1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7762],{1150:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return u}});let n=t(95155),i=t(12115),a=t(24437);function o(e){return{default:e&&"default"in e?e.default:e}}t(36552);let s={loader:()=>Promise.resolve(o(()=>null)),loading:null,ssr:!0},u=function(e){let r={...s,...e},t=(0,i.lazy)(()=>r.loader().then(o)),u=r.loading;function l(e){let o=u?(0,n.jsx)(u,{isLoading:!0,pastDelay:!0,error:null}):null,s=!r.ssr||!!r.loading,l=s?i.Suspense:i.Fragment,c=r.ssr?(0,n.jsxs)(n.Fragment,{children:[null,(0,n.jsx)(t,{...e})]}):(0,n.jsx)(a.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(t,{...e})});return(0,n.jsx)(l,{...s?{fallback:o}:{},children:c})}return l.displayName="LoadableComponent",l}},8567:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorage",{enumerable:!0,get:function(){return n.workAsyncStorageInstance}});let n=t(17828)},13905:function(e,r,t){var n;!function(e,i,a){function o(e){var r=this,t="";r.next=function(){var e=r.b,t=r.c,n=r.d,i=r.a;return e=e<<25^e>>>7^t,t=t-n|0,n=n<<24^n>>>8^i,i=i-e|0,r.b=e=e<<20^e>>>12^t,r.c=t=t-n|0,r.d=n<<16^t>>>16^i,r.a=i-e|0},r.a=0,r.b=0,r.c=-0x61c88647,r.d=0x517cc1b7,e===Math.floor(e)?(r.a=e/0x100000000|0,r.b=0|e):t+=e;for(var n=0;n<t.length+20;n++)r.b^=t.charCodeAt(n),r.next()}function s(e,r){return r.a=e.a,r.b=e.b,r.c=e.c,r.d=e.d,r}function u(e,r){var t=new o(e),n=r&&r.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var e=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=t.next,i.quick=i,n&&("object"==typeof n&&s(n,t),i.state=function(){return s(t,{})}),i}i&&i.exports?i.exports=u:t.amdD&&t.amdO?void 0===(n=(function(){return u}).call(r,t,r,i))||(i.exports=n):this.tychei=u}(0,e=t.nmd(e),t.amdD)},15239:(e,r,t)=>{"use strict";t.d(r,{default:()=>i.a});var n=t(54652),i=t.n(n)},17828:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,t(64054).createAsyncLocalStorage)()},19452:e=>{e.exports=function e(r,t){"use strict";var n,i,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,l=/^0/,c=function(r){return e.insensitive&&(""+r).toLowerCase()||""+r},f=c(r).replace(o,"")||"",m=c(t).replace(o,"")||"",p=f.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=m.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(f.match(u),16)||1!==p.length&&f.match(s)&&Date.parse(f),g=parseInt(m.match(u),16)||d&&m.match(s)&&Date.parse(m)||null;if(g){if(d<g)return -1;else if(d>g)return 1}for(var v=0,y=Math.max(p.length,h.length);v<y;v++){if(n=!(p[v]||"").match(l)&&parseFloat(p[v])||p[v]||0,i=!(h[v]||"").match(l)&&parseFloat(h[v])||h[v]||0,isNaN(n)!==isNaN(i))return isNaN(n)?1:-1;if(typeof n!=typeof i&&(n+="",i+=""),n<i)return -1;if(n>i)return 1}return 0}},20063:(e,r,t)=>{"use strict";var n=t(47260);t.o(n,"usePathname")&&t.d(r,{usePathname:function(){return n.usePathname}}),t.o(n,"useRouter")&&t.d(r,{useRouter:function(){return n.useRouter}}),t.o(n,"useSearchParams")&&t.d(r,{useSearchParams:function(){return n.useSearchParams}})},24437:(e,r,t)=>{"use strict";function n(e){let{reason:r,children:t}=e;return t}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return n}}),t(24553)},33235:function(e,r,t){var n;!function(e,i,a){function o(e){var r=this,t="";r.next=function(){var e=r.x^r.x>>>2;return r.x=r.y,r.y=r.z,r.z=r.w,r.w=r.v,(r.d=r.d+362437|0)+(r.v=r.v^r.v<<4^(e^e<<1))|0},r.x=0,r.y=0,r.z=0,r.w=0,r.v=0,e===(0|e)?r.x=e:t+=e;for(var n=0;n<t.length+64;n++)r.x^=t.charCodeAt(n),n==t.length&&(r.d=r.x<<10^r.x>>>4),r.next()}function s(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r.v=e.v,r.d=e.d,r}function u(e,r){var t=new o(e),n=r&&r.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var e=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=t.next,i.quick=i,n&&("object"==typeof n&&s(n,t),i.state=function(){return s(t,{})}),i}i&&i.exports?i.exports=u:t.amdD&&t.amdO?void 0===(n=(function(){return u}).call(r,t,r,i))||(i.exports=n):this.xorwow=u}(0,e=t.nmd(e),t.amdD)},33861:(e,r,t)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.d(r,{A:()=>n})},35508:function(e,r,t){var n;!function(e,i,a){function o(e){var r,t=this,n=(r=0xefc8249d,function(e){e=String(e);for(var t=0;t<e.length;t++){var n=.02519603282416938*(r+=e.charCodeAt(t));r=n>>>0,n-=r,n*=r,r=n>>>0,n-=r,r+=0x100000000*n}return(r>>>0)*23283064365386963e-26});t.next=function(){var e=2091639*t.s0+23283064365386963e-26*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=e-(t.c=0|e)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(e),t.s0<0&&(t.s0+=1),t.s1-=n(e),t.s1<0&&(t.s1+=1),t.s2-=n(e),t.s2<0&&(t.s2+=1)}function s(e,r){return r.c=e.c,r.s0=e.s0,r.s1=e.s1,r.s2=e.s2,r}function u(e,r){var t=new o(e),n=r&&r.state,i=t.next;return i.int32=function(){return 0x100000000*t.next()|0},i.double=function(){return i()+(2097152*i()|0)*11102230246251565e-32},i.quick=i,n&&("object"==typeof n&&s(n,t),i.state=function(){return s(t,{})}),i}i&&i.exports?i.exports=u:t.amdD&&t.amdO?void 0===(n=(function(){return u}).call(r,t,r,i))||(i.exports=n):this.alea=u}(0,e=t.nmd(e),t.amdD)},36552:(e,r,t)=>{"use strict";function n(e){let{moduleIds:r}=e;return null}
1Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return n}}),t(95155),t(47650),t(8567),t(77278)},40092:e=>{"use strict";var r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},t={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},n={"â":"\\--","â":"\\---"," ":"~"," ":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"};e.exports=function(e){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.preserveFormatting,o=i.escapeMapFn,s=String(e),u="",l=(void 0===o?function(e,t){return r({},e,t)}:o)(r({},t),void 0!==a&&a?r({},n):{}),c=Object.keys(l);s;)!function(){var e=!1;c.forEach(function(r,t){!e&&s.length>=r.length&&s.slice(0,r.length)===r&&(u+=l[c[t]],s=s.slice(r.length,s.length),e=!0)}),e||(u+=s.slice(0,1),s=s.slice(1,s.length))}();return u}},46647:(e,r,t)=>{"use strict";t.d(r,{_3:()=>be});var n=t(88945),i={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null},a=function(e){if(e)throw Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(i)};function o(e){var r=typeof e;if("number"===r||"bigint"===r||"string"===r||"boolean"===r||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map(function(e){return o(e)});if(e instanceof Date)return new Date(e.valueOf());if(D(e))return e;if(U(e)){var t=e,n=o,i={};for(var a in t)l(t,a)&&(i[a]=n(t[a]));return i}if("function"===r)return e;throw TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function s(e,r){for(var t in r)l(r,t)&&(e[t]=r[t]);return e}function u(e,r){var t,n,i;if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(n=0,i=e.length;n<i;n++)if(!u(e[n],r[n]))return!1;return!0}if("function"==typeof e)return e===r;if(!(e instanceof Object))return e===r;if(Array.isArray(r)||!(r instanceof Object))return!1;for(t in e)if(!(t in r)||!u(e[t],r[t]))return!1;for(t in r)if(!(t in e))return!1;return!0}function l(e,r){return e&&Object.hasOwnProperty.call(e,r)}function c(e,r){if(m(e,r))return e[r];if("function"==typeof e[r]&&p(e,r))throw Error('Cannot access method "'+r+'" as a property');throw Error('No access to property "'+r+'"')}function f(e,r,t){if(m(e,r))return e[r]=t,t;throw Error('No access to property "'+r+'"')}function m(e,r){var t;return(!!("object"==typeof(t=e)&&t&&t.constructor===Object)||!!Array.isArray(e))&&(!!l(h,r)||!(r in Object.prototype)&&!(r in Function.prototype))}function p(e,r){return!(null==e||"function"!=typeof e[r]||l(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e))&&(!!l(d,r)||!(r in Object.prototype)&&!(r in Function.prototype))}(0,n.A)(a,i,{MATRIX_OPTIONS:["Matrix","Array"],NUMBER_OPTIONS:["number","BigNumber","bigint","Fraction"]});var h={length:!0,name:!0},d={toString:!0,valueOf:!0,toLocaleString:!0};class g{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter(e=>this.has(e)).values()}get(e){return c(this.wrappedObject,e)}set(e,r){return f(this.wrappedObject,e,r),this}has(e){return m(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return y(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){m(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class v{constructor(e,r,t){this.a=e,this.b=r,this.bKeys=t,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,r){return this.bKeys.has(e)?this.b.set(e,r):this.a.set(e,r),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return y(this.keys(),e=>[e,this.get(e)])}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function y(e,r){return{next:()=>{var t=e.next();return t.done?t:{value:r(t.value),done:!1}}}}function x(){return new Map}function b(e){if(!e)return x();if(L(e))return e;if(U(e))return new g(e);throw Error("createMap can create maps from objects or Maps")}function w(e){return"number"==typeof e}function D(e){return!!e&&"object"==typeof e&&"function"==typeof e.constructor&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function N(e){return"bigint"==typeof e}function E(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function A(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function C(e){return e&&!0===e.constructor.prototype.isUnit||!1}function S(e){return"string"==typeof e}var M=Array.isArray;function F(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function T(e){return Array.isArray(e)||F(e)}function B(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function O(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function _(e){return e&&!0===e.constructor.prototype.isRange||!1}function z(e){return e&&!0===e.constructor.prototype.isIndex||!1}function k(e){return"boolean"==typeof e}function I(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function R(e){return e&&!0===e.constructor.prototype.isHelp||!1}function q(e){return"function"==typeof e}function P(e){return e instanceof Date}function j(e){return e instanceof RegExp}function U(e){return!!(e&&"object"==typeof e&&e.constructor===Object&&!E(e)&&!A(e))}function L(e){return!!e&&(e instanceof Map||e instanceof g||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function $(e){return null===e}function H(e){return void 0===e}function G(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function Z(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function V(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function W(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function J(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function Y(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function X(e){return Y(e)||en(e)&&1===e.args.length&&Y(e.args[0])&&"-+~".includes(e.op)}function Q(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function K(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function ee(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function er(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function et(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function en(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ei(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function ea(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function eo(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function es(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function eu(e){return e&&!0===e.constructor.prototype.isChain||!1}function el(e){var r=typeof e;return"object"===r?null===e?"null":D(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}var ec=new Set(["end"]);function ef(e,r,t,n){function i(n){var i=function(e,r){for(var t={},n=0;n<r.length;n++){var i=r[n],a=e[i];void 0!==a&&(t[i]=a)}return t}(n,r.map(em));return function(e,r,t){if(!r.filter(e=>{var r;return!((r=e)&&"?"===r[0])}).every(e=>void 0!==t[e])){var n=r.filter(e=>void 0===t[e]);throw Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(n.map(e=>'"'.concat(e,'"')).join(", "),"."))}}(e,r,n),t(i)}return i.isFactory=!0,i.fn=e,i.dependencies=r.slice().sort(),n&&(i.meta=n),i}function em(e){return e&&"?"===e[0]?e.slice(1):e}var ep=ef("Node",["mathWithTransform"],e=>{var{mathWithTransform:r}=e;
1class t{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){var e=this._compile(r,{}),t={};return{evaluate:function(r){var n=b(r);for(var i of[...ec])if(n.has(i))throw Error('Scope contains an illegal symbol, "'+i+'" is a reserved keyword');return e(n,t,null)}}}_compile(e,r){throw Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw Error("Cannot run forEach on a Node interface")}map(e){throw Error("Cannot run map on a Node interface")}_ifNode(e){if(!er(e))throw TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),!function e(r,t){r.forEach(function(r,n,i){t(r,n,i),e(r,t)})}(this,e)}transform(e){return function r(t,n,i){var a=e(t,n,i);return a!==t?a:t.map(r)}(this,null,null)}filter(e){var r=[];return this.traverse(function(t,n,i){e(t,n,i)&&r.push(t)}),r}clone(){throw Error("Cannot clone a Node interface")}cloneDeep(){return this.map(function(e){return e.cloneDeep()})}equals(e){return!!e&&this.type===e.type&&u(this,e)}toString(e){var r=this._getCustomString(e);return void 0!==r?r:this._toString(e)}_toString(){throw Error("_toString not implemented for "+this.type)}toJSON(){throw Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){var r=this._getCustomString(e);return void 0!==r?r:this._toHTML(e)}_toHTML(){throw Error("_toHTML not implemented for "+this.type)}toTex(e){var r=this._getCustomString(e);return void 0!==r?r:this._toTex(e)}_toTex(e){throw Error("_toTex not implemented for "+this.type)}_getCustomString(e){if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}return t},{isClass:!0,isNode:!0}),eh=t(86779);function ed(e,r,t){return(r=(0,eh.A)(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function eg(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function ev(e,r){if("bigint"===r.number)try{BigInt(e)}catch(e){return r.numberFallback}return r.number}var ey=Math.sign||function(e){return e>0?1:e<0?-1:0},ex=Math.log2||function(e){return Math.log(e)/Math.LN2},eb=Math.log10||function(e){return Math.log(e)/Math.LN10},ew=Math.log1p||function(e){return Math.log(e+1)},eD=Math.cbrt||function(e){if(0===e)return e;var r,t=e<0;return t&&(e=-e),isFinite(e)?(r=Math.exp(Math.log(e)/3),r=(e/(r*r)+2*r)/3):r=e,t?-r:r},eN=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function eE(e,r,t){var n="";if(t){if(t<1)throw Error("size must be in greater than 0");if(!eg(t))throw Error("size must be an integer");if(e>2**(t-1)-1||e<-(2**(t-1)))throw Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!eg(e))throw Error("Value must be an integer");e<0&&(e+=2**t),n="i".concat(t)}var i="";return e<0&&(e=-e,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[r]).concat(e.toString(r)).concat(n)}function eA(e,r){if("function"==typeof r)return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:t,precision:n,wordSize:i}=eC(r);switch(t){case"fixed":return eM(e,n);case"exponential":return eF(e,n);case"engineering":return function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=eT(eS(e),r),n=t.exponent,i=t.coefficients,a=n%3==0?n:n<0?n-3-n%3:n-n%3;if(w(r))for(;r>i.length||n-a+1>i.length;)i.push(0);else for(var o=Math.abs(n-a)-(i.length-1),s=0;s<o;s++)i.push(0);for(var u=Math.abs(n-a),l=1;u>0;)l++,u--;var c=i.slice(l).join(""),f=w(r)&&c.length||c.match(/[1-9]/)?"."+c:"",m=i.slice(0,l).join("")+f+"e"+(n>=0?"+":"")+a.toString();return t.sign+m}(e,n);case"bin":return eE(e,2,i);case"oct":return eE(e,8,i);case"hex":return eE(e,16,i);case"auto":return(function(e,r,t){if(isNaN(e)||!isFinite(e))return String(e);var n=ej(null==t?void 0:t.lowerExp,-3),i=ej(null==t?void 0:t.upperExp,5),a=eS(e),o=r?eT(a,r):a;if(o.exponent<n||o.exponent>=i)return eF(e,r);var s=o.coefficients,u=o.exponent;s.length<r&&(s=s.concat(eB(r-s.length))),s=s.concat(eB(u-s.length+1+(s.length<r?r-s.length:0))),s=eB(-u).concat(s);var l=u>0?u:0;return l<s.length-1&&s.splice(l+1,0,"."),o.sign+s.join("")})(e,n,r).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r});default:throw Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function eC(e){var r,t,n="auto";if(void 0!==e)if(w(e))r=e;else if(D(e))r=e.toNumber();else if(U(e))void 0!==e.precision&&(r=eP(e.precision,()=>{throw Error('Option "precision" must be a number or BigNumber')})),void 0!==e.wordSize&&(t=eP(e.wordSize,()=>{throw Error('Option "wordSize" must be a number or BigNumber')})),e.notation&&(n=e.notation);else throw Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:n,precision:r,wordSize:t}}function eS(e){var r=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw SyntaxError("Invalid number "+e);var t=r[1],n=r[2],i=parseFloat(r[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===o.length&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function eM(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=eS(e),n="number"==typeof r?eT(t,t.exponent+1+r):t,i=n.coefficients,a=n.exponent+1,o=a+(r||0);return i.length<o&&(i=i.concat(eB(o-i.length))),a<0&&(i=eB(-a+1).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}function eF(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=eS(e),n=r?eT(t,r):t,i=n.coefficients,a=n.exponent;i.length<r&&(i=i.concat(eB(r-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function eT(e,r){for(var t={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=t.coefficients;r<=0;)n.unshift(0),t.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),t.exponent++,i++),i--,n[i]++}return t}function eB(e){for(var r=[],t=0;t<e;t++)r.push(0);return r}function eO(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-8,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(t<=0)throw Error("Relative tolerance must be greater than 0");if(n<0)throw Error("Absolute tolerance must be at least 0");return!(isNaN(e)||isNaN(r))&&(isFinite(e)&&isFinite(r)?e===r||Math.abs(e-r)<=Math.max(t*Math.max(Math.abs(e),Math.abs(r)),n):e===r)}var e_=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},ez=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},ek=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},eI=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},eR=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},eq=Math.tanh||function(e){var r=Math.exp(2*e);return(r-1)/(r+1)};function eP(e,r){return w(e)?e:D(e)?e.toNumber():void r()}function ej(e,r){return w(e)?e:D(e)?e.toNumber():r}function eU(e,r,t){var n=new e.constructor(2),i="";if(t){if(t<1)throw Error("size must be in greater than 0");if(!eg(t))throw Error("size must be an integer");if(e.greaterThan(n.pow(t-1).sub(1))||e.lessThan(n.pow(t-1).mul(-1)))throw Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!e.isInteger())throw Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(t))),i="i".concat(t)}switch(r){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw Error("Base ".concat(r," not supported "))}}function eL(e,r){return void 0!==r?e.toExponential(r-1):e.toExponential()}function e$(e,r){return w(e)?e:D(e)?e.toNumber():r}function eH(e,r){var t=function(e,r){var t;if("number"==typeof e)return eA(e,r);if(D(e))return function(e,r){if("function"==typeof r)return r(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var t,n,i,a,o,s,u,{notation:l,precision:c,wordSize:f}=eC(r);switch(l){case"fixed":return t=e,n=c,t.toFixed(n);case"exponential":return eL(e,c);case"engineering":return i=e,a=c,s=(o=i.e)%3==0?o:o<0?o-3-o%3:o-o%3,(u=i.mul(Math.pow(10,-s)).toPrecision(a)).includes("e")&&(u=new i.constructor(u).toFixed()),u+"e"+(o>=0?"+":"")+s.toString();case"bin":return eU(e,2,f);case"oct":return eU(e,8,f);case"hex":return eU(e,16,f);case"auto":var m=e$(null==r?void 0:r.lowerExp,-3),p=e$(null==r?void 0:r.upperExp,5);if(e.isZero())return"0";var h=e.toSignificantDigits(c),d=h.e;return(d>=m&&d<p?h.toFixed():eL(e,c)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r});default:throw Error('Unknown notation "'+l+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,r);if((t=e)&&"object"==typeof t&&"bigint"==typeof t.s&&"bigint"==typeof t.n&&"bigint"==typeof t.d)if(!r||"decimal"!==r.fraction)return"".concat(e.s*e.n,"/").concat(e.d);else return e.toString();if(Array.isArray(e))return function e(r,t){if(!Array.isArray(r))return eH(r,t);for(var n="[",i=r.length,a=0;a<i;a++)0!==a&&(n+=", "),n+=e(r[a],t);return n+"]"}(e,r);if(S(e))return eG(e);if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e)if("function"==typeof e.format)return e.format(r);else return e&&e.toString(r)!==({}).toString()?e.toString(r):"{"+Object.keys(e).map(t=>eG(t)+": "+eH(e[t],r)).join(", ")+"}";return String(e)}(e,r);return r&&"object"==typeof r&&"truncate"in r&&t.length>r.truncate?t.substring(0,r.truncate-3)+"...":t}function eG(e){for(var r=String(e),t="",n=0;n<r.length;){var i=r.charAt(n);t+=i in eZ?eZ[i]:i,n++}return'"'+t+'"'}var eZ={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function eV(e){var r=String(e);return r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function eW(e,r){if(!S(e))throw TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+el(e)+", index: 0)");if(!S(r))throw TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+el(r)+", index: 1)");return e===r?0:e>r?1:-1}var eJ="ObjectNode",eY=ef(eJ,["Node"],e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every(function(r){return er(e[r])})))throw TypeError("Object containing Nodes expected")}get type(){return eJ}get isObjectNode(){return!0}_compile(e,r){var t={};for(var n in this.properties)if(l(this.properties,n)){var i=JSON.parse(eG(n)),a=c(this.properties,n);t[i]=a._compile(e,r)}return function(e,r,n){var i={};for(var a in t)l(t,a)&&(i[a]=t[a](e,r,n));return i}}forEach(e){for(var r in this.properties)l(this.properties,r)&&e(this.properties[r],"properties["+eG(r)+"]",this)}map(e){var r={};for(var n in this.properties)l(this.properties,n)&&(r[n]=this._ifNode(e(this.properties[n],"properties["+eG(n)+"]",this)));return new t(r)}clone(){var e={};for(var r in this.properties)l(this.properties,r)&&(e[r]=this.properties[r]);return new t(e)}_toString(e){var r=[];for(var t in this.properties)l(this.properties,t)&&r.push(eG(t)+": "+this.properties[t].toString(e));return"{"+r.join(", ")+"}"}toJSON(){return{mathjs:eJ,properties:this.properties}}static fromJSON(e){return new t(e.properties)}_toHTML(e){var r=[];for(var t in this.properties)l(this.properties,t)&&r.push('<span class="math-symbol math-property">'+eV(t)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[t].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(e){var r=[];for(var t in this.properties)l(this.properties,t)&&r.push("\\mathbf{"+t+":} & "+this.properties[t].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+r.join("\n")+"\\end{array}\\right\\}"}}return ed(t,"name",eJ),t},{isClass:!0,isNode:!0});function eX(e,r,t){if(!(this instanceof eX))throw SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=r,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=Error().stack}function eQ(e,r,t){if(!(this instanceof eQ))throw SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=t),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 eK(e){for(var r=[];Array.isArray(e);)r.push(e.length),e=e[0];return r}function e0(e,r){if(0===r.length){if(Array.isArray(e))throw new eX(e.length,0)}else!function e(r,t,n){var i,a=r.length;if(a!==t[n])throw new eX(a,t[n]);if(n<t.length-1){var o=n+1;for(i=0;i<a;i++){if(!Array.isArray(r[i]))throw new eX(t.length-1,t.length,"<");e(r[i],t,o)}}else for(i=0;i<a;i++)if(Array.isArray(r[i]))throw new eX(t.length+1,t.length,">")}(e,r,0)}function e1(e,r){var t=e.isMatrix?e._size:eK(e);r._sourceSize.forEach((e,r)=>{if(null!==e&&e!==t[r])throw new eX(e,t[r])})}function e2(e,r){if(void 0!==e){if(!w(e)||!eg(e))throw TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof r&&e>=r)throw new eQ(e,r)}}function e3(e){for(var r=0;r<e._dimensions.length;++r){var t=e._dimensions[r];
1if(t._data&&M(t._data)){if(0===t._size[0])return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(S(t)&&0===t.length)return!0}return!1}function e5(e,r,t){if(!Array.isArray(r))throw TypeError("Array expected");if(0===r.length)throw Error("Resizing to scalar is not supported");return r.forEach(function(e){if(!w(e)||!eg(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+eH(r)+")")}),(w(e)||D(e))&&(e=[e]),function e(r,t,n,i){var a,o,s=r.length,u=t[n],l=Math.min(s,u);if(r.length=u,n<t.length-1){var c=n+1;for(a=0;a<l;a++)Array.isArray(o=r[a])||(o=[o],r[a]=o),e(o,t,c,i);for(a=l;a<u;a++)o=[],r[a]=o,e(o,t,c,i)}else{for(a=0;a<l;a++)for(;Array.isArray(r[a]);)r[a]=r[a][0];for(a=l;a<u;a++)r[a]=i}}(e,r,0,void 0!==t?t:0),e}function e4(e,r){var t=re(e,!0),n=t.length;if(!Array.isArray(e)||!Array.isArray(r))throw TypeError("Array expected");if(0===r.length)throw new eX(0,n,"!=");var i=e6(r=e8(r,n));if(n!==i)throw new eX(i,n,"!=");try{return function(e,r){for(var t,n=e,i=r.length-1;i>0;i--){var a=r[i];t=[];for(var o=n.length/a,s=0;s<o;s++)t.push(n.slice(s*a,(s+1)*a));n=t}return n}(t,r)}catch(e){if(e instanceof eX)throw new eX(i,n,"!=");throw e}}function e8(e,r){var t=e6(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(r%t==0)n[i]=-r/t;else throw Error("Could not replace wildcard, since "+r+" is no multiple of "+-t);return n}function e6(e){return e.reduce((e,r)=>e*r,1)}function e7(e,r){for(var t=r||eK(e);Array.isArray(e)&&1===e.length;)e=e[0],t.shift();for(var n=t.length;1===t[n-1];)n--;return n<t.length&&(e=function e(r,t,n){var i,a;if(n<t){var o=n+1;for(i=0,a=r.length;i<a;i++)r[i]=e(r[i],t,o)}else for(;Array.isArray(r);)r=r[0];return r}(e,n,0),t.length=n),e}function e9(e,r,t,n){var i=n||eK(e);if(t)for(var a=0;a<t;a++)e=[e],i.unshift(1);for(e=function e(r,t,n){var i,a;if(Array.isArray(r)){var o=n+1;for(i=0,a=r.length;i<a;i++)r[i]=e(r[i],t,o)}else for(var s=n;s<t;s++)r=[r];return r}(e,r,0);i.length<r;)i.push(1);return e}function re(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!Array.isArray(e))return e;if("boolean"!=typeof r)throw TypeError("Boolean expected for second argument of flatten");var t=[];return r?function e(r){if(Array.isArray(r[0]))for(var n=0;n<r.length;n++)e(r[n]);else for(var i=0;i<r.length;i++)t.push(r[i])}(e):function e(r){for(var n=0;n<r.length;n++){var i=r[n];Array.isArray(i)?e(i):t.push(i)}}(e),t}function rr(e,r){return Array.prototype.map.call(e,r)}function rt(e,r){Array.prototype.forEach.call(e,r)}function rn(e,r){if(1!==eK(e).length)throw Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,r)}function ri(e,r){if(1!==eK(e).length)throw Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,e=>r.test(e))}function ra(e,r){return Array.prototype.join.call(e,r)}function ro(e){if(!Array.isArray(e))throw TypeError("Array input expected");if(0===e.length)return e;var r=[],t=0;r[0]={value:e[0],identifier:0};for(var n=1;n<e.length;n++)e[n]===e[n-1]?t++:t=0,r.push({value:e[n],identifier:t});return r}function rs(e){if(!Array.isArray(e))throw TypeError("Array input expected");if(0===e.length)return e;for(var r=[],t=0;t<e.length;t++)r.push(e[t].value);return r}function ru(e,r){for(var t,n=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(0===i&&o&&(n=a.length),o&&a.length!==n)return;var s=o?ru(a,r):r(a);if(void 0===t)t=s;else if(t!==s)return"mixed"}return t}function rl(){var e=Array.prototype.slice.call(arguments,0,-1),r=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce(function(e,t){return function e(r,t,n,i){if(!(i<n))return r.concat(t);if(r.length!==t.length)throw new eX(r.length,t.length);for(var a=[],o=0;o<r.length;o++)a[o]=e(r[o],t[o],n,i+1);return a}(e,t,r,0)},e[0]);throw Error("Wrong number of arguments in function concat")}function rc(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];for(var n=r.map(e=>e.length),i=Math.max(...n),a=Array(i).fill(null),o=0;o<r.length;o++)for(var s=r[o],u=n[o],l=0;l<u;l++){var c=i-u+l;s[l]>a[c]&&(a[c]=s[l])}for(var f=0;f<r.length;f++)rf(r[f],a);return a}function rf(e,r){for(var t=r.length,n=e.length,i=0;i<n;i++){var a=t-n+i;if(e[i]<r[a]&&e[i]>1||e[i]>r[a])throw Error("shape mismatch: mismatch is found in arg with shape (".concat(e,")
1not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(r[a]))}}function rm(e,r){var t,i,a,o,s=eK(e);if(u(s,r))return e;rf(s,r);var l=rc(s,r),c=l.length,f=[...Array(c-s.length).fill(1),...s],m=(t=e,(0,n.A)([],t));s.length<c&&(s=eK(m=e4(m,f)));for(var p=0;p<c;p++){s[p]<l[p]&&(s=eK((i=m,a=l[p],o=p,m=rl(...Array(a).fill(i),o))))}return m}function rp(e,r){if(!Array.isArray(e))throw Error("Array expected");var t=eK(e);if(r.length!==t.length)throw new eX(r.length,t.length);for(var n=0;n<r.length;n++)e2(r[n],t[n]);return r.reduce((e,r)=>e[r],e)}function rh(e,r){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0===e.length)return[];if(t)return function e(t){if(!Array.isArray(t))return r(t);for(var n=t.length,i=Array(n),a=0;a<n;a++)i[a]=e(t[a]);return i}(e);var n=[];return function t(i,a){if(!Array.isArray(i))return r(i,n.slice(0,a),e);for(var o=i.length,s=Array(o),u=0;u<o;u++)n[a]=u,s[u]=t(i[u],a+1);return s}(e,0)}function rd(e,r){var t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(0!==e.length){if(t)return void function e(t){if(Array.isArray(t))for(var n=t.length,i=0;i<n;i++)e(t[i]);else r(t)}(e);var n=[];!function t(i,a){if(Array.isArray(i))for(var o=i.length,s=0;s<o;s++)n[a]=s,t(i[s],a+1);else r(i,n.slice(0,a),e)}(e,0)}}function rg(e,r){return new v(e,new g(r),new Set(Object.keys(r)))}eX.prototype=RangeError(),eX.prototype.constructor=RangeError,eX.prototype.name="DimensionError",eX.prototype.isDimensionError=!0,eQ.prototype=RangeError(),eQ.prototype.constructor=RangeError,eQ.prototype.name="IndexError",eQ.prototype.isIndexError=!0;var rv=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:nullish":{op:"??",associativity:"left",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function ry(e,r){if(!r||"auto"!==r)return e;for(var t=e;ei(t);)t=t.content;return t}function rx(e,r,t,n){var i=e;"keep"!==r&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<rv.length;
1s++)if(a in rv[s]){o=s;break}if("OperatorNode:multiply"===a&&i.implicit&&"show"!==t){var u=ry(i.args[0],r);Y(u)&&n&&"OperatorNode:divide"===n.getIdentifier()&&X(ry(n.args[0],r))||"OperatorNode:divide"===u.getIdentifier()&&X(ry(u.args[0],r))&&Y(ry(u.args[1]))||(o+=1)}return o}function rb(e,r){var t=e;"keep"!==r&&(t=e.getContent());var n=t.getIdentifier(),i=rx(t,r);if(null===i)return null;var a=rv[i][n];if(l(a,"associativity")){if("left"===a.associativity)return"left";if("right"===a.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function rw(e,r,t){var n="keep"!==t?e.getContent():e,i="keep"!==t?e.getContent():r,a=n.getIdentifier(),o=i.getIdentifier(),s=rx(n,t);if(null===s)return null;var u=rv[s][a];if(l(u,"associativeWith")&&u.associativeWith instanceof Array){for(var c=0;c<u.associativeWith.length;c++)if(u.associativeWith[c]===o)return!0;return!1}return null}var rD=t(40092),rN={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},rE={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},rA={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(rE.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(rE.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(rE.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(rE.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(rE.pow,"{${args[0]}}-1\\right)"),fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},fraction:{2:"\\frac{${args[0]}}{${args[1]}}"},gcd:"\\gcd\\left(${args}\\right)",hypot:"\\hypot\\left(${args}\\right)",log:{1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},log10:{1:"\\log_{10}\\left(${args[0]}\\right)"},log1p:{1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},log2:"\\log_{2}\\left(${args[0]}\\right)",mod:{2:"\\left(${args[0]}".concat(rE.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(rE.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : y^${args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(rE.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(rE.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(rE.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(rE.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(rE.bitAnd,"${args[1]}\\right)")},bitNot:{1:rE.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(rE.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(rE.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(rE.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(rE.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(rE.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(rE.and,"${args[1]}\\right)")},not:{1:rE.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(rE.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(rE.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}
1\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(rE.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(rE.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(rE.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(rE.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(rE.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(rE.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(rE.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(rE.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(rE.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(rE.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(rE.to,"${args[1]}\\right)")},numeric:function(e,r){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(rN.i,"\\cdot\\left(${args[1]}\\right)\\right)")},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},rC={deg:"^\\circ"};function rS(e){return rD(e,{preserveFormatting:!0})}function rM(e,r){return(r=void 0!==r&&r)?l(rC,e)?rC[e]:"\\mathrm{"+rS(e)+"}":l(rN,e)?rN[e]:rS(e)}var rF="OperatorNode",rT=ef(rF,["Node"],e=>{var{Node:r}=e;function t(e,r,t,n,i){var a=rx(e,r,t),o=rb(e,r);if("all"===r||n.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return n.map(function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});switch(n.length){case 0:s=[];break;case 1:var s,u,l,c=rx(n[0],r,t,e);if(i&&null!==c&&("keep"===r?(u=n[0].getIdentifier(),l=e.getIdentifier()):(u=n[0].getContent().getIdentifier(),l=e.getContent().getIdentifier()),!1===rv[a][l].latexLeftParens||!1===rv[c][u].latexParens)||null===c){s=[!1];break}if(c<=a){s=[!0];break}s=[!1];break;case 2:var f,m,p,h,d,g=rx(n[0],r,t,e),v=rw(e,n[0],r);f=null!==g&&(g===a&&"right"===o&&!v||g<a);var y=rx(n[1],r,t,e),x=rw(e,n[1],r);m=null!==y&&(y===a&&"left"===o&&!x||y<a),i&&("keep"===r?(p=e.getIdentifier(),h=e.args[0].getIdentifier(),d=e.args[1].getIdentifier()):(p=e.getContent().getIdentifier(),h=e.args[0].getContent().getIdentifier(),d=e.args[1].getContent().getIdentifier()),null!==g&&(!1===rv[a][p].latexLeftParens&&(f=!1),!1===rv[g][h].latexParens&&(f=!1)),null!==y&&(!1===rv[a][p].latexRightParens&&(m=!1),!1===rv[y][d].latexParens&&(m=!1))),s=[f,m];break;default:("OperatorNode:add"===e.getIdentifier()||"OperatorNode:multiply"===e.getIdentifier())&&(s=n.map(function(n){var i=rx(n,r,t,e),s=rw(e,n,r),u=rb(n,r);if(null===i);else if(a===i&&o===u&&!s)return!0;else if(i<a)return!0;return!1}))}if(n.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==r&&"hide"===t)for(var b=1;b<s.length;++b)!function e(r,t){var n=r;if("auto"===t)for(;ei(n);)n=n.content;return!!Y(n)||!!en(n)&&e(n.args[0],t)}(n[b],r)||s[b-1]||"keep"===r&&ei(n[b-1])||(s[b]=!0);return s}class n extends r{constructor(e,r,t,n,i){if(super(),"string"!=typeof e)throw TypeError('string expected for parameter "op"');if("string"!=typeof r)throw TypeError('string expected for parameter "fn"');if(!Array.isArray(t)||!t.every(er))throw TypeError('Array containing Nodes expected for parameter "args"');
1this.implicit=!0===n,this.isPercentage=!0===i,this.op=e,this.fn=r,this.args=t||[]}get type(){return rF}get isOperatorNode(){return!0}_compile(e,r){if("string"!=typeof this.fn||!p(e,this.fn))if(e[this.fn])throw Error('No access to function "'+this.fn+'"');else throw Error("Function "+this.fn+' missing in provided namespace "math"');var t=c(e,this.fn),n=rr(this.args,function(t){return t._compile(e,r)});if("function"==typeof t&&!0===t.rawArgs){var i=this.args;return function(r,n,a){return t(i,e,rg(r,n))}}if(1===n.length){var a=n[0];return function(e,r,n){return t(a(e,r,n))}}if(2!==n.length)return function(e,r,i){return t.apply(null,rr(n,function(t){return t(e,r,i)}))};var o=n[0],s=n[1];return function(e,r,n){return t(o(e,r,n),s(e,r,n))}}forEach(e){for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)}map(e){for(var r=[],t=0;t<this.args.length;t++)r[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new n(this.op,this.fn,r,this.implicit,this.isPercentage)}clone(){return new n(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return 1===this.args.length}isBinary(){return 2===this.args.length}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,a=t(this,r,n,i,!1);if(1===i.length){var o=rb(this,r),s=i[0].toString(e);a[0]&&(s="("+s+")");var u=/[a-zA-Z]+/.test(this.op);return"right"===o?this.op+(u?" ":"")+s:"left"===o?s+(u?" ":"")+this.op:s+this.op}if(2===i.length){var l=i[0].toString(e),c=i[1].toString(e);return(a[0]&&(l="("+l+")"),a[1]&&(c="("+c+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n)?l+" "+c:l+" "+this.op+" "+c}if(!(i.length>2)||"OperatorNode:add"!==this.getIdentifier()&&"OperatorNode:multiply"!==this.getIdentifier())return this.fn+"("+this.args.join(", ")+")";var f=i.map(function(r,t){return r=r.toString(e),a[t]&&(r="("+r+")"),r});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?f.join(" "):f.join(" "+this.op+" ")}toJSON(){return{mathjs:rF,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new n(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){var r=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,a=t(this,r,n,i,!1);if(1===i.length){var o=rb(this,r),s=i[0].toHTML(e);return(a[0]&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===o)?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+eV(this.op)+"</span>
1"+s:s+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+eV(this.op)+"</span>"}if(2===i.length){var u=i[0].toHTML(e),l=i[1].toHTML(e);return(a[0]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),a[1]&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n)?u+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+l:u+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+eV(this.op)+"</span>"+l}var c=i.map(function(r,t){return r=r.toHTML(e),a[t]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r});return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?c.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):c.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+eV(this.op)+"</span>"):'<span class="math-function">'+eV(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}_toTex(e){var r=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,a=t(this,r,n,i,!0),o=rE[this.fn];if(o=void 0===o?this.op:o,1===i.length){var s=rb(this,r),u=i[0].toTex(e);return(a[0]&&(u="\\left(".concat(u,"\\right)")),"right"===s)?o+u:u+o}if(2===i.length){var l,c=i[0],f=c.toTex(e);a[0]&&(f="\\left(".concat(f,"\\right)"));var m=i[1].toTex(e);switch(a[1]&&(m="\\left(".concat(m,"\\right)")),l="keep"===r?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+f+"}{"+m+"}";case"OperatorNode:pow":switch(f="{"+f+"}",m="{"+m+"}",l){case"ConditionalNode":case"OperatorNode:divide":f="\\left(".concat(f,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return f+"~"+m}return f+o+m}if(!(i.length>2)||"OperatorNode:add"!==this.getIdentifier()&&"OperatorNode:multiply"!==this.getIdentifier())return"\\mathrm{"+this.fn+"}\\left("+i.map(function(r){return r.toTex(e)}).join(",")+"\\right)";var p=i.map(function(r,t){return r=r.toTex(e),a[t]&&(r="\\left(".concat(r,"\\right)")),r});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?p.join("~"):p.join(o)}getIdentifier(){return this.type+":"+this.fn}}return ed(n,"name",rF),n},{isClass:!0,isNode:!0}),rB="ParenthesisNode",rO=ef(rB,["Node"],e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),!er(e))throw TypeError('Node expected for parameter "content"');this.content=e}get type(){return rB}get isParenthesisNode(){return!0}_compile(e,r){return this.content._compile(e,r)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){return new t(e(this.content,"content",this))}clone(){return new t(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:rB,content:this.content}}static fromJSON(e){return new t(e.content)}_toHTML(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(e)}_toTex(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)}}return ed(t,"name",rB),t},{isClass:!0,isNode:!0}),r_="RelationalNode",rz=ef(r_,["Node"],e=>{var{Node:r}=e,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends r{constructor(e,r){if(super(),!Array.isArray(e))throw TypeError("Parameter conditionals must be an array");if(!Array.isArray(r))throw TypeError("Parameter params must be an array");if(e.length!==r.length-1)throw TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=r}get type(){return r_}get isRelationalNode(){return!0}_compile(e,r){var t=this,n=this.params.map(t=>t._compile(e,r));return function(r,i,a){for(var o,s=n[0](r,i,a),u=0;u<t.conditionals.length;
1u++)if(o=s,s=n[u+1](r,i,a),!c(e,t.conditionals[u])(o,s))return!1;return!0}}forEach(e){this.params.forEach((r,t)=>e(r,"params["+t+"]",this),this)}map(e){return new n(this.conditionals.slice(),this.params.map((r,t)=>this._ifNode(e(r,"params["+t+"]",this)),this))}clone(){return new n(this.conditionals,this.params)}_toString(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",n=rx(this,r,e&&e.implicit),i=this.params.map(function(t,i){var a=rx(t,r,e&&e.implicit);return"all"===r||null!==a&&a<=n?"("+t.toString(e)+")":t.toString(e)}),a=i[0],o=0;o<this.conditionals.length;o++)a+=" "+t[this.conditionals[o]],a+=" "+i[o+1];return a}toJSON(){return{mathjs:r_,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new n(e.conditionals,e.params)}_toHTML(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",n=rx(this,r,e&&e.implicit),i=this.params.map(function(t,i){var a=rx(t,r,e&&e.implicit);return"all"===r||null!==a&&a<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+t.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':t.toHTML(e)}),a=i[0],o=0;o<this.conditionals.length;o++)a+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+eV(t[this.conditionals[o]])+"</span>"+i[o+1];return a}_toTex(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",t=rx(this,r,e&&e.implicit),n=this.params.map(function(n,i){var a=rx(n,r,e&&e.implicit);return"all"===r||null!==a&&a<=t?"\\left("+n.toTex(e)+"\right)":n.toTex(e)}),i=n[0],a=0;a<this.conditionals.length;a++)i+=rE[this.conditionals[a]]+n[a+1];return i}}return ed(n,"name",r_),n},{isClass:!0,isNode:!0}),rk="ArrayNode",rI=ef(rk,["Node"],e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(er))throw TypeError("Array containing Nodes expected")}get type(){return rk}get isArrayNode(){return!0}_compile(e,r){var t=rr(this.items,function(t){return t._compile(e,r)});if("Array"===e.config.matrix)return function(e,r,n){return rr(t,function(t){return t(e,r,n)})};var n=e.matrix;return function(e,r,i){return n(rr(t,function(t){return t(e,r,i)}))}}forEach(e){for(var r=0;r<this.items.length;r++)e(this.items[r],"items["+r+"]",this)}map(e){for(var r=[],n=0;n<this.items.length;n++)r[n]=this._ifNode(e(this.items[n],"items["+n+"]",this));return new t(r)}clone(){return new t(this.items.slice(0))}_toString(e){return"["+this.items.map(function(r){return r.toString(e)}).join(", ")+"]"}toJSON(){return{mathjs:rk,items:this.items}}static fromJSON(e){return new t(e.items)}_toHTML(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map(function(r){return r.toHTML(e)}).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){return function r(t,n){var i=t.some(Z)&&!t.every(Z),a=n||i,o=t.map(function(t){return t.items?r(t.items,!n):t.toTex(e)}).join(a?"&":"\\\\");return i||!a||a&&!n?"\\begin{bmatrix}"+o+"\\end{bmatrix}":o}(this.items,!1)}}return ed(t,"name",rk),t},{isClass:!0,isNode:!0}),rR="BlockNode",rq=ef(rR,["ResultSet","Node"],e=>{var{ResultSet:r,Node:t}=e;class n extends t{constructor(e){if(super(),!Array.isArray(e))throw Error("Array expected");this.blocks=e.map(function(e){var r=e&&e.node,t=!e||void 0===e.visible||e.visible;if(!er(r))throw TypeError('Property "node" must be a Node');if("boolean"!=typeof t)throw TypeError('Property "visible" must be a boolean');return{node:r,visible:t}})}get type(){return rR}get isBlockNode(){return!0}_compile(e,t){var n=rr(this.blocks,function(r){return{evaluate:r.node._compile(e,t),visible:r.visible}});return function(e,t,i){var a=[];return rt(n,function(r){var n=r.evaluate(e,t,i);r.visible&&a.push(n)}),new r(a)}}forEach(e){for(var r=0;r<this.blocks.length;r++)e(this.blocks[r].node,"blocks["+r+"].node",this)}map(e){for(var r=[],t=0;t<this.blocks.length;t++){var i=this.blocks[t],a=this._ifNode(e(i.node,"blocks["+t+"].node",this));r[t]={node:a,visible:i.visible}}return new n(r)}clone(){return new n(this.blocks.map(function(e){return{node:e.node,visible:e.visible}}))}_toString(e){return this.blocks.map(function(r){return r.node.toString(e)+(r.visible?"":";")}).join("\n")}toJSON(){return{mathjs:rR,blocks:this.blocks}}static fromJSON(e){return new n(e.blocks)}_toHTML(e){return this.blocks.map(function(r){return r.node.toHTML(e)+(r.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')}_toTex(e){return this.blocks.map(function(r){return r.node.toTex(e)+(r.visible?"":";")}).join("\\;\\;\n")}}return ed(n,"name",rR),n},{isClass:!0,isNode:!0}),rP="ConditionalNode",rj=ef(rP,["Node"],e=>{var{Node:r}=e;class t extends r{constructor(e,r,t){if(super(),!er(e))throw TypeError("Parameter condition must be a Node");if(!er(r))throw TypeError("Parameter trueExpr must be a Node");if(!er(t))throw TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=r,this.falseExpr=t}get type(){return rP}get isConditionalNode(){return!0}
1_compile(e,r){var t=this.condition._compile(e,r),n=this.trueExpr._compile(e,r),i=this.falseExpr._compile(e,r);return function(e,r,a){return!function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(D(e))return!e.isZero();if(E(e))return!!(e.re||e.im);if(C(e))return!!e.value}if(null==e)return!1;throw TypeError('Unsupported type of condition "'+el(e)+'"')}(t(e,r,a))?i(e,r,a):n(e,r,a)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new t(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new t(this.condition,this.trueExpr,this.falseExpr)}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=rx(this,r,e&&e.implicit),n=this.condition.toString(e),i=rx(this.condition,r,e&&e.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==i&&i<=t)&&(n="("+n+")");var a=this.trueExpr.toString(e),o=rx(this.trueExpr,r,e&&e.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==o&&o<=t)&&(a="("+a+")");var s=this.falseExpr.toString(e),u=rx(this.falseExpr,r,e&&e.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=t)&&(s="("+s+")"),n+" ? "+a+" : "+s}toJSON(){return{mathjs:rP,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new t(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=rx(this,r,e&&e.implicit),n=this.condition.toHTML(e),i=rx(this.condition,r,e&&e.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==i&&i<=t)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');var a=this.trueExpr.toHTML(e),o=rx(this.trueExpr,r,e&&e.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==o&&o<=t)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.falseExpr.toHTML(e),u=rx(this.falseExpr,r,e&&e.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=t)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+'<span class="math-operator math-conditional-operator">?</span>'+a+'<span class="math-operator math-conditional-operator">:</span>'+s}_toTex(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return ed(t,"name",rP),t},{isClass:!0,isNode:!0}),rU="ConstantNode",rL=ef(rU,["Node"],e=>{var{Node:r}=e;class t extends r{constructor(e){super(),this.value=e}get type(){return rU}get isConstantNode(){return!0}_compile(e,r){var t=this.value;return function(){return t}}forEach(e){}map(e){return this.clone()}clone(){return new t(this.value)}_toString(e){return eH(this.value,e)}_toHTML(e){var r=this._toString(e);switch(el(this.value)){case"number":case"bigint":case"BigNumber":case"Fraction":return'<span class="math-number">'+r+"</span>";case"string":return'<span class="math-string">'+r+"</span>";case"boolean":return'<span class="math-boolean">'+r+"</span>";case"null":return'<span class="math-null-symbol">'+r+"</span>";case"undefined":return'<span class="math-undefined">'+r+"</span>";default:return'<span class="math-symbol">'+r+"</span>"}}toJSON(){return{mathjs:rU,value:this.value}}static fromJSON(e){return new t(e.value)}_toTex(e){var r=this._toString(e),t=el(this.value);switch(t){case"string":return"\\mathtt{"+rS(r)+"}";case"number":case"BigNumber":if(!("BigNumber"===t?this.value.isFinite():isFinite(this.value)))return 0>this.value.valueOf()?"-\\infty":"\\infty";var n=r.toLowerCase().indexOf("e");if(-1!==n)return r.substring(0,n)+"\\cdot10^{"+r.substring(n+1)+"}";return r;case"bigint":return r.toString();case"Fraction":return this.value.toLatex();default:return r}}}return ed(t,"name",rU),t},{isClass:!0,isNode:!0}),r$="RangeNode",rH=ef(r$,["Node"],e=>{var{Node:r}=e;function t(e,r,t){var n=rx(e,r,t),i={},a=rx(e.start,r,t);if(i.start=null!==a&&a<=n||"all"===r,e.step){var o=rx(e.step,r,t);i.step=null!==o&&o<=n||"all"===r}var s=rx(e.end,r,t);return i.end=null!==s&&s<=n||"all"===r,i}class n extends r{constructor(e,r,t){if(super(),!er(e)||!er(r)||t&&!er(t))throw TypeError("Node expected");if(arguments.length>3)throw Error("Too many arguments");this.start=e,this.end=r,this.step=t||null}get type(){return r$}get isRangeNode(){return!0}needsEnd(){return this.filter(function(e){return es(e)&&"end"===e.name}).length>0}_compile(e,r){var t=e.range,n=this.start._compile(e,r),i=this.end._compile(e,r);if(!this.step)return function(e,r,a){return t(n(e,r,a),i(e,r,a))};var a=this.step._compile(e,r);return function(e,r,o){return t(n(e,r,o),i(e,r,o),a(e,r,o))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new n(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toString(e);if(n.start&&(i="("+i+")"),r=i,this.step){var a=this.step.toString(e);n.step&&(a="("+a+")"),r+=":"+a}var o=this.end.toString(e);return n.end&&(o="("+o+")"),r+=":"+o}toJSON(){return{mathjs:r$,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new n(e.start,e.end,e.step)}_toHTML(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toHTML(e);if(n.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r=i,this.step){var a=this.step.toHTML(e);
1n.step&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+a}var o=this.end.toHTML(e);return n.end&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+o}_toTex(e){var r=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),n=this.start.toTex(e);if(r.start&&(n="\\left(".concat(n,"\\right)")),this.step){var i=this.step.toTex(e);r.step&&(i="\\left(".concat(i,"\\right)")),n+=":"+i}var a=this.end.toTex(e);return r.end&&(a="\\left(".concat(a,"\\right)")),n+=":"+a}}return ed(n,"name",r$),n},{isClass:!0,isNode:!0}),rG=ef("reviver",["classes"],e=>{var{classes:r}=e;return function(e,t){var n=r[t&&t.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(t):t}}),rZ=ef("Chain",["?on","math","typed"],e=>{var{on:r,math:t,typed:n}=e;function i(e){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");eu(e)?this.value=e.value:this.value=e}function a(e,r){var t,n,a,s;t=i.prototype,n=function(){var e=r();if("function"==typeof e)return o(e)},s=!0,Object.defineProperty(t,e,{get:function(){return s&&(a=n(),s=!1),a},set:function(e){a=e,s=!1},configurable:!0,enumerable:!0})}function o(e){return function(){if(0==arguments.length)return new i(e(this.value));for(var r=[this.value],t=0;t<arguments.length;t++)r[t+1]=arguments[t];if(n.isTypedFunction(e)){var a=n.resolve(e,r);if(1===a.params.length)throw Error("chain function "+e.name+" cannot match rest parameter between chain value and additional arguments.");return new i(a.implementation.apply(e,r))}return new i(e.apply(e,r))}}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return eH(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(e){return new i(e.value)},i.createProxy=function(e,r){if("string"==typeof e)"function"==typeof r&&(i.prototype[e]=o(r));else{var t=function(r){l(e,r)&&void 0===s[r]&&a(r,()=>e[r])};for(var n in e)t(n)}};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),r&&r("import",function(e,r,t){t||a(e,r)}),i},{isClass:!0}),rV="FunctionAssignmentNode",rW=ef(rV,["typed","Node"],e=>{var{typed:r,Node:t}=e;function n(e,r,t){var n=rx(e,r,t),i=rx(e.expr,r,t);return"all"===r||null!==i&&i<=n}class i extends t{constructor(e,r,t){if(super(),"string"!=typeof e)throw TypeError('String expected for parameter "name"');
1if(!Array.isArray(r))throw TypeError('Array containing strings or objects expected for parameter "params"');if(!er(t))throw TypeError('Node expected for parameter "expr"');if(ec.has(e))throw Error('Illegal function name, "'+e+'" is a reserved keyword');var n=new Set;for(var i of r){var a="string"==typeof i?i:i.name;if(n.has(a))throw Error('Duplicate parameter name "'.concat(a,'"'));n.add(a)}this.name=e,this.params=r.map(function(e){return e&&e.name||e}),this.types=r.map(function(e){return e&&e.type||"any"}),this.expr=t}get type(){return rV}get isFunctionAssignmentNode(){return!0}_compile(e,t){var n=Object.create(t);rt(this.params,function(e){n[e]=!0});var i=this.expr,a=i._compile(e,n),o=this.name,s=this.params,u=ra(this.types,","),l=o+"("+ra(this.params,", ")+")";return function(e,t,n){var c={};c[u]=function(){for(var r=Object.create(t),i=0;i<s.length;i++)r[s[i]]=arguments[i];return a(e,r,n)};var f=r(o,c);return f.syntax=l,f.expr=i.toString(),e.set(o,f),f}}forEach(e){e(this.expr,"expr",this)}map(e){var r=this._ifNode(e(this.expr,"expr",this));return new i(this.name,this.params.slice(0),r)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=this.expr.toString(e);return n(this,r,e&&e.implicit)&&(t="("+t+")"),this.name+"("+this.params.join(", ")+") = "+t}toJSON(){var e=this.types;return{mathjs:rV,name:this.name,params:this.params.map(function(r,t){return{name:r,type:e[t]}}),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",t=[],i=0;i<this.params.length;i++)t.push('<span class="math-symbol math-parameter">'+eV(this.params[i])+"</span>");var a=this.expr.toHTML(e);return n(this,r,e&&e.implicit)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+eV(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+a}_toTex(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=this.expr.toTex(e);return n(this,r,e&&e.implicit)&&(t="\\left(".concat(t,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(rM).join(",")+"\\right)="+t}}return ed(i,"name",rV),i},{isClass:!0,isNode:!0}),rJ="chain",rY=ef(rJ,["typed","Chain"],e=>{var{typed:r,Chain:t}=e;return r(rJ,{"":function(){return new t},any:function(e){return new t(e)}})});function rX(e){return e&&e.isIndexError?new eQ(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function rQ(e){var{subset:r}=e;return function(e,t){try{if(Array.isArray(e))return r(e,t);if(e&&"function"==typeof e.subset)return e.subset(t);if("string"==typeof e)return r(e,t);else if("object"==typeof e){if(!t.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return c(e,t.getObjectProperty())}else throw TypeError("Cannot apply index: unsupported type of object")}catch(e){throw rX(e)}}}var rK="AccessorNode",r0=ef(rK,["subset","Node"],e=>{var{subset:r,Node:t}=e,n=rQ({subset:r});function i(e){return!(G(e)||Z(e)||Y(e)||K(e)||et(e)||ei(e)||es(e))}class a extends t{constructor(e,r){if(super(),!er(e))throw TypeError('Node expected for parameter "object"');if(!ee(r))throw TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=r}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return rK}get isAccessorNode(){return!0}_compile(e,r){var t=this.object._compile(e,r),i=this.index._compile(e,r);if(!this.index.isObjectProperty())return function(e,r,a){var o=t(e,r,a),s=i(e,r,o);return n(o,s)};var a=this.index.getObjectProperty();return function(e,r,n){return c(t(e,r,n),a)}}forEach(e){e(this.object,"object",this),e(this.index,"index",this)}map(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(e){var r=this.object.toString(e);return i(this.object)&&(r="("+r+")"),r+this.index.toString(e)}_toHTML(e){var r=this.object.toHTML(e);return i(this.object)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+this.index.toHTML(e)}_toTex(e){var r=this.object.toTex(e);return i(this.object)&&(r="\\left(' + object + '\\right)"),r+this.index.toTex(e)}toJSON(){return{mathjs:rK,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return ed(a,"name",rK),a},{isClass:!0,isNode:!0}),r1="AssignmentNode",r2=ef(r1,["subset","?matrix","Node"],e=>{var{subset:r,matrix:t,Node:n}=e,i=rQ({subset:r}),a=function(e){var{subset:r,matrix:t}=e;return function(e,n,i){try{if(Array.isArray(e))return t(e).subset(n,i).valueOf().forEac
1h((r,t)=>{e[t]=r}),e;if(e&&"function"==typeof e.subset)return e.subset(n,i);if("string"==typeof e)return r(e,n,i);else if("object"==typeof e){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return f(e,n.getObjectProperty(),i),e}else throw TypeError("Cannot apply index: unsupported type of object")}catch(e){throw rX(e)}}}({subset:r,matrix:t});function o(e,r,t){r||(r="keep");var n=rx(e,r,t),i=rx(e.value,r,t);return"all"===r||null!==i&&i<=n}class s extends n{constructor(e,r,t){if(super(),this.object=e,this.index=t?r:null,this.value=t||r,!es(e)&&!G(e))throw TypeError('SymbolNode or AccessorNode expected as "object"');if(es(e)&&"end"===e.name)throw Error('Cannot assign to symbol "end"');if(this.index&&!ee(this.index))throw TypeError('IndexNode expected as "index"');if(!er(this.value))throw TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return r1}get isAssignmentNode(){return!0}_compile(e,r){var t=this.object._compile(e,r),n=this.index?this.index._compile(e,r):null,o=this.value._compile(e,r),s=this.object.name;if(this.index)if(this.index.isObjectProperty()){var u=this.index.getObjectProperty();return function(e,r,n){var i=t(e,r,n),a=o(e,r,n);return f(i,u,a),a}}else{if(es(this.object))return function(e,r,i){var u=t(e,r,i),l=o(e,r,i),c=n(e,r,u);return e.set(s,a(u,c,l)),l};var l=this.object.object._compile(e,r);if(this.object.index.isObjectProperty()){var m=this.object.index.getObjectProperty();return function(e,r,t){var i=l(e,r,t),s=c(i,m),u=n(e,r,s),p=o(e,r,t);return f(i,m,a(s,u,p)),p}}var p=this.object.index._compile(e,r);return function(e,r,t){var s=l(e,r,t),u=p(e,r,s),c=i(s,u),f=n(e,r,c),m=o(e,r,t);return a(s,u,a(c,f,m)),m}}if(!es(this.object))throw TypeError("SymbolNode expected as object");return function(e,r,t){var n=o(e,r,t);return e.set(s,n),n}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){return new s(this._ifNode(e(this.object,"object",this)),this.index?this._ifNode(e(this.index,"index",this)):null,this._ifNode(e(this.value,"value",this)))}clone(){return new s(this.object,this.index,this.value)}_toString(e){var r=this.object.toString(e),t=this.index?this.index.toString(e):"",n=this.value.toString(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n="("+n+")"),r+t+" = "+n}toJSON(){return{mathjs:r1,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new s(e.object,e.index,e.value)}_toHTML(e){var r=this.object.toHTML(e),t=this.index?this.index.toHTML(e):"",n=this.value.toHTML(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n='<span class="math-paranthesis math-round-parenthesis">(</span>'+n+'<span class="math-paranthesis math-round-parenthesis">)</span>'),r+t+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n}_toTex(e){var r=this.object.toTex(e),t=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n="\\left(".concat(n,"\\right)")),r+t+"="+n}}return ed(s,"name",r1),s},{isClass:!0,isNode:!0}),r3="IndexNode",r5=ef(r3,["Node","size"],e=>{var{Node:r,size:t}=e;class n extends r{constructor(e,r){if(super(),this.dimensions=e,this.dotNotation=r||!1,!Array.isArray(e)||!e.every(er))throw TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw Error("dotNotation only applicable for object properties")}get type(){return r3}get isIndexNode(){return!0}_compile(e,r){var n=rr(this.dimensions,function(n,i){if(!(n.filter(e=>e.isSymbolNode&&"end"===e.name).length>0))return n._compile(e,r);var a=Object.create(r);a.end=!0;var o=n._compile(e,a);return function(e,r,n){if(!F(n)&&!M(n)&&!S(n))throw TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+el(n));var a=t(n).valueOf(),s=Object.create(r);return s.end=a[i],o(e,s,n)}}),i=c(e,"index");return function(e,r,t){return i(...rr(n,function(n){return n(e,r,t)}))}}forEach(e){for(var r=0;r<this.dimensions.length;r++)e(this.dimensions[r],"dimensions["+r+"]",this)}map(e){for(var r=[],t=0;t<this.dimensions.length;t++)r[t]=this._ifNode(e(this.dimensions[t],"dimensions["+t+"]",this));return new n(r,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&Y(this.dimensions[0])&&"string"==typeof this.dimensions[0].value}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:r3,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new n(e.dimensions,e.dotNotation)}_toHTML(e){for(var r=[],t=0;t<this.dimensions.length;t++)r[t]=this.dimensions[t].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+eV(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){var r=this.dimensions.map(function(r){return r.toTex(e)});return this.dotNotation?"."+this.getObjectProperty():"_{"+r.join(",")+"}"}}return ed(n,"name",r3),n},{isClass:!0,isNode:!0}),r4=ef("SymbolNode",["math","?Unit","Node"],e=>{var{math:r,Unit:t,Node:n}=e;function i(e){return!!t&&t.isValuelessUnit(e)}class a extends n{constructor(e){if(super(),"string"!=typeof e)throw TypeError('String expected for parameter "name"');this.name=e}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(e,r){var n=this.name;if(!0===r[n])return function(e,r,t){return c(r,n)};if(n in e)return function(r,t,i){return r.has(n)?r.get(n):c(e,n)};var o=i(n);return function(e,r,i){return e.has(n)?e.get(n):o?new t(null,n):a.onUndefinedSymbol(n)}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw Error("Undefined symbol "+e)}clone(){return new a(this.name)}_toString(e){return this.name}_toHTML(e){var r=eV(this.name);if("true"===r||"false"===r)return'<span class="math-symbol math-boolean">'+r+"</span>";if("i"===r)return'<span class="math-symbol math-imaginary-symbol">'+r+"</span>";if("Infinity"===r)return'<span class="math-symbol math-infinity-symbol">'+r+"</span>";if("NaN"===r)return'<span class="math-symbol math-nan-symbol">'+r+"</span>";if("null"===r)return'<span class="math-symbol math-null-symbol">'+r+"</span>";else if("undefined"===r)return'<span class="math-symbol math-undefined-symbol">'+r+"</span>";return'<span class="math-symbol">'+r+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){var t=!1;void 0===r[this.name]&&i(this.name)&&(t=!0);var n=rM(this.name,t);return"\\"===n[0]?n:" "+n}}return a},{isClass:!0,isNode:!0}),r8="FunctionNode",r6=ef(r8,["math","Node","SymbolNode"],e=>{var{math:r,Node:t,SymbolNode:n}=e,i=e=>eH(e,{truncate:78});function a(e,r,t){for(var n,i="",a=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,o=0;null!==(n=a.exec(e));)if(i+=e.substring(o,n.index),o=n.index,"$$"===n[0])i+="$",o++;else{o+=n[0].length;var s=r[n[1]];if(!s)throw ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(typeof s){case"string":i+=s;break;case"object":if(er(s))i+=s.toTex(t);else if(Array.isArray(s))i+=s.map(function(e,r){if(er(e))return e.toTex(t);throw TypeError("Template: "+n[1]+"["+r+"] is not a Node.")}).join(",");else throw TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");break;default:throw TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes")}else if(er(s[n[2]]&&s[n[2]]))i+=s[n[2]].toTex(t);else throw TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.")}return i+e.slice(o)}class o extends t{constructor(e,r){if(super(),"string"==typeof e&&(e=new n(e)),!er(e))throw TypeError('Node expected as parameter "fn"');if(!Array.isArray(r)||!r.every(er))throw TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=r||[]}get name(){return this.fn.name||""}get type(){return r8}get isFunctionNode(){return!0}_compile(e,r){var t=this.args.map(t=>t._compile(e,r));if(es(this.fn)){var n=this.fn.name;if(r[n]){var a=this.args;return function(r,o,s){var u=c(o,n);if("function"!=typeof u)throw TypeError("Argument '".concat(n,"' was not a function; received: ").concat(i(u)));if(u.rawArgs)return u(a,e,rg(r,o));var l=t.map(e=>e(r,o,s));return u.apply(u,l)}}var s=n in e?c(e,n):void 0,u="function"==typeof s&&!0===s.rawArgs,l=r=>{var t;if(r.has(n))t=r.get(n);else{if(!(n in e))return o.onUndefinedFunction(n);t=c(e,n)}if("function"==typeof t)return t;throw TypeError("'".concat(n,"' is not a function; its value is:\n ").concat(i(t)))};if(u){var f=this.args;return function(r,n,i){var a=l(r);return!0===a.rawArgs?a(f,e,rg(r,n)):a(...t.map(e=>e(r,n,i)))}}switch(t.length){case 0:return function(e,r,t){return l(e)()};case 1:return function(e,r,n){return l(e)((0,t[0])(e,r,n))};case 2:return function(e,r,n){var i=l(e),a=t[0],o=t[1];return i(a(e,r,n),o(e,r,n))};default:return function(e,r,n){return l(e)(...t.map(t=>t(e,r,n)))}}}if(G(this.fn)&&ee(this.fn.index)&&this.fn.index.isObjectProperty()){var m=this.fn.object._compile(e,r),h=this.fn.index.getObjectProperty(),d=this.args;return function(r,n,i){var a=m(r,n,i),o=function(e,r){if(!p(e,r))throw Error('No access to method "'+r
1+'"');return e[r]}(a,h);if(null!=o&&o.rawArgs)return o(d,e,rg(r,n));var s=t.map(e=>e(r,n,i));return o.apply(a,s)}}var g=this.fn.toString(),v=this.fn._compile(e,r),y=this.args;return function(r,n,a){var o=v(r,n,a);if("function"!=typeof o)throw TypeError("Expression '".concat(g,"' did not evaluate to a function; value is:")+"\n ".concat(i(o)));if(o.rawArgs)return o(y,e,rg(r,n));var s=t.map(e=>e(r,n,a));return o.apply(o,s)}}forEach(e){e(this.fn,"fn",this);for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)}map(e){for(var r=this._ifNode(e(this.fn,"fn",this)),t=[],n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new o(r,t)}clone(){return new o(this.fn,this.args.slice(0))}toString(e){var r,t=this.fn.toString(e);return(e&&"object"==typeof e.handler&&l(e.handler,t)&&(r=e.handler[t](this,e)),void 0!==r)?r:super.toString(e)}_toString(e){var r=this.args.map(function(r){return r.toString(e)});return(Q(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+r.join(", ")+")"}toJSON(){return{mathjs:r8,fn:this.fn,args:this.args}}_toHTML(e){var r=this.args.map(function(r){return r.toHTML(e)});return'<span class="math-function">'+eV(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(e){var r;return(e&&"object"==typeof e.handler&&l(e.handler,this.name)&&(r=e.handler[this.name](this,e)),void 0!==r)?r:super.toTex(e)}_toTex(e){var t,n,i=this.args.map(function(r){return r.toTex(e)});switch(rA[this.name]&&(t=rA[this.name]),r[this.name]&&("function"==typeof r[this.name].toTex||"object"==typeof r[this.name].toTex||"string"==typeof r[this.name].toTex)&&(t=r[this.name].toTex),typeof t){case"function":n=t(this,e);break;case"string":n=a(t,this,e);break;case"object":switch(typeof t[i.length]){case"function":n=t[i.length](this,e);break;case"string":n=a(t[i.length],this,e)}}return void 0!==n?n:a("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return ed(o,"name",r8),ed(o,"onUndefinedFunction",function(e){throw Error("Undefined function "+e)}),ed(o,"fromJSON",function(e){return new o(e.fn,e.args)}),o},{isClass:!0,isNode:!0});function r7(e){var r,t,n=e.length,i=e[0].length,a=[];for(t=0;t<i;t++){var o=[];for(r=0;r<n;r++)o.push(e[r][t]);a.push(o)}return a}function r9(e){for(var r=0;r<e.length;r++)if(T(e[r]))return!0;return!1}function te(e,r){F(e)?e.forEach(e=>r(e),!1,!0):rd(e,r,!0)}function tr(e,r,t){if(!t)if(F(e))return e.map(e=>r(e),!1,!0);else return rh(e,r,!0);var n=e=>0===e?e:r(e);return F(e)?e.map(e=>n(e),!1,!0):rh(e,n,!0)}function tt(e,r,t){var n=Array.isArray(e)?eK(e):e.size();if(r<0||r>=n.length)throw new eQ(r,n.length);return F(e)?e.create(tn(e.valueOf(),r,t),e.datatype()):tn(e,r,t)}function tn(e,r,t){var n,i,a,o;if(r<=0)if(Array.isArray(e[0])){for(n=0,o=r7(e),i=[];n<o.length;n++)i[n]=tn(o[n],r-1,t);return i}else{for(n=1,a=e[0];n<e.length;n++)a=t(a,e[n]);return a}for(n=0,i=[];n<e.length;n++)i[n]=tn(e[n],r-1,t);return i}function ti(e,r,t,n,i,a,o,s,u,l,c){var f,m,p,h,d=e._values,g=e._index,v=e._ptr;if(n)for(m=v[r],p=v[r+1],f=m;f<p;f++)t[h=g[f]]!==a?(t[h]=a,o.push(h),l?(n[h]=u?s(d[f],c):s(c,d[f]),i[h]=a):n[h]=d[f]):(n[h]=u?s(d[f],n[h]):s(n[h],d[f]),i[h]=a);else for(m=v[r],p=v[r+1],f=m;f<p;f++)t[h=g[f]]!==a?(t[h]=a,o.push(h)):i[h]=a}var ta="parse",to=ef(ta,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],e=>{var{typed:r,numeric:t,config:i,AccessorNode:a,ArrayNode:o,AssignmentNode:s,BlockNode:u,ConditionalNode:c,ConstantNode:f,FunctionAssignmentNode:m,FunctionNode:p,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:v,RangeNode:y,RelationalNode:x,SymbolNode:b}=e,w=r(ta,{string:function(e){return q(e,{})},"Array | Matrix":function(e){return D(e,{})},"string, Object":function(e,r){return q(e,void 0!==r.nodes?r.nodes:{})},"Array | Matrix, Object":D});function D(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=void 0!==r.nodes?r.nodes:{};return tr(e,function(e){if("string"!=typeof e)throw TypeError("String expected");return q(e,t)})}var N={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},E={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"??":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},A={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},C={true:!0,false:!1,null:null,undefined},S=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "};function F(e,r){return e.expression.substr(e.index,r)}function T(e){return F(e,1)}function B(e){e.index++}function O(e){return e.expression.charAt(e.index-1)}function _(e){return e.expression.charAt(e.index+1)}function z(e){for(e.tokenType=N.NULL,e.token="",e.comment="";;){if("#"===T(e))for(;"\n"!==T(e)&&""!==T(e);)e.comment+=T(e),B(e);if(w.isWhitespace(T(e),e.nestingLevel))B(e);else break}if(""===T(e)){e.tokenType=N.DELIMITER;return}if("\n"===T(e)&&!e.nestingLevel){e.tokenType=N.DELIMITER,e.token=T(e),B(e);return}var r=T(e),t=F(e,2),n=F(e,3);if(3===n.length&&E[n]){e.tokenType=N.DELIMITER,e.token=n,B(e),B(e),B(e);return}if(2===t.length&&E[t]){e.tokenType=N.DELIMITER,e.token=t,B(e),B(e);return}if(E[r]){e.tokenType=N.DELIMITER,e.token=r,B(e);return}if(w.isDigitDot(r)){e.tokenType=N.NUMBER;var i=F(e,2);if("0b"===i||"0o"===i||"0x"===i){for(e.token+=T(e),B(e),e.token+=T(e),B(e);w.isHexDigit(T(e));)e.token+=T(e),B(e);if("."===T(e))for(e.token+=".",B(e);w.isHexDigit(T(e));)e.token+=T(e),B(e);else if("i"===T(e))for(e.token+="i",B(e);w.isDigit(T(e));)e.token+=T(e),B(e);return}if("."===T(e)){if(e.token+=T(e),B(e),!w.isDigit(T(e))){e.tokenType=N.DELIMITER;return}}else{for(;w.isDigit(T(e));)e.token+=T(e),B(e);w.isDecimalMark(T(e),_(e))&&(e.token+=T(e),B(e))}for(;w.isDigit(T(e));)e.token+=T(e),B(e);if("E"===T(e)||"e"===T(e)){if(w.isDigit(_(e))||"-"===_(e)||"+"===_(e)){if(e.token+=T(e),B(e),("+"===T(e)||"-"===T(e))&&(e.token+=T(e),B(e)),!w.isDigit(T(e)))throw ef(e,'Digit expected, got "'+T(e)+'"');for(;w.isDigit(T(e));)e.token+=T(e),B(e);if(w.isDecimalMark(T(e),_(e)))throw ef(e,'Digit expected, got "'+T(e)+'"')}else if(w.isDecimalMark(_(e),e.expression.charAt(e.index+2)))throw B(e),ef(e,'Digit expected, got "'+T(e)+'"')}return}if(w.isAlpha(T(e),O(e),_(e))){for(;w.isAlpha(T(e),O(e),_(e))||w.isDigit(T(e));)e.token+=T(e),B(e);l(A,e.token)?e.tokenType=N.DELIMITER:e.tokenType=N.SYMBOL;return}for(e.tokenType=N.UNKNOWN;""!==T(e);)e.token+=T(e),B(e);throw ef(e,'Syntax error in part "'+e.token+'"')}function k(e){do z(e);while("\n"===e.token)}function I(e){e.nestingLevel++}function R(e){e.nestingLevel--}function q(e,r){var t={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:N.NULL,nestingLevel:0,conditionalLevel:null};(0,n.A)(t,{expression:e,extraNodes:r}),z(t);var i=function(e){var r,t,n=[];for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(r=P(e),e.comment&&(r.comment=e.comment));"\n"===e.token||";"===e.token;)0===n.length&&r&&(t=";"!==e.token,n.push({node:r,visible:t})),z(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(r=P(e),e.comment&&(r.comment=e.comment),t=";"!==e.token,n.push({node:r,visible:t}));return n.length>0?new u(n):(!r&&(r=new f(void 0),e.comment&&(r.comment=e.comment)),r)}(t);if(""!==t.token)if(t.tokenType===N.DELIMITER)throw em(t,"Unexpected operator "+t.token);else throw ef(t,'Unexpected part "'+t.token+'"');return i}function P(e){var r,t,n,i,a=function(e){for(var r=function(e){for(var r=j(e);"or"===e.token;)k(e),r=new g("or","or",[r,j(e)]);return r}(e);"?"===e.token;){var t=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,k(e);var n=r,i=P(e);if(":"!==e.token)throw ef(e,"False part of conditional expression expected");e.conditionalLevel=null,k(e),r=new c(n,i,P(e)),e.conditionalLevel=t}return r}(e);if("="===e.token){if(es(a))return r=a.name,k(e),n=P(e),new s(new b(r),n);if(G(a))return k(e),n=P(e),new s(a.object,a.index,n);
1if(K(a)&&es(a.fn)&&(i=!0,t=[],r=a.name,a.args.forEach(function(e,r){es(e)?t[r]=e.name:i=!1}),i))return k(e),new m(r,t,n=P(e));throw ef(e,"Invalid left hand side of assignment operator =")}return a}function j(e){for(var r=U(e);"xor"===e.token;)k(e),r=new g("xor","xor",[r,U(e)]);return r}function U(e){for(var r=L(e);"and"===e.token;)k(e),r=new g("and","and",[r,L(e)]);return r}function L(e){for(var r=$(e);"|"===e.token;)k(e),r=new g("|","bitOr",[r,$(e)]);return r}function $(e){for(var r=H(e);"^|"===e.token;)k(e),r=new g("^|","bitXor",[r,H(e)]);return r}function H(e){for(var r=Z(e);"&"===e.token;)k(e),r=new g("&","bitAnd",[r,Z(e)]);return r}function Z(e){for(var r=[V(e)],t=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};l(n,e.token);){var i={name:e.token,fn:n[e.token]};t.push(i),k(e),r.push(V(e))}return 1===r.length?r[0]:2===r.length?new g(t[0].name,t[0].fn,r):new x(t.map(e=>e.fn),r)}function V(e){for(var r,t,n=W(e),i={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};l(i,e.token);)t=i[r=e.token],k(e),n=new g(r,t,[n,W(e)]);return n}function W(e){for(var r,t,n=J(e),i={to:"to",in:"to"};l(i,e.token);)t=i[r=e.token],k(e),n="in"===r&&"])},;".includes(e.token)?new g("*","multiply",[n,new b("in")],!0):new g(r,t,[n,J(e)]);return n}function J(e){var r,t=[];if(r=":"===e.token?new f(1):Q(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(t.push(r);":"===e.token&&t.length<3;)k(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?t.push(new b("end")):t.push(Q(e));r=3===t.length?new y(t[0],t[2],t[1]):new y(t[0],t[1])}return r}function Q(e){for(var r,t,n,i=ee(e),a={"+":"add","-":"subtract"};l(a,e.token);){t=a[r=e.token],k(e);var o=ee(e);n=o.isPercentage?[i,new g("*","multiply",[i,o])]:[i,o],i=new g(r,t,n)}return i}function ee(e){for(var r,t,n,i=r=er(e),a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};;)if(l(a,e.token))if(n=a[t=e.token],k(e),"%"===t&&e.tokenType===N.DELIMITER&&"("!==e.token)if(""!==e.token&&a[e.token]){var o=new g("/","divide",[r,new f(100)],!1,!0);n=a[t=e.token],k(e),r=new g(t,n,[o,er(e)])}else r=new g("/","divide",[r,new f(100)],!1,!0);else r=new g(t,n,[r,er(e)]);else break;return r}function er(e){var r,t;for(t=r=et(e);;)if(e.tokenType===N.SYMBOL||"in"===e.token&&Y(r)||"in"===e.token&&en(r)&&"unaryMinus"===r.fn&&Y(r.args[0])||e.tokenType===N.NUMBER&&!Y(t)&&(!en(t)||"!"===t.op)||"("===e.token)r=new g("*","multiply",[r,t=et(e)],!0);else break;return r}function et(e){for(var r=ei(e),t=r,i=[];;)if("/"===e.token&&X(t))if(i.push((0,n.A)({},e)),k(e),e.tokenType===N.NUMBER)if(i.push((0,n.A)({},e)),k(e),e.tokenType===N.SYMBOL||"("===e.token||"in"===e.token)(0,n.A)(e,i.pop()),i.pop(),r=new g("/","divide",[r,t=ei(e)]);else{i.pop(),(0,n.A)(e,i.pop());break}else{(0,n.A)(e,i.pop());break}else break;return r}function ei(e){var r,t,n,i,a,o={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return l(o,e.token)?(a=o[e.token],i=e.token,k(e),new g(i,a,[ei(e)])):(t=function(e){for(var r=ea(e);"??"===e.token;)k(e),r=new g("??","nullish",[r,ea(e)]);return r}(r=e),("^"===r.token||".^"===r.token)&&(n=r.token,k(r),t=new g(n,"^"===n?"pow":"dotPow",[t,ei(r)])),t)}function ea(e){for(var r,n,a=function(e){var r,n,a,s,u,c=[];if(e.tokenType===N.SYMBOL&&l(e.extraNodes,e.token)){var m=e.extraNodes[e.token];if(z(e),"("===e.token){if(c=[],I(e),z(e),")"!==e.token)for(c.push(P(e));","===e.token;)z(e),c.push(P(e));if(")"!==e.token)throw ef(e,"Parenthesis ) expected");R(e),z(e)}return new m(c)}return(r=e).tokenType===N.SYMBOL||r.tokenType===N.DELIMITER&&r.token in A?(a=r.token,z(r),eo(r,l(C,a)?new f(C[a]):S.includes(a)?new f(t(a,"number")):new b(a))):'"'===(s=r).token||"'"===s.token?(u=new f(eu(s,s.token)),u=eo(s,u)):function(e){if("["===e.token){if(I(e),z(e),"]"!==e.token){var r=el(e);if(";"===e.token){for(l=1,u=[r];";"===e.token;)z(e),"]"!==e.token&&(u[l]=el(e),l++);if("]"!==e.token)throw ef(e,"End of matrix ] expected");R(e),z(e),c=u[0].items.length;for(var n=1;n<l;n++)if(u[n].items.length!==c)throw em(e,"Column dimensions mismatch ("+u[n].items.length+" !== "+c+")");s=new o(u)}else{if("]"!==e.token)throw ef(e,"End of matrix ] expected");R(e),z(e),s=r}}else R(e),z(e),s=new o([]);return eo(e,s)}var a=e;if("{"===a.token){I(a);var s,u,l,c,m,p={};do if(z(a),"}"!==a.token){if('"'===a.token||"'"===a.token)m=eu(a,a.token);else if(a.tokenType===N.SYMBOL||a.tokenType===N.DELIMITER&&a.token in A)m=a.token,z(a);else throw ef(a,"Symbol or string expected as object key");if(":"!==a.token)throw ef(a,"Colon : expected after object key");z(a),p[m]=P(a)}while(","===a.token);if("}"!==a.token)throw ef(a,"Comma , or bracket } expected after object value");R(a),z(a);var h=new d(p);return eo(a,h)}return function(e){if(e.tokenType===N.NUMBER){r=e.token,z(e);var r,n,a=ev(r,i);return new f(t(r,a))}var o=e;if("("===o.token){if(I(o),z(o),n=P(o),")"!==o.token)throw ef(o,"Parenthesis ) expected");return R(o),z(o),n=eo(o,n=new v(n))}var s=o;if(""===s.token)throw ef(s,"Unexpected end of expression");throw ef(s,"Value expected")}(a)}(s)}(e),s={"!":"factorial","'":"ctranspose"};l(s,e.token);)n=s[r=e.token],z(e),a=eo(e,a=new g(r,n,[a]));return a}function eo(e,r,t){for(var n;("("===e.token||"["===e.token||"."===e.token)&&(!t||t.includes(e.token));)if(n=[],"("===e.token)if(es(r)||G(r)){if(I(e),z(e),")"!==e.token)for(n.push(P(e));","===e.token;)z(e),n.push(P(e));if(")"!==e.token)throw ef(e,"Parenthesis ) expected");R(e),z(e),r=new p(r,n)}else break;else if("["===e.token){if(I(e),z(e),"]"!==e.token)for(n.push(P(e));","===e.token;)z(e),n.push(P(e));if("]"!==e.token)throw ef(e,"Parenthesis ] expected");R(e),z(e),r=new a(r,new h(n))}else{if(z(e),!(e.tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in A))throw ef(e,"Property name expected after dot");n.push(new f(e.token)),z(e),r=new a(r,new h(n,!0))}return r}function eu(e,r){for(var t="";""!==T(e)&&T(e)!==r;)if("\\"===T(e)){B(e);var n=T(e),i=M[n];if(void 0!==i)t+=i,e.index+=1;else if("u"===n){var a=e.expression.slice(e.index+1,e.index+5);if(/^[0-9A-Fa-f]{4}$/.test(a))t+=String.fromCharCode(parseInt(a,16)),e.index+=5;else throw ef(e,"Invalid unicode character \\u".concat(a))}else throw ef(e,"Bad escape character \\".concat(n))}else t+=T(e),B(e);if(z(e),e.token!==r)throw ef(e,"End of string ".concat(r," expected"));return z(e),t}function el(e){for(var r=[P(e)],t=1;","===e.token;)z(e),"]"!==e.token&&";"!==e.token&&(r[t]=P(e),t++);return new o(r)}function ec(e){return e.index-e.token.length+1}function ef(e,r){var t=ec(e),n=SyntaxError(r+" (char "+t+")");return n.char=t,n}function em(e,r){var t=ec(e),n=SyntaxError(r+" (char "+t+")");return n.char=t,n}return w.isAlpha=function(e,r,t){return w.isValidLatinOrGreek(e)||w.isValidMathSymbol(e,t)||w.isValidMathSymbol(r,e)},w.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},w.isValidMathSymbol=function(e,r){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(r)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(r)},w.isWhitespace=function(e,r){return" "===e||" "===e||"\xa0"===e||"\n"===e&&r>0},w.isDecimalMark=function(e,r){return"."===e&&"/"!==r&&"*"!==r&&"^"!==r},w.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},w.isDigit=function(e){return e>="0"&&e<="9"},w.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},r.addConversion({from:"string",to:"Node",convert:w}),w}),ts=ef("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(e,r){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!r)return e;if(es(e)){if(u.has(e.name)){var l=Array.from(u).join(", ");throw ReferenceError("recursive loop of variable definitions among {".concat(l,"}"))}
1var c=r.get(e.name);if(er(c)){var f=new Set(u);return f.add(e.name),s(c,r,f)}return"number"==typeof c?t(String(c)):void 0!==c?new n(c):e}if(en(e)){var m=e.args.map(function(e){return s(e,r,u)});return new a(e.op,e.fn,m,e.implicit)}if(ei(e))return new o(s(e.content,r,u));if(K(e)){var p=e.args.map(function(e){return s(e,r,u)});return new i(e.name,p)}return e.map(e=>s(e,r,u))}return r("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,r)=>s(e,b(r)),"Array | Matrix":r.referToSelf(e=>r=>r.map(r=>e(r))),"Array | Matrix, null | undefined":r.referToSelf(e=>r=>r.map(r=>e(r))),"Array, Object":r.referTo("Array,Map",e=>(r,t)=>e(r,b(t))),"Matrix, Object":r.referTo("Matrix,Map",e=>(r,t)=>e(r,b(t))),"Array | Matrix, Map":r.referToSelf(e=>(r,t)=>r.map(r=>e(r,t)))})});function tu(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function tl(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?tu(Object(t),!0).forEach(function(r){ed(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tu(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}var tc=ef("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],e=>{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,i="defaultF",a={add:{trivial:!0,total:!0,commutative:!0,associative:!0},unaryPlus:{trivial:!0,total:!0,commutative:!0,associative:!0},subtract:{trivial:!1,total:!0,commutative:!1,associative:!1},multiply:{trivial:!0,total:!0,commutative:!0,associative:!0},divide:{trivial:!1,total:!0,commutative:!1,associative:!1},paren:{trivial:!0,total:!0,commutative:!0,associative:!1},defaultF:{trivial:!1,total:!0,commutative:!1,associative:!1}};function o(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a,n=i;if("string"==typeof e?n=e:en(e)?n=e.fn.toString():K(e)?n=e.name:ei(e)&&(n="paren"),l(t,n)){var o=t[n];if(l(o,r))return o[r];if(l(a,n))return a[n][r]}if(l(t,i)){var s=t[i];return l(s,r)?s[r]:a[i][r]}if(l(a,n)){var u=a[n];if(l(u,r))return u[r]}return a[i][r]}function s(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;return o(e,"associative",r)}function u(e,r){var t,n=[],i=function(e){for(var r=0;r<e.args.length;r++){var a=e.args[r];en(a)&&t===a.op?i(a):n.push(a)}};return s(e,r)?(t=e.op,i(e),n):e.args}function c(e){return en(e)?function(r){try{return new t(e.op,e.fn,r,e.implicit)}catch(e){return console.error(e),[]}}:function(t){return new r(new n(e.name),t)}}return{createMakeNodeFunction:c,hasProperty:o,isCommutative:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;return o(e,"commutative",r)},isAssociative:s,mergeContext:function(e,r){var t=tl({},e);for(var n in r)l(e,n)?t[n]=tl(tl({},r[n]),e[n]):t[n]=r[n];return t},flatten:function e(r,t){if(!r.args||0===r.args.length)return r;r.args=u(r,t);for(var n=0;n<r.args.length;n++)e(r.args[n],t)},allChildren:u,unflattenr:function e(r,t){if(r.args&&0!==r.args.length){for(var n=c(r),i=r.args.length,a=0;a<i;a++)e(r.args[a],t);if(i>2&&s(r,t)){for(var o=r.args.pop();r.args.length>0;)o=n([r.args.pop(),o]);r.args=o.args}}},unflattenl:function e(r,t){if(r.args&&0!==r.args.length){for(var n=c(r),i=r.args.length,a=0;a<i;a++)e(r.args[a],t);if(i>2&&s(r,t)){for(var o=r.args.shift();r.args.length>0;)o=n([o,r.args.shift()]);r.args=o.args}}},defaultContext:a,realContext:{divide:{total:!1},log:{total:!1}},positiveContext:{subtract:{total:!1},abs:{trivial:!0},log:{total:!0}}}});function tf(){throw Error('No "bignumber" implementation available')}function tm(){throw Error('No "fraction" implementation available')}function tp(){throw Error('No "matrix" implementation available')}var th=ef("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],e=>{var{typed:r,config:t,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:u,ConstantNode:l,FunctionNode:c,IndexNode:f,ObjectNode:m,OperatorNode:p,SymbolNode:h}=e,{isCommutative:d,isAssociative:g,allChildren:v,createMakeNodeFunction:y}=tc({FunctionNode:c,OperatorNode:p,SymbolNode:h}),x=r("simplifyConstant",{Node:e=>D(M(e,{})),"Node, Object":function(e,r){return D(M(e,r))}});function b(e,r,t){try{return n[e].apply(null,r)}catch(a){return r=r.map(function e(r){return A(r)?r.valueOf():r instanceof Array?r.map(e):F(r)?i(e(r.valueOf())):r}),E(n[e].apply(null,r),t)}}var w=r({Fraction:function(e){var r=e=>"BigNumber"===t.number&&o?o(e):Number(e),n=e.s*e.n,i=n<0n?new p("-","unaryMinus",[new l(-r(n))]):new l(r(n));return 1n===e.d?i:new p("/","divide",[i,new l(r(e.d))])},number:function(e){return e<0?C(new l(-e)):new l(e)},BigNumber:function(e){return e<0?C(new l(-e)):new l(e)},bigint:function(e){return e<0n?C(new l(-e)):new l(e)},Complex:function(e){throw Error("Cannot convert Complex number to Node")},string:function(e){return new l(e)},Matrix:function(e){return new u(e.valueOf().map(e=>w(e)))}});function D(e){return er(e)?e:w(e)}function N(e,r){if(r&&!1!==r.exactFractions&&isFinite(e)&&a){var t=a(e),n=r&&"number"==typeof r.fractionsLimit?r.fractionsLimit:1/0;if(t.valueOf()===e&&t.n<n&&t.d<n)return t}return e}
1var E=r({"string, Object":function(e,r){var n=ev(e,t);return"BigNumber"===n?(void 0===o&&tf(),o(e)):"bigint"===n?BigInt(e):"Fraction"===n?(void 0===a&&tm(),a(e)):N(parseFloat(e),r)},"Fraction, Object":function(e,r){return e},"BigNumber, Object":function(e,r){return e},"number, Object":function(e,r){return N(e,r)},"bigint, Object":function(e,r){return e},"Complex, Object":function(e,r){return 0!==e.im?e:N(e.re,r)},"Matrix, Object":function(e,r){return i(N(e.valueOf()))},"Array, Object":function(e,r){return e.map(N)}});function C(e){return new p("-","unaryMinus",[e])}function S(e,r,t,n){var i=r.shift(),a=r.reduce((r,i)=>{if(!er(i)){var a=r.pop();if(er(a))return[a,i];try{return r.push(b(e,[a,i],n)),r}catch(e){r.push(a)}}r.push(D(r.pop()));var o=1===r.length?r[0]:t(r);return[t([o,D(i)])]},[i]);return 1===a.length?a[0]:t([a[0],w(a[1])])}function M(e,r){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":case"bigint":return E(e.value,r);case"string":return e.value;default:if(!isNaN(e.value))return E(e.value,r)}return e;case"FunctionNode":if(n[e.name]&&n[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){var t=e.args.map(e=>M(e,r));if(!t.some(er))try{return b(e.name,t,r)}catch(e){}if("size"===e.name&&1===t.length&&Z(t[0])){for(var a=[],o=t[0];Z(o);)a.push(o.items.length),o=o.items[0];return i(a)}return new c(e.name,t.map(D))}case"OperatorNode":var p,h,w=e.fn.toString(),N=y(e);if(en(e)&&e.isUnary())h=er((p=[M(e.args[0],r)])[0])?N(p):b(w,p,r);else if(g(e,r.context))if(p=(p=v(e,r.context)).map(e=>M(e,r)),d(w,r.context)){for(var A=[],C=[],T=0;T<p.length;T++)er(p[T])?C.push(p[T]):A.push(p[T]);A.length>1?(h=S(w,A,N,r),C.unshift(h),h=S(w,C,N,r)):h=S(w,p,N,r)}else h=S(w,p,N,r);else h=S(w,p=e.args.map(e=>M(e,r)),N,r);return h;case"ParenthesisNode":return M(e.content,r);case"AccessorNode":return function(e,r,t){if(!ee(r))return new s(D(e),D(r));if(Z(e)||F(e)){for(var n=Array.from(r.dimensions);n.length>0;)if(Y(n[0])&&"string"!=typeof n[0].value){var a=E(n.shift().value,t);Z(e)?e=e.items[a-1]:(e=e.valueOf()[a-1])instanceof Array&&(e=i(e))}else if(n.length>1&&Y(n[1])&&"string"!=typeof n[1].value){var o=E(n[1].value,t),c=[],m=Z(e)?e.items:e.valueOf();for(var p of m)if(Z(p))c.push(p.items[o-1]);else if(F(e))c.push(p[o-1]);else break;if(c.length===m.length)e=Z(e)?new u(c):i(c),n.splice(1,1);else break}else break;return n.length===r.dimensions.length?new s(D(e),r):n.length>0?(r=new f(n),new s(D(e),r)):e}if(et(e)&&1===r.dimensions.length&&Y(r.dimensions[0])){var h=r.dimensions[0].value;return h in e.properties?e.properties[h]:new l}return new s(D(e),r)}(M(e.object,r),M(e.index,r),r);case"ArrayNode":var B=e.items.map(e=>M(e,r));if(B.some(er))return new u(B.map(D));return i(B);case"IndexNode":return new f(e.dimensions.map(e=>x(e,r)));case"ObjectNode":var O={};for(var _ in e.properties)O[_]=x(e.properties[_],r);return new m(O);default:throw Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return x}),td="compile",tg=ef(td,["typed","parse"],e=>{var{typed:r,parse:t}=e;return r(td,{string:function(e){return t(e).compile()},"Array | Matrix":function(e){return tr(e,function(e){return t(e).compile()})}})}),tv="simplifyCore",ty=ef(tv,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],e=>{var{typed:r,parse:t,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:l,AccessorNode:c,ArrayNode:f,ConstantNode:m,FunctionNode:p,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:v,SymbolNode:y}=e,x=new m(0),b=new m(1),w=new m(!0),D=new m(!1);function N(e){return en(e)&&["and","not","or"].includes(e.op)}var{hasProperty:E,isCommutative:A}=tc({FunctionNode:p,OperatorNode:g,SymbolNode:y});function C(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r?r.context:void 0;if(E(e,"trivial",t)){if(K(e)&&1===e.args.length)return C(e.args[0],r);var a=!1,o=0;if(e.forEach(e=>{1==++o&&(a=C(e,r))}),1===o)return a}var s=e;if(K(s)){var u=function(e){var r="OperatorNode:"+e;for(var t of rv)if(r in t)return t[r].op;return null}(s.name);if(!u)return new p(C(s.fn),s.args.map(e=>C(e,r)));if(s.args.length>2&&E(s,"associative",t))for(;s.args.length>2;){var l=s.args.pop(),m=s.args.pop();s.args.push(new g(u,s.name,[l,m]))}s=new g(u,s.name,s.args)}if(en(s)&&s.isUnary()){var v=C(s.args[0],r);if("~"===s.op&&en(v)&&v.isUnary()&&"~"===v.op||"not"===s.op&&en(v)&&v.isUnary()&&"not"===v.op&&N(v.args[0]))return v.args[0];var y=!0;if("-"===s.op&&en(v)&&(v.isBinary()&&"subtract"===v.fn&&(s=new g("-","subtract",[v.args[1],v.args[0]]),y=!1),v.isUnary()&&"-"===v.op))return v.args[0];if(y)return new g(s.op,s.fn,[v])}if(en(s)&&s.isBinary()){var S=C(s.args[0],r),M=C(s.args[1],r);if("+"===s.op){if(Y(S)&&i(S.value))return M;if(Y(M)&&i(M.value))return S;en(M)&&M.isUnary()&&"-"===M.op&&(s=new g("-","subtract",[S,M=M.args[0]]))}if("-"===s.op)return en(M)&&M.isUnary()&&"-"===M.op?C(new g("+","add",[S,M.args[0]]),r):Y(S)&&i(S.value)?C(new g("-","unaryMinus",[M
1])):Y(M)&&i(M.value)?S:new g(s.op,s.fn,[S,M]);if("*"===s.op){if(Y(S)){if(i(S.value))return x;else if(n(S.value,1))return M}if(Y(M)){if(i(M.value))return x;if(n(M.value,1))return S;if(A(s,t))return new g(s.op,s.fn,[M,S],s.implicit)}return new g(s.op,s.fn,[S,M],s.implicit)}if("/"===s.op)return Y(S)&&i(S.value)?x:Y(M)&&n(M.value,1)?S:new g(s.op,s.fn,[S,M]);if("^"===s.op&&Y(M)){if(i(M.value))return b;else if(n(M.value,1))return S}if("and"===s.op){if(Y(S))if(!S.value)return D;else{if(N(M))return M;if(Y(M))return M.value?w:D}if(Y(M)){if(!M.value)return D;else if(N(S))return S}}if("or"===s.op){if(Y(S)){if(S.value)return w;else if(N(M))return M}if(Y(M)){if(M.value)return w;else if(N(S))return S}}return new g(s.op,s.fn,[S,M])}if(en(s))return new g(s.op,s.fn,s.args.map(e=>C(e,r)));if(Z(s))return new f(s.items.map(e=>C(e,r)));if(G(s))return new c(C(s.object,r),C(s.index,r));if(ee(s))return new h(s.dimensions.map(e=>C(e,r)));if(et(s)){var F={};for(var T in s.properties)F[T]=C(s.properties[T],r);return new d(F)}return s}return r(tv,{Node:C,"Node,Object":C})}),tx="evaluate",tb=ef(tx,["typed","parse"],e=>{var{typed:r,parse:t}=e;return r(tx,{string:function(e){var r=x();return t(e).compile().evaluate(r)},"string, Map | Object":function(e,r){return t(e).compile().evaluate(r)},"Array | Matrix":function(e){var r=x();return tr(e,function(e){return t(e).compile().evaluate(r)})},"Array | Matrix, Map | Object":function(e,r){return tr(e,function(e){return t(e).compile().evaluate(r)})}})}),tw=ef("Help",["evaluate"],e=>{var{evaluate:r}=e;function t(e){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator");if(!e)throw Error('Argument "doc" missing');this.doc=e}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var e=this.doc||{},t="\n";if(e.name&&(t+="Name: "+e.name+"\n\n"),e.category&&(t+="Category: "+e.category+"\n\n"),e.description&&(t+="Description:\n "+e.description+"\n\n"),e.syntax&&(t+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){t+="Examples:\n";for(var n=!1,i=r("config()"),a={config:e=>(n=!0,r("config(newConfig)",{newConfig:e}))},o=0;o<e.examples.length;o++){var s=e.examples[o];t+=" "+s+"\n";var u=void 0;try{u=r(s,a)}catch(e){u=e}void 0===u||R(u)||(t+=" "+eH(u,{precision:14})+"\n")}t+="\n",n&&r("config(originalConfig)",{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(t+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(t+="See also: "+e.seealso.join(", ")+"\n"),t},t.prototype.toJSON=function(){var e=o(this.doc);return e.mathjs="Help",e},t.fromJSON=function(e){var r={};return Object.keys(e).filter(e=>"mathjs"!==e).forEach(t=>{r[t]=e[t]}),new t(r)},t.prototype.valueOf=t.prototype.toString,t},{isClass:!0}),tD=ef("Parser",["evaluate","parse"],e=>{var{evaluate:r,parse:t}=e;function n(){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:x(),writable:!1})}return n.prototype.type="Parser",n.prototype.isParser=!0,n.prototype.evaluate=function(e){return r(e,this.scope)},n.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},n.prototype.getAll=function(){var e=this.scope;if(e instanceof g)return e.wrappedObject;var r={};for(var t of e.keys()){var n=e.get(t);f(r,t,n)}return r},n.prototype.getAllAsMap=function(){return this.scope},n.prototype.set=function(e,r){if(!function(e){if(0===e.length)return!1;for(var r=0;r<e.length;r++){var n=e.charAt(r-1),i=e.charAt(r),a=e.charAt(r+1);if(!(t.isAlpha(i,n,a)||r>0&&t.isDigit(i)))return!1}return!0}(e))throw Error("Invalid variable name: '".concat(e,"'. Variable names must follow the specified rules."));return this.scope.set(e,r),r},n.prototype.remove=function(e){this.scope.delete(e)},n.prototype.clear=function(){this.scope.clear()},n.prototype.toJSON=function(){var e,r={mathjs:"Parser",variables:{},functions:{}};for(var[t,n]of this.scope)if(q(n)){if("function"!=typeof(e=n)||"string"!=typeof e.syntax||"string"!=typeof e.expr)throw Error("Cannot serialize external function ".concat(t));r.functions[t]="".concat(n.syntax," = ").concat(n.expr)}else r.variables[t]=n;return r},n.fromJSON=function(e){var r=new n;
1return Object.entries(e.variables).forEach(e=>{var[t,n]=e;return r.set(t,n)}),Object.entries(e.functions).forEach(e=>{var[t,n]=e;return r.evaluate(n)}),r},n},{isClass:!0});function tN(e){return Y(e)||en(e)&&e.isUnary()&&Y(e.args[0])}function tE(e){return!!(Y(e)||(K(e)||en(e))&&e.args.every(tE)||ei(e)&&tE(e.content))}var tA=ef("simplify",["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],e=>{var{typed:r,parse:t,equal:n,resolve:i,simplifyConstant:a,simplifyCore:o,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:f,IndexNode:m,ObjectNode:p,OperatorNode:h,ParenthesisNode:d,SymbolNode:g,replacer:v}=e,{hasProperty:y,isCommutative:w,isAssociative:D,mergeContext:N,flatten:E,unflattenr:A,unflattenl:C,createMakeNodeFunction:S,defaultContext:M,realContext:F,positiveContext:T}=tc({FunctionNode:f,OperatorNode:h,SymbolNode:g});r.addConversion({from:"Object",to:"Map",convert:b});var B=r("simplify",{Node:I,"Node, Map":(e,r)=>I(e,!1,r),"Node, Map, Object":(e,r,t)=>I(e,!1,r,t),"Node, Array":I,"Node, Array, Map":I,"Node, Array, Map, Object":I});function O(e){return e.transform(function(e){return ei(e)?O(e.content):e})}r.removeConversion({from:"Object",to:"Map",convert:b}),B.defaultContext=M,B.realContext=F,B.positiveContext=T;var _={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};B.rules=[o,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},a,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},a,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];var z=0;function k(){return new g("_p"+z++)}function I(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:x(),a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=a.consoleDebug;r=function(e,r){for(var n=[],i=0;i<e.length;i++){var a=e[i],o=void 0,s=typeof a;switch(s){case"string":a={s:a};case"object":o=function(e,r){var n={};if(e.s){var i=e.s.split("->");if(2===i.length)n.l=i[0],n.r=i[1];else throw SyntaxError("Could not parse rule: "+e.s)}else n.l=e.l,n.r=e.r;for(var a of(n.l=O(t(n.l)),n.r=O(t(n.r)),["imposeContext","repeat","assuming"]))a in e&&(n[a]=e[a]);if(e.evaluate&&(n.evaluate=t(e.evaluate)),D(n.l,r)){var o,s=!w(n.l,r);s&&(o=k());var u=S(n.l),l=k();n.expanded={},n.expanded.l=u([n.l,l]),E(n.expanded.l,r),A(n.expanded.l,r),n.expanded.r=u([n.r,l]),s&&(n.expandedNC1={},n.expandedNC1.l=u([o,n.l]),n.expandedNC1.r=u([o,n.r]),n.expandedNC2={},n.expandedNC2.l=u([o,n.expanded.l]),n.expandedNC2.r=u([o,n.expanded.r]))}return n}(a,r);break;case"function":o=a;break;default:throw TypeError("Unsupported type of rule: "+s)}n.push(o)}return n}(r||B.rules,a.context);var s=i(e,n);s=O(s);for(var u={},l=s.toString({parenthesis:"all"});!u[l];){u[l]=!0,z=0;var c=l;o&&console.log("Working on: ",l);for(var f=0;f<r.length;f++){var m="";if("function"==typeof r[f]?(s=r[f](s,a),o&&(m=r[f].name)):(E(s,a.context),s=q(s,r[f],a.context),o&&(m="".concat(r[f].l.toString()," -> ").concat(r[f].r.toString()))),o){var p=s.toString({parenthesis:"all"});p!==c&&(console.log("Applying",m,"produced",p),c=p)}C(s,a.context)}l=s.toString({parenthesis:"all"})}return s}function R(e,r,t){var n=e;if(e)for(var i=0;i<e.length;++i){var a=q(e[i],r,t);a!==e[i]&&(n===e&&(n=e.slice()),n[i]=a)}return n}function q(e,r,t){if(r.assuming){for(var n in r.assuming)for(var i in r.assuming[n])if(y(n,i,t)!==r.assuming[n][i])return e}var a=N(r.imposeContext,t),o=e;if(o instanceof h||o instanceof f){var c=R(o.args,r,t);c!==o.args&&((o=o.clone()).args=c)}else if(o instanceof d){if(o.content){var g=q(o.content,r,t);g!==o.content&&(o=new d(g))}}else if(o instanceof u){var v=R(o.items,r,t);v!==o.items&&(o=new u(v))}else if(o instanceof s){var x=o.object;o.object&&(x=q(o.object,r,t));var b=o.index;o.index&&(b=q(o.index,r,t)),(x!==o.object||b!==o.index)&&(o=new s(x,b))}else if(o instanceof m){var w=R(o.dimensions,r,t);w!==o.dimensions&&(o=new m(w))}else if(o instanceof p){var D=!1,E={};for(var A in o.properties)E[A]=q(o.properties[A],r,t),E[A]!==o.properties[A]&&(D=!0);D&&(o=new p(E))}var C=r.r,S=j(r.l,o,a)[0];if(!S&&r.expanded&&(C=r.expanded.r,S=j(r.expanded.l,o,a)[0]),!S&&r.expandedNC1&&(C=r.expandedNC1.r,(S=j(r.expandedNC1.l,o,a)[0])||
1(C=r.expandedNC2.r,S=j(r.expandedNC2.l,o,a)[0])),S){var M=o.implicit;o=C.clone(),M&&"implicit"in C&&(o.implicit=!0),o=o.transform(function(e){return e.isSymbolNode&&l(S.placeholders,e.name)?S.placeholders[e.name].clone():e})}return r.repeat&&o!==e&&(o=q(o,r,t)),o}function P(e,r){var t,i=[];if(0===e.length||0===r.length)return i;for(var a=0;a<e.length;a++)for(var o=0;o<r.length;o++)(t=function(e,r){var t={placeholders:{}};if(!e.placeholders&&!r.placeholders)return t;if(!e.placeholders)return r;if(!r.placeholders)return e;for(var i in e.placeholders)if(l(e.placeholders,i)&&(t.placeholders[i]=e.placeholders[i],l(r.placeholders,i)&&!function e(r,t){if(r instanceof c&&t instanceof c){if(!n(r.value,t.value))return!1}else if(r instanceof g&&t instanceof g){if(r.name!==t.name)return!1}else{if((!(r instanceof h)||!(t instanceof h))&&(!(r instanceof f)||!(t instanceof f)))return!1;if(r instanceof h){if(r.op!==t.op||r.fn!==t.fn)return!1}else if(r instanceof f&&r.name!==t.name)return!1;if(r.args.length!==t.args.length)return!1;for(var i=0;i<r.args.length;i++)if(!e(r.args[i],t.args[i]))return!1}return!0}(e.placeholders[i],r.placeholders[i])))return null;for(var a in r.placeholders)l(r.placeholders,a)&&(t.placeholders[a]=r.placeholders[a]);return t}(e[a],r[o]))&&i.push(t);return i}function j(e,r,t,i){var a=[{placeholders:{}}];if(e instanceof h&&r instanceof h||e instanceof f&&r instanceof f){if(e instanceof h){if(e.op!==r.op||e.fn!==r.fn)return[]}else if(e instanceof f&&e.name!==r.name)return[];if(1===r.args.length&&1===e.args.length||!D(r,t)&&r.args.length===e.args.length||i){for(var o=[],s=0;s<e.args.length;s++){var u=j(e.args[s],r.args[s],t);if(0===u.length)break;o.push(u)}if(o.length!==e.args.length){if(!w(r,t)||1===e.args.length)return[];if(e.args.length>2)throw Error("permuting >2 commutative non-associative rule arguments not yet implemented");var l=j(e.args[0],r.args[1],t);if(0===l.length)return[];var m=j(e.args[1],r.args[0],t);
1if(0===m.length)return[];o=[l,m]}a=function(e){if(0===e.length)return e;for(var r=e.reduce(P),t=[],n={},i=0;i<r.length;i++){var a=JSON.stringify(r[i],v);n[a]||(n[a]=!0,t.push(r[i]))}return t}(o)}else if(r.args.length>=2&&2===e.args.length){for(var p=function(e,r){var t,n,i=[],a=S(e);if(w(e,r))for(var o=0;o<e.args.length;o++)(n=e.args.slice(0)).splice(o,1),t=1===n.length?n[0]:a(n),i.push(a([e.args[o],t]));else for(var s=1;s<e.args.length;s++){var u=e.args[0];s>1&&(u=a(e.args.slice(0,s))),t=1===(n=e.args.slice(s)).length?n[0]:a(n),i.push(a([u,t]))}return i}(r,t),d=[],y=0;y<p.length;y++){var x=j(e,p[y],t,!0);d=d.concat(x)}return d}else if(!(e.args.length>2))return[];else throw Error("Unexpected non-binary associative function: "+e.toString())}else if(e instanceof g){if(0===e.name.length)throw Error("Symbol in rule has 0 length...!?");if(_[e.name]){if(e.name!==r.name)return[]}else switch(e.name[1]>="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":a[0].placeholders[e.name]=r;break;case"c":case"cl":if(!Y(r))return[];a[0].placeholders[e.name]=r;break;case"v":if(Y(r))return[];a[0].placeholders[e.name]=r;break;case"vl":if(!es(r))return[];a[0].placeholders[e.name]=r;break;case"cd":if(!tN(r))return[];a[0].placeholders[e.name]=r;break;case"vd":if(tN(r))return[];a[0].placeholders[e.name]=r;break;case"ce":if(!tE(r))return[];a[0].placeholders[e.name]=r;break;case"ve":if(tE(r))return[];a[0].placeholders[e.name]=r;break;default:throw Error("Invalid symbol in rule: "+e.name)}}else if(!(e instanceof c))return[];else if(!n(e.value,r.value))return[];return a}return B}),tC="symbolicEqual",tS=ef(tC,["parse","simplify","typed","OperatorNode"],e=>{var{parse:r,simplify:t,typed:n,OperatorNode:i}=e;function a(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=t(new i("-","subtract",[e,r]),{},n);return Y(a)&&!a.value}return n(tC,{"Node, Node":a,"Node, Node, Object":a})}),tM="leafCount",tF=ef(tM,["parse","typed"],e=>{var{parse:r,typed:t}=e;return t(tM,{Node:function(e){return function e(r){var t=0;return r.forEach(r=>{t+=e(r)}),t||1}(e)}})}),tT="parser",tB=ef(tT,["typed","Parser"],e=>{var{typed:r,Parser:t}=e;return r(tT,{"":function(){return new t}})}),tO="rationalize",t_=ef(tO,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],e=>{var{config:r,typed:t,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:l,parse:c,simplifyConstant:f,simplifyCore:m,simplify:p,fraction:h,bignumber:d,mathWithTransform:g,matrix:v,AccessorNode:y,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:D,ObjectNode:N,OperatorNode:E,SymbolNode:A,ParenthesisNode:C}=e;function S(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=(l=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],c=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],(h={}).firstRules=(u=[m,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}]).concat(l,c),h.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],h.sucDivRules=c,h.firstRulesAgain=u.concat(l),h.finalRules=[m,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],h),i=(d=e,g=r,v=!0,y=n.firstRules,x=[],w=p(d,y,g,{exactFractions:!1}),D="+-*"+((v=!!v)?"/":""),!function e(r){var t=r.type;if("FunctionNode"===t)throw Error("There is an unsolved function call");if("OperatorNode"===t)if("^"===r.op)if("ConstantNode"===r.args[1].type&&eg(parseFloat(r.args[1].value)))e(r.args[0]);else throw Error("There is a non-integer exponent");else{if(!D.includes(r.op))throw Error("Operator "+r.op+" invalid in polynomial expression");for(var n=0;n<r.args.length;n++)e(r.args[n])}else if("SymbolNode"===t){var i=r.name;-1===x.indexOf(i)&&x.push(i)}else if("ParenthesisNode"===t)e(r.content);else if("ConstantNode"!==t)throw Error("type "+t+" is not allowed in polynomial expression")}(w),(N={}).expression=w,N.variables=x,N),a=i.variables.length,o={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,a>=1){e=function e(r,t,n){var i=r.type,a=arguments.length>1;if("OperatorNode"===i&&r.isBinary()){var o,s=!1;if("^"===r.op&&("ParenthesisNode"===r.args[0].type||"OperatorNode"===r.args[0].type)&&"ConstantNode"===r.args[1].type&&(s=(o=parseFloat(r.args[1].value))>=2&&eg(o)),s){if(o>2){var u=r.args[0],l=new E("^","pow",[r.args[0].cloneDeep(),new b(o-1)]);r=new E("*","multiply",[u,l])}else r=new E("*","multiply",[r.args[0],r.args[0].cloneDeep()]);a&&("content"===n?t.content=r:t.args[n]=r)}}if("ParenthesisNode"===i)e(r.content,r,"content");else if("ConstantNode"!==i&&"SymbolNode"!==i)for(var c=0;c<r.args.length;c++)e(r.args[c],r,c);if(!a)return r}(e);var u,l,c,h,d,g,v,y,x,w,D,N,A,C,S=!0,F=!1;for(e=p(e,n.firstRules,{},o);e=p(e,S?n.distrDivRules:n.sucDivRules,{},s),S=!S,(C=e.toString())!==A;)F=!0,A=C;F&&(e=p(e,n.firstRulesAgain,{},o)),e=p(e,n.finalRules,{},o)}var T=[],B={};return("OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===a&&(e.args[0]=M(e.args[0],T),e.args[1]=M(e.args[1])),t&&(B.numerator=e.args[0],B.denominator=e.args[1])):(1===a&&(e=M(e,T)),t&&(B.numerator=e,B.denominator=null)),t)?(B.coefficients=T,B.variables=i.variables,B.expression=e,B):e}return t(tO,{Node:S,"Node, boolean":(e,r)=>S(e,{}
1,r),"Node, Object":S,"Node, Object, boolean":S});function M(e,r){void 0===r&&(r=[]),r[0]=0;var t,n={};n.cte=1,n.oper="+",n.fire="";var i=0,a="";(function e(t,n,o){var s=t.type;if("FunctionNode"===s)throw Error("There is an unsolved function call");if("OperatorNode"===s){if(!"+-*^".includes(t.op))throw Error("Operator "+t.op+" invalid");if(null!==n&&(("unaryMinus"===t.fn||"pow"===t.fn)&&"add"!==n.fn&&"subtract"!==n.fn&&"multiply"!==n.fn||("subtract"===t.fn||"add"===t.fn||"multiply"===t.fn)&&"add"!==n.fn&&"subtract"!==n.fn||("subtract"===t.fn||"add"===t.fn||"unaryMinus"===t.fn)&&0!==o.noFil))throw Error("Invalid "+t.op+" placing");("^"===t.op||"*"===t.op)&&(o.fire=t.op);for(var u=0;u<t.args.length;u++)"unaryMinus"===t.fn&&(o.oper="-"),("+"===t.op||"subtract"===t.fn)&&(o.fire="",o.cte=1,o.oper=0===u?"+":t.op),o.noFil=u,e(t.args[u],t,o)}else if("SymbolNode"===s){if(t.name!==a&&""!==a)throw Error("There is more than one variable");if(a=t.name,null===n){r[1]=1;return}if("^"===n.op&&0!==o.noFil)throw Error("In power the variable should be the first parameter");if("*"===n.op&&1!==o.noFil)throw Error("In multiply the variable should be the second parameter");(""===o.fire||"*"===o.fire)&&(i<1&&(r[1]=0),r[1]+=o.cte*("+"===o.oper?1:-1),i=Math.max(1,i))}else if("ConstantNode"===s){var l=parseFloat(t.value);if(null===n){r[0]=l;return}if("^"===n.op){if(1!==o.noFil)throw Error("Constant cannot be powered");if(!eg(l)||l<=0)throw Error("Non-integer exponent is not allowed");for(var c=i+1;c<l;c++)r[c]=0;l>i&&(r[l]=0),r[l]+=o.cte*("+"===o.oper?1:-1),i=Math.max(l,i);return}o.cte=l,""===o.fire&&(r[0]+=o.cte*("+"===o.oper?1:-1))}else throw Error("Type "+s+" is not allowed")})(e,null,n),i=r.length-1;for(var o=!0,s=i;s>=0;s--)if(0!==r[s]){var u=new b(o?r[s]:Math.abs(r[s])),l=r[s]<0?"-":"+";if(s>0){var c=new A(a);s>1&&(c=new E("^","pow",[c,new b(s)])),u=-1===r[s]&&o?new E("-","unaryMinus",[c]):1===Math.abs(r[s])?c:new E("*","multiply",[u,c])}t=o?u:"+"===l?new E("+","add",[t,u]):new E("-","subtract",[t,u]),o=!1}return o?new b(0):t}}),tz="derivative",tk=ef(tz,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],e=>{var{typed:r,config:t,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:u,FunctionNode:l,OperatorNode:c,ParenthesisNode:f,SymbolNode:m}=e;function p(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0},n=new Map,a=r.name,o=y(e,function e(r){var t=n.get(r);if(void 0!==t)return t;var i=v(e,r,a);return n.set(r,i),i});return t.simplify?i(o):o}function h(e){var r=n(e);if(!r.isSymbolNode)throw TypeError("Invalid variable. "+"Cannot parse ".concat(JSON.stringify(e)," into a variable in function derivative"));return r}var d=r(tz,{"Node, SymbolNode":p,"Node, SymbolNode, Object":p,"Node, string":(e,r)=>p(e,h(r)),"Node, string, Object":(e,r,t)=>p(e,h(r),t)});d._simplify=!0,d.toTex=function(e){return g.apply(null,e.args)};var g=r("_derivTex",{"Node, SymbolNode":function(e,r){return Y(e)&&"string"===el(e.value)?g(n(e.value).toString(),r.toString(),1):g(e.toTex(),r.toString(),1)},"Node, ConstantNode":function(e,r){if("string"===el(r.value))return g(e,n(r.value));throw Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,r,t){return g(e.toString(),r.name,t.value)},"string, string, number":function(e,r,t){return(1===t?"{d\\over d"+r+"}":"{d^{"+t+"}\\over d"+r+"^{"+t+"}}")+"\\left[".concat(e,"\\right]")}}),v=r("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(e,r,t){return r.name!==t},"function, ParenthesisNode, string":function(e,r,t){return e(r.content,t)},"function, FunctionAssignmentNode, string":function(e,r,t){return!r.params.includes(t)||e(r.expr,t)},"function, FunctionNode | OperatorNode, string":function(e,r,t){return r.args.every(r=>e(r,t))}}),y=r("_derivative",{"ConstantNode, function":function(){return x(0)},"SymbolNode, function":function(e,r){return r(e)?x(0):x(1)},"ParenthesisNode, function":function(e,r){return new f(y(e.content,r))},"FunctionAssignmentNode, function":function(e,r){return r(e)?x(0):y(e.expr,r)},"FunctionNode, function":function(e,r){if(r(e))return x(0);var t,n,i,a,o=e.args[0],s=!1,u=!1;switch(e.name){case"cbrt":s=!0,n=new c("*","multiply",[x(3),new c("^","pow",[o,new c("/","divide",[x(2),x(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,n=new c("*","multiply",[x(2),new l("sqrt",[o])]);else if(2===e.args.length)return t=new c("/","divide",[x(1),e.args[1]]),y(new c("^","pow",[o,t]),r);break;case"log10":t=x(10);case"log":if(t||1!==e.args.length){if(1===e.args.length&&t||2===e.args.length&&r(e.args[1]))n=new c("*","multiply",[o.clone(),new l("log",[t||e.args[1]])]),s=!0;else if(2===e.args.length)return y(new c("/","divide",[new l("log",[o]),new l("log",[e.args[1]])]),r)}else n=o.clone(),s=!0;break;case"pow":if(2===e.args.length)return y(new c("^","pow",[o,e.args[1]]),r);break;case"exp":n=new l("exp",[o.clone()]);break;case"sin":n=new l("cos",[o.clone()]);break;case"cos":n=new c("-","unaryMinus",[new l("sin",[o.clone()])]);break;case"tan":n=new c("^","pow",[new l("sec",[o.clone()]),x(2)]);break;case"sec":n=new c("*","multiply",[e,new l("tan",[o.clone()])]);break;case"csc":u=!0,n=new c("*","multiply",[e,new l("cot",[o.clone()])]);break;case"cot":u=!0,n=new c("^","pow",[new l("csc",[o.clone()]),x(2)]);break;case"asin":s=!0,n=new l("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[o.clone(),x(2)])])]);break;case"acos":s=!0,u=!0,n=new l("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[o.clone(),x(2)])])]);break;case"atan":s=!0,n=new c("+","add",[new c("^","pow",[o.clone(),x(2)]),x(1)]);break;case"asec":s=!0,n=new c("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[o.clone(),x(2)]),x(1)])])]);break;case"acsc":s=!0,u=!0,n=new c("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[o.clone(),x(2)]),x(1)])])]);break;case"acot":s=!0,u=!0,n=new c("+","add",[new c("^","pow",[o.clone(),x(2)]),x(1)]);break;case"sinh":n=new l("cosh",[o.clone()]);break;case"cosh":n=new l("sinh",[o.clone()]);break;case"tanh":n=new c("^","pow",[new l("sech",[o.clone()]),x(2)]);break;case"sech":u=!0,n=new c("*","multiply",[e,new l("tanh",[o.clone()])]);break;case"csch":u=!0,n=new c("*","multiply",[e,new l("coth",[o.clone()])]);break;case"coth":u=!0,n=new c("^","pow",[new l("csch",[o.clone()]),x(2)]);break;
1case"asinh":s=!0,n=new l("sqrt",[new c("+","add",[new c("^","pow",[o.clone(),x(2)]),x(1)])]);break;case"acosh":s=!0,n=new l("sqrt",[new c("-","subtract",[new c("^","pow",[o.clone(),x(2)]),x(1)])]);break;case"atanh":s=!0,n=new c("-","subtract",[x(1),new c("^","pow",[o.clone(),x(2)])]);break;case"asech":s=!0,u=!0,n=new c("*","multiply",[o.clone(),new l("sqrt",[new c("-","subtract",[x(1),new c("^","pow",[o.clone(),x(2)])])])]);break;case"acsch":s=!0,u=!0,n=new c("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new c("+","add",[new c("^","pow",[o.clone(),x(2)]),x(1)])])]);break;case"acoth":s=!0,u=!0,n=new c("-","subtract",[x(1),new c("^","pow",[o.clone(),x(2)])]);break;case"abs":n=new c("/","divide",[new l(new m("abs"),[o.clone()]),o.clone()]);break;default:throw Error('Cannot process function "'+e.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}s?(i="/",a="divide"):(i="*",a="multiply");var f=y(o,r);return u&&(f=new c("-","unaryMinus",[f])),new c(i,a,[f,n])},"OperatorNode, function":function(e,r){if(r(e))return x(0);if("+"===e.op)return new c(e.op,e.fn,e.args.map(function(e){return y(e,r)}));if("-"===e.op){if(e.isUnary())return new c(e.op,e.fn,[y(e.args[0],r)]);if(e.isBinary())return new c(e.op,e.fn,[y(e.args[0],r),y(e.args[1],r)])}if("*"===e.op){var t=e.args.filter(function(e){return r(e)});if(t.length>0){var n=e.args.filter(function(e){return!r(e)}),i=1===n.length?n[0]:new c("*","multiply",n);return new c("*","multiply",t.concat(y(i,r)))}return new c("+","add",e.args.map(function(t){return new c("*","multiply",e.args.map(function(e){return e===t?y(e,r):e.clone()}))}))}if("/"===e.op&&e.isBinary()){var s=e.args[0],u=e.args[1];return r(u)?new c("/","divide",[y(s,r),u]):r(s)?new c("*","multiply",[new c("-","unaryMinus",[s]),new c("/","divide",[y(u,r),new c("^","pow",[u.clone(),x(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[y(s,r),u.clone()]),new c("*","multiply",[s.clone(),y(u,r)])]),new c("^","pow",[u.clone(),x(2)])])}if("^"===e.op&&e.isBinary()){var f=e.args[0],m=e.args[1];if(r(f))return Y(f)&&(o(f.value)||a(f.value,1))?x(0):new c("*","multiply",[e,new c("*","multiply",[new l("log",[f.clone()]),y(m.clone(),r)])]);if(r(m)){if(Y(m)){if(o(m.value))return x(0);if(a(m.value,1))return y(f,r)}var p=new c("^","pow",[f.clone(),new c("-","subtract",[m,x(1)])]);return new c("*","multiply",[m.clone(),new c("*","multiply",[y(f,r),p])])}return new c("*","multiply",[new c("^","pow",[f.clone(),m.clone()]),new c("+","add",[new c("*","multiply",[y(f,r),new c("/","divide",[m.clone(),f.clone()])]),new c("*","multiply",[y(m,r),new l("log",[f.clone()])])])])}throw Error('Cannot process operator "'+e.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function x(e,r){return new u(s(e,r||ev(String(e),t)))}return d}),tI={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},tR={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},tq={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","bigint","complex","fraction","index","matrix","string","unit"]},bigint:{name:"bigint",category:"Construction",syntax:["bigint(x)"],description:"Create a bigint, an integer with an arbitrary number of digits, from a number or string.",examples:["123123123123123123 # a large number will lose digits",'bigint("123123123123123123")','bignumber(["1", "3", "5"])'],seealso:["boolean","bignumber","number","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,de
1n)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","bigint","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:tI,E:tI,false:{name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},i:{name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},Infinity:{name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},LN2:{name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LN10:{name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LOG2E:{name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},LOG10E:{name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},NaN:{name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},null:{name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]}
1,pi:tR,PI:tR,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]}
1,coulomb:{description:"Coulomb's constant. Deprecated in favor of coulombConstant",examples:["coulombConstant"]},coulombConstant:{description:"Coulomb's constant",examples:["coulombConstant"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Bohr magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Bohr radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},lsolveAll:{name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2,
11], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},leafCount:{name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},polynomialRoot:{name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},resolve:{name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},simplifyConstant:{name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCore:{name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},symbolicEqual:{name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},usolveAll:{name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cub
1ic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)","ceil(x, n)","ceil(unit, valuelessUnit)","ceil(unit, n, valuelessUnit)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)","ceil(3.241cm, cm)","ceil(3.241cm, 2, cm)"],seealso:["floor","fix","round"]},cube:{name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},divide:{name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},dotDivide:{name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},dotMultiply:{name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},dotPow:{name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},exp:{name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},expm:{name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},expm1:{name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},fix:{name:"fix",category:"Arithmetic",syntax:["fix(x)","fix(x, n)","fix(unit, valuelessUnit)","fix(unit, n, valuelessUnit)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)","fix(3.241cm, cm)","fix(3.241cm, 2, cm)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)","floor(x, n)","floor(unit, valuelessUnit)","floor(unit, n, valuelessUnit)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)","floor(3.241cm, cm)","floor(3.241cm, 2, cm)"],seealso:["ceil","fix","round"]},gcd:{name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},hypot:{name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenuse of a list with values.",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divi
1de"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>0, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]},sqrt:{name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]}
1,sqrtm:{name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[33, 24], [48, 57]])"],seealso:["sqrt","abs","square","multiply"]},square:{name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]},subtract:{name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]},unaryMinus:{name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]},unaryPlus:{name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]},xgcd:{name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]}
1,invmod:{name:"invmod",category:"Arithmetic",syntax:["invmod(a, b)"],description:"Calculate the (modular) multiplicative inverse of a modulo b. Solution to the equation ax ⣠1 (mod b)",examples:["invmod(8, 12)","invmod(7, 13)","invmod(15151, 15122)"],seealso:["gcd","xgcd"]},bitAnd:{name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitNot:{name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]},bitOr:{name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]},bitXor:{name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]},leftShift:{name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]},rightArithShift:{name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]},rightLogShift:{name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]},bellNumbers:{name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]},catalan:{name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]},composition:{name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]},stirlingS2:{name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2
1(5, 3)"],seealso:["bellNumbers"]},config:{name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]},import:{name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]},typed:{name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number": f(x)=x+x, "string": f(x)=concat(x,x) })',"double(2)",'double("hello")'],seealso:[]},arg:{name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]},conj:{name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]},re:{name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]},im:{name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]},evaluate:{name:"evaluate",category:"Expression",syntax:["evaluate(expression)","evaluate(expression, scope)","evaluate([expr1, expr2, expr3, ...])","evaluate([expr1, expr2, expr3, ...], scope)"],description:"Evaluate an expression or an array with expressions.",examples:['evaluate("2 + 3")','evaluate("sqrt(16)")','evaluate("2 inch to cm")','evaluate("sin(x * pi)", { "x": 1/2 })','evaluate(["width=2", "height=4","width*height"])'],seealso:["parser","parse","compile"]},help:{name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]},parse:{name:"parse",category:"Expression",syntax:["parse(expr)","parse(expr, options)","parse([expr1, expr2, expr3, ...])","parse([expr1, expr2, expr3, ...], options)"],description:"Parse an expression. Returns a node tree, which can be evaluated by invoking node.evaluate() or transformed into a functional object via node.compile().",examples:['node1 = parse("sqrt(3^2 + 4^2)")',"node1.evaluate()","code1 = node1.compile()","code1.evaluate()","scope = {a: 3, b: 4}",'node2 = parse("a * b")',"node2.evaluate(scope)","code2 = node2.compile()","code2.evaluate(scope)"],seealso:["parser","evaluate","compile"]},parser:{name:"parser",category:"Expression",syntax:["parser()"],description:"Create a parser object that keeps a context of variables and their values, allowing the evaluation of expressions in that context.",examples:["myParser = parser()",'myParser.evaluate("sqrt(3^2 + 4^2)")','myParser.set("x", 3)','myParser.evaluate("y = x + 3")','myParser.evaluate(["y = x + 3", "y = y + 1"])','myParser.get("y")'],seealso:["evaluate","parse","compile"]},compile:{name:"compile",category:"Expression",syntax:["compile(expr) ","compile([expr1, expr2, expr3, ...])"],description:"Parse and compile an expression. Returns a an object with a function evaluate([scope]) to evaluate the compiled expression.",examples:['code1 = compile("sqrt(3^2 + 4^2)")',"code1.evaluate() ",'code2 = compile("a * b")',"code2.evaluate({a: 3, b: 4})"],seealso:["parser","parse","evaluate"]},distance:{name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2]])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]},intersect:{name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]},and:{name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]},not:{name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]},nullish:{name:"nullish",category:"Logical",syntax:["x ?? y","nullish(x, y)"],description:"Nullish coalescing operator. Returns the right-hand operand when the left-hand operand is null or undefined, and otherwise returns the left-hand operand.",examples:["null ?? 42","undefined ?? 42","0 ?? 42","false ?? 42","null ?? undefined ?? 42"],seealso:["and","or","not"]},or:{name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]},xor:{name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]},mapSlices:{name:"mapSlices",category:"Matrix",syntax:["mapSlices(A, dim, callback)"],description:"Generate a matrix one dimension less than A by applying c
1allback to each slice of A along dimension dim.",examples:["A = [[1, 2], [3, 4]]","mapSlices(A, 1, sum)","mapSlices(A, 2, prod)"],seealso:["map","forEach"]},concat:{name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},count:{name:"count",category:"Matrix",syntax:["count(x)"],description:"Count the number of elements of a matrix, array or string.",examples:["a = [1, 2; 3, 4; 5, 6]","count(a)","size(a)",'count("hello world")'],seealso:["size"]},cross:{name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]},column:{name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row","matrixFromColumns"]},ctranspose:{name:"ctranspose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","one
1s","range","size","squeeze","subset","trace","zeros"]},det:{name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diag:{name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},diff:{name:"diff",category:"Matrix",syntax:["diff(arr)","diff(arr, dim)"],description:["Create a new matrix or array with the difference of the passed matrix or array.","Dim parameter is optional and used to indicate the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dot:{name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},getMatrixDataType:{name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},identity:{name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},filter:{name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},flatten:{name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]}
1,forEach:{name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},inv:{name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},pinv:{name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the MooreâPenrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},eigs:{name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the Kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},matrixFromFunction:{name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn
1)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},matrixFromRows:{name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},matrixFromColumns:{name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)","map(x, y, ..., callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.",examples:["map([1, 2, 3], square)","map([1, 2], [3, 4], f(a,b) = a + b)"],seealso:["filter","forEach"]},ones:{name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},partitionSelect:{name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},range:{name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","one
1s","size","squeeze","subset","trace","transpose","zeros"]},resize:{name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},reshape:{name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},rotate:{name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},rotationMatrix:{name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},row:{name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},size:{name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","one
1s","range","squeeze","subset","trace","transpose","zeros"]},sort:{name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},squeeze:{name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},subset:{name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","one
1s","range","size","squeeze","trace","transpose","zeros"]},trace:{name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},transpose:{name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},zeros:{name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},fft:{name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifft:{name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},sylvester:{name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},schur:{name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},lyap:{name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},solveODE:{name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},combinations:{name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},combinationsWithRep:{name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},factorial:{name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},gamma:{name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},kldivergence:{name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},lgamma:{name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},multinomial:{name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},permutations:{name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},pickRandom:{name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},random:{name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},randomInt:{name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},compare:{name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},compareNatural:{name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},compareText:{name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},deepEqual:{name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},equal:{name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},equalText:{name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},larger:{name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not. Comparing a value with NaN returns false.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]}
1,largerEq:{name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},smaller:{name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not. Comparing a value with NaN returns false.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},smallerEq:{name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},unequal:{name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},setCartesian:{name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},setDifference:{name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},setDistinct:{name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},setIntersect:{name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},setIsSubset:{name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},setMultiplicity:{name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},setPowerset:{name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},setSize:{name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},setSymDifference:{name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},setUnion:{name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},zpk2tf:{name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},freqz:{name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},erf:{name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},zeta:{name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},cumsum:{name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values. If any NaN values are found, the function yields the last NaN in the input.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},std:{name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},sum:{name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","variance"]},variance:{name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]}
1,corr:{name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},acsc:{name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},acsch:{name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},asec:{name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},asech:{name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asin:{name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},asinh:{name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},atan:{name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},atanh:{name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},atan2:{name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},cos:{name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},cosh:{name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cot:{name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},coth:{name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},csc:{name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},csch:{name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]}
1,sec:{name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},sech:{name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},sin:{name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},sinh:{name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tan:{name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},tanh:{name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},to:{name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},toBest:{name:"toBest",category:"Units",syntax:["toBest(x)","toBest(x, unitList)","toBest(x, unitList, options)"],description:"Converts to the most appropriate display unit.",examples:['toBest(unit(5000, "m"))','toBest(unit(3500000, "W"))','toBest(unit(0.000000123, "A"))','toBest(unit(10, "m"), "cm")','toBest(unit(10, "m"), "mm,km", {offset: 1.5})'],seealso:[]},clone:{name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},format:{name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},bin:{name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},oct:{name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},hex:{name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isNaN:{name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isInteger:{name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isNegative:{name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},isNumeric:{name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},hasNumericValue:{name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},isPositive:{name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]}
1,isPrime:{name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isZero:{name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},print:{name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOf:{name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "bigint")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","bigint","fraction","bignumber","string","format"]}},tP="help",tj=ef(tP,["typed","mathWithTransform","Help"],e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(tP,{any:function(e){var r,i=e;if("string"!=typeof e){for(r in t)if(l(t,r)&&e===t[r]){i=r;break}}var a=c(tq,i);if(!a)throw Error('No documentation found on "'+("function"==typeof i?i.name:i)+'"');return new n(a)}})}),tU="mapSlices",tL=ef(tU,["typed","isInteger"],e=>{var{typed:r,isInteger:t}=e;return r(tU,{"Array | Matrix, number | BigNumber, function":function(e,r,n){if(!t(r))throw TypeError("Integer number expected for dimension");var i=Array.isArray(e)?eK(e):e.size();if(r<0||r>=i.length)throw new eQ(r,i.length);return F(e)?e.create(t$(e.valueOf(),r,n),e.datatype()):t$(e,r,n)}})},{formerly:"apply"});function t$(e,r,t){var n,i,a;if(r<=0)if(!Array.isArray(e[0]))return t(e);else{for(n=0,a=function(e){var r,t,n=e.length,i=e[0].length,a=[];for(t=0;t<i;t++){var o=[];for(r=0;r<n;r++)o.push(e[r][t]);a.push(o)}return a}(e),i=[];n<a.length;n++)i[n]=t$(a[n],r-1,t);return i}for(n=0,i=[];n<e.length;n++)i[n]=t$(e[n],r-1,t);return i}function tH(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}var tG=ef("mapSlices",["typed","isInteger"],e=>{var{typed:r,isInteger:t}=e,n=tL({typed:r,isInteger:t});return r("mapSlices",{"...any":function(e){var r=e[1];w(r)?e[1]=r-1:D(r)&&(e[1]=r.minus(1));try{return n.apply(null,e)}catch(e){throw rX(e)}}})},function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?tH(Object(t),!0).forEach(function(r){ed(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):tH(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({isTransformFunction:!0},tL.meta)),tZ=t(85748);function tV(e,r,t,n){if(tZ.isTypedFunction(e)){if(n)i=1;else{var i,a,o=(r.isMatrix?r.size():eK(r)).map(()=>0);i=function(e,r,t,n){for(var i=[r,t,n],a=3;a>0;a--){var o=i.slice(0,a);if(null!==tZ.resolve(e,o))return a}}(e,r.isMatrix?r.get(o):rp(r,o),o,r)}if(r.isMatrix&&"mixed"!==r.dataType&&void 0!==r.dataType){var s=function(e,r){var t=[];if(Object.entries(e.signatures).forEach(e=>{var[n,i]=e;n.split(",").length===r&&t.push(i)}),1===t.length)return t[0]}(e,i);a=void 0!==s?s:e}else a=e;return i>=1&&i<=3?{isUnary:1===i,fn:function(){for(var r=arguments.length,n=Array(r),o=0;o<r;o++)n[o]=arguments[o];return tW(a,n.slice(0,i),t,e.name)}}:{isUnary:!1,fn:function(){for(var r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];return tW(a,n,t,e.name)}}}return void 0===n?{isUnary:function(e){if(1!==e.length)return!1;var r=e.toString();if(/arguments/.test(r))return!1;var t=r.match(/\(.*?\)/);return!/\.\.\./.test(t)}(e),fn:e}:{isUnary:n,fn:e}}function tW(e,r,t,n){try{return e(...r)}catch(e){var i,a=e,o=r,s=t,u=n;if(a instanceof TypeError&&(null==(i=a.data)?void 0:i.category)==="wrongType"){var l=[];throw l.push("value: ".concat(el(o[0]))),o.length>=2&&l.push("index: ".concat(el(o[1]))),o.length>=3&&l.push("array: ".concat(el(o[2]))),TypeError("Function ".concat(s," cannot apply callback arguments ")+"".concat(u,"(").concat(l.join(", "),") at index ").concat(JSON.stringify(o[1])))}throw TypeError("Function ".concat(s," cannot apply callback arguments ")+"to function ".concat(u,": ").concat(a.message))}}var tJ=ef("filter",["typed"],e=>{var{typed:r}=e;
1return r("filter",{"Array, function":tY,"Matrix, function":function(e,r){return e.create(tY(e.valueOf(),r),e.datatype())},"Array, RegExp":ri,"Matrix, RegExp":function(e,r){return e.create(ri(e.valueOf(),r),e.datatype())}})});function tY(e,r){var t=tV(r,e,"filter");return t.isUnary?rn(e,t.fn):rn(e,function(e,r,n){return t.fn(e,[r],n)})}function tX(e,r,t){var n=e.filter(function(e){return es(e)&&!(e.name in r)&&!t.has(e.name)})[0];if(!n)throw Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=new Map,o=new v(t,a,new Set([i])),s=e.compile();return function(e){return a.set(i,e),s.evaluate(o)}}var tQ=ef("transformCallback",["typed"],e=>{var{typed:r}=e;return function(e,t){return r.isTypedFunction(e)?function e(t,n){var i=Object.fromEntries(Object.entries(t.signatures).map(t=>{var[i,a]=t,o=i.split(",").length;return r.isTypedFunction(a)?[i,e(a,n)]:[i,tK(a,o,n)]}));return"string"==typeof t.name?r(t.name,i):r(i)}(e,t):tK(e,e.length,t)}});function tK(e,r,t){return r===t?e:r===t+1?function(){for(var r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];return e(...n.slice(0,t),t0(n[t]))}:r>t+1?function(){for(var r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];return e(...n.slice(0,t),t0(n[t]),...n.slice(t+1))}:e}function t0(e){return e.map(e=>e+1)}var t1=ef("filter",["typed"],e=>{var{typed:r}=e;function t(e,t,i){var a=tJ({typed:r}),o=tQ({typed:r});if(0===e.length)return a();var s=e[0];if(1===e.length)return a(s);var u=e.length-1,l=e[u];return s&&(s=n(s,i)),l&&(l=es(l)||Q(l)?n(l,i):tX(l,t,i)),a(s,o(l,u))}function n(e,r){return e.compile().evaluate(r)}return t.rawArgs=!0,t},{isTransformFunction:!0}),t2="forEach",t3=ef(t2,["typed"],e=>{var{typed:r}=e;return r(t2,{"Array, function":t5,"Matrix, function":function(e,r){e.forEach(r)}})});function t5(e,r){var t=tV(r,e,t2);rd(e,t.fn,t.isUnary)}var t4=ef("forEach",["typed"],e=>{var{typed:r}=e,t=t3({typed:r}),n=tQ({typed:r});function i(e,r,i){if(0===e.length)return t();var o=e[0];if(1===e.length)return t(o);var s=e.length-1,u=e[s];return o&&(o=a(o,i)),u&&(u=es(u)||Q(u)?a(u,i):tX(u,r,i)),t(o,n(u,s))}function a(e,r){return e.compile().evaluate(r)}return i.rawArgs=!0,i},{isTransformFunction:!0}),t8=ef("map",["typed"],e=>{var{typed:r}=e;return r("map",{"Array, function":n,"Matrix, function":function(e,r){return e.map(r)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,i,a)=>(function(e,i){if("function"!=typeof i)throw Error("Last argument must be a callback function");var a,o,s,u,l=e[0].isMatrix,c=e.map(e=>e.isMatrix?e.size():eK(e)),f=rc(...c),m=e.length,p=l?(e,r)=>e.get(r):rp,h=e.map((e,r)=>{var t=c[r].map(()=>0);return e.isMatrix?e.get(t):rp(e,t)}),d=r.isTypedFunction(i)?(a=i,o=h,s=f.map(()=>0),u=e,null!==r.resolve(a,[...o,s,...u])?2:null!==r.resolve(a,[...o,s])?1:(r.resolve(a,o),0)):function(e,r){var t=e.toString();if(/arguments/.test(t))return 2;var n=t.match(/\(.*?\)/);return/\.\.\./.test(n)||e.length>r+1?2:+(e.length===r+1)}(i,m);if(d<2)return function(e,r){var t=e[0],n=e.map(e=>e.isMatrix?e.valueOf():e),i=e.map(e=>e.isMatrix?e.size():eK(e)),a=rc(...i),o=i.map(e=>a.length-e.length),s=a.length-1,u=r.length>1?[]:null,l=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=a[n],l=Array(i);if(n<s)for(var c=function(r){u&&(u[n]=r),l[r]=e(t.map((e,t)=>o[t]>n?e:1===e.length?e[0]:e[r]),n+1)},f=0;f<i;f++)c(f);else for(var m=function(e){u&&(u[n]=e),l[e]=r(t.map(r=>1===r.length?r[0]:r[e]),u?u.slice():void 0)},p=0;p<i;p++)m(p);return l}(n,0);if(!t.isMatrix)return l;var c=t.create();return c._data=l,c._size=a,c}(e,t(d,i,null));var g=l?e.map(r=>r.isMatrix?r.create(rm(r.toArray(),f),r.datatype()):e[0].create(rm(r.valueOf(),f))):e.map(e=>e.isMatrix?rm(e.toArray(),f):rm(e,f)),v=t(d,i,g),y=(e,r)=>v([e,...g.slice(1).map(e=>p(e,r))],r);return l?g[0].map(y):n(g[0],y)})([e,i,...a.slice(0,a.length-1)],a[a.length-1])});function t(e,r,t){switch(e){case 0:return e=>r(...e);case 1:return(e,t)=>r(...e,t);case 2:return(e,n)=>r(...e,n,...t)}}function n(e,r){var t=tV(r,e,"map");return rh(e,t.fn,t.isUnary)}}),t6=ef("map",["typed"],e=>{var{typed:r}=e,t=t8({typed:r}),n=tQ({typed:r});
1function i(e,r,i){if(0===e.length)return t();if(1===e.length)return t(e[0]);var a=e.length-1,o=e.slice(0,a),s=e[a];return o=o.map(e=>u(e,i)),s&&(s=es(s)||Q(s)?u(s,i):tX(s,r,i)),t(...o,n(s,a));function u(e,r){return e.compile().evaluate(r)}}return i.rawArgs=!0,i},{isTransformFunction:!0}),t7=ef("matAlgo03xDSf",["typed"],e=>{var{typed:r}=e;return function(e,t,n,i){var a,o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._values,c=t._index,f=t._ptr,m=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(s.length!==m.length)throw new eX(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");if(!l)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var h=s[0],d=s[1],g=0,v=n;"string"==typeof u&&u===p&&"mixed"!==u&&(a=u,g=r.convert(0,a),v=r.find(n,[a,a]));for(var y=[],x=0;x<h;x++)y[x]=[];for(var b=[],w=[],D=0;D<d;D++){for(var N=D+1,E=f[D],A=f[D+1],C=E;C<A;C++){var S=c[C];b[S]=i?v(l[C],o[S][D]):v(o[S][D],l[C]),w[S]=N}for(var M=0;M<h;M++)w[M]===N?y[M][D]=b[M]:y[M][D]=i?v(g,o[M][D]):v(o[M][D],g)}return e.createDenseMatrix({data:y,size:[h,d],datatype:u===e._datatype&&p===t._datatype?a:void 0})}}),t9=ef("matAlgo12xSfs",["typed","DenseMatrix"],e=>{var{typed:r,DenseMatrix:t}=e;return function(e,n,i,a){var o,s=e._values,u=e._index,l=e._ptr,c=e._size,f=e._datatype;if(!s)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=c[0],p=c[1],h=i;"string"==typeof f&&(o=f,n=r.convert(n,o),h=r.find(i,[o,o]));for(var d=[],g=[],v=[],y=0;y<p;y++){for(var x=y+1,b=l[y],w=l[y+1],D=b;D<w;D++){var N=u[D];g[N]=s[D],v[N]=x}for(var E=0;E<m;E++)0===y&&(d[E]=[]),v[E]===x?d[E][y]=a?h(n,g[E]):h(g[E],n):d[E][y]=a?h(n,0):h(0,n)}return new t({data:d,size:[m,p],datatype:o})}}),ne=ef("matAlgo05xSfSf",["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a,o,s,u,l,c=e._values,f=e._index,m=e._ptr,p=e._size,h=e._datatype||void 0===e._data?e._datatype:e.getDataType(),d=n._values,g=n._index,v=n._ptr,y=n._size,x=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(p.length!==y.length)throw new eX(p.length,y.length);if(p[0]!==y[0]||p[1]!==y[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+y+")");var b=p[0],w=p[1],D=t,N=0,E=i;"string"==typeof h&&h===x&&"mixed"!==h&&(a=h,D=r.find(t,[a,a]),N=r.convert(0,a),E=r.find(i,[a,a]));var A=c&&d?[]:void 0,C=[],S=[],M=A?[]:void 0,F=A?[]:void 0,T=[],B=[];for(s=0;s<w;
1s++){S[s]=C.length;var O=s+1;for(u=m[s],l=m[s+1];u<l;u++)o=f[u],C.push(o),T[o]=O,M&&(M[o]=c[u]);for(u=v[s],l=v[s+1];u<l;u++)T[o=g[u]]!==O&&C.push(o),B[o]=O,F&&(F[o]=d[u]);if(A)for(u=S[s];u<C.length;){var _=T[o=C[u]],z=B[o];if(_===O||z===O){var k=E(_===O?M[o]:N,z===O?F[o]:N);D(k,N)?C.splice(u,1):(A.push(k),u++)}}}return S[w]=C.length,e.createSparseMatrix({values:A,index:C,ptr:S,size:[b,w],datatype:h===e._datatype&&x===n._datatype?a:void 0})}}),nr=ef("matAlgo13xDD",["typed"],e=>{var{typed:r}=e;return function(e,t,n){var i,a=e._data,o=e._size,s=e._datatype,u=t._data,l=t._size,c=t._datatype,f=[];if(o.length!==l.length)throw new eX(o.length,l.length);for(var m=0;m<o.length;m++){if(o[m]!==l[m])throw RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");f[m]=o[m]}var p=n;"string"==typeof s&&s===c&&(i=s,p=r.find(n,[i,i]));var h=f.length>0?function e(r,t,n,i,a,o){var s=[];if(t===n.length-1)for(var u=0;u<i;u++)s[u]=r(a[u],o[u]);else for(var l=0;l<i;l++)s[l]=e(r,t+1,n,n[t+1],a[l],o[l]);return s}(p,0,f,f[0],a,u):[];return e.createDenseMatrix({data:h,size:f,datatype:i})}}),nt=ef("matAlgo14xDs",["typed"],e=>{var{typed:r}=e;return function(e,t,n,i){var a,s=e._data,u=e._size,l=e._datatype,c=n;"string"==typeof l&&(a=l,t=r.convert(t,a),c=r.find(n,[a,a]));var f=u.length>0?function e(r,t,n,i,a,o,s){var u=[];if(t===n.length-1)for(var l=0;l<i;l++)u[l]=s?r(o,a[l]):r(a[l],o);else for(var c=0;c<i;c++)u[c]=e(r,t+1,n,n[t+1],a[c],o,s);return u}(c,0,u,u[0],s,t,i):[];return e.createDenseMatrix({data:f,size:o(u),datatype:a})}});function nn(e,r){if(u(e.size(),r.size()))return[e,r];var t=rc(e.size(),r.size());return[e,r].map(e=>{var r,n;return r=e,n=t,u(r.size(),n)?r:r.create(rm(r.valueOf(),n),r.datatype())})}var ni=ef("matrixAlgorithmSuite",["typed","matrix"],e=>{var{typed:r,matrix:t}=e,n=nr({typed:r}),i=nt({typed:r});return function(e){var a,o=e.elop,u=e.SD||e.DS;o?(a={"DenseMatrix, DenseMatrix":(e,r)=>n(...nn(e,r),o),"Array, Array":(e,r)=>n(...nn(t(e),t(r)),o).valueOf(),"Array, DenseMatrix":(e,r)=>n(...nn(t(e),r),o),"DenseMatrix, Array":(e,r)=>n(...nn(e,t(r)),o)},e.SS&&(a["SparseMatrix, SparseMatrix"]=(r,t)=>e.SS(...nn(r,t),o,!1)),e.DS&&(a["DenseMatrix, SparseMatrix"]=(r,t)=>e.DS(...nn(r,t),o,!1),a["Array, SparseMatrix"]=(r,n)=>e.DS(...nn(t(r),n),o,!1)),u&&(a["SparseMatrix, DenseMatrix"]=(e,r)=>u(...nn(r,e),o,!0),a["SparseMatrix, Array"]=(e,r)=>u(...nn(t(r),e),o,!0))):(a={"DenseMatrix, DenseMatrix":r.referToSelf(e=>(r,t)=>n(...nn(r,t),e)),"Array, Array":r.referToSelf(e=>(r,i)=>n(...nn(t(r),t(i)),e).valueOf()),"Array, DenseMatrix":r.referToSelf(e=>(r,i)=>n(...nn(t(r),i),e)),"DenseMatrix, Array":r.referToSelf(e=>(r,i)=>n(...nn(r,t(i)),e))},e.SS&&(a["SparseMatrix, SparseMatrix"]=r.referToSelf(r=>(t,n)=>e.SS(...nn(t,n),r,!1))),e.DS&&(a["DenseMatrix, SparseMatrix"]=r.referToSelf(r=>(t,n)=>e.DS(...nn(t,n),r,!1)),a["Array, SparseMatrix"]=r.referToSelf(r=>(n,i)=>e.DS(...nn(t(n),i),r,!1))),u&&(a["SparseMatrix, DenseMatrix"]=r.referToSelf(e=>(r,t)=>u(...nn(t,r),e,!0)),a["SparseMatrix, Array"]=r.referToSelf(e=>(r,n)=>u(...nn(t(n),r),e,!0))));var l=e.scalar||"any";(e.Ds||e.Ss)&&(o?(a["DenseMatrix,"+l]=(e,r)=>i(e,r,o,!1),a[l+", DenseMatrix"]=(e,r)=>i(r,e,o,!0),a["Array,"+l]=(e,r)=>i(t(e),r,o,!1).valueOf(),a[l+", Array"]=(e,r)=>i(t(r),e,o,!0).valueOf()):(a["DenseMatrix,"+l]=r.referToSelf(e=>(r,t)=>i(r,t,e,!1)),a[l+", DenseMatrix"]=r.referToSelf(e=>(r,t)=>i(t,r,e,!0)),a["Array,"+l]=r.referToSelf(e=>(r,n)=>i(t(r),n,e,!1).valueOf()),a[l+", Array"]=r.referToSelf(e=>(r,n)=>i(t(n),r,e,!0).valueOf())));var c=void 0!==e.sS?e.sS:e.Ss;return o?(e.Ss&&(a["SparseMatrix,"+l]=(r,t)=>e.Ss(r,t,o,!1)),c&&(a[l+", SparseMatrix"]=(e,r)=>c(r,e,o,!0))):(e.Ss&&(a["SparseMatrix,"+l]=r.referToSelf(r=>(t,n)=>e.Ss(t,n,r,!1))),c&&(a[l+", SparseMatrix"]=r.referToSelf(e=>(r,t)=>c(t,r,e,!0)))),o&&o.signatures&&s(a,o.signatures),a}}),na="number, number";function no(e){return!e}function ns(e,r){return!!(e||r)}function nu(e,r){return!!e!=!!r}function nl(e,r){return!!(e&&r)}no.signature="number",ns.signature=na,nu.signature=na,nl.signature=na;var nc=ef("or",["typed","matrix","equalScalar","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=t7({typed:r}),s=ne({typed:r,equalScalar:n}),u=t9({typed:r,DenseMatrix:i}),l=ni({typed:r,matrix:t,concat:a});return r("or",{"number, number":ns,"Complex, Complex":function(e,r){return 0!==e.re||0!==e.im||0!==r.re||0!==r.im},"BigNumber, BigNumber":function(e,r){return!e.isZero()&&!e.isNaN()||!r.isZero()&&!r.isNaN()},"bigint, bigint":ns,"Unit, Unit":r.referToSelf(e=>(r,t)=>e(r.value||0,t.value||0))},l({SS:s,DS:o,Ss:u}))}),nf=ef("or",["typed","matrix","equalScalar","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=nc({typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function s(e,r,t){var n=e[0].compile().evaluate(t);return!!(!T(n)&&o(n,!1))||o(n,e[1].compile().evaluate(t))}return s.rawArgs=!0,s},{isTransformFunction:!0}),nm=ef("matAlgo02xDS0",["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i,a){var o,s=e._data,u=e._size,l=e._datatype||e.getDataType(),c=n._values,f=n._index,m=n._ptr,p=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==p.length)throw new eX(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],v=t,y=0,x=i;"string"==typeof l&&l===h&&"mixed"!==l&&(o=l,v=r.find(t,[o,o]),y=r.convert(0,o),x=r.find(i,[o,o]));for(var b=[],w=[],D=[],N=0;N<g;N++){D[N]=w.length;for(var E=m[N],A=m[N+1],C=E;C<A;C++){var S=f[C],M=a?x(c[C],s[S][N]):x(s[S][N],c[C]);v(M,y)||(w.push(S),b.push(M))}}return D[g]=w.length,n.createSparseMatrix({values:b,index:w,ptr:D,size:[d,g],datatype:l===e._datatype&&h===n._datatype?o:void 0})}}),np=ef("matAlgo11xS0s",["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i,a){var o,s=e._values,u=e._index,l=e._ptr,c=e._size,f=e._datatype;if(!s)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=c[0],p=c[1],h=t,d=0,g=i;"string"==typeof f&&(o=f,h=r.find(t,[o,o]),d=r.convert(0,o),n=r.convert(n,o),g=r.find(i,[o,o]));for(var v=[],y=[],x=[],b=0;b<p;b++){x[b]=y.length;for(var w=l[b],D=l[b+1],N=w;N<D;N++){var E=u[N],A=a?g(n,s[N]):g(s[N],n);h(A,d)||(y.push(E),v.push(A))}}return x[p]=y.length,e.createSparseMatrix({values:v,index:y,ptr:x,size:[m,p],datatype:o})}}),nh=ef("matAlgo06xS0S0",["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a,o=e._values,s=e._size,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,c=n._size,f=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(s.length!==c.length)throw new eX(s.length,c.length);if(s[0]!==c[0]||s[1]!==c[1])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");var m=s[0],p=s[1],h=t,d=0,g=i;"string"==typeof u&&u===f&&"mixed"!==u&&(a=u,h=r.find(t,[a,a]),d=r.convert(0,a),g=r.find(i,[a,a]));for(var v=o&&l?[]:void 0,y=[],x=[],b=v?[]:void 0,w=[],D=[],N=0;N<p;N++){x[N]=y.length;var E=N+1;if(ti(e,N,w,b,D,E,y,g),ti(n,N,w,b,D,E,y,g),b)for(var A=x[N];A<y.length;
1){var C=y[A];if(D[C]===E){var S=b[C];h(S,d)?y.splice(A,1):(v.push(S),A++)}else y.splice(A,1)}else for(var M=x[N];M<y.length;)D[y[M]]!==E?y.splice(M,1):M++}return x[p]=y.length,e.createSparseMatrix({values:v,index:y,ptr:x,size:[m,p],datatype:u===e._datatype&&f===n._datatype?a:void 0})}}),nd=ef("and",["typed","matrix","equalScalar","zeros","not","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=e,s=nm({typed:r,equalScalar:n}),u=nh({typed:r,equalScalar:n}),l=np({typed:r,equalScalar:n}),c=nt({typed:r}),f=ni({typed:r,matrix:t,concat:o});return r("and",{"number, number":nl,"Complex, Complex":function(e,r){return(0!==e.re||0!==e.im)&&(0!==r.re||0!==r.im)},"BigNumber, BigNumber":function(e,r){return!e.isZero()&&!r.isZero()&&!e.isNaN()&&!r.isNaN()},"bigint, bigint":nl,"Unit, Unit":r.referToSelf(e=>(r,t)=>e(r.value||0,t.value||0)),"SparseMatrix, any":r.referToSelf(e=>(r,t)=>a(t)?i(r.size(),r.storage()):l(r,t,e,!1)),"DenseMatrix, any":r.referToSelf(e=>(r,t)=>a(t)?i(r.size(),r.storage()):c(r,t,e,!1)),"any, SparseMatrix":r.referToSelf(e=>(r,t)=>a(r)?i(r.size(),r.storage()):l(t,r,e,!0)),"any, DenseMatrix":r.referToSelf(e=>(r,t)=>a(r)?i(r.size(),r.storage()):c(t,r,e,!0)),"Array, any":r.referToSelf(e=>(r,n)=>e(t(r),n).valueOf()),"any, Array":r.referToSelf(e=>(r,n)=>e(r,t(n)).valueOf())},f({SS:u,DS:s}))}),ng=ef("and",["typed","matrix","zeros","add","equalScalar","not","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=e,s=nd({typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(e,r,t){var n=e[0].compile().evaluate(t);return(!!T(n)||!!s(n,!0))&&s(n,e[1].compile().evaluate(t))}return u.rawArgs=!0,u},{isTransformFunction:!0}),nv="concat",ny=ef(nv,["typed","matrix","isInteger"],e=>{var{typed:r,matrix:t,isInteger:n}=e;return r(nv,{"...Array | Matrix | number | BigNumber":function(e){var r,i,a=e.length,s=-1,u=!1,l=[];for(r=0;r<a;r++){var c=e[r];if(F(c)&&(u=!0),w(c)||D(c)){if(r!==a-1)throw Error("Dimension must be specified as last argument");if(i=s,!n(s=c.valueOf()))throw TypeError("Integer number expected for dimension");if(s<0||r>0&&s>i)throw new eQ(s,i+1)}else{var f=o(c).valueOf(),m=eK(f);if(l[r]=f,i=s,s=m.length-1,r>0&&s!==i)throw new eX(i+1,s+1)}}if(0===l.length)throw SyntaxError("At least one matrix expected");for(var p=l.shift();l.length;)p=rl(p,l.shift(),s);return u?t(p):p},"...string":function(e){return e.join("")}})}),nx=ef("concat",["typed","matrix","isInteger"],e=>{var{typed:r,matrix:t,isInteger:n}=e,i=ny({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(e){var r=e.length-1,t=e[r];w(t)?e[r]=t-1:D(t)&&(e[r]=t.minus(1));try{return i.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),nb=ef("index",["Index","getMatrixDataType"],e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var e=[],n=0,i=arguments.length;n<i;n++){var a=arguments[n];if(_(a))a.start--,a.end-=a.step>0?0:2;else if(a&&!0===a.isSet)a=a.map(function(e){return e-1});else if(M(a)||F(a))"boolean"!==t(a)&&(a=a.map(function(e){return e-1}));else if(w(a)||N(a))a--;else if(D(a))a=a.toNumber()-1;else if("string"==typeof a);else throw TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");e[n]=a}var o=new r;return r.apply(o,e),o}},{isTransformFunction:!0}),nw=/\$([\w.]+)/g,nD="print",nN=ef(nD,["typed"],e=>{var{typed:r}=e;return r(nD,{"string, Object | Array":nE,"string, Object | Array, number | Object":nE})});function nE(e,r,t){return e.replace(nw,function(e,n){var i=n.split("."),a=r[i.shift()];for(void 0!==a&&a.isMatrix&&(a=a.toArray());i.length&&void 0!==a;){var o=i.shift();a=o?a[o]:a+"."}if(void 0!==a)if(!S(a))return eH(a,t);else return a;return e})}var nA="print",nC=ef(nA,["typed","matrix","zeros","add"],e=>{var{typed:r,matrix:t,zeros:n,add:i}=e,a=nN({typed:r,matrix:t,zeros:n,add:i});return r(nA,{"string, Object | Array":function(e,r){return a(o(e),r)},"string, Object | Array, number | Object":function(e,r,t){return a(o(e),r,t)}});function o(e){return e.replace(nw,e=>"$"+e.slice(1).split(".").map(function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e}).join("."))}},{isTransformFunction:!0});function nS(e,r,t){var n;return String(e).includes("Unexpected type")?(n=arguments.length>2?" (type: "+el(t)+", value: "+JSON.stringify(t)+")":" (type: "+e.data.actual+")",TypeError("Cannot calculate "+r+", unexpected type of argument"+n)):String(e).includes("complex numbers")?(n=arguments.length>2?" (type: "+el(t)+", value: "+JSON.stringify(t)+")":"",TypeError("Cannot calculate "+r+", no ordering relation is defined for c
1omplex numbers"+n)):e}var nM=ef("sum",["typed","config","add","numeric"],e=>{var{typed:r,config:t,add:n,numeric:i}=e;return r("sum",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,r){try{return tt(e,r,n)}catch(e){throw nS(e,"sum")}},"...":function(e){if(r9(e))throw TypeError("Scalar values expected in function sum");return a(e)}});function a(e){var r;return te(e,function(e){try{r=void 0===r?e:n(r,e)}catch(r){throw nS(r,"sum",e)}}),void 0===r&&(r=i(0,t.number)),"string"==typeof r&&(r=i(r,ev(r,t))),r}});function nF(e){if(2===e.length&&T(e[0])){var r=(e=e.slice())[1];(w(r)||D(r))&&(e[1]=w(r)?r-1:D(r)?r.minus(1):r)}return e}var nT=ef("sum",["typed","config","add","numeric"],e=>{var{typed:r,config:t,add:n,numeric:i}=e,a=nM({typed:r,config:t,add:n,numeric:i});return r("sum",{"...any":function(e){e=nF(e);try{return a.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0});function nB(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function bitAnd");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()===r.isNegative()?e:new t(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e}return nz(e,r,function(e,r){return e&r})}function nO(e){if(e.isFinite()&&!e.isInteger())throw Error("Integer expected in function bitNot");var r=e.constructor,t=r.precision;r.config({precision:1e9});var n=e.plus(new r(1));return n.s=-n.s||null,r.config({precision:t}),n}function n_(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function bitOr");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);var n=new t(-1);return e.isZero()||r.eq(n)||e.eq(r)?r:r.isZero()||e.eq(n)?e:e.isFinite()&&r.isFinite()?nz(e,r,function(e,r){return e|r}):!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?n:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e}function nz(e,r,t){var n,i,a,o,s,u=e.constructor,l=+(e.s<0),c=+(r.s<0);if(l){n=nk(nO(e));for(var f=0;f<n.length;++f)n[f]^=1}else n=nk(e);if(c){i=nk(nO(r));for(var m=0;m<i.length;++m)i[m]^=1}else i=nk(r);n.length<=i.length?(a=n,o=i,s=l):(a=i,o=n,s=c);var p=a.length,h=o.length,d=1^t(l,c),g=new u(1^d),v=new u(1),y=new u(2),x=u.precision;for(u.config({precision:1e9});p>0;)t(a[--p],o[--h])===d&&(g=g.plus(v)),v=v.times(y);for(;h>0;)t(s,o[--h])===d&&(g=g.plus(v)),v=v.times(y);return u.config({precision:x}),0===d&&(g.s=-g.s),g}function nk(e){for(var r=e.d,t=r[0]+"",n=1;n<r.length;++n){for(var i=r[n]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;"0"===t.charAt(o);)o--;var s=e.e,u=t.slice(0,o+1||1),l=u.length;if(s>0)if(++s>l)for(s-=l;s--;)u+="0";else s<l&&(u=u.slice(0,s)+"."+u.slice(s));for(var c=[0],f=0;f<u.length;){for(var m=c.length;m--;)c[m]*=10;c[0]+=parseInt(u.charAt(f++));for(var p=0;p<c.length;++p)c[p]>1&&((null===c[p+1]||void 0===c[p+1])&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function nI(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function bitXor");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero())return r;if(r.isZero())return e;if(e.eq(r))return new t(0);var n=new t(-1);return e.eq(n)?nO(r):r.eq(n)?nO(e):e.isFinite()&&r.isFinite()?nz(e,r,function(e,r){return e^r}):e.isFinite()||r.isFinite()?new t(e.isNegative()===r.isNegative()?1/0:-1/0):n}function nR(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function leftShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:e.isFinite()||r.isFinite()?r.lt(55)?e.times(Math.pow(2,r.toNumber())+""):e.times(new t(2).pow(r)):new t(NaN)}function nq(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw Error("Integers expected in function rightArithShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new t(2).pow(r)).floor():new t(e.isNegative()?-1:e.isFinite()?0:NaN)}var nP="number, number";function nj(e,r){if(!eg(e)||!eg(r))throw Error("Integers expected in function bitAnd");return e&r}function nU(e){if(!eg(e))throw Error("Integer expected in function bitNot");return~e}function nL(e,r){if(!eg(e)||!eg(r))throw Error("Integers expected in function bitOr");return e|r}function n$(e,r){if(!eg(e)||!eg(r))throw Error("Integers expected in function bitXor");return e^r}function nH(e,r){if(!eg(e)||!eg(r))throw Error("Integers expected in function leftShift");return e<<r}function nG(e,r){if(!eg(e)||!eg(r))throw Error("Integers expected in function rightArithShift");return e>>r}function nZ(e,r){if(!eg(e)||!eg(r))throw Error("Integers expected in function rightLogShift");return e>>>r}nj.signature=nP,nU.signature="number",nL.signature=nP,n$.signature=nP,nH.signature=nP,nG.signature=nP,nZ.signature=nP;var nV="bitAnd",nW=ef(nV,["typed","matrix","equalScalar","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,concat:i}=e,a=nm({typed:r,equalScalar:n}),o=nh({typed:r,equalScalar:n}),s=np({typed:r,equalScalar:n}),u=ni({typed:r,matrix:t,concat:i});return r(nV,{"number, number":nj,"BigNumber, BigNumber":nB,"bigint, bigint":(e,r)=>e&r},u({SS:o,DS:a,Ss:s}))}),nJ=ef("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=e,s=nW({typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(e,r,t){var n=e[0].compile().evaluate(t);if(!T(n)){if(isNaN(n))return NaN;if(0===n||!1===n)return 0}return s(n,e[1].compile().evaluate(t))}return u.rawArgs=!0,u},{isTransformFunction:!0}),nY=ef("min",["typed","config","numeric","smaller","isNaN"],e=>{var{typed:r,config:t,numeric:n,smaller:i,isNaN:a}=e;return r("min",{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,r){return tt(e,r.valueOf(),o)},"...":function(e){if(r9(e))throw TypeError("Scalar values expected in function min");return s(e)}});function o(e,r){try{return i(e,r)?e:r}catch(e){throw nS(e,"min",r)}}function s(e){var r;if(te(e,function(e){try{a(e)?r=e:(void 0===r||i(e,r))&&(r=e)}catch(r){throw nS(r,"min",e)}}),void 0===r)throw Error("Cannot calculate min of an empty array");return"string"==typeof r&&(r=n(r,ev(r,t))),r}}),nX=ef("min",["typed","config","numeric","smaller","isNaN"],e=>{var{typed:r,config:t,numeric:n,smaller:i,isNaN:a}=e,o=nY({typed:r,config:t,numeric:n,smaller:i,isNaN:a});return r("min",{"...any":function(e){e=nF(e);try{return o.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),nQ="nullish",nK=ef(nQ,["typed","matrix","size","flatten","deepEqual"],e=>{var{typed:r,matrix:t,size:n,flatten:i,deepEqual:a}=e,o=t7({typed:r}),s=nt({typed:r}),u=nr({typed:r});return r(nQ,{"number|bigint|Complex|BigNumber|Fraction|Unit|string|boolean|SparseMatrix, any":(e,r)=>e,"null, any":(e,r)=>r,"undefined, any":(e,r)=>r,"SparseMatrix, Array | Matrix":(e,r)=>{var t=i(n(e).valueOf()),o=i(n(r).valueOf());if(a(t,o))return e;throw new eX(t,o)},"DenseMatrix, DenseMatrix":r.referToSelf(e=>(r,t)=>u(r,t,e)),"DenseMatrix, SparseMatrix":r.referToSelf(e=>(r,t)=>
1o(r,t,e,!1)),"DenseMatrix, Array":r.referToSelf(e=>(r,n)=>u(r,t(n),e)),"DenseMatrix, any":r.referToSelf(e=>(r,t)=>s(r,t,e,!1)),"Array, Array":r.referToSelf(e=>(r,n)=>u(t(r),t(n),e).valueOf()),"Array, DenseMatrix":r.referToSelf(e=>(r,n)=>u(t(r),n,e)),"Array, SparseMatrix":r.referToSelf(e=>(r,n)=>o(t(r),n,e,!1)),"Array, any":r.referToSelf(e=>(r,n)=>s(t(r),n,e,!1).valueOf())})}),n0=ef("nullish",["typed","matrix","size","flatten","deepEqual"],e=>{var{typed:r,matrix:t,size:n,flatten:i,deepEqual:a}=e,o=nK({typed:r,matrix:t,size:n,flatten:i,deepEqual:a});function s(e,r,t){var n=e[0].compile().evaluate(t);return T(n)||null==n||void 0===n?o(n,e[1].compile().evaluate(t)):n}return s.rawArgs=!0,s},{isTransformFunction:!0}),n1="subset",n2=ef(n1,["typed","matrix","zeros","add"],e=>{var{typed:r,matrix:t,zeros:n,add:i}=e;return r(n1,{"Matrix, Index":function(e,r){return e3(r)?t():(e1(e,r),e.subset(r))},"Array, Index":r.referTo("Matrix, Index",function(e){return function(r,n){var i=e(t(r),n);return n.isScalar()?i:i.valueOf()}}),"Object, Index":n4,"string, Index":n3,"Matrix, Index, any, any":function(e,r,t,a){return e3(r)?e:(e1(e,r),e.clone().subset(r,function(e,r){if("string"==typeof e)throw Error("can't boradcast a string");if(r._isScalar)return e;var t=r.size();if(!t.every(e=>e>0))return e;try{return i(e,n(t))}catch(r){return e}}(t,r),a))},"Array, Index, any, any":r.referTo("Matrix, Index, any, any",function(e){return function(r,n,i,a){var o=e(t(r),n,i,a);return o.isMatrix?o.valueOf():o}}),"Array, Index, any":r.referTo("Matrix, Index, any, any",function(e){return function(r,n,i){return e(t(r),n,i,void 0).valueOf()}}),"Matrix, Index, any":r.referTo("Matrix, Index, any, any",function(e){return function(r,t,n){return e(r,t,n,void 0)}}),"string, Index, string":n5,"string, Index, string, string":n5,"Object, Index, any":n8})});function n3(e,r){if(!z(r))throw TypeError("Index expected");if(e3(r))return"";if(e1(Array.from(e),r),1!==r.size().length)throw new eX(r.size().length,1);var t=e.length;e2(r.min()[0],t),e2(r.max()[0],t);var n=r.dimension(0),i="";return n.forEach(function(r){i+=e.charAt(r)}),i}function n5(e,r,t,n){if(!r||!0!==r.isIndex)throw TypeError("Index expected");if(e3(r))return e;if(e1(Array.from(e),r),1!==r.size().length)throw new eX(r.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw TypeError("Single character expected as defaultValue")}else n=" ";var i=r.dimension(0);if(i.size()[0]!==t.length)throw new eX(i.size()[0],t.length);var a=e.length;e2(r.min()[0]),e2(r.max()[0]);for(var o=[],s=0;s<a;s++)o[s]=e.charAt(s);if(i.forEach(function(e,r){o[e]=t.charAt(r[0])}),o.length>a)for(var u=a-1,l=o.length;u<l;u++)o[u]||(o[u]=n);return o.join("")}function n4(e,r){if(!e3(r)){if(1!==r.size().length)throw new eX(r.size(),1);var t=r.dimension(0);if("string"!=typeof t)throw TypeError("String expected as index to retrieve an object property");return c(e,t)}}function n8(e,r,t){if(e3(r))return e;if(1!==r.size().length)throw new eX(r.size(),1);var n=r.dimension(0);if("string"!=typeof n)throw TypeError("String expected as index to retrieve an object property");var i=o(e);return f(i,n,t),i}var n6,n7,n9=ef("subset",["typed","matrix","zeros","add"],e=>{var{typed:r,matrix:t,zeros:n,add:i}=e,a=n2({typed:r,matrix:t,zeros:n,add:i});return r("subset",{"...any":function(e){try{return a.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),ie=ef("matAlgo10xSids",["typed","DenseMatrix"],e=>{var{typed:r,DenseMatrix:t}=e;return function(e,n,i,a){var o,s=e._values,u=e._index,l=e._ptr,c=e._size,f=e._datatype;if(!s)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var m=c[0],p=c[1],h=i;"string"==typeof f&&(o=f,n=r.convert(n,o),h=r.find(i,[o,o]));for(var d=[],g=[],v=[],y=0;y<p;y++){for(var x=y+1,b=l[y],w=l[y+1],D=b;D<w;D++){var N=u[D];g[N]=s[D],v[N]=x}for(var E=0;E<m;E++)0===y&&(d[E]=[]),v[E]===x?d[E][y]=a?h(n,g[E]):h(g[E],n):d[E][y]=n}return new t({data:d,size:[m,p],datatype:o})}}),ir=ef("matAlgo04xSidSid",["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a,o,s,u,l,c,f=e._values,m=e._index,p=e._ptr,h=e._size,d=e._datatype||void 0===e._data?e._datatype:e.getDataType(),g=n._values,v=n._index,y=n._ptr,x=n._size,b=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(h.length!==x.length)throw new eX(h.length,x.length);if(h[0]!==x[0]||h[1]!==x[1])throw RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+x+")");var w=h[0],D=h[1],N=t,E=0,A=i;"string"==typeof d&&d===b&&"mixed"!==d&&(a=d,N=r.find(t,[a,a]),E=r.convert(0,a),A=r.find(i,[a,a]));var C=f&&g?[]:void 0,S=[],M=[],F=f&&g?[]:void 0,T=f&&g?[]:void 0,B=[],O=[];for(s=0;s<D;s++){M[s]=S.length;var _=s+1;for(l=p[s],c=p[s+1],u=l;u<c;u++)o=m[u],S.push(o),B[o]=_,F&&(F[o]=f[u]);for(l=y[s],c=y[s+1],u=l;u<c;u++)if(B[o=v[u]]===_){if(F){var z=A(F[o],g[u]);N(z,E)?B[o]=null:F[o]=z}}else S.push(o),O[o]=_,T&&(T[o]=g[u]);if(F&&T)for(u=M[s];u<S.length;)B[o=S[u]]===_?(C[u]=F[o],u++):O[o]===_?(C[u]=T[o],u++):S.splice(u,1)}return M[D]=S.length,e.createSparseMatrix({values:C,index:S,ptr:M,size:[w,D],datatype:d===e._datatype&&b===n._datatype?a:void 0})}}),it=ef("matAlgo01xDSid",["typed"],e=>{var{typed:r}=e;return function(e,t,n,i){var a,o,s=e._data,u=e._size,l=e._datatype||e.getDataType(),c=t._values,f=t._index,m=t._ptr,p=t._size,h=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(u.length!==p.length)throw new eX(u.length,p.length);if(u[0]!==p[0]||u[1]!==p[1])throw RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+p+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d=u[0],g=u[1],v="string"==typeof l&&"mixed"!==l&&l===h?l:void 0,y=v?r.find(n,[v,v]):n,x=[];for(a=0;a<d;a++)x[a]=[];var b=[],w=[];for(o=0;o<g;o++){for(var D=o+1,N=m[o],E=m[o+1],A=N;A<E;A++)b[a=f[A]]=i?y(c[A],s[a][o]):y(s[a][o],c[A]),w[a]=D;for(a=0;a<d;a++)w[a]===D?x[a][o]=b[a]:x[a][o]=s[a][o]}return e.createDenseMatrix({data:x,size:[d,g],datatype:l===e._datatype&&h===t._datatype?v:void 0})}}),ii="bitOr",ia=ef(ii,["typed","matrix","equalScalar","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=it({typed:r}),s=ir({typed:r,equalScalar:n}),u=ie({typed:r,DenseMatrix:i}),l=ni({typed:r,matrix:t,concat:a});return r(ii,{"number, number":nL,"BigNumber, BigNumber":n_,"bigint, bigint":(e,r)=>e|r},l({SS:s,DS:o,Ss:u}))}),io=ef("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=ia({typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function s(e,r,t){var n=e[0].compile().evaluate(t);if(!T(n)){if(isNaN(n))return NaN;if(-1===n)return -1;if(!0===n)return 1}return o(n,e[1].compile().evaluate(t))}return s.rawArgs=!0,s},{isTransformFunction:!0}),is="cumsum",iu=ef(is,["typed","add","unaryPlus"],e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(is,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,r){return e.create(o(e.valueOf(),r),e.datatype())},"...":function(e){if(r9(e))throw TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return a(e)}catch(e){throw nS(e,is)}}function a(e){if(0===e.length)return[];for(var r=[n(e[0])],i=1;i<e.length;++i)r.push(t(r[i-1],e[i]));return r}function o(e,r){var t=eK(e);if(r<0||r>=t.length)throw new eQ(r,t.length);try{return function e(r,t){var n,i,o;if(t<=0){if(!Array.isArray(r[0][0]))return a(r);for(n=0,o=r7(r),i=[];n<o.length;n++)i[n]=e(o[n],t-1);return i}for(n=0,i=[];n<r.length;n++)i[n]=e(r[n],t-1);return i}(e,r)}catch(e){throw nS(e,is)}}}),il="cumsum",ic=ef(il,["typed","add","unaryPlus"],e=>{var{typed:r,add:t,unaryPlus:n}=e,i=iu({typed:r,add:t,unaryPlus:n});return r(il,{"...any":function(e){if(2===e.length&&T(e[0])){var r=e[1];w(r)?e[1]=r-1:D(r)&&(e[1]=r.minus(1))}try{return i.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),im="diff",ip=ef(im,["typed","matrix","subtract","number"],e=>{var{typed:r,matrix:t,subtract:n,number:i}=e;return r(im,{"Array | Matrix":function(e){return F(e)?t(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,r){if(!eg(r))throw RangeError("Dimension must be a whole number");return F(e)?t(a(e.toArray(),r)):a(e,r)},"Array, BigNumber":r.referTo("Array,number",e=>(r,t)=>e(r,i(t))),"Matrix, BigNumber":r.referTo("Matrix,number",e=>(r,t)=>e(r,i(t)))});function a(e,r){if(F(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(r>0){var t=[];
1return e.forEach(e=>{t.push(a(e,r-1))}),t}if(0===r)return o(e);throw RangeError("Cannot have negative dimension")}function o(e){for(var r=[],t=e.length,i=1;i<t;i++)r.push(function e(r,t){F(r)&&(r=r.toArray()),F(t)&&(t=t.toArray());var i=Array.isArray(r),a=Array.isArray(t);if(i&&a){var o=r,s=t;if(o.length!==s.length)throw RangeError("Not all sub-arrays have the same length");for(var u=[],l=o.length,c=0;c<l;c++)u.push(e(o[c],s[c]));return u}if(!i&&!a)return n(t,r);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}(e[i-1],e[i]));return r}}),ih="diff",id=ef(ih,["typed","matrix","subtract","number","bignumber"],e=>{var{typed:r,matrix:t,subtract:n,number:i,bignumber:a}=e,o=ip({typed:r,matrix:t,subtract:n,number:i,bignumber:a});return r(ih,{"...any":function(e){e=nF(e);try{return o.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),ig=ef("max",["typed","config","numeric","larger","isNaN"],e=>{var{typed:r,config:t,numeric:n,larger:i,isNaN:a}=e;return r("max",{"Array | Matrix":s,"Array | Matrix, number | BigNumber":function(e,r){return tt(e,r.valueOf(),o)},"...":function(e){if(r9(e))throw TypeError("Scalar values expected in function max");return s(e)}});function o(e,r){try{return i(e,r)?e:r}catch(e){throw nS(e,"max",r)}}function s(e){var r;if(te(e,function(e){try{a(e)?r=e:(void 0===r||i(e,r))&&(r=e)}catch(r){throw nS(r,"max",e)}}),void 0===r)throw Error("Cannot calculate max of an empty array");return"string"==typeof r&&(r=n(r,ev(r,t))),r}}),iv=ef("max",["typed","config","numeric","larger","isNaN"],e=>{var{typed:r,config:t,numeric:n,larger:i,isNaN:a}=e,o=ig({typed:r,config:t,numeric:n,larger:i,isNaN:a});return r("max",{"...any":function(e){e=nF(e);try{return o.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),iy="range",ix=ef(iy,["typed","config","?matrix","?bignumber","equal","smaller","smallerEq","larger","largerEq","add","isZero","isPositive"],e=>{var{typed:r,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u,add:l,isZero:c,isPositive:f}=e;return r(iy,{string:p,"string, boolean":p,number:function(e){throw TypeError("Too few arguments to function range(): ".concat(e))},boolean:function(e){throw TypeError("Unexpected type of argument 1 to function range(): ".concat(e,", number|bigint|BigNumber|Fraction"))},"number, number":function(e,r){return m(h(e,r,1,!1))},"number, number, number":function(e,r,t){return m(h(e,r,t,!1))},"number, number, boolean":function(e,r,t){return m(h(e,r,1,t))},"number, number, number, boolean":function(e,r,t,n){return m(h(e,r,t,n))},"bigint, bigint|number":function(e,r){return m(h(e,r,1n,!1))},"number, bigint":function(e,r){return m(h(BigInt(e),r,1n,!1))},"bigint, bigint|number, bigint|number":function(e,r,t){return m(h(e,r,BigInt(t),!1))},"number, bigint, bigint|number":function(e,r,t){return m(h(BigInt(e),r,BigInt(t),!1))},"bigint, bigint|number, boolean":function(e,r,t){return m(h(e,r,1n,t))},"number, bigint, boolean":function(e,r,t){return m(h(BigInt(e),r,1n,t))},"bigint, bigint|number, bigint|number, boolean":function(e,r,t,n){return m(h(e,r,BigInt(t),n))},"number, bigint, bigint|number, boolean":function(e,r,t,n){return m(h(BigInt(e),r,BigInt(t),n))},"BigNumber, BigNumber":function(e,r){var t=e.constructor;return m(h(e,r,new t(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,r,t){return m(h(e,r,t,!1))},"BigNumber, BigNumber, boolean":function(e,r,t){var n=e.constructor;return m(h(e,r,new n(1),t))},"BigNumber, BigNumber, BigNumber, boolean":function(e,r,t,n){return m(h(e,r,t,n))},"Fraction, Fraction":function(e,r){return m(h(e,r,1,!1))},"Fraction, Fraction, Fraction":function(e,r,t){return m(h(e,r,t,!1))},"Fraction, Fraction, boolean":function(e,r,t){return m(h(e,r,1,t))},"Fraction, Fraction, Fraction, boolean":function(e,r,t,n){return m(h(e,r,t,n))},"Unit, Unit, Unit":function(e,r,t){return m(h(e,r,t,!1))},"Unit, Unit, Unit, boolean":function(e,r,t,n){return m(h(e,r,t,n))}});function m(e){return"Matrix"===t.matrix?n?n(e):tp():e}function p(e,r){var n=function(e){var r=e.split(":").map(function(e){return Number(e)});if(r.some(function(e){return isNaN(e)}))return null;switch(r.length){case 2:return{start:r[0],end:r[1],step:1};case 3:return{start:r[0],end:r[2],step:r[1]};default:return null}}(e);if(!n)throw SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===t.number?(void 0===i&&tf(),m(h(i(n.start),i(n.end),i(n.step)),r)):m(h(n.start,n.end,n.step,r))}function h(e,r,t,n){var i=[];if(c(t))throw Error("Step must be non-zero");for(var m=f(t)?n?o:a:n?u:s,p=e;m(p,r);)i.push(p),p=l(p,t);return i}}),ib=ef("range",["typed","config","?matrix","?bignumber","equal","smaller","smallerEq","larger","largerEq","add","isZero","isPositive"],e=>{var{typed:r,config:t,matrix:n,bignumber:i,equal:a,smaller:o,smallerEq:s,larger:u,largerEq:l,add:c,isZero:f,isPositive:m}=e,p=ix({typed:r,config:t,matrix:n,bignumber:i,equal:a,smaller:o,smallerEq:s,larger:u,largerEq:l,add:c,isZero:f,isPositive:m});return r("range",{"...any":function(e){var r=e.length-1;return"boolean"!=typeof e[r]&&e.push(!0),p.apply(null,e)}})},{isTransformFunction:!0}),iw=ef("row",["typed","Index","matrix","range"],e=>{var{typed:r,Index:t,matrix:n,range:i}=e;return r("row",{"Matrix, number":a,"Array, number":function(e,r){return a(n(o(e)),r).valueOf()}});function a(e,r){if(2!==e.size().length)throw Error("Only two dimensional matrix is supported");e2(r,e.size()[0]);
1var a=new t(r,i(0,e.size()[1])),o=e.subset(a);return F(o)?o:n([[o]])}}),iD=ef("row",["typed","Index","matrix","range"],e=>{var{typed:r,Index:t,matrix:n,range:i}=e,a=iw({typed:r,Index:t,matrix:n,range:i});return r("row",{"...any":function(e){var r=e.length-1,t=e[r];w(t)&&(e[r]=t-1);try{return a.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),iN="column",iE=ef(iN,["typed","Index","matrix","range"],e=>{var{typed:r,Index:t,matrix:n,range:i}=e;return r(iN,{"Matrix, number":a,"Array, number":function(e,r){return a(n(o(e)),r).valueOf()}});function a(e,r){if(2!==e.size().length)throw Error("Only two dimensional matrix is supported");e2(r,e.size()[1]);var a=new t(i(0,e.size()[0]),r),o=e.subset(a);return F(o)?o:n([[o]])}}),iA=ef("column",["typed","Index","matrix","range"],e=>{var{typed:r,Index:t,matrix:n,range:i}=e,a=iE({typed:r,Index:t,matrix:n,range:i});return r("column",{"...any":function(e){var r=e.length-1,t=e[r];w(t)&&(e[r]=t-1);try{return a.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),iC="mean",iS=ef(iC,["typed","add","divide"],e=>{var{typed:r,add:t,divide:n}=e;return r(iC,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,r){try{var i=tt(e,r,t),a=Array.isArray(e)?eK(e):e.size();return n(i,a[r])}catch(e){throw nS(e,"mean")}},"...":function(e){if(r9(e))throw TypeError("Scalar values expected in function mean");return i(e)}});function i(e){var r,i=0;if(te(e,function(e){try{r=void 0===r?e:t(r,e),i++}catch(r){throw nS(r,"mean",e)}}),0===i)throw Error("Cannot calculate the mean of an empty array");return n(r,i)}}),iM=ef("mean",["typed","add","divide"],e=>{var{typed:r,add:t,divide:n}=e,i=iS({typed:r,add:t,divide:n});return r("mean",{"...any":function(e){e=nF(e);try{return i.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),iF="quantileSeq",iT=ef(iF,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],e=>{var{typed:r,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:u,isInteger:l,smaller:c,smallerEq:f,larger:m,mapSlices:p}=e;return r(iF,{"Array | Matrix, number | BigNumber":(e,r)=>d(e,r,!1),"Array | Matrix, number | BigNumber, number":(e,r,t)=>h(e,r,!1,t,d),"Array | Matrix, number | BigNumber, boolean":d,"Array | Matrix, number | BigNumber, boolean, number":(e,r,t,n)=>h(e,r,t,n,d),"Array | Matrix, Array | Matrix":(e,r)=>g(e,r,!1),"Array | Matrix, Array | Matrix, number":(e,r,t)=>h(e,r,!1,t,g),"Array | Matrix, Array | Matrix, boolean":g,"Array | Matrix, Array | Matrix, boolean, number":(e,r,t,n)=>h(e,r,t,n,g)});function h(e,r,t,n,i){return p(e,n,e=>i(e,r,t))}function d(e,r,i){var o,s=e.valueOf();if(c(r,0))throw Error("N/prob must be non-negative");if(f(r,1))return w(r)?v(s,r,i):t(v(s,r,i));if(m(r,1)){if(!l(r))throw Error("N must be a positive integer");if(m(r,0xffffffff))throw Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var u=n(r,1);o=[];for(var p=0;c(p,r);p++){var h=a(p+1,u);o.push(v(s,h,i))}return w(r)?o:t(o)}}function g(e,r,t){for(var n=e.valueOf(),i=r.valueOf(),a=[],o=0;o<i.length;++o)a.push(v(n,i[o],t));return a}function v(e,r,t){var a,c,f=re(e),m=f.length;if(0===m)throw Error("Cannot calculate quantile of an empty sequence");var p=w(r)?r*(m-1):r.times(m-1),h=w(r)?Math.floor(p):p.floor().toNumber(),d=w(r)?p%1:p.minus(h);if(l(p))return t?f[p]:s(f,w(r)?p:p.valueOf());if(t)a=f[h],c=f[h+1];else{c=s(f,h+1),a=f[h];for(var g=0;g<h;++g)u(f[g],a)>0&&(a=f[g])}return n(o(a,i(1,d)),o(c,d))}}),iB=ef("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],e=>{var{typed:r,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:u,isInteger:l,smaller:c,smallerEq:f,larger:m,mapSlices:p}=e,h=iT({typed:r,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:u,isInteger:l,smaller:c,smallerEq:f,larger:m,mapSlices:p});return r("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(e,r,t)=>h(e,r,d(t)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(e,r,t,n)=>h(e,r,t,d(n)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(e,r,t)=>h(e,r,d(t)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(e,r,t,n)=>h(e,r,t,d(n))});function d(e){return nF([[],e])[1]}},{isTransformFunction:!0}),iO="unbiased",i_="variance",iz=ef(i_,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:a,mapSlices:o,isNaN:s}=e;return r(i_,{"Array | Matrix":function(e){return u(e,iO)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(e,r){return l(e,r,iO)},"Array | Matrix, number | BigNumber, string":l,"...":function(e){return u(e,iO)}});function u(e,r){var o,u=0;if(0===e.length)throw SyntaxError("Function variance requires one or more parameters (0 provided)");if(te(e,function(e){try{o=void 0===o?e:t(o,e),u++}catch(r){throw nS(r,"variance",e)}}),0===u)throw Error("Cannot calculate variance of an empty array");var l=a(o,u);if(o=void 0,te(e,function(e){var r=n(e,l);o=void 0===o?i(r,r):t(o,i(r,r))}),s(o))return o;switch(r){case"uncorrected":return a(o,u);case"biased":return a(o,u+1);case"unbiased":var c=D(o)?o.mul(0):0;return 1===u?c:a(o,u-1);default:throw Error('Unknown normalization "'+r+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function l(e,r,t){try{if(0===e.length)throw SyntaxError("Function variance requires one or more parameters (0 provided)");return o(e,r,e=>u(e,t))}catch(e){throw nS(e,"variance")}}}),ik="variance",iI=ef(ik,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:a,mapSlices:o,isNaN:s}=e,u=iz({typed:r,add:t,subtract:n,multiply:i,divide:a,mapSlices:o,isNaN:s});return r(ik,{"...any":function(e){e=nF(e);try{return u.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),iR=ef("std",["typed","map","sqrt","variance"],e=>{var{typed:r,map:t,sqrt:n,variance:i}=e;return r("std",{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,r){if(0===e.length)throw SyntaxError("Function std requires one or more parameters (0 provided)");try{var a=i.apply(null,arguments);if(T(a))return t(a,n);return n(a)}catch(e){if(e instanceof TypeError&&e.message.includes(" variance"))throw TypeError(e.message.replace(" variance"," std"));throw e}}}),iq=ef("std",["typed","map","sqrt","variance"],e=>{var{typed:r,map:t,sqrt:n,variance:i}=e,a=iR({typed:r,map:t,sqrt:n,variance:i});return r("std",{"...any":function(e){e=nF(e);try{return a.apply(null,e)}catch(e){throw rX(e)}}})},{isTransformFunction:!0}),iP="0123456789abcdef",ij="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",iU="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823
1066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",iL={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},i$=!0,iH="[DecimalError] ",iG=iH+"Invalid argument: ",iZ=iH+"Precision limit exceeded",iV=iH+"crypto unavailable",iW="[object Decimal]",iJ=Math.floor,iY=Math.pow,iX=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,iQ=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,iK=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,i0=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,i1=ij.length-1,i2=iU.length-1,i3={toStringTag:iW};function i5(e){var r,t,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,r=1;r<i;r++)(t=7-(n=e[r]+"").length)&&(a+=aa(t)),a+=n;(t=7-(n=(o=e[r])+"").length)&&(a+=aa(t))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function i4(e,r,t){if(e!==~~e||e<r||e>t)throw Error(iG+e)}function i8(e,r,t,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--r;return--r<0?(r+=7,i=0):(i=Math.ceil((r+1)/7),r%=7),a=iY(10,7-r),s=e[i]%a|0,null==n?r<3?(0==r?s=s/100|0:1==r&&(s=s/10|0),o=t<4&&99999==s||t>3&&49999==s||5e4==s||0==s):o=(t<4&&s+1==a||t>3&&s+1==a/2)&&(e[i+1]/a/100|0)==iY(10,r-2)-1||(s==a/2||0==s)&&(e[i+1]/a/100|0)==0:r<4?(0==r?s=s/1e3|0:1==r?s=s/100|0:2==r&&(s=s/10|0),o=(n||t<4)&&9999==s||!n&&t>3&&4999==s):o=((n||t<4)&&s+1==a||!n&&t>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==iY(10,r-3)-1,o}function i6(e,r,t){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=r;for(a[0]+=iP.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>t-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/t|0,a[n]%=t)}return a.reverse()}i3.absoluteValue=i3.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),i9(e)},i3.ceil=function(){return i9(new this.constructor(this),this.e+1,2)},i3.clampedTo=i3.clamp=function(e,r){var t=this.constructor;if(e=new t(e),r=new t(r),!e.s||!r.s)return new t(NaN);if(e.gt(r))throw Error(iG+r);return 0>this.cmp(e)?e:this.cmp(r)>0?r:new t(this)},i3.comparedTo=i3.cmp=function(e){var r,t,n,i,a=this.d,o=(e=new this.constructor(e)).d,s=this.s,u=e.s;if(!a||!o)return s&&u?s!==u?s:a===o?0:!a^s<0?1:-1:NaN;if(!a[0]||!o[0])return a[0]?s:o[0]?-u:0;if(s!==u)return s;if(this.e!==e.e)return this.e>e.e^s<0?1:-1;for(r=0,t=(n=a.length)<(i=o.length)?n:i;r<t;++r)if(a[r]!==o[r])return a[r]>o[r]^s<0?1:-1;return n===i?0:n>i^s<0?1:-1},i3.cosine=i3.cos=function(){var e,r,t=this,n=t.constructor;return t.d?t.d[0]?(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+7,n.rounding=1,t=function(e,r){var t,n,i;if(r.isZero())return r;(n=r.d.length)<32?i=(1/ah(4,t=Math.ceil(n/3))).toString():(t=16,i="2.3283064365386962890625e-10"),e.precision+=t,r=ap(e,1,r.times(i),new e(1));for(var a=t;a--;){var o=r.times(r);r=o.times(o).minus(o).times(8).plus(1)}return e.precision-=t,r}(n,ad(n,t)),n.precision=e,n.rounding=r,i9(2==n7||3==n7?t.neg():t,e,r,!0)):new n(1):new n(NaN)},i3.cubeRoot=i3.cbrt=function(){var e,r,t,n,i,a,o,s,u,l,c=this.constructor;if(!this.isFinite()||this.isZero())return new c(this);for(i$=!1,(a=this.s*iY(this.s*this,1/3))&&Math.abs(a)!=1/0?n=new c(a.toString()):(t=i5(this.d),(a=((e=this.e)-t.length+1)%3)&&(t+=1==a||-2==a?"0":"00"),a=iY(t,1/3),e=iJ((e+1)/3)-(e%3==(e<0?-1:2)),(n=new c(t=a==1/0?"5e"+e:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+e)).s=this.s),o=(e=c.precision)+3;;)if(n=i7((l=(u=(s=n).times(s).times(s)).plus(this)).plus(this).times(s),l.plus(u),o+2,1),i5(s.d).slice(0,o)===(t=i5(n.d)).slice(0,o)){if
1("9999"!=(t=t.slice(o-3,o+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(i9(n,e+1,1),r=!n.times(n).times(n).eq(this));break}if(!i&&(i9(s,e+1,0),s.times(s).times(s).eq(this))){n=s;break}o+=4,i=1}return i$=!0,i9(n,e,c.rounding,r)},i3.decimalPlaces=i3.dp=function(){var e,r=this.d,t=NaN;if(r){if(t=((e=r.length-1)-iJ(this.e/7))*7,e=r[e])for(;e%10==0;e/=10)t--;t<0&&(t=0)}return t},i3.dividedBy=i3.div=function(e){return i7(this,new this.constructor(e))},i3.dividedToIntegerBy=i3.divToInt=function(e){var r=this.constructor;return i9(i7(this,new r(e),0,1,1),r.precision,r.rounding)},i3.equals=i3.eq=function(e){return 0===this.cmp(e)},i3.floor=function(){return i9(new this.constructor(this),this.e+1,3)},i3.greaterThan=i3.gt=function(e){return this.cmp(e)>0},i3.greaterThanOrEqualTo=i3.gte=function(e){var r=this.cmp(e);return 1==r||0===r},i3.hyperbolicCosine=i3.cosh=function(){var e,r,t,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;t=o.precision,n=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?r=(1/ah(4,e=Math.ceil(i/3))).toString():(e=16,r="2.3283064365386962890625e-10"),a=ap(o,1,a.times(r),new o(1),!0);for(var u,l=e,c=new o(8);l--;)u=a.times(a),a=s.minus(u.times(c.minus(u.times(c))));return i9(a,o.precision=t,o.rounding=n,!0)},i3.hyperbolicSine=i3.sinh=function(){var e,r,t,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(r=a.precision,t=a.rounding,a.precision=r+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=ap(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=ap(a,2,i=i.times(1/ah(5,e)),i,!0);for(var o,s=new a(5),u=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(u.times(o).plus(l))))}return a.precision=r,a.rounding=t,i9(i,r,t,!0)},i3.hyperbolicTangent=i3.tanh=function(){var e,r,t=this.constructor;return this.isFinite()?this.isZero()?new t(this):(e=t.precision,r=t.rounding,t.precision=e+7,t.rounding=1,i7(this.sinh(),this.cosh(),t.precision=e,t.rounding=r)):new t(this.s)},i3.inverseCosine=i3.acos=function(){var e=this,r=e.constructor,t=e.abs().cmp(1),n=r.precision,i=r.rounding;return -1!==t?0===t?e.isNeg()?an(r,n,i):new r(0):new r(NaN):e.isZero()?an(r,n+4,i).times(.5):(r.precision=n+6,r.rounding=1,e=new r(1).minus(e).div(e.plus(1)).sqrt().atan(),r.precision=n,r.rounding=i,e.times(2))},i3.inverseHyperbolicCosine=i3.acosh=function(){var e,r,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(e=n.precision,r=n.rounding,n.precision=e+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,i$=!1,t=t.times(t).minus(1).sqrt().plus(t),i$=!0,n.precision=e,n.rounding=r,t.ln()):new n(t)},i3.inverseHyperbolicSine=i3.asinh=function(){var e,r,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,i$=!1,t=t.times(t).plus(1).sqrt().plus(t),i$=!0,n.precision=e,n.rounding=r,t.ln())},i3.inverseHyperbolicTangent=i3.atanh=function(){var e,r,t,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,r=a.rounding,Math.max(n=i.sd(),e)<-(2*i.e)-1)?i9(new a(i),e,r,!0):(a.precision=t=n-i.e,i=i7(i.plus(1),new a(1).minus(i),t+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=r,i.times(.5)):new a(NaN)},i3.inverseSine=i3.asin=function(){var e,r,t,n,i=this,a=i.constructor;return i.isZero()?new a(i):(r=i.abs().cmp(1),t=a.precision,n=a.rounding,-1!==r)?0===r?((e=an(a,t+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=t+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=t,a.rounding=n,i.times(2))},i3.inverseTangent=i3.atan=function(){var e,r,t,n,i,a,o,s,u,l=this,c=l.constructor,f=c.precision,m=c.rounding;if(l.isFinite()){if(l.isZero())return new c(l);else if(l.abs().eq(1)&&f+4<=i2)return(o=an(c,f+4,m).times(.25)).s=l.s,o}else{if(!l.s)return new c(NaN);if(f+4<=i2)return(o=an(c,f+4,m).times(.5)).s=l.s,o}for(c.precision=s=f+10,c.rounding=1,e=t=Math.min(28,s/7+2|0);e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(i$=!1,r=Math.ceil(s/7),n=1,u=l.times(l),o=new c(l),i=l;-1!==e;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),void 0!==(o=a.plus(i.div(n+=2))).d[r])for(e=r;o.d[e]===a.d[e]&&e--;);return t&&(o=o.times(2<<t-1)),i$=!0,i9(o,c.precision=f,c.rounding=m,!0)},i3.isFinite=function(){return!!this.d},i3.isInteger=i3.isInt=function(){return!!this.d&&iJ(this.e/7)>this.d.length-2},i3.isNaN=function(){return!this.s},i3.isNegative=i3.isNeg=function(){return this.s<0},i3.isPositive=i3.isPos=function(){return this.s>0},i3.isZero=function(){return!!this.d&&0===this.d[0]},i3.lessThan=i3.lt=function(e){return 0>this.cmp(e)},i3.lessThanOrEqualTo=i3.lte=function(e){return 1>this.cmp(e)},i3.logarithm=i3.log=function(e){var r,t,n,i,a,o,s,u=this.constructor,l=u.precision,c=u.rounding;if(null==e)e=new u(10),r=!0;else{if(t=(e=new u(e)).d,e.s<0||!t||!t[0]||e.eq(1))return new u(NaN);r=e.eq(10)}if(t=this.d,this.s<0||!t||!t[0]||this.eq(1))return new u(t&&!t[0]?-1/0:1!=this.s?NaN:t?0:1/0);if(r)if(t.length>1)i=!0;else{for(n=t[0];n%10==0;)n/=10;i=1!==n}if(i$=!1,i8((s=i7(a=ac(this,o=l+5),r?at(u,o+10):ac(e,o),o,1)).d,n=l,c))do if(o+=10,s=i7(a=ac(this,o),r?at(u,o+10):ac(e,o),o,1),!i){+i5(s.d).slice(n+1,n+15)+1==1e14&&(s=i9(s,l+1,0));break}while(i8(s.d,n+=10,c));return i$=!0,i9(s,l,c)},i3.minus=i3.sub=function(e){var r,t,n,i,a,o,s,u,l,c,f,m,p=this.constructor;if(e=new p(e),!this.d||!e.d)return this.s&&e.s?this.d?e.s=-e.s:e=new p(e.d||this.s!==e.s?this:NaN):e=new p(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.plus(e);if(l=this.d,m=e.d,s=p.precision,u=p.rounding,!l[0]||!m[0]){if(m[0])e.s=-e.s;else{if(!l[0])return new p(3===u?-0:0);e=new p(this)}return i$?i9(e,s,u):e}if(t=iJ(e.e/7),c=iJ(this.e/7),l=l.slice(),a=c-t){for((f=a<0)?(r=l,a=-a,o=m.length):(r=m,t
1=c,o=l.length),a>(n=Math.max(Math.ceil(s/7),o)+2)&&(a=n,r.length=1),r.reverse(),n=a;n--;)r.push(0);r.reverse()}else{for((f=(n=l.length)<(o=m.length))&&(o=n),n=0;n<o;n++)if(l[n]!=m[n]){f=l[n]<m[n];break}a=0}for(f&&(r=l,l=m,m=r,e.s=-e.s),o=l.length,n=m.length-o;n>0;--n)l[o++]=0;for(n=m.length;n>a;){if(l[--n]<m[n]){for(i=n;i&&0===l[--i];)l[i]=1e7-1;--l[i],l[n]+=1e7}l[n]-=m[n]}for(;0===l[--o];)l.pop();for(;0===l[0];l.shift())--t;return l[0]?(e.d=l,e.e=ar(l,t),i$?i9(e,s,u):e):new p(3===u?-0:0)},i3.modulo=i3.mod=function(e){var r,t=this.constructor;return(e=new t(e),this.d&&e.s&&(!e.d||e.d[0]))?e.d&&(!this.d||this.d[0])?(i$=!1,9==t.modulo?(r=i7(this,e.abs(),0,3,1),r.s*=e.s):r=i7(this,e,0,t.modulo,1),r=r.times(e),i$=!0,this.minus(r)):i9(new t(this),t.precision,t.rounding):new t(NaN)},i3.naturalExponential=i3.exp=function(){return al(this)},i3.naturalLogarithm=i3.ln=function(){return ac(this)},i3.negated=i3.neg=function(){var e=new this.constructor(this);return e.s=-e.s,i9(e)},i3.plus=i3.add=function(e){var r,t,n,i,a,o,s,u,l,c,f=this.constructor;if(e=new f(e),!this.d||!e.d)return this.s&&e.s?this.d||(e=new f(e.d||this.s===e.s?this:NaN)):e=new f(NaN),e;if(this.s!=e.s)return e.s=-e.s,this.minus(e);if(l=this.d,c=e.d,s=f.precision,u=f.rounding,!l[0]||!c[0])return c[0]||(e=new f(this)),i$?i9(e,s,u):e;if(a=iJ(this.e/7),n=iJ(e.e/7),l=l.slice(),i=a-n){for(i<0?(t=l,i=-i,o=c.length):(t=c,n=a,o=l.length),i>(o=(a=Math.ceil(s/7))>o?a+1:o+1)&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for((o=l.length)-(i=c.length)<0&&(i=o,t=c,c=l,l=t),r=0;i;)r=(l[--i]=l[i]+c[i]+r)/1e7|0,l[i]%=1e7;for(r&&(l.unshift(r),++n),o=l.length;0==l[--o];)l.pop();return e.d=l,e.e=ar(l,n),i$?i9(e,s,u):e},i3.precision=i3.sd=function(e){var r;if(void 0!==e&&!!e!==e&&1!==e&&0!==e)throw Error(iG+e);return this.d?(r=ai(this.d),e&&this.e+1>r&&(r=this.e+1)):r=NaN,r},i3.round=function(){var e=this.constructor;return i9(new e(this),this.e+1,e.rounding)},i3.sine=i3.sin=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+7,n.rounding=1,t=function(e,r){var t,n=r.d.length;if(n<3)return r.isZero()?r:ap(e,2,r,r);t=(t=1.4*Math.sqrt(n))>16?16:0|t,r=ap(e,2,r=r.times(1/ah(5,t)),r);for(var i,a=new e(5),o=new e(16),s=new e(20);t--;)i=r.times(r),r=r.times(a.plus(i.times(o.times(i).minus(s))));return r}(n,ad(n,t)),n.precision=e,n.rounding=r,i9(n7>2?t.neg():t,e,r,!0)):new n(NaN)},i3.squareRoot=i3.sqrt=function(){var e,r,t,n,i,a,o=this.d,s=this.e,u=this.s,l=this.constructor;if(1!==u||!o||!o[0])return new l(!u||u<0&&(!o||o[0])?NaN:o?this:1/0);for(i$=!1,0==(u=Math.sqrt(+this))||u==1/0?(((r=i5(o)).length+s)%2==0&&(r+="0"),u=Math.sqrt(r),s=iJ((s+1)/2)-(s<0||s%2),n=new l(r=u==1/0?"5e"+s:(r=u.toExponential()).slice(0,r.indexOf("e")+1)+s)):n=new l(u.toString()),t=(s=l.precision)+3;;)if(n=(a=n).plus(i7(this,a,t+2,1)).times(.5),i5(a.d).slice(0,t)===(r=i5(n.d)).slice(0,t)){if("9999"!=(r=r.slice(t-3,t+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(i9(n,s+1,1),e=!n.times(n).eq(this));break}if(!i&&(i9(a,s+1,0),a.times(a).eq(this))){n=a;break}t+=4,i=1}return i$=!0,i9(n,s,l.rounding,e)},i3.tangent=i3.tan=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+10,n.rounding=1,(t=t.sin()).s=1,t=i7(t,new n(1).minus(t.times(t)).sqrt(),e+10,0),n.precision=e,n.rounding=r,i9(2==n7||4==n7?t.neg():t,e,r,!0)):new n(NaN)},i3.times=i3.mul=function(e){var r,t,n,i,a,o,s,u,l,c=this.constructor,f=this.d,m=(e=new c(e)).d;if(e.s*=this.s,!f||!f[0]||!m||!m[0])return new c(!e.s||f&&!f[0]&&!m||m&&!m[0]&&!f?NaN:!f||!m?e.s/0:0*e.s);for(t=iJ(this.e/7)+iJ(e.e/7),(u=f.length)<(l=m.length)&&(a=f,f=m,m=a,o=u,u=l,l=o),a=[],n=o=u+l;n--;)a.push(0);for(n=l;--n>=0;){for(r=0,i=u+n;i>n;)s=a[i]+m[n]*f[i-n-1]+r,a[i--]=s%1e7|0,r=s/1e7|0;a[i]=(a[i]+r)%1e7|0}for(;!a[--o];)a.pop();return r?++t:a.shift(),e.d=a,e.e=ar(a,t),i$?i9(e,c.precision,c.rounding):e},i3.toBinary=function(e,r){return ag(this,2,e,r)},i3.toDecimalPlaces=i3.toDP=function(e,r){var t=this,n=t.constructor;return(t=new n(t),void 0===e)?t:(i4(e,0,1e9),void 0===r?r=n.rounding:i4(r,0,8),i9(t,e+t.e+1,r))},i3.toExponential=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=ae(n,!0):(i4(e,0,1e9),void 0===r?r=i.rounding:i4(r,0,8),t=ae(n=i9(new i(n),e+1,r),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+t:t},i3.toFixed=function(e,r){var t,n,i=this.constructor;return void 0===e?t=ae(this):(i4(e,0,1e9),void 0===r?r=i.rounding:i4(r,0,8),t=ae(n=i9(new i(this),e+this.e+1,r),!1,e+n.e+1)),this.isNeg()&&!this.isZero()?"-"+t:t},i3.toFraction=function(e){var r,t,n,i,a,o,s,u,l,c,f,m,p=this.d,h=this.constructor;if(!p)return new h(this);if(l=t=new h(1),n=u=new h(0),o=(a=(r=new h(n)).e=ai(p)-this.e-1)%7,r.d[0]=iY(10,o<0?7+o:o),null==e)e=a>0?r:l;else{if(!(s=new h(e)).isInt()||s.lt(l))throw Error(iG+s);e=s.gt(r)?a>0?r:l:s}for(i$=!1,s=new h(i5(p)),c=h.precision,h.precision=a=7*p.length*2;f=i7(s,r,0,1,1),1!=(i=t.plus(f.times(n))).cmp(e);)t=n,n=i,i=l,l=u.plus(f.times(i)),u=i,i=r,r=s.minus(f.times(i)),s=i;return i=i7(e.minus(t),n,0,1,1),u=u.plus(i.times(l)),t=t.plus(i.times(n)),u.s=l.s=this.s,m=1>i7(l,n,a,1).minus(this).abs().cmp(i7(u,t,a,1).minus(this).abs())?[l,n]:[u,t],h.precision=c,i$=!0,m},i3.toHexadecimal=i3.toHex=function(e,r){return ag(this,16,e,r)},i3.toNearest=function(e,r){var t=this,n=t.constructor;if(t=new n(t),null==e){if(!t.d)return t;e=new n(1),r=n.rounding}else{if(e=new n(e),void 0===r?r=n.rounding:i4(r,0,8),!t.d)return e.s?t:e;if(!e.d)return e.s&&(e.s=t.s),e}return e.d[0]?(i$=!1,t=i7(t,e,0,r,1).times(e),i$=!0,i9(t)):(e.s=t.s,t=e),t},i3.toNumber=function(){return+this},i3.toOctal=function(e,r){return ag(this,8,e,r)},i3.toPower=i3.pow=function(e){var r,t,n,i,a,o,s=this,u=s.constructor,l=+(e=new u(e));if(!s.d||!e.d||!s.d[0]||!e.d[0])return new u(iY(+s,l));if((s=new u(s)).eq(1))return s;if(n=u.precision,a=u.rounding,e.eq(1))return i9(s,n,a);if((r=iJ(e.e/7))>=e.d.length-1&&(t=l<0?-l:l)<=0x1fffffffffffff)return i=ao(u,s,t,n),e.s<0?new u(1).div(i):i9(i,n,a);if((o=s.s)<0){if(r<e.d.length-1)return new u(NaN);if((1&e.d[r])==0&&(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(r=0!=(t=iY(+s,l))&&isFinite(t)?new u(t+"").e:iJ(l*(Math.log("0."+i5(s.d))/Math.LN10+s.e+1)))>u.maxE+1||r<u.minE-1?new u(r>0?o/0:0):(i$=!1,u.rounding=s.s=1,t=Math.min(12,(r+"").length),(i=al(e.times(ac(s,n+t)),n)).d&&i8((i=i9(i,n+5,1)).d,n,a)&&(r=n+10,+i5((i=i9(al(e.times(ac(s,r+t)),r),r+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=i9(i,n+1,0))),i.s=o,i$=!0,u.rounding=a,i9(i,n,a))},i3.toPrecision=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=ae(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(i4(e,1,1e9),void 0===r?r=i.rounding:i4(r,0,8),t=ae(n=i9(new i(n),e,r),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+t:t},i3.toSignificantDigits=i3.toSD=function(e,r){var t=this.constructor;return void 0===e?(e=t.precision,r=t.rounding):(i4(e,1,1e9),void 0===r?r=t.rounding:i4(r,0,8)),i9(new t(this),e,r)},i3.toString=function(){var e=this.constructor,r=ae(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()&&!this.isZero()?"-"+r:r},i3.truncated=i3.trunc=function(){return i9(new this.constructor(this),this.e+1,1)},i3.valueOf=i3.toJSON=function(){var e=this.constructor,r=ae(this,this.e<=e.toExpNeg||this.e>=e.toExpPos);return this.isNeg()?"-"+r:r};var i7=function(){function e(e,r,t){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*r+i,e[a]=n%t|0,i=n/t|0;return i&&e.unshift(i),e}function r(e,r,t,n){var i,a;if(t!=n)a=t>n?1:-1;else for(i=a=0;i<t;i++)if(e[i]!=r[i]){a=e[i]>r[i]?1:-1;break}return a}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=+(e[t]<r[t]),e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,u){var l,c,f,m,p,h,d,g,v,y,x,b,w,D,N,E,A,C,S,M,F=n.constructor,T=n.s==i.s?1:-1,B=n.d,O=i.d;if(!B||!B[0]||!O||!O[0])return new F(!n.s||!i.s||(B?O&&B[0]==O[0]:!O)?NaN:B&&0==B[0]||!O?0*T:T/0);
1for(u?(p=1,c=n.e-i.e):(u=1e7,p=7,c=iJ(n.e/p)-iJ(i.e/p)),S=O.length,A=B.length,y=(v=new F(T)).d=[],f=0;O[f]==(B[f]||0);f++);if(O[f]>(B[f]||0)&&c--,null==a?(D=a=F.precision,o=F.rounding):D=s?a+(n.e-i.e)+1:a,D<0)y.push(1),h=!0;else{if(D=D/p+2|0,f=0,1==S){for(m=0,O=O[0],D++;(f<A||m)&&D--;f++)N=m*u+(B[f]||0),y[f]=N/O|0,m=N%O|0;h=m||f<A}else{for((m=u/(O[0]+1)|0)>1&&(O=e(O,m,u),B=e(B,m,u),S=O.length,A=B.length),E=S,b=(x=B.slice(0,S)).length;b<S;)x[b++]=0;(M=O.slice()).unshift(0),C=O[0],O[1]>=u/2&&++C;do m=0,(l=r(O,x,S,b))<0?(w=x[0],S!=b&&(w=w*u+(x[1]||0)),(m=w/C|0)>1?(m>=u&&(m=u-1),g=(d=e(O,m,u)).length,b=x.length,1==(l=r(d,x,g,b))&&(m--,t(d,S<g?M:O,g,u))):(0==m&&(l=m=1),d=O.slice()),(g=d.length)<b&&d.unshift(0),t(x,d,b,u),-1==l&&(b=x.length,(l=r(O,x,S,b))<1&&(m++,t(x,S<b?M:O,b,u))),b=x.length):0===l&&(m++,x=[0]),y[f++]=m,l&&x[0]?x[b++]=B[E]||0:(x=[B[E]],b=1);while((E++<A||void 0!==x[0])&&D--);h=void 0!==x[0]}y[0]||y.shift()}if(1==p)v.e=c,n6=h;else{for(f=1,m=y[0];m>=10;m/=10)f++;v.e=f+c*p-1,i9(v,s?a+v.e+1:a,o,h)}return v}}();function i9(e,r,t,n){var i,a,o,s,u,l,c,f,m,p=e.constructor;e:if(null!=r){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((a=r-i)<0)a+=7,o=r,u=(c=f[m=0])/iY(10,i-o-1)%10|0;else if((m=Math.ceil((a+1)/7))>=(s=f.length))if(n){for(;s++<=m;)f.push(0);c=u=0,i=1,a%=7,o=a-7+1}else break e;else{for(i=1,c=s=f[m];s>=10;s/=10)i++;a%=7,u=(o=a-7+i)<0?0:c/iY(10,i-o-1)%10|0}if(n=n||r<0||void 0!==f[m+1]||(o<0?c:c%iY(10,i-o-1)),l=t<4?(u||n)&&(0==t||t==(e.s<0?3:2)):u>5||5==u&&(4==t||n||6==t&&(a>0?o>0?c/iY(10,i-o):0:f[m-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,l?(r-=e.e+1,f[0]=iY(10,(7-r%7)%7),e.e=-r||0):f[0]=e.e=0,e;if(0==a?(f.length=m,s=1,m--):(f.length=m+1,s=iY(10,7-a),f[m]=o>0?(c/iY(10,i-o)%iY(10,o)|0)*s:0),l)for(;;)if(0==m){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,1e7==f[0]&&(f[0]=1));break}else{if(f[m]+=s,1e7!=f[m])break;f[m--]=0,s=1}for(a=f.length;0===f[--a];)f.pop()}return i$&&(e.e>p.maxE?(e.d=null,e.e=NaN):e.e<p.minE&&(e.e=0,e.d=[0])),e}function ae(e,r,t){if(!e.isFinite())return af(e);var n,i=e.e,a=i5(e.d),o=a.length;return r?(t&&(n=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+aa(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+aa(-i-1)+a,t&&(n=t-o)>0&&(a+=aa(n))):i>=o?(a+=aa(i+1-o),t&&(n=t-i-1)>0&&(a=a+"."+aa(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),t&&(n=t-o)>0&&(i+1===o&&(a+="."),a+=aa(n))),a}function ar(e,r){var t=e[0];for(r*=7;t>=10;t/=10)r++;return r}function at(e,r,t){if(r>i1)throw i$=!0,t&&(e.precision=t),Error(iZ);return i9(new e(ij),r,1,!0)}function an(e,r,t){if(r>i2)throw Error(iZ);return i9(new e(iU),r,t,!0)}function ai(e){var r=e.length-1,t=7*r+1;if(r=e[r]){for(;r%10==0;r/=10)t--;for(r=e[0];r>=10;r/=10)t++}return t}function aa(e){for(var r="";e--;)r+="0";return r}function ao(e,r,t,n){var i,a=new e(1),o=Math.ceil(n/7+4);for(i$=!1;;){if(t%2&&av((a=a.times(r)).d,o)&&(i=!0),0===(t=iJ(t/2))){t=a.d.length-1,i&&0===a.d[t]&&++a.d[t];break}av((r=r.times(r)).d,o)}return i$=!0,a}function as(e){return 1&e.d[e.d.length-1]}function au(e,r,t){for(var n,i,a=new e(r[0]),o=0;++o<r.length;){if(!(i=new e(r[o])).s){a=i;break}((n=a.cmp(i))===t||0===n&&a.s===t)&&(a=i)}return a}function al(e,r){var t,n,i,a,o,s,u,l=0,c=0,f=0,m=e.constructor,p=m.rounding,h=m.precision;if(!e.d||!e.d[0]||e.e>17)return new m(e.d?!e.d[0]?1:e.s<0?0:1/0:e.s?e.s<0?0:e:0/0);for(null==r?(i$=!1,u=h):u=r,s=new m(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=n=Math.log(iY(2,f))/Math.LN10*2+5|0,t=a=o=new m(1),m.precision=u;;){if(a=i9(a.times(e),u,1),t=t.times(++c),i5((s=o.plus(i7(a,t,u,1))).d).slice(0,u)===i5(o.d).slice(0,u)){for(i=f;i--;)o=i9(o.times(o),u,1);if(null!=r)return m.precision=h,o;if(!(l<3&&i8(o.d,u-n,p,l)))return i9(o,m.precision=h,p,i$=!0);m.precision=u+=10,t=a=s=new m(1),c=0,l++}o=s}}function ac(e,r){var t,n,i,a,o,s,u,l,c,f,m,p=1,h=e,d=h.d,g=h.constructor,v=g.rounding,y=g.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new g(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(null==r?(i$=!1,c=y):c=r,g.precision=c+=10,n=(t=i5(d)).charAt(0),!(15e14>Math.abs(a=h.e)))return l=at(g,c+2,y).times(a+""),h=ac(new g(n+"."+t.slice(1)),c-10).plus(l),g.precision=y,null==r?i9(h,y,v,i$=!0):h;for(;n<7&&1!=n||1==n&&t.charAt(1)>3;)n=(t=i5((h=h.times(e)).d)).charAt(0),p++;for(a=h.e,n>1?(h=new g("0."+t),a++):h=new g(n+"."+t.slice(1)),f=h,u=o=h=i7(h.minus(1),h.plus(1),c,1),m=i9(h.times(h),c,1),i=3;;){if(o=i9(o.times(m),c,1),i5((l=u.plus(i7(o,new g(i),c,1))).d).slice(0,c)===i5(u.d).slice(0,c)){if(u=u.times(2),0!==a&&(u=u.plus(at(g,c+2,y).times(a+""))),u=i7(u,new g(p),c,1),null!=r)return g.precision=y,u;if(!i8(u.d,c-10,v,s))return i9(u,g.precision=y,v,i$=!0);g.precision=c+=10,l=o=h=i7(f.minus(1),f.plus(1),c,1),m=i9(h.times(h),c,1),i=s=1}u=l,i+=2}}function af(e){return String(e.s*e.s/0)}function am(e,r){var t,n,i;for((t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=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,e.e=t=t-n-1,e.d=[],n=(t+1)%7,t<0&&(n+=7),n<i){for(n&&e.d.push(+r.slice(0,n)),i-=7;n<i;)e.d.push(+r.slice(n,n+=7));n=7-(r=r.slice(n)).length}else n-=i;for(;n--;)r+="0";e.d.push(+r),i$&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function ap(e,r,t,n,i){var a,o,s,u,l=e.precision,c=Math.ceil(l/7);for(i$=!1,u=t.times(t),s=new e(n);;){if(o=i7(s.times(u),new e(r++*r++),l,1),s=i?n.plus(o):n.minus(o),n=i7(o.times(u),new e(r++*r++),l,1),void 0!==(o=s.plus(n)).d[c]){for(a=c;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return i$=!0,o.d.length=c+1,o}function ah(e,r){for(var t=e;--r;)t*=e;return t}function ad(e,r){var t,n=r.s<0,i=an(e,e.precision,1),a=i.times(.5);if((r=r.abs()).lte(a))return n7=n?4:1,r;if((t=r.divToInt(i)).isZero())n7=n?3:2;else{if((r=r.minus(t.times(i))).lte(a))return n7=as(t)?n?2:3:n?4:1,r;n7=as(t)?n?1:4:n?3:2}return r.minus(i).abs()}function ag(e,r,t,n){var i,a,o,s,u,l,c,f,m,p=e.constructor,h=void 0!==t;if(h?(i4(t,1,1e9),void 0===n?n=p.rounding:i4(n,0,8)):(t=p.precision,n=p.rounding),e.isFinite()){for(o=(c=ae(e)).indexOf("."),h?(i=2,16==r?t=4*t-3:8==r&&(t=3*t-2)):i=r,o>=0&&(c=c.replace(".",""),(m=new p(1)).e=c.length-o,m.d=i6(ae(m),10,i),m.e=m.d.length),a=u=(f=i6(c,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(o<0?a--:((e=new p(e)).d=f,e.e=a,f=(e=i7(e,m,t,n,0,i)
1).d,a=e.e,l=n6),o=f[t],s=i/2,l=l||void 0!==f[t+1],l=n<4?(void 0!==o||l)&&(0===n||n===(e.s<0?3:2)):o>s||o===s&&(4===n||l||6===n&&1&f[t-1]||n===(e.s<0?8:7)),f.length=t,l)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(o=0,c="";o<u;o++)c+=iP.charAt(f[o]);if(h){if(u>1)if(16==r||8==r){for(o=16==r?4:3,--u;u%o;u++)c+="0";for(u=(f=i6(c,i,r)).length;!f[u-1];--u);for(o=1,c="1.";o<u;o++)c+=iP.charAt(f[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>u)for(a-=u;a--;)c+="0";else a<u&&(c=c.slice(0,a)+"."+c.slice(a))}else c=h?"0p+0":"0";c=(16==r?"0x":2==r?"0b":8==r?"0o":"")+c}else c=af(e);return e.s<0?"-"+c:c}function av(e,r){if(e.length>r)return e.length=r,!0}function ay(e){return new this(e).abs()}function ax(e){return new this(e).acos()}function ab(e){return new this(e).acosh()}function aw(e,r){return new this(e).plus(r)}function aD(e){return new this(e).asin()}function aN(e){return new this(e).asinh()}function aE(e){return new this(e).atan()}function aA(e){return new this(e).atanh()}function aC(e,r){e=new this(e),r=new this(r);var t,n=this.precision,i=this.rounding,a=n+4;return e.s&&r.s?e.d||r.d?!r.d||e.isZero()?(t=r.s<0?an(this,n,i):new this(0)).s=e.s:!e.d||r.isZero()?(t=an(this,a,1).times(.5)).s=e.s:r.s<0?(this.precision=a,this.rounding=1,t=this.atan(i7(e,r,a,1)),r=an(this,a,1),this.precision=n,this.rounding=i,t=e.s<0?t.minus(r):t.plus(r)):t=this.atan(i7(e,r,a,1)):(t=an(this,a,1).times(r.s>0?.25:.75)).s=e.s:t=new this(NaN),t}function aS(e){return new this(e).cbrt()}function aM(e){return i9(e=new this(e),e.e+1,2)}function aF(e,r,t){return new this(e).clamp(r,t)}function aT(e){if(!e||"object"!=typeof e)throw Error(iH+"Object expected");var r,t,n,i=!0===e.defaults,a=["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<a.length;r+=3)if(t=a[r],i&&(this[t]=iL[t]),void 0!==(n=e[t]))if(iJ(n)===n&&n>=a[r+1]&&n<=a[r+2])this[t]=n;else throw Error(iG+t+": "+n);if(t="crypto",i&&(this[t]=iL[t]),void 0!==(n=e[t]))if(!0===n||!1===n||0===n||1===n)if(n)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(iV);else this[t]=!1;else throw Error(iG+t+": "+n);return this}function aB(e){return new this(e).cos()}function aO(e){return new this(e).cosh()}function a_(e,r){return new this(e).div(r)}function az(e){return new this(e).exp()}function ak(e){return i9(e=new this(e),e.e+1,3)}function aI(){var e,r,t=new this(0);for(e=0,i$=!1;e<arguments.length;)if(r=new this(arguments[e++]),r.d)t.d&&(t=t.plus(r.times(r)));else{if(r.s)return i$=!0,new this(1/0);t=r}return i$=!0,t.sqrt()}function aR(e){return e instanceof a5||e&&e.toStringTag===iW||!1}function aq(e){return new this(e).ln()}function aP(e,r){return new this(e).log(r)}function aj(e){return new this(e).log(2)}function aU(e){return new this(e).log(10)}function aL(){return au(this,arguments,-1)}function a$(){return au(this,arguments,1)}function aH(e,r){return new this(e).mod(r)}function aG(e,r){return new this(e).mul(r)}function aZ(e,r){return new this(e).pow(r)}function aV(e){var r,t,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:i4(e,1,1e9),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(r=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=r[a])>=429e7?r[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else if(crypto.randomBytes){for(r=crypto.randomBytes(n*=4);a<n;)(i=r[a]+(r[a+1]<<8)+(r[a+2]<<16)+((127&r[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(r,a):(s.push(i%1e7),a+=4);a=n/4}else throw Error(iV);else for(;a<n;)s[a++]=1e7*Math.random()|0;for(n=s[--a],e%=7,n&&e&&(i=iY(10,7-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)t=0,s=[0];else{for(t=-1;0===s[0];t-=7)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<7&&(t-=7-n)}return o.e=t,o.d=s,o}function aW(e){return i9(e=new this(e),e.e+1,this.rounding)}function aJ(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function aY(e){return new this(e).sin()}function aX(e){return new this(e).sinh()}function aQ(e){return new this(e).sqrt()}function aK(e,r){return new this(e).sub(r)}function a0(){var e=0,r=arguments,t=new this(r[0]);for(i$=!1;t.s&&++e<r.length;)t=t.plus(r[e]);return i$=!0,i9(t,this.precision,this.rounding)}function a1(e){return new this(e).tan()}function a2(e){return new this(e).tanh()}function a3(e){return i9(e=new this(e),e.e+1,1)}i3[Symbol.for("nodejs.util.inspect.custom")]=i3.toString,i3[Symbol.toStringTag]="Decimal";var a5=i3.constructor=function e(r){var t,n,i;function a(e){var r,t,n;if(!(this instanceof a))return new a(e);if(this.constructor=a,aR(e)){this.s=e.s,i$?!e.d||e.e>a.maxE?(this.e=NaN,this.d=null):e.e<a.minE?(this.e=0,this.d=[0]):(this.e=e.e,this.d=e.d.slice()):(this.e=e.e,this.d=e.d?e.d.slice():e.d);return}if("number"==(n=typeof e)){if(0===e){this.s=1/e<0?-1:1,this.e=0,this.d=[0];return}if(e<0?(e=-e,this.s=-1):this.s=1,e===~~e&&e<1e7){for(r=0,t=e;t>=10;t/=10)r++;i$?r>a.maxE?(this.e=NaN,this.d=null):r<a.minE?(this.e=0,this.d=[0]):(this.e=r,this.d=[e]):(this.e=r,this.d=[e]);return}if(0*e!=0){e||(this.s=NaN),this.e=NaN,this.d=null;return}return am(this,e.toString())}if("string"===n)return 45===(t=e.charCodeAt(0))?(e=e.slice(1),this.s=-1):(43===t&&(e=e.slice(1)),this.s=1),i0.test(e)?am(this,e):function(e,r){var t,n,i,a,o,s,u,l,c;if(r.indexOf("_")>-1){if(r=r.replace(/(\d)_(?=\d)/g,"$1"),i0.test(r))return am(e,r)}else if("Infinity"===r||"NaN"===r)return+r||(e.s=NaN),e.e=NaN,e.d=null,e;if(iQ.test(r))t=16,r=r.toLowerCase();else if(iX.test(r))t=2;else if(iK.test(r))t=8;else throw Error(iG+r);for((a=r.search(/p/i))>0?(u=+r.slice(a+1),r=r.substring(2,a)):r=r.slice(2),o=(a=r.indexOf("."))>=0,n=e.constructor,o&&(a=(s=(r=r.replace(".","")).length)-a,i=ao(n,new n(t),a,2*a)),a=c=(l=i6(r,t,1e7)).length-1;0===l[a];--a)l.pop();return a<0?new n(0*e.s):(e.e=ar(l,c),e.d=l,i$=!1,o&&(e=i7(e,i,4*s)),u&&(e=e.times(54>Math.abs(u)?iY(2,u):a5.pow(2,u))),i$=!0,e)}(this,e);if("bigint"===n)return e<0?(e=-e,this.s=-1):this.s=1,am(this,e.toString());throw Error(iG+e)}if(a.prototype=i3,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=aT,a.clone=e,a.isDecimal=aR,a.abs=ay,a.acos=ax,a.acosh=ab,a.add=aw,a.asin=aD,a.asinh=aN,a.atan=aE,a.atanh=aA,a.atan2=aC,a.cbrt=aS,a.ceil=aM,a.clamp=aF,a.cos=aB,a.cosh=aO,a.div=a_,a.exp=az,a.floor=ak,a.hypot=aI,a.ln=aq,a.log=aP,a.log10=aU,a.log2=aj,a.max=aL,a.min=a$,a.mod=aH,a.mul=aG,a.pow=aZ,a.random=aV,a.round=aW,a.sign=aJ,a.sin=aY,a.sinh=aX,a.sqrt=aQ,a.sub=aK,a.sum=a0,a.tan=a1,a.tanh=a2,a.trunc=a3,void 0===r&&(r={}),r&&!0!==r.defaults)for(t=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];t<i.length;)r.hasOwnProperty(n=i[t++])||(r[n]=this[n]);return a.config(r),a}(iL);ij=new a5(ij),iU=new a5(iU);var a4=ef("BigNumber",["?on","config"],e=>{var{on:r,config:t}=e,n=a5.clone({precision:t.precision,modulo:a5.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(e){return new n(e.value)},r&&r("config",function(e,r){e.precision!==r.precision&&n.config({precision:e.precision})}),n},{isClass:!0});let a8=Math.cosh||function(e){return 1e-9>Math.abs(e)?1-e:(Math.exp(e)+Math.exp(-e))*.5},a6=Math.sinh||function(e){return 1e-9>Math.abs(e)?e:(Math.exp(e)-Math.exp(-e))*.5},a7=function(e){let r=Math.PI/4;if(-r>e||e>r)return Math.cos(e)-1;let t=e*e;return t*(t*(t*(t*(t*(t*(t*(t/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},a9=function(e,r){return((e=Math.abs(e))<(r=Math.abs(r))&&([e,r]=[r,e]),e<1e8)?Math.sqrt(e*e+r*r):(r/=e,e*Math.sqrt(1+r*r))},oe=function(){throw SyntaxError("Invalid Param")};function or(e,r){let t=Math.abs(e),n=Math.abs(r);return 0===e?Math.log(n):0===r?Math.log(t):t<3e3&&n<3e3?.5*Math.log(e*e+r*r):.5*Math.log((e*=.5)*e+(r*=.5)*r)+Math.LN2}let ot={re:0,im:0},on=function(e,r){if(null==e)ot.re=ot.im=0;else if(void 0!==r)ot.re=e,ot.im=r;else switch(typeof e){case"object":if("im"in e&&"re"in e)ot.re=e.re,ot.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return oi.INFINITY;ot.re=e.abs*Math.cos(e.arg),ot.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return oi.INFINITY;ot.re=e.r*Math.cos(e.phi),ot.im=e.r*Math.sin(e.phi)}else 2===e.length?(ot.re=e[0],ot.im=e[1]):oe();break;case"string":ot.im=ot.re=0;let t=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),n=1,i=0;null===t&&oe();for(let e=0;e<t.length;e++){let r=t[e];" "===r||" "===r||"\n"===r||("+"===r?n++:"-"===r?i++:("i"===r||"I"===r?(n+i===0&&oe()," "===t[e+1]||isNaN(t[e+1])?ot.im+=parseFloat((i%2?"-":"")+"1"):(ot.im+=parseFloat((i%2?"-":"")+t[e+1]),e++)):((n+i===0||isNaN(r))&&oe(),"i"===t[e+1]||"I"===t[e+1]?(ot.im+=parseFloat((i%2?"-":"")+r),e++):ot.re+=parseFloat((i%2?"-":"")+r)),n=i=0))}n+i>0&&oe();break;case"number":ot.im=0,ot.re=e;break;default:oe()}return isNaN(ot.re)||isNaN(ot.im),ot};function oi(e,r){if(!(this instanceof oi))return new oi(e,r);
1let t=on(e,r);this.re=t.re,this.im=t.im}oi.prototype={re:0,im:0,sign:function(){let e=a9(this.re,this.im);return new oi(this.re/e,this.im/e)},add:function(e,r){let t=on(e,r),n=this.isInfinite(),i=!(isFinite(t.re)&&isFinite(t.im));return n||i?n&&i?oi.NAN:oi.INFINITY:new oi(this.re+t.re,this.im+t.im)},sub:function(e,r){let t=on(e,r),n=this.isInfinite(),i=!(isFinite(t.re)&&isFinite(t.im));return n||i?n&&i?oi.NAN:oi.INFINITY:new oi(this.re-t.re,this.im-t.im)},mul:function(e,r){let t=on(e,r),n=this.isInfinite(),i=!(isFinite(t.re)&&isFinite(t.im)),a=0===this.re&&0===this.im,o=0===t.re&&0===t.im;return n&&o||i&&a?oi.NAN:n||i?oi.INFINITY:0===t.im&&0===this.im?new oi(this.re*t.re,0):new oi(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)},div:function(e,r){let t=on(e,r),n=this.isInfinite(),i=!(isFinite(t.re)&&isFinite(t.im)),a=0===this.re&&0===this.im,o=0===t.re&&0===t.im;if(a&&o||n&&i)return oi.NAN;if(o||n)return oi.INFINITY;if(a||i)return oi.ZERO;if(0===t.im)return new oi(this.re/t.re,this.im/t.re);if(Math.abs(t.re)<Math.abs(t.im)){let e=t.re/t.im,r=t.re*e+t.im;return new oi((this.re*e+this.im)/r,(this.im*e-this.re)/r)}{let e=t.im/t.re,r=t.im*e+t.re;return new oi((this.re+this.im*e)/r,(this.im-this.re*e)/r)}},pow:function(e,r){let t=on(e,r),n=0===this.re&&0===this.im;if(0===t.re&&0===t.im)return oi.ONE;if(0===t.im){if(0===this.im&&this.re>0)return new oi(Math.pow(this.re,t.re),0);else if(0===this.re)switch((t.re%4+4)%4){case 0:return new oi(Math.pow(this.im,t.re),0);case 1:return new oi(0,Math.pow(this.im,t.re));case 2:return new oi(-Math.pow(this.im,t.re),0);case 3:return new oi(0,-Math.pow(this.im,t.re))}}if(n&&t.re>0)return oi.ZERO;let i=Math.atan2(this.im,this.re),a=or(this.re,this.im),o=Math.exp(t.re*a-t.im*i),s=t.im*a+t.re*i;return new oi(o*Math.cos(s),o*Math.sin(s))},sqrt:function(){let e=this.re,r=this.im;if(0===r)if(e>=0)return new oi(Math.sqrt(e),0);else return new oi(0,Math.sqrt(-e));let t=Math.sqrt(.5*(a9(e,r)+Math.abs(e))),n=Math.abs(r)/(2*t);return e>=0?new oi(t,r<0?-n:n):new oi(n,r<0?-t:t)},exp:function(){let e=Math.exp(this.re);return 0===this.im?new oi(e,0):new oi(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){let e=this.re,r=this.im;return new oi(Math.expm1(e)*Math.cos(r)+a7(r),Math.exp(e)*Math.sin(r))},log:function(){let e=this.re,r=this.im;return 0===r&&e>0?new oi(Math.log(e),0):new oi(or(e,r),Math.atan2(r,e))},abs:function(){return a9(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){let e=this.re,r=this.im;return new oi(Math.sin(e)*a8(r),Math.cos(e)*a6(r))},cos:function(){let e=this.re,r=this.im;return new oi(Math.cos(e)*a8(r),-Math.sin(e)*a6(r))},tan:function(){let e=2*this.re,r=2*this.im,t=Math.cos(e)+a8(r);return new oi(Math.sin(e)/t,a6(r)/t)},cot:function(){let e=2*this.re,r=2*this.im,t=Math.cos(e)-a8(r);return new oi(-Math.sin(e)/t,a6(r)/t)},sec:function(){let e=this.re,r=this.im,t=.5*a8(2*r)+.5*Math.cos(2*e);return new oi(Math.cos(e)*a8(r)/t,Math.sin(e)*a6(r)/t)},csc:function(){let e=this.re,r=this.im,t=.5*a8(2*r)-.5*Math.cos(2*e);return new oi(Math.sin(e)*a8(r)/t,-Math.cos(e)*a6(r)/t)},asin:function(){let e=this.re,r=this.im,t=new oi(r*r-e*e+1,-2*e*r).sqrt(),n=new oi(t.re-r,t.im+e).log();return new oi(n.im,-n.re)},acos:function(){let e=this.re,r=this.im,t=new oi(r*r-e*e+1,-2*e*r).sqrt(),n=new oi(t.re-r,t.im+e).log();return new oi(Math.PI/2-n.im,n.re)},atan:function(){let e=this.re,r=this.im;if(0===e){if(1===r)return new oi(0,1/0);if(-1===r)return new oi(0,-1/0)}let t=e*e+(1-r)*(1-r),n=new oi((1-r*r-e*e)/t,-2*e/t).log();return new oi(-.5*n.im,.5*n.re)},acot:function(){let e=this.re,r=this.im;if(0===r)return new oi(Math.atan2(1,e),0);let t=e*e+r*r;return 0!==t?new oi(e/t,-r/t).atan():new oi(0!==e?e/0:0,0!==r?-r/0:0).atan()},asec:function(){let e=this.re,r=this.im;if(0===e&&0===r)return new oi(0,1/0);let t=e*e+r*r;return 0!==t?new oi(e/t,-r/t).acos():new oi(0!==e?e/0:0,0!==r?-r/0:0).acos()},acsc:function(){let e=this.re,r=this.im;if(0===e&&0===r)return new oi(Math.PI/2,1/0);let t=e*e+r*r;return 0!==t?new oi(e/t,-r/t).asin():new oi(0!==e?e/0:0,0!==r?-r/0:0).asin()},sinh:function(){let e=this.re,r=this.im;return new oi(a6(e)*Math.cos(r),a8(e)*Math.sin(r))},cosh:function(){let e=this.re,r=this.im;return new oi(a8(e)*Math.cos(r),a6(e)*Math.sin(r))},tanh:function(){let e=2*this.re,r=2*this.im,t=a8(e)+Math.cos(r);return new oi(a6(e)/t,Math.sin(r)/t)},coth:function(){let e=2*this.re,r=2*this.im,t=a8(e)-Math.cos(r);return new oi(a6(e)/t,-Math.sin(r)/t)},csch:function(){let e=this.re,r=this.im,t=Math.cos(2*r)-a8(2*e);return new oi(-2*a6(e)*Math.cos(r)/t,2*a8(e)*Math.sin(r)/t)},sech:function(){let e=this.re,r=this.im,t=Math.cos(2*r)+a8(2*e);return new oi(2*a8(e)*Math.cos(r)/t,-2*a6(e)*Math.sin(r)/t)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;let r=this.asin();return this.re=-this.im,this.im=e,e=r.re,r.re=-r.im,r.im=e,r},acosh:function(){let e=this.acos();if(e.im<=0){let r=e.re;e.re=-e.im,e.im=r}else{let r=e.im;e.im=-e.re,e.re=r}return e},atanh:function(){let e=this.re,r=this.im,t=1-e,n=1+e,i=t*t+r*r,a=0!==i?new oi((n*t-r*r)/i,(r*t+n*r)/i):new oi(-1!==e?e/0:0,0!==r?r/0:0),o=a.re;return a.re=or(a.re,a.im)/2,a.im=Math.atan2(a.im,o)/2,e>1&&0===r&&(a.im=-a.im),a},acoth:function(){let e=this.re,r=this.im;if(0===e&&0===r)return new oi(0,Math.PI/2);let t=e*e+r*r;return 0!==t?new oi(e/t,-r/t).atanh():new oi(0!==e?e/0:0,0!==r?-r/0:0).atanh()},acsch:function(){let e=this.re,r=this.im;if(0===r)return new oi(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);let t=e*e+r*r;return 0!==t?new oi(e/t,-r/t).asinh():new oi(0!==e?e/0:0,0!==r?-r/0:0).asinh()},asech:function(){let e=this.re,r=this.im;if(this.isZero())return oi.INFINITY;let t=e*e+r*r;return 0!==t?new oi(e/t,-r/t).acosh():new oi(0!==e?e/0:0,0!==r?-r/0:0).acosh()},inverse:function(){if(this.isZero())return oi.INFINITY;if(this.isInfinite())return oi.ZERO;let e=this.re,r=this.im,t=e*e+r*r;return new oi(e/t,-r/t)},conjugate:function(){return new oi(this.re,-this.im)},neg:function(){return new oi(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new oi(Math.ceil(this.re*e)/e,Math.
1ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new oi(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new oi(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,r){let t=on(e,r);return Math.abs(t.re-this.re)<=oi.EPSILON&&Math.abs(t.im-this.im)<=oi.EPSILON},clone:function(){return new oi(this.re,this.im)},toString:function(){let e=this.re,r=this.im,t="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<oi.EPSILON&&(e=0),Math.abs(r)<oi.EPSILON&&(r=0),0===r)?t+e:(0!==e?(t+=e,t+=" ",r<0?(r=-r,t+="-"):t+="+",t+=" "):r<0&&(r=-r,t+="-"),1!==r&&(t+=r),t+"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()}},oi.ZERO=new oi(0,0),oi.ONE=new oi(1,0),oi.I=new oi(0,1),oi.PI=new oi(Math.PI,0),oi.E=new oi(Math.E,0),oi.INFINITY=new oi(1/0,1/0),oi.NAN=new oi(NaN,NaN),oi.EPSILON=1e-15;var oa=ef("Complex",[],()=>(Object.defineProperty(oi,"name",{value:"Complex"}),oi.prototype.constructor=oi,oi.prototype.type="Complex",oi.prototype.isComplex=!0,oi.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},oi.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},oi.prototype.format=function(e){var r=this.im,t=this.re,n=eA(this.re,e),i=eA(this.im,e),a=w(e)?e:e?e.precision:null;if(null!==a){var o=Math.pow(10,-a);Math.abs(t/r)<o&&(t=0),Math.abs(r/t)<o&&(r=0)}return 0===r?n:0===t?1===r?"i":-1===r?"-i":i+"i":r<0?-1===r?n+" - i":n+" - "+i.substring(1)+"i":1===r?n+" + i":n+" + "+i+"i"},oi.fromPolar=function(e){switch(arguments.length){case 1:var r=arguments[0];if("object"==typeof r)return oi(r);throw TypeError("Input has to be an object with r and phi keys.");case 2:var t=arguments[0],n=arguments[1];if(w(t)){if(C(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),w(n))return new oi({r:t,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")}},oi.prototype.valueOf=oi.prototype.toString,oi.fromJSON=function(e){return new oi(e)},oi.compare=function(e,r){return e.re>r.re?1:e.re<r.re?-1:e.im>r.im?1:e.im<r.im?-1:0},oi),{isClass:!0});function oo(e){var{hasher:r,limit:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=null==t?1/0:t,r=null==r?JSON.stringify:r,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:(i=t||1/0,a=0,o=1,s=Object.create(null),u=Object.create(null),l=0,c=function(e){var r=u[e];if(r&&(delete s[r],delete u[e],--a,o===r)){if(!a){l=0,o=1;return}for(;!Object.prototype.hasOwnProperty.call(s,++o););}},i=Math.abs(i),{hit:function(e){var r=u[e],t=++l;if(s[t]=e,u[e]=t,!r){if(++a<=i)return;return c(e=s[o]),e}if(delete s[r],o===r)for(;!Object.prototype.hasOwnProperty.call(s,++o););},delete:c,clear:function(){a=l=0,o=1,s=Object.create(null),u=Object.create(null)}})});for(var i,a,o,s,u,l,c,f=[],m=0;m<arguments.length;m++)f[m]=arguments[m];var p=r(f);if(n.cache.values.has(p))return n.cache.lru.hit(p),n.cache.values.get(p);var h=e.apply(e,f);return n.cache.values.set(p,h),n.cache.values.delete(n.cache.lru.hit(p)),h}}var os=oo(function(e){return new e(1).exp()},{hasher:of}),ou=oo(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},{hasher:of}),ol=oo(function(e){return e.acos(-1)},{hasher:of}),oc=oo(function(e){return ol(e).times(2)},{hasher:of});function of(e){return e[0].precision}var om=Math.PI,op=2*Math.PI,oh=Math.E,od=ef("true",[],()=>!0),og=ef("false",[],()=>!1),ov=ef("null",[],()=>null),oy=oO("Infinity",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1/0):1/0}),ox=oO("NaN",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(NaN):NaN}),ob=oO("pi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?ol(t):om}),ow=oO("tau",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?oc(t):op}),oD=oO("e",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?os(t):oh}),oN=oO("phi",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?ou(t):1.618033988749895}),oE=oO("LN2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(2).ln():Math.LN2}),oA=oO("LN10",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(10).ln():Math.LN10}),oC=oO("LOG2E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1).div(new t(2).ln()):Math.LOG2E}),oS=oO("LOG10E",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1).div(new t(10).ln()):Math.LOG10E}),oM=oO("SQRT1_2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t("0.5").sqrt():Math.SQRT1_2}),oF=oO("SQRT2",["config","?BigNumber"],e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(2).sqrt():Math.SQRT2}),oT=oO("i",["Complex"],e=>{var{Complex:r}=e;return r.I}),oB=ef("version",[],()=>"14.9.1");function oO(e,r,t){return ef(e,r,t,{recreateOnConfigChange:!0})}var o_=sb("speedOfLight","299792458","m s^-1"),oz=sb("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),ok=sb("planckConstant","6.62607015e-34","J s"),oI=sb("reducedPlanckConstant","1.0545718176461565e-34","J s"),oR=sb("magneticConstant","1.25663706212e-6","N A^-2"),oq=sb("electricConstant","8.8541878128e-12","F m^-1"),oP=sb("vacuumImpedance","376.730313667","ohm"),oj=sb("coulomb","8.987551792261171e9","N m^2 C^-2"),oU=sb("coulombConstant","8.987551792261171e9","N m^2 C^-2"),oL=sb("elementaryCharge","1.602176634e-19","C"),o$=sb("bohrMagneton","9.2740100783e-24","J T^-1"),oH=sb("conductanceQuantum","7.748091729863649e-5","S"),oG=sb("inverseConductanceQuantum","12906.403729652257","ohm"),oZ=sb("magneticFluxQuantum","2.0678338484619295e-15","Wb"),oV=sb("nuclearMagneton","5.0507837461e-27","J T^-1"),oW=sb("klitzing","25812.807459304513","ohm"),oJ=sb("bohrRadius","5.29177210903e-11","m"),oY=sb("classicalElectronRadius","2.8179403262e-15","m"),oX=sb("electronMass","9.1093837015e-31","kg"),oQ=sb("fermiCoupling","1.1663787e-5","GeV^-2"),oK=sw("fineStructure",.0072973525693),o0=sb("hartreeEnergy","4.3597447222071e-18","J"),o1=sb("protonMass","1.67262192369e-27","kg"),o2=sb("deuteronMass","3.3435830926e-27","kg"),o3=sb("neutronMass","1.6749271613e-27","kg"),o5=sb("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),o4=sb("rydberg","10973731.568160","m^-1"),o8=sb("thomsonCrossSection","6.6524587321e-29","m^2"),o6=sw("weakMixingAngle",.2229),o7=sw("efimovFactor",22.7),o9=sb("atomicMass","1.66053906660e-27","kg"),se=sb("avogadro","6.02214076e23","mol^-1"),sr=sb("boltzmann","1.380649e-23","J K^-1"),st=sb("faraday","96485.33212331001","C mol^-1"),sn=sb("firstRadiation","3.7417718521927573e-16","W m^2"),si=sb("loschmidt","2.686780111798444e25","m^-3"),sa=sb("gasConstant","8.31446261815324","J K^-1 mol^-1"),so=sb("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),ss=sb("molarVolume","0.022413969545014137","m^3 mol^-1"),su=sw("sackurTetrode",-1.16487052358),sl=sb("secondRadiation","0.014387768775039337","m K"),sc=sb("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),sf=sb("wienDisplacement","2.897771955e-3","m K"),sm=sb("molarMass","0.99999999965e-3","kg mol^-1"),sp=sb("molarMassC12","11.9999999958e-3","kg mol^-1"),sh=sb("gravity","9.80665","m s^-2"),sd=sb("planckLength","1.616255e-35","m"),sg=sb("planckMass","2.176435e-8","kg"),sv=sb("planckTime","5.391245e-44","s"),sy=sb("planckCharge","1.87554603778e-18","C"),sx=sb("planckTemperature","1.416785e+32","K");
1function sb(e,r,t){return ef(e,["config","Unit","BigNumber"],e=>{var{config:n,Unit:i,BigNumber:a}=e,o=new i("BigNumber"===n.number?new a(r):parseFloat(r),t);return o.fixPrefix=!0,o})}function sw(e,r){return ef(e,["config","BigNumber"],e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(r):r})}"undefined"==typeof BigInt&&(BigInt=function(e){if(isNaN(e))throw Error("");return e});let sD=BigInt(0),sN=BigInt(1),sE=BigInt(2),sA=BigInt(5),sC=BigInt(10),sS={s:sN,n:sD,d:sN};function sM(e,r){try{e=BigInt(e)}catch(e){throw sI()}return e*r}function sF(e){return"bigint"==typeof e?e:Math.floor(e)}function sT(e,r){if(r===sD)throw sk();let t=Object.create(sz.prototype);t.s=e<sD?-sN:sN;let n=s_(e=e<sD?-e:e,r);return t.n=e/n,t.d=r/n,t}function sB(e){let r={},t=e,n=sE,i=sA-sN;for(;i<=t;){for(;t%n===sD;)t/=n,r[n]=(r[n]||sD)+sN;i+=sN+sE*n++}return t!==e?t>1&&(r[t]=(r[t]||sD)+sN):r[e]=(r[e]||sD)+sN,r}let sO=function(e,r){let t=sD,n=sN,i=sN;if(null==e);else if(void 0!==r){if("bigint"==typeof e)t=e;else if(isNaN(e))throw sI();else if(e%1!=0)throw sR();else t=BigInt(e);if("bigint"==typeof r)n=r;else if(isNaN(r))throw sI();else if(r%1!=0)throw sR();else n=BigInt(r);i=t*n}else if("object"==typeof e){if("d"in e&&"n"in e)t=BigInt(e.n),n=BigInt(e.d),"s"in e&&(t*=BigInt(e.s));else if(0 in e)t=BigInt(e[0]),1 in e&&(n=BigInt(e[1]));else if("bigint"==typeof e)t=e;else throw sI();i=t*n}else if("number"==typeof e){if(isNaN(e))throw sI();if(e<0&&(i=-sN,e=-e),e%1==0)t=BigInt(e);else{let r=1,i=0,a=1,o=1,s=1;for(e>=1&&(r=10**Math.floor(1+Math.log10(e)),e/=r);a<=1e7&&s<=1e7;){let r=(i+o)/(a+s);if(e===r){a+s<=1e7?(t=i+o,n=a+s):s>a?(t=o,n=s):(t=i,n=a);break}e>r?(i+=o,a+=s):(o+=i,s+=a),a>1e7?(t=o,n=s):(t=i,n=a)}t=BigInt(t)*BigInt(r),n=BigInt(n)}}else if("string"==typeof e){let r=0,a=sD,o=sD,s=sD,u=sN,l=sN,c=e.replace(/_/g,"").match(/\d+|./g);if(null===c)throw sI();if("-"===c[r]?(i=-sN,r++):"+"===c[r]&&r++,c.length===r+1?o=sM(c[r++],i):"."===c[r+1]||"."===c[r]?("."!==c[r]&&(a=sM(c[r++],i)),(++r+1===c.length||"("===c[r+1]&&")"===c[r+3]||"'"===c[r+1]&&"'"===c[r+3])&&(o=sM(c[r],i),u=sC**BigInt(c[r].length),r++),("("===c[r]&&")"===c[r+2]||"'"===c[r]&&"'"===c[r+2])&&(s=sM(c[r+1],i),l=sC**BigInt(c[r+1].length)-sN,r+=3)):"/"===c[r+1]||":"===c[r+1]?(o=sM(c[r],i),u=sM(c[r+2],sN),r+=3):"/"===c[r+3]&&" "===c[r+1
1]&&(a=sM(c[r],i),o=sM(c[r+2],i),u=sM(c[r+4],sN),r+=5),c.length<=r)i=t=s+(n=u*l)*a+l*o;else throw sI()}else if("bigint"==typeof e)t=e,i=e,n=sN;else throw sI();if(n===sD)throw sk();sS.s=i<sD?-sN:sN,sS.n=t<sD?-t:t,sS.d=n<sD?-n:n};function s_(e,r){if(!e)return r;if(!r)return e;for(;;){if(!(e%=r))return r;if(!(r%=e))return e}}function sz(e,r){if(sO(e,r),!(this instanceof sz))return sT(sS.s*sS.n,sS.d);e=s_(sS.d,sS.n),this.s=sS.s,this.n=sS.n/e,this.d=sS.d/e}var sk=function(){return Error("Division by Zero")},sI=function(){return Error("Invalid argument")},sR=function(){return Error("Parameters must be integer")};sz.prototype={s:sN,n:sD,d:sN,abs:function(){return sT(this.n,this.d)},neg:function(){return sT(-this.s*this.n,this.d)},add:function(e,r){return sO(e,r),sT(this.s*this.n*sS.d+sS.s*this.d*sS.n,this.d*sS.d)},sub:function(e,r){return sO(e,r),sT(this.s*this.n*sS.d-sS.s*this.d*sS.n,this.d*sS.d)},mul:function(e,r){return sO(e,r),sT(this.s*sS.s*this.n*sS.n,this.d*sS.d)},div:function(e,r){return sO(e,r),sT(this.s*sS.s*this.n*sS.d,this.d*sS.n)},clone:function(){return sT(this.s*this.n,this.d)},mod:function(e,r){if(void 0===e)return sT(this.s*this.n%this.d,sN);if(sO(e,r),sD===sS.n*this.d)throw sk();return sT(this.s*(sS.d*this.n)%(sS.n*this.d),sS.d*this.d)},gcd:function(e,r){return sO(e,r),sT(s_(sS.n,this.n)*s_(sS.d,this.d),sS.d*this.d)},lcm:function(e,r){return(sO(e,r),sS.n===sD&&this.n===sD)?sT(sD,sN):sT(sS.n*this.n,s_(sS.n,this.n)*s_(sS.d,this.d))},inverse:function(){return sT(this.s*this.d,this.n)},pow:function(e,r){if(sO(e,r),sS.d===sN)if(sS.s<sD)return sT((this.s*this.d)**sS.n,this.n**sS.n);else return sT((this.s*this.n)**sS.n,this.d**sS.n);if(this.s<sD)return null;let t=sB(this.n),n=sB(this.d),i=sN,a=sN;for(let e in t)if("1"!==e){if("0"===e){i=sD;break}if(t[e]*=sS.n,t[e]%sS.d!==sD)return null;t[e]/=sS.d,i*=BigInt(e)**t[e]}for(let e in n)if("1"!==e){if(n[e]*=sS.n,n[e]%sS.d!==sD)return null;n[e]/=sS.d,a*=BigInt(e)**n[e]}return sS.s<sD?sT(a,i):sT(i,a)},log:function(e,r){if(sO(e,r),this.s<=sD||sS.s<=sD)return null;let t={},n=sB(sS.n),i=sB(sS.d),a=sB(this.n),o=sB(this.d);for(let e in i)n[e]=(n[e]||sD)-i[e];for(let e in o)a[e]=(a[e]||sD)-o[e];for(let e in n)"1"!==e&&(t[e]=!0);for(let e in a)"1"!==e&&(t[e]=!0);let s=null,u=null;for(let e in t){let r=n[e]||sD,t=a[e]||sD;if(r===sD){if(t!==sD)return null;continue}let i=t,o=r,l=s_(i,o);if(i/=l,o/=l,null===s&&null===u)s=i,u=o;else if(i*u!=s*o)return null}return null!==s&&null!==u?sT(s,u):null},equals:function(e,r){return sO(e,r),this.s*this.n*sS.d==sS.s*sS.n*this.d},lt:function(e,r){return sO(e,r),this.s*this.n*sS.d<sS.s*sS.n*this.d},lte:function(e,r){return sO(e,r),this.s*this.n*sS.d<=sS.s*sS.n*this.d},gt:function(e,r){return sO(e,r),this.s*this.n*sS.d>sS.s*sS.n*this.d},gte:function(e,r){return sO(e,r),this.s*this.n*sS.d>=sS.s*sS.n*this.d},compare:function(e,r){sO(e,r);let t=this.s*this.n*sS.d-sS.s*sS.n*this.d;return(sD<t)-(t<sD)},ceil:function(e){return e=sC**BigInt(e||0),sT(sF(this.s*e*this.n/this.d)+(e*this.n%this.d>sD&&this.s>=sD?sN:sD),e)},floor:function(e){return e=sC**BigInt(e||0),sT(sF(this.s*e*this.n/this.d)-(e*this.n%this.d>sD&&this.s<sD?sN:sD),e)},round:function(e){return e=sC**BigInt(e||0),sT(sF(this.s*e*this.n/this.d)+this.s*((this.s>=sD?sN:sD)+sE*(e*this.n%this.d)>this.d?sN:sD),e)},roundTo:function(e,r){sO(e,r);let t=this.n*sS.d,n=this.d*sS.n,i=t%n,a=sF(t/n);return i+i>=n&&a++,sT(this.s*a*sS.n,sS.d)},divisible:function(e,r){return sO(e,r),!(!(sS.n*this.d)||this.n*sS.d%(sS.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(e){let r=this.n,t=this.d;e=e||15;let n=function(e,r){for(;r%sE===sD;r/=sE);for(;r%sA===sD;r/=sA);if(r===sN)return sD;let t=sC%r,n=1;for(;t!==sN;n++)if(t=t*sC%r,n>2e3)return sD;return BigInt(n)}(0,t),i=function(e,r,t){let n=sN,i=function(e,r,t){let n=sN;for(;r>sD;e=e*e%t,r>>=sN)r&sN&&(n=n*e%t);return n}(sC,t,r);for(let e=0;e<300;e++){if(n===i)return BigInt(e);n=n*sC%r,i=i*sC%r}return 0}(0,t,n),a=this.s<sD?"-":"";if(a+=sF(r/t),r%=t,(r*=sC)&&(a+="."),n){for(let e=i;e--;)a+=sF(r/t),r%=t,r*=sC;a+="(";for(let e=n;e--;)a+=sF(r/t),r%=t,r*=sC;a+=")"}else for(let n=e;r&&n--;)a+=sF(r/t),r%=t,r*=sC;return a},toFraction:function(e){let r=this.n,t=this.d,n=this.s<sD?"-":"";if(t===sN)n+=r;else{let i=sF(r/t);e&&i>sD&&(n+=i,n+=" ",r%=t),n+=r,n+="/",n+=t}return n},toLatex:function(e){let r=this.n,t=this.d,n=this.s<sD?"-":"";if(t===sN)n+=r;else{let i=sF(r/t);e&&i>sD&&(n+=i,r%=t),n+="\\frac{",n+=r,n+="}{",n+=t,n+="}"}return n},toContinued:function(){let e=this.n,r=this.d,t=[];do{t.push(sF(e/r));let n=e%r;e=r,r=n}while(e!==sN);return t},simplify:function(e){let r=BigInt(1/(e||.001)|0),t=this.abs(),n=t.toContinued();for(let e=1;e<n.length;e++){let i=sT(n[e-1],sN);for(let r=e-2;r>=0;r--)i=i.inverse().add(n[r]);let a=i.sub(t);if(a.n*r<a.d)return i.mul(this.s)}return this}};var sq=ef("Fraction",[],()=>(Object.defineProperty(sz,"name",{value:"Fraction"}),sz.prototype.constructor=sz,sz.prototype.type="Fraction",sz.prototype.isFraction=!0,sz.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},sz.fromJSON=function(e){return new sz(e)},sz),{isClass:!0}),sP=ef("Matrix",[],()=>{function e(){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,r){throw Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,r,t){throw Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,r,t){throw Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,r){throw Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,r){throw Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,r){throw Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},e},{isClass:!0}),sj=ef("Range",[],()=>{function e(r,t,n){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator");var i=null!=r,a=null!=t,o=null!=n;if(i){if(D(r))r=r.toNumber();else if("number"!=typeof r&&!N(r))throw TypeError("Parameter start must be a number or bigint")}if(a){if(D(t))t=t.toNumber();else if("number"!=typeof t&&!N(t))throw TypeError("Parameter end must be a number or bigint")}if(o){if(D(n))n=n.toNumber();else if("number"!=typeof n&&!N(n))throw TypeError("Parameter step must be a number or bigint")}if(this.start=i?parseFloat(r):0,this.end=a?parseFloat(t):0,this.step=o?parseFloat(n):1,o&&eO(this.step,0))throw Error("Step must not be zero")}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(r){if("string"!=typeof r)return null;var t=r.split(":").map(function(e){return parseFloat(e)});if(t.some(function(e){return isNaN(e)}))return null;switch(t.length){case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[2],t[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var e=0,r=this.start,t=this.step,n=this.end-r;return ey(t)===ey(n)?e=Math.ceil(n/t):0===n&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){var e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){var r=this.start,t=this.step,n=this.end,i=0;if(t>0)for(;r<n;)e(r,[i],this),r+=t,i++;else if(t<0)for(;r>n;)e(r,[i],this),r+=t,i++},e.prototype.map=function(e){var r=[];return this.forEach(function(t,n,i){r[n[0]]=e(t,n,i)}),r},e.prototype.toArray=function(){var e=[];return this.forEach(function(r,t){e[t[0]]=r}),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var r=eA(this.start,e);return 1!==this.step&&(r+=":"+eA(this.step,e)),r+=":"+eA(this.end,e)},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(r){return new e(r.start,r.end,r.step)},e},{isClass:!0}),sU=ef("ResultSet",[],()=>{function e(r){if(!(this instanceof e))throw SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(r){return new e(r.entries)},e},{isClass:!0}
1),sL=ef("DenseMatrix",["Matrix"],e=>{var{Matrix:r}=e;function t(e,r){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator");if(r&&!S(r))throw Error("Invalid datatype: "+r);if(F(e))"DenseMatrix"===e.type?(this._data=o(e._data),this._size=o(e._size)):(this._data=e.toArray(),this._size=e.size()),this._datatype=r||e._datatype;else if(e&&M(e.data)&&M(e.size))this._data=e.data,this._size=e.size,e0(this._data,this._size),this._datatype=r||e.datatype;else if(M(e))this._data=function e(r){return F(r)?e(r.valueOf()):M(r)?r.map(e):r}(e),this._size=eK(this._data),e0(this._data,this._size),this._datatype=r;else if(e)throw TypeError("Unsupported type of data ("+el(e)+")");else this._data=[],this._size=[0],this._datatype=r}function n(e,r,t){if(0===r.length){for(var n=e._data;M(n);)n=n[0];return n}return e._size=r.slice(0),e._data=e5(e._data,e._size,t),e}function i(e,r,t){for(var i=e._size.slice(0),a=!1;i.length<r.length;)i.push(0),a=!0;for(var o=0,s=r.length;o<s;o++)r[o]>i[o]&&(i[o]=r[o],a=!0);a&&n(e,i,t)}return t.prototype=new r,t.prototype.createDenseMatrix=function(e,r){return new t(e,r)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return ru(this._data,el)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(e,r){return new t(e,r)},t.prototype.subset=function(e,r,n){switch(arguments.length){case 1:return function(e,r){if(!z(r))throw TypeError("Invalid index");if(r.isScalar())return e.get(r.min());var n,i,a,o,s=r.size();if(s.length!==e._size.length)throw new eX(s.length,e._size.length);for(var u=r.min(),l=r.max(),c=0,f=e._size.length;c<f;c++)e2(u[c],e._size[c]),e2(l[c],e._size[c]);var m=new t([]),p=(n=e._data,o=Array(a=(i=r).size().length-1),{data:function e(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=i.dimension(t);return(o[t]=n.size()[0],t<a)?n.map(n=>(e2(n,r.length),e(r[n],t+1))).valueOf():n.map(e=>(e2(e,r.length),r[e])).valueOf()}(n),size:o});return m._size=p.size,m._datatype=e._datatype,m._data=p.data,m}(this,e);case 2:case 3:return function(e,r,t,n){if(!r||!0!==r.isIndex)throw TypeError("Invalid index");var a,o=r.size(),s=r.isScalar();if(F(t)?(a=t.size(),t=t.valueOf()):a=eK(t),s){if(0!==a.length)throw TypeError("Scalar expected");e.set(r.min(),t,n)}else{if(!u(a,o))try{t=0===a.length?rm([t],o):rm(t,o),a=eK(t)}catch(e){}if(o.length<e._size.length)throw new eX(o.length,e._size.length,"<");if(a.length<o.length){for(var l,c,f,m,p=0,h=0;1===o[p]&&1===a[p];)p++;for(;1===o[p];)h++,p++;t=e9(t,o.length,h,a)}if(!u(o,a))throw new eX(o,a,">");i(e,r.max().map(function(e){return e+1}),n),l=e._data,c=r,f=t,m=c.size().length-1,function e(r,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=c.dimension(n);n<m?i.forEach((i,a)=>{e2(i,r.length),e(r[i],t[a[0]],n+1)}):i.forEach((e,n)=>{e2(e,r.length),r[e]=t[n[0]]})}(l,f)}return e}(this,e,r,n);default:throw SyntaxError("Wrong number of arguments")}},t.prototype.get=function(e){return rp(this._data,e)},t.prototype.set=function(e,r,t){if(!M(e))throw TypeError("Array expected");if(e.length<this._size.length)throw new eX(e.length,this._size.length,"<");i(this,e.map(function(e){return e+1}),t);var n,a,o,s=this._data;for(n=0,a=e.length-1;n<a;n++)e2(o=e[n],s.length),s=s[o];return e2(o=e[e.length-1],s.length),s[o]=r,this},t.prototype.resize=function(e,r,t){if(!T(e))throw TypeError("Array or Matrix expected");var i=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);return n(t?this.clone():this,i,r)},t.prototype.reshape=function(e,r){var t=r?this.clone():this;t._data=e4(t._data,e);var n=t._size.reduce((e,r)=>e*r);return t._size=e8(e,n),t},t.prototype.clone=function(){return new t({data:o(this._data),size:o(this._size),datatype:this._datatype})},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=this,n=t._size.length-1;if(n<0)return t.clone();var i=tV(e,t,"map",r),a=i.fn,o=t.create(void 0,t._datatype);if(o._size=t._size,r||i.isUnary)return o._data=function e(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=Array(r.length);if(t<n)for(var o=0;o<r.length;o++)i[o]=e(r[o],t+1);else for(var s=0;s<r.length;s++)i[s]=a(r[s]);return i}(t._data),o;
1if(0===n){for(var s=t.valueOf(),u=Array(s.length),l=0;l<s.length;l++)u[l]=a(s[l],[l],t);return o._data=u,o}var c=[];return o._data=function e(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=Array(r.length);if(i<n)for(var s=0;s<r.length;s++)c[i]=s,o[s]=e(r[s],i+1);else for(var u=0;u<r.length;u++)c[i]=u,o[u]=a(r[u],c.slice(),t);return o}(t._data),o},t.prototype.forEach=function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],t=this,n=t._size.length-1;if(!(n<0)){var i=tV(e,t,"map",r),a=i.fn;if(r||i.isUnary)return void function e(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(t<n)for(var i=0;i<r.length;i++)e(r[i],t+1);else for(var o=0;o<r.length;o++)a(r[o])}(t._data);if(0===n){for(var o=0;o<t._data.length;o++)a(t._data[o],[o],t);return}var s=[];!function e(r){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(i<n)for(var o=0;o<r.length;o++)s[i]=o,e(r[o],i+1);else for(var u=0;u<r.length;u++)s[i]=u,a(r[u],s.slice(),t)}(t._data)}},t.prototype[Symbol.iterator]=function*(){var e=this._size.length-1;if(!(e<0)){if(0===e){for(var r=0;r<this._data.length;r++)yield{value:this._data[r],index:[r]};return}for(var t=Array(e+1).fill(0),n=this._size.reduce((e,r)=>e*r,1),i=0;i<n;i++){for(var a=this._data,o=0;o<e;o++)a=a[t[o]];yield{value:a[t[e]],index:t.slice()};for(var s=e;s>=0&&(t[s]++,!(t[s]<this._size[s]));s--)t[s]=0}}},t.prototype.rows=function(){var e=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var r of this._data)e.push(new t([r],this._datatype));return e},t.prototype.columns=function(){var e=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,a=function(n){var a=i.map(e=>[e[n]]);r.push(new t(a,e._datatype))},o=0;o<n[1];o++)a(o);return r},t.prototype.toArray=function(){return o(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(e){return eH(this._data,e)},t.prototype.toString=function(){return eH(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(e){if(e){if(D(e)&&(e=e.toNumber()),!w(e)||!eg(e))throw TypeError("The parameter k must be an integer number")}else e=0;for(var r=e>0?e:0,n=e<0?-e:0,i=Math.min(this._size[0]-n,this._size[1]-r),a=[],o=0;o<i;o++)a[o]=this._data[o+n][o+r];return new t({data:a,size:[i],datatype:this._datatype})},t.diagonal=function(e,r,n,i){if(!M(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(D(e)&&(e=e.toNumber()),!w(e)||!eg(e)||e<1)throw Error("Size values must be positive integers");return e}),n){if(D(n)&&(n=n.toNumber()),!w(n)||!eg(n))throw TypeError("The parameter k must be an integer number")}else n=0;var a,o=n>0?n:0,s=n<0?-n:0,u=e[0],l=e[1],c=Math.min(u-s,l-o);if(M(r)){if(r.length!==c)throw Error("Invalid value array length");a=function(e){return r[e]}}else if(F(r)){var f=r.size();if(1!==f.length||f[0]!==c)throw Error("Invalid matrix length");a=function(e){return r.get([e])}}else a=function(){return r};i||(i=D(a(0))?a(0).mul(0):0);var m=[];if(e.length>0){m=e5(m,e,i);for(var p=0;p<c;p++)m[p+s][p+o]=a(p)}return new t({data:m,size:[u,l]})},t.fromJSON=function(e){return new t(e)},t.prototype.swapRows=function(e,r){if(!w(e)||!eg(e)||!w(r)||!eg(r))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return e2(e,this._size[0]),e2(r,this._size[0]),t._swapRows(e,r,this._data),this},t._swapRows=function(e,r,t){var n=t[e];t[e]=t[r],t[r]=n},t},{isClass:!0}),s$=ef("replacer",[],()=>function(e,r){return"number"==typeof r&&(!isFinite(r)||isNaN(r))?{mathjs:"number",value:String(r)}:"bigint"==typeof r?{mathjs:"bigint",value:String(r)}:r}),sH=function(){return sH=tZ.create,tZ},sG=ef("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(e){var{BigNumber:r,Complex:t,DenseMatrix:n,Fraction:i}=e,a=sH();return a.clear(),a.addTypes([{name:"number",test:w},{name:"Complex",test:E},{name:"BigNumber",test:D},{name:"bigint",test:N},{name:"Fraction",test:A},{name:"Unit",test:C},{name:"identifier",test:e=>S&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u
10EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE4
10-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFB
1D3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDDC0-\uDDF3\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDD4A-\uDD65\uDD6F-\uDD85\uDE80-\uDEA9\uDEB0\uDEB1\uDEC2-\uDEC4\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61\uDF80-\uDF89\uDF8B\uDF8E\uDF90-\uDFB5\uDFB7\uDFD1\uDFD3]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8\uDFC0-\uDFE0]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD80E\uD80F\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46\uDC60-\uDFFF]|\uD810[\uDC00-\uDFFA]|\uD811[\uDC00-\uDE46]|\uD818[\uDD00-\uDD1D]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDD40-\uDD6C\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDDD0-\uDDED\uDDF0\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(e)},{name:"string",test:S},{name:"Chain",test:eu},{name:"Array",test:M},{name:"Matrix",test:F},{name:"DenseMatrix",test:B},{name:"SparseMatrix",test:O},{name:"Range",test:_},{name:"Index",test:z},{name:"boolean",test:k},{name:"ResultSet",test:I},{name:"Help",test:R},{name:"function",test:q},{name:"Date",test:P},{name:"RegExp",test:j},{name:"null",test:$},{name:"undefined",test:H}
1,{name:"AccessorNode",test:G},{name:"ArrayNode",test:Z},{name:"AssignmentNode",test:V},{name:"BlockNode",test:W},{name:"ConditionalNode",test:J},{name:"ConstantNode",test:Y},{name:"FunctionNode",test:K},{name:"FunctionAssignmentNode",test:Q},{name:"IndexNode",test:ee},{name:"Node",test:er},{name:"ObjectNode",test:et},{name:"OperatorNode",test:en},{name:"ParenthesisNode",test:ei},{name:"RangeNode",test:ea},{name:"RelationalNode",test:eo},{name:"SymbolNode",test:es},{name:"Map",test:L},{name:"Object",test:U}]),a.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(r||sZ(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new r(e)}},{from:"number",to:"Complex",convert:function(e){return t||sV(e),new t(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return t||sV(e),new t(e.toNumber(),0)}},{from:"bigint",to:"number",convert:function(e){if(e>Number.MAX_SAFE_INTEGER)throw TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+e+")");return Number(e)}},{from:"bigint",to:"BigNumber",convert:function(e){return r||sZ(e),new r(e.toString())}},{from:"bigint",to:"Fraction",convert:function(e){return i||sW(e),new i(e)}},{from:"Fraction",to:"BigNumber",convert:function(e){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(e){return t||sV(e),new t(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||sW(e);var r=new i(e);if(r.valueOf()!==e)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return r}},{from:"string",to:"number",convert:function(e){var r=Number(e);if(isNaN(r))throw Error('Cannot convert "'+e+'" to a number');return r}},{from:"string",to:"BigNumber",convert:function(e){r||sZ(e);try{return new r(e)}catch(r){throw Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(e){try{return BigInt(e)}catch(r){throw Error('Cannot convert "'+e+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(e){i||sW(e);try{return new i(e)}catch(r){throw Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){t||sV(e);try{return new t(e)}catch(r){throw Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return r||sZ(e),new r(+e)}},{from:"boolean",to:"bigint",convert:function(e){return BigInt(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||sW(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),a.onMismatch=(e,r,t)=>{var n=a.createError(e,r,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&T(r[0])&&t.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},a.onMismatch=(e,r,t)=>{var n=a.createError(e,r,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&T(r[0])&&t.some(e=>!e.params.includes(","))){var i=TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},a});function sZ(e){throw Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function sV(e){throw Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function sW(e){throw Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var sJ="number",sY="number, number";function sX(e){return Math.abs(e)}function sQ(e,r){return e+r}function sK(e,r){return e-r}function s0(e,r){return e*r}function s1(e){return-e}function s2(e){return e}function s3(e){return eD(e)}function s5(e){return e*e*e}function s4(e){return Math.exp(e)}function s8(e){return eN(e)}function s6(e,r){if(!eg(e)||!eg(r))throw Error("Parameters in function lcm must be integer numbers");if(0===e||0===r)return 0;for(var t,n=e*r;0!==r;)r=e%(t=r),e=t;return Math.abs(n/e)}function s7(e,r){return r?Math.log(e)/Math.log(r):Math.log(e)}function s9(e){return eb(e)}function ue(e){return ex(e)}function ur(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=r<0;if(t&&(r=-r),0===r)throw Error("Root must be non-zero");if(e<0&&Math.abs(r)%2!=1)throw Error("Root must be odd when a is negative.");if(0===e)return t?1/0:0;if(!isFinite(e))return t?0:e;var n=Math.pow(Math.abs(e),1/r);return n=e<0?-n:n,t?1/n:n}function ut(e){return ey(e)}function un(e){return e*e}function ui(e,r){var t,n,i,a=0,o=1,s=1,u=0;if(!eg(e)||!eg(r))throw Error("Parameters in function xgcd must be integer numbers");for(;r;)n=Math.floor(e/r),i=e-n*r,t=a,a=o-n*a,o=t,t=s,s=u-n*s,u=t,e=r,r=i;return e<0?[-e,-o,-u]:[e,e?o:0,u]}function ua(e,r){return e*e<1&&r===1/0||e*e>1&&r===-1/0?0:Math.pow(e,r)}function uo(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!eg(r)||r<0||r>15)throw Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(eM(e,r))}sX.signature=sJ,sQ.signature=sY,sK.signature=sY,s0.signature=sY,s1.signature=sJ,s2.signature=sJ,s3.signature=sJ,s5.signature=sJ,s4.signature=sJ,s8.signature=sJ,s6.signature=sY,s9.signature=sJ,ue.signature=sJ,ut.signature=sJ,un.signature=sJ,ui.signature=sY,ua.signature=sY;var us=ef("abs",["typed"],e=>{var{typed:r}=e;return r("abs",{number:sX,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0))})}),uu="acos",ul=ef(uu,["typed","config","Complex"],e=>{var{typed:r,config:t,Complex:n}=e;return r(uu,{number:function(e){return e>=-1&&e<=1||t.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})}),uc="number";function uf(e){return Math.atan(1/e)}function um(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function up(e){return Math.asin(1/e)}function uh(e){var r=1/e;return Math.log(r+Math.sqrt(r*r+1))}function ud(e){return Math.acos(1/e)}function ug(e){var r=1/e;return Math.log(Math.sqrt(r*r-1)+r)}function uv(e){return ez(e)}uf.signature=uc,um.signature=uc,up.signature=uc,uh.signature=uc,ud.signature=uc,ug.signature=uc,uv.signature=uc;function uy(e){return 1/Math.tan(e)}function ux(e){var r=Math.exp(2*e);return(r+1)/(r-1)}function ub(e){return 1/Math.sin(e)}function uw(e){return 0===e?1/0:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*ey(e)}function uD(e){return 1/Math.cos(e)}function uN(e){return 2/(Math.exp(e)+Math.exp(-e))}function uE(e){return eR(e)}uy.signature=uc,ux.signature=uc,ub.signature=uc,uw.signature=uc,uD.signature=uc,uN.signature=uc,uE.signature=uc;var uA="acot",uC=ef(uA,["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e;return r(uA,{number:uf,Complex:function(e){return e.acot()},BigNumber:function(e){return new t(1).div(e).atan()}})}),uS="acsc",uM=ef(uS,["typed","config","Complex","BigNumber"],e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(uS,{number:function(e){return e<=-1||e>=1||t.predictable?up(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})}),uF="addScalar",uT=ef(uF,["typed"],e=>{var{typed:r}=e;return r(uF,{"number, number":sQ,"Complex, Complex":function(e,r){return e.add(r)},"BigNumber, BigNumber":function(e,r){return e.plus(r)},"bigint, bigint":function(e,r){return e+r},"Fraction, Fraction":function(e,r){return e.add(r)},"Unit, Unit":r.referToSelf(e=>(t,n)=>{if(null===t.value||void 0===t.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw Error("Units do not match");var i=t.clone();
1return i.value=r.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),uB=ef("arg",["typed"],e=>{var{typed:r}=e;return r("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),uO="asech",u_=ef(uO,["typed","config","Complex","BigNumber"],e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(uO,{number:function(e){if(e<=1&&e>=-1||t.predictable){var r=1/e;return r>0||t.predictable?ug(e):new n(Math.log(Math.sqrt(r*r-1)-r),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})}),uz=ef("asinh",["typed"],e=>{var{typed:r}=e;return r("asinh",{number:uv,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})}),uk=ef("atan",["typed"],e=>{var{typed:r}=e;return r("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})}),uI="atanh",uR=ef(uI,["typed","config","Complex"],e=>{var{typed:r,config:t,Complex:n}=e;return r(uI,{number:function(e){return e<=1&&e>=-1||t.predictable?ek(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})}),uq=ef("bigint",["typed"],e=>{var{typed:r}=e,t=r("bigint",{"":function(){return 0n},bigint:function(e){return e},number:function(e){return BigInt(e.toFixed())},BigNumber:function(e){return BigInt(e.round().toString())},Fraction:function(e){return BigInt(e.valueOf().toFixed())},"string | boolean":function(e){return BigInt(e)},null:function(e){return 0n},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))});return t.fromJSON=function(e){return BigInt(e.value)},t}),uP="bitNot",uj=ef(uP,["typed"],e=>{var{typed:r}=e;return r(uP,{number:nU,BigNumber:nO,bigint:e=>~e,"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),uU="boolean",uL=ef(uU,["typed"],e=>{var{typed:r}=e;return r(uU,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var r=e.toLowerCase();if("true"===r)return!0;if("false"===r)return!1;var t=Number(e);if(""!==e&&!isNaN(t))return!!t;throw Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),u$="clone",uH=ef(u$,["typed"],e=>{var{typed:r}=e;return r(u$,{any:o})});function uG(e,r){if(r<e)return 1;if(r===e)return r;var t=r+e>>1;return uG(e,t)*uG(t+1,r)}function uZ(e,r){if(!eg(e)||e<0||!eg(r)||r<0)throw TypeError("Positive integer value expected in function combinations");if(r>e)throw TypeError("k must be less than or equal to n");for(var t=e-r,n=1,i=r<t?t+1:r+1,a=2,o=r<t?r:t,s=i;s<=e;++s)for(n*=s;a<=o&&n%a==0;)n/=a,++a;return a<=o&&(n/=uG(a,o)),n}uZ.signature="number, number";var uV="combinations",uW=ef(uV,["typed"],e=>{var{typed:r}=e;return r(uV,{"number, number":uZ,"BigNumber, BigNumber":function(e,r){var t,n,i=e.constructor,a=e.minus(r),o=new i(1);if(!uJ(e)||!uJ(r))throw TypeError("Positive integer value expected in function combinations");if(r.gt(e))throw TypeError("k must be less than n in function combinations");if(t=o,r.lt(a))for(n=o;n.lte(a);n=n.plus(o))t=t.times(r.plus(n)).dividedBy(n);else for(n=o;n.lte(r);n=n.plus(o))t=t.times(a.plus(n)).dividedBy(n);return t}})});function uJ(e){return e.isInteger()&&e.gte(0)}var uY=ef("complex",["typed","Complex"],e=>{var{typed:r,Complex:t}=e;return r("complex",{"":function(){return t.ZERO},number:function(e){return new t(e,0)},"number, number":function(e,r){return new t(e,r)},"BigNumber, BigNumber":function(e,r){return new t(e.toNumber(),r.toNumber())},Fraction:function(e){return new t(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return t(e)},null:function(e){return t(0)},Object:function(e){if("re"in e&&"im"in e)return new t(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new t(e);throw Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),uX="conj",uQ=ef(uX,["typed"],e=>{var{typed:r}=e;return r(uX,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),Unit:r.referToSelf(e=>r=>
1new r.constructor(e(r.toNumeric()),r.formatUnits())),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),uK=ef("trigUnit",["typed"],e=>{var{typed:r}=e;return{Unit:r.referToSelf(e=>t=>{if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw TypeError("Unit in function cot is no angle");return r.find(e,t.valueType())(t.value)})}}),u0=ef("cos",["typed"],e=>{var{typed:r}=e,t=uK({typed:r});return r("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},t)}),u1=ef("cot",["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e,n=uK({typed:r});return r("cot",{number:uy,Complex:e=>e.cot(),BigNumber:e=>new t(1).div(e.tan())},n)}),u2=ef("csc",["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e,n=uK({typed:r});return r("csc",{number:ub,Complex:e=>e.csc(),BigNumber:e=>new t(1).div(e.sin())},n)}),u3="cube",u5=ef(u3,["typed"],e=>{var{typed:r}=e;return r(u3,{number:s5,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},bigint:function(e){return e*e*e},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})});function u4(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(t<=0)throw Error("Relative tolerance must be greater than 0");if(n<0)throw Error("Absolute tolerance must be at least 0");return!(e.isNaN()||r.isNaN())&&(e.isFinite()&&r.isFinite()?!!e.eq(r)||e.minus(r).abs().lte(e.constructor.max(e.constructor.max(e.abs(),r.abs()).mul(t),n)):e.eq(r))}var u8=ef("compareUnits",["typed"],e=>{var{typed:r}=e;return{"Unit, Unit":r.referToSelf(e=>(t,n)=>{if(!t.equalBase(n))throw Error("Cannot compare units with different base");return r.find(e,[t.valueType(),n.valueType()])(t.value,n.value)})}}),u6="equalScalar",u7=ef(u6,["typed","config"],e=>{var{typed:r,config:t}=e,n=u8({typed:r});return r(u6,{"boolean, boolean":function(e,r){return e===r},"number, number":function(e,r){return eO(e,r,t.relTol,t.absTol)},"BigNumber, BigNumber":function(e,r){return e.eq(r)||u4(e,r,t.relTol,t.absTol)},"bigint, bigint":function(e,r){return e===r},"Fraction, Fraction":function(e,r){return e.equals(r)},"Complex, Complex":function(e,r){var n,i;return n=t.relTol,i=t.absTol,eO(e.re,r.re,n,i)&&eO(e.im,r.im,n,i)}},n)});ef(u6,["typed","config"],e=>{var{typed:r,config:t}=e;return r(u6,{"number, number":function(e,r){return eO(e,r,t.relTol,t.absTol)}})});var u9=ef("erf",["typed"],e=>{var{typed:r}=e;return r("name",{number:function(e){var r=Math.abs(e);return r>=li?ey(e):r<=le?ey(e)*function(e){var r,t=e*e,n=lt[0][4]*t,i=t;for(r=0;r<3;r+=1)n=(n+lt[0][r])*t,i=(i+ln[0][r])*t;return e*(n+lt[0][3])/(i+ln[0][3])}(r):r<=4?ey(e)*(1-function(e){var r,t=lt[1][8]*e,n=e;for(r=0;r<7;r+=1)t=(t+lt[1][r])*e,n=(n+ln[1][r])*e;var i=(t+lt[1][7])/(n+ln[1][7]),a=parseInt(16*e)/16;return Math.exp(-a*a)*Math.exp(-((e-a)*(e+a)))*i}(r)):ey(e)*(1-function(e){var r,t=1/(e*e),n=lt[2][5]*t,i=t;
1for(r=0;r<4;r+=1)n=(n+lt[2][r])*t,i=(i+ln[2][r])*t;var a=t*(n+lt[2][4])/(i+ln[2][4]);a=(lr-a)/e,t=parseInt(16*e)/16;var o=(e-t)*(e+t);return Math.exp(-t*t)*Math.exp(-o)*a}(r))},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),le=.46875,lr=.5641895835477563,lt=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,6587491615298378e-19,.016315387137302097]],ln=[[23.601290952344122,244.02463793444417,1282.6165260773723,2844.236833439171],[15.744926110709835,117.6939508913125,537.1811018620099,1621.3895745666903,3290.7992357334597,4362.619090143247,3439.3676741437216,1230.3393548037495],[2.568520192289822,1.8729528499234604,.5279051029514285,.06051834131244132,.0023352049762686918]],li=0x20000000000000,la=ef("exp",["typed"],e=>{var{typed:r}=e;return r("exp",{number:s4,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})}),lo="expm1",ls=ef(lo,["typed","Complex"],e=>{var{typed:r,Complex:t}=e;return r(lo,{number:s8,Complex:function(e){var r=Math.exp(e.re);return new t(r*Math.cos(e.im)-1,r*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})}),lu="flatten",ll=ef(lu,["typed"],e=>{var{typed:r}=e;return r(lu,{Array:function(e){return re(e)},Matrix:function(e){return e.create(re(e.valueOf(),!0),e.datatype())}})}),lc="format",lf=ef(lc,["typed"],e=>{var{typed:r}=e;return r(lc,{any:eH,"any, Object | function | number | BigNumber":eH})}),lm="getMatrixDataType",lp=ef(lm,["typed"],e=>{var{typed:r}=e;return r(lm,{Array:function(e){return ru(e,el)},Matrix:function(e){return e.getDataType()}})}),lh=ef("hex",["typed","format"],e=>{var{typed:r,format:t}=e;return r("hex",{"number | BigNumber":function(e){return t(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,r){return t(e,{notation:"hex",wordSize:r})}})}),ld=ef("im",["typed"],e=>{var{typed:r}=e;return r("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),lg="isInteger",lv=ef(lg,["typed"],e=>{var{typed:r}=e;return r(lg,{number:eg,BigNumber:function(e){return e.isInt()},bigint:function(e){return!0},Fraction:function(e){return 1n===e.d},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),ly="number";function lx(e){return Number.isNaN(e)}lx.signature=ly;var lb="isNegative",lw=ef(lb,["typed","config"],e=>{var{typed:r,config:t}=e;return r(lb,{number:e=>!eO(e,0,t.relTol,t.absTol)&&e<0,BigNumber:e=>!u4(e,new e.constructor(0),t.relTol,t.absTol)&&e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0n,Unit:r.referToSelf(e=>t=>r.find(e,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),lD="isPositive",lN=ef(lD,["typed","config"],e=>{var{typed:r,config:t}=e;return r(lD,{number:e=>!eO(e,0,t.relTol,t.absTol)&&e>0,BigNumber:e=>!u4(e,new e.constructor(0),t.relTol,t.absTol)&&!e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e>0n,Fraction:e=>e.s>0n&&e.n>0n,Unit:r.referToSelf(e=>t=>r.find(e,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),lE="isZero",lA=ef(lE,["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return r(lE,{"number | BigNumber | Complex | Fraction":e=>t(e,0),bigint:e=>0n===e,Unit:r.referToSelf(e=>t=>r.find(e,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})});function lC(e){if(eg(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:uG(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*lC(1-e));if(e>=171.35)return 1/0;if(e>85){var r,t=e*e,n=t*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*n)-571/(2488320*i)+163879/(0xc756000*a)+5246819/(0x11850f0000*a*e))}--e,r=lM[0];for(var o=1;o<lM.length;++o)r+=lM[o]/(e+o);var s=e+lS+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,e+.5)*Math.exp(-s)*r}lC.signature="number";var lS=4.7421875,lM=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,339946499848
11189e-20,4652362892704858e-20,-9837447530487956e-20,1580887032249125e-19,-21026444172410488e-20,21743961811521265e-20,-1643181065367639e-19,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],lF=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function lT(e){if(e<0)return NaN;if(0===e)return 1/0;if(!isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-lT(1-e);for(var r=(e-=1)+5+.5,t=lF[0],n=6;n>=1;n--)t+=lF[n]/(e+n);return .9189385332046728+(e+.5)*Math.log(r)-r+Math.log(t)}lT.signature="number";var lB="lgamma",lO=ef(lB,["Complex","typed"],e=>{var{Complex:r,typed:t}=e,n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,8417508417508417e-19,-5952380952380953e-19,7936507936507937e-19,-.002777777777777778,.08333333333333333];return t(lB,{number:lT,Complex:function e(t){if(t.isNaN())return new r(NaN,NaN);if(0===t.im)return new r(lT(t.re),0);if(t.re>=7||Math.abs(t.im)>=7)return i(t);if(t.re<=.1){var n,o=(!0^((n=t.im)>0||!(n<0)&&1/n==1/0)?-6.283185307179586:6.283185307179586)*Math.floor(.5*t.re+.25),s=t.mul(Math.PI).sin().log(),u=e(new r(1-t.re,-t.im));return new r(1.1447298858494002,o).sub(s).sub(u)}if(t.im>=0)return a(t);else return a(t.conjugate()).conjugate()},BigNumber:function(){throw Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){for(var t=e.sub(.5).mul(e.log()).sub(e).add(.9189385332046728),i=new r(1,0).div(e),a=i.div(e),o=n[0],s=n[1],u=2*a.re,l=a.re*a.re+a.im*a.im,c=2;c<8;c++){var f=s;s=-l*o+n[c],o=u*o+f}var m=i.mul(a.mul(o).add(s));return t.add(m)}function a(e){var t=0,n=0,a=e;for(e=e.add(1);e.re<=7;){var o=+((a=a.mul(e)).im<0);0!==o&&0===n&&t++,n=o,e=e.add(1)}return i(e).sub(a.log()).sub(new r(0,2*t*Math.PI*1))}});function l_(e,r,t,n){return function(i){if(i>0||t.predictable){if(i<=0)return NaN;var a=i.toString(16),o=a.substring(0,15);return e*(a.length-o.length)+r(Number("0x"+o))}return n(i.toNumber())}}var lz="log10",lk=s9(16),lI=ef(lz,["typed","config","Complex"],e=>{var{typed:r,config:t,Complex:n}=e;function i(e){return e.log().div(Math.LN10)}function a(e){return i(new n(e,0))}return r(lz,{number:function(e){return e>=0||t.predictable?s9(e):a(e)},bigint:l_(lk,s9,t,a),Complex:i,BigNumber:function(e){return!e.isNegative()||t.predictable?e.log():a(e.toNumber())},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),lR="log2",lq=ef(lR,["typed","config","Complex"],e=>{var{typed:r,config:t,Complex:n}=e;function i(e){return a(new n(e,0))}return r(lR,{number:function(e){return e>=0||t.predictable?ue(e):i(e)},bigint:l_(4,ue,t,i),Complex:a,BigNumber:function(e){return!e.isNegative()||t.predictable?e.log(2):i(e.toNumber())},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))});function a(e){var r=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(r):Math.log(r)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}}),lP=ef("multiplyScalar",["typed"],e=>{var{typed:r}=e;return r("multiplyScalar",{"number, number":s0,"Complex, Complex":function(e,r){return e.mul(r)},"BigNumber, BigNumber":function(e,r){return e.times(r)},"bigint, bigint":function(e,r){return e*r},"Fraction, Fraction":function(e,r){return e.mul(r)},"number | Fraction | BigNumber | Complex, Unit":(e,r)=>r.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,r)=>e.multiply(r)})}),lj=ef("not",["typed"],e=>{var{typed:r}=e;return r("not",{"null | undefined":()=>!0,number:no,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:r.referToSelf(e=>t=>r.find(e,t.valueType())(t.value)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),lU=ef("number",["typed"],e=>{var{typed:r}=e,t=r("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var r=function(e){var r=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(!r)return null;var t={"0b":2,"0o":8,"0x":16}[r[1]];return{input:e,radix:t,integerPart:r[2],fractionalPart:r[3]}}(e);if(r){for(var t=parseInt(r.integerPart,r.radix),n=0,i=0;i<r.fractionalPart.length;i++)n+=parseInt(r.fractionalPart[i],r.radix)/Math.pow(r.radix,i+1);var a=t+n;if(isNaN(a))throw SyntaxError('String "'+r.input+'" is not a valid number');return a}var o=0,s=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);s&&(o=Number(s[2]),e=s[1]);var u=Number(e);if(isNaN(u))throw SyntaxError('String "'+e+'" is not a valid number');if(s){if(u>2**o-1)throw SyntaxError('String "'.concat(e,'" is out of range'));u>=2**(o-1)&&(u-=2**o)}return u},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:r.referToSelf(e=>r=>{var t=r.clone();return t.value=e(r.value),t}),null:function(e){return 0},"Unit, string | Unit":function(e,r){return e.toNumber(r)},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))});return t.fromJSON=function(e){return parseFloat(e.value)},t}),lL=ef("oct",["typed","format"],e=>{var{typed:r,format:t}=e;return r("oct",{"number | BigNumber":function(e){return t(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,r){return t(e,{notation:"oct",wordSize:r})}})}),l$=t(68173),lH=l$(Date.now());function lG(e){var r;return r=null===e?lH:l$(String(e)),function(){return r()}}var lZ="pickRandom",lV=ef(lZ,["typed","config","?on"],e=>{var{typed:r,config:t,on:n}=e,i=lG(t.randomSeed);return n&&n("config",function(e,r){e.randomSeed!==r.randomSeed&&(i=lG(e.randomSeed))}),r(lZ,{"Array | Matrix":function(e){return a(e,{})},"Array | Matrix, Object":function(e,r){return a(e,r)},"Array | Matrix, number":function(e,r){return a(e,{number:r})},"Array | Matrix, Array | Matrix":function(e,r){return a(e,{weights:r})},"Array | Matrix, Array | Matrix, number":function(e,r,t){return a(e,{number:t,weights:r})},"Array | Matrix, number, Array | Matrix":function(e,r,t){return a(e,{number:r,weights:t})}});function a(e,r){var t,{number:n,weights:a,elementWise:o=!0}=r,s=void 0===n;s&&(n=1);var u=F(e)?e.create:F(a)?a.create:null;e=e.valueOf(),a&&(a=a.valueOf()),!0===o&&(e=re(e),a=re(a));var l=0;if(void 0!==a){if(a.length!==e.length)throw Error("Weights must have the same length as possibles");for(var c=0,f=a.length;c<f;c++){if(!w(a[c])||a[c]<0)throw Error("Weights must be an array of positive numbers");l+=a[c]}}for(var m=e.length,p=[];p.length<n;){if(void 0===a)t=e[Math.floor(i()*m)];else for(var h=i()*l,d=0,g=e.length;d<g;d++)if((h-=a[d])<0){t=e[d];break}p.push(t)}return s?p[0]:u?u(p):p}});function lW(e,r){var t=[];
1if((e=e.slice(0)).length>1)for(var n=0,i=e.shift();n<i;n++)t.push(lW(e,r));else for(var a=0,o=e.shift();a<o;a++)t.push(r());return t}var lJ="random",lY=ef(lJ,["typed","config","?on"],e=>{var{typed:r,config:t,on:n}=e,i=lG(t.randomSeed);return n&&n("config",function(e,r){e.randomSeed!==r.randomSeed&&(i=lG(e.randomSeed))}),r(lJ,{"":()=>(function(e,r){return 0+i()*(1-e)})(0,1),number:e=>(function(e,r){return 0+i()*(r-e)})(0,e),"number, number":(e,r)=>(function(e,r){return e+i()*(r-e)})(e,r),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,r)=>a(e,0,r),"Array | Matrix, number, number":(e,r,t)=>a(e,r,t)});function a(e,r,t){var n=lW(e.valueOf(),()=>{var e,n;return e=r,n=t,e+i()*(n-e)});return F(e)?e.create(n,"number"):n}}),lX=ef("re",["typed"],e=>{var{typed:r}=e;return r("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),lQ=ef("sec",["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e,n=uK({typed:r});return r("sec",{number:uD,Complex:e=>e.sec(),BigNumber:e=>new t(1).div(e.cos())},n)}),lK="sign",l0=ef(lK,["typed","BigNumber","Fraction","complex"],e=>{var{typed:r,BigNumber:t,complex:n,Fraction:i}=e;return r(lK,{number:ut,Complex:function(e){return 0===e.im?n(ut(e.re)):e.sign()},BigNumber:function(e){return new t(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return new i(0n===e.n?0:e.s)},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0)),Unit:r.referToSelf(e=>t=>{if(!t._isDerived()&&0!==t.units[0].unit.offset)throw TypeError("sign is ambiguous for units with offset");return r.find(e,t.valueType())(t.value)})})}),l1=ef("sin",["typed"],e=>{var{typed:r}=e,t=uK({typed:r});return r("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},t)}),l2=ef("SparseMatrix",["typed","equalScalar","Matrix"],e=>{var{typed:r,equalScalar:t,Matrix:n}=e;function i(e,r){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(r&&!S(r))throw Error("Invalid datatype: "+r);if(F(e)){var t,n,s;t=this,n=e,s=r,"SparseMatrix"===n.type?(t._values=n._values?o(n._values):void 0,t._index=o(n._index),t._ptr=o(n._ptr),t._size=o(n._size),t._datatype=s||n._datatype):a(t,n.valueOf(),s||n._datatype)}else if(e&&M(e.index)&&M(e.ptr)&&M(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=r||e.datatype;else if(M(e))a(this,e,r);else if(e)throw TypeError("Unsupported type of data ("+el(e)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=r}function a(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,o=0,s=t,u=0;if(S(i)&&(s=r.find(t,[i,i])||t,u=r.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var c=0;c<a;c++){var f=n[c];if(M(f)){if(0===l&&o<f.length&&(o=f.length),l<f.length){var m=f[l];s(m,u)||(e._values.push(m),e._index.push(c))}}else 0===l&&o<1&&(o=1),s(f,u)||(e._values.push(f),e._index.push(c))}l++}while(l<o)}e._ptr.push(e._index.length),e._size=[a,o]}function s(e,r,t,n){if(t-r==0)return t;for(var i=r;i<t;i++)if(n[i]===e)return i;return r}function l(e,r,t,n,i,a,o){i.splice(e,0,n),a.splice(e,0,r);for(var s=t+1;s<o.length;s++)o[s]++}function c(e,n,i,a){var o,s,u,l=a||0,c=t,f=0;S(e._datatype)&&(c=r.find(t,[e._datatype,e._datatype])||t,f=r.convert(0,e._datatype),l=r.convert(l,e._datatype));var m=!c(l,f),p=e._size[0],h=e._size[1];if(i>h){for(s=h;s<i;s++)if(e._ptr[s]=e._values.length,m)for(o=0;o<p;o++)e._values.push(l),e._index.push(o);e._ptr[i]=e._values.length}
1else i<h&&(e._ptr.splice(i+1,h-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(h=i,n>p){if(m){var d=0;for(s=0;s<h;s++){e._ptr[s]=e._ptr[s]+d,u=e._ptr[s+1]+d;var g=0;for(o=p;o<n;o++,g++)e._values.splice(u+g,0,l),e._index.splice(u+g,0,o),d++}e._ptr[h]=e._values.length}}else if(n<p){var v=0;for(s=0;s<h;s++){e._ptr[s]=e._ptr[s]-v;var y=e._ptr[s],x=e._ptr[s+1]-v;for(u=y;u<x;u++)(o=e._index[u])>n-1&&(e._values.splice(u,1),e._index.splice(u,1),v++)}e._ptr[s]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function f(e,r,t,n,i){var a,s,u=n[0],l=n[1],c=[];for(a=0;a<u;a++)for(s=0,c[a]=[];s<l;s++)c[a][s]=0;for(s=0;s<l;s++)for(var f=t[s],m=t[s+1],p=f;p<m;p++)c[a=r[p]][s]=e?i?o(e[p]):e[p]:1;return c}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,r){return new i(e,r)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return ru(this._values,el)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,r){return new i(e,r)},i.prototype.density=function(){var e=this._size[0],r=this._size[1];return 0!==e&&0!==r?this._index.length/(e*r):0},i.prototype.subset=function(e,r,t){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,r){if(!z(r))throw TypeError("Invalid index");if(r.isScalar())return e.get(r.min());var t,n,a,o,s=r.size();if(s.length!==e._size.length)throw new eX(s.length,e._size.length);var u=r.min(),l=r.max();for(t=0,n=e._size.length;t<n;t++)e2(u[t],e._size[t]),e2(l[t],e._size[t]);var c=e._values,f=e._index,m=e._ptr,p=r.dimension(0),h=r.dimension(1),d=[],g=[];p.forEach(function(e,r){g[e]=r[0],d[e]=!0});var v=c?[]:void 0,y=[],x=[];return h.forEach(function(e){for(x.push(y.length),a=m[e],o=m[e+1];a<o;a++)!0===d[t=f[a]]&&(y.push(g[t]),v&&v.push(c[a]))}),x.push(y.length),new i({values:v,index:y,ptr:x,size:s,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,r,t,n){if(!r||!0!==r.isIndex)throw TypeError("Invalid index");var i,a=r.size(),o=r.isScalar();if(F(t)?(i=t.size(),t=t.toArray()):i=eK(t),o){if(0!==i.length)throw TypeError("Scalar expected");e.set(r.min(),t,n)}else{if(1!==a.length&&2!==a.length)throw new eX(a.length,e._size.length,"<");if(i.length<a.length){for(var s=0,l=0;1===a[s]&&1===i[s];)s++;for(;1===a[s];)l++,s++;t=e9(t,a.length,l,i)}if(!u(a,i))throw new eX(a,i,">");if(1===a.length)r.dimension(0).forEach(function(r,i){e2(r),e.set([r,0],t[i[0]],n)});else{var c=r.dimension(0),f=r.dimension(1);c.forEach(function(r,i){e2(r),f.forEach(function(a,o){e2(a),e.set([r,a],t[i[0]][o[0]],n)})})}}return e}(this,e,r,t);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!M(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new eX(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var r=e[0],t=e[1];e2(r,this._size[0]),e2(t,this._size[1]);var n=s(r,this._ptr[t],this._ptr[t+1],this._index);return n<this._ptr[t+1]&&this._index[n]===r?this._values[n]:0},i.prototype.set=function(e,n,i){if(!M(e))throw TypeError("Array expected");if(e.length!==this._size.length)throw new eX(e.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var a=e[0],o=e[1],u=this._size[0],f=this._size[1],m=t,p=0;S(this._datatype)&&(m=r.find(t,[this._datatype,this._datatype])||t,p=r.convert(0,this._datatype)),(a>u-1||o>f-1)&&(c(this,Math.max(a+1,u),Math.max(o+1,f),i),u=this._size[0],f=this._size[1]),e2(a,u),e2(o,f);var h=s(a,this._ptr[o],this._ptr[o+1],this._index);return h<this._ptr[o+1]&&this._index[h]===a?m(n,p)?function(e,r,t,n,i){t.splice(e,1),n.splice(e,1);for(var a=r+1;a<i.length;a++)i[a]--}(h,o,this._values,this._index,this._ptr):this._values[h]=n:m(n,p)||l(h,a,o,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,r,t){if(!T(e))throw TypeError("Array or Matrix expected");var n=e.valueOf().map(e=>Array.isArray(e)&&1===e.length?e[0]:e);if(2!==n.length)throw Error("Only two dimensions matrix are supported");
1return n.forEach(function(e){if(!w(e)||!eg(e)||e<0)throw TypeError("Invalid size, must contain positive integers (size: "+eH(n)+")")}),c(t?this.clone():this,n[0],n[1],r)},i.prototype.reshape=function(e,r){if(!M(e))throw TypeError("Array expected");if(2!==e.length)throw Error("Sparse matrices can only be reshaped in two dimensions");e.forEach(function(r){if(!w(r)||!eg(r)||r<=-2||0===r)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+eH(e)+")")});var t=this._size[0]*this._size[1],n=(e=e8(e,t))[0]*e[1];if(t!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=r?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return i;for(var a=[],o=0;o<i._ptr.length;o++)for(var u=0;u<i._ptr[o+1]-i._ptr[o];u++)a.push(o);for(var c=i._values.slice(),f=i._index.slice(),m=0;m<i._index.length;m++){var p=f[m],h=a[m],d=p*i._size[1]+h;a[m]=d%e[1],f[m]=Math.floor(d/e[1])}i._values.length=0,i._index.length=0,i._ptr.length=e[1]+1,i._size=e.slice();for(var g=0;g<i._ptr.length;g++)i._ptr[g]=0;for(var v=0;v<c.length;v++){var y=f[v],x=a[v],b=c[v];l(s(y,i._ptr[x],i._ptr[x+1],i._index),y,x,b,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?o(this._values):void 0,index:o(this._index),ptr:o(this._ptr),size:o(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var a=this,o=this._size[0],s=this._size[1],u=tV(e,a,"map");return function(e,n,a,o,s,u,l){var c=[],f=[],m=[],p=t,h=0;S(e._datatype)&&(p=r.find(t,[e._datatype,e._datatype])||t,h=r.convert(0,e._datatype));for(var d=function(e,r,t){var n=u(e,r,t);p(n,h)||(c.push(n),f.push(r))},g=0;g<=s;g++){m.push(c.length);var v=e._ptr[g],y=e._ptr[g+1];if(l)for(var x=v;x<y;x++){var b=e._index[x];b>=0&&b<=a&&d(e._values[x],b-n,g-o)}else{for(var w={},D=v;D<y;D++)w[e._index[D]]=e._values[D];for(var N=n;N<=a;N++)d(N in w?w[N]:0,N-n,g-o)}}return m.push(c.length),new i({values:c,index:f,ptr:m,size:[a-n+1,s-o+1]})}(this,0,o-1,0,s-1,function(e,r,t){return u.fn(e,[r,t],a)},n)},i.prototype.forEach=function(e,r){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var t=this._size[0],n=this._size[1],i=tV(e,this,"forEach"),a=0;a<n;a++){var o=this._ptr[a],s=this._ptr[a+1];if(r)for(var u=o;u<s;u++){var l=this._index[u];i.fn(this._values[u],[l,a],this)}else{for(var c={},f=o;f<s;f++)c[this._index[f]]=this._values[f];for(var m=0;m<t;m++){var p=m in c?c[m]:0;i.fn(p,[m,a],this)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],r=0;r<e;r++)for(var t=this._ptr[r],n=this._ptr[r+1],i=t;i<n;i++){var a=this._index[i];yield{value:this._values[i],index:[a,r]}}},i.prototype.toArray=function(){return f(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return f(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var r=this._size[0],t=this._size[1],n=this.density(),i="Sparse Matrix ["+eH(r,e)+" x "+eH(t,e)+"] density: "+eH(n,e)+"\n",a=0;a<t;a++)for(var o=this._ptr[a],s=this._ptr[a+1],u=o;u<s;u++)i+="\n ("+eH(this._index[u],e)+", "+eH(a,e)+") ==> "+(this._values?eH(this._values[u],e):"X");return i},i.prototype.toString=function(){return eH(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(D(e)&&(e=e.toNumber()),!w(e)||!eg(e))throw TypeError("The parameter k must be an integer number")}else e=0;var r=e>0?e:0,t=e<0?-e:0,n=this._size[0],a=this._size[1],o=Math.min(n-t,a-r),s=[],u=[],l=[];l[0]=0;for(var c=r;c<a&&s.length<o;c++)for(var f=this._ptr[c],m=this._ptr[c+1],p=f;p<m;p++){var h=this._index[p];if(h===c-r+t){s.push(this._values[p]),u[s.length-1]=h-t;break}}return l.push(s.length),new i({values:s,index:u,ptr:l,size:[o,1]})},i.fromJSON=function(e){return new i(e)}
1,i.diagonal=function(e,n,a,o,s){if(!M(e))throw TypeError("Array expected, size parameter");if(2!==e.length)throw Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(D(e)&&(e=e.toNumber()),!w(e)||!eg(e)||e<1)throw Error("Size values must be positive integers");return e}),a){if(D(a)&&(a=a.toNumber()),!w(a)||!eg(a))throw TypeError("The parameter k must be an integer number")}else a=0;var u,l=t,c=0;S(s)&&(l=r.find(t,[s,s])||t,c=r.convert(0,s));var f=a>0?a:0,m=a<0?-a:0,p=e[0],h=e[1],d=Math.min(p-m,h-f);if(M(n)){if(n.length!==d)throw Error("Invalid value array length");u=function(e){return n[e]}}else if(F(n)){var g=n.size();if(1!==g.length||g[0]!==d)throw Error("Invalid matrix length");u=function(e){return n.get([e])}}else u=function(){return n};for(var v=[],y=[],x=[],b=0;b<h;b++){x.push(v.length);var N=b-f;if(N>=0&&N<d){var E=u(N);l(E,c)||(y.push(N+m),v.push(E))}}return x.push(v.length),new i({values:v,index:y,ptr:x,size:[p,h]})},i.prototype.swapRows=function(e,r){if(!w(e)||!eg(e)||!w(r)||!eg(r))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return e2(e,this._size[0]),e2(r,this._size[0]),i._swapRows(e,r,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,r,t,n,i){for(var a=n[e],o=n[e+1],s=a;s<o;s++)i(t[s],r[s])},i._swapRows=function(e,r,t,n,i,a){for(var o=0;o<t;o++){var u=a[o],l=a[o+1],c=s(e,u,l,i),f=s(r,u,l,i);if(c<l&&f<l&&i[c]===e&&i[f]===r){if(n){var m=n[c];n[c]=n[f],n[f]=m}continue}if(c<l&&i[c]===e&&(f>=l||i[f]!==r)){var p=n?n[c]:void 0;i.splice(f,0,r),n&&n.splice(f,0,p),i.splice(f<=c?c+1:c,1),n&&n.splice(f<=c?c+1:c,1);continue}if(f<l&&i[f]===r&&(c>=l||i[c]!==e)){var h=n?n[f]:void 0;i.splice(c,0,e),n&&n.splice(c,0,h),i.splice(c<=f?f+1:f,1),n&&n.splice(c<=f?f+1:f,1)}}},i},{isClass:!0}),l3="splitUnit",l5=ef(l3,["typed"],e=>{var{typed:r}=e;return r(l3,{"Unit, Array":function(e,r){return e.splitUnit(r)}})}),l4="square",l8=ef(l4,["typed"],e=>{var{typed:r}=e;return r(l4,{number:un,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},bigint:function(e){return e*e},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})}),l6="string",l7=ef(l6,["typed"],e=>{var{typed:r}=e;return r(l6,{"":function(){return""},number:eA,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e)),any:function(e){return String(e)}})}),l9="subtractScalar",ce=ef(l9,["typed"],e=>{var{typed:r}=e;return r(l9,{"number, number":sK,"Complex, Complex":function(e,r){return e.sub(r)},"BigNumber, BigNumber":function(e,r){return e.minus(r)},"bigint, bigint":function(e,r){return e-r},"Fraction, Fraction":function(e,r){return e.sub(r)},"Unit, Unit":r.referToSelf(e=>(t,n)=>{if(null===t.value||void 0===t.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw Error("Units do not match");var i=t.clone();return i.value=r.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),cr=ef("tan",["typed"],e=>{var{typed:r}=e,t=uK({typed:r});return r("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},t)}),ct="toBest",cn=ef(ct,["typed"],e=>{var{typed:r}=e;return r(ct,{Unit:e=>e.toBest(),"Unit, string":(e,r)=>e.toBest(r.split(",")),"Unit, string, Object":(e,r,t)=>e.toBest(r.split(","),t),"Unit, Array":(e,r)=>e.toBest(r),"Unit, Array, Object":(e,r,t)=>e.toBest(r,t)})}),ci="typeOf",ca=ef(ci,["typed"],e=>{var{typed:r}=e;return r(ci,{any:el})}),co="acosh",cs=ef(co,["typed","config","Complex"],e=>{var{typed:r,config:t,Complex:n}=e;return r(co,{number:function(e){return e>=1||t.predictable?e_(e):e<=-1?new n(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new n(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})}),cu="acsch",cl=ef(cu,["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e;return r(cu,{number:uh,Complex:function(e){return e.acsch()},BigNumber:function(e){return new t(1).div(e).asinh()}})}),cc="asec",cf=ef(cc,["typed","config","Complex","BigNumber"],e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(cc,{number:function(e){return e<=-1||e>=1||t.predictable?ud(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})}),cm=ef("bignumber",["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e;return r("bignumber",{"":function(){return new t(0)},number:function(e){return new t(e+"")},string:function(e){var r=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(r){var n=r[2],i=t(r[1]),a=new t(2).pow(Number(n));if(i.gt(a.sub(1)))throw SyntaxError('String "'.concat(e,'" is out of range'));var o=new t(2).pow(Number(n)-1);return i.gte(o)?i.sub(a):i}return new t(e)},BigNumber:function(e){return e},bigint:function(e){return new t(e.toString())},Unit:r.referToSelf(e=>r=>{var t=r.clone();return t.value=e(r.value),t}),Fraction:function(e){return new t(String(e.n)).div(String(e.d)).times(String(e.s))},null:function(e){return new t(0)},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),cp="combinationsWithRep",ch=ef(cp,["typed"],e=>{var{typed:r}=e;return r(cp,{"number, number":function(e,r){if(!eg(e)||e<0||!eg(r)||r<0)throw TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw TypeError("k must be less than or equal to n + k - 1");return r<e-1?uG(e,e+r-1)/uG(1,r):uG(r+1,e+r-1)/uG(1,e-1)},"BigNumber, BigNumber":function(e,r){var t,n,i=new e.constructor(1),a=e.minus(i);if(!cd(e)||!cd(r))throw TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(t=i,r.lt(a))for(n=i;n.lte(a);n=n.plus(i))t=t.times(r.plus(n)).dividedBy(n);else for(n=i;n.lte(r);n=n.plus(i))t=t.times(a.plus(n)).dividedBy(n);return t}})});function cd(e){return e.isInteger()&&e.gte(0)}var cg="cosh",cv=ef(cg,["typed"],e=>{var{typed:r}=e;return r(cg,{number:eI,"Complex | BigNumber":e=>e.cosh()})}),cy="csch",cx=ef(cy,["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e;return r(cy,{number:uw,Complex:e=>e.csch(),BigNumber:e=>new t(1).div(e.sinh())})}),cb="isNaN",cw=ef(cb,["typed"],e=>{var{typed:r}=e;return r(cb,{number:lx,BigNumber:function(e){return e.isNaN()},bigint:function(e){return!1},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),cD="isPrime",cN=ef(cD,["typed"],e=>{var{typed:r}=e;return r(cD,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(var r=5;r*r<=e;r+=6)if(e%r==0||e%(r+2)==0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;
1if(e%2n===0n||e%3n===0n)return!1;for(var r=5n;r*r<=e;r+=6n)if(e%r===0n||e%(r+2n)===0n)return!1;return!0},BigNumber:function(e){if(e.lte(3))return e.gt(1);if(e.mod(2).eq(0)||e.mod(3).eq(0))return!1;if(e.lt(0x100000000)){for(var r=e.toNumber(),t=5;t*t<=r;t+=6)if(r%t==0||r%(t+2)==0)return!1;return!0}e=new(e.constructor.clone({precision:2*e.toFixed(0).length}))(e);for(var n=0,i=e.sub(1);i.mod(2).eq(0);)i=i.div(2),n+=1;var a=null;if(e.lt("3317044064679887385961981"))a=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(r=>r<e);else{var o=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));a=[];for(var s=2;s<=o;s+=1)a.push(o)}for(var u=0;u<a.length;u+=1){var l=a[u],c=function(e,r,t){for(var n=1;!r.eq(0);)r.mod(2).eq(0)?(r=r.div(2),e=e.mul(e).mod(t)):(r=r.sub(1),n=e.mul(n).mod(t));return n}(e.sub(e).add(l),i,e);if(!c.eq(1)){for(var f=0,m=c;!m.eq(e.sub(1));f+=1,m=m.mul(m).mod(e))if(f===n-1)return!1}}return!0},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),cE="matrix",cA=ef(cE,["typed","Matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:r,Matrix:t,DenseMatrix:n,SparseMatrix:i}=e;return r(cE,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,r){return a([],e,r)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,r,t){if("dense"===r||"default"===r||void 0===r)return new n(e,t);if("sparse"===r)return new i(e,t);throw TypeError("Unknown matrix type "+JSON.stringify(r)+".")}}),cC="matrixFromFunction",cS=ef(cC,["typed","matrix","isZero"],e=>{var{typed:r,matrix:t,isZero:n}=e;return r(cC,{"Array | Matrix, function, string, string":function(e,r,t,n){return i(e,r,t,n)},"Array | Matrix, function, string":function(e,r,t){return i(e,r,t)},"Matrix, function":function(e,r){return i(e,r,"dense")},"Array, function":function(e,r){return i(e,r,"dense").toArray()},"Array | Matrix, string, function":function(e,r,t){return i(e,t,r)},"Array | Matrix, string, string, function":function(e,r,t,n){return i(e,n,r,t)}});function i(e,r,i,a){var o;return(o=void 0!==a?t(i,a):t(i)).resize(e),o.forEach(function(e,t){var i=r(t);n(i)||o.set(t,i)}),o}}),cM=ef("ones",["typed","config","matrix","BigNumber"],e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r("ones",{"":function(){return"Array"===t.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var r=e.pop();return a(e,r)}return"Array"===t.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var r=e.storage();return a(e.valueOf(),r)},"Array | Matrix, string":function(e,r){return a(e.valueOf(),r)}});function a(e,r){var t,a=(t=!1,e.forEach(function(e,r,n){D(e)&&(t=!0,n[r]=e.toNumber())}),t)?new i(1):1;if(e.forEach(function(e){if("number"!=typeof e||!eg(e)||e<0)throw Error("Parameters in function ones must be positive integers")}),r){var o=n(r);return e.length>0?o.resize(e,a):o}var s=[];return e.length>0?e5(s,e,a):s}}),cF="randomInt",cT=ef(cF,["typed","config","log2","?on"],e=>{var{typed:r,config:t,log2:n,on:i}=e,a=lG(t.randomSeed);return i&&i("config",function(e,r){e.randomSeed!==r.randomSeed&&(a=lG(e.randomSeed))}),r(cF,{"":()=>s(0,2),number:e=>s(0,e),"number, number":(e,r)=>s(e,r),bigint:e=>u(0n,e),"bigint, bigint":u,"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,r)=>o(e,0,r),"Array | Matrix, number, number":(e,r,t)=>o(e,r,t)});function o(e,r,t){var n=lW(e.valueOf(),()=>s(r,t));return F(e)?e.create(n,"number"):n}function s(e,r){return Math.floor(e+a()*(r-e))}function u(e,r){var t=r-e;if(t<=2n**30n)return e+BigInt(s(0,Number(t)));for(var i=n(t),o=t;o>=t;){o=0n;for(var u=0;u<i;++u)o=2n*o+(.5>a()?0n:1n)}return e+o}}),cB="reshape",cO=ef(cB,["typed","isInteger","matrix"],e=>{var{typed:r,isInteger:t}=e;return r(cB,{"Matrix, Array":function(e,r){return e.reshape(r,!0)},"Array, Array":function(e,r){return r.forEach(function(e){if(!t(e))throw TypeError("Invalid size for dimension: "+e)}),e4(e,r)}})}),c_="sech",cz=ef(c_,["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e;return r(c_,{number:uN,Complex:e=>e.sech(),BigNumber:e=>new t(1).div(e.cosh())})}),ck="sinh",cI=ef(ck,["typed"],e=>{var{typed:r}=e;return r(ck,{number:uE,"Complex | BigNumber":e=>e.sinh()})}),cR="sparse",cq=ef(cR,["typed","SparseMatrix"],e=>{var{typed:r,SparseMatrix:t}=e;return r(cR,{"":function(){return new t([])}
1,string:function(e){return new t([],e)},"Array | Matrix":function(e){return new t(e)},"Array | Matrix, string":function(e,r){return new t(e,r)}})}),cP=ef("sqrt",["config","typed","Complex"],e=>{var{config:r,typed:t,Complex:n}=e;return t("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||r.predictable?Math.sqrt(e):new n(e,0).sqrt()}}),cj="squeeze",cU=ef(cj,["typed"],e=>{var{typed:r}=e;return r(cj,{Array:function(e){return e7(o(e))},Matrix:function(e){var r=e7(e.toArray());return Array.isArray(r)?e.create(r,e.datatype()):r},any:function(e){return o(e)}})}),cL=ef("tanh",["typed"],e=>{var{typed:r}=e;return r("tanh",{number:eq,"Complex | BigNumber":e=>e.tanh()})}),c$="transpose",cH=ef(c$,["typed","matrix"],e=>{var{typed:r,matrix:t}=e;return r(c$,{Array:e=>n(t(e)).valueOf(),Matrix:n,any:o});function n(e){var r,t=e.size();switch(t.length){case 1:r=e.clone();break;case 2:var n=t[0],i=t[1];if(0===i)throw RangeError("Cannot transpose a 2D matrix with no columns (size: "+eH(t)+")");switch(e.storage()){case"dense":r=function(e,r,t){for(var n,i=e._data,a=[],s=0;s<t;s++){n=a[s]=[];for(var u=0;u<r;u++)n[u]=o(i[u][s])}return e.createDenseMatrix({data:a,size:[t,r],datatype:e._datatype})}(e,n,i);break;case"sparse":r=function(e,r,t){for(var n,i,a,s=e._values,u=e._index,l=e._ptr,c=s?[]:void 0,f=[],m=[],p=[],h=0;h<r;h++)p[h]=0;for(n=0,i=u.length;n<i;n++)p[u[n]]++;for(var d=0,g=0;g<r;g++)m.push(d),d+=p[g],p[g]=m[g];for(m.push(d),a=0;a<t;a++)for(var v=l[a],y=l[a+1],x=v;x<y;x++){var b=p[u[x]]++;f[b]=a,s&&(c[b]=o(s[x]))}return e.createSparseMatrix({values:c,index:f,ptr:m,size:[t,r],datatype:e._datatype})}(e,n,i)}break;default:throw RangeError("Matrix must be a vector or two dimensional (size: "+eH(t)+")")}return r}}),cG="xgcd",cZ=ef(cG,["typed","config","matrix","BigNumber"],e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r(cG,{"number, number":function(e,r){var i=ui(e,r);return"Array"===t.matrix?i:n(i)},"BigNumber, BigNumber":function(e,r){var a,o,s,u,l=new i(0),c=new i(1),f=l,m=c,p=c,h=l;if(!e.isInt()||!r.isInt())throw Error("Parameters in function xgcd must be integer numbers");for(;!r.isZero();)o=e.div(r).floor(),s=e.mod(r),a=f,f=m.minus(o.times(f)),m=a,a=p,p=h.minus(o.times(p)),h=a,e=r,r=s;return u=e.lt(l)?[e.neg(),m.neg(),h.neg()]:[e,e.isZero()?0:m,h],"Array"===t.matrix?u:n(u)}})}),cV="zeros",cW=ef(cV,["typed","config","matrix","BigNumber"],e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r(cV,{"":function(){return"Array"===t.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var r=e.pop();return a(e,r)}return"Array"===t.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var r=e.storage();return a(e.valueOf(),r)},"Array | Matrix, string":function(e,r){return a(e.valueOf(),r)}});function a(e,r){var t,a=(t=!1,e.forEach(function(e,r,n){D(e)&&(t=!0,n[r]=e.toNumber())}),t)?new i(0):0;if(e.forEach(function(e){if("number"!=typeof e||!eg(e)||e<0)throw Error("Parameters in function zeros must be positive integers")}),r){var o=n(r);return e.length>0?o.resize(e,a):o}var s=[];return e.length>0?e5(s,e,a):s}}),cJ="acoth",cY=ef(cJ,["typed","config","Complex","BigNumber"],e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(cJ,{number:function(e){return e>=1||e<=-1||t.predictable?um(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})}),cX="asin",cQ=ef(cX,["typed","config","Complex"],e=>{var{typed:r,config:t,Complex:n}=e;return r(cX,{number:function(e){return e>=-1&&e<=1||t.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})}),cK=ef("bin",["typed","format"],e=>{var{typed:r,format:t}=e;return r("bin",{"number | BigNumber":function(e){return t(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,r){return t(e,{notation:"bin",wordSize:r})}})}),c0="coth",c1=ef(c0,["typed","BigNumber"],e=>{var{typed:r,BigNumber:t}=e;return r(c0,{number:ux,Complex:e=>e.coth(),BigNumber:e=>new t(1).div(e.tanh())})}),c2="ctranspose",c3=ef(c2,["typed","transpose","conj"],e=>{var{typed:r,transpose:t,conj:n}=e;return r(c2,{any:function(e){return n(t(e))}})}),c5="diag",c4=ef(c5,["typed","matrix","DenseMatrix","SparseMatrix"],e=>{var{typed:r,matrix:t,DenseMatrix:n,SparseMatrix:i}=e;return r(c5,{Array:function(e){return a(e,0,eK(e),null)},"Array, number":function(e,r){return a(e,r,eK(e),null)},"Array, BigNumber":function(e,r){return a(e,r.toNumber(),eK(e),null)},"Array, string":function(e,r){return a(e,0,eK(e),r)},"Array, number, string":function(e,r,t){return a(e,r,eK(e),t)},"Array, BigNumber, string":function(e,r,t){return a(e,r.toNumber(),eK(e),t)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,r){return a(e,r,e.size(),e.storage())},"Matrix, BigNumber":function(e,r){return a(e,r.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,r){return a(e,0,e.size(),r)},"Matrix, number, string":function(e,r,t){return a(e,r,e.size(),t)},"Matrix, BigNumber, string":function(e,r,t){return a(e,r.toNumber(),e.size(),t)}});function a(e,r,a,o){if(!eg(r))throw TypeError("Second parameter in function diag must be an integer");var s=r>0?r:0,u=r<0?-r:0;switch(a.length){case 1:var l=e,c=r,f=o,m=a[0],p=u,h=s,d=[m+p,m+h];if(f&&"sparse"!==f&&"dense"!==f)throw TypeError("Unknown matrix type ".concat(f,'"'));var g="sparse"===f?i.diagonal(d,l,c):n.diagonal(d,l,c);return null!==f?g:g.valueOf();case 2:var v=e,y=r,x=o,b=a,w=u,D=s;if(F(v)){var N=v.diagonal(y);return null!==x?x!==N.storage()?t(N,x):N:N.valueOf()}for(var E=Math.min(b[0]-w,b[1]-D),A=[],C=0;C<E;C++)A[C]=v[C+w][C+D];return null!==x?t(A):A}throw RangeError("Matrix for function diag must be 2 dimensional")}}),c8=ef("matAlgo09xS0Sf",["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a,o,s,u,l,c,f=e._values,m=e._index,p=e._ptr,h=e._size,d=e._datatype||void 0===e._data?e._datatype:e.getDataType(),g=n._values,v=n._index,y=n._ptr,x=n._size,b=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(h.length!==x.length)throw new eX(h.length,x.length);if(h[0]!==x[0]||h[1]!==x[1])throw RangeError("Dimension mismatch. Matrix A ("+h+") must match Matrix B ("+x+")");var w=h[0],D=h[1],N=t,E=0,A=i;"string"==typeof d&&d===b&&"mixed"!==d&&(a=d,N=r.find(t,[a,a]),E=r.convert(0,a),A=r.find(i,[a,a]));var C=f&&g?[]:void 0,S=[],M=[],F=C?[]:void 0,T=[];for(s=0;s<D;s++){M[s]=S.length;var B=s+1;if(F)for(l=y[s],c=y[s+1],u=l;u<c;u++)T[o=v[u]]=B,F[o]=g[u];for(l=p[s],c=p[s+1],u=l;u<c;u++)if(o=m[u],F){var O=T[o]===B?F[o]:E,_=A(f[u],O);N(_,E)||(S.push(o),C.push(_))}else S.push(o)}return M[D]=S.length,e.createSparseMatrix({values:C,index:S,ptr:M,size:[w,D],datatype:d===e._datatype&&b===n._datatype?a:void 0})}}),c6="dotMultiply",c7=ef(c6,["typed","matrix","equalScalar","multiplyScalar","concat"],e=>
1{var{typed:r,matrix:t,equalScalar:n,multiplyScalar:i,concat:a}=e,o=nm({typed:r,equalScalar:n}),s=c8({typed:r,equalScalar:n}),u=np({typed:r,equalScalar:n}),l=ni({typed:r,matrix:t,concat:a});return r(c6,l({elop:i,SS:s,DS:o,Ss:u}))}),c9=ef("matAlgo07xSSf",["typed","SparseMatrix"],e=>{var{typed:r,SparseMatrix:t}=e;return function(e,i,a){var o,s=e._size,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=i._size,c=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(s.length!==l.length)throw new eX(s.length,l.length);if(s[0]!==l[0]||s[1]!==l[1])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+l+")");var f=s[0],m=s[1],p=0,h=a;"string"==typeof u&&u===c&&"mixed"!==u&&(o=u,p=r.convert(0,o),h=r.find(a,[o,o]));for(var d=[],g=[],v=Array(m+1).fill(0),y=[],x=[],b=[],w=[],D=0;D<m;D++){var N=D+1,E=0;n(e,D,b,y,N),n(i,D,w,x,N);for(var A=0;A<f;A++){var C=h(b[A]===N?y[A]:p,w[A]===N?x[A]:p);0!==C&&!1!==C&&(g.push(A),d.push(C),E++)}v[D+1]=v[D]+E}return new t({values:d,index:g,ptr:v,size:[f,m],datatype:u===e._datatype&&c===i._datatype?o:void 0})};function n(e,r,t,n,i){for(var a=e._values,o=e._index,s=e._ptr,u=s[r],l=s[r+1];u<l;u++){var c=o[u];t[c]=i,n[c]=a[u]}}}),fe="equal",fr=ef(fe,["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=t7({typed:r}),u=c9({typed:r,SparseMatrix:o}),l=t9({typed:r,DenseMatrix:i}),c=ni({typed:r,matrix:t,concat:a});return r(fe,ft({typed:r,equalScalar:n}),c({elop:n,SS:u,DS:s,Ss:l}))}),ft=ef(fe,["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return r(fe,{"any, any":function(e,r){return null===e?null===r:null===r?null===e:void 0===e?void 0===r:void 0===r?void 0===e:t(e,r)}})}),fn=ef("fraction",["typed","Fraction"],e=>{var{typed:r,Fraction:t}=e;return r("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw Error(e+" cannot be represented as a fraction");return new t(e)},string:function(e){return new t(e)},"number, number":function(e,r){return new t(e,r)},"bigint, bigint":function(e,r){return new t(e,r)},null:function(e){return new t(0)},BigNumber:function(e){return new t(e.toString())},bigint:function(e){return new t(e.toString())},Fraction:function(e){return e},Unit:r.referToSelf(e=>r=>{var t=r.clone();return t.value=e(r.value),t}),Object:function(e){return new t(e)},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),fi="identity",fa=ef(fi,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],e=>{var{typed:r,config:t,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:o}=e;return r(fi,{"":function(){return"Matrix"===t.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return u(e,e,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber, string":function(e,r){return u(e,e,r)},"number | BigNumber, number | BigNumber":function(e,r){return u(e,r,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,r,t){return u(e,r,t)},Array:function(e){return s(e)},"Array, string":function(e,r){return s(e,r)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,r){return s(e.valueOf(),r)}});function s(e,r){switch(e.length){case 0:return r?n(r):[];case 1:return u(e[0],e[0],r);case 2:return u(e[0],e[1],r);default:throw Error("Vector containing two values expected")}}function u(e,r,t){var n=D(e)||D(r)?i:null;if(D(e)&&(e=e.toNumber()),D(r)&&(r=r.toNumber()),!eg(e)||e<1||!eg(r)||r<1)throw Error("Parameters in function identity must be positive integers");var s=n?new i(1):1,u=n?new n(0):0,l=[e,r];if(t){if("sparse"===t)return o.diagonal(l,s,0,u);if("dense"===t)return a.diagonal(l,s,0,u);throw TypeError('Unknown matrix type "'.concat(t,'"'))}for(var c=e5([],l,u),f=e<r?e:r,m=0;m<f;m++)c[m][m]=s;return c}}),fo="isNumeric",fs=ef(fo,["typed"],e=>{var{typed:r}=e;return r(fo,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),fu="kron",fl=ef(fu,["typed","matrix","multiplyScalar"],e=>{var{typed:r,matrix:t,multiplyScalar:n}=e;return r(fu,{"Matrix, Matrix":function(e,r){return t(i(e.toArray(),r.toArray()))},"Matrix, Array":function(e,r){return t(i(e.toArray(),r))},"Array, Matrix":function(e,r){return t(i(e,r.toArray()))},"Array, Array":i});function i(e,r){if(1===eK(e).length&&(e=[e]),1===eK(r).length&&(r=[r]),eK(e).length>2||eK(r).length>2)throw RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(r.length)+")");var t=[],i=[];return e.map(function(e){return r.map(function(r){return i=[],t.push(i),e.map(function(e){return r.map(function(r){return i.push(n(e,r))})})})})&&t}}
1),fc="largerEq",ff=ef(fc,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=t7({typed:r}),u=c9({typed:r,SparseMatrix:o}),l=t9({typed:r,DenseMatrix:i}),c=ni({typed:r,matrix:n,concat:a}),f=u8({typed:r});return r(fc,fm({typed:r,config:t}),{"boolean, boolean":(e,r)=>e>=r,"BigNumber, BigNumber":function(e,r){return e.gte(r)||u4(e,r,t.relTol,t.absTol)},"bigint, bigint":function(e,r){return e>=r},"Fraction, Fraction":(e,r)=>-1!==e.compare(r),"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:u,DS:s,Ss:l}))}),fm=ef(fc,["typed","config"],e=>{var{typed:r,config:t}=e;return r(fc,{"number, number":function(e,r){return e>=r||eO(e,r,t.relTol,t.absTol)}})}),fp=ef("matAlgo08xS0Sid",["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a,o,s,u,l,c=e._values,f=e._index,m=e._ptr,p=e._size,h=e._datatype||void 0===e._data?e._datatype:e.getDataType(),d=n._values,g=n._index,v=n._ptr,y=n._size,x=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(p.length!==y.length)throw new eX(p.length,y.length);if(p[0]!==y[0]||p[1]!==y[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+y+")");if(!c||!d)throw Error("Cannot perform operation on Pattern Sparse Matrices");var b=p[0],w=p[1],D=t,N=0,E=i;"string"==typeof h&&h===x&&"mixed"!==h&&(a=h,D=r.find(t,[a,a]),N=r.convert(0,a),E=r.find(i,[a,a]));for(var A=[],C=[],S=[],M=[],F=[],T=0;T<w;T++){S[T]=C.length;var B=T+1;for(s=m[T],u=m[T+1],o=s;o<u;o++)F[l=f[o]]=B,M[l]=c[o],C.push(l);for(s=v[T],u=v[T+1],o=s;o<u;o++)F[l=g[o]]===B&&(M[l]=E(M[l],d[o]));for(o=S[T];o<C.length;){var O=M[l=C[o]];D(O,N)?C.splice(o,1):(A.push(O),o++)}}return S[w]=C.length,e.createSparseMatrix({values:A,index:C,ptr:S,size:[b,w],datatype:h===e._datatype&&x===n._datatype?a:void 0})}}),fh=ef("useMatrixForArrayScalar",["typed","matrix"],e=>{var{typed:r,matrix:t}=e;return{"Array, number":r.referTo("DenseMatrix, number",e=>(r,n)=>e(t(r),n).valueOf()),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",e=>(r,n)=>e(t(r),n).valueOf()),"number, Array":r.referTo("number, DenseMatrix",e=>(r,n)=>e(r,t(n)).valueOf()),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",e=>(r,n)=>e(r,t(n)).valueOf())}}),fd="leftShift",fg=ef(fd,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=it({typed:r}),u=nm({typed:r,equalScalar:n}),l=fp({typed:r,equalScalar:n}),c=ie({typed:r,DenseMatrix:a}),f=np({typed:r,equalScalar:n}),m=nt({typed:r}),p=ni({typed:r,matrix:t,concat:o}),h=fh({typed:r,matrix:t});return r(fd,{"number, number":nH,"BigNumber, BigNumber":nR,"bigint, bigint":(e,r)=>e<<r,"SparseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>n(t,0)?r.clone():m(r,t,e,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):c(t,r,e,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):m(t,r,e,!0))},h,p({SS:l,DS:s,SD:u}))}),fv="mode",fy=ef(fv,["typed","isNaN","isNumeric"],e=>{var{typed:r,isNaN:t,isNumeric:n}=e;return r(fv,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=re(e.valueOf())).length)throw Error("Cannot calculate mode of an empty array");for(var r={},i=[],a=0,o=0;o<e.length;o++){var s=e[o];if(n(s)&&t(s))throw Error("Cannot calculate mode of an array containing NaN values");s in r||(r[s]=0),r[s]++,r[s]===a?i.push(s):r[s]>a&&(a=r[s],i=[s])}return i}}),fx="nthRoot",fb=ef(fx,["typed","matrix","equalScalar","BigNumber","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:i,concat:a}=e,o=it({typed:r}),s=nm({typed:r,equalScalar:n}),u=nh({typed:r,equalScalar:n}),l=np({typed:r,equalScalar:n}),c=ni({typed:r,matrix:t,concat:a});function f(){throw Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(fx,{number:ur,"number, number":ur,BigNumber:e=>m(e,new i(2)),"BigNumber, BigNumber":m,Complex:f,"Complex, number":f,Array:r.referTo("DenseMatrix,number",e=>r=>e(t(r),2).valueOf()),DenseMatrix:r.referTo("DenseMatrix,number",e=>r=>e(r,2)),SparseMatrix:r.referTo("SparseMatrix,number",e=>r=>e(r,2)),"SparseMatrix, SparseMatrix":r.referToSelf(e=>(r,t)=>{if(1===t.density())return u(r,t,e);throw Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":r.referToSelf(e=>(r,t)=>{if(1===t.density())return o(r,t,e,!1);throw Error("Root must be non-zero")}),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",e=>(r,n)=>e(t(r),n)),"number | BigNumber, SparseMatrix":r.referToSelf(e=>(r,t)=>{if(1===t.density())return l(t,r,e,!0);throw Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:s,Ss:l,sS:!1}));function m(e,r){var t=i.precision,n=i.clone({precision:t+2}),a=new i(0),o=new n(1),s=r.isNegative();if(s&&(r=r.neg()),r.isZero())throw Error("Root must be non-zero");if(e.isNegative()&&!r.abs().mod(2).equals(1))throw Error("Root must be odd when a is negative.");if(e.isZero())return s?new n(1/0):0;if(!e.isFinite())return s?a:e;var u=e.abs().pow(o.div(r));return u=e.isNeg()?u.neg():u,new i((s?o.div(u):u).toPrecision(t))}}),fw=ef("numeric",["number","?bignumber","?fraction"],e=>{var{number:r,bignumber:t,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:e=>r(e),BigNumber:t?e=>
1t(e):tf,bigint:e=>BigInt(e),Fraction:n?e=>n(e):tm};return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",t=arguments.length>2?arguments[2]:void 0;if(void 0!==t)throw SyntaxError("numeric() takes one or two arguments");var n=el(e);if(!(n in i))throw TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(r in a))throw TypeError("Cannot convert "+e+' to type "'+r+'"; valid output types are '+Object.keys(a).join(", "));return r===n?e:a[r](e)}}),fD="prod",fN=ef(fD,["typed","config","multiplyScalar","numeric"],e=>{var{typed:r,config:t,multiplyScalar:n,numeric:i}=e;return r(fD,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,r){throw Error("prod(A, dim) is not yet supported")},"...":function(e){return a(e)}});function a(e){var r;if(te(e,function(e){try{r=void 0===r?e:n(r,e)}catch(r){throw nS(r,"prod",e)}}),"string"==typeof r&&(r=i(r,ev(r,t))),void 0===r)throw Error("Cannot calculate prod of an empty array");return r}});function fE(e,r,t,n){if(!(this instanceof fE))throw SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=r,this.min=t,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+r+" provided, "+t+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}fE.prototype=Error(),fE.prototype.constructor=Error,fE.prototype.name="ArgumentsError",fE.prototype.isArgumentsError=!0;var fA=ef("resize",["config","matrix"],e=>{var{config:r,matrix:t}=e;return function(e,n,i){if(2!=arguments.length&&3!=arguments.length)throw new fE("resize",arguments.length,2,3);if(F(n)&&(n=n.valueOf()),D(n[0])&&(n=n.map(function(e){return D(e)?e.toNumber():e})),F(e))return e.resize(n,i,!0);if("string"==typeof e){var a=e,s=n,u=i;if(void 0!==u){if("string"!=typeof u||1!==u.length)throw TypeError("Single character expected as defaultValue")}else u=" ";if(1!==s.length)throw new eX(s.length,1);var l=s[0];if("number"!=typeof l||!eg(l))throw TypeError("Invalid size, must contain positive integers (size: "+eH(s)+")");if(a.length>l)return a.substring(0,l);if(!(a.length<l))return a;for(var c=a,f=0,m=l-a.length;f<m;f++)c+=u;return c}var p=!Array.isArray(e)&&"Array"!==r.matrix;if(0===n.length){for(;Array.isArray(e);)e=e[0];return o(e)}Array.isArray(e)||(e=[e]);var h=e5(e=o(e),n,i);return p?t(h):h}}),fC="rightArithShift",fS=ef(fC,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=it({typed:r}),u=nm({typed:r,equalScalar:n}),l=fp({typed:r,equalScalar:n}),c=ie({typed:r,DenseMatrix:a}),f=np({typed:r,equalScalar:n}),m=nt({typed:r}),p=ni({typed:r,matrix:t,concat:o}),h=fh({typed:r,matrix:t});return r(fC,{"number, number":nG,"BigNumber, BigNumber":nq,"bigint, bigint":(e,r)=>e>>r,"SparseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>n(t,0)?r.clone():m(r,t,e,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):c(t,r,e,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):m(t,r,e,!0))},h,p({SS:l,DS:s,SD:u}))}),fM="Number of decimals in function round must be an integer",fF="round",fT=ef(fF,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],e=>{var{typed:r,config:t,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,u=np({typed:r,equalScalar:i}),l=t9({typed:r,DenseMatrix:s}),c=nt({typed:r});function f(e){return Math.abs(eS(e).exponent)}return r(fF,{number:function(e){var r=uo(e,f(t.relTol));return uo(eO(e,r,t.relTol,t.absTol)?r:e)},"number, number":function(e,r){var n=f(t.relTol);if(r>=n)return uo(e,r);var i=uo(e,n);return uo(eO(e,i,t.relTol,t.absTol)?i:e,r)},"number, BigNumber":function(e,r){if(!r.isInteger())throw TypeError(fM);return new o(e).toDecimalPlaces(r.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,r){if(r%1)throw TypeError(fM);return e.round(r)},"Complex, BigNumber":function(e,r){if(!r.isInteger())throw TypeError(fM);var t=r.toNumber();return e.round(t)},BigNumber:function(e){var r=new o(e).toDecimalPlaces(f(t.relTol));return(u4(e,r,t.relTol,t.absTol)?r:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,r){if(!r.isInteger())throw TypeError(fM);var n=f(t.relTol);if(r>=n)return e.toDecimalPlaces(r.toNumber());var i=e.toDecimalPlaces(n);return(u4(e,i,t.relTol,t.absTol)?i:e).toDecimalPlaces(r.toNumber())},bigint:e=>e,"bigint, number":(e,r)=>e,"bigint, BigNumber":(e,r)=>e,Fraction:function(e){return e.round()},"Fraction, number":function(e,r){if(r%1)throw TypeError(fM);return e.round(r)},"Fraction, BigNumber":function(e,r){if(!r.isInteger())throw TypeError(fM);return e.round(r.toNumber())},"Unit, number, Unit":r.referToSelf(e=>function(r,t,n){var i=r.toNumeric(n);return n.multiply(e(i,t))}),"Unit, BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>e(r,t.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>tr(r,r=>e(r,t,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(e=>(r,t)=>e(r,0,t)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0)),"SparseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>
1u(r,t,e,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>c(r,t,e,!1)),"Array, number | BigNumber":r.referToSelf(e=>(r,t)=>c(n(r),t,e,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf(e=>(r,t)=>i(r,0)?a(t.size(),t.storage()):l(t,r,e,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf(e=>(r,t)=>i(r,0)?a(t.size(),t.storage()):c(t,r,e,!0)),"number | Complex | BigNumber | Fraction, Array":r.referToSelf(e=>(r,t)=>c(n(t),r,e,!0).valueOf())})}),fB="size",fO=ef(fB,["typed","config","?matrix"],e=>{var{typed:r,config:t,matrix:n}=e;return r(fB,{Matrix:function(e){return e.create(e.size(),"number")},Array:eK,string:function(e){return"Array"===t.matrix?[e.length]:n([e.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===t.matrix?[]:n?n([],"dense","number"):tp()}})}),f_="smaller",fz=ef(f_,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,config:t,bignumber:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,u=t7({typed:r}),l=c9({typed:r,SparseMatrix:s}),c=t9({typed:r,DenseMatrix:a}),f=ni({typed:r,matrix:i,concat:o}),m=u8({typed:r});function p(e,r){return e.lt(r)&&!u4(e,r,t.relTol,t.absTol)}return r(f_,fk({typed:r,config:t}),{"boolean, boolean":(e,r)=>e<r,"BigNumber, BigNumber":p,"bigint, bigint":(e,r)=>e<r,"Fraction, Fraction":(e,r)=>-1===e.compare(r),"Fraction, BigNumber":function(e,r){return p(n(e),r)},"BigNumber, Fraction":function(e,r){return p(e,n(r))},"Complex, Complex":function(e,r){throw TypeError("No ordering relation is defined for complex numbers")}},m,f({SS:l,DS:u,Ss:c}))}),fk=ef(f_,["typed","config"],e=>{var{typed:r,config:t}=e;return r(f_,{"number, number":function(e,r){return e<r&&!eO(e,r,t.relTol,t.absTol)}})}),fI=ef("to",["typed","matrix","concat"],e=>{var{typed:r,matrix:t,concat:n}=e,i=ni({typed:r,matrix:t,concat:n});return r("to",{"Unit, Unit | string":(e,r)=>e.to(r)},i({Ds:!0}))}),fR="unaryMinus",fq=ef(fR,["typed"],e=>{var{typed:r}=e;return r(fR,{number:s1,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:r.referToSelf(e=>t=>{var n=t.clone();return n.value=r.find(e,n.valueType())(t.value),n}),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0))})}),fP="unequal",fj=ef(fP,["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,config:t,equalScalar:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,u=t7({typed:r}),l=c9({typed:r,SparseMatrix:s}),c=t9({typed:r,DenseMatrix:a}),f=ni({typed:r,matrix:i,concat:o});return r(fP,fU({typed:r,equalScalar:n}),f({elop:function(e,r){return!n(e,r)},SS:l,DS:u,Ss:c}))}),fU=ef(fP,["typed","equalScalar"],e=>{var{typed:r,equalScalar:t}=e;return r(fP,{"any, any":function(e,r){return null===e?null!==r:null===r?null!==e:void 0===e?void 0!==r:void 0===r?void 0!==e:!t(e,r)}})}),fL=ef("xor",["typed","matrix","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:i,SparseMatrix:a}=e,o=t7({typed:r}),s=c9({typed:r,SparseMatrix:a}),u=t9({typed:r,DenseMatrix:n}),l=ni({typed:r,matrix:t,concat:i});return r("xor",{"number, number":nu,"Complex, Complex":function(e,r){return(0!==e.re||0!==e.im)!=(0!==r.re||0!==r.im)},"bigint, bigint":nu,"BigNumber, BigNumber":function(e,r){return(!e.isZero()&&!e.isNaN())!=(!r.isZero()&&!r.isNaN())},"Unit, Unit":r.referToSelf(e=>(r,t)=>e(r.value||0,t.value||0))},l({SS:s,DS:o,Ss:u}))}),f$=ef("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],e=>{var{typed:r,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,u=it({typed:r}),l=ir({typed:r,equalScalar:i}),c=ie({typed:r,DenseMatrix:a}),f=ni({typed:r,matrix:t,concat:s});return r("add",{"any, any":n,"any, any, ...any":r.referToSelf(e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i})},f({elop:n,DS:u,SS:l,Ss:c}))}),fH="atan2",fG=ef(fH,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=nm({typed:r,equalScalar:n}),u=t7({typed:r}),l=c8({typed:r,equalScalar:n}),c=np({typed:r,equalScalar:n}),f=t9({typed:r,DenseMatrix:a}),m=ni({typed:r,matrix:t,concat:o});return r(fH,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,r)=>i.atan2(e,r)},m({scalar:"number | BigNumber",SS:l,DS:u,SD:s,Ss:c,sS:f}))}),fZ="bitXor",fV=ef(fZ,["typed","matrix","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:i,SparseMatrix:a}=e,o=t7({typed:r}),s=c9({typed:r,SparseMatrix:a}),u=t9({typed:r,DenseMatrix:n}),l=ni({typed:r,matrix:t,concat:i});return r(fZ,{"number, number":n$,"BigNumber, BigNumber":nI,"bigint, bigint":(e,r)=>e^r},l({SS:s,DS:o,Ss:u}))}),fW="cbrt",fJ=ef(fW,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],e=>{var{config:r,typed:t,isNegative:n,unaryMinus:i,matrix:a,Complex:o,BigNumber:s,Fraction:u}=e;return t(fW,{number:s3,Complex:l,"Complex, boolean":l,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&E(e.value)){var r=e.clone();return r.value=1,(r=r.pow(1/3)).value=l(e.value),r}var t,a=n(e.value);a&&(e.value=i(e.value)),t=D(e.value)?new s(1).div(3):A(e.value)?new u(1,3):1/3;var o=e.pow(t);return a&&(o.value=i(o.value)),o}});function l(e,t){var n=e.arg()/3,i=e.abs(),s=new o(s3(i),0).mul(new o(0,n).exp());if(!t)return s;var u=[s,new o(s3(i),0).mul(new o(0,n+2*Math.PI/3).exp()),new o(s3(i),0).mul(new o(0,n-2*Math.PI/3).exp())];return"Array"===r.matrix?u:a(u)}}),fY="compare",fX=ef(fY,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],e=>{var{typed:r,config:t,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:u}=e,l=t7({typed:r}),c=ne({typed:r,equalScalar:n}),f=t9({typed:r,DenseMatrix:s}),m=ni({typed:r,matrix:i,concat:u}),p=u8({typed:r});return r(fY,fQ({typed:r,config:t}),{"boolean, boolean":function(e,r){return e===r?0:e>r?1:-1},"BigNumber, BigNumber":function(e,r){return new a(u4(e,r,t.relTol,t.absTol)?0:e.cmp(r))},"bigint, bigint":function(e,r){return e===r?0n:e>r?1n:-1n},"Fraction, Fraction":function(e,r){return new o(e.compare(r))},"Complex, Complex":function(){throw TypeError("No ordering relation is defined for c
1omplex numbers")}},p,m({SS:c,DS:l,Ss:f}))}),fQ=ef(fY,["typed","config"],e=>{var{typed:r,config:t}=e;return r(fY,{"number, number":function(e,r){return eO(e,r,t.relTol,t.absTol)?0:e>r?1:-1}})}),fK="compareText";eW.signature="any, any";var f0=ef(fK,["typed","matrix","concat"],e=>{var{typed:r,matrix:t,concat:n}=e,i=ni({typed:r,matrix:t,concat:n});return r(fK,eW,i({elop:eW,Ds:!0}))}),f1="count",f2=ef(f1,["typed","size","prod"],e=>{var{typed:r,size:t,prod:n}=e;return r(f1,{string:function(e){return e.length},"Matrix | Array":function(e){return n(t(e))}})}),f3="deepEqual",f5=ef(f3,["typed","equal"],e=>{var{typed:r,equal:t}=e;return r(f3,{"any, any":function(e,r){return function e(r,n){if(Array.isArray(r))if(!Array.isArray(n))return!1;else{var i=r.length;if(i!==n.length)return!1;for(var a=0;a<i;a++)if(!e(r[a],n[a]))return!1;return!0}return!Array.isArray(n)&&t(r,n)}(e.valueOf(),r.valueOf())}})}),f4="divideScalar",f8=ef(f4,["typed","numeric"],e=>{var{typed:r,numeric:t}=e;return r(f4,{"number, number":function(e,r){return e/r},"Complex, Complex":function(e,r){return e.div(r)},"BigNumber, BigNumber":function(e,r){return e.div(r)},"bigint, bigint":function(e,r){return e/r},"Fraction, Fraction":function(e,r){return e.div(r)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,r)=>e.divide(r),"number | Fraction | Complex | BigNumber, Unit":(e,r)=>r.divideInto(e)})}),f6="dotDivide",f7=ef(f6,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,u=nm({typed:r,equalScalar:n}),l=t7({typed:r}),c=c9({typed:r,SparseMatrix:s}),f=np({typed:r,equalScalar:n}),m=t9({typed:r,DenseMatrix:a}),p=ni({typed:r,matrix:t,concat:o});return r(f6,p({elop:i,SS:c,DS:l,SD:u,Ss:f,sS:m}))}),f9="equalText",me=ef(f9,["typed","compareText","isZero"],e=>{var{typed:r,compareText:t,isZero:n}=e;return r(f9,{"any, any":function(e,r){return n(t(e,r))}})}),mr="floor",mt=new a5(10),mn=ef(mr,["typed","config","round"],e=>{var{typed:r,config:t,round:n}=e;function i(e){var r=Math.floor(e),i=n(e);return r===i?r:eO(e,i,t.relTol,t.absTol)&&!eO(e,r,t.relTol,t.absTol)?i:r}return r(mr,{number:i,"number, number":function(e,r){if(!eg(r))throw RangeError("number of decimals in function floor must be an integer");if(r<0||r>15)throw RangeError("number of decimals in floor number must be in range 0 - 15");var t=10**r;return i(e*t)/t}})}),mi=ef(mr,["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=np({typed:r,equalScalar:a}),l=t9({typed:r,DenseMatrix:s}),c=nt({typed:r}),f=mn({typed:r,config:t,round:n});function m(e){var r=(e,r)=>u4(e,r,t.relTol,t.absTol),i=e.floor(),a=n(e);return i.eq(a)?i:r(e,a)&&!r(e,i)?a:i}return r("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,r){return e.floor(r)},"Complex, BigNumber":function(e,r){return e.floor(r.toNumber())},BigNumber:m,"BigNumber, BigNumber":function(e,r){var t=mt.pow(r);return m(e.mul(t)).div(t)},bigint:e=>e,"bigint, number":(e,r)=>e,"bigint, BigNumber":(e,r)=>e,Fraction:function(e){return e.floor()},"Fraction, number":function(e,r){return e.floor(r)},"Fraction, BigNumber":function(e,r){return e.floor(r.toNumber())},"Unit, number, Unit":r.referToSelf(e=>function(r,t,n){var i=r.toNumeric(n);return n.multiply(e(i,t))}),"Unit, BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>e(r,t.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>tr(r,r=>e(r,t,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(e=>(r,t)=>e(r,0,t)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0)),"Array, number | BigNumber":r.referToSelf(e=>(r,t)=>tr(r,r=>e(r,t),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>u(r,t,e,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>c(r,t,e,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(e=>(r,t)=>c(i(t),r,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(e=>(r,t)=>a(r,0)?o(t.size(),t.storage()):"dense"===t.storage()?c(t,r,e,!0):l(t,r,e,!0))})}),ma=ef("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:u}=e,l=mi({typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),c=nm({typed:r,equalScalar:a}),f=t7({typed:r}),m=ne({typed:r,equalScalar:a}),p=np({typed:r,equalScalar:a}),h=t9({typed:r,DenseMatrix:s}),d=ni({typed:r,matrix:i,concat:u});return r("mod",{"number, number":function(e,r){return 0===r?e:e-r*l(e/r)},"BigNumber, BigNumber":function(e,r){return r.isZero()?e:e.sub(r.mul(l(e.div(r))))},"bigint, bigint":function(e,r){if(0n===r)return e;if(e<0){var t=e%r;return 0n===t?t:t+r}return e%r},"Fraction, Fraction":function(e,r){return r.equals(0)?e:e.sub(r.mul(l(e.div(r))))}},d({SS:m,DS:f,SD:c,Ss:p,sS:h}))}),mo="number | BigNumber | Fraction | Matrix | Array",ms="".concat(mo,", ").concat(mo,", ...").concat(mo);
1function mu(e){return!e.some(e=>Array.isArray(e))}var ml=ef("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,config:n,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:u,concat:l}=e,c=ma({typed:r,config:n,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:u,concat:l}),f=it({typed:r}),m=ir({typed:r,equalScalar:a}),p=ie({typed:r,DenseMatrix:u}),h=ni({typed:r,matrix:t,concat:l});return r("gcd",{"number, number":function(e,r){var t;if(!eg(e)||!eg(r))throw Error("Parameters in function gcd must be integer numbers");for(;0!==r;)t=c(e,r),e=r,r=t;return e<0?-e:e},"BigNumber, BigNumber":function(e,r){if(!e.isInt()||!r.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var t=new s(0);!r.isZero();){var n=c(e,r);e=r,r=n}return e.lt(t)?e.neg():e},"Fraction, Fraction":(e,r)=>e.gcd(r)},h({SS:m,DS:f,Ss:p}),{[ms]:r.referToSelf(e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i}),Array:r.referToSelf(e=>r=>{if(1===r.length&&Array.isArray(r[0])&&mu(r[0]))return e(...r[0]);if(mu(r))return e(...r);throw new fE("gcd() supports only 1d matrices!")}),Matrix:r.referToSelf(e=>r=>e(r.toArray()))})}),mc="hasNumericValue",mf=ef(mc,["typed","isNumeric"],e=>{var{typed:r,isNumeric:t}=e;return r(mc,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return t(e)}})}),mm="hypot",mp=ef(mm,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],e=>{var{typed:r,abs:t,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:s,isPositive:u}=e;return r(mm,{"... number | BigNumber":l,Array:l,Matrix:e=>l(re(e.toArray(),!0))});function l(e){for(var r=0,l=0,c=0;c<e.length;c++){if(E(e[c]))throw TypeError("Unexpected type of argument to hypot");var f=t(e[c]);s(l,f)?(r=n(r=a(r,a(i(l,f),i(l,f))),1),l=f):r=n(r,u(f)?a(i(f,l),i(f,l)):f)}return a(l,o(r))}}),mh=ef("ImmutableDenseMatrix",["smaller","DenseMatrix"],e=>{var{smaller:r,DenseMatrix:t}=e;function n(e,r){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");if(r&&!S(r))throw Error("Invalid datatype: "+r);if(F(e)||M(e)){var i=new t(e,r);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&M(e.data)&&M(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=void 0!==e.min?e.min:null,this._max=void 0!==e.max?e.max:null;else if(e)throw TypeError("Unsupported type of data ("+el(e)+")");else this._data=[],this._size=[0],this._datatype=r,this._min=null,this._max=null}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:var r=t.prototype.subset.call(this,e);if(F(r))return new n({data:r._data,size:r._size,datatype:r._datatype});return r;case 2:case 3:throw Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:o(this._data),size:o(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(){throw Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(null===this._min){var e=null;this.forEach(function(t){(null===e||r(t,e))&&(e=t)}),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var e=null;this.forEach(function(t){(null===e||r(e,t))&&(e=t)}),this._max=null!==e?e:void 0}return this._max},n},{isClass:!0}),md=ef("Index",["ImmutableDenseMatrix","getMatrixDataType"],e=>{var{ImmutableDenseMatrix:r,getMatrixDataType:t}=e;function n(e){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var r=0,a=arguments.length;r<a;r++){var o=arguments[r],s=M(o),u=F(o),l=typeof o,c=null;if(_(o))this._dimensions.push(o),this._isScalar=!1;else if(s||u){var f=void 0;"boolean"===t(o)?(s&&(f=i(mg(o).valueOf())),u&&(f=i(mg(o._data).valueOf())),c=o.valueOf().length):f=i(o.valueOf()),this._dimensions.push(f);var m=f.size();(1!==m.length||1!==m[0]||null!==c)&&(this._isScalar=!1)}else if("number"===l)this._dimensions.push(i([o]));else if("bigint"===l)this._dimensions.push(i([Number(o)]));else if("string"===l)this._dimensions.push(o);else throw TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");this._sourceSize.push(c)}}function i(e){for(var t=0,n=e.length;t<n;t++)if("number"!=typeof e[t]||!eg(e[t]))throw TypeError("Index parameters must be positive integer numbers");return new r(e)}return n.prototype.type="Index",n.prototype.isIndex=!0,n.prototype.clone=function(){var e=new n;return e._dimensions=o(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},n.create=function(e){var r=new n;return n.apply(r,e),r},n.prototype.size=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?1:n.size()[0]}return e},n.prototype.max=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?n:n.max()}return e},n.prototype.min=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?n:n.min()}return e},n.prototype.forEach=function(e){for(var r=0,t=this._dimensions.length;r<t;r++)e(this._dimensions[r],r,this)},n.prototype.dimension=function(e){return"number"!=typeof e?null:this._dimensions[e]||null},n.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e.push("string"==typeof n?n:n.toArray())}return e},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},n.fromJSON=function(e){return n.create(e.dimensions)},n},{isClass:!0});function mg(e){var r=[];return e.forEach((e,t)=>{e&&r.push(t)}),r}var mv="larger",my=ef(mv,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,config:t,bignumber:n,matrix:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,u=t7({typed:r}),l=c9({typed:r,SparseMatrix:s}),c=t9({typed:r,DenseMatrix:a}),f=ni({typed:r,matrix:i,concat:o}),m=u8({typed:r});function p(e,r){return e.gt(r)&&!u4(e,r,t.relTol,t.absTol)}return r(mv,mx({typed:r,config:t}),{"boolean, boolean":(e,r)=>e>r,"BigNumber, BigNumber":p,"bigint, bigint":(e,r)=>e>r,"Fraction, Fraction":(e,r)=>1===e.compare(r),"Fraction, BigNumber":function(e,r){return p(n(e),r)},"BigNumber, Fraction":function(e,r){return p(e,n(r))},"Complex, Complex":function(){throw TypeError("No ordering relation is defined for c
1omplex numbers")}},m,f({SS:l,DS:u,Ss:c}))}),mx=ef(mv,["typed","config"],e=>{var{typed:r,config:t}=e;return r(mv,{"number, number":function(e,r){return e>r&&!eO(e,r,t.relTol,t.absTol)}})}),mb=Math.log(16),mw=ef("log",["config","typed","typeOf","divideScalar","Complex"],e=>{var{typed:r,typeOf:t,config:n,divideScalar:i,Complex:a}=e;function o(e){return e.log()}function s(e){return o(new a(e,0))}return r("log",{number:function(e){return e>=0||n.predictable?s7(e):s(e)},bigint:l_(mb,s7,n,s),Complex:o,BigNumber:function(e){return!e.isNegative()||n.predictable?e.ln():s(e.toNumber())},"any, any":r.referToSelf(e=>(r,n)=>{if("Fraction"===t(r)&&"Fraction"===t(n)){var a=r.log(n);if(null!==a)return a}return i(e(r),e(n))})})});function mD(e){var{DenseMatrix:r}=e;return function(e,t,n){var i=e.size();if(2!==i.length)throw RangeError("Matrix must be two dimensional (size: "+eH(i)+")");var a=i[0];if(a!==i[1])throw RangeError("Matrix must be square (size: "+eH(i)+")");var o=[];if(F(t)){var s=t.size(),u=t._data;if(1===s.length){if(s[0]!==a)throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var l=0;l<a;l++)o[l]=[u[l]];return new r({data:o,size:[a,1],datatype:t._datatype})}if(2===s.length){if(s[0]!==a||1!==s[1])throw RangeError("Dimension mismatch. Matrix columns must match vector length.");if(B(t)){if(n){o=[];for(var c=0;c<a;c++)o[c]=[u[c][0]];return new r({data:o,size:[a,1],datatype:t._datatype})}return t}if(O(t)){for(var f=0;f<a;f++)o[f]=[0];for(var m=t._values,p=t._index,h=t._ptr,d=h[1],g=h[0];g<d;g++)o[p[g]][0]=m[g];return new r({data:o,size:[a,1],datatype:t._datatype})}}throw RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(M(t)){var v=eK(t);if(1===v.length){if(v[0]!==a)throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var y=0;y<a;y++)o[y]=[t[y]];return new r({data:o,size:[a,1]})}if(2===v.length){if(v[0]!==a||1!==v[1])throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var x=0;x<a;x++)o[x]=[t[x][0]];return new r({data:o,size:[a,1]})}throw RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var mN="lsolve",mE=ef(mN,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=mD({DenseMatrix:s});return r(mN,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=e._values,m=e._index,p=e._ptr,h=[],d=0;d<c;d++){var g=t[d][0]||0;if(o(g,0))h[d]=[0];else{for(var v=0,y=[],x=[],b=p[d],w=p[d+1],D=b;D<w;D++){var N=m[D];N===d?v=f[D]:N>d&&(y.push(f[D]),x.push(N))}if(o(v,0))throw Error("Linear system cannot be solved since matrix is singular");for(var E=n(g,v),A=0,C=x.length;A<C;A++){var S=x[A];t[S]=[a(t[S][0]||0,i(E,y[A]))]}h[d]=[E]}}return new s({data:h,size:[l,1]})}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).valueOf()}});function l(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=[],m=e._data,p=0;p<c;p++){var h=t[p][0]||0,d=void 0;if(o(h,0))d=0;else{var g=m[p][p];if(o(g,0))throw Error("Linear system cannot be solved since matrix is singular");d=n(h,g);for(var v=p+1;v<l;v++)t[v]=[a(t[v][0]||0,i(d,m[v][p]))]}f[p]=[d]}return new s({data:f,size:[l,1]})}}),mA="matrixFromColumns",mC=ef(mA,["typed","matrix","flatten","size"],e=>{var{typed:r,matrix:t,flatten:n,size:i}=e;return r(mA,{"...Array":function(e){return a(e)},"...Matrix":function(e){return t(a(e.map(e=>e.toArray())))}});function a(e){if(0===e.length)throw TypeError("At least one column is needed to construct a matrix.");for(var r=o(e[0]),t=[],i=0;i<r;i++)t[i]=[];for(var a of e){var s=o(a);if(s!==r)throw TypeError("The vectors had different length: "+(0|r)+" â "+(0|s));for(var u=n(a),l=0;l<r;l++)t[l].push(u[l])}return t}function o(e){var r=i(e);if(1===r.length)return r[0];if(2===r.length)if(1===r[0])return r[1];else if(1===r[1])return r[0];else throw TypeError("At least one of the arguments is not a vector.");throw TypeError("Only one- or two-dimensional vectors are supported.")}}),mS="nthRoots",mM=ef(mS,["config","typed","divideScalar","Complex"],e=>{var{typed:r,config:t,divideScalar:n,Complex:i}=e,a=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function o(e,r){if(r<0)throw Error("Root must be greater than zero");if(0===r)throw Error("Root must be non-zero");if(r%1!=0)throw Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];var t,n="number"==typeof e;(n||0===e.re||0===e.im)&&(t=n?2*(e<0):0===e.im?2*(e.re<0):2*(e.im<0)+1);for(var o=e.arg(),s=e.abs(),u=[],l=Math.pow(s,1/r),c=0;c<r;c++){var f=(t+4*c)/r;if(f===Math.round(f)){u.push(a[f%4](l));continue}u.push(new i({r:l,phi:(o+2*Math.PI*c)/r}))}return u}return r(mS,{Complex:function(e){return o(e,2)},"Complex, number":o})}),mF="partitionSelect",mT=ef(mF,["typed","isNumeric","isNaN","compare"],e=>{var{typed:r,isNumeric:t,isNaN:n,compare:i}=e,a=(e,r)=>-i(e,r);return r(mF,{"Array | Matrix, number":function(e,r){return o(e,r,i)},"Array | Matrix, number, string":function(e,r,t){if("asc"===t)return o(e,r,i);if("desc"===t)return o(e,r,a);
1throw Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":o});function o(e,r,t){if(!eg(r)||r<0)throw Error("k must be a non-negative integer");if(F(e)){if(e.size().length>1)throw Error("Only one dimensional matrices supported");return s(e.valueOf(),r,t)}if(Array.isArray(e))return s(e,r,t)}function s(e,r,i){if(r>=e.length)throw Error("k out of bounds");for(var a=0;a<e.length;a++)if(t(e[a])&&n(e[a]))return e[a];for(var o=0,s=e.length-1;o<s;){for(var u=o,l=s,c=e[Math.floor(Math.random()*(s-o+1))+o];u<l;)if(i(e[u],c)>=0){var f=e[l];e[l]=e[u],e[u]=f,--l}else++u;i(e[u],c)>0&&--u,r<=u?s=u:o=u+1}return e[r]}}),mB=ef("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],e=>{var{typed:r,matrix:t,zeros:i,identity:a,isZero:o,equal:s,sign:u,sqrt:l,conj:c,unaryMinus:f,addScalar:m,divideScalar:p,multiplyScalar:h,subtractScalar:d,complex:g}=e;return(0,n.A)(r("qr",{DenseMatrix:function(e){return y(e)},SparseMatrix:function(e){throw Error("qr not implemented for sparse matrices yet")},Array:function(e){var r=y(t(e));return{Q:r.Q.valueOf(),R:r.R.valueOf()}}}),{_denseQRimpl:v});function v(e){var r,t,n,g=e._size[0],v=e._size[1],y=a([g],"dense"),x=y._data,b=e.clone(),w=b._data,D=i([g],"");for(n=0;n<Math.min(v,g);++n){var N=w[n][n],E=f(s(N,0)?1:u(N)),A=c(E),C=0;for(r=n;r<g;r++)C=m(C,h(w[r][n],c(w[r][n])));var S=h(E,l(C));if(!o(S)){var M=d(N,S);for(D[n]=1,r=n+1;r<g;r++)D[r]=p(w[r][n],M);var F=f(c(p(M,S))),T=void 0;for(t=n;t<v;t++){for(T=0,r=n;r<g;r++)T=m(T,h(c(D[r]),w[r][t]));for(T=h(T,F),r=n;r<g;r++)w[r][t]=h(d(w[r][t],h(D[r],T)),A)}for(r=0;r<g;r++){for(T=0,t=n;t<g;t++)T=m(T,h(x[r][t],D[t]));for(T=h(T,F),t=n;t<g;++t)x[r][t]=p(d(x[r][t],h(T,c(D[t]))),A)}}}return{Q:y,R:b,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function y(e){var r=v(e),t=r.R._data;if(e._data.length>0)for(var n="Complex"===t[0][0].type?g(0):0,i=0;i<t.length;++i)for(var a=0;a<i&&a<(t[0]||[]).length;++a)t[i][a]=n;return r}}),mO="rightLogShift",m_=ef(mO,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=it({typed:r}),u=nm({typed:r,equalScalar:n}),l=fp({typed:r,equalScalar:n}),c=ie({typed:r,DenseMatrix:a}),f=np({typed:r,equalScalar:n}),m=nt({typed:r}),p=ni({typed:r,matrix:t,concat:o}),h=fh({typed:r,matrix:t});return r(mO,{"number, number":nZ,"SparseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>n(t,0)?r.clone():m(r,t,e,!1)),"number | BigNumber, SparseMatrix":r.referToSelf(e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):c(t,r,e,!0)),"number | BigNumber, DenseMatrix":r.referToSelf(e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):m(t,r,e,!0))},h,p({SS:l,DS:s,SD:u}))}),mz="smallerEq",mk=ef(mz,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a,SparseMatrix:o}=e,s=t7({typed:r}),u=c9({typed:r,SparseMatrix:o}),l=t9({typed:r,DenseMatrix:i}),c=ni({typed:r,matrix:n,concat:a}),f=u8({typed:r});return r(mz,mI({typed:r,config:t}),{"boolean, boolean":(e,r)=>e<=r,"BigNumber, BigNumber":function(e,r){return e.lte(r)||u4(e,r,t.relTol,t.absTol)},"bigint, bigint":(e,r)=>e<=r,"Fraction, Fraction":(e,r)=>1!==e.compare(r),"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:u,DS:s,Ss:l}))}),mI=ef(mz,["typed","config"],e=>{var{typed:r,config:t}=e;return r(mz,{"number, number":function(e,r){return e<=r||eO(e,r,t.relTol,t.absTol)}})}),mR="subtract",mq=ef(mR,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,u=it({typed:r}),l=t7({typed:r}),c=ne({typed:r,equalScalar:n}),f=ie({typed:r,DenseMatrix:o}),m=t9({typed:r,DenseMatrix:o}),p=ni({typed:r,matrix:t,concat:s});return r(mR,{"any, any":i},p({elop:i,SS:c,DS:u,SD:l,Ss:m,sS:f}))}),mP=ef("trace",["typed","matrix","add"],e=>{var{typed:r,matrix:t,add:n}=e;return r("trace",{Array:function(e){return i(t(e))},SparseMatrix:function(e){var r=e._values,t=e._index,i=e._ptr,a=e._size,o=a[0],s=a[1];if(o===s){var u=0;if(r.length>0)for(var l=0;l<s;l++)for(var c=i[l],f=i[l+1],m=c;m<f;m++){var p=t[m];if(p===l){u=n(u,r[m]);break}if(p>l)break}return u}throw RangeError("Matrix must be square (size: "+eH(a)+")")},DenseMatrix:i,any:o});function i(e){var r=e._size,t=e._data;switch(r.length){case 1:if(1===r[0])return o(t[0]);throw RangeError("Matrix must be square (size: "+eH(r)+")");case 2:var i=r[0];if(i===r[1]){for(var a=0,s=0;s<i;s++)a=n(a,t[s][s]);return a}throw RangeError("Matrix must be square (size: "+eH(r)+")");
1default:throw RangeError("Matrix must be two dimensional (size: "+eH(r)+")")}}}),mj="usolve",mU=ef(mj,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=mD({DenseMatrix:s});return r(mj,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=e._values,m=e._index,p=e._ptr,h=[],d=c-1;d>=0;d--){var g=t[d][0]||0;if(o(g,0))h[d]=[0];else{for(var v=0,y=[],x=[],b=p[d],w=p[d+1],D=w-1;D>=b;D--){var N=m[D];N===d?v=f[D]:N<d&&(y.push(f[D]),x.push(N))}if(o(v,0))throw Error("Linear system cannot be solved since matrix is singular");for(var E=n(g,v),A=0,C=x.length;A<C;A++){var S=x[A];t[S]=[a(t[S][0],i(E,y[A]))]}h[d]=[E]}}return new s({data:h,size:[l,1]})}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).valueOf()}});function l(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=[],m=e._data,p=c-1;p>=0;p--){var h=t[p][0]||0,d=void 0;if(o(h,0))d=0;else{var g=m[p][p];if(o(g,0))throw Error("Linear system cannot be solved since matrix is singular");d=n(h,g);for(var v=p-1;v>=0;v--)t[v]=[a(t[v][0]||0,i(d,m[v][p]))]}f[p]=[d]}return new s({data:f,size:[l,1]})}}),mL="catalan",m$=ef(mL,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],e=>
1{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return r(mL,{"number | BigNumber":function(e){if(!s(e)||o(e))throw TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),t(e,1))}})}),mH=t(19452),mG="compareNatural",mZ=ef(mG,["typed","compare"],e=>{var{typed:r,compare:t}=e,n=t.signatures["boolean,boolean"];return r(mG,{"any, any":function e(r,a){var o,s,u,l=el(r),c=el(a);if(("number"===l||"BigNumber"===l||"Fraction"===l)&&("number"===c||"BigNumber"===c||"Fraction"===c))return"0"!==(u=t(r,a)).toString()?u>0?1:-1:mH(l,c);var f=["Array","DenseMatrix","SparseMatrix"];if(f.includes(l)||f.includes(c))return 0!==(u=function e(r,t,n){return O(t)&&O(n)?i(r,t.toJSON().values,n.toJSON().values):O(t)?e(r,t.toArray(),n):O(n)?e(r,t,n.toArray()):B(t)?e(r,t.toJSON().data,n):B(n)?e(r,t,n.toJSON().data):Array.isArray(t)?Array.isArray(n)?i(r,t,n):e(r,t,[n]):e(r,[t],n)}(e,r,a))?u:mH(l,c);if(l!==c)return mH(l,c);if("Complex"===l){return o=r,s=a,o.re>s.re?1:o.re<s.re?-1:o.im>s.im?1:o.im<s.im?-1:0}if("Unit"===l)return r.equalBase(a)?e(r.value,a.value):i(e,r.formatUnits(),a.formatUnits());if("boolean"===l)return n(r,a);if("string"===l)return mH(r,a);if("Object"===l)return function(e,r,t){var n=Object.keys(r),a=Object.keys(t);n.sort(mH),a.sort(mH);var o=i(e,n,a);if(0!==o)return o;for(var s=0;s<n.length;s++){var u=e(r[n[s]],t[a[s]]);if(0!==u)return u}return 0}(e,r,a);if("null"===l||"undefined"===l)return 0;throw TypeError('Unsupported type of value "'+l+'"')}});function i(e,r,t){for(var n=0,i=Math.min(r.length,t.length);n<i;n++){var a=e(r[n],t[n]);if(0!==a)return a}return r.length>t.length?1:r.length<t.length?-1:0}}),mV="composition",mW=ef(mV,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],e=>{var{typed:r,addScalar:t,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return r(mV,{"number | BigNumber, number | BigNumber":function(e,r){if(o(e)&&i(e)&&o(r)&&i(r)){if(s(r,e))throw TypeError("k must be less than or equal to n in function composition")}else throw TypeError("Positive integer value expected in function composition");return n(t(e,-1),t(r,-1))}})}),mJ="distance",mY=ef(mJ,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:o,sqrt:s,abs:u}=e;return r(mJ,{"Array, Array, Array":function(e,r,t){if(2===e.length&&2===r.length&&2===t.length){if(!c(e))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(r))throw TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(t))throw TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(o(r,t))throw TypeError("LinePoint1 should not be same with LinePoint2");var a=n(t[1],r[1]),s=n(r[0],t[0]),u=n(i(t[0],r[1]),i(r[0],t[1]));return d(e[0],e[1],a,s,u)}throw TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,r,t){if(2===Object.keys(e).length&&2===Object.keys(r).length&&2===Object.keys(t).length){if(!c(e))throw TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(r))throw TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(t))throw TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(o(h(r),h(t)))throw TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in r&&"lineOnePtY"in r&&"lineTwoPtX"in t&&"lineTwoPtY"in t){var a=n(t.lineTwoPtY,r.lineOnePtY),s=n(r.lineOnePtX,t.lineTwoPtX),u=n(i(t.lineTwoPtX,r.lineOnePtY),i(r.lineOnePtX,t.lineTwoPtY));return d(e.pointX,e.pointY,a,s,u)}
1throw TypeError("Key names do not match")}throw TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,r){if(2===e.length&&3===r.length){if(!c(e))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(r))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");return d(e[0],e[1],r[0],r[1],r[2])}if(3===e.length&&6===r.length){if(!f(e))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(r))throw TypeError("Array with 6 numbers or BigNumbers expected for second argument");return g(e[0],e[1],e[2],r[0],r[1],r[2],r[3],r[4],r[5])}if(e.length===r.length&&e.length>0){if(!m(e)||!m(r))throw TypeError("All values of an array should be numbers or BigNumbers");return v(e,r)}throw TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,r){if(2===Object.keys(e).length&&3===Object.keys(r).length){if(!c(e))throw TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(r))throw TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in r&&"yCoeffLine"in r&&"constant"in r)return d(e.pointX,e.pointY,r.xCoeffLine,r.yCoeffLine,r.constant);
1throw TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(r).length){if(!f(e))throw TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(r))throw TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in r&&"y0"in r&&"z0"in r&&"a"in r&&"b"in r&&"c"in r)return g(e.pointX,e.pointY,e.pointZ,r.x0,r.y0,r.z0,r.a,r.b,r.c);throw TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(r).length){if(!c(e))throw TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(r))throw TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in r&&"pointTwoY"in r)return v([e.pointOneX,e.pointOneY],[r.pointTwoX,r.pointTwoY]);throw TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(r).length){if(!f(e))throw TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(r))throw TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in r&&"pointTwoY"in r&&"pointTwoZ"in r)return v([e.pointOneX,e.pointOneY,e.pointOneZ],[r.pointTwoX,r.pointTwoY,r.pointTwoZ]);
1throw TypeError("Key names do not match")}throw TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&l(e[0][0])&&l(e[0][1])){if(e.some(e=>2!==e.length||!l(e[0])||!l(e[1])))return!1}else if(!(3===e[0].length&&l(e[0][0])&&l(e[0][1])&&l(e[0][2])))return!1;else if(e.some(e=>3!==e.length||!l(e[0])||!l(e[1])||!l(e[2])))return!1;return!0}(e))throw TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var r=[],t=[],n=[],i=0;i<e.length-1;i++)for(var a=i+1;a<e.length;a++)2===e[0].length?(t=[e[i][0],e[i][1]],n=[e[a][0],e[a][1]]):3===e[0].length&&(t=[e[i][0],e[i][1],e[i][2]],n=[e[a][0],e[a][1],e[a][2]]),r.push(v(t,n));return r}(e)}});function l(e){return"number"==typeof e||D(e)}function c(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])}function f(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])&&l(e[2])}function m(e){return Array.isArray(e)||(e=h(e)),e.every(l)}function p(e){return e.constructor!==Array&&(e=h(e)),l(e[0])&&l(e[1])&&l(e[2])&&l(e[3])&&l(e[4])&&l(e[5])}function h(e){for(var r=Object.keys(e),t=[],n=0;n<r.length;n++)t.push(e[r[n]]);return t}function d(e,r,n,o,l){return a(u(t(t(i(n,e),i(o,r)),l)),s(t(i(n,n),i(o,o))))}function g(e,r,o,u,l,c,f,m,p){var h=[n(i(n(l,r),p),i(n(c,o),m)),n(i(n(c,o),f),i(n(u,e),p)),n(i(n(u,e),m),i(n(l,r),f))];return a(h=s(t(t(i(h[0],h[0]),i(h[1],h[1])),i(h[2],h[2]))),s(t(t(i(f,f),i(m,m)),i(p,p))))}function v(e,r){for(var a=e.length,o=0,u=0,l=0;l<a;l++)o=t(i(u=n(e[l],r[l]),u),o);return s(o)}}),mX=ef("dot",["typed","addScalar","multiplyScalar","conj","size"],e=>{var{typed:r,addScalar:t,multiplyScalar:n,conj:i,size:a}=e;return r("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,a){var u=o(e,a),l=F(e)?e._data:e,c=F(e)?e._datatype||e.getDataType():void 0,f=F(a)?a._data:a,m=F(a)?a._datatype||a.getDataType():void 0,p=2===s(e).length,h=2===s(a).length,d=t,g=n;if(c&&m&&c===m&&"string"==typeof c&&"mixed"!==c&&(d=r.find(t,[c,c]),g=r.find(n,[c,c])),!p&&!h){for(var v=g(i(l[0]),f[0]),y=1;y<u;y++)v=d(v,g(i(l[y]),f[y]));return v}if(!p&&h){for(var x=g(i(l[0]),f[0][0]),b=1;b<u;b++)x=d(x,g(i(l[b]),f[b][0]));return x}if(p&&!h){for(var w=g(i(l[0][0]),f[0]),D=1;D<u;D++)w=d(w,g(i(l[D][0]),f[D]));return w}if(p&&h){for(var N=g(i(l[0][0]),f[0][0]),E=1;E<u;E++)N=d(N,g(i(l[E][0]),f[E][0]));return N}},"SparseMatrix, SparseMatrix":function(e,r){o(e,r);for(var i=e._index,a=e._values,s=r._index,u=r._values,l=0,c=0,f=0;c<i.length&&f<s.length;){var m=i[c],p=s[f];if(m<p){c++;continue}if(m>p){f++;continue}m===p&&(l=t(l,n(a[c],u[f])),c++,f++)}return l}});function o(e,r){var t,n,i=s(e),a=s(r);if(1===i.length)t=i[0];else if(2===i.length&&1===i[1])t=i[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");if(1===a.length)n=a[0];else if(2===a.length&&1===a[1])n=a[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+a.join(", ")+")");if(t!==n)throw RangeError("Vectors must have equal length ("+t+" != "+n+")");if(0===t)throw RangeError("Cannot calculate the dot product of empty vectors");return t}function s(e){return F(e)?e.size():a(e)}}),mQ=ef("FibonacciHeap",["smaller","larger"],e=>{var{smaller:r,larger:t}=e,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function a(e,r,t){r.left.right=r.right,r.right.left=r.left,t.degree--,t.child===r&&(t.child=r.right),0===t.degree&&(t.child=null),r.left=e,r.right=e.right,e.right=r,r.right.left=r,r.parent=null,r.mark=!1}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,t){var n={key:e,value:t,degree:0};if(this._minimum){var i=this._minimum;n.left=i,n.right=i.right,i.right=n,n.right.left=n,r(e,i.key)&&(this._minimum=n)}else n.left=n,n.right=n,this._minimum=n;return this._size++,n},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return 0===this._size},i.prototype.extractMinimum=function(){var e=this._minimum;if(null===e)return e;for(var i=this._minimum,a=e.degree,s=e.child;a>0;){var u=s.right;s.left.right=s.right,s.right.left=s.left,s.left=i,s.right=i.right,i.right=s,s.right.left=s,s.parent=null,s=u,a--}return e.left.right=e.right,e.right.left=e.left,i=e===e.right?null:function(e,i){var a,s=Math.floor(Math.log(i)*n)+1,u=Array(s),l=0,c=e;
1if(c)for(l++,c=c.right;c!==e;)l++,c=c.right;for(;l>0;){for(var f=c.degree,m=c.right;a=u[f];){if(t(c.key,a.key)){var p=a;a=c,c=p}o(a,c),u[f]=null,f++}u[f]=c,c=m,l--}e=null;for(var h=0;h<s;h++)(a=u[h])&&(e?(a.left.right=a.right,a.right.left=a.left,a.left=e,a.right=e.right,e.right=a,a.right.left=a,r(a.key,e.key)&&(e=a)):e=a);return e}(i=e.right,this._size),this._size--,this._minimum=i,e},i.prototype.remove=function(e){var t,n,i,o;this._minimum=(t=this._minimum,i=-1,(n=e).key=-1,(o=n.parent)&&r(n.key,o.key)&&(a(t,n,o),function e(r,t){var n=t.parent;n&&(t.mark?(a(r,t,n),e(n)):t.mark=!0)}(t,o)),r(n.key,t.key)&&(t=n),t),this.extractMinimum()};var o=function(e,r){e.left.right=e.right,e.right.left=e.left,e.parent=r,r.child?(e.left=r.child,e.right=r.child.right,r.child.right=e,e.right.left=e):(r.child=e,e.right=e,e.left=e),r.degree++,e.mark=!1};return i},{isClass:!0}),mK="index",m0=ef(mK,["typed","Index"],e=>{var{typed:r,Index:t}=e;return r(mK,{"...number | string | BigNumber | Range | Array | Matrix":function(e){var r=e.map(function(e){return D(e)?e.toNumber():M(e)||F(e)?e.map(function(e){return D(e)?e.toNumber():e}):e}),n=new t;return t.apply(n,r),n}})}),m1="invmod",m2=ef(m1,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],e=>{var{typed:r,config:t,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:u,isInteger:l}=e;return r(m1,{"number, number":c,"BigNumber, BigNumber":c});function c(e,r){if(!l(e)||!l(r))throw Error("Parameters in function invmod must be integer numbers");if(e=s(e,r),a(r,0))throw Error("Divisor must be non zero");var t=i(e,r),[c,f]=t=t.valueOf();return a(c,n(1))?(o(f=s(f,r),n(0))&&(f=u(f,r)),f):NaN}}),m3=ef("lcm",["typed","matrix","equalScalar","concat"],e=>{var{typed:r,matrix:t,equalScalar:n,concat:i}=e,a=nm({typed:r,equalScalar:n}),o=nh({typed:r,equalScalar:n}),s=np({typed:r,equalScalar:n}),u=ni({typed:r,matrix:t,concat:i}),l="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(l,", ").concat(l,", ...").concat(l)]=r.referToSelf(e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i}),r("lcm",{"number, number":s6,"BigNumber, BigNumber":function(e,r){if(!e.isInt()||!r.isInt())throw Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(r.isZero())return r;for(var t=e.times(r);!r.isZero();){var n=r;r=e.mod(n),e=n}return t.div(e).abs()},"Fraction, Fraction":(e,r)=>e.lcm(r)},u({SS:o,DS:a,Ss:s}),c)}),m5="log1p",m4=ef(m5,["typed","config","divideScalar","log","Complex"],e=>{var{typed:r,config:t,divideScalar:n,log:i,Complex:a}=e;return r(m5,{number:function(e){return e>=-1||t.predictable?ew(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var r=e.plus(1);return!r.isNegative()||t.predictable?r.ln():o(new a(e.toNumber(),0))},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e)),"any, any":r.referToSelf(e=>(r,t)=>n(e(r),i(t)))});function o(e){var r=e.re+1;return new a(Math.log(Math.sqrt(r*r+e.im*e.im)),Math.atan2(e.im,r))}}),m8="lsolveAll",m6=ef(m8,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=mD({DenseMatrix:s});return r(m8,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=[u(e,r,!0)._data.map(e=>e[0])],l=e._size[0],c=e._size[1],f=e._values,m=e._index,p=e._ptr,h=0;h<c;h++)for(var d=t.length,g=0;g<d;g++){for(var v=t[g],y=[],x=[],b=p[h],w=p[h+1],D=0,N=b;N<w;N++){var E=m[N];E===h?D=f[N]:E>h&&(y.push(f[N]),x.push(E))}if(o(D,0))if(o(v[h],0)){if(0===g){var A=[...v];A[h]=1;for(var C=0,S=x.length;C<S;C++){var M=x[C];A[M]=a(A[M],y[C])}t.push(A)}}else{if(0===g)return[];t.splice(g,1),g-=1,d-=1}else{v[h]=n(v[h],D);for(var F=0,T=x.length;F<T;F++){var B=x[F];v[B]=a(v[B],i(v[h],y[F]))}}}return t.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).map(e=>e.valueOf())}});function l(e,r){for(var t=[u(e,r,!0)._data.map(e=>e[0])],l=e._data,c=e._size[0],f=e._size[1],m=0;m<f;m++)for(var p=t.length,h=0;h<p;h++){var d=t[h];if(o(l[m][m],0))if(o(d[m],0)){if(0===h){var g=[...d];g[m]=1;for(var v=m+1;v<f;v++)g[v]=a(g[v],l[v][m]);t.push(g)}}else{if(0===h)return[];t.splice(h,1),h-=1,p-=1}else{d[m]=n(d[m],l[m][m]);for(var y=m+1;y<f;y++)d[y]=a(d[y],i(d[m],l[y][m]))}}return t.map(e=>new s({data:e.map(e=>[e]),size:[c,1]}))}}),m7="matrixFromRows",m9=ef(m7,["typed","matrix","flatten","size"],e=>{var{typed:r,matrix:t,flatten:n,size:i}=e;return r(m7,{"...Array":function(e){return a(e)},"...Matrix":function(e){return t(a(e.map(e=>e.toArray())))}});function a(e){if(0===e.length)throw TypeError("At least one row is needed to construct a matrix.");var r=o(e[0]),t=[];for(var i of e){var a=o(i);if(a!==r)throw TypeError("The vectors had different length: "+(0|r)+" â "+(0|a));t.push(n(i))}return t}function o(e){var r=i(e);if(1===r.length)return r[0];if(2===r.length)if(1===r[0])return r[1];else if(1===r[1])return r[0];else throw TypeError("At least one of the arguments is not a vector.");throw TypeError("Only one- or two-dimensional vectors are supported.")}}),pe="multiply",pr=ef(pe,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=np({typed:r,equalScalar:a}),u=nt({typed:r});function l(e,r){switch(e.length){case 1:switch(r.length){case 1:if(e[0]!==r[0])throw RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==r[0])throw RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+r[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}
1break;case 2:switch(r.length){case 1:if(e[1]!==r[0])throw RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+r[0]+")");break;case 2:if(e[1]!==r[0])throw RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+r[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}var c=r("_multiplyMatrixVector",{"DenseMatrix, any":function(e,t){var a,o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._data,c=t._datatype||t.getDataType(),f=s[0],m=s[1],p=n,h=i;u&&c&&u===c&&"string"==typeof u&&"mixed"!==u&&(a=u,p=r.find(n,[a,a]),h=r.find(i,[a,a]));for(var d=[],g=0;g<f;g++){for(var v=o[g],y=h(v[0],l[0]),x=1;x<m;x++)y=p(y,h(v[x],l[x]));d[g]=y}return e.createDenseMatrix({data:d,size:[f],datatype:u===e._datatype&&c===t._datatype?a:void 0})},"SparseMatrix, any":function(e,t){var o,s=e._values,u=e._index,l=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!s)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=t._data,m=t._datatype||t.getDataType(),p=e._size[0],h=t._size[0],d=[],g=[],v=[],y=n,x=i,b=a,w=0;c&&m&&c===m&&"string"==typeof c&&"mixed"!==c&&(o=c,y=r.find(n,[o,o]),x=r.find(i,[o,o]),b=r.find(a,[o,o]),w=r.convert(0,o));var D=[],N=[];v[0]=0;for(var E=0;E<h;E++){var A=f[E];if(!b(A,w))for(var C=l[E],S=l[E+1],M=C;M<S;M++){var F=u[M];N[F]?D[F]=y(D[F],x(A,s[M])):(N[F]=!0,g.push(F),D[F]=x(A,s[M]))}}for(var T=g.length,B=0;B<T;B++){var O=g[B];d[B]=D[O]}return v[1]=g.length,e.createSparseMatrix({values:d,index:g,ptr:v,size:[p,1],datatype:c===e._datatype&&m===t._datatype?o:void 0})}}),f=r("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,t){var a,o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._data,c=t._size,f=t._datatype||t.getDataType(),m=s[0],p=s[1],h=c[1],d=n,g=i;u&&f&&u===f&&"string"==typeof u&&"mixed"!==u&&"mixed"!==u&&(a=u,d=r.find(n,[a,a]),g=r.find(i,[a,a]));for(var v=[],y=0;y<m;y++){var x=o[y];v[y]=[];for(var b=0;b<h;b++){for(var w=g(x[0],l[0][b]),D=1;D<p;D++)w=d(w,g(x[D],l[D][b]));v[y][b]=w}}return e.createDenseMatrix({data:v,size:[m,h],datatype:u===e._datatype&&f===t._datatype?a:void 0})},"DenseMatrix, SparseMatrix":function(e,t){var o,s=e._data,u=e._size,l=e._datatype||e.getDataType(),c=t._values,f=t._index,m=t._ptr,p=t._size,h=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!c)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");var d=u[0],g=p[1],v=n,y=i,x=a,b=0;l&&h&&l===h&&"string"==typeof l&&"mixed"!==l&&(o=l,v=r.find(n,[o,o]),y=r.find(i,[o,o]),x=r.find(a,[o,o]),b=r.convert(0,o));for(var w=[],D=[],N=[],E=t.createSparseMatrix({values:w,index:D,ptr:N,size:[d,g],datatype:l===e._datatype&&h===t._datatype?o:void 0}),A=0;A<g;A++){N[A]=D.length;var C=m[A],S=m[A+1];if(S>C)for(var M=0,F=0;F<d;F++){for(var T=F+1,B=void 0,O=C;O<S;O++){var _=f[O];M!==T?(B=y(s[F][_],c[O]),M=T):B=v(B,y(s[F][_],c[O]))}M!==T||x(B,b)||(D.push(F),w.push(B))}}return N[g]=D.length,E},"SparseMatrix, DenseMatrix":function(e,t){var o,s=e._values,u=e._index,l=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!s)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var f=t._data,m=t._datatype||t.getDataType(),p=e._size[0],h=t._size[0],d=t._size[1],g=n,v=i,y=a,x=0;c&&m&&c===m&&"string"==typeof c&&"mixed"!==c&&(o=c,g=r.find(n,[o,o]),v=r.find(i,[o,o]),y=r.find(a,[o,o]),x=r.convert(0,o));for(var b=[],w=[],D=[],N=e.createSparseMatrix({values:b,index:w,ptr:D,size:[p,d],datatype:c===e._datatype&&m===t._datatype?o:void 0}),E=[],A=[],C=0;C<d;C++){D[C]=w.length;for(var S=C+1,M=0;M<h;M++){var F=f[M][C];if(!y(F,x))for(var T=l[M],B=l[M+1],O=T;O<B;O++){var _=u[O];A[_]!==S?(A[_]=S,w.push(_),E[_]=v(F,s[O])):E[_]=g(E[_],v(F,s[O]))}}for(var z=D[C],k=w.length,I=z;I<k;I++){var R=w[I];b[I]=E[R]}}return D[d]=w.length,N},"SparseMatrix, SparseMatrix":function(e,t){var a,o,s,u,l,c,f,m,p,h=e._values,d=e._index,g=e._ptr,v=e._datatype||void 0===e._data?e._datatype:e.getDataType(),y=t._values,x=t._index,b=t._ptr,w=t._datatype||void 0===t._data?t._datatype:t.getDataType(),D=e._size[0],N=t._size[1],E=h&&y,A=n,C=i;v&&w&&v===w&&"string"==typeof v&&"mixed"!==v&&(a=v,A=r.find(n,[a,a]),C=r.find(i,[a,a]));for(var S=E?[]:void 0,M=[],F=[],T=e.createSparseMatrix({values:S,index:M,ptr:F,size:[D,N],datatype:v===e._datatype&&w===t._datatype?a:void 0}),B=E?[]:void 0,O=[],_=0;_<N;_++){F[_]=M.length;var z=_+1;for(c=b[_],f=b[_+1],l=c;l<f;l++)if(p=x[l],E)for(s=g[p],u=g[p+1],o=s;o<u;o++)O[m=d[o]]!==z?(O[m]=z,M.push(m),B[m]=C(y[l],h[o])):B[m]=A(B[m],C(y[l],h[o]));else for(s=g[p],u=g[p+1],o=s;o<u;o++)O[m=d[o]]!==z&&(O[m]=z,M.push(m));if(E)for(var k=F[_],I=M.length,R=k;R<I;R++){var q=M[R];S[R]=B[q]}}return F[N]=M.length,T}});return r(pe,i,{"Array, Array":r.referTo("Matrix, Matrix",e=>(r,n)=>{l(eK(r),eK(n));var i=e(t(r),t(n));return F(i)?i.valueOf():i}),"Matrix, Matrix":function(e,t){var a=e.size(),s=t.size();if(l(a,s),1===a.length){if(1===s.length){if(0===a[0])throw Error("Cannot multiply two empty vectors");return o(e,t)}if("dense"!==t.storage())throw Error("Support for SparseMatrix not implemented");return function(e,t){var a,o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._data,c=t._size,f=t._datatype||t.getDataType(),m=s[0],p=c[1],h=n,d=i;u&&f&&u===f&&"string"==typeof u&&"mixed"!==u&&(a=u,h=r.find(n,[a,a]),d=r.find(i,[a,a]));for(var g=[],v=0;v<p;v++){for(var y=d(o[0],l[0][v]),x=1;x<m;x++)y=h(y,d(o[x],l[x][v]));g[v]=y}return e.createDenseMatrix({data:g,size:[p],datatype:u===e._datatype&&f===t._datatype?a:void 0})}(e,t)}return 1===s.length?c(e,t):f(e,t)},"Matrix, Array":r.referTo("Matrix,Matrix",e=>(r,n)=>e(r,t(n))),"Array, Matrix":r.referToSelf(e=>(r,n)=>e(t(r,n.storage()),n)),"SparseMatrix, any":function(e,r){return s(e,r,i,!1)},"DenseMatrix, any":function(e,r){return u(e,r,i,!1)},"any, SparseMatrix":function(e,r){return s(r,e,i,!0)},"any, DenseMatrix":function(e,r){return u(r,e,i,!0)},"Array, any":function(e,r){return u(t(e),r,i,!1).valueOf()},"any, Array":function(e,r){return u(t(r),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":r.referToSelf(e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i})})}),pt="setCartesian",pn=ef(pt,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(pt,{"Array | Matrix, Array | Matrix":function(e,r){var s=[];if(0!==n(t(e),new a(0))&&0!==n(t(r),new a(0))){var u=re(Array.isArray(e)?e:e.toArray()).sort(i),l=re(Array.isArray(r)?r:r.toArray()).sort(i);s=[];for(var c=0;c<u.length;c++)for(var f=0;f<l.length;f++)s.push([u[c],l[f]])}return Array.isArray(e)&&Array.isArray(r)?s:new o(s)}})}),pi="setDistinct",pa=ef(pi,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(pi,{"Array | Matrix":function(e){var r;if(0===n(t(e),new a(0)))r=[];else{var s=re(Array.isArray(e)?e:e.toArray()).sort(i);(r=[]).push(s[0]);for(var u=1;u<s.length;u++)0!==i(s[u],s[u-1])&&r.push(s[u])}return Array.isArray(e)?r:new o(r)}})}),po="setIsSubset",ps=ef(po,["typed","size","subset","compareNatural","Index"],e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(po,{"Array | Matrix, Array | Matrix":function(e,r){if(0===n(t(e),new a(0)))return!0;
1if(0===n(t(r),new a(0)))return!1;for(var o,s=ro(re(Array.isArray(e)?e:e.toArray()).sort(i)),u=ro(re(Array.isArray(r)?r:r.toArray()).sort(i)),l=0;l<s.length;l++){o=!1;for(var c=0;c<u.length;c++)if(0===i(s[l].value,u[c].value)&&s[l].identifier===u[c].identifier){o=!0;break}if(!1===o)return!1}return!0}})}),pu="setPowerset",pl=ef(pu,["typed","size","subset","compareNatural","Index"],e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(pu,{"Array | Matrix":function(e){if(0===n(t(e),new a(0)))return[];for(var r=re(Array.isArray(e)?e:e.toArray()).sort(i),o=[],s=0;s.toString(2).length<=r.length;)o.push(function(e,r){for(var t=[],n=0;n<r.length;n++)"1"===r[n]&&t.push(e[n]);return t}(r,s.toString(2).split("").reverse())),s++;for(var u=o,l=[],c=u.length-1;c>0;c--)for(var f=0;f<c;f++)u[f].length>u[f+1].length&&(l=u[f],u[f]=u[f+1],u[f+1]=l);return u}})});function pc(e,r,t,n,i,a,o){var s=0;for(t[o]=e;s>=0;){var u=t[o+s],l=t[n+u];-1===l?(s--,a[r++]=u):(t[n+u]=t[i+l],t[o+ ++s]=l)}return r}var pf=ef("csAmd",["add","multiply","transpose"],e=>{var{add:r,multiply:t,transpose:n}=e;return function(e,o){if(!o||e<=0||e>3)return null;var s,u,l,c,f,m,p,h,d,g,v,y,x,b,w,D,N=o._size,E=N[0],A=N[1],C=0,S=Math.max(16,10*Math.sqrt(A));S=Math.min(A-2,S);var M=function(e,i,a,o,s){var u=n(i);if(1===e&&o===a)return r(i,u);if(2===e){for(var l=u._index,c=u._ptr,f=0,m=0;m<a;m++){var p=c[m];if(c[m]=f,!(c[m+1]-p>s))for(var h=c[m+1];p<h;p++)l[f++]=l[p]}c[a]=f,i=n(u)}return t(u,i)}(e,o,E,A,S);!function(e,r,t){for(var n=e._values,i=e._index,a=e._ptr,o=e._size[1],s=0,u=0;u<o;u++){var l=a[u];for(a[u]=s;l<a[u+1];l++)r(i[l],u,n?n[l]:1,null)&&(i[s]=i[l],n&&(n[s]=n[l]),s++)}a[o]=s,i.splice(s,i.length-s),n&&n.splice(s,n.length-s)}(M,a,0);for(var F=M._index,T=M._ptr,B=T[A],O=[],_=[],z=A+1,k=2*(A+1),I=3*(A+1),R=4*(A+1),q=5*(A+1),P=6*(A+1),j=7*(A+1),U=function(e,r,t,n,a,o,s,u,l,c,f,m){for(var p=0;p<e;p++)t[0+p]=r[p+1]-r[p];t[n+e]=0;for(var h=0;h<=e;h++)t[a+h]=-1,o[h]=-1,t[s+h]=-1,t[u+h]=-1,t[l+h]=1,t[c+h]=1,t[f+h]=0,t[m+h]=t[n+h];var d=i(0,0,t,c,e);return t[f+e]=-2,r[e]=-1,t[c+e]=0,d}(A,T,_,0,I,O,k,j,z,P,R,q),L=function(e,r,t,n,i,a,o,s,u,l,c){for(var f=0,m=0;m<e;m++){var p=t[n+m];if(0===p)t[i+m]=-2,f++,r[m]=-1,t[a+m]=0;else if(p>o)t[s+m]=0,t[i+m]=-1,f++,r[m]=-e-2,t[s+e]++;else{var h=t[u+p];-1!==h&&(l[h]=m),t[c+m]=t[u+p],t[u+p]=m}}return f}(A,T,_,q,R,P,S,z,I,O,k),$=0;L<A;){for(l=-1;$<A&&-1===(l=_[I+$]);$++);-1!==_[k+l]&&(O[_[k+l]]=-1),_[I+$]=_[k+l];var H=_[R+l],G=_[z+l];L+=G;var Z=0;_[z+l]=-G;var V=T[l],W=0===H?V:B,J=W;for(c=1;c<=H+1;c++){for(c>H?(m=l,p=V,h=_[0+l]-H):(p=T[m=F[V++]],h=_[0+m]),f=1;f<=h;f++)(d=_[z+(s=F[p++])])<=0||(Z+=d,_[z+s]=-d,F[J++]=s,-1!==_[k+s]&&(O[_[k+s]]=O[s]),-1!==O[s]?_[k+O[s]]=_[k+s]:_[I+_[q+s]]=_[k+s]);m!==l&&(T[m]=-l-2,_[P+m]=0)}for(0!==H&&(B=J),_[q+l]=Z,T[l]=W,_[0+l]=J-W,_[R+l]=-2,U=i(U,C,_,P,A),g=W;g<J;g++)if(!((v=_[R+(s=F[g])])<=0)){var Y=U-(d=-_[z+s]);for(V=T[s],y=T[s]+v-1;V<=y;V++)_[P+(m=F[V])]>=U?_[P+m]-=d:0!==_[P+m]&&(_[P+m]=_[q+m]+Y)}for(g=W;g<J;g++){for(w=0,x=(y=T[s=F[g]])+_[R+s]-1,b=y,D=0,V=y;V<=x;V++)if(0!==_[P+(m=F[V])]){var X=_[P+m]-U;X>0?(D+=X,F[b++]=m,w+=m):(T[m]=-l-2,_[P+m]=0)}_[R+s]=b-y+1;var Q=b,K=y+_[0+s];for(V=x+1;V<K;V++){var ee=_[z+(u=F[V])];ee<=0||(D+=ee,F[b++]=u,w+=u)}0===D?(T[s]=-l-2,Z-=d=-_[z+s],G+=d,L+=d,_[z+s]=0,_[R+s]=-1):(_[q+s]=Math.min(_[q+s],D),F[b]=F[Q],F[Q]=F[y],F[y]=l,_[0+s]=b-y+1,w=(w<0?-w:w)%A,_[k+s]=_[j+w],_[j+w]=s,O[s]=w)}for(_[q+l]=Z,U=i(U+(C=Math.max(C,Z)),C,_,P,A),g=W;g<J;g++)if(!(_[z+(s=F[g])]>=0))for(s=_[j+(w=O[s])],_[j+w]=-1;-1!==s&&-1!==_[k+s];s=_[k+s],U++){for(h=_[0+s],v=_[R+s],V=T[s]+1;V<=T[s]+h-1;V++)_[P+F[V]]=U;var er=s;for(u=_[k+s];-1!==u;){var et=_[0+u]===h&&_[R+u]===v;for(V=T[u]+1;et&&V<=T[u]+h-1;V++)_[P+F[V]]!==U&&(et=0);et?(T[u]=-s-2,_[z+s]+=_[z+u],_[z+u]=0,_[R+u]=-1,u=_[k+u],_[k+er]=u):(er=u,u=_[k+u])}}for(V=W,g=W;g<J;g++)(d=-_[z+(s=F[g])])<=0||(_[z+s]=d,D=Math.min(D=_[q+s]+Z-d,A-L-d),-1!==_[I+D]&&(O[_[I+D]]=s),_[k+s]=_[I+D],O[s]=-1,_[I+D]=s,$=Math.min($,D),_[q+s]=D,F[V++]=s);_[z+l]=G,0==(_[0+l]=V-W)&&(T[l]=-1,_[P+l]=0),0!==H&&(B=V)}for(s=0;s<A;s++)T[s]=-T[s]-2;for(u=0;
1u<=A;u++)_[I+u]=-1;for(u=A;u>=0;u--)_[z+u]>0||(_[k+u]=_[I+T[u]],_[I+T[u]]=u);for(m=A;m>=0;m--)_[z+m]<=0||-1!==T[m]&&(_[k+m]=_[I+T[m]],_[I+T[m]]=m);for(l=0,s=0;s<=A;s++)-1===T[s]&&(l=pc(s,l,_,I,k,O,P));return O.splice(O.length-1,1),O};function i(e,r,t,n,i){if(e<2||e+r<0){for(var a=0;a<i;a++)0!==t[n+a]&&(t[n+a]=1);e=2}return e}function a(e,r){return e!==r}}),pm=ef("csCounts",["transpose"],e=>{var{transpose:r}=e;return function(e,t,n,i){if(!e||!t||!n)return null;var a,o,s,u,l,c,f,m=e._size,p=m[0],h=m[1],d=4*h+(i?h+p+1:0),g=[],v=2*h,y=3*h,x=4*h,b=5*h+1;for(s=0;s<d;s++)g[s]=-1;var w=[],D=r(e),N=D._index,E=D._ptr;for(s=0;s<h;s++)for(w[o=n[s]]=+(-1===g[y+o]);-1!==o&&-1===g[y+o];o=t[o])g[y+o]=s;if(i){for(s=0;s<h;s++)g[n[s]]=s;for(a=0;a<p;a++){for(s=h,c=E[a],f=E[a+1],l=c;l<f;l++)s=Math.min(s,g[N[l]]);g[b+a]=g[x+s],g[x+s]=a}}for(a=0;a<h;a++)g[0+a]=a;for(s=0;s<h;s++){for(-1!==t[o=n[s]]&&w[t[o]]--,u=i?g[x+s]:o;-1!==u;u=i?g[b+u]:-1)for(l=E[u];l<E[u+1];l++){var A=function(e,r,t,n,i,a,o){var s,u,l,c=0;if(e<=r||t[n+r]<=t[i+e])return -1;t[i+e]=t[n+r];var f=t[a+e];if(t[a+e]=r,-1===f)c=1,l=e;else{for(c=2,l=f;l!==t[0+l];l=t[0+l]);for(s=f;s!==l;s=u)u=t[o+s],t[o+s]=l}return{jleaf:c,q:l}}(a=N[l],o,g,y,h,v,0);A.jleaf>=1&&w[o]++,2===A.jleaf&&w[A.q]--}-1!==t[o]&&(g[0+o]=t[o])}for(o=0;o<h;o++)-1!==t[o]&&(w[t[o]]+=w[o]);return w}}),pp=ef("csSqr",["add","multiply","transpose"],e=>{var{add:r,multiply:t,transpose:n}=e,i=pf({add:r,multiply:t,transpose:n}),a=pm({transpose:n});return function(e,r,t){var n,o=r._ptr,s=r._size[1],u={};if(u.q=i(e,r),e&&!u.q)return null;if(t){var l=e?function(e,r,t,n){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,u=e._datatype,l=s[0],c=s[1],f=[],m=[],p=0,h=0;h<c;h++){m[h]=p;for(var d=t?t[h]:h,g=o[d],v=o[d+1],y=g;y<v;y++){var x=a[y];f[p]=x,p++}}return m[c]=p,e.createSparseMatrix({values:null,index:f,ptr:m,size:[l,c],datatype:u})}(r,0,u.q,0):r;u.parent=function(e,r){if(!e)return null;var t,n,i=e._index,a=e._ptr,o=e._size,s=o[0],u=o[1],l=[],c=[];for(t=0;t<s;t++)c[u+t]=-1;for(var f=0;f<u;f++){l[f]=-1,c[0+f]=-1;for(var m=a[f],p=a[f+1],h=m;h<p;h++){var d=i[h];for(t=(0,c[u+d]);-1!==t&&t<f;t=n)n=c[0+t],c[0+t]=f,-1===n&&(l[t]=f);r&&(c[u+d]=f)}}return l}(l,1);var c=function(e,r){if(!e)return null;var t,n=0,i=[],a=[],o=2*r;for(t=0;t<r;t++)a[0+t]=-1;for(t=r-1;t>=0;t--)-1!==e[t]&&(a[r+t]=a[0+e[t]],a[0+e[t]]=t);for(t=0;t<r;t++)-1===e[t]&&(n=pc(t,n,a,0,r,i,o));return i}(u.parent,s);if(u.cp=a(l,u.parent,c,1),l&&u.parent&&u.cp&&function(e,r){var t,n,i,a,o,s=e._ptr,u=e._index,l=e._size,c=l[0],f=l[1];r.pinv=[],r.leftmost=[];var m=r.parent,p=r.pinv,h=r.leftmost,d=[],g=c+f,v=c+2*f;for(n=0;n<f;n++)d[c+n]=-1,d[g+n]=-1,d[v+n]=0;for(t=0;t<c;t++)h[t]=-1;for(n=f-1;n>=0;n--)for(a=s[n],o=s[n+1],i=a;i<o;i++)h[u[i]]=n;for(t=c-1;t>=0;t--)p[t]=-1,-1!==(n=h[t])&&(0==d[v+n]++&&(d[g+n]=t),d[0+t]=d[c+n],d[c+n]=t);for(n=0,r.lnz=0,r.m2=c;n<f;n++)if(t=d[c+n],r.lnz++,t<0&&(t=r.m2++),p[t]=n,!(--v[n]<=0)){r.lnz+=d[v+n];var y=m[n];-1!==y&&(0===d[v+y]&&(d[g+y]=d[g+n]),d[0+d[g+n]]=d[c+y],d[c+y]=d[0+t],d[v+y]+=d[v+n])}for(t=0;t<c;t++)p[t]<0&&(p[t]=n++);return!0}(l,u))for(u.unz=0,n=0;n<s;n++)u.unz+=u.cp[n]}else u.unz=4*o[s]+s,u.lnz=u.unz;return u}});function ph(e,r){e[r]=-e[r]-2}var pd=ef("csSpsolve",["divideScalar","multiply","subtract"],e=>{var{divideScalar:r,multiply:t,subtract:n}=e;return function(e,i,a,o,s,u,l){var c,f,m,p,h=e._values,d=e._index,g=e._ptr,v=e._size[1],y=i._values,x=i._index,b=i._ptr,w=function(e,r,t,n,i){var a,o,s,u=e._ptr,l=e._size,c=r._index,f=r._ptr,m=l[1],p=m;for(o=f[t],s=f[t+1],a=o;a<s;a++){var h=c[a];u[h]<0||(p=function(e,r,t,n,i){var a,o,s,u=r._index,l=r._ptr,c=r._size[1],f=0;for(n[0]=e;f>=0;){e=n[f];var m,p,h=i?i[e]:e;l[e]<0||(ph(l,e),n[c+f]=h<0?0:(m=l[h])<0?-m-2:m);var d=1;for(o=n[c+f],s=h<0?0:(p=l[h+1])<0?-p-2:p;o<s;o++)if(!(l[a=u[o]]<0)){n[c+f]=o,n[++f]=a,d=0;break}d&&(f--,n[--t]=e)}return t}(h,e,p,n,i))}for(a=p;a<m;a++)ph(u,n[a]);return p}(e,i,a,o,u);for(c=w;c<v;c++)s[o[c]]=0;for(f=b[a],m=b[a+1],c=f;c<m;c++)s[x[c]]=y[c];for(var D=w;D<v;D++){var N=o[D],E=u?u[N]:N;if(!(E<0))for(f=g[E],m=g[E+1],s[N]=r(s[N],h[l?f:m-1]),c=l?f+1:f,p=l?m:m-1;c<p;c++){var A=d[c];s[A]=n(s[A],t(h[c],s[N]))}}return w}}),pg=ef("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],e=>
1{var{abs:r,divideScalar:t,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,u=pd({divideScalar:t,multiply:n,subtract:i});return function(e,i,l){if(!e)return null;var c,f,m,p=e._size[1],h=100,d=100;i&&(c=i.q,h=i.lnz||h,d=i.unz||d);var g=[],v=[],y=[],x=new s({values:g,index:v,ptr:y,size:[p,p]}),b=[],w=[],D=[],N=new s({values:b,index:w,ptr:D,size:[p,p]}),E=[],A=[],C=[];for(f=0;f<p;f++)A[f]=0,E[f]=-1,y[f+1]=0;h=0,d=0;for(var S=0;S<p;S++){y[S]=h,D[S]=d;var M=c?c[S]:S,F=u(x,e,M,C,A,E,1),T=-1,B=-1;for(m=F;m<p;m++)if(E[f=C[m]]<0){var O=r(A[f]);a(O,B)&&(B=O,T=f)}else w[d]=E[f],b[d++]=A[f];if(-1===T||B<=0)return null;E[M]<0&&o(r(A[M]),n(B,l))&&(T=M);var _=A[T];for(w[d]=S,b[d++]=_,E[T]=S,v[h]=T,g[h++]=1,m=F;m<p;m++)E[f=C[m]]<0&&(v[h]=f,g[h++]=t(A[f],_)),A[f]=0}for(m=0,y[p]=h,D[p]=d;m<h;m++)v[m]=E[v[m]];return g.splice(h,g.length-h),v.splice(h,v.length-h),b.splice(d,b.length-d),w.splice(d,w.length-d),{L:x,U:N,pinv:E}}}),pv=ef("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],e=>{var{typed:r,abs:t,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:u,largerEq:l,SparseMatrix:c}=e,f=pp({add:n,multiply:i,transpose:a}),m=pg({abs:t,divideScalar:o,multiply:i,subtract:s,larger:u,largerEq:l,SparseMatrix:c});return r("slu",{"SparseMatrix, number, number":function(e,r,t){if(!eg(r)||r<0||r>3)throw Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(t<0||t>1)throw Error("Partial pivoting threshold must be a number from 0 to 1");var n=f(r,e,!1),i=m(e,n,t);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}),py="sort",px=ef(py,["typed","matrix","compare","compareNatural"],e=>{var{typed:r,matrix:t,compare:n,compareNatural:i}=e,a=(e,r)=>-n(e,r);return r(py,{Array:function(e){return s(e),e.sort(n)},Matrix:function(e){return u(e),t(e.toArray().sort(n),e.storage())},"Array, function":function(e,r){return s(e),e.sort(r)},"Matrix, function":function(e,r){return u(e),t(e.toArray().sort(r),e.storage())},"Array, string":function(e,r){return s(e),e.sort(o(r))},"Matrix, string":function(e,r){return u(e),t(e.toArray().sort(o(r)),e.storage())}});function o(e){if("asc"===e)return n;if("desc"===e)return a;
1if("natural"===e)return i;throw Error('String "asc", "desc", or "natural" expected')}function s(e){if(1!==eK(e).length)throw Error("One dimensional array expected")}function u(e){if(1!==e.size().length)throw Error("One dimensional matrix expected")}}),pb="unaryPlus",pw=ef(pb,["typed","config","numeric"],e=>{var{typed:r,config:t,numeric:n}=e;return r(pb,{number:s2,Complex:function(e){return e},BigNumber:function(e){return e},bigint:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0)),boolean:function(e){return n(+!!e,t.number)},string:function(e){return n(e,ev(e,t))}})}),pD="usolveAll",pN=ef(pD,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=mD({DenseMatrix:s});return r(pD,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=[u(e,r,!0)._data.map(e=>e[0])],l=e._size[0],c=e._size[1],f=e._values,m=e._index,p=e._ptr,h=c-1;h>=0;h--)for(var d=t.length,g=0;g<d;g++){for(var v=t[g],y=[],x=[],b=p[h],w=p[h+1],D=0,N=w-1;N>=b;N--){var E=m[N];E===h?D=f[N]:E<h&&(y.push(f[N]),x.push(E))}if(o(D,0))if(o(v[h],0)){if(0===g){var A=[...v];A[h]=1;for(var C=0,S=x.length;C<S;C++){var M=x[C];A[M]=a(A[M],y[C])}t.push(A)}}else{if(0===g)return[];t.splice(g,1),g-=1,d-=1}else{v[h]=n(v[h],D);for(var F=0,T=x.length;F<T;F++){var B=x[F];v[B]=a(v[B],i(v[h],y[F]))}}}return t.map(e=>new s({data:e.map(e=>[e]),size:[l,1]}))}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).map(e=>e.valueOf())}});function l(e,r){for(var t=[u(e,r,!0)._data.map(e=>e[0])],l=e._data,c=e._size[0],f=e._size[1],m=f-1;m>=0;m--)for(var p=t.length,h=0;h<p;h++){var d=t[h];if(o(l[m][m],0))if(o(d[m],0)){if(0===h){var g=[...d];g[m]=1;for(var v=m-1;v>=0;v--)g[v]=a(g[v],l[v][m]);t.push(g)}}else{if(0===h)return[];t.splice(h,1),h-=1,p-=1}else{d[m]=n(d[m],l[m][m]);for(var y=m-1;y>=0;y--)d[y]=a(d[y],i(d[m],l[y][m]))}}return t.map(e=>new s({data:e.map(e=>[e]),size:[c,1]}))}}),pE="zpk2tf",pA=ef(pE,["typed","add","multiply","Complex","number"],e=>{var{typed:r,add:t,multiply:n,Complex:i,number:a}=e;return r(pE,{"Array,Array,number":function(e,r,t){return o(e,r,t)},"Array,Array":function(e,r){return o(e,r,1)},"Matrix,Matrix,number":function(e,r,t){return o(e.valueOf(),r.valueOf(),t)},"Matrix,Matrix":function(e,r){return o(e.valueOf(),r.valueOf(),1)}});function o(e,r,t){e.some(e=>"BigNumber"===e.type)&&(e=e.map(e=>a(e))),r.some(e=>"BigNumber"===e.type)&&(r=r.map(e=>a(e)));for(var o=[i(1,0)],u=[i(1,0)],l=0;l<e.length;l++){var c=e[l];"number"==typeof c&&(c=i(c,0)),o=s(o,[i(1,0),i(-c.re,-c.im)])}for(var f=0;f<r.length;f++){var m=r[f];"number"==typeof m&&(m=i(m,0)),u=s(u,[i(1,0),i(-m.re,-m.im)])}for(var p=0;p<o.length;p++)o[p]=n(o[p],t);return[o,u]}function s(e,r){for(var a=[],o=0;o<e.length+r.length-1;o++){a[o]=i(0,0);for(var s=0;s<e.length;s++)o-s>=0&&o-s<r.length&&(a[o]=t(a[o],n(e[s],r[o-s])))}return a}}),pC="ceil",pS=new a5(10),pM=ef(pC,["typed","config","round"],e=>{var{typed:r,config:t,round:n}=e;function i(e){var r=Math.ceil(e),i=n(e);return r===i?r:eO(e,i,t.relTol,t.absTol)&&!eO(e,r,t.relTol,t.absTol)?i:r}return r(pC,{number:i,"number, number":function(e,r){if(!eg(r))throw RangeError("number of decimals in function ceil must be an integer");if(r<0||r>15)throw RangeError("number of decimals in ceil number must be in range 0-15");var t=10**r;return i(e*t)/t}})}),pF=ef(pC,["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=np({typed:r,equalScalar:a}),l=t9({typed:r,DenseMatrix:s}),c=nt({typed:r}),f=pM({typed:r,config:t,round:n});function m(e){var r=(e,r)=>u4(e,r,t.relTol,t.absTol),i=e.ceil(),a=n(e);return i.eq(a)?i:r(e,a)&&!r(e,i)?a:i}return r("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,r){return e.ceil(r)},"Complex, BigNumber":function(e,r){return e.ceil(r.toNumber())},BigNumber:m,"BigNumber, BigNumber":function(e,r){var t=pS.pow(r);return m(e.mul(t)).div(t)},bigint:e=>e,"bigint, number":(e,r)=>e,"bigint, BigNumber":(e,r)=>e,Fraction:function(e){return e.ceil()},"Fraction, number":function(e,r){return e.ceil(r)},"Fraction, BigNumber":function(e,r){return e.ceil(r.toNumber())},"Unit, number, Unit":r.referToSelf(e=>function(r,t,n){var i=r.toNumeric(n);return n.multiply(e(i,t))}),"Unit, BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>e(r,t.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>tr(r,r=>e(r,t,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(e=>(r,t)=>e(r,0,t)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0)),"Array, number | BigNumber":r.referToSelf(e=>(r,t)=>tr(r,r=>e(r,t),!0)),"SparseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>
1u(r,t,e,!1)),"DenseMatrix, number | BigNumber":r.referToSelf(e=>(r,t)=>c(r,t,e,!1)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(e=>(r,t)=>c(i(t),r,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(e=>(r,t)=>a(r,0)?o(t.size(),t.storage()):"dense"===t.storage()?c(t,r,e,!0):l(t,r,e,!0))})}),pT="cross",pB=ef(pT,["typed","matrix","subtract","multiply"],e=>{var{typed:r,matrix:t,subtract:n,multiply:i}=e;return r(pT,{"Matrix, Matrix":function(e,r){return t(a(e.toArray(),r.toArray()))},"Matrix, Array":function(e,r){return t(a(e.toArray(),r))},"Array, Matrix":function(e,r){return t(a(e,r.toArray()))},"Array, Array":a});function a(e,r){var t=Math.max(eK(e).length,eK(r).length);e=e7(e),r=e7(r);var a=eK(e),o=eK(r);if(1!==a.length||1!==o.length||3!==a[0]||3!==o[0])throw RangeError("Vectors with length 3 expected (Size A = ["+a.join(", ")+"], B = ["+o.join(", ")+"])");var s=[n(i(e[1],r[2]),i(e[2],r[1])),n(i(e[2],r[0]),i(e[0],r[2])),n(i(e[0],r[1]),i(e[1],r[0]))];return t>1?[s]:s}}),pO=ef("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:i,divideScalar:a,isZero:s,unaryMinus:u}=e;return r("det",{any:function(e){return o(e)},"Array | Matrix":function(e){var r;switch((r=F(e)?e.size():Array.isArray(e)?(e=t(e)).size():[]).length){case 0:return o(e);case 1:if(1===r[0])return o(e.valueOf()[0]);if(0===r[0])return 1;throw RangeError("Matrix must be square (size: "+eH(r)+")");case 2:var l=r[0],c=r[1];if(l===c)return function(e,r,t){if(1===r)return o(e[0][0]);if(2===r)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var l=!1,c=Array(r).fill(0).map((e,r)=>r),f=0;f<r;f++){var m=c[f];if(s(e[m][f])){var p=void 0;for(p=f+1;p<r;p++)if(!s(e[c[p]][f])){m=c[p],c[p]=c[f],c[f]=m,l=!l;break}if(p===r)return e[m][f]}for(var h=e[m][f],d=0===f?1:e[c[f-1]][f-1],g=f+1;g<r;g++)for(var v=c[g],y=f+1;y<r;y++)e[v][y]=a(n(i(e[v][y],h),i(e[v][f],e[m][y])),d)}var x=e[c[r-1]][r-1];return l?u(x):x}(e.clone().valueOf(),l,0);if(0===c)return 1;throw RangeError("Matrix must be square (size: "+eH(r)+")");default:throw RangeError("Matrix must be two dimensional (size: "+eH(r)+")")}}})}),p_=ef("fix",["typed","ceil","floor"],e=>{var{typed:r,ceil:t,floor:n}=e;return r("fix",{number:function(e){return e>0?n(e):t(e)},"number, number":function(e,r){return e>0?n(e,r):t(e,r)}})}),pz=ef("fix",["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],e=>{var{typed:r,Complex:t,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:u}=e,l=t9({typed:r,DenseMatrix:u}),c=nt({typed:r}),f=p_({typed:r,ceil:i,floor:a});return r("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new t(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,r){return new t(e.re>0?a(e.re,r):i(e.re,r),e.im>0?a(e.im,r):i(e.im,r))},"Complex, BigNumber":function(e,r){var n=r.toNumber();return new t(e.re>0?a(e.re,n):i(e.re,n),e.im>0?a(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,r){return e.isNegative()?i(e,r):a(e,r)},bigint:e=>e,"bigint, number":(e,r)=>e,"bigint, BigNumber":(e,r)=>e,Fraction:function(e){return e.s<0n?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,r){return e.s<0n?i(e,r):a(e,r)},"Unit, number, Unit":r.referToSelf(e=>function(r,t,n){var i=r.toNumeric(n);return n.multiply(e(i,t))}),"Unit, BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>e(r,t.toNumber(),n)),"Array | Matrix, number | BigNumber, Unit":r.referToSelf(e=>(r,t,n)=>tr(r,r=>e(r,t,n),!0)),"Array | Matrix | Unit, Unit":r.referToSelf(e=>(r,t)=>e(r,0,t)),"Array | Matrix":r.referToSelf(e=>r=>tr(r,e,!0)),"Array | Matrix, number | BigNumber":r.referToSelf(e=>(r,t)=>tr(r,r=>e(r,t),!0)),"number | Complex | Fraction | BigNumber, Array":r.referToSelf(e=>(r,t)=>c(n(t),r,e,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf(e=>(r,t)=>o(r,0)?s(t.size(),t.storage()):"dense"===t.storage()?c(t,r,e,!0):l(t,r,e,!0))})}),pk=ef("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],e=>{var{typed:r,matrix:t,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:u,abs:l}=e;return r("inv",{"Array | Matrix":function(e){var r=F(e)?e.size():eK(e);switch(r.length){case 1:if(1===r[0])if(F(e))return t([n(1,e.valueOf()[0])]);else return[n(1,e[0])];throw RangeError("Matrix must be square (size: "+eH(r)+")");case 2:var i=r[0],a=r[1];if(i===a)if(F(e))return t(c(e.valueOf(),i,a),e.storage());else return c(e,i,a);throw RangeError("Matrix must be square (size: "+eH(r)+")");
1default:throw RangeError("Matrix must be two dimensional (size: "+eH(r)+")")}},any:function(e){return n(1,e)}});function c(e,r,t){if(1===r){if(0===(p=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,p)]]}if(2===r){var c,f,m,p,h,d=s(e);if(0===d)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],d),n(o(e[0][1]),d)],[n(o(e[1][0]),d),n(e[0][0],d)]]}var g=e.concat();for(c=0;c<r;c++)g[c]=g[c].concat();for(var v=u(r).valueOf(),y=0;y<t;y++){var x=l(g[y][y]),b=y;for(c=y+1;c<r;)l(g[c][y])>x&&(x=l(g[c][y]),b=c),c++;if(0===x)throw Error("Cannot calculate inverse, determinant is zero");(c=b)!==y&&(h=g[y],g[y]=g[c],g[c]=h,h=v[y],v[y]=v[c],v[c]=h);var w=g[y],D=v[y];for(c=0;c<r;c++){var N=g[c],E=v[c];if(c!==y){if(0!==N[y]){for(m=n(o(N[y]),w[y]),f=y;f<t;f++)N[f]=i(N[f],a(m,w[f]));for(f=0;f<t;f++)E[f]=i(E[f],a(m,D[f]))}}else{for(m=w[y],f=y;f<t;f++)N[f]=n(N[f],m);for(f=0;f<t;f++)E[f]=n(E[f],m)}}}return v}}),pI="pinv",pR=ef(pI,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],e=>{var{typed:r,matrix:t,inv:n,deepEqual:i,equal:a,dotDivide:s,dot:u,ctranspose:l,divideScalar:c,multiply:f,add:m,Complex:p}=e;return r(pI,{"Array | Matrix":function(e){var r=F(e)?e.size():eK(e);switch(r.length){case 1:if(g(e))return l(e);if(1===r[0])return n(e);return s(l(e),u(e,e));case 2:if(g(e))return l(e);var i=r[0],a=r[1];if(i===a)try{return n(e)}catch(e){if(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/));else throw e}if(F(e))return t(h(e.valueOf(),i,a),e.storage());return h(e,i,a);default:throw RangeError("Matrix must be two dimensional (size: "+eH(r)+")")}},any:function(e){return a(e,0)?o(e):c(1,e)}});function h(e,r,t){var i,a,c,{C:p,F:h}=(c=function(e,r,t){for(var n=o(e),i=0,a=0;a<r&&!(t<=i);a++){for(var u=a;d(n[u][i]);)if(r===++u&&(u=a,t===++i))return n;[n[u],n[a]]=[n[a],n[u]];for(var l=n[a][i],c=0;c<t;c++)n[a][c]=s(n[a][c],l);for(var p=0;p<r;p++)if(p!==a){l=n[p][i];for(var h=0;h<t;h++)n[p][h]=m(n[p][h],f(-1,f(l,n[a][h])))}i++}return n}(i=e,a=r,t),{C:i.map((e,r)=>e.filter((e,r)=>r<a&&!d(u(c[r],c[r])))),F:c.filter((e,r)=>!d(u(c[r],c[r])))}),g=f(n(f(l(p),p)),l(p)),v=f(l(h),n(f(h,l(h))));return f(v,g)}function d(e){return a(m(e,p(1,1)),m(0,p(1,1)))}function g(e){return i(m(e,p(1,1)),m(f(e,0),p(1,1)))}}),pq=ef("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],e=>{var{typed:r,config:t,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:u,Complex:l}=e;return r("pow",{"number, number":c,"Complex, Complex":function(e,r){return e.pow(r)},"BigNumber, BigNumber":function(e,r){return r.isInteger()||e>=0||t.predictable?e.pow(r):new l(e.toNumber(),0).pow(r.toNumber(),0)},"bigint, bigint":(e,r)=>e**r,"Fraction, Fraction":function(e,r){var n=e.pow(r);if(null!=n)return n;if(!t.predictable)return c(e.valueOf(),r.valueOf());throw Error("Result of pow is non-rational and cannot be expressed as a fraction")},"Array, number":f,"Array, BigNumber":function(e,r){return f(e,r.toNumber())},"Matrix, number":m,"Matrix, BigNumber":function(e,r){return m(e,r.toNumber())},"Unit, number | BigNumber":function(e,r){return e.pow(r)}});function c(e,r){if(t.predictable&&!eg(r)&&e<0)try{var n=u(r),i=s(n);if((r===i||1e-14>Math.abs((r-i)/r))&&n.d%2n===1n)return(n.n%2n===0n?1:-1)*Math.pow(-e,r)}catch(e){}return t.predictable&&(e<-1&&r===1/0||e>-1&&e<0&&r===-1/0)?NaN:eg(r)||e>=0||t.predictable?ua(e,r):e*e<1&&r===1/0||e*e>1&&r===-1/0?0:new l(e,0).pow(r,0)}function f(e,r){if(!eg(r))throw TypeError("For A^b, b must be an integer (value is "+r+")");var t=eK(e);if(2!==t.length)throw Error("For A^b, A must be 2 dimensional (A has "+t.length+" dimensions)");if(t[0]!==t[1])throw Error("For A^b, A must be square (size is "+t[0]+"x"+t[1]+")");if(r<0)try{return f(o(e),-r)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+r+")");throw e}for(var a=n(t[0]).valueOf(),s=e;r>=1;)(1&r)==1&&(a=i(s,a)),r>>=1,s=i(s,s);return a}function m(e,r){return a(f(e.valueOf(),r))}}),pP="setDifference",pj=ef(pP,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(pP,{"Array | Matrix, Array | Matrix":function(e,r){var s;if(0===n(t(e),new a(0)))s=[];else{if(0===n(t(r),new a(0)))return re(e.toArray());var u,l=ro(re(Array.isArray(e)?e:e.toArray()).sort(i)),c=ro(re(Array.isArray(r)?r:r.toArray()).sort(i));s=[];for(var f=0;f<l.length;f++){u=!1;for(var m=0;m<c.length;m++)if(0===i(l[f].value,c[m].value)&&l[f].identifier===c[m].identifier){u=!0;break}u||s.push(l[f])}}return Array.isArray(e)&&Array.isArray(r)?rs(s):new o(rs(s))}})}),pU="setMultiplicity",pL=ef(pU,["typed","size","subset","compareNatural","Index"],e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(pU,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,r){if(0===n(t(r),new a(0)))return 0;for(var o=re(Array.isArray(r)?r:r.toArray()),s=0,u=0;u<o.length;u++)0===i(o[u],e)&&s++;return s}})}),p$="setSymDifference",pH=ef(p$,["typed","size","concat","subset","setDifference","Index"],e=>{var{typed:r,size:t,concat:n,subset:i,setDifference:a,Index:o}=e;return r(p$,{"Array | Matrix, Array | Matrix":function(e,r){if(0===i(t(e),new o(0)))return re(r);if(0===i(t(r),new o(0)))return re(e);var s=re(e),u=re(r);return n(a(s,u),a(u,s))}})}),pG=ef("Spa",["addScalar","equalScalar","FibonacciHeap"],e=>{var{addScalar:r,equalScalar:t,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(e,r){if(this._values[e])this._values[e].value=r;else{var t=this._heap.insert(e,r);this._values[e]=t}},i.prototype.get=function(e){var r=this._values[e];return r?r.value:0},i.prototype.accumulate=function(e,t){var n=this._values[e];n?n.value=r(n.value,t):(n=this._heap.insert(e,t),this._values[e]=n)},i.prototype.forEach=function(e,r,n){var i=this._heap,a=this._values,o=[],s=i.extractMinimum();for(s&&o.push(s);s&&s.key<=r;)s.key>=e&&!t(s.value,0)&&n(s.key,s.value,this),(s=i.extractMinimum())&&o.push(s);for(var u=0;u<o.length;u++){var l=o[u];a[(s=i.insert(l.key,l.value)).key]=s}},i.prototype.swap=function(e,r){var t=this._values[e],n=this._values[r];if(!t&&n)t=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=t,this._values[r]=void 0;else if(t&&!n)n=this._heap.insert(r,t.value),this._heap.remove(t),this._values[r]=n,this._values[e]=void 0;else if(t&&n){var i=t.value;
1t.value=n.value,n.value=i}},i},{isClass:!0}),pZ="sqrtm",pV=ef(pZ,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],e=>{var{typed:r,abs:t,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:u,size:l,max:c,identity:f}=e;return r(pZ,{"Array | Matrix":function(e){var r=F(e)?e.size():eK(e);switch(r.length){case 1:if(1===r[0])return a(e,o);throw RangeError("Matrix must be square (size: "+eH(r)+")");case 2:if(r[0]===r[1])return function(e){var r,a=0,o=e,m=f(l(e));do{var p=o;if(o=i(.5,n(p,u(m))),m=i(.5,n(m,u(p))),(r=c(t(s(o,p))))>1e-6&&++a>1e3)throw Error("computing square root of matrix: iterative method could not converge")}while(r>1e-6);return o}(e);throw RangeError("Matrix must be square (size: "+eH(r)+")");default:throw RangeError("Matrix must be at most two dimensional (size: "+eH(r)+")")}}})});function pW(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function pJ(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?pW(Object(t),!0).forEach(function(r){ed(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):pW(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}var pY=ef("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","toBest","number","Complex","BigNumber","Fraction"],e=>{var r,t,i,{on:a,config:s,addScalar:u,subtractScalar:c,multiplyScalar:f,divideScalar:m,pow:p,abs:h,fix:d,round:g,equal:v,isNumeric:y,format:x,toBest:b,number:w,Complex:D,BigNumber:N,Fraction:A}=e;function S(e,r){if(!(this instanceof S))throw Error("Constructor must be called with the new operator");if(!(null==e||y(e)||E(e)))throw TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===r)this.units=[],this.dimensions=P.map(e=>0);else if("string"==typeof r){var t=S.parse(r);this.units=t.units,this.dimensions=t.dimensions}else if(C(r)&&null===r.value)this.fixPrefix=r.fixPrefix,this.skipAutomaticSimplification=r.skipAutomaticSimplification,this.dimensions=r.dimensions.slice(0),this.units=r.units.map(e=>(0,n.A)({},e));else throw TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(e)}function M(){for(;" "===i||" "===i;)T()}function F(e){return e>="0"&&e<="9"}function T(){t++,i=r.charAt(t)}function B(e){t=e,i=r.charAt(t)}function O(){var e,r="",n=t;if("+"===i?T():"-"===i&&(r+=i,T()),!((e=i)>="0"&&e<="9"||"."===e))return B(n),null;if("."===i){if(r+=i,T(),!F(i))return B(n),null}else{for(;F(i);)r+=i,T();"."===i&&(r+=i,T())}for(;F(i);)r+=i,T();if("E"===i||"e"===i){var a="",o=t;if(a+=i,T(),("+"===i||"-"===i)&&(a+=i,T()),!F(i))return B(o),r;for(r+=a;F(i);)r+=i,T()}return r}function _(e){return i===e?(T(),e):null}Object.defineProperty(S,"name",{value:"Unit"}),S.prototype.constructor=S,S.prototype.type="Unit",S.prototype.isUnit=!0,S.parse=function(e,n){if(n=n||{},t=-1,i="","string"!=typeof(r=e))throw TypeError("Invalid argument in Unit.parse, string expected");var a=new S;a.units=[];var o=1,u=!1;T(),M();var l=O(),c=null;if(l){if("BigNumber"===s.number)c=new N(l);else if("Fraction"===s.number)try{c=new A(l)}catch(e){c=parseFloat(l)}else c=parseFloat(l);M(),_("*")?(o=1,u=!0):_("/")&&(o=-1,u=!0)}for(var f=[],m=1;;){for(M();"("===i;)f.push(o),m*=o,o=1,T(),M();var p=void 0;if(i){var h=i;if(null===(p=function(){for(var e="";F(i)||S.isValidAlpha(i);)e+=i,T();var r=e.charAt(0);return S.isValidAlpha(r)?e:null}()))throw SyntaxError('Unexpected "'+h+'" in "'+r+'" at index '+t.toString())}else break;var d=z(p);if(null===d)throw SyntaxError('Unit "'+p+'" not found.');var g=o*m;if(M(),_("^")){M();var v=O();if(null===v)throw SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');g*=v}a.units.push({unit:d.unit,prefix:d.prefix,power:g});for(var y=0;y<P.length;y++)a.dimensions[y]+=(d.unit.dimensions[y]||0)*g;for(M();")"===i;){if(0===f.length)throw SyntaxError('Unmatched ")" in "'+r+'" at index '+t.toString());m/=f.pop(),T(),M()}if(u=!1,_("*")?(o=1,u=!0):_("/")?(o=-1,u=!0):o=1,d.unit.base){var x=d.unit.base.ke
1y;Z.auto[x]={unit:d.unit,prefix:d.prefix}}}if(M(),i)throw SyntaxError('Could not parse: "'+e+'"');if(u)throw SyntaxError('Trailing characters: "'+e+'"');if(0!==f.length)throw SyntaxError('Unmatched "(" in "'+r+'"');if(0===a.units.length&&!n.allowNoUnits)throw SyntaxError('"'+e+'" contains no units');return a.value=void 0!==c?a._normalize(c):null,a},S.prototype.clone=function(){var e=new S;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=o(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var r=0;r<this.units.length;r++)for(var t in e.units[r]={},this.units[r])l(this.units[r],t)&&(e.units[r][t]=this.units[r][t]);return e},S.prototype.valueType=function(){return el(this.value)},S.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},S.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;for(var r=e,t=S._getNumberConverter(el(e)),n=0;n<this.units.length;n++){var i=t(this.units[n].unit.value),a=t(this.units[n].prefix.value),o=t(this.units[n].power);r=f(r,p(f(i,a),o))}return r},S.prototype._denormalize=function(e,r){if(null==e||0===this.units.length)return e;for(var t=e,n=S._getNumberConverter(el(e)),i=0;i<this.units.length;i++){var a=n(this.units[i].unit.value),o=n(this.units[i].prefix.value),s=n(this.units[i].power);t=m(t,p(f(a,o),s))}return t};var z=oo(e=>{if(l($,e)){var r=$[e],t=r.prefixes[""];return{unit:r,prefix:t}}for(var n in $)if(l($,n)&&function(e,r){var t=e.length-r.length,n=e.length;return e.substring(t,n)===r}(e,n)){var i=$[n],a=e.length-n.length,o=e.substring(0,a),s=l(i.prefixes,o)?i.prefixes[o]:void 0;if(void 0!==s)return{unit:i,prefix:s}}return null},{hasher:e=>e[0],limit:100});function k(e){return e.equalBase(j.NONE)&&null!==e.value&&!s.predictable?e.value:e}function I(e){return S._getNumberConverter(el(e))(1)}function R(e){var r,t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.skipAutomaticSimplification||null===e.value?e.clone():e.simplify();(function(e){var r=!1;for(var t in void 0!==e.value&&null!==e.value&&E(e.value)&&(r=1e-14>Math.abs(e.value.re)),e.units)l(e.units,t)&&e.units[t].unit&&("VA"===e.units[t].unit.name&&r?e.units[t].unit=$.VAR:"VAR"!==e.units[t].unit.name||r||(e.units[t].unit=$.VA))})(i),r=i,t=n.offset,1===r.units.length&&!r.fixPrefix&&1e-14>Math.abs(r.units[0].power-Math.round(r.units[0].power))&&(r.units[0].prefix=r._bestPrefix(t));var a=i._denormalize(i.value),o=null!==i.value?x(a,n||{}):"",s=i.formatUnits();return{simp:i,valueStr:o,unitStr:s}}S.isValuelessUnit=function(e){return null!==z(e)},S.prototype.hasBase=function(e){if("string"==typeof e&&(e=j[e]),!e)return!1;for(var r=0;r<P.length;r++)if(Math.abs((this.dimensions[r]||0)-(e.dimensions[r]||0))>1e-12)return!1;return!0},S.prototype.equalBase=function(e){for(var r=0;r<P.length;r++)if(Math.abs((this.dimensions[r]||0)-(e.dimensions[r]||0))>1e-12)return!1;return!0},S.prototype.equals=function(e){return this.equalBase(e)&&v(this.value,e.value)},S.prototype.multiply=function(e){for(var r=this.clone(),t=C(e)?e:new S(e),n=0;n<P.length;n++)r.dimensions[n]=(this.dimensions[n]||0)+(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var a=pJ({},t.units[i]);r.units.push(a)}return null!==this.value||null!==t.value?r.value=f(null===this.value?this._normalize(I(t.value)):this.value,null===t.value?t._normalize(I(this.value)):t.value):r.value=null,C(e)&&(r.skipAutomaticSimplification=!1),k(r)},S.prototype.divideInto=function(e){return new S(e).divide(this)},S.prototype.divide=function(e){for(var r=this.clone(),t=C(e)?e:new S(e),n=0;n<P.length;n++)r.dimensions[n]=(this.dimensions[n]||0)-(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var a=pJ(pJ({},t.units[i]),{},{power:-t.units[i].power});r.units.push(a)}return null!==this.value||null!==t.value?r.value=m(null===this.value?this._normalize(I(t.value)):this.value,null===t.value?t._normalize(I(this.value)):t.value):r.value=null,C(e)&&(r.skipAutomaticSimplification=!1),k(r)},S.prototype.pow=function(e){for(var r=this.clone(),t=0;t<P.length;t++)r.dimensions[t]=(this.dimensions[t]||0)*e;for(var n=0;n<r.units.length;n++)r.units[n].power*=e;return null!==r.value?r.value=p(r.value,e):r.value=null,r.skipAutomaticSimplification=!1,k(r)},S.prototype.abs=function(){var e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units.length||0===e.units[0].unit.offset)e.value=h(e.value);else{var r=e._numberConverter(),t=f(r(e.units[0].unit.value),r(e.units[0].unit.offset));e.value=c(h(u(e.value,t)),t)}for(var n in e.units)("VA"===e.units[n].unit.name||"VAR"===e.units[n].unit.name)&&(e.units[n].unit=$.W);return e},S.prototype.to=function(e){var r,t=null===this.value?this._normalize(1):this.value;if("string"==typeof e)r=S.parse(e);else if(C(e))r=e.clone();else throw Error("String or Unit expected as parameter");if(!this.equalBase(r))throw Error("Units do not match ('".concat(r.toString(),"' != '").concat(this.toString(),"')"));if(null!==r.value)throw Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||0===this.units.length||0===r.units.length||this.units[0].unit.offset===r.units[0].unit.offset)r.value=o(t);else{var n=S._getNumberConverter(el(t)),i=f(this.units[0].unit.value,this.units[0].unit.offset),a=f(r.units[0].unit.value,r.units[0].unit.offset);r.value=u(t,n(c(i,a)))}
1return r.fixPrefix=!0,r.skipAutomaticSimplification=!0,r},S.prototype.toNumber=function(e){return w(this.toNumeric(e))},S.prototype.toNumeric=function(e){var r;return(r=e?this.to(e):this.clone())._isDerived()||0===r.units.length?r._denormalize(r.value):r._denormalize(r.value,r.units[0].prefix.value)},S.prototype.toString=function(){return this.format()},S.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},S.fromJSON=function(e){var r,t=new S(e.value,null!=(r=e.unit)?r:void 0);return t.fixPrefix=e.fixPrefix||!1,t},S.prototype.valueOf=S.prototype.toString,S.prototype.simplify=function(){var e,r,t=this.clone(),n=[];for(var i in V)if(l(V,i)&&t.hasBase(j[i])){e=i;break}if("NONE"===e)t.units=[];else if(e&&l(V,e)&&(r=V[e]),r)t.units=[{unit:r.unit,prefix:r.prefix,power:1}];else{for(var a=!1,o=0;o<P.length;o++){var s=P[o];Math.abs(t.dimensions[o]||0)>1e-12&&(l(V,s)?n.push({unit:V[s].unit,prefix:V[s].prefix,power:t.dimensions[o]||0}):a=!0)}n.length<t.units.length&&!a&&(t.units=n)}return t},S.prototype.toSI=function(){for(var e=this.clone(),r=[],t=0;t<P.length;t++){var n=P[t];if(Math.abs(e.dimensions[t]||0)>1e-12)if(l(Z.si,n))r.push({unit:Z.si[n].unit,prefix:Z.si[n].prefix,power:e.dimensions[t]||0});else throw Error("Cannot express custom unit "+n+" in SI units")}return(e.units=r,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value)?(e.value=null,this.to(e)):e},S.prototype.formatUnits=function(){for(var e="",r="",t=0,n=0,i=0;i<this.units.length;i++)this.units[i].power>0?(t++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(t>0?(r+=" "+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(r+="^"+-this.units[a].power)):(r+=" "+this.units[a].prefix.name+this.units[a].unit.name,r+="^"+this.units[a].power));e=e.substr(1),r=r.substr(1),t>1&&n>0&&(e="("+e+")"),n>1&&t>0&&(r="("+r+")");var o=e;return t>0&&n>0&&(o+=" / "),o+=r},S.prototype.toBest=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e&&!Array.isArray(e))throw Error("Invalid unit type. Expected string or Unit.");var t=this.units[0].unit.prefixes;if(e&&e.length>0){var n=e.map(e=>{var r=null;if("string"==typeof e){if(!(r=S.parse(e)))throw Error("Invalid unit type. Expected compatible string or Unit.")}else if(!C(e))throw Error("Invalid unit type. Expected compatible string or Unit.");null===r&&(r=e.clone());try{return this.to(r.formatUnits()),r}catch(e){throw Error("Invalid unit type. Expected compatible string or Unit.")}}).map(e=>e.units[0].prefix);this.units[0].unit.prefixes=n.reduce((e,r)=>(e[r.name]=r,e),{}),this.units[0].prefix=n[0]}var i=R(this,r).simp;return this.units[0].unit.prefixes=t,i.fixPrefix=!0,i},S.prototype.format=function(e){var{simp:r,valueStr:t,unitStr:n}=R(this,e),i=t;return r.value&&E(r.value)&&(i="("+i+")"),n.length>0&&i.length>0&&(i+=" "),i+=n},S.prototype._bestPrefix=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1.2;if(1!==this.units.length||Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var r=null!==this.value?h(this.value):0,t=h(this.units[0].unit.value),n=this.units[0].prefix;if(0===r)return n;var i=this.units[0].power,a=Math.log(r/Math.pow(n.value*t,i))/Math.LN10-e;if(a>-2.200001&&a<1.800001)return n;a=Math.abs(a);var o=this.units[0].unit.prefixes;for(var s in o)if(l(o,s)){var u=o[s];if(u.scientific){var c=Math.abs(Math.log(r/Math.pow(u.value*t,i))/Math.LN10-e);(c<a||c===a&&u.name.length<n.name.length)&&(n=u,a=c)}}return n},S.prototype.splitUnit=function(e){for(var r=this.clone(),t=[],n=0;n<e.length&&(r=r.to(e[n]),n!==e.length-1);n++){var i=r.toNumeric(),a=g(i),o=new S(v(a,i)?a:d(r.toNumeric()),e[n].toString());t.push(o),r=c(r,o)}for(var s=0,l=0;l<t.length;l++)s=u(s,t[l].value);return v(s,this.value)&&(r.value=0),t.push(r),t};var q={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0}
1,r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:1048576,scientific:!0},Gi:{name:"Gi",value:0x40000000,scientific:!0},Ti:{name:"Ti",value:0x10000000000,scientific:!0},Pi:{name:"Pi",value:0x4000000000000,scientific:!0},Ei:{name:"Ei",value:0x1000000000000000,scientific:!0},Zi:{name:"Zi",value:11805916207174113e5,scientific:!0},Yi:{name:"Yi",value:12089258196146292e8,scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:1048576,scientific:!0},gibi:{name:"gibi",value:0x40000000,scientific:!0},tebi:{name:"tebi",value:0x10000000000,scientific:!0},pebi:{name:"pebi",value:0x4000000000000,scientific:!0},exi:{name:"exi",value:0x1000000000000000,scientific:!0},zebi:{name:"zebi",value:11805916207174113e5,scientific:!0}
1,yobi:{name:"yobi",value:12089258196146292e8,scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};q.SHORTLONG=(0,n.A)({},q.SHORT,q.LONG),q.BINARY_SHORT=(0,n.A)({},q.BINARY_SHORT_SI,q.BINARY_SHORT_IEC),q.BINARY_LONG=(0,n.A)({},q.BINARY_LONG_SI,q.BINARY_LONG_IEC);var P=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],j={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var U in j)l(j,U)&&(j[U].key=U);var L={name:"",base:{},value:1,offset:0,dimensions:P.map(e=>0)},$={meter:{name:"meter",base:j.LENGTH,prefixes:q.LONG,value:1,offset:0},inch:{name:"inch",base:j.LENGTH,prefixes:q.NONE,value:.0254,offset:0},foot:{name:"foot",base:j.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yard:{name:"yard",base:j.LENGTH,prefixes:q.NONE,value:.9144,offset:0},mile:{name:"mile",base:j.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},link:{name:"link",base:j.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rod:{name:"rod",base:j.LENGTH,prefixes:q.NONE,value:5.0292,offset:0},chain:{name:"chain",base:j.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:j.LENGTH,prefixes:q.NONE,value:1e-10,offset:0},m:{name:"m",base:j.LENGTH,prefixes:q.SHORT,value:1,offset:0},in:{name:"in",base:j.LENGTH,prefixes:q.NONE,value:.0254,offset:0},ft:{name:"ft",base:j.LENGTH,prefixes:q.NONE,value:.3048,offset:0},yd:{name:"yd",base:j.LENGTH,prefixes:q.NONE,value:.9144,offset:0}
1,mi:{name:"mi",base:j.LENGTH,prefixes:q.NONE,value:1609.344,offset:0},li:{name:"li",base:j.LENGTH,prefixes:q.NONE,value:.201168,offset:0},rd:{name:"rd",base:j.LENGTH,prefixes:q.NONE,value:5.02921,offset:0},ch:{name:"ch",base:j.LENGTH,prefixes:q.NONE,value:20.1168,offset:0},mil:{name:"mil",base:j.LENGTH,prefixes:q.NONE,value:254e-7,offset:0},m2:{name:"m2",base:j.SURFACE,prefixes:q.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:j.SURFACE,prefixes:q.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:j.SURFACE,prefixes:q.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:j.SURFACE,prefixes:q.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:j.SURFACE,prefixes:q.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:j.SURFACE,prefixes:q.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:j.SURFACE,prefixes:q.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:j.SURFACE,prefixes:q.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:j.SURFACE,prefixes:q.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:j.SURFACE,prefixes:q.NONE,value:1e4,offset:0},m3:{name:"m3",base:j.VOLUME,prefixes:q.CUBIC,value:1,offset:0},L:{name:"L",base:j.VOLUME,prefixes:q.SHORT,value:.001,offset:0},l:{name:"l",base:j.VOLUME,prefixes:q.SHORT,value:.001,offset:0},litre:{name:"litre",base:j.VOLUME,prefixes:q.LONG,value:.001,offset:0},cuin:{name:"cuin",base:j.VOLUME,prefixes:q.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:j.VOLUME,prefixes:q.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:j.VOLUME,prefixes:q.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:j.VOLUME,prefixes:q.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:j.VOLUME,prefixes:q.NONE,value:15e-6,offset:0},drop:{name:"drop",base:j.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:j.VOLUME,prefixes:q.NONE,value:5e-8,offset:0},minim:{name:"minim",base:j.VOLUME,prefixes:q.NONE,value:61611519921875e-21,offset:0},fluiddram:{name:"fluiddram",base:j.VOLUME,prefixes:q.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:j.VOLUME,prefixes:q.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:j.VOLUME,prefixes:q.NONE,value:11829411825e-14,offset:0},cc:{name:"cc",base:j.VOLUME,prefixes:q.NONE,value:1e-6,offset:0},cup:{name:"cup",base:j.VOLUME,prefixes:q.NONE,value:2365882365e-13,offset:0},pint:{name:"pint",base:j.VOLUME,prefixes:q.NONE,value:473176473e-12,offset:0},quart:{name:"quart",base:j.VOLUME,prefixes:q.NONE,value:946352946e-12,offset:0},gallon:{name:"gallon",base:j.VOLUME,prefixes:q.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:j.VOLUME,prefixes:q.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:j.VOLUME,prefixes:q.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:j.VOLUME,prefixes:q.NONE,value:.238480942392,offset:0},g:{name:"g",base:j.MASS,prefixes:q.SHORT,value:.001,offset:0},gram:{name:"gram",base:j.MASS,prefixes:q.LONG,value:.001,offset:0},ton:{name:"ton",base:j.MASS,prefixes:q.SHORT,value:907.18474,offset:0},t:{name:"t",base:j.MASS,prefixes:q.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:j.MASS,prefixes:q.LONG,value:1e3,offset:0},grain:{name:"grain",base:j.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:j.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:j.MASS,prefixes:q.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:j.MASS,prefixes:q.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:j.MASS,prefixes:q.NONE,value:45.359237,offset:0},stick:{name:"stick",base:j.MASS,prefixes:q.NONE,value:.115,offset:0},stone:{name:"stone",base:j.MASS,prefixes:q.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:j.MASS,prefixes:q.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:j.MASS,prefixes:q.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:j.MASS,prefixes:q.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:j.MASS,prefixes:q.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:j.MASS,prefixes:q.NONE,value:45.359237,offset:0}
1,s:{name:"s",base:j.TIME,prefixes:q.SHORT,value:1,offset:0},min:{name:"min",base:j.TIME,prefixes:q.NONE,value:60,offset:0},h:{name:"h",base:j.TIME,prefixes:q.NONE,value:3600,offset:0},second:{name:"second",base:j.TIME,prefixes:q.LONG,value:1,offset:0},sec:{name:"sec",base:j.TIME,prefixes:q.LONG,value:1,offset:0},minute:{name:"minute",base:j.TIME,prefixes:q.NONE,value:60,offset:0},hour:{name:"hour",base:j.TIME,prefixes:q.NONE,value:3600,offset:0},day:{name:"day",base:j.TIME,prefixes:q.NONE,value:86400,offset:0},week:{name:"week",base:j.TIME,prefixes:q.NONE,value:604800,offset:0},month:{name:"month",base:j.TIME,prefixes:q.NONE,value:2629800,offset:0},year:{name:"year",base:j.TIME,prefixes:q.NONE,value:0x1e187e0,offset:0},decade:{name:"decade",base:j.TIME,prefixes:q.NONE,value:315576e3,offset:0},century:{name:"century",base:j.TIME,prefixes:q.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:j.TIME,prefixes:q.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:j.FREQUENCY,prefixes:q.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:j.FREQUENCY,prefixes:q.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:j.ANGLE,prefixes:q.SHORT,value:1,offset:0},radian:{name:"radian",base:j.ANGLE,prefixes:q.LONG,value:1,offset:0},deg:{name:"deg",base:j.ANGLE,prefixes:q.SHORT,value:null,offset:0},degree:{name:"degree",base:j.ANGLE,prefixes:q.LONG,value:null,offset:0},grad:{name:"grad",base:j.ANGLE,prefixes:q.SHORT,value:null,offset:0},gradian:{name:"gradian",base:j.ANGLE,prefixes:q.LONG,value:null,offset:0},cycle:{name:"cycle",base:j.ANGLE,prefixes:q.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:j.ANGLE,prefixes:q.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:j.ANGLE,prefixes:q.NONE,value:null,offset:0},A:{name:"A",base:j.CURRENT,prefixes:q.SHORT,value:1,offset:0},ampere:{name:"ampere",base:j.CURRENT,prefixes:q.LONG,value:1,offset:0}
1,K:{name:"K",base:j.TEMPERATURE,prefixes:q.SHORT,value:1,offset:0},degC:{name:"degC",base:j.TEMPERATURE,prefixes:q.SHORT,value:1,offset:273.15},degF:{name:"degF",base:j.TEMPERATURE,prefixes:q.SHORT,value:new A(5,9),offset:459.67},degR:{name:"degR",base:j.TEMPERATURE,prefixes:q.SHORT,value:new A(5,9),offset:0},kelvin:{name:"kelvin",base:j.TEMPERATURE,prefixes:q.LONG,value:1,offset:0},celsius:{name:"celsius",base:j.TEMPERATURE,prefixes:q.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:j.TEMPERATURE,prefixes:q.LONG,value:new A(5,9),offset:459.67},rankine:{name:"rankine",base:j.TEMPERATURE,prefixes:q.LONG,value:new A(5,9),offset:0},mol:{name:"mol",base:j.AMOUNT_OF_SUBSTANCE,prefixes:q.SHORT,value:1,offset:0},mole:{name:"mole",base:j.AMOUNT_OF_SUBSTANCE,prefixes:q.LONG,value:1,offset:0},cd:{name:"cd",base:j.LUMINOUS_INTENSITY,prefixes:q.SHORT,value:1,offset:0},candela:{name:"candela",base:j.LUMINOUS_INTENSITY,prefixes:q.LONG,value:1,offset:0},N:{name:"N",base:j.FORCE,prefixes:q.SHORT,value:1,offset:0},newton:{name:"newton",base:j.FORCE,prefixes:q.LONG,value:1,offset:0},dyn:{name:"dyn",base:j.FORCE,prefixes:q.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:j.FORCE,prefixes:q.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:j.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:j.FORCE,prefixes:q.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:j.FORCE,prefixes:q.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:j.FORCE,prefixes:q.NONE,value:9.80665,offset:0},J:{name:"J",base:j.ENERGY,prefixes:q.SHORT,value:1,offset:0},joule:{name:"joule",base:j.ENERGY,prefixes:q.LONG,value:1,offset:0},erg:{name:"erg",base:j.ENERGY,prefixes:q.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:j.ENERGY,prefixes:q.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:j.ENERGY,prefixes:q.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:j.ENERGY,prefixes:q.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:j.ENERGY,prefixes:q.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:j.POWER,prefixes:q.SHORT,value:1,offset:0},watt:{name:"watt",base:j.POWER,prefixes:q.LONG,value:1,offset:0},hp:{name:"hp",base:j.POWER,prefixes:q.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:j.POWER,prefixes:q.SHORT,value:D.I,offset:0},VA:{name:"VA",base:j.POWER,prefixes:q.SHORT,value:1,offset:0},Pa:{name:"Pa",base:j.PRESSURE,prefixes:q.SHORT,value:1,offset:0},psi:{name:"psi",base:j.PRESSURE,prefixes:q.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:j.PRESSURE,prefixes:q.NONE,value:101325,offset:0},bar:{name:"bar",base:j.PRESSURE,prefixes:q.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:j.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:j.PRESSURE,prefixes:q.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:j.PRESSURE,prefixes:q.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:j.PRESSURE,prefixes:q.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:j.ELECTRIC_CHARGE,prefixes:q.LONG,value:1,offset:0},C:{name:"C",base:j.ELECTRIC_CHARGE,prefixes:q.SHORT,value:1,offset:0},farad:{name:"farad",base:j.ELECTRIC_CAPACITANCE,prefixes:q.LONG,value:1,offset:0},F:{name:"F",base:j.ELECTRIC_CAPACITANCE,prefixes:q.SHORT,value:1,offset:0},volt:{name:"volt",base:j.ELECTRIC_POTENTIAL,prefixes:q.LONG,value:1,offset:0},V:{name:"V",base:j.ELECTRIC_POTENTIAL,prefixes:q.SHORT,value:1,offset:0},ohm:{name:"ohm",base:j.ELECTRIC_RESISTANCE,prefixes:q.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:j.ELECTRIC_INDUCTANCE,prefixes:q.LONG,value:1,offset:0},H:{name:"H",base:j.ELECTRIC_INDUCTANCE,prefixes:q.SHORT,value:1,offset:0},siemens:{name:"siemens",base:j.ELECTRIC_CONDUCTANCE,prefixes:q.LONG,value:1,offset:0},S:{name:"S",base:j.ELECTRIC_CONDUCTANCE,prefixes:q.SHORT,value:1,offset:0},weber:{name:"weber",base:j.MAGNETIC_FLUX,prefixes:q.LONG,value:1,offset:0},Wb:{name:"Wb",base:j.MAGNETIC_FLUX,prefixes:q.SHORT,value:1,offset:0},tesla:{name:"tesla",base:j.MAGNETIC_FLUX_DENSITY,prefixes:q.LONG,value:1,offset:0},T:{name:"T",base:j.MAGNETIC_FLUX_DENSITY,prefixes:q.SHORT,value:1,offset:0},b:{name:"b",base:j.BIT,prefixes:q.BINARY_SHORT,value:1,offset:0}
1,bits:{name:"bits",base:j.BIT,prefixes:q.BINARY_LONG,value:1,offset:0},B:{name:"B",base:j.BIT,prefixes:q.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:j.BIT,prefixes:q.BINARY_LONG,value:8,offset:0}},H={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fldr:"fluiddram",fluiddrams:"fluiddram",floz:"fluidounce",fluidounces:"fluidounce",gi:"gill",gills:"gill",cp:"cup",cups:"cup",pt:"pint",pints:"pint",qt:"quart",quarts:"quart",gal:"gallon",gallons:"gallon",bbl:"beerbarrel",beerbarrels:"beerbarrel",obl:"oilbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function G(e){if("BigNumber"===e.number){var r=ol(N);$.rad.value=new N(1),$.deg.value=r.div(180),$.grad.value=r.div(200),$.cycle.value=r.times(2),$.arcsec.value=r.div(648e3),$.arcmin.value=r.div(10800)}else $.rad.value=1,$.deg.value=Math.PI/180,$.grad.value=Math.PI/200,$.cycle.value=2*Math.PI,$.arcsec.value=Math.PI/648e3,$.arcmin.value=Math.PI/10800;$.radian.value=$.rad.value,$.degree.value=$.deg.value,$.gradian.value=$.grad.value}G(s),a&&a("config",function(e,r){e.number!==r.number&&G(e)});var Z={si:{NONE:{unit:L,prefix:q.NONE[""]},LENGTH:{unit:$.m,prefix:q.SHORT[""]},MASS:{unit:$.g,prefix:q.SHORT.k},TIME:{unit:$.s,prefix:q.SHORT[""]},CURRENT:{unit:$.A,prefix:q.SHORT[""]},TEMPERATURE:{unit:$.K,prefix:q.SHORT[""]},LUMINOUS_INTENSITY:{unit:$.cd,prefix:q.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:$.mol,prefix:q.SHORT[""]},ANGLE:{unit:$.rad,prefix:q.SHORT[""]},BIT:{unit:$.bits,prefix:q.SHORT[""]},FORCE:{unit:$.N,prefix:q.SHORT[""]},ENERGY:{unit:$.J,prefix:q.SHORT[""]},POWER:{unit:$.W,prefix:q.SHORT[""]},PRESSURE:{unit:$.Pa,prefix:q.SHORT[""]},ELECTRIC_CHARGE:{unit:$.C,prefix:q.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:$.F,prefix:q.SHORT[""]},ELECTRIC_POTENTIAL:{unit:$.V,prefix:q.SHORT[""]},ELECTRIC_RESISTANCE:{unit:$.ohm,prefix:q.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:$.H,prefix:q.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:$.S,prefix:q.SHORT[""]},MAGNETIC_FLUX:{unit:$.Wb,prefix:q.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:$.T,prefix:q.SHORT[""]},FREQUENCY:{unit:$.Hz,prefix:q.SHORT[""]}}};Z.cgs=JSON.parse(JSON.stringify(Z.si)),Z.cgs.LENGTH={unit:$.m,prefix:q.SHORT.c},Z.cgs.MASS={unit:$.g,prefix:q.SHORT[""]},Z.cgs.FORCE={unit:$.dyn,prefix:q.SHORT[""]},Z.cgs.ENERGY={unit:$.erg,prefix:q.NONE[""]},Z.us=JSON.parse(JSON.stringify(Z.si)),Z.us.LENGTH={unit:$.ft,prefix:q.NONE[""]},Z.us.MASS={unit:$.lbm,prefix:q.NONE[""]},Z.us.TEMPERATURE={unit:$.degF,prefix:q.NONE[""]},Z.us.FORCE={unit:$.lbf,prefix:q.NONE[""]},Z.us.ENERGY={unit:$.BTU,prefix:q.BTU[""]},Z.us.POWER={unit:$.hp,prefix:q.NONE[""]},Z.us.PRESSURE={unit:$.psi,prefix:q.NONE[""]},Z.auto=JSON.parse(JSON.stringify(Z.si));var V=Z.auto;for(var W in S.setUnitSystem=function(e){if(l(Z,e))V=Z[e];else throw Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(Z).join(", "))},S.getUnitSystem=function(){for(var e in Z)if(l(Z,e)&&Z[e]===V)return e},S.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new N(String(e.n)).div(String(e.d)).times(String(e.s)):new N(e+"")},Fraction:function(e){return new A(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?w(e):e}},S.prototype._numberConverter=function(){var e=S.typeConverters[this.valueType()];if(e)return e;throw TypeError('Unsupported Unit value type "'+this.valueType()+'"')},S._getNumberConverter=function(e){if(!S.typeConverters[e])throw TypeError('Unsupported type "'+e+'"');return S.typeConverters[e]},$)if(l($,W)){var J=$[W];J.dimensions=J.base.dimensions}
1for(var Y in H)if(l(H,Y)){var X=$[H[Y]],Q={};for(var K in X)l(X,K)&&(Q[K]=X[K]);Q.name=Y,$[Y]=Q}return S.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},S.createUnit=function(e,r){if("object"!=typeof e)throw TypeError("createUnit expects first parameter to be of type 'Object'");if(r&&r.override){for(var t in e)if(l(e,t)&&S.deleteUnit(t),e[t].aliases)for(var n,i=0;i<e[t].aliases.length;i++)S.deleteUnit(e[t].aliases[i])}for(var a in e)l(e,a)&&(n=S.createUnitSingle(a,e[a]));return n},S.createUnitSingle=function(e,r){if(null==r&&(r={}),"string"!=typeof e)throw TypeError("createUnitSingle expects first parameter to be of type 'string'");if(l($,e))throw Error('Cannot create unit "'+e+'": a unit with that name already exists');for(var t=0;t<e.length;t++){if(i=e.charAt(t),0===t&&!S.isValidAlpha(i))throw Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!(S.isValidAlpha(i)||F(i)))throw Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}var n,a,o,s=null,u=[],c=0;if(r&&"Unit"===r.type)s=r.clone();else if("string"==typeof r)""!==r&&(n=r);else if("object"==typeof r)n=r.definition,a=r.prefixes,c=r.offset,o=r.baseName,r.aliases&&(u=r.aliases.valueOf());else throw TypeError('Cannot create unit "'+e+'" from "'+r.toString()+'": expecting "string" or "Unit" or "Object"');if(u){for(var f=0;f<u.length;f++)if(l($,u[f]))throw Error('Cannot create alias "'+u[f]+'": a unit with that name already exists')}if(n&&"string"==typeof n&&!s)try{s=S.parse(n,{allowNoUnits:!0})}catch(r){throw r.message='Could not create unit "'+e+'" from "'+n+'": '+r.message,r}else n&&"Unit"===n.type&&(s=n.clone());u=u||[],c=c||0,a=a&&a.toUpperCase&&q[a.toUpperCase()]||q.NONE;var m={};if(s){m={name:e,value:s.value,dimensions:s.dimensions.slice(0),prefixes:a,offset:c};var p=!1;for(var h in j)if(l(j,h)){for(var d=!0,g=0;g<P.length;g++)if(Math.abs((m.dimensions[g]||0)-(j[h].dimensions[g]||0))>1e-12){d=!1;break}if(d){p=!0,m.base=j[h];break}}if(!p){o=o||e+"_STUFF";var v={dimensions:s.dimensions.slice(0)};v.key=o,j[o]=v,V[o]={unit:m,prefix:q.NONE[""]},m.base=j[o]}}else{if(o=o||e+"_STUFF",P.indexOf(o)>=0)throw Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');for(var y in P.push(o),j)l(j,y)&&(j[y].dimensions[P.length-1]=0);for(var x={dimensions:[]},b=0;b<P.length;b++)x.dimensions[b]=0;x.dimensions[P.length-1]=1,x.key=o,j[o]=x,m={name:e,value:1,dimensions:j[o].dimensions.slice(0),prefixes:a,offset:c,base:j[o]},V[o]={unit:m,prefix:q.NONE[""]}}S.UNITS[e]=m;for(var w=0;w<u.length;w++){var D=u[w],N={};for(var E in m)l(m,E)&&(N[E]=m[E]);N.name=D,S.UNITS[D]=N}return delete z.cache,new S(null,e)},S.deleteUnit=function(e){delete S.UNITS[e],delete z.cache},S.PREFIXES=q,S.BASE_DIMENSIONS=P,S.BASE_UNITS=j,S.UNIT_SYSTEMS=Z,S.UNITS=$,S},{isClass:!0}),pX="createUnit",pQ=ef(pX,["typed","Unit"],e=>{var{typed:r,Unit:t}=e;return r(pX,{"Object, Object":function(e,r){return t.createUnit(e,r)},Object:function(e){return t.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,r,n){var i={};return i[e]=r,t.createUnit(i,n)},"string, Unit | string | Object":function(e,r){var n={};return n[e]=r,t.createUnit(n,{})},string:function(e){var r={};return r[e]={},t.createUnit(r,{})}})}),pK="dotPow",p0=ef(pK,["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],e=>{var{typed:r,equalScalar:t,matrix:n,pow:i,DenseMatrix:a,concat:o,SparseMatrix:s}=e,u=t7({typed:r}),l=c9({typed:r,SparseMatrix:s}),c=np({typed:r,equalScalar:t}),f=t9({typed:r,DenseMatrix:a}),m=ni({typed:r,matrix:n,concat:o}),p={};for(var h in i.signatures)!Object.prototype.hasOwnProperty.call(i.signatures,h)||h.includes("Matrix")||h.includes("Array")||(p[h]=i.signatures[h]);var d=r(p);return r(pK,m({elop:d,SS:l,DS:u,Ss:c,sS:f}))}),p1="expm",p2=ef(p1,["typed","abs","add","identity","inv","multiply"],e=>{var{typed:r,abs:t,add:n,identity:i,inv:a,multiply:o}=e;return r(p1,{Matrix:function(e){var r=e.size();if(2!==r.length||r[0]!==r[1])throw RangeError("Matrix must be square (size: "+eH(r)+")");for(var s=r[0],u=function(e,r){for(var t=0;t<30;t++)for(var n=0;n<=t;n++){var i=t-n;if(1e-15>function(e,r,t){for(var n=1,i=2;i<=r;i++)n*=i;for(var a=n,o=r+1;o<=2*r;o++)a*=o;var s=a*(2*r+1);return 8*Math.pow(e/Math.pow(2,t),2*r)*n*n/(a*s)}(e,n,i))return{q:n,j:i}}throw Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(function(e){for(var r=e.size()[0],n=0,i=0;i<r;i++){for(var a=0,o=0;o<r;o++)a+=t(e.get([i,o]));n=Math.max(a,n)}return n}(e),1e-15),l=u.q,c=u.j,f=o(e,Math.pow(2,-c)),m=i(s),p=i(s),h=1,d=f,g=-1,v=1;v<=l;v++)v>1&&(d=o(d,f),g=-g),m=n(m,o(h=h*(l-v+1)/((2*l-v+1)*v),d)),p=n(p,o(h*g,d));for(var y=o(a(p),m),x=0;x<c;x++)y=o(y,y);return O(e)?e.createSparseMatrix(y):y}})}),p3=ef("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:u,dotDivide:l,conj:c,pow:f,ceil:m,log2:p}=e;return r("fft",{Array:h,Matrix:function(e){return e.create(h(e.valueOf()),e.datatype())}});function h(e){var r=eK(e);return 1===r.length?d(e,r[0]):function e(r,t){var n=eK(r);if(0!==t)return Array(n[0]).fill(0).map((n,i)=>e(r[i],t-1));if(1===n.length)return d(r);function i(e){var r=eK(e);return Array(r[1]).fill(0).map((t,n)=>Array(r[0]).fill(0).map((r,t)=>e[t][n]))}return i(e(i(r),1))}(e.map(e=>h(e,r.slice(1))),0)}function d(e){var r=e.length;if(1===r)return[e[0]];if(r%2!=0)return function(e){for(var r=e.length,t=o(a(i(-1,i(u,s)),r)),n=[],g=1-r;g<r;g++)n.push(f(t,a(f(g,2),2)));for(var v=f(2,m(p(r+r-1))),y=[...Array(r).fill(0).map((t,a)=>i(e[a],n[r-1+a])),...Array(v-r).fill(0)],x=[...Array(r+r-1).fill(0).map((e,r)=>a(1,n[r])),...Array(v-(r+r-1)).fill(0)],b=d(y),w=d(x),D=l(c(h(c(Array(v).fill(0).map((e,r)=>i(b[r],w[r]))))),v),N=[],E=r-1;E<r+r-1;E++)N.push(i(D[E],n[E]));return N}(e);for(var t=[...d(e.filter((e,r)=>r%2==0),r/2),...d(e.filter((e,r)=>r%2==1),r/2)],g=0;g<r/2;
1g++){var v=t[g],y=i(t[g+r/2],o(i(i(s,u),a(-g,r))));t[g]=n(v,y),t[g+r/2]=n(v,i(-1,y))}return t}}),p5="gamma",p4=ef(p5,["typed","config","multiplyScalar","pow","BigNumber","Complex"],e=>{var{typed:r,config:t,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;return r(p5,{number:lC,Complex:function e(r){if(0===r.im)return lC(r.re);if(r.re<.5){var t=new o(1-r.re,-r.im),n=new o(Math.PI*r.re,Math.PI*r.im);return new o(Math.PI).div(n.sin()).div(e(t))}r=new o(r.re-1,r.im);for(var i=new o(lM[0],0),a=1;a<lM.length;++a){var s=new o(lM[a],0);i=i.add(s.div(r.add(a)))}var u=new o(r.re+lS+.5,r.im),l=Math.sqrt(2*Math.PI),c=u.pow(r.add(.5)),f=u.neg().exp();return i.mul(l).mul(c).mul(f)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new a(1/0):function e(r){if(r<8)return new a([1,1,2,6,24,120,720,5040][r]);var n=t.precision+(0|Math.log(r.toNumber())),i=a.clone({precision:n});if(r%2==1)return r.times(e(new a(r-1)));for(var o=r,s=new i(r),u=r.toNumber();o>2;)o-=2,u+=o,s=s.times(u);return new a(s.toPrecision(a.precision))}(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw Error("Integer BigNumber expected")}})}),p8="ifft",p6=ef(p8,["typed","fft","dotDivide","conj"],e=>{var{typed:r,fft:t,dotDivide:n,conj:i}=e;return r(p8,{"Array | Matrix":function(e){var r=F(e)?e.size():eK(e);return n(i(t(i(e))),r.reduce((e,r)=>e*r,1))}})}),p7="setSize",p9=ef(p7,["typed","compareNatural"],e=>{var{typed:r,compareNatural:t}=e;return r(p7,{"Array | Matrix":function(e){return Array.isArray(e)?re(e).length:re(e.toArray()).length},"Array | Matrix, boolean":function(e,r){if(!1===r||0===e.length)return Array.isArray(e)?re(e).length:re(e.toArray()).length;for(var n=re(Array.isArray(e)?e:e.toArray()).sort(t),i=1,a=1;a<n.length;a++)0!==t(n[a],n[a-1])&&i++;return i}})}),he=ef("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],e=>{var{typed:r,matrix:t,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,u=np({typed:r,equalScalar:i}),l=nt({typed:r});return r("divide",s({"Array | Matrix, Array | Matrix":function(e,r){return n(e,o(r))},"DenseMatrix, any":function(e,r){return l(e,r,a,!1)},"SparseMatrix, any":function(e,r){return u(e,r,a,!1)},"Array, any":function(e,r){return l(t(e),r,a,!1).valueOf()},"any, Array | Matrix":function(e,r){return n(e,o(r))}},a.signatures))}),hr="factorial",ht=ef(hr,["typed","gamma"],e=>{var{typed:r,gamma:t}=e;return r(hr,{number:function(e){if(e<0)throw Error("Value must be non-negative");return t(e+1)},BigNumber:function(e){if(e.isNegative())throw Error("Value must be non-negative");return t(e.plus(1))},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),hn=ef("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],e=>{var{typed:r,config:t,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:u,divi
1deScalar:l,subtract:c,smaller:f,equalScalar:m,flatten:p,isZero:h,isNumeric:d}=e;return r("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":v,"Matrix, Matrix, Matrix":function(e,r,t){var n=g(e.valueOf(),r.valueOf(),t.valueOf());return null===n?null:o(n)},"Matrix, Matrix, Matrix, Matrix":function(e,r,t,n){var i=v(e.valueOf(),r.valueOf(),t.valueOf(),n.valueOf());return null===i?null:o(i)}});function g(e,r,t){var n,i,o,s,f,m,p,h,g,v,x,w,D,N,E,A,C,S;if(e=y(e),r=y(r),t=y(t),!b(e))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(r))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!(4===(n=t).length&&d(n[0])&&d(n[1])&&d(n[2])&&d(n[3])))throw TypeError("Array with 4 numbers expected as third argument");return i=e[0],o=e[1],s=e[2],f=r[0],m=r[1],p=r[2],h=t[0],g=t[1],v=t[2],x=t[3],w=u(i,h),D=u(f,h),N=u(o,g),E=u(m,g),A=u(s,v),C=u(p,v),S=l(c(c(c(x,w),N),A),c(c(c(a(a(D,E),C),w),N),A)),[a(i,u(S,c(f,i))),a(o,u(S,c(m,o))),a(s,u(S,c(p,s)))]}function v(e,r,o,p){if(e=y(e),r=y(r),o=y(o),p=y(p),2===e.length){if(!x(e))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!x(r))throw TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!x(o))throw TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!x(p))throw TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,r,o,m){var p=c(e,r),d=c(o,m),g=c(u(p[0],d[1]),u(d[0],p[1]));if(h(g)||f(n(g),t.relTol))return null;var v=u(d[0],e[1]),y=u(d[1],e[0]),x=u(d[0],o[1]),b=u(d[1],o[0]);return i(s(p,l(a(c(c(v,y),x),b),g)),e)}(e,r,o,p)}if(3===e.length){if(!b(e))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(r))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!b(o))throw TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!b(p))throw TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,r,t,n,i,o,s,f,p,d,g,v){var y=w(e,s,d,s,r,f,g,f,t,p,v,p),x=w(d,s,n,e,g,f,i,r,v,p,o,t),b=w(e,s,n,e,r,f,i,r,t,p,o,t),D=w(d,s,d,s,g,f,g,f,v,p,v,p),N=w(n,e,n,e,i,r,i,r,o,t,o,t),E=c(u(y,x),u(b,D)),A=c(u(N,D),u(x,x));if(h(A))return null;var C=l(E,A),S=l(a(y,u(C,x)),D),M=a(e,u(C,c(n,e))),F=a(r,u(C,c(i,r))),T=a(t,u(C,c(o,t))),B=a(s,u(S,c(d,s))),O=a(f,u(S,c(g,f))),_=a(p,u(S,c(v,p)));return m(M,B)&&m(F,O)&&m(T,_)?[M,F,T]:null}(e[0],e[1],e[2],r[0],r[1],r[2],o[0],o[1],o[2],p[0],p[1],p[2])}throw TypeError("Arrays with two or thee dimensional points expected")}function y(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every(e=>Array.isArray(e)&&1===e.length)?p(e):e}function x(e){return 2===e.length&&d(e[0])&&d(e[1])}function b(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,r,t,n,i,o,s,l,f,m,p,h){var d=u(c(e,r),c(t,n)),g=u(c(i,o),c(s,l)),v=u(c(f,m),c(p,h));return a(a(d,g),v)}}),hi=ef("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],e=>{var{typed:r,matrix:t,abs:n,addScalar:i,divideScalar:a,multiplyScalar:s,subtractScalar:u,larger:l,equalScalar:c,unaryMinus:f,DenseMatrix:m,SparseMatrix:p,Spa:h}=e;return r("lup",{DenseMatrix:function(e){return d(e)},SparseMatrix:function(e){return function(e){var r,t,i,o=e._size[0],u=e._size[1],m=Math.min(o,u),d=e._values,g=e._index,v=e._ptr,y=[],x=[],b=[],w=[o,m],D=[],N=[],E=[],A=[m,u],C=[],S=[];for(r=0;r<o;r++)C[r]=r,S[r]=r;var M=function(e,r){var t=S[e],n=S[r];C[t]=r,C[n]=e,S[e]=n,S[r]=t};for(t=0;t<u;t++)!function(){var e=new h;t<o&&(b.push(y.length),y.push(1),x.push(t)),E.push(D.length);var u=v[t],m=v[t+1];for(i=u;i<m;i++)r=g[i],e.set(C[r],d[i]);t>0&&e.forEach(0,t-1,function(r,t){p._forEachRow(r,y,x,b,function(n,i){n>r&&e.accumulate(n,f(s(i,t)))})});var S=t,F=e.get(t),T=n(F);e.forEach(t+1,o-1,function(e,r){var t=n(r);l(t,T)&&(S=e,T=t,F=r)}),t!==S&&(p._swapRows(t,S,w[1],y,x,b),p._swapRows(t,S,A[1],D,N,E),e.swap(t,S),M(t,S)),e.forEach(0,o-1,function(e,r){e<=t?(D.push(r),N.push(e)):c(r=a(r,F),0)||(y.push(r),x.push(e))})}();return E.push(D.length),b.push(y.length),{L:new p({values:y,index:x,ptr:b,size:w}),U:new p({values:D,index:N,ptr:E,size:A}),p:C,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){var r=d(t(e));return{L:r.L.valueOf(),U:r.U.valueOf(),p:r.p}}});function d(e){var r,t,f,p=e._size[0],h=e._size[1],d=Math.min(p,h),g=o(e._data),v=[],y=[p,d],x=[],b=[d,h],w=[];for(r=0;r<p;r++)w[r]=r;for(t=0;t<h;t++){if(t>0)for(r=0;r<p;r++){var D=Math.min(r,t),N=0;for(f=0;f<D;f++)N=i(N,s(g[r][f],g[f][t]));g[r][t]=u(g[r][t],N)}var E=t,A=0,C=0;for(r=t;r<p;r++){var S=g[r][t],M=n(S);l(M,A)&&(E=r,A=M,C=S)}if(t!==E&&(w[t]=[w[E],w[E]=w[t]][0],m._swapRows(t,E,g)),t<p)for(r=t+1;r<p;r++)c(g[r][t],0)||(g[r][t]=a(g[r][t],C))}for(t=0;t<h;t++)for(r=0;r<p;
1r++){if(0===t&&(r<h&&(x[r]=[]),v[r]=[]),r<t){r<h&&(x[r][t]=g[r][t]),t<p&&(v[r][t]=0);continue}if(r===t){r<h&&(x[r][t]=g[r][t]),t<p&&(v[r][t]=1);continue}r<h&&(x[r][t]=0),t<p&&(v[r][t]=g[r][t])}var F=new m({data:v,size:y}),T=new m({data:x,size:b}),B=[];for(r=0,d=w.length;r<d;r++)B[w[r]]=r;return{L:F,U:T,p:B,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}}),ha="multinomial",ho=ef(ha,["typed","add","divide","multiply","factorial","isInteger","isPositive"],e=>{var{typed:r,add:t,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return r(ha,{"Array | Matrix":function(e){var r=0,u=1;return te(e,function(e){if(!o(e)||!s(e))throw TypeError("Positive integer value expected in function multinomial");r=t(r,e),u=i(u,a(e))}),n(a(r),u)}})}),hs="permutations",hu=ef(hs,["typed","factorial"],e=>{var{typed:r,factorial:t}=e;return r(hs,{"number | BigNumber":t,"number, number":function(e,r){if(!eg(e)||e<0||!eg(r)||r<0)throw TypeError("Positive integer value expected in function permutations");if(r>e)throw TypeError("second argument k must be less than or equal to first argument n");return uG(e-r+1,e)},"BigNumber, BigNumber":function(e,r){var t,n;if(!hl(e)||!hl(r))throw TypeError("Positive integer value expected in function permutations");if(r.gt(e))throw TypeError("second argument k must be less than or equal to first argument n");for(t=e.mul(0).add(1),n=e.minus(r).plus(1);n.lte(e);n=n.plus(1))t=t.times(n);return t}})});function hl(e){return e.isInteger()&&e.gte(0)}var hc="polynomialRoot",hf=ef(hc,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],e=>{var{typed:r,isZero:t,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:u,unaryMinus:l,cbrt:c,typeOf:f,im:m,re:p}=e;return r(hc,{"number|Complex, ...number|Complex":(e,r)=>{for(var h=[e,...r];h.length>0&&t(h[h.length-1]);)h.pop();if(h.length<2)throw RangeError("Polynomial [".concat(e,", ").concat(r,"] must have a non-zero non-constant coefficient"));switch(h.length){case 2:return[l(s(h[0],h[1]))];case 3:var[d,g,v]=h,y=o(2,v),x=o(g,g),b=o(4,v,d);if(n(x,b))return[s(l(g),y)];var w=u(a(x,b));return[s(a(w,g),y),s(a(l(w),g),y)];case 4:var[D,N,E,A]=h,C=l(o(3,A)),S=o(E,E),M=o(3,A,N),F=i(o(2,E,E,E),o(27,A,A,D)),T=o(9,A,E,N);if(n(S,M)&&n(F,T))return[s(E,C)];var B=a(S,M),O=a(F,T);if(n(i(o(18,A,E,N,D),o(E,E,N,N)),i(o(4,E,E,E,D),o(4,A,N,N,N),o(27,A,A,D,D))))return[s(a(o(4,A,E,N),i(o(9,A,A,D),o(E,E,E))),o(A,B)),s(a(o(9,A,D),o(E,N)),o(2,B))];return c(n(S,M)?O:s(i(O,u(a(o(O,O),o(4,B,B,B)))),2),!0).toArray().map(e=>s(i(E,e,s(B,e)),C)).map(e=>"Complex"===f(e)&&n(p(e),p(e)+m(e))?p(e):e);default:throw RangeError("only implemented for cubic or lower-order polynomials, not ".concat(h))}}})}),hm="setIntersect",hp=ef(hm,["typed","size","subset","compareNatural","Index","DenseMatrix"],e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(hm,{"Array | Matrix, Array | Matrix":function(e,r){var s;if(0===n(t(e),new a(0))||0===n(t(r),new a(0)))s=[];else{var u=ro(re(Array.isArray(e)?e:e.toArray()).sort(i)),l=ro(re(Array.isArray(r)?r:r.toArray()).sort(i));s=[];for(var c=0;c<u.length;c++)for(var f=0;f<l.length;f++)if(0===i(u[c].value,l[f].value)&&u[c].identifier===l[f].identifier){s.push(u[c]);break}}return Array.isArray(e)&&Array.isArray(r)?rs(s):new o(rs(s))}})});function hh(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}var hd=ef("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:a,max:o,map:s,abs:u,isPositive:l,isNegative:c,larger:f,smaller:m,matrix:p,bignumber:h,unaryMinus:d}=e;function g(e){return function(r,p,g,v){if(!(2===p.length&&(p.every(b)||p.every(C))))throw Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');
1var y,x=p[0],w=p[1],N=f(w,x),E=v.firstStep;if(void 0!==E&&!l(E))throw Error('"firstStep" must be positive');var A=v.maxStep;if(void 0!==A&&!l(A))throw Error('"maxStep" must be positive');var S=v.minStep;if(S&&c(S))throw Error('"minStep" must be positive or zero');var M=[x,w,E,S,A].filter(e=>void 0!==e);if(!(M.every(b)||M.every(C)))throw Error('Inconsistent type of "t" dependant variables');for(var F=v.tol?v.tol:1e-4,T=v.minDelta?v.minDelta:.2,B=v.maxDelta?v.maxDelta:5,O=v.maxIter?v.maxIter:1e4,_=[x,w,...g,A,S].some(D),[z,k,I,R]=_?[h(e.a),h(e.c),h(e.b),h(e.bp)]:[e.a,e.c,e.b,e.bp],q=E?N?E:d(E):a(n(w,x),1),P=[x],j=[g],U=n(I,R),L=0,$=0,H=N?m:f,G=(y=N?f:m,function(e,r,i){return y(t(e,i),r)?n(r,e):i});H(P[L],w);){var Z=[];q=G(P[L],w,q),Z.push(r(P[L],j[L]));for(var V=1;V<k.length;++V)Z.push(r(t(P[L],i(k[V],q)),t(j[L],i(q,z[V],Z))));var W=o(u(s(i(U,Z),e=>C(e)?e.value:e)));W<F&&F/W>1/4&&(P.push(t(P[L],q)),j.push(t(j[L],i(q,I,Z))),L++);var J=.84*(F/W)**.2;if(m(J,T)?J=T:f(J,B)&&(J=B),q=i(q,J=_?h(J):J),A&&f(u(q),A)?q=N?A:d(A):S&&m(u(q),S)&&(q=N?S:d(S)),++$>O)throw Error("Maximum number of iterations reached, try changing options")}return{t:P,y:j}}}function v(e,r,t,n){return g({a:[[],[.5],[0,3/4],[2/9,1/3,4/9]],c:[null,.5,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(e,r,t,n)}function y(e,r,t,n){return g({a:[[],[.2],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,.2,.3,.8,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40]})(e,r,t,n)}function x(e,r,t,n){var i=n.method?n.method:"RK45",a={RK23:v,RK45:y};if(i.toUpperCase()in a){var o=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?hh(Object(t),!0).forEach(function(r){ed(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):hh(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({},n);return delete o.method,a[i.toUpperCase()](e,r,t,o)}var s=Object.keys(a).map(e=>'"'.concat(e,'"')),u="".concat(s.slice(0,-1).join(", ")," and ").concat(s.slice(-1));throw Error('Unavailable method "'.concat(i,'". Available methods are ').concat(u))}function b(e){return D(e)||w(e)}function N(e,r,t,n){var i=x(e,r.toArray(),t.toArray(),n);return{t:p(i.t),y:p(i.y)}}return r("solveODE",{"function, Array, Array, Object":x,"function, Matrix, Matrix, Object":N,"function, Array, Array":(e,r,t)=>x(e,r,t,{}),"function, Matrix, Matrix":(e,r,t)=>N(e,r,t,{}),"function, Array, number | BigNumber | Unit":(e,r,t)=>{var n=x(e,r,[t],{});return{t:n.t,y:n.y.map(e=>e[0])}},"function, Matrix, number | BigNumber | Unit":(e,r,t)=>{var n=x(e,r.toArray(),[t],{});return{t:p(n.t),y:p(n.y.map(e=>e[0]))}},"function, Array, number | BigNumber | Unit, Object":(e,r,t,n)=>{var i=x(e,r,[t],n);return{t:i.t,y:i.y.map(e=>e[0])}},"function, Matrix, number | BigNumber | Unit, Object":(e,r,t,n)=>{var i=x(e,r.toArray(),[t],n);return{t:p(i.t),y:p(i.y.map(e=>e[0]))}}})}),hg="stirlingS2",hv=ef(hg,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,pow:o,factorial:s,combinations:u,isNegative:l,isInteger:c,number:f,bignumber:m,larger:p}=e,h=[],d=[];return r(hg,{"number | BigNumber, number | BigNumber":function(e,r){if(!c(e)||l(e)||!c(r)||l(r))throw TypeError("Non-negative integer value expected in function stirlingS2");if(p(r,e))throw TypeError("k must be less than or equal to n in function stirlingS2");var n=!(w(e)&&w(r)),a=n?d:h,o=n?m:f,s=f(e),u=f(r);if(a[s]&&a[s].length>u)return a[s][u];for(var g=0;g<=s;++g)if(a[g]||(a[g]=[o(+(0===g))]),0!==g)for(var v=a[g],y=a[g-1],x=v.length;x<=g&&x<=u;++x)x===g?v[x]=1:v[x]=t(i(o(x),y[x]),y[x-1]);return a[s][u]}})}),hy="unit",hx=ef(hy,["typed","Unit"],e=>{var{typed:r,Unit:t}=e;return r(hy,{Unit:function(e){return e.clone()},string:function(e){return t.isValuelessUnit(e)?new t(null,e):t.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,r){return new t(e,r)},"number | BigNumber | Fraction":function(e){return new t(e)},"Array | Matrix":r.referToSelf(e=>r=>tr(r,e))})}),hb="bellNumbers",hw=ef(hb,["typed","addScalar","isNegative","isInteger","stirlingS2"],e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:i,stirlingS2:a}=e;return r(hb,{"number | BigNumber":function(e){if(!i(e)||n(e))throw TypeError("Non-negative integer value expected in function bellNumbers");for(var r=0,o=0;o<=e;o++)r=t(r,a(e,o));return r}})}),hD=ef("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],e=>{var{config:r,typed:t,matrix:i,addScalar:a,subtract:s,equal:u,abs:l,atan:c,cos:f,sin:m,multiplyScalar:p,divideScalar:h,inv:d,bignumber:g,multiply:v,add:y,larger:x,column:b,flatten:N,number:C,complex:S,sqrt:M,diag:F,size:T,reshape:B,qr:O,usolve:_,usolveAll:z,im:k,re:I,smaller:R,matrixFromColumns:q,dot:P}=e,j=function(e){var{config:r,addScalar:t,subtract:n,abs:i,atan:a,cos:s,sin:u,multiplyScalar:l,inv:c,bignumber:f,multiply:m,add:p}=e;function h(e){for(var r=e.length,t=0,n=[0,1],i=0;i<r;i++)for(var a=i+1;a<r;a++)Math.abs(t)<Math.abs(e[i][a])&&(t=Math.abs(e[i][a]),n=[i,a]);return[n,t]}function d(e){for(var r=e.length,t=0,n=[0,1],a=0;a<r;a++)for(var o=a+1;o<r;o++)i(t)<i(e[a][o])&&(t=i(e[a][o]),n=[a,o]);return[n,t]}function g(e,r,t){var n,a=e.length,o=Array(a);if(t){n=Array(a);for(var s=0;s<a;s++)n[s]=Array(a)}for(var u=0;u<a;u++){for(var l=0,c=e[0],f=0;f<e.length;f++)i(e[f])<i(c)&&(c=e[l=f]);if(o[u]=e.splice(l,1)[0],t)for(var m=0;m<a;m++)n[u][m]=r[m][l],r[m].splice(l,1)}if(!t)return{values:o};var p=n.map((e,r)=>({value:o[r],vector:e}));return{values:o,eigenvectors:p}}return function(e,v){var y=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.relTol,x=arguments.length>3?arguments[3]:void 0,b=arguments.length>4?arguments[4]:void 0;if("number"===x)return function(e,t,n){var i,a,s=e.length,u=Math.abs(t/s);if(n){a=Array(s);for(var l=0;l<s;l++)a[l]=Array(s).fill(0),a[l][l]=1}for(var c=h(e);Math.abs(c[1])>=Math.abs(u);){var f,m,p,d=c[0][0],v=c[0][1];f=e[d][d],m=e[v][v],p=e[d][v],e=function(e,r,t,n){for(var i=e.length,a=Math.cos(r),o=Math.sin(r),s=a*a,u=o*o,l=Array(i).fill(0),c=Array(i).fill(0),f=s*e[t][t]-2*a*o*e[t][n]+u*e[n][n],m=u*e[t][t]+2*a*o*e[t][n]+s*e[n][n],p=0;p<i;p++)l[p]=a*e[t][p]-o*e[n][p],c[p]=o*e[t][p]+a*e[n][p];e[t][t]=f,e[n][n]=m,e[t][n]=0,e[n][t]=0;for(var h=0;h<i;h++)h!==t&&h!==n&&(e[t][h]=l[h],e[h][t]=l[h],e[n][h]=c[h],e[h][n]=c[h]);return e}(e,i=Math.abs(m-f)<=r.relTol?Math.PI/4:.5*Math.atan(2*p/(m-f)),d,v),n&&(a=function(e,r,t,n){for(var i=e.length,a=Math.cos(r),o=Math.sin(r),s=Array(i).fill(0),u=Array(i).fill(0),l=0;l<i;l++)s[l]=a*e[l][t]-o*e[l][n],u[l]=o*e[l][t]+a*e[l][n];for(var c=0;c<i;c++)e[c][t]=s[c],e[c][n]=u[c];return e}(a,i,d,v)),c=h(e)}for(var y=Array(s).fill(0),x=0;x<s;x++)y[x]=e[x][x];return g(o(y),a,n)}(e,y,b);if("BigNumber"===x)return function(e,h,v){var y,x,b=e.length,w=i(h/b);if(v){x=Array(b);for(var D=0;D<b;D++)x[D]=Array(b).fill(0),x[D][D]=1}for(var N=d(e);i(N[1])>=i(w);){var E=N[0][0],A=N[0][1];y=function(e,t,o){var s=n(t,e);return i(s)<=r.relTol?f(-1).acos().div(4):l(.5,a(m(2,o,c(s))))}(e[E][E],e[A][A],e[E][A]),e=function(e,r,i,a){for(var o=e.length,c=f(s(r)),h=f(u(r)),d=l(c,c),g=l(h,h),v=Array(o).fill(f(0)),y=Array(o).fill(f(0)),x=m(f(2),c,h,e[i][a]),b=t(n(l(d,e[i][i]),x),l(g,e[a][a])),w=p(l(g,e[i][i]),x,l(d,e[a][a])),D=0;D<o;D++)v[D]=n(l(c,e[i][D]),l(h,e[a][D])),y[D]=t(l(h,e[i][D]),l(c,e[a][D]));e[i][i]=b,e[a][a]=w,e[i][a]=f(0),e[a][i]=f(0);for(var N=0;N<o;N++)N!==i&&N!==a&&(e[i][N]=v[N],e[N][i]=v[N],e[a][N]=y[N],e[N][a]=y[N]);return e}(e,y,E,A),v&&(x=function(e,r,i,a){for(var o=e.length,c=s(r),m=u(r),p=Array(o).fill(f(0)),h=Array(o).fill(f(0)),d=0;d<o;
1d++)p[d]=n(l(c,e[d][i]),l(m,e[d][a])),h[d]=t(l(m,e[d][i]),l(c,e[d][a]));for(var g=0;g<o;g++)e[g][i]=p[g],e[g][a]=h[g];return e}(x,y,E,A)),N=d(e)}for(var C=Array(b).fill(0),S=0;S<b;S++)C[S]=e[S][S];return g(o(C),x,v)}(e,y,b);throw TypeError("Unsupported data type: "+x)}}({config:r,addScalar:a,subtract:s,column:b,flatten:N,equal:u,abs:l,atan:c,cos:f,sin:m,multiplyScalar:p,inv:d,bignumber:g,complex:S,multiply:v,add:y}),U=function(e){var{addScalar:r,subtract:t,flatten:n,multiply:i,multiplyScalar:a,divideScalar:s,sqrt:u,abs:l,bignumber:c,diag:f,size:m,reshape:p,inv:h,qr:d,usolve:g,usolveAll:v,equal:y,complex:x,larger:b,smaller:w,matrixFromColumns:D,dot:N}=e;function E(e,r){for(var t=0;t<e.length;t++)e[t].push(...Array(r-e[t].length).fill(0));for(var n=e.length;n<r;n++)e.push(Array(r).fill(0)),e[n][n]=1;return e}function A(e,r){var n=m(e);for(var a of r)e=t(e,i(s(N(a=p(a,n),e),N(a,a)),a));return e}function C(e){return l(u(N(e,e)))}function S(e,r){return i(s("BigNumber"===r?c(1):"Complex"===r?x(1):1,C(e)),e)}return function(e,m,p,D){var N=!(arguments.length>4)||void 0===arguments[4]||arguments[4],M=function(e,t,n,i,o){var u,m="BigNumber"===i,p=m?c(0):0,h=m?c(1):"Complex"===i?x(1):1,d=m?c(1):1,g=m?c(10):2,v=a(g,g);o&&(u=Array(t).fill(h));for(var D=!1;!D;){D=!0;for(var N=0;N<t;N++){for(var E=p,A=p,C=0;C<t;C++)N!==C&&(E=r(E,l(e[C][N])),A=r(A,l(e[N][C])));if(!y(E,0)&&!y(A,0)){for(var S=d,M=E,F=s(A,g),T=a(A,g);w(M,F);)M=a(M,v),S=a(S,g);for(;b(M,T);)M=s(M,v),S=s(S,g);if(w(s(r(M,A),S),a(r(E,A),.95))){D=!1;for(var B=s(1,S),O=0;O<t;O++)N!==O&&(e[N][O]=a(e[N][O],B),e[O][N]=a(e[O][N],S));o&&(u[N]=a(u[N],B))}}}}return o?f(u):null}(e,m,0,D,N);!function(e,n,i,o,u,f){var m="BigNumber"===o,p=m?c(0):"Complex"===o?x(0):0;m&&(i=c(i));for(var h=0;h<n-2;h++){for(var d=0,g=p,v=h+1;v<n;v++){var y=e[v][h];w(l(g),l(y))&&(g=y,d=v)}if(!w(l(g),i)){if(d!==h+1){var b=e[d];e[d]=e[h+1],e[h+1]=b;for(var D=0;D<n;D++){var N=e[D][d];e[D][d]=e[D][h+1],e[D][h+1]=N}if(u){var E=f[d];f[d]=f[h+1],f[h+1]=E}}for(var A=h+2;A<n;A++){var C=s(e[A][h],g);if(0!==C){for(var S=0;S<n;S++)e[A][S]=t(e[A][S],a(C,e[h+1][S]));for(var M=0;M<n;M++)e[M][h+1]=r(e[M][h+1],a(C,e[M][A]));if(u)for(var F=0;F<n;F++)f[A][F]=t(f[A][F],a(C,f[h+1][F]))}}}}}(e,m,p,D,N,M);var{values:F,C:T}=function(e,n,s,m,p){var h="BigNumber"===m,g="Complex"===m,v=h?c(1):g?x(1):1;h&&(s=c(s));for(var y=o(e),D=[],N=n,A=[],C=p?f(Array(n).fill(v)):void 0,S=p?f(Array(N).fill(v)):void 0,M=0;M<=100;){M+=1;for(var F=y[N-1][N-1],T=0;T<N;T++)y[T][T]=t(y[T][T],F);var{Q:B,R:O}=d(y);y=i(O,B);for(var _=0;_<N;_++)y[_][_]=r(y[_][_],F);if(p&&(S=i(S,B)),1===N||w(l(y[N-1][N-2]),s)){M=0,D.push(y[N-1][N-1]),p&&(A.unshift([[1]]),E(S,n),C=i(C,S),N>1&&(S=f(Array(N-1).fill(v)))),N-=1,y.pop();for(var z=0;z<N;z++)y[z].pop()}else if(2===N||w(l(y[N-2][N-3]),s)){M=0;var k=function(e,n,i,o){var s=r(e,o),l=t(a(e,o),a(n,i)),c=a(s,.5),f=a(u(t(a(s,s),a(4,l))),.5);return[r(c,f),t(c,f)]}(y[N-2][N-2],y[N-2][N-1],y[N-1][N-2],y[N-1][N-1]);D.push(...k),p&&(A.unshift(function(e,r,n,i,a,o,s,u){var f="BigNumber"===u,m="Complex"===u,p=f?c(0):m?x(0):0,h=f?c(1):m?x(1):1;if(w(l(n),s))return[[h,p],[p,h]];if(b(l(t(a,o)),s))return[[t(a,i),t(o,i)],[n,n]];var d=t(e,a),g=t(i,a);return w(l(r),s)&&w(l(g),s)?[[d,h],[n,p]]:[[r,p],[g,h]]}(y[N-2][N-2],y[N-2][N-1],y[N-1][N-2],y[N-1][N-1],k[0],k[1],s,m)),E(S,n),C=i(C,S),N>2&&(S=f(Array(N-2).fill(v)))),N-=2,y.pop(),y.pop();for(var I=0;I<N;I++)y[I].pop(),y[I].pop()}if(0===N)break}if(D.sort((e,r)=>+t(l(e),l(r))),M>100){var R=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+D.join(", "));throw R.values=D,R.vectors=[],R}return{values:D,C:p?i(C,function(e,r){for(var t=[],n=0;n<r;n++)t[n]=Array(r).fill(0);var i=0;for(var a of e){for(var o=a.length,s=0;s<o;s++)for(var u=0;u<o;u++)t[i+s][i+u]=a[s][u];i+=o}return t}(A,n)):void 0}}(e,m,p,D,N);if(N){var B=function(e,r,a,o,s,u,l){var m=i(h(a),e,a),p="BigNumber"===l,d="Complex"===l,D=p?c(0):d?x(0):0,N=p?c(1):d?x(1):1,E=[],M=[];for(var F of s){var T=function(e,r,t){for(var n=0;n<e.length;n++)if(t(e[n],r))return n;return -1}(E,F,y);-1===T?(E.push(F),M.push(1)):M[T]+=1}for(var B=[],O=E.length,_=Array(r).fill(D),z=f(Array(r).fill(N)),k=0;k<O;k++)!function(){var e=E[k],s=t(m,i(e,z)),f=v(s,_);for(f.shift();f.length<M[k];){var p=function(e,r,t,n,i){for(var a,o="BigNumber"===i?c(1e3):1e3,s=0;s<5;++s){a=function(e,r,t){var n="BigNumber"===t,i="Complex"===t,a=Array(e).fill(0).map(e=>2*Math.random()-1);return n&&(a=a.map(e=>c(e))),i&&(a=a.map(e=>x(e))),S(a=A(a,r),t)}(r,t,i);try{a=g(e,a)}catch(e){continue}if(b(C(a),o))break}if(s>=5)return null;for(s=0;;){var u=g(e,a);if(w(C(A(a,[u])),n))break;if(++s>=10)return null;a=S(u)}return a}(s,r,f,u,l);if(null===p)break;f.push(p)}var d=i(h(o),a);f=f.map(e=>i(d,e)),B.push(...f.map(r=>({value:e,vector:n(r)})))}();return B}(e,m,T,M,F,p,D);return{values:F,eigenvectors:B}}return{values:F}}}({config:r,addScalar:a,subtract:s,multiply:v,multiplyScalar:p,flatten:N,divideScalar:h,sqrt:M,abs:l,bignumber:g,diag:F,size:T,reshape:B,qr:O,inv:d,usolve:_,usolveAll:z,equal:u,complex:S,larger:x,smaller:R,matrixFromColumns:q,dot:P});return t("eigs",{Array:function(e){return L(i(e))},"Array, number|BigNumber":function(e,r){return L(i(e),{precision:r})},"Array, Object":(e,r)=>L(i(e),r),Matrix:function(e){return L(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,r){return L(e,{precision:r,matricize:!0})},"Matrix, Object":function(e,r){var t={matricize:!0};return(0,n.A)(t,r),L(e,t)}});function L(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=!("eigenvectors"in n)||n.eigenvectors,o=function(e,r,t){var n=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw RangeError("Matrix must be square (size: ".concat(eH(i),")"));var a=i[0];if(function(e,r,t){for(var n=0;n<r;n++)for(var i=0;i<r;i++)if(x(g(l(k(e[n][i]))),t))return!1;return!0}(n,a,r)&&(function(e,r){for(var t=0;t<r;t++)for(var n=0;n<r;n++)e[t][n]=I(e[t][n])}(n,a),function(e,r,t){for(var n=0;n<r;n++)for(var i=n;i<r;i++)if(x(g(l(s(e[n][i],e[i][n]))),t))return!1;return!0}(n,a,r))){var o=$(e,n,a);return j(n,a,r,o,t)}var u=$(e,n,a);return U(n,a,r,u,t)}(e,null!=(t=n.precision)?t:r.relTol,a);return n.matricize&&(o.values=i(o.values),a&&(o.eigenvectors=o.eigenvectors.map(e=>{var{value:r,vector:t}=e;return{value:r,vector:i(t)}}))),a&&Object.defineProperty(o,"vectors",{enumerable:!1,get:()=>{throw Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),o}function $(e,r,t){var n=e.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;for(var i=!1,a=!1,o=!1,s=0;s<t;s++)for(var u=0;u<t;u++){var l=r[s][u];if(w(l)||A(l))i=!0;else if(D(l))a=!0;else if(E(l))o=!0;else throw TypeError("Unsupported type in Matrix: "+el(l))}if(a&&o&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),o){for(var c=0;c<t;c++)for(var f=0;f<t;f++)r[c][f]=S(r[c][f]);return"Complex"}if(a){for(var m=0;m<t;m++)for(var p=0;p<t;p++)r[m][p]=g(r[m][p]);return"BigNumber"}if(i){for(var h=0;h<t;h++)for(var d=0;d<t;d++)r[h][d]=C(r[h][d]);return"number"}throw TypeError("Matrix contains unsupported types only.")}}),hN="kldivergence",hE=ef(hN,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],e=>{var{typed:r,matrix:t,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:u,isNumeric:l}=e;return r(hN,{"Array, Array":function(e,r){return c(t(e),t(r))},"Matrix, Array":function(e,r){return c(e,t(r))},"Array, Matrix":function(e,r){return c(t(e),r)},"Matrix, Matrix":function(e,r){return c(e,r)}});function c(e,r){var t=r.size().length,c=e.size().length;if(t>1)throw Error("first object must be one dimensional");if(c>1)throw Error("second object must be one dimensional");if(t!==c)throw Error("Length of two vectors must be equal");if(0===i(e))throw Error("Sum of elements in first object must be non zero");if(0===i(r))throw Error("Sum of elements in second object must be non zero");var f=n(e,i(e)),m=n(r,i(r)),p=i(a(f,o(s(f,m),e=>u(e))));return l(p)?p:NaN}});function hA(e,r){var t,n=r.length,i=[];if(e)for(t=0;t<n;t++)i[e[t]]=r[t];else for(t=0;t<n;t++)i[t]=r[t];return i}var hC="lusolve",hS=ef(hC,["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],e=>{var{typed:r,matrix:t,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,u=mD({DenseMatrix:s});return r(hC,{"Array, Array | Matrix":function(e,r){var i=n(e=t(e));return c(i.L,i.U,i.p,null,r).valueOf()},"DenseMatrix, Array | Matrix":function(e,r){var t=n(e);return c(t.L,t.U,t.p,null,r)},"SparseMatrix, Array | Matrix":function(e,r){var t=n(e);return c(t.L,t.U,t.p,null,r)},"SparseMatrix, Array | Matrix, number, number":function(e,r,t,n){var a=i(e,t,n);return c(a.L,a.U,a.p,a.q,r)},"Object, Array | Matrix":function(e,r){return c(e.L,e.U,e.p,e.q,r)}});function l(e){if(F(e))return e;if(M(e))return t(e);throw TypeError("Invalid Matrix LU decomposition")}function c(e,r,t,n,i){e=l(e),r=l(r),t&&((i=u(e,i,!0))._data=hA(t,i._data));var s=a(r,o(e,i));return n&&(s._data=hA(n,s._data)),s}}),hM="setUnion",hF=ef(hM,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],e=>{var{typed:r,size:t,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return r(hM,{"Array | Matrix, Array | Matrix":function(e,r){if(0===i(t(e),new s(0)))return re(r);if(0===i(t(r),new s(0)))return re(e);var u=re(e),l=re(r);return n(o(u,l),a(u,l))}})}),hT="median",hB=ef(hT,["typed","add","divide","compare","partitionSelect"],e=>{var{typed:r,add:t,divide:n,compare:i,partitionSelect:a}=e;function o(e){try{var r=(e=re(e.valueOf())).length;if(0===r)throw Error("Cannot calculate median of an empty array");if(r%2==0){for(var t=r/2-1,n=a(e,t+1),o=e[t],l=0;l<t;++l)i(e[l],o)>0&&(o=e[l]);return u(o,n)}var c=a(e,(r-1)/2);return s(c)}catch(e){throw nS(e,"median")}}var s=r({"number | BigNumber | Complex | Unit":function(e){return e}}),u=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,r){return n(t(e,r),2)}});return r(hT,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,r){throw Error("median(A, dim) is not yet supported")},"...":function(e){if(r9(e))throw TypeError("Scalar values expected in function median");return o(e)}})}),hO="corr",h_=ef(hO,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],e=>{var{typed:r,matrix:t,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:u,divide:l}=e;return r(hO,{"Array, Array":function(e,r){return c(e,r)},"Matrix, Matrix":function(e,r){var n=c(e.toArray(),r.toArray());return Array.isArray(n)?t(n):n}});function c(e,r){var t=[];if(Array.isArray(e[0])&&Array.isArray(r[0])){if(e.length!==r.length)throw SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var n=0;n<e.length;n++){if(e[n].length!==r[n].length)throw SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");t.push(f(e[n],r[n]))}return t}if(e.length!==r.length)throw SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(e,r)}
1function f(e,r){var t=e.length,c=i(e),f=i(r),m=e.reduce((e,t,n)=>a(e,s(t,r[n])),0),p=i(e.map(e=>u(e,2))),h=i(r.map(e=>u(e,2)));return l(o(s(t,m),s(c,f)),n(s(o(s(t,p),u(c,2)),o(s(t,h),u(f,2)))))}}),hz="freqz",hk=ef(hz,["typed","add","multiply","Complex","divide","matrix"],e=>{var{typed:r,add:t,multiply:n,Complex:i,divide:a,matrix:o}=e;return r(hz,{"Array, Array":function(e,r){return s(e,r,u(512))},"Array, Array, Array":function(e,r,t){return s(e,r,t)},"Array, Array, number":function(e,r,t){if(t<0)throw Error("w must be a positive number");return s(e,r,u(t))},"Matrix, Matrix":function(e,r){var t=u(512),{w:n,h:i}=s(e.valueOf(),r.valueOf(),t);return{w:o(n),h:o(i)}},"Matrix, Matrix, Matrix":function(e,r,t){var{h:n}=s(e.valueOf(),r.valueOf(),t.valueOf());return{h:o(n),w:o(t)}},"Matrix, Matrix, number":function(e,r,t){if(t<0)throw Error("w must be a positive number");var n=u(t),{h:i}=s(e.valueOf(),r.valueOf(),n);return{h:o(i),w:o(n)}}});function s(e,r,o){for(var s=[],u=[],l=0;l<o.length;l++){for(var c=i(0,0),f=i(0,0),m=0;m<e.length;m++)c=t(c,n(e[m],i(Math.cos(-m*o[l]),Math.sin(-m*o[l]))));for(var p=0;p<r.length;p++)f=t(f,n(r[p],i(Math.cos(-p*o[l]),Math.sin(-p*o[l]))));s.push(c),u.push(f)}for(var h=[],d=0;d<s.length;d++)h.push(a(s[d],u[d]));return{h,w:o}}function u(e){for(var r=[],t=0;t<e;t++)r.push(t/e*Math.PI);return r}}),hI=ef("mad",["typed","abs","map","median","subtract"],e=>{var{typed:r,abs:t,map:n,median:i,subtract:a}=e;return r("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(0===(e=re(e.valueOf())).length)throw Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var r=i(e);return i(n(e,function(e){return t(a(e,r))}))}catch(e){if(e instanceof TypeError&&e.message.includes("median"))throw TypeError(e.message.replace("median","mad"));throw nS(e,"mad")}}}),hR="zeta",hq=ef(hR,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],e=>{var{typed:r,config:t,multiply:n,pow:i,divide:a,factorial:o,equal:s,smallerEq:u,isNegative:l,gamma:c,sin:f,subtract:m,add:p,Complex:h,BigNumber:d,pi:g}=e;return r(hR,{number:e=>v(e,e=>e,()=>20),BigNumber:e=>v(e,e=>new d(e),()=>Math.abs(Math.log10(t.relTol))),Complex:function(e){return 0===e.re&&0===e.im?new h(-.5):1===e.re?new h(NaN,NaN):e.re===1/0&&0===e.im?new h(1):e.im===1/0||e.re===-1/0?new h(NaN,NaN):y(e,e=>e,e=>Math.round(19.5+.9*Math.abs(e.im)),e=>e.re)}});function v(e,r,t){return s(e,0)?r(-.5):s(e,1)?r(NaN):isFinite(e)?y(e,r,t,e=>e):r(l(e)?NaN:1)}function y(e,r,t,o){var s=t(e);if(o(e)>-(s-1)/2)return function(e,r,t){for(var o=a(1,n(x(t(0),r),m(1,i(2,m(1,e))))),s=t(0),l=t(1);u(l,r);l=p(l,1))s=p(s,a(n((-1)**(l-1),x(l,r)),i(l,e)));return n(o,s)}(e,r(s),r);var l=n(i(2,e),i(r(g),m(e,1)));return l=n(l,f(n(a(r(g),2),e))),l=n(l,c(m(1,e))),n(l,y(m(1,e),r,t,o))}function x(e,r){for(var t=e,s=e;u(s,r);s=p(s,1)){var l=a(n(o(p(r,m(s,1))),i(4,s)),n(o(m(r,s)),o(n(2,s))));t=p(t,l)}return n(r,t)}}),hP="norm",hj=ef(hP,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],e=>{var{typed:r,abs:t,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:u,larger:l,smaller:c,matrix:f,ctranspose:m,eigs:p}=e;return r(hP,{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return h(f(e),2)},Matrix:function(e){return h(e,2)},"Array, number | BigNumber | string":function(e,r){return h(f(e),r)},"Matrix, number | BigNumber | string":function(e,r){return h(e,r)}});function h(e,r){var f,d,g=e.size();if(1===g.length){if(r===1/0||"inf"===r)return f=0,e.forEach(function(e){var r=t(e);l(r,f)&&(f=r)},!0),f;if(r===-1/0||"-inf"===r)return e.forEach(function(e){var r=t(e);(!d||c(r,d))&&(d=r)},!0),d||0;if("fro"===r)return h(e,2);if("number"==typeof r&&!isNaN(r)){if(!u(r,0)){var v=0;return e.forEach(function(e){v=n(i(t(e),r),v)},!0),i(v,1/r)}return 1/0}throw Error("Unsupported parameter value")}if(2===g.length)if(g[0]&&g[1])return function(e,r){if(1===r)return i=[],u=0,e.forEach(function(e,r){var a=r[1],o=n(i[a]||0,t(e));l(o,u)&&(u=o),i[a]=o},!0),u;if(r===1/0||"inf"===r)return c=[],f=0,e.forEach(function(e,r){var i=r[0],a=n(c[i]||0,t(e));l(a,f)&&(f=a),c[i]=a},!0),f;if("fro"===r)return h=0,e.forEach(function(e,r){h=n(h,s(e,a(e)))}),t(o(h));if(2===r){var i,u,c,f,h,d=e.size();if(d[0]!==d[1])throw RangeError("Invalid matrix dimensions");var g=p(s(m(e),e)).values.toArray();return t(o(g[g.length-1]))}throw Error("Unsupported parameter value "+r)}(e,r);else throw RangeError("Invalid matrix dimensions")}}),hU="rotationMatrix",hL=ef(hU,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],e=>{var{typed:r,config:t,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:o,BigNumber:s,matrix:u,DenseMatrix:l,SparseMatrix:c,cos:f,sin:m}=e;return r(hU,{"":function(){return"Matrix"===t.matrix?u([]):[]},string:function(e){return u(e)},"number | BigNumber | Complex | Unit":function(e){return p(e,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,r){return p(e,r)},"number | BigNumber | Complex | Unit, Array":function(e,r){var t=u(r);return h(t),v(e,t,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,r){h(r);var n=r.storage()||("Matrix"===t.matrix?"dense":void 0);return v(e,r,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,r,t){var n=u(r);return h(n),v(e,n,t)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,r,t){return h(r),v(e,r,t)}});function p(e,r){var t=D(e)?new s(-1):-1,i=f(e),a=m(e);return g([[i,n(t,a)],[a,i]],r)}function h(e){var r=e.size();if(r.length<1||3!==r[0])throw RangeError("Vector must be of dimensions 1x3")}function d(e){return e.reduce((e,r)=>n(e,r))}function g(e,r){if(r){if("sparse"===r)return new c(e);if("dense"===r)return new l(e);throw TypeError('Unknown matrix type "'.concat(r,'"'))}return e}function v(e,r,t){var n=o(r);if(0===n)throw RangeError("Rotation around zero vector");var u=D(e)?s:null,l=u?new u(1):1,c=u?new u(-1):-1,p=u?new u(r.get([0])/n):r.get([0])/n,h=u?new u(r.get([1])/n):r.get([1])/n,v=u?new u(r.get([2])/n):r.get([2])/n,y=f(e),x=i(l,a(y)),b=m(e);return g([[i(y,d([p,p,x])),i(d([p,h,x]),d([c,v,b])),i(d([p,v,x]),d([h,b]))],[i(d([p,h,x]),d([v,b])),i(y,d([h,h,x])),i(d([h,v,x]),d([c,p,b]))],[i(d([p,v,x]),d([c,h,b])),i(d([h,v,x]),d([p,b])),i(y,d([v,v,x]))]],t)}}),h$="schur",hH=ef(h$,["typed","matrix","identity","multiply","qr","norm","subtract"],e=>{var{typed:r,matrix:t,identity:n,multiply:i,qr:a,norm:o,subtract:s}=e;return r(h$,{Array:function(e){var r=u(t(e));return{U:r.U.valueOf(),T:r.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){var r,t=e.size()[0],u=e,l=n(t),c=0;do{r=u;var f=a(u),m=f.Q;if(u=i(f.R,m),l=i(l,m),c++>100)break}while(o(s(u,r))>1e-4);return{U:l,T:u}}
1}),hG="rotate",hZ=ef(hG,["typed","multiply","rotationMatrix"],e=>{var{typed:r,multiply:t,rotationMatrix:n}=e;return r(hG,{"Array , number | BigNumber | Complex | Unit":function(e,r){return i(e,2),t(n(r),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,r){return i(e,2),t(n(r),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,r,a){return i(e,3),t(n(r,a),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,r,a){return i(e,3),t(n(r,a),e)}});function i(e,r){var t=Array.isArray(e)?eK(e):e.size();if(t.length>2||2===t.length&&1!==t[1]||t[0]!==r)throw RangeError("Vector must be of dimensions 1x".concat(r))}}),hV="sylvester",hW=ef(hV,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:u,index:l,subset:c,add:f,subtract:m,identity:p,lusolve:h,abs:d}=e;return r(hV,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,r,t){return g(i(e),r,t)},"Array, Array, Matrix":function(e,r,t){return g(i(e),i(r),t)},"Array, Matrix, Array":function(e,r,t){return g(i(e),r,i(t))},"Matrix, Array, Matrix":function(e,r,t){return g(e,i(r),t)},"Matrix, Array, Array":function(e,r,t){return g(e,i(r),i(t))},"Matrix, Matrix, Array":function(e,r,t){return g(e,r,i(t))},"Array, Array, Array":function(e,r,t){return g(i(e),i(r),i(t)).toArray()}});function g(e,r,g){for(var v=r.size()[0],y=e.size()[0],x=t(e),b=x.T,w=x.U,D=t(a(-1,r)),N=D.T,E=D.U,A=a(a(u(w),g),E),C=o(0,y),S=[],M=(e,r)=>s(e,r,1),F=(e,r)=>s(e,r,0),T=0;T<v;T++)if(T<v-1&&d(c(N,l(T+1,T)))>1e-5){for(var B=F(c(A,l(C,T)),c(A,l(C,T+1))),O=0;O<T;O++)B=f(B,F(a(S[O],c(N,l(O,T))),a(S[O],c(N,l(O,T+1)))));var _=a(p(y),a(-1,c(N,l(T,T)))),z=a(p(y),a(-1,c(N,l(T+1,T)))),k=a(p(y),a(-1,c(N,l(T,T+1)))),I=a(p(y),a(-1,c(N,l(T+1,T+1)))),R=h(F(M(f(b,_),z),M(k,f(b,I))),B);S[T]=R.subset(l(o(0,y),0)),S[T+1]=R.subset(l(o(y,2*y),0)),T++}else{for(var q=c(A,l(C,T)),P=0;P<T;P++)q=f(q,a(S[P],c(N,l(P,T))));var j=m(b,a(c(N,l(T,T)),p(y)));S[T]=h(j,q)}return a(w,a(i(n(...S)),u(E)))}}),hJ="lyap",hY=ef(hJ,["typed","matrix","sylvester","multiply","transpose"],e=>{var{typed:r,matrix:t,sylvester:n,multiply:i,transpose:a}=e;return r(hJ,{"Matrix, Matrix":function(e,r){return n(e,a(e),i(-1,r))},"Array, Matrix":function(e,r){return n(t(e),a(t(e)),i(-1,r))},"Matrix, Array":function(e,r){return n(e,a(t(e)),t(i(-1,r)))},"Array, Array":function(e,r){return n(t(e),a(t(e)),t(i(-1,r))).toArray()}})}),hX=a4({config:a}),hQ=oa({}),hK=oD({BigNumber:hX,config:a}),h0=og({}),h1=oK({BigNumber:hX,config:a}),h2=sq({}),h3=oT({Complex:hQ}),h5=oy({BigNumber:hX,config:a}),h4=oA({BigNumber:hX,config:a}),h8=oS({BigNumber:hX,config:a}),h6=sP({}),h7=ox({BigNumber:hX,config:a}),h9=ov({}),de=oN({BigNumber:hX,config:a}),dr=sj({}),dt=sU({}),dn=oM({BigNumber:hX,config:a}),di=su({BigNumber:hX,config:a}),da=ow({BigNumber:hX,config:a}),ds=od({}),du=oB({}),dl=sL({Matrix:h6}),dc=o7({BigNumber:hX,config:a}),df=oE({BigNumber:hX,config:a}),dm=ob({BigNumber:hX,config:a}),dp=s$({}),dh=oF({BigNumber:hX,config:a}),dd=sG({BigNumber:hX,Complex:hQ,DenseMatrix:dl,Fraction:h2}),dg=o6({BigNumber:hX,config:a}),dv=us({typed:dd}),dy=ul({Complex:hQ,config:a,typed:dd}),dx=uC({BigNumber:hX,typed:dd}),db=uM({BigNumber:hX,Complex:hQ,config:a,typed:dd}),dw=uT({typed:dd}),dD=uB({typed:dd}),dN=u_({BigNumber:hX,Complex:hQ,config:a,typed:dd}),dE=uz({typed:dd}),dA=uk({typed:dd}),dC=uR({Complex:hQ,config:a,typed:dd}),dS=uq({typed:dd}),dM=uj({typed:dd}),dF=uL({typed:dd}),dT=uH({typed:dd}),dB=uW({typed:dd}),dO=uY({Complex:hQ,typed:dd}),d_=uQ({typed:dd}),dz=u0({typed:dd}),dk=u1({BigNumber:hX,typed:dd}),dI=u2({BigNumber:hX,typed:dd}),dR=u5({typed:dd}),dq=u7({config:a,typed:dd}),dP=u9({typed:dd}),dj=la({typed:dd}),dU=ls({Complex:hQ,typed:dd}),dL=tJ({typed:dd}),d$=ll({typed:dd}),dH=t3({typed:dd}),dG=lf({typed:dd}),dZ=lp({typed:dd}),dV=lh({format:dG,typed:dd}),dW=ld({typed:dd}),dJ=lv({typed:dd}),dY=lw({config:a,typed:dd}),dX=lN({config:a,typed:dd}),dQ=lA({equalScalar:dq,typed:dd}),dK=oC({BigNumber:hX,config:a}),d0=lO({Complex:hQ,typed:dd}),d1=lI({Complex:hQ,config:a,typed:dd}),d2=lq({Complex:hQ,config:a,typed:dd}),d3=t8({typed:dd}),d5=lP({typed:dd}),d4=lj({typed:dd}),d8=lU({typed:dd}),d6=lL({format:dG,typed:dd}),d7=lV({config:a,typed:dd}),d9=nN({typed:dd}),ge=lY({config:a,typed:dd}),gr=lX({typed:dd}),gt=lQ({BigNumber:hX,typed:dd}),gn=l0({BigNumber:hX,Fraction:h2,complex:dO,typed:dd}),gi=l1({typed:dd}),ga=l2({Matrix:h6,equalScalar:dq,typed:dd}),go=l5({typed:dd}),gs=l8({typed:dd}),gu=l7({typed:dd}),gl=ce({typed:dd}),gc=cr({typed:dd}),gf=cn({typed:dd}),gm=ca({typed:dd}),gp=cs({Complex:hQ,config:a,typed:dd}),gh=cl({BigNumber:hX,typed:dd}),gd=cf({BigNumber:hX,Complex:hQ,config:a,typed:dd}),gg=cm({BigNumber:hX,typed:dd}),gv=ch({typed:dd}),gy=cv({typed:dd}),gx=cx({BigNumber:hX,typed:dd}),gb=cw({typed:dd}),gw=cN({typed:dd}
1),gD=tL({isInteger:dJ,typed:dd}),gN=cA({DenseMatrix:dl,Matrix:h6,SparseMatrix:ga,typed:dd}),gE=cS({isZero:dQ,matrix:gN,typed:dd}),gA=cM({BigNumber:hX,config:a,matrix:gN,typed:dd}),gC=cT({config:a,log2:d2,typed:dd}),gS=cO({isInteger:dJ,matrix:gN,typed:dd}),gM=cz({BigNumber:hX,typed:dd}),gF=cI({typed:dd}),gT=cq({SparseMatrix:ga,typed:dd}),gB=cP({Complex:hQ,config:a,typed:dd}),gO=cU({typed:dd}),g_=cL({typed:dd}),gz=cH({matrix:gN,typed:dd}),gk=cZ({BigNumber:hX,config:a,matrix:gN,typed:dd}),gI=cW({BigNumber:hX,config:a,matrix:gN,typed:dd}),gR=cY({BigNumber:hX,Complex:hQ,config:a,typed:dd}),gq=cQ({Complex:hQ,config:a,typed:dd}),gP=cK({format:dG,typed:dd}),gj=ny({isInteger:dJ,matrix:gN,typed:dd}),gU=c1({BigNumber:hX,typed:dd}),gL=c3({conj:d_,transpose:gz,typed:dd}),g$=c4({DenseMatrix:dl,SparseMatrix:ga,matrix:gN,typed:dd}),gH=c7({concat:gj,equalScalar:dq,matrix:gN,multiplyScalar:d5,typed:dd}),gG=fr({DenseMatrix:dl,SparseMatrix:ga,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),gZ=fn({Fraction:h2,typed:dd}),gV=fa({BigNumber:hX,DenseMatrix:dl,SparseMatrix:ga,config:a,matrix:gN,typed:dd}),gW=fs({typed:dd}),gJ=fl({matrix:gN,multiplyScalar:d5,typed:dd}),gY=ff({DenseMatrix:dl,SparseMatrix:ga,concat:gj,config:a,matrix:gN,typed:dd}),gX=fg({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd,zeros:gI}),gQ=fy({isNaN:gb,isNumeric:gW,typed:dd}),gK=fb({BigNumber:hX,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),g0=fw({bignumber:gg,fraction:gZ,number:d8}),g1=fN({config:a,multiplyScalar:d5,numeric:g0,typed:dd}),g2=fA({config:a,matrix:gN}),g3=fS({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd,zeros:gI}),g5=fT({BigNumber:hX,DenseMatrix:dl,config:a,equalScalar:dq,matrix:gN,typed:dd,zeros:gI}),g4=fO({matrix:gN,config:a,typed:dd}),g8=fz({DenseMatrix:dl,SparseMatrix:ga,bignumber:gg,concat:gj,config:a,matrix:gN,typed:dd}),g6=fI({concat:gj,matrix:gN,typed:dd}),g7=fq({typed:dd}),g9=fj({DenseMatrix:dl,SparseMatrix:ga,concat:gj,config:a,equalScalar:dq,matrix:gN,typed:dd}),ve=fL({DenseMatrix:dl,SparseMatrix:ga,concat:gj,matrix:gN,typed:dd}),vr=f$({DenseMatrix:dl,SparseMatrix:ga,addScalar:dw,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),vt=fG({BigNumber:hX,DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),vn=nW({concat:gj,equalScalar:dq,matrix:gN,typed:dd}),vi=ia({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),va=fV({DenseMatrix:dl,SparseMatrix:ga,concat:gj,matrix:gN,typed:dd}),vo=fJ({BigNumber:hX,Complex:hQ,Fraction:h2,config:a,isNegative:dY,matrix:gN,typed:dd,unaryMinus:g7}),vs=fX({BigNumber:hX,DenseMatrix:dl,Fraction:h2,concat:gj,config:a,equalScalar:dq,matrix:gN,typed:dd}),vu=f0({concat:gj,matrix:gN,typed:dd}),vl=f2({prod:g1,size:g4,typed:dd}),vc=f5({equal:gG,typed:dd}),vf=f8({numeric:g0,typed:dd}),vm=f7({DenseMatrix:dl,SparseMatrix:ga,concat:gj,divideScalar:vf,equalScalar:dq,matrix:gN,typed:dd}),vp=me({compareText:vu,isZero:dQ,typed:dd}),vh=mi({DenseMatrix:dl,config:a,equalScalar:dq,matrix:gN,round:g5,typed:dd,zeros:gI}),vd=ml({BigNumber:hX,DenseMatrix:dl,concat:gj,config:a,equalScalar:dq,matrix:gN,round:g5,typed:dd,zeros:gI}),vg=mf({isNumeric:gW,typed:dd}),vv=mp({abs:dv,addScalar:dw,divideScalar:vf,isPositive:dX,multiplyScalar:d5,smaller:g8,sqrt:gB,typed:dd}),vy=mh({DenseMatrix:dl,smaller:g8}),vx=md({ImmutableDenseMatrix:vy,getMatrixDataType:dZ}),vb=my({DenseMatrix:dl,SparseMatrix:ga,bignumber:gg,concat:gj,config:a,matrix:gN,typed:dd}),vw=mw({Complex:hQ,config:a,divideScalar:vf,typeOf:gm,typed:dd}),vD=mE({DenseMatrix:dl,divideScalar:vf,equalScalar:dq,matrix:gN,multiplyScalar:d5,subtractScalar:gl,typed:dd}),vN=mC({flatten:d$,matrix:gN,size:g4,typed:dd}),vE=ig({config:a,isNaN:gb,larger:vb,numeric:g0,typed:dd}),vA=nY({config:a,isNaN:gb,numeric:g0,smaller:g8,typed:dd}),vC=ma({DenseMatrix:dl,concat:gj,config:a,equalScalar:dq,matrix:gN,round:g5,typed:dd,zeros:gI}),vS=mM({Complex:hQ,config:a,divideScalar:vf,typed:dd}),vM=nK({deepEqual:vc,flatten:d$,matrix:gN,size:g4,typed:dd}),vF=nc({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),vT=mT({compare:vs,isNaN:gb,isNumeric:gW,typed:dd}),vB=mB({addScalar:dw,complex:dO,conj:d_,divideScalar:vf,equal:gG,identity:gV,isZero:dQ,matrix:gN,multiplyScalar:d5,sign:gn,sqrt:gB,subtractScalar:gl,typed:dd,unaryMinus:g7,zeros:gI}),vO=m_({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd,zeros:gI}
1),v_=mk({DenseMatrix:dl,SparseMatrix:ga,concat:gj,config:a,matrix:gN,typed:dd}),vz=n2({add:vr,matrix:gN,typed:dd,zeros:gI}),vk=mq({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,subtractScalar:gl,typed:dd,unaryMinus:g7}),vI=mP({add:vr,matrix:gN,typed:dd}),vR=mU({DenseMatrix:dl,divideScalar:vf,equalScalar:dq,matrix:gN,multiplyScalar:d5,subtractScalar:gl,typed:dd}),vq=m$({addScalar:dw,combinations:dB,divideScalar:vf,isInteger:dJ,isNegative:dY,multiplyScalar:d5,typed:dd}),vP=mZ({compare:vs,typed:dd}),vj=mW({addScalar:dw,combinations:dB,isInteger:dJ,isNegative:dY,isPositive:dX,larger:vb,typed:dd}),vU=ip({matrix:gN,number:d8,subtract:vk,typed:dd}),vL=mY({abs:dv,addScalar:dw,deepEqual:vc,divideScalar:vf,multiplyScalar:d5,sqrt:gB,subtractScalar:gl,typed:dd}),v$=mX({addScalar:dw,conj:d_,multiplyScalar:d5,size:g4,typed:dd}),vH=mQ({larger:vb,smaller:g8}),vG=m0({Index:vx,typed:dd}),vZ=m2({BigNumber:hX,add:vr,config:a,equal:gG,isInteger:dJ,mod:vC,smaller:g8,typed:dd,xgcd:gk}),vV=m3({concat:gj,equalScalar:dq,matrix:gN,typed:dd}),vW=m4({Complex:hQ,config:a,divideScalar:vf,log:vw,typed:dd}),vJ=m6({DenseMatrix:dl,divideScalar:vf,equalScalar:dq,matrix:gN,multiplyScalar:d5,subtractScalar:gl,typed:dd}),vY=m9({flatten:d$,matrix:gN,size:g4,typed:dd}),vX=pr({addScalar:dw,dot:v$,equalScalar:dq,matrix:gN,multiplyScalar:d5,typed:dd}),vQ=ix({bignumber:gg,matrix:gN,add:vr,config:a,equal:gG,isPositive:dX,isZero:dQ,larger:vb,largerEq:gY,smaller:g8,smallerEq:v_,typed:dd}),vK=iw({Index:vx,matrix:gN,range:vQ,typed:dd}),v0=pn({DenseMatrix:dl,Index:vx,compareNatural:vP,size:g4,subset:vz,typed:dd}),v1=pa({DenseMatrix:dl,Index:vx,compareNatural:vP,size:g4,subset:vz,typed:dd}),v2=ps({Index:vx,compareNatural:vP,size:g4,subset:vz,typed:dd}),v3=pl({Index:vx,compareNatural:vP,size:g4,subset:vz,typed:dd}),v5=pv({SparseMatrix:ga,abs:dv,add:vr,divideScalar:vf,larger:vb,largerEq:gY,multiply:vX,subtract:vk,transpose:gz,typed:dd}),v4=px({compare:vs,compareNatural:vP,matrix:gN,typed:dd}),v8=pw({config:a,numeric:g0,typed:dd}),v6=pN({DenseMatrix:dl,divideScalar:vf,equalScalar:dq,matrix:gN,multiplyScalar:d5,subtractScalar:gl,typed:dd}),v7=pA({Complex:hQ,add:vr,multiply:vX,number:d8,typed:dd}),v9=nd({concat:gj,equalScalar:dq,matrix:gN,not:d4,typed:dd,zeros:gI}),ye=pF({DenseMatrix:dl,config:a,equalScalar:dq,matrix:gN,round:g5,typed:dd,zeros:gI}),yr=iE({Index:vx,matrix:gN,range:vQ,typed:dd}),yt=pB({matrix:gN,multiply:vX,subtract:vk,typed:dd}),yn=pO({divideScalar:vf,isZero:dQ,matrix:gN,multiply:vX,subtractScalar:gl,typed:dd,unaryMinus:g7}),yi=pz({Complex:hQ,DenseMatrix:dl,ceil:ye,equalScalar:dq,floor:vh,matrix:gN,typed:dd,zeros:gI}),ya=pk({abs:dv,addScalar:dw,det:yn,divideScalar:vf,identity:gV,matrix:gN,multiply:vX,typed:dd,unaryMinus:g7}),yo=pR({Complex:hQ,add:vr,ctranspose:gL,deepEqual:vc,divideScalar:vf,dot:v$,dotDivide:vm,equal:gG,inv:ya,matrix:gN,multiply:vX,typed:dd}),ys=pq({Complex:hQ,config:a,fraction:gZ,identity:gV,inv:ya,matrix:gN,multiply:vX,number:d8,typed:dd}),yu=pj({DenseMatrix:dl,Index:vx,compareNatural:vP,size:g4,subset:vz,typed:dd}),yl=pL({Index:vx,compareNatural:vP,size:g4,subset:vz,typed:dd}),yc=pH({Index:vx,concat:gj,setDifference:yu,size:g4,subset:vz,typed:dd}),yf=pG({FibonacciHeap:vH,addScalar:dw,equalScalar:dq}),ym=pV({abs:dv,add:vr,identity:gV,inv:ya,map:d3,max:vE,multiply:vX,size:g4,sqrt:gB,subtract:vk,typed:dd}),yp=nM({add:vr,config:a,numeric:g0,typed:dd}),yh=pY({BigNumber:hX,Complex:hQ,Fraction:h2,abs:dv,addScalar:dw,config:a,divideScalar:vf,equal:gG,fix:yi,format:dG,isNumeric:gW,multiplyScalar:d5,number:d8,pow:ys,round:g5,subtractScalar:gl,toBest:gf}),yd=oP({BigNumber:hX,Unit:yh,config:a}),yg=sf({BigNumber:hX,Unit:yh,config:a}),yv=o9({BigNumber:hX,Unit:yh,config:a}),yy=o$({BigNumber:hX,Unit:yh,config:a}),yx=sr({BigNumber:hX,Unit:yh,config:a}),yb=oH({BigNumber:hX,Unit:yh,config:a}),yw=oj({BigNumber:hX,Unit:yh,config:a}),yD=pQ({Unit:yh,typed:dd}),yN=o2({BigNumber:hX,Unit:yh,config:a}),yE=p0({DenseMatrix:dl,SparseMatrix:ga,concat:gj,equalScalar:dq,matrix:gN,pow:ys,typed:dd}),yA=oq({BigNumber:hX,Unit:yh,config:a}),yC=oL({BigNumber:hX,Unit:yh,config:a}),yS=p2({abs:dv,add:vr,identity:gV,inv:ya,multiply:vX,typed:dd}),yM=st({BigNumber:hX,Unit:yh,config:a}),yF=p3({addScalar:dw,ceil:ye,conj:d_,divideScalar:vf,dotDivide:vm,exp:dj,i:h3,log2:d2,matrix:gN,multiplyScalar:d5,pow:ys,tau:da,typed:dd}),yT=p4({BigNumber:hX,Complex:hQ,config:a,multiplyScalar:d5,pow:ys,typed:dd}),yB=oz({BigNumber:hX,Unit:yh,config:a}),yO=o0({BigNumber:hX,Unit:yh,config:a}),y_=p6({conj:d_,dotDivide:vm,fft:yF,typed:dd}),yz=oG({BigNumber:hX,Unit:yh,config:a}),yk=oW({BigNumber:hX,Unit:yh,config:a}),yI=si({BigNumber:hX,Unit:yh,config:a}),yR=oR({BigNumber:hX,Unit:yh,config:a}),yq=sm({BigNumber:hX,Unit:yh,config:a}),yP=so({BigNumber:hX,Unit:yh,config:a}),yj=o3({BigNumber:hX,Unit:yh,config:a}),yU=oV({BigNumber:hX,Unit:yh,config:a}),yL=sy({BigNumber:hX,Unit:yh,config:a}),y$=sd({BigNumber:hX,Unit:yh,config:a}),yH=sx({BigNumber:hX,Unit:yh,config:a}),yG=o1({BigNumber:hX,Unit:yh,config:a}),yZ=o5({BigNumber:hX,Unit:yh,config:a}),yV=oI({BigNumber:hX,Unit:yh,config:a}),yW=o4({BigNumber:hX,Unit:yh,config:a}),yJ=sl({BigNumber:hX,Unit:yh,config:a}),yY=p9({compareNatural:vP,typed:dd}),yX=o_({BigNumber:hX,Unit:yh,config:a}),yQ=sc({BigNumber:hX,Unit:yh,config:a}),yK=o8({BigNumber:hX,Unit:yh,config:a}),y0=se({BigNumber:hX,Unit:yh,config:a}),y1=oJ({BigNumber:hX,Unit:yh,config:a}),y2=oU({BigNumber:hX,Unit:yh,config:a}),y3=he({divideScalar:vf,equalScalar:dq,inv:ya,matrix:gN,multiply:vX,typed:dd}),y5=oX({BigNumber:hX,Unit:yh,config:a}
1),y4=ht({gamma:yT,typed:dd}),y8=sn({BigNumber:hX,Unit:yh,config:a}),y6=sh({BigNumber:hX,Unit:yh,config:a}),y7=hn({abs:dv,add:vr,addScalar:dw,config:a,divideScalar:vf,equalScalar:dq,flatten:d$,isNumeric:gW,isZero:dQ,matrix:gN,multiply:vX,multiplyScalar:d5,smaller:g8,subtract:vk,typed:dd}),y9=hi({DenseMatrix:dl,Spa:yf,SparseMatrix:ga,abs:dv,addScalar:dw,divideScalar:vf,equalScalar:dq,larger:vb,matrix:gN,multiplyScalar:d5,subtractScalar:gl,typed:dd,unaryMinus:g7}),xe=oZ({BigNumber:hX,Unit:yh,config:a}),xr=sp({BigNumber:hX,Unit:yh,config:a}),xt=ho({add:vr,divide:y3,factorial:y4,isInteger:dJ,isPositive:dX,multiply:vX,typed:dd}),xn=hu({factorial:y4,typed:dd}),xi=sg({BigNumber:hX,Unit:yh,config:a}),xa=hf({add:vr,cbrt:vo,divide:y3,equalScalar:dq,im:dW,isZero:dQ,multiply:vX,re:gr,sqrt:gB,subtract:vk,typeOf:gm,typed:dd,unaryMinus:g7}),xo=hp({DenseMatrix:dl,Index:vx,compareNatural:vP,size:g4,subset:vz,typed:dd}),xs=hd({abs:dv,add:vr,bignumber:gg,divide:y3,isNegative:dY,isPositive:dX,larger:vb,map:d3,matrix:gN,max:vE,multiply:vX,smaller:g8,subtract:vk,typed:dd,unaryMinus:g7}),xu=hv({bignumber:gg,addScalar:dw,combinations:dB,divideScalar:vf,factorial:y4,isInteger:dJ,isNegative:dY,larger:vb,multiplyScalar:d5,number:d8,pow:ys,subtractScalar:gl,typed:dd}),xl=hx({Unit:yh,typed:dd}),xc=hw({addScalar:dw,isInteger:dJ,isNegative:dY,stirlingS2:xu,typed:dd}),xf=iu({add:vr,typed:dd,unaryPlus:v8}),xm=hD({abs:dv,add:vr,addScalar:dw,atan:dA,bignumber:gg,column:yr,complex:dO,config:a,cos:dz,diag:g$,divideScalar:vf,dot:v$,equal:gG,flatten:d$,im:dW,inv:ya,larger:vb,matrix:gN,matrixFromColumns:vN,multiply:vX,multiplyScalar:d5,number:d8,qr:vB,re:gr,reshape:gS,sin:gi,size:g4,smaller:g8,sqrt:gB,subtract:vk,typed:dd,usolve:vR,usolveAll:v6}),xp=oQ({BigNumber:hX,Unit:yh,config:a}),xh=sa({BigNumber:hX,Unit:yh,config:a}),xd=hE({divide:y3,dotDivide:vm,isNumeric:gW,log:vw,map:d3,matrix:gN,multiply:vX,sum:yp,typed:dd}),xg=hS({DenseMatrix:dl,lsolve:vD,lup:y9,matrix:gN,slu:v5,typed:dd,usolve:vR}),xv=iS({add:vr,divide:y3,typed:dd}),xy=ss({BigNumber:hX,Unit:yh,config:a}),xx=ok({BigNumber:hX,Unit:yh,config:a}),xb=iT({bignumber:gg,add:vr,compare:vs,divide:y3,isInteger:dJ,larger:vb,mapSlices:gD,multiply:vX,partitionSelect:vT,smaller:g8,smallerEq:v_,subtract:vk,typed:dd}),xw=hF({Index:vx,concat:gj,setIntersect:xo,setSymDifference:yc,size:g4,subset:vz,typed:dd}),xD=iz({add:vr,divide:y3,isNaN:gb,mapSlices:gD,multiply:vX,subtract:vk,typed:dd}),xN=oY({BigNumber:hX,Unit:yh,config:a}),xE=hB({add:vr,compare:vs,divide:y3,partitionSelect:vT,typed:dd}),xA=h_({add:vr,divide:y3,matrix:gN,mean:xv,multiply:vX,pow:ys,sqrt:gB,subtract:vk,sum:yp,typed:dd}),xC=hk({Complex:hQ,add:vr,divide:y3,matrix:gN,multiply:vX,typed:dd}),xS=hI({abs:dv,map:d3,median:xE,subtract:vk,typed:dd}),xM=iR({map:d3,sqrt:gB,typed:dd,variance:xD}),xF=hq({BigNumber:hX,Complex:hQ,add:vr,config:a,divide:y3,equal:gG,factorial:y4,gamma:yT,isNegative:dY,multiply:vX,pi:dm,pow:ys,sin:gi,smallerEq:v_,subtract:vk,typed:dd}),xT=hj({abs:dv,add:vr,conj:d_,ctranspose:gL,eigs:xm,equalScalar:dq,larger:vb,matrix:gN,multiply:vX,pow:ys,smaller:g8,sqrt:gB,typed:dd}),xB=hL({BigNumber:hX,DenseMatrix:dl,SparseMatrix:ga,addScalar:dw,config:a,cos:dz,matrix:gN,multiplyScalar:d5,norm:xT,sin:gi,typed:dd,unaryMinus:g7}),xO=sv({BigNumber:hX,Unit:yh,config:a}),x_=hH({identity:gV,matrix:gN,multiply:vX,norm:xT,qr:vB,subtract:vk,typed:dd}),xz=hZ({multiply:vX,rotationMatrix:xB,typed:dd}),xk=hW({abs:dv,add:vr,concat:gj,identity:gV,index:vG,lusolve:xg,matrix:gN,matrixFromColumns:vN,multiply:vX,range:vQ,schur:x_,subset:vz,subtract:vk,transpose:gz,typed:dd}),xI=hY({matrix:gN,multiply:vX,sylvester:xk,transpose:gz,typed:dd}),xR={},xq={},xP={},xj=ep({mathWithTransform:xq}),xU=eY({Node:xj}),xL=rT({Node:xj}),x$=rO({Node:xj}),xH=rz({Node:xj}),xG=rI({Node:xj}),xZ=rq({Node:xj,ResultSet:dt}),xV=rj({Node:xj}),xW=rL({Node:xj}),xJ=rH({Node:xj}),xY=rG({classes:xP}),xX=rZ({math:xR,typed:dd}),xQ=rW({Node:xj,typed:dd}),xK=rY({Chain:xX,typed:dd}),x0=r0({Node:xj,subset:vz}),x1=r2({matrix:gN,Node:xj,subset:vz}),x2=r5({Node:xj,size:g4}),x3=r4({Unit:yh,Node:xj,math:xR}),x5=r6({Node:xj,SymbolNode:x3,math:xR}),x4=to({AccessorNode:x0,ArrayNode:xG,AssignmentNode:x1,BlockNode:xZ,ConditionalNode:xV,ConstantNode:xW,FunctionAssignmentNode:xQ,FunctionNode:x5,IndexNode:x2,ObjectNode:xU,OperatorNode:xL,ParenthesisNode:x$,RangeNode:xJ,RelationalNode:xH,SymbolNode:x3,config:a,numeric:g0,typed:dd}),x8=ts({ConstantNode:xW,FunctionNode:x5,OperatorNode:xL,ParenthesisNode:x$,parse:x4,typed:dd}),x6=th({bignumber:gg,fraction:gZ,AccessorNode:x0,ArrayNode:xG,ConstantNode:xW,FunctionNode:x5,IndexNode:x2,ObjectNode:xU,OperatorNode:xL,SymbolNode:x3,config:a,mathWithTransform:xq,matrix:gN,typed:dd}),x7=tg({parse:x4,typed:dd}),x9=ty({AccessorNode:x0,ArrayNode:xG,ConstantNode:xW,FunctionNode:x5,IndexNode:x2,ObjectNode:xU,OperatorNode:xL,ParenthesisNode:x$,SymbolNode:x3,add:vr,divi
1de:y3,equal:gG,isZero:dQ,multiply:vX,parse:x4,pow:ys,subtract:vk,typed:dd}),be=tb({parse:x4,typed:dd}),br=tw({evaluate:be}),bt=tD({evaluate:be,parse:x4}),bn=tA({AccessorNode:x0,ArrayNode:xG,ConstantNode:xW,FunctionNode:x5,IndexNode:x2,ObjectNode:xU,OperatorNode:xL,ParenthesisNode:x$,SymbolNode:x3,equal:gG,parse:x4,replacer:dp,resolve:x8,simplifyConstant:x6,simplifyCore:x9,typed:dd}),bi=tS({OperatorNode:xL,parse:x4,simplify:bn,typed:dd}),ba=tF({parse:x4,typed:dd}),bo=tB({Parser:bt,typed:dd}),bs=t_({bignumber:gg,fraction:gZ,AccessorNode:x0,ArrayNode:xG,ConstantNode:xW,FunctionNode:x5,IndexNode:x2,ObjectNode:xU,OperatorNode:xL,ParenthesisNode:x$,SymbolNode:x3,add:vr,config:a,divide:y3,equal:gG,isZero:dQ,mathWithTransform:xq,matrix:gN,multiply:vX,parse:x4,pow:ys,simplify:bn,simplifyConstant:x6,simplifyCore:x9,subtract:vk,typed:dd}),bu=tk({ConstantNode:xW,FunctionNode:x5,OperatorNode:xL,ParenthesisNode:x$,SymbolNode:x3,config:a,equal:gG,isZero:dQ,numeric:g0,parse:x4,simplify:bn,typed:dd}),bl=tj({Help:br,mathWithTransform:xq,typed:dd});(0,n.A)(xR,{e:hK,false:h0,fineStructure:h1,i:h3,Infinity:h5,LN10:h4,LOG10E:h8,NaN:h7,null:h9,phi:de,SQRT1_2:dn,sackurTetrode:di,tau:da,true:ds,E:hK,version:du,efimovFactor:dc,LN2:df,pi:dm,replacer:dp,reviver:xY,SQRT2:dh,typed:dd,PI:dm,weakMixingAngle:dg,abs:dv,acos:dy,acot:dx,acsc:db,addScalar:dw,arg:dD,asech:dN,asinh:dE,atan:dA,atanh:dC,bigint:dS,bitNot:dM,boolean:dF,clone:dT,combinations:dB,complex:dO,conj:d_,cos:dz,cot:dk,csc:dI,cube:dR,equalScalar:dq,erf:dP,exp:dj,expm1:dU,filter:dL,flatten:d$,forEach:dH,format:dG,getMatrixDataType:dZ,hex:dV,im:dW,isInteger:dJ,isNegative:dY,isPositive:dX,isZero:dQ,LOG2E:dK,lgamma:d0,log10:d1,log2:d2,map:d3,multiplyScalar:d5,not:d4,number:d8,oct:d6,pickRandom:d7,print:d9,random:ge,re:gr,sec:gt,sign:gn,sin:gi,splitUnit:go,square:gs,string:gu,subtractScalar:gl,tan:gc,toBest:gf,typeOf:gm,acosh:gp,acsch:gh,asec:gd,bignumber:gg,chain:xK,combinationsWithRep:gv,cosh:gy,csch:gx,isNaN:gb,isPrime:gw,mapSlices:gD,matrix:gN,matrixFromFunction:gE,ones:gA,randomInt:gC,reshape:gS,sech:gM,sinh:gF,sparse:gT,sqrt:gB,squeeze:gO,tanh:g_,transpose:gz,xgcd:gk,zeros:gI,acoth:gR,asin:gq,bin:gP,concat:gj,coth:gU,ctranspose:gL,diag:g$,dotMultiply:gH,equal:gG,fraction:gZ,identity:gV,isNumeric:gW,kron:gJ,largerEq:gY,leftShift:gX,mode:gQ,nthRoot:gK,numeric:g0,prod:g1,resize:g2,rightArithShift:g3,round:g5,size:g4,smaller:g8,to:g6,unaryMinus:g7,unequal:g9,xor:ve,add:vr,atan2:vt,bitAnd:vn,bitOr:vi,bitXor:va,cbrt:vo,compare:vs,compareText:vu,count:vl,deepEqual:vc,divideScalar:vf,dotDivide:vm,equalText:vp,floor:vh,gcd:vd,hasNumericValue:vg,hypot:vv,larger:vb,log:vw,lsolve:vD,matrixFromColumns:vN,max:vE,min:vA,mod:vC,nthRoots:vS,nullish:vM,or:vF,partitionSelect:vT,qr:vB,rightLogShift:vO,smallerEq:v_,subset:vz,subtract:vk,trace:vI,usolve:vR,catalan:vq,compareNatural:vP,composition:vj,diff:vU,distance:vL,dot:v$,index:vG,invmod:vZ,lcm:vV,log1p:vW,lsolveAll:vJ,matrixFromRows:vY,multiply:vX,range:vQ,row:vK,setCartesian:v0,setDistinct:v1,setIsSubset:v2,setPowerset:v3,slu:v5,sort:v4,unaryPlus:v8,usolveAll:v6,zpk2tf:v7,and:v9,ceil:ye,column:yr,cross:yt,det:yn,fix:yi,inv:ya,pinv:yo,pow:ys,setDifference:yu,setMultiplicity:yl,setSymDifference:yc,sqrtm:ym,sum:yp,vacuumImpedance:yd,wienDisplacement:yg,atomicMass:yv,bohrMagneton:yy,boltzmann:yx,conductanceQuantum:yb,coulomb:yw,createUnit:yD,deuteronMass:yN,dotPow:yE,electricConstant:yA,elementaryCharge:yC,expm:yS,faraday:yM,fft:yF,gamma:yT,gravitationConstant:yB,hartreeEnergy:yO,ifft:y_,inverseConductanceQuantum:yz,klitzing:yk,loschmidt:yI,magneticConstant:yR,molarMass:yq,molarPlanckConstant:yP,neutronMass:yj,nuclearMagneton:yU,planckCharge:yL,planckLength:y$,planckTemperature:yH,protonMass:yG,quantumOfCirculation:yZ,reducedPlanckConstant:yV,rydberg:yW,secondRadiation:yJ,setSize:yY,speedOfLight:yX,stefanBoltzmann:yQ,thomsonCrossSection:yK,avogadro:y0,bohrRadius:y1,coulombConstant:y2,divide:y3,electronMass:y5,factorial:y4,firstRadiation:y8,gravity:y6,intersect:y7,lup:y9,magneticFluxQuantum:xe,molarMassC12:xr,multinomial:xt,parse:x4,permutations:xn,planckMass:xi,polynomialRoot:xa,resolve:x8,setIntersect:xo,simplifyConstant:x6,solveODE:xs,stirlingS2:xu,unit:xl,bellNumbers:xc,compile:x7,cumsum:xf,eigs:xm,fermiCoupling:xp,gasConstant:xh,kldivergence:xd,lusolve:xg,mean:xv,molarVolume:xy,planckConstant:xx,quantileSeq:xb,setUnion:xw,simplifyCore:x9,variance:xD,classicalElectronRadius:xN,evaluate:be,median:xE,simplify:bn,symbolicEqual:bi,corr:xA,freqz:xC,leafCount:ba,mad:xS,parser:bo,rationalize:bs,std:xM,zeta:xF,derivative:bu,norm:xT,rotationMatrix:xB,help:bl,planckTime:xO,schur:x_,rotate:
1xz,sylvester:xk,lyap:xI,config:a}),(0,n.A)(xq,xR,{mapSlices:tG({isInteger:dJ,typed:dd}),filter:t1({typed:dd}),forEach:t4({typed:dd}),map:t6({typed:dd}),or:nf({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),and:ng({add:vr,concat:gj,equalScalar:dq,matrix:gN,not:d4,typed:dd,zeros:gI}),concat:nx({isInteger:dJ,matrix:gN,typed:dd}),index:nb({Index:vx,getMatrixDataType:dZ}),print:nC({add:vr,matrix:gN,typed:dd,zeros:gI}),sum:nT({add:vr,config:a,numeric:g0,typed:dd}),bitAnd:nJ({add:vr,concat:gj,equalScalar:dq,matrix:gN,not:d4,typed:dd,zeros:gI}),min:nX({config:a,isNaN:gb,numeric:g0,smaller:g8,typed:dd}),nullish:n0({deepEqual:vc,flatten:d$,matrix:gN,size:g4,typed:dd}),subset:n9({add:vr,matrix:gN,typed:dd,zeros:gI}),bitOr:io({DenseMatrix:dl,concat:gj,equalScalar:dq,matrix:gN,typed:dd}),cumsum:ic({add:vr,typed:dd,unaryPlus:v8}),diff:id({bignumber:gg,matrix:gN,number:d8,subtract:vk,typed:dd}),max:iv({config:a,isNaN:gb,larger:vb,numeric:g0,typed:dd}),range:ib({bignumber:gg,matrix:gN,add:vr,config:a,equal:gG,isPositive:dX,isZero:dQ,larger:vb,largerEq:gY,smaller:g8,smallerEq:v_,typed:dd}),row:iD({Index:vx,matrix:gN,range:vQ,typed:dd}),column:iA({Index:vx,matrix:gN,range:vQ,typed:dd}),mean:iM({add:vr,divide:y3,typed:dd}),quantileSeq:iB({add:vr,bignumber:gg,compare:vs,divide:y3,isInteger:dJ,larger:vb,mapSlices:gD,multiply:vX,partitionSelect:vT,smaller:g8,smallerEq:v_,subtract:vk,typed:dd}),variance:iI({add:vr,divide:y3,isNaN:gb,mapSlices:gD,multiply:vX,subtract:vk,typed:dd}),std:iq({map:d3,sqrt:gB,typed:dd,variance:xD})}),(0,n.A)(xP,{BigNumber:hX,Complex:hQ,Fraction:h2,Matrix:h6,Node:xj,ObjectNode:xU,OperatorNode:xL,ParenthesisNode:x$,Range:dr,RelationalNode:xH,ResultSet:dt,ArrayNode:xG,BlockNode:xZ,ConditionalNode:xV,ConstantNode:xW,DenseMatrix:dl,RangeNode:xJ,Chain:xX,FunctionAssignmentNode:xQ,SparseMatrix:ga,ImmutableDenseMatrix:vy,Index:vx,AccessorNode:x0,AssignmentNode:x1,FibonacciHeap:vH,IndexNode:x2,Spa:yf,Unit:yh,SymbolNode:x3,FunctionNode:x5,Help:br,Parser:bt}),xX.createProxy(xR)},52985:function(e,r,t){var n;!function(e,i,a){function o(e){var r=this;r.next=function(){var e,t,n=r.x,i=r.i;return e=n[i],e^=e>>>7,t=e^e<<24^((e=n[i+1&7])^e>>>10)^((e=n[i+3&7])^e>>>3)^((e=n[i+4&7])^e<<7),e=n[i+7&7],e^=e<<13,t^=e^e<<9,n[i]=t,r.i=i+1&7,t};var t,n=e,i=[];if(n===(0|n))i[0]=n;else for(t=0,n=""+n;t<n.length;++t)i[7&t]=i[7&t]<<15^n.charCodeAt(t)+i[t+1&7]<<13;for(;i.length<8;)i.push(0);for(t=0;t<8&&0===i[t];++t);for(8==t?i[7]=-1:i[t],r.x=i,r.i=0,t=256;t>0;--t)r.next()}function s(e,r){return r.x=e.x.slice(),r.i=e.i,r}function u(e,r){null==e&&(e=+new Date);var t=new o(e),n=r&&r.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var e=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=t.next,i.quick=i,n&&(n.x&&s(n,t),i.state=function(){return s(t,{})}),i}i&&i.exports?i.exports=u:t.amdD&&t.amdO?void 0===(n=(function(){return u}).call(r,t,r,i))||(i.exports=n):this.xorshift7=u}(0,e=t.nmd(e),t.amdD)},54652:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,r){for(var t in r)Object.defineProperty(e,t,{enumerable:!0,get:r[t]})}(r,{default:function(){return u},getImageProps:function(){return s}});let n=t(28140),i=t(75040),a=t(81356),o=n._(t(71124));function s(e){let{props:r}=(0,i.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],qualities:[25,50,75,88,90],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,t]of Object.entries(r))void 0===t&&delete r[e];return{props:r}}let u=a.Image},55285:function(e,r,t){var n;!function(e,i,a){function o(e){var r=this,t="";r.x=0,r.y=0,r.z=0,r.w=0,r.next=function(){var e=r.x^r.x<<11;return r.x=r.y,r.y=r.z,r.z=r.w,r.w^=r.w>>>19^e^e>>>8},e===(0|e)?r.x=e:t+=e;for(var n=0;n<t.length+64;n++)r.x^=t.charCodeAt(n),r.next()}function s(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r}function u(e,r){var t=new o(e),n=r&&r.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var e=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=t.next,i.quick=i,n&&("object"==typeof n&&s(n,t),i.state=function(){return s(t,{})}),i}i&&i.exports?i.exports=u:t.amdD&&t.amdO?void 0===(n=(function(){return u}).call(r,t,r,i))||(i.exports=n):this.xor128=u}(0,e=t.nmd(e),t.amdD)},60247:function(e,r,t){var n;!function(e,i,a){function o(e){var r=this;r.next=function(){var e,t,n=r.w,i=r.X,a=r.i;return r.w=n=n+0x61c88647|0,t=i[a+34&127],e=i[a=a+1&127],t^=t<<13,e^=e<<17,t^=t>>>15,e^=e>>>12,t=i[a]=t^e,r.i=a,t+(n^n>>>16)|0},!function(e,r){var t,n,i,a,o,s=[],u=128;for(r===(0|r)?(n=r,r=null):(r+="\0",n=0,u=Math.max(u,r.length)),i=0,a=-32;a<u;++a)r&&(n^=r.charCodeAt((a+32)%r.length)),0===a&&(o=n),n^=n<<10,n^=n>>>15,n^=n<<4,n^=n>>>13,a>=0&&(o=o+0x61c88647|0,i=0==(t=s[127&a]^=n+o)?i+1:0);for(i>=128&&(s[127&(r&&r.length||0)]=-1),i=127,a=512;a>0;--a)n=s[i+34&127],t=s[i=i+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>
112,s[i]=n^t;e.w=o,e.X=s,e.i=i}(r,e)}function s(e,r){return r.i=e.i,r.w=e.w,r.X=e.X.slice(),r}function u(e,r){null==e&&(e=+new Date);var t=new o(e),n=r&&r.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var e=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===e);return e},i.int32=t.next,i.quick=i,n&&(n.X&&s(n,t),i.state=function(){return s(t,{})}),i}i&&i.exports?i.exports=u:t.amdD&&t.amdO?void 0===(n=(function(){return u}).call(r,t,r,i))||(i.exports=n):this.xor4096=u}(0,e=t.nmd(e),t.amdD)},64054:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),!function(e,r){for(var t in r)Object.defineProperty(e,t,{enumerable:!0,get:r[t]})}(r,{bindSnapshot:function(){return o},createAsyncLocalStorage:function(){return a},createSnapshot:function(){return s}});let t=Object.defineProperty(Error("Invariant: AsyncLocalStorage accessed in runtime where it is not available"),"__NEXT_ERROR_CODE",{value:"E504",enumerable:!1,configurable:!0});class n{disable(){throw t}getStore(){}run(){throw t}exit(){throw t}enterWith(){throw t}static bind(e){return e}}let i="undefined"!=typeof globalThis&&globalThis.AsyncLocalStorage;function a(){return i?new i:new n}function o(e){return i?i.bind(e):n.bind(e)}function s(){return i?i.snapshot():function(e,...r){return e(...r)}}},67909:(e,r,t)=>{"use strict";t.d(r,{default:()=>i.a});var n=t(86278),i=t.n(n)},68173:(e,r,t)=>{var n=t(35508),i=t(55285),a=t(33235),o=t(52985),s=t(60247),u=t(13905),l=t(95277);l.alea=n,l.xor128=i,l.xorwow=a,l.xorshift7=o,l.xor4096=s,l.tychei=u,e.exports=l},85748:function(e){e.exports=function(){"use strict";function e(){return!0}function r(){return!1}function t(){}let n="Argument is not a typed-function.";return function i(){let a,o;function s(e){return"object"==typeof e&&null!==e&&e.constructor===Object}let u=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:s},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],l={name:"any",test:e,isAny:!0},c=0,f={createCount:0};function m(e){let r,t=a.get(e);if(t)return t;let n='Unknown type "'+e+'"',i=e.toLowerCase();for(r of o)if(r.toLowerCase()===i){n+='. Did you mean "'+r+'" ?';break}throw TypeError(n)}function p(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",t=r?m(r).index:o.length,n=[];for(let r=0;r<e.length;++r){if(!e[r]||"string"!=typeof e[r].name||"function"!=typeof e[r].test)throw TypeError("Object with properties {name: string, test: function} expected");let i=e[r].name;if(a.has(i))throw TypeError('Duplicate type name "'+i+'"');n.push(i),a.set(i,{name:i,test:e[r].test,isAny:e[r].isAny,index:t+r,conversionsTo:[]})}let i=o.slice(t);o=o.slice(0,t).concat(n).concat(i);for(let e=t+n.length;e<o.length;++e)a.get(o[e]).index=e}function h(){a=new Map,o=[],c=0,p([l],!1)}function d(e){let r=o.filter(r=>{let t=a.get(r);return!t.isAny&&t.test(e)});return r.length?r:["any"]}function g(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function v(e,r,t){let i,a;if(!g(e))throw TypeError(n);let o=t&&t.exact,s=w(Array.isArray(r)?r.join(","):r),u=y(s);if(!o||u in e.signatures){let r=e._typedFunctionData.signatureMap.get(u);if(r)return r}let l=s.length;if(o){let r;for(r in i=[],e.signatures)i.push(e._typedFunctionData.signatureMap.get(r))}else i=e._typedFunctionData.signatures;for(let e=0;e<l;++e){let r,t=s[e],n=[];for(r of i){let i=E(r.params,e);if(i&&(!t.restParam||i.restParam)){if(!i.hasAny){let e=b(i);if(t.types.some(r=>!e.has(r.name)))continue}n.push(r)}}if(0===(i=n).length)break}for(a of i)if(a.params.length<=l)return a;throw TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+y(s,", ")+"))")}function y(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map(e=>e.name).join(r)}function x(e){let r=function(e){if(0===e.length)return[];let r=e.map(m);e.length>1&&r.sort((e,r)=>e.index-r.index);let t=r[0].conversionsTo;if(1===e.length)return t;t=t.concat([]);let n=new Set(e);for(let e=1;e<r.length;++e){let i;for(i of r[e].conversionsTo)n.has(i.from)||(t.push(i),n.add(i.from))}return t}(e.types.map(e=>e.name)),t=e.hasAny,n=e.name,i=r.map(function(e){let r=m(e.from);return t=r.isAny||t,n+="|"+e.from,{name:e.from,typeIndex:r.index,test:r.test,isAny:r.isAny,conversion:e,conversionIndex:e.index}});return{types:e.types.concat(i),name:n,hasAny:t,hasConversion:i.length>0,restParam:e.restParam}}function b(e){return e.typeSet||(e.typeSet=new Set,e.types.forEac
1h(r=>e.typeSet.add(r.name))),e.typeSet}function w(e){let r=[];if("string"!=typeof e)throw TypeError("Signatures must be strings");let t=e.trim();if(""===t)return r;let n=t.split(",");for(let e=0;e<n.length;++e){let t=function(e){let r=0===e.indexOf("..."),t=(r?e.length>3?e.slice(3):"any":e).split("|").map(e=>m(e.trim())),n=!1,i=r?"...":"";return{types:t.map(function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}}),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:r}}(n[e].trim());if(t.restParam&&e!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===t.types.length)return null;r.push(t)}return r}function D(e){let r=k(e);return!!r&&r.restParam}function N(r){if(!r||0===r.types.length)return e;if(1===r.types.length)return m(r.types[0].name).test;if(2===r.types.length){let e=m(r.types[0].name).test,t=m(r.types[1].name).test;return function(r){return e(r)||t(r)}}{let e=r.types.map(function(e){return m(e.name).test});return function(r){for(let t=0;t<e.length;t++)if(e[t](r))return!0;return!1}}}function E(e,r){return r<e.length?e[r]:D(e)?k(e):null}function A(e,r){let t=E(e,r);return t?b(t):new Set}function C(e){return null===e.conversion||void 0===e.conversion}function S(e,r){let t=new Set;return e.forEach(e=>{let n;for(n of A(e.params,r))t.add(n)}),t.has("any")?["any"]:Array.from(t)}function M(e,r,t){let n,i,a,o=e||"unnamed",s=t;for(a=0;a<r.length;a++){let e=[];
1if(s.forEach(t=>{let n=N(E(t.params,a));(a<t.params.length||D(t.params))&&n(r[a])&&e.push(t)}),0===e.length){if((i=S(s,a)).length>0){let e=d(r[a]);return(n=TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+a+")")).data={category:"wrongType",fn:o,index:a,actual:e,expected:i},n}}else s=e}let u=s.map(function(e){return D(e.params)?1/0:e.params.length});if(r.length<Math.min.apply(null,u))return(n=TypeError("Too few arguments in function "+o+" (expected: "+(i=S(s,a)).join(" or ")+", index: "+r.length+")")).data={category:"tooFewArgs",fn:o,index:r.length,expected:i},n;let l=Math.max.apply(null,u);if(r.length>l)return(n=TypeError("Too many arguments in function "+o+" (expected: "+l+", actual: "+r.length+")")).data={category:"tooManyArgs",fn:o,index:r.length,expectedLength:l},n;let c=[];for(let e=0;e<r.length;++e)c.push(d(r[e]).join("|"));return(n=TypeError('Arguments of type "'+c.join(", ")+'" do not match any of the defined signatures of function '+o+".")).data={category:"mismatch",actual:c},n}function F(e){let r=o.length+1;for(let t=0;t<e.types.length;t++)C(e.types[t])&&(r=Math.min(r,e.types[t].typeIndex));return r}function T(e){let r=c+1;for(let t=0;t<e.types.length;t++)C(e.types[t])||(r=Math.min(r,e.types[t].conversionIndex));return r}function B(e,r){let t,n,i=e.params,a=r.params,o=k(i),s=k(a),u=D(i),l=D(a);if(u&&o.hasAny){if(!l||!s.hasAny)return 1}else if(l&&s.hasAny)return -1;let c=0,f=0;for(t of i)t.hasAny&&++c,t.hasConversion&&++f;let m=0,p=0;for(t of a)t.hasAny&&++m,t.hasConversion&&++p;if(c!==m)return c-m;if(u&&o.hasConversion){if(!l||!s.hasConversion)return 1}else if(l&&s.hasConversion)return -1;if(f!==p)return f-p;if(u){if(!l)return 1}else if(l)return -1;let h=(i.length-a.length)*(u?-1:1);if(0!==h)return h;let d=[],g=0;for(let e=0;e<i.length;++e){let r=function(e,r){if(e.hasAny){if(!r.hasAny)return 1}else if(r.hasAny)return -1;if(e.restParam){if(!r.restParam)return 1}else if(r.restParam)return -1;if(e.hasConversion){if(!r.hasConversion)return 1}else if(r.hasConversion)return -1;let t=F(e)-F(r);if(t<0)return -1;if(t>0)return 1;let n=T(e)-T(r);return n<0?-1:+(n>0)}(i[e],a[e]);d.push(r),g+=r}if(0!==g)return g;for(n of d)if(0!==n)return n;return 0}function O(e){let r,t,n,i,a=[],o=[];switch(e.types.forEach(function(e){e.conversion&&(a.push(m(e.conversion.from).test),o.push(e.conversion.convert))}),o.length){case 0:return function(e){return e};case 1:return r=a[0],n=o[0],function(e){return r(e)?n(e):e};case 2:return r=a[0],t=a[1],n=o[0],i=o[1],function(e){return r(e)?n(e):t(e)?i(e):e};default:return function(e){for(let r=0;r<o.length;r++)if(a[r](e))return o[r](e);return e}}}function _(e,r,t){throw M(e,r,t)}function z(e){return I(e,0,e.length-1)}function k(e){return e[e.length-1]}function I(e,r,t){return Array.prototype.slice.call(e,r,t)}function R(e,r){return{referTo:{references:e,callback:r}}}function q(e){if("function"!=typeof e)throw TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function P(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function j(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function U(e,r){if(!e)return r;if(r&&r!==e){let t=Error("Function names do not match (expected: "+e+", actual: "+r+")");throw t.data={actual:r,expected:e},t}return e}h(),p(u);let L=f;function $(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return(f=function(e){let n="string"==typeof e,i=+!!n,a=n?e:"",o={};for(let e=i;e<arguments.length;++e){let r,t=arguments[e],i={};if("function"==typeof t?(r=t.name,"string"==typeof t.signature?i[t.signature]=t:g(t)&&(i=t.signatures)):s(t)&&(i=t,n||(r=function(e){let r;for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(g(e[t])||"string"==typeof e[t].signature)&&(r=U(r,e[t].name));return r}(t))),0===Object.keys(i).length){let r=TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw r.data={index:e,argument:t},r}n||(a=U(a,r)),function(e,r){let t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(t in e&&r[t]!==e[t]){let n=Error('Signature "'+t+'" is defined twice');throw n.data={signature:t,sourceFunction:r[t],destFunction:e[t]},n}e[t]=r[t]}}(o,i)}return function(e,n){let i,a;if(f.createCount++,0===Object.keys(n).length)throw SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&function(e){let r=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach(t=>{let n=e[t];if(r.test(n.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}(n);let o=[],s=[],u={},l=[];for(i in n){let e;if(!Object.prototype.hasOwnProperty.call(n,i))continue;let r=w(i);if(!r)continue;o.forEach(function(e){if(function(e,r){let t=Math.max(e.length,r.length);for(let n=0;n<t;n++){let t,i=A(e,n),a=A(r,n),o=!1;for(t of a)if(i.has(t)){o=!0;break}if(!o)return!1}let n=e.length,i=r.length,a=D(e),o=D(r);return a?o?n===i:i>=n:o?n>=i:n===i}(e,r))throw TypeError('Conflicting signatures "'+y(e)+'" and "'+y(r)+'".')}),o.push(r);let t=s.length;for(e of(s.push(n[i]),function e(r,t,n){if(!(t<r.length))return[n];{var i,a;let o=r[t],s=[];if(o.restParam){let e=o.types.filter(C);e.length<o.types.length&&s.push({types:e,name:"..."+e.map(e=>e.name).join("|"),hasAny:e.some(e=>e.isAny),hasConversion:!1,restParam:!0}),s.push(o)}else s=o.types.map(function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}});return i=s,a=function(i){return e(r,t+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(a))}}(r.map(x),0,[]))){let r=y(e);l.push({params:e,name:r,fn:t}),e.every(e=>!e.hasConversion)&&(u[r]=t)}}l.sort(B);let c=function(e,r,t){let n=e.map(e=>j(e)?q(e.referToSelf.callback):P(e)?R(e.referTo.references,e.referTo.callback):e),i=Array(n.length).fill(!1),a=!0;for(;a;){a=!1;let e=!0;for(let o=0;o<n.length;++o){if(i[o])continue;let s=n[o];if(j(s))n[o]=s.referToSelf.callback(t),n[o].referToSelf=s.referToSelf,i[o]=!0,e=!1;else if(P(s)){let t=function(e,r,t){let n,i=[];for(n of e){let e=t[n];if("number"!=typeof e)throw TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(e=r[e]))return!1;i.push(e)}return i}(s.referTo.references,n,r);t?(n[o]=s.referTo.callback.apply(this,t),n[o].referTo=s.referTo,i[o]=!0,e=!1):a=!0}}if(e&&a)throw SyntaxError("Circular reference detected in resolving typed.referTo")}return n}(s,u,ef);for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&(u[a]=c[u[a]]);let m=[],p=new Map;for(a of l)p.has(a.name)||(a.fn=c[a.fn],m.push(a),p.set(a.name,a));let h=m[0]&&m[0].params.length<=2&&!D(m[0].params),d=m[1]&&m[1].params.length<=2&&!D(m[1].params),g=m[2]&&m[2].params.length<=2&&!D(m[2].params),v=m[3]&&m[3].params.length<=2&&!D(m[3].params),b=m[4]&&m[4].params.length<=2&&!D(m[4].params),E=m[5]&&m[5].params.length<=2&&!D(m[5].params);for(let e=0;e<m.length;++e)m[e].test=function(e){let r,t,n;if(D(e)){let t=(r=z(e).map(N)).length,n=N(k(e)),i=function(e){for(let r=t;r<e.length;r++)if(!n(e[r]))return!1;return!0};return function(e){for(let t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return i(e)&&e.length>=t+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(t=N(e[0]),function(e){return t(e[0])&&1===e.length}):2===e.length?(t=N(e[0]),n=N(e[1]),function(e){return t(e[0])&&n(e[1])&&2===e.length}):(r=e.map(N),function(e){for(let t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return e.length===r.length})}(m[e].params);let S=h?N(m[0].params[0]):r,M=d?N(m[1].params[0]):r,F=g?N(m[2].params[0]):r,T=v?N(m[3].params[0]):r,_=b?N(m[4].params[0]):r,U=E?N(m[5].params[0]):r,L=h?N(m[0].params[1]):r,$=d?N(m[1].params[1]):r,H=g?N(m[2].params[1]):r,G=v?N(m[3].params[1]):r,Z=b?N(m[4].params[1]):r,V=E?N(m[5].params[1]):r;for(let e=0;e<m.length;++e)m[e].implementation=function(e,r){let t=r;if(e.some(e=>e.hasConversion)){let n=D(e),i=e.map(O);t=function(){let e=[],t=n?arguments.length-1:arguments.length;for(let r=0;r<t;r++)e[r]=i[r](arguments[r]);return n&&(e[t]=arguments[t].map(i[t])),r.apply(this,e)}}let n=t;if(D(e)){let r=e.length-1;n=function(){return t.apply(this,I(arguments,0,r).concat([I(arguments,r)]))}}return n}(m[e].params,m[e].fn);let W=h?m[0].implementation:t,J=d?m[1].implementation:t,Y=g?m[2].implementation:t,X=v?m[3].implementation:t,Q=b?m[4].implementation:t,K=E?m[5].implementation:t,ee=h?m[0].params.length:-1,er=d?m[1].params.length:-1,et=g?m[2].params.length:-1,en=v?m[3].params.length:-1,ei=b?m[4].params.length:-1,ea=E?m[5].params.length:-1,eo=6*!!(h&&d&&g&&v&&b&&E),es=m.length,eu=m.map(e=>e.test),el=m.map(e=>e.implementation),ec=function(){for(let e=eo;e<es;e++)if(eu[e](arguments))return el[e].apply(this,arguments);return f.onMismatch(e,arguments,m)};function ef(e,r){return arguments.length===ee&&S(e)&&L(r)?W.apply(this,arguments):arguments.length===er&&M(e)&&$(r)?J.apply(this,arguments):arguments.length===et&&F(e)&&H(r)?Y.apply(this,arguments):arguments.length===en&&T(e)&&G(r)?X.apply(this,arguments):arguments.length===ei&&_(e)&&Z(r)?Q.apply(this,arguments):arguments.length===ea&&U(e)&&V(r)?K.apply(this,arguments):ec.apply(this,arguments)}try{Object.defineProperty(ef,"name",{value:e})}catch(e){}return ef.signatures=u,ef._typedFunctionData={signatures:m,signatureMap:p},ef}(a||"",o)}).create=i,f.createCount=L.createCount,f.onMismatch=_,f.throwMismatchError=_,f.createError=M,f.clear=h,f.clearConversions=function(){let e;
1for(e of o)a.get(e).conversionsTo=[];c=0},f.addTypes=p,f._findType=m,f.referTo=function(){let e=z(arguments).map(e=>y(w(e))),r=k(arguments);if("function"!=typeof r)throw TypeError("Callback function expected as last argument");return R(e,r)},f.referToSelf=q,f.convert=function(e,r){let t=m(r);if(t.test(e))return e;let n=t.conversionsTo;if(0===n.length)throw Error("There are no conversions to "+r+" defined.");for(let r=0;r<n.length;r++)if(m(n[r].from).test(e))return n[r].convert(e);throw Error("Cannot convert "+e+" to "+r)},f.findSignature=v,f.find=function(e,r,t){return v(e,r,t).implementation},f.isTypedFunction=g,f.warnAgainstDeprecatedThis=!0,f.addType=function(e,r){let t="any";!1!==r&&a.has("Object")&&(t="Object"),f.addTypes([e],t)},f.addConversion=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};$(e);let t=m(e.to),n=t.conversionsTo.find(r=>r.from===e.from);if(n)if(r&&r.override)f.removeConversion({from:n.from,to:e.to,convert:n.convert});else throw Error('There is already a conversion from "'+e.from+'" to "'+t.name+'"');t.conversionsTo.push({from:e.from,convert:e.convert,index:c++})},f.addConversions=function(e,r){e.forEach(e=>f.addConversion(e,r))},f.removeConversion=function(e){$(e);let r=m(e.to),t=function(e,r){for(let t=0;t<e.length;t++)if(r(e[t]))return e[t]}(r.conversionsTo,r=>r.from===e.from);if(!t)throw Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(t.convert!==e.convert)throw Error("Conversion to remove does not match existing conversion");let n=r.conversionsTo.indexOf(t);r.conversionsTo.splice(n,1)},f.resolve=function(e,r){if(!g(e))throw TypeError(n);let t=e._typedFunctionData.signatures;for(let e=0;e<t.length;++e)if(t[e].test(r))return t[e];return null},f}()}()},86278:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return i}});let n=t(28140)._(t(1150));function i(e,r){var t;let i={};"function"==typeof e&&(i.loader=e);let a={...i,...r};return(0,n.default)({...a,modules:null==(t=a.loadableGenerated)?void 0:t.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),e.exports=r.default)},86779:(e,r,t)=>{"use strict";t.d(r,{A:()=>i});var n=t(33861);function i(e){var r=function(e,r){if("object"!=(0,n.A)(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,r||"default");if("object"!=(0,n.A)(i))return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==(0,n.A)(r)?r:r+""}},88945:(e,r,t)=>{"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(null,arguments)}t.d(r,{A:()=>n})},95277:function(e,r,t){var n;!function(i,a,o){var s,u=o.pow(256,6),l=o.pow(2,52),c=2*l;function f(e,r,t){var n=[],f=h(function e(r,t){var n,i=[],a=typeof r;if(t&&"object"==a)for(n in r)try{i.push(e(r[n],t-1))}catch(e){}return i.length?i:"string"==a?r:r+"\0"}((r=!0==r?{entropy:!0}:r||{}).entropy?[e,d(a)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(256):(e=new Uint8Array(256),(i.crypto||i.msCrypto).getRandomValues(e)),d(e)}catch(e){var r=i.navigator,t=r&&r.plugins;return[+new Date,i,t,i.screen,d(a)]}}():e,3),n),g=new m(n),v=function(){for(var e=g.g(6),r=u,t=0;e<l;)e=(e+t)*256,r*=256,t=g.g(1);for(;e>=c;)e/=2,r/=2,t>>>=1;return(e+t)/r};return v.int32=function(){return 0|g.g(4)},v.quick=function(){return g.g(4)/0x100000000},v.double=v,h(d(g.S),a),(r.pass||t||function(e,r,t,n){return(n&&(n.S&&p(n,g),e.state=function(){return p(g,{})}),t)?(o.random=e,r):e})(v,f,"global"in r?r.global:this==o,r.state)}function m(e){var r,t=e.length,n=this,i=0,a=n.i=n.j=0,o=n.S=[];for(t||(e=[t++]);i<256;)o[i]=i++;for(i=0;i<256;i++)o[i]=o[a=255&a+e[i%t]+(r=o[i])],o[a]=r;(n.g=function(e){for(var r,t=0,i=n.i,a=n.j,o=n.S;e--;)r=o[i=255&i+1],t=256*t+o[255&(o[i]=o[a=255&a+r])+(o[a]=r)];return n.i=i,n.j=a,t})(256)}function p(e,r){return r.i=e.i,r.j=e.j,r.S=e.S.slice(),r}function h(e,r){for(var t,n=e+"",i=0;i<n.length;)r[255&i]=255&(t^=19*r[255&i])+n.charCodeAt(i++);return d(r)}function d(e){return String.fromCharCode.apply(0,e)}if(h(o.random(),a),e.exports){e.exports=f;try{s=t(41234)}catch(e){}}else void 0===(n=(function(){return f}).call(r,t,r,e))||(e.exports=n)}("undefined"!=typeof self?self:this,[],Math)}}]); 2//# sourceMappingURL=7762-f9c914e2e1579fb8.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.