mathjs 14.2.0 → 14.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/HISTORY.md +4 -0
- package/lib/browser/math.js +1 -1
- package/lib/browser/math.js.LICENSE.txt +2 -2
- package/lib/browser/math.js.map +1 -1
- package/lib/cjs/header.js +2 -2
- package/lib/cjs/version.js +1 -1
- package/lib/esm/version.js +1 -1
- package/package.json +6 -7
package/lib/browser/math.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
/*! For license information please see math.js.LICENSE.txt */
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,(()=>(()=>{var e={3144:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},r={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},i=function(e,n){return t({},e,n)};e.exports=function(e){for(var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.preserveFormatting,s=void 0!==a&&a,u=o.escapeMapFn,c=void 0===u?i:u,l=String(e),f="",p=c(t({},n),s?t({},r):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,n){e||l.length>=t.length&&l.slice(0,t.length)===t&&(f+=p[m[n]],l=l.slice(t.length,l.length),e=!0)})),e||(f+=l.slice(0,1),l=l.slice(1,l.length))};l;)h();return f}},1880:e=>{e.exports=function e(t,n){"use strict";var r,i,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,a=/(^[ ]*|[ ]*$)/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,c=/^0/,l=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},f=l(t).replace(a,"")||"",p=l(n).replace(a,"")||"",m=f.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||d&&p.match(s)&&Date.parse(p)||null;if(g){if(d<g)return-1;if(d>g)return 1}for(var y=0,x=Math.max(m.length,h.length);y<x;y++){if(r=!(m[y]||"").match(c)&&parseFloat(m[y])||m[y]||0,i=!(h[y]||"").match(c)&&parseFloat(h[y])||h[y]||0,isNaN(r)!==isNaN(i))return isNaN(r)?1:-1;if(typeof r!=typeof i&&(r+="",i+=""),r<i)return-1;if(r>i)return 1}return 0}},7391:(e,t,n)=>{var r=n(7180),i=n(3181),o=n(3031),a=n(9067),s=n(6833),u=n(6098),c=n(4801);c.alea=r,c.xor128=i,c.xorwow=o,c.xorshift7=a,c.xor4096=s,c.tychei=u,e.exports=c},7180:function(e,t,n){var r;!function(e,i){function o(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n<e.length;n++){var r=.02519603282416938*(t+=e.charCodeAt(n));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var n=new o(e),r=t&&t.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.alea=s}(0,e=n.nmd(e),n.amdD)},6098:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,i=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r<n.length+20;r++)t.b^=0|n.charCodeAt(r),t.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function s(e,t){var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.tychei=s}(0,e=n.nmd(e),n.amdD)},3181:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function s(e,t){var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xor128=s}(0,e=n.nmd(e),n.amdD)},6833:function(e,t,n){var r;!function(e,i){function o(e){var t=this;t.next=function(){var e,n,r=t.w,i=t.X,o=t.i;return t.w=r=r+1640531527|0,n=i[o+34&127],e=i[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=i[o]=n^e,t.i=o,n+(r^r>>>16)|0},function(e,t){var n,r,i,o,a,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),i=0,o=-32;o<u;++o)t&&(r^=t.charCodeAt((o+32)%t.length)),0===o&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,o>=0&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,o=512;o>0;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;e.w=a,e.X=s,e.i=i}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&(r.X&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xor4096=s}(0,e=n.nmd(e),n.amdD)},9067:function(e,t,n){var r;!function(e,i){function o(e){var t=this;t.next=function(){var e,n,r=t.x,i=t.i;return e=r[i],n=(e^=e>>>7)^e<<24,n^=(e=r[i+1&7])^e>>>10,n^=(e=r[i+3&7])^e>>>3,n^=(e=r[i+4&7])^e<<7,e=r[i+7&7],n^=(e^=e<<13)^e<<9,r[i]=n,t.i=i+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n<t.length;++n)r[7&n]=r[7&n]<<15^t.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],e.x=r,e.i=0,n=256;n>0;--n)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&(r.x&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xorshift7=s}(0,e=n.nmd(e),n.amdD)},3031:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function s(e,t){var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xorwow=s}(0,e=n.nmd(e),n.amdD)},4801:function(e,t,n){var r;!function(i,o,a){var s,u=256,c=a.pow(u,6),l=a.pow(2,52),f=2*l,p=255;function m(e,t,n){var r=[],p=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,x(o)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(u):(e=new Uint8Array(u),(i.crypto||i.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=i.navigator,n=t&&t.plugins;return[+new Date,i,n,i.screen,x(o)]}}():e,3),r),m=new h(r),b=function(){for(var e=m.g(6),t=c,n=0;e<l;)e=(e+n)*u,t*=u,n=m.g(1);for(;e>=f;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|m.g(4)},b.quick=function(){return m.g(4)/4294967296},b.double=b,y(x(m.S),o),(t.pass||n||function(e,t,n,r){return r&&(r.S&&d(r,m),e.state=function(){return d(m,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,i=0,o=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);i<u;)a[i]=i++;for(i=0;i<u;i++)a[i]=a[o=p&o+e[i%n]+(t=a[i])],a[o]=t;(r.g=function(e){for(var t,n=0,i=r.i,o=r.j,a=r.S;e--;)t=a[i=p&i+1],n=n*u+a[p&(a[i]=a[o=p&o+t])+(a[o]=t)];return r.i=i,r.j=o,n})(u)}function d(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var n,r=[],i=typeof e;if(t&&"object"==i)for(n in e)try{r.push(g(e[n],t-1))}catch(e){}return r.length?r:"string"==i?e:e+"\0"}function y(e,t){for(var n,r=e+"",i=0;i<r.length;)t[p&i]=p&(n^=19*t[p&i])+r.charCodeAt(i++);return x(t)}function x(e){return String.fromCharCode.apply(0,e)}if(y(a.random(),o),e.exports){e.exports=m;try{s=n(1234)}catch(e){}}else void 0===(r=function(){return m}.call(t,n,t,e))||(e.exports=r)}("undefined"!=typeof self?self:this,[],Math)},1504:e=>{function t(){}t.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,i=n.length;r<i;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],i=[];if(r&&t)for(var o=0,a=r.length;o<a;o++)r[o].fn!==t&&r[o].fn._!==t&&i.push(r[o]);return i.length?n[e]=i:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t},1234:()=>{},9306:(e,t,n)=>{"use strict";var r=n(4901),i=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a function")}},5548:(e,t,n)=>{"use strict";var r=n(3517),i=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a constructor")}},3506:(e,t,n)=>{"use strict";var r=n(3925),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},6469:(e,t,n)=>{"use strict";var r=n(8227),i=n(2360),o=n(4913).f,a=r("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},7829:(e,t,n)=>{"use strict";var r=n(8183).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},679:(e,t,n)=>{"use strict";var r=n(1625),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not an object")}},9617:(e,t,n)=>{"use strict";var r=n(5397),i=n(5610),o=n(6198),a=function(e){return function(t,n,a){var s=r(t),u=o(s);if(0===u)return!e&&-1;var c,l=i(a,u);if(e&&n!=n){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},4598:(e,t,n)=>{"use strict";var r=n(9039);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){return 1},1)}))}},926:(e,t,n)=>{"use strict";var r=n(9306),i=n(8981),o=n(7055),a=n(6198),s=TypeError,u="Reduce of empty array with no initial value",c=function(e){return function(t,n,c,l){var f=i(t),p=o(f),m=a(f);if(r(n),0===m&&c<2)throw new s(u);var h=e?m-1:0,d=e?-1:1;if(c<2)for(;;){if(h in p){l=p[h],h+=d;break}if(h+=d,e?h<0:m<=h)throw new s(u)}for(;e?h>=0:m>h;h+=d)h in p&&(l=n(l,p[h],h,f));return l}};e.exports={left:c(!1),right:c(!0)}},7680:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r([].slice)},4488:(e,t,n)=>{"use strict";var r=n(7680),i=Math.floor,o=function(e,t){var n=e.length;if(n<8)for(var a,s,u=1;u<n;){for(s=u,a=e[u];s&&t(e[s-1],a)>0;)e[s]=e[--s];s!==u++&&(e[s]=a)}else for(var c=i(n/2),l=o(r(e,0,c),t),f=o(r(e,c),t),p=l.length,m=f.length,h=0,d=0;h<p||d<m;)e[h+d]=h<p&&d<m?t(l[h],f[d])<=0?l[h++]:f[d++]:h<p?l[h++]:f[d++];return e};e.exports=o},6319:(e,t,n)=>{"use strict";var r=n(8551),i=n(9539);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){i(e,"throw",t)}}},4428:(e,t,n)=>{"use strict";var r=n(8227)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},2195:(e,t,n)=>{"use strict";var r=n(9504),i=r({}.toString),o=r("".slice);e.exports=function(e){return o(i(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),i=n(4901),o=n(2195),a=n(8227)("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?n:u?o(t):"Object"===(r=o(t))&&i(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),i=n(5031),o=n(7347),a=n(4913);e.exports=function(e,t,n){for(var s=i(t),u=a.f,c=o.f,l=0;l<s.length;l++){var f=s[l];r(e,f)||n&&r(n,f)||u(e,f,c(t,f))}}},2211:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},6699:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),o=n(6980);e.exports=r?function(e,t,n){return i.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4659:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),o=n(6980);e.exports=function(e,t,n){r?i.f(e,t,o(0,n)):e[t]=n}},2106:(e,t,n)=>{"use strict";var r=n(283),i=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),i.f(e,t,n)}},6840:(e,t,n)=>{"use strict";var r=n(4901),i=n(4913),o=n(283),a=n(9433);e.exports=function(e,t,n,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:t;if(r(n)&&o(n,c,s),s.global)u?e[t]=n:a(t,n);else{try{s.unsafe?e[t]&&(u=!0):delete e[t]}catch(e){}u?e[t]=n:i.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6279:(e,t,n)=>{"use strict";var r=n(6840);e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},9433:(e,t,n)=>{"use strict";var r=n(4576),i=Object.defineProperty;e.exports=function(e,t){try{i(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},4606:(e,t,n)=>{"use strict";var r=n(6823),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw new i("Cannot delete property "+r(t)+" of "+r(e))}},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,n)=>{"use strict";var r=n(4576),i=n(34),o=r.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:(e,t,n)=>{"use strict";var r=n(2839).match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},3763:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/MSIE|Trident/.test(r)},4265:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},9544:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},6193:(e,t,n)=>{"use strict";var r=n(4215);e.exports="NODE"===r},7860:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/web0s(?!.*chrome)/i.test(r)},2839:(e,t,n)=>{"use strict";var r=n(4576).navigator,i=r&&r.userAgent;e.exports=i?String(i):""},9519:(e,t,n)=>{"use strict";var r,i,o=n(4576),a=n(2839),s=o.process,u=o.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(i=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=+r[1]),e.exports=i},3607:(e,t,n)=>{"use strict";var r=n(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},4215:(e,t,n)=>{"use strict";var r=n(4576),i=n(2839),o=n(2195),a=function(e){return i.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},6518:(e,t,n)=>{"use strict";var r=n(4576),i=n(7347).f,o=n(6699),a=n(6840),s=n(9433),u=n(7740),c=n(2796);e.exports=function(e,t){var n,l,f,p,m,h=e.target,d=e.global,g=e.stat;if(n=d?r:g?r[h]||s(h,{}):r[h]&&r[h].prototype)for(l in t){if(p=t[l],f=e.dontCallGetSet?(m=i(n,l))&&m.value:n[l],!c(d?l:h+(g?".":"#")+l,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(e.sham||f&&f.sham)&&o(p,"sham",!0),a(n,l,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9228:(e,t,n)=>{"use strict";n(7495);var r=n(9565),i=n(6840),o=n(7323),a=n(9039),s=n(8227),u=n(6699),c=s("species"),l=RegExp.prototype;e.exports=function(e,t,n,f){var p=s(e),m=!a((function(){var t={};return t[p]=function(){return 7},7!==""[e](t)})),h=m&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[p]=/./[p]),n.exec=function(){return t=!0,null},n[p](""),!t}));if(!m||!h||n){var d=/./[p],g=t(p,""[e],(function(e,t,n,i,a){var s=t.exec;return s===o||s===l.exec?m&&!a?{done:!0,value:r(d,t,n,i)}:{done:!0,value:r(e,n,t,i)}:{done:!1}}));i(String.prototype,e,g[0]),i(l,p,g[1])}f&&u(l[p],"sham",!0)}},8745:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(o):function(){return a.apply(o,arguments)})},6080:(e,t,n)=>{"use strict";var r=n(7476),i=n(9306),o=n(616),a=r(r.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),i=n(9297),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=i(o,"name"),u=s&&"something"===function(){}.name,c=s&&(!r||r&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},6706:(e,t,n)=>{"use strict";var r=n(9504),i=n(9306);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},7476:(e,t,n)=>{"use strict";var r=n(2195),i=n(9504);e.exports=function(e){if("Function"===r(e))return i(e)}},9504:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);e.exports=r?a:function(e){return function(){return o.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4576),i=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],i(n)?n:void 0):r[e]&&r[e][t];var n}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},851:(e,t,n)=>{"use strict";var r=n(6955),i=n(5966),o=n(4117),a=n(6269),s=n(8227)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[r(e)]}},81:(e,t,n)=>{"use strict";var r=n(9565),i=n(9306),o=n(8551),a=n(6823),s=n(851),u=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(i(n))return o(r(n,e));throw new u(a(e)+" is not iterable")}},6933:(e,t,n)=>{"use strict";var r=n(9504),i=n(4376),o=n(4901),a=n(2195),s=n(655),u=r([].push);e.exports=function(e){if(o(e))return e;if(i(e)){for(var t=e.length,n=[],r=0;r<t;r++){var c=e[r];"string"==typeof c?u(n,c):"number"!=typeof c&&"Number"!==a(c)&&"String"!==a(c)||u(n,s(c))}var l=n.length,f=!0;return function(e,t){if(f)return f=!1,t;if(i(this))return t;for(var r=0;r<l;r++)if(n[r]===e)return t}}}},5966:(e,t,n)=>{"use strict";var r=n(9306),i=n(4117);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},2478:(e,t,n)=>{"use strict";var r=n(9504),i=n(8981),o=Math.floor,a=r("".charAt),s=r("".replace),u=r("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,r,f,p){var m=n+e.length,h=r.length,d=l;return void 0!==f&&(f=i(f),d=c),s(p,d,(function(i,s){var c;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return u(t,0,n);case"'":return u(t,m);case"<":c=f[u(s,1,-1)];break;default:var l=+s;if(0===l)return i;if(l>h){var p=o(l/10);return 0===p?i:p<=h?void 0===r[p-1]?a(s,1):r[p-1]+a(s,1):i}c=r[l-1]}return void 0===c?"":c}))}},4576:function(e){"use strict";var t=function(e){return e&&e.Math===Math&&e};e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||t("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,n)=>{"use strict";var r=n(9504),i=n(8981),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},421:e=>{"use strict";e.exports={}},3138:e=>{"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},5917:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039),o=n(4055);e.exports=!r&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(2195),a=Object,s=r("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},3167:(e,t,n)=>{"use strict";var r=n(4901),i=n(34),o=n(2967);e.exports=function(e,t,n){var a,s;return o&&r(a=t.constructor)&&a!==n&&i(s=a.prototype)&&s!==n.prototype&&o(e,s),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),i=n(4901),o=n(7629),a=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},1181:(e,t,n)=>{"use strict";var r,i,o,a=n(8622),s=n(4576),u=n(34),c=n(6699),l=n(9297),f=n(7629),p=n(6119),m=n(421),h="Object already initialized",d=s.TypeError,g=s.WeakMap;if(a||f.state){var y=f.state||(f.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw new d(h);return t.facade=e,y.set(e,t),t},i=function(e){return y.get(e)||{}},o=function(e){return y.has(e)}}else{var x=p("state");m[x]=!0,r=function(e,t){if(l(e,x))throw new d(h);return t.facade=e,c(e,x,t),t},i=function(e){return l(e,x)?e[x]:{}},o=function(e){return l(e,x)}}e.exports={set:r,get:i,has:o,enforce:function(e){return o(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!u(t)||(n=i(t)).type!==e)throw new d("Incompatible receiver, "+e+" required");return n}}}},4209:(e,t,n)=>{"use strict";var r=n(8227),i=n(6269),o=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},4376:(e,t,n)=>{"use strict";var r=n(2195);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},3517:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(4901),a=n(6955),s=n(7751),u=n(3706),c=function(){},l=s("Reflect","construct"),f=/^\s*(?:class|function)\b/,p=r(f.exec),m=!f.test(c),h=function(e){if(!o(e))return!1;try{return l(c,[],e),!0}catch(e){return!1}},d=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return m||!!p(f,u(e))}catch(e){return!0}};d.sham=!0,e.exports=!l||i((function(){var e;return h(h.call)||!h(Object)||!h((function(){e=!0}))||e}))?d:h},2796:(e,t,n)=>{"use strict";var r=n(9039),i=n(4901),o=/#|\.prototype\./,a=function(e,t){var n=u[s(e)];return n===l||n!==c&&(i(t)?r(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},3925:(e,t,n)=>{"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},6395:e=>{"use strict";e.exports=!1},788:(e,t,n)=>{"use strict";var r=n(34),i=n(2195),o=n(8227)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},757:(e,t,n)=>{"use strict";var r=n(7751),i=n(4901),o=n(1625),a=n(7040),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&o(t.prototype,s(e))}},2652:(e,t,n)=>{"use strict";var r=n(6080),i=n(9565),o=n(8551),a=n(6823),s=n(4209),u=n(6198),c=n(1625),l=n(81),f=n(851),p=n(9539),m=TypeError,h=function(e,t){this.stopped=e,this.result=t},d=h.prototype;e.exports=function(e,t,n){var g,y,x,b,v,w,N,E=n&&n.that,A=!(!n||!n.AS_ENTRIES),S=!(!n||!n.IS_RECORD),M=!(!n||!n.IS_ITERATOR),C=!(!n||!n.INTERRUPTED),T=r(t,E),B=function(e){return g&&p(g,"normal",e),new h(!0,e)},D=function(e){return A?(o(e),C?T(e[0],e[1],B):T(e[0],e[1])):C?T(e,B):T(e)};if(S)g=e.iterator;else if(M)g=e;else{if(!(y=f(e)))throw new m(a(e)+" is not iterable");if(s(y)){for(x=0,b=u(e);b>x;x++)if((v=D(e[x]))&&c(d,v))return v;return new h(!1)}g=l(e,y)}for(w=S?e.next:g.next;!(N=i(w,g)).done;){try{v=D(N.value)}catch(e){p(g,"throw",e)}if("object"==typeof v&&v&&c(d,v))return v}return new h(!1)}},9539:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),o=n(5966);e.exports=function(e,t,n){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw n;return n}a=r(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw n;if(s)throw a;return i(a),n}},9462:(e,t,n)=>{"use strict";var r=n(9565),i=n(2360),o=n(6699),a=n(6279),s=n(8227),u=n(1181),c=n(5966),l=n(7657).IteratorPrototype,f=n(2529),p=n(9539),m=s("toStringTag"),h="IteratorHelper",d="WrapForValidIterator",g=u.set,y=function(e){var t=u.getterFor(e?d:h);return a(i(l),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return f(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:f(r,n.done)}catch(e){throw n.done=!0,e}},return:function(){var n=t(this),i=n.iterator;if(n.done=!0,e){var o=c(i,"return");return o?r(o,i):f(void 0,!0)}if(n.inner)try{p(n.inner.iterator,"normal")}catch(e){return p(i,"throw",e)}return i&&p(i,"normal"),f(void 0,!0)}})},x=y(!0),b=y(!1);o(b,m,"Iterator Helper"),e.exports=function(e,t,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=t?d:h,i.returnHandlerResult=!!n,i.nextHandler=e,i.counter=0,i.done=!1,g(this,i)};return r.prototype=t?x:b,r}},713:(e,t,n)=>{"use strict";var r=n(9565),i=n(9306),o=n(8551),a=n(1767),s=n(9462),u=n(6319),c=s((function(){var e=this.iterator,t=o(r(this.next,e));if(!(this.done=!!t.done))return u(e,this.mapper,[t.value,this.counter++],!0)}));e.exports=function(e){return o(this),i(e),new c(a(this),{mapper:e})}},7657:(e,t,n)=>{"use strict";var r,i,o,a=n(9039),s=n(4901),u=n(34),c=n(2360),l=n(2787),f=n(6840),p=n(8227),m=n(6395),h=p("iterator"),d=!1;[].keys&&("next"in(o=[].keys())?(i=l(l(o)))!==Object.prototype&&(r=i):d=!0),!u(r)||a((function(){var e={};return r[h].call(e)!==e}))?r={}:m&&(r=c(r)),s(r[h])||f(r,h,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:d}},6269:e=>{"use strict";e.exports={}},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},283:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(4901),a=n(9297),s=n(3724),u=n(350).CONFIGURABLE,c=n(3706),l=n(1181),f=l.enforce,p=l.get,m=String,h=Object.defineProperty,d=r("".slice),g=r("".replace),y=r([].join),x=s&&!i((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),v=e.exports=function(e,t,n){"Symbol("===d(m(t),0,7)&&(t="["+g(m(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||u&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),x&&n&&a(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=f(e);return a(r,"source")||(r.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=v((function(){return o(this)&&p(this).source||c(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},1955:(e,t,n)=>{"use strict";var r,i,o,a,s,u=n(4576),c=n(3389),l=n(6080),f=n(9225).set,p=n(8265),m=n(9544),h=n(4265),d=n(7860),g=n(6193),y=u.MutationObserver||u.WebKitMutationObserver,x=u.document,b=u.process,v=u.Promise,w=c("queueMicrotask");if(!w){var N=new p,E=function(){var e,t;for(g&&(e=b.domain)&&e.exit();t=N.get();)try{t()}catch(e){throw N.head&&r(),e}e&&e.enter()};m||g||d||!y||!x?!h&&v&&v.resolve?((a=v.resolve(void 0)).constructor=v,s=l(a.then,a),r=function(){s(E)}):g?r=function(){b.nextTick(E)}:(f=l(f,u),r=function(){f(E)}):(i=!0,o=x.createTextNode(""),new y(E).observe(o,{characterData:!0}),r=function(){o.data=i=!i}),w=function(e){N.head||r(),N.add(e)}}e.exports=w},6043:(e,t,n)=>{"use strict";var r=n(9306),i=TypeError,o=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw new i("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},2360:(e,t,n)=>{"use strict";var r,i=n(8551),o=n(6801),a=n(8727),s=n(421),u=n(397),c=n(4055),l=n(6119),f="prototype",p="script",m=l("IE_PROTO"),h=function(){},d=function(e){return"<"+p+">"+e+"</"+p+">"},g=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;y="undefined"!=typeof document?document.domain&&r?g(r):(t=c("iframe"),n="java"+p+":",t.style.display="none",u.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):g(r);for(var i=a.length;i--;)delete y[f][a[i]];return y()};s[m]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[f]=i(e),n=new h,h[f]=null,n[m]=e):n=y(),void 0===t?n:o.f(n,t)}},6801:(e,t,n)=>{"use strict";var r=n(3724),i=n(8686),o=n(4913),a=n(8551),s=n(5397),u=n(1072);t.f=r&&!i?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),i=u(t),c=i.length,l=0;c>l;)o.f(e,n=i[l++],r[n]);return e}},4913:(e,t,n)=>{"use strict";var r=n(3724),i=n(5917),o=n(8686),a=n(8551),s=n(6969),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",p="configurable",m="writable";t.f=r?o?function(e,t,n){if(a(e),t=s(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&m in n&&!n[m]){var r=l(e,t);r&&r[m]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:f in n?n[f]:r[f],writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(a(e),t=s(t),a(n),i)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),i=n(9565),o=n(8773),a=n(6980),s=n(5397),u=n(6969),c=n(9297),l=n(5917),f=Object.getOwnPropertyDescriptor;t.f=r?f:function(e,t){if(e=s(e),t=u(t),l)try{return f(e,t)}catch(e){}if(c(e,t))return a(!i(o.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},2787:(e,t,n)=>{"use strict";var r=n(9297),i=n(4901),o=n(8981),a=n(6119),s=n(2211),u=a("IE_PROTO"),c=Object,l=c.prototype;e.exports=s?c.getPrototypeOf:function(e){var t=o(e);if(r(t,u))return t[u];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof c?l:null}},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),i=n(9297),o=n(5397),a=n(9617).indexOf,s=n(421),u=r([].push);e.exports=function(e,t){var n,r=o(e),c=0,l=[];for(n in r)!i(s,n)&&i(r,n)&&u(l,n);for(;t.length>c;)i(r,n=t[c++])&&(~a(l,n)||u(l,n));return l}},1072:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727);e.exports=Object.keys||function(e){return r(e,i)}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),i=n(34),o=n(7750),a=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return o(n),a(r),i(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),i=n(4901),o=n(34),a=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&i(n=e.toString)&&!o(s=r(n,e)))return s;if(i(n=e.valueOf)&&!o(s=r(n,e)))return s;if("string"!==t&&i(n=e.toString)&&!o(s=r(n,e)))return s;throw new a("Can't convert object to primitive value")}},5031:(e,t,n)=>{"use strict";var r=n(7751),i=n(9504),o=n(8480),a=n(3717),s=n(8551),u=i([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(s(e)),n=a.f;return n?u(t,n(e)):t}},1103:e=>{"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},916:(e,t,n)=>{"use strict";var r=n(4576),i=n(550),o=n(4901),a=n(2796),s=n(3706),u=n(8227),c=n(4215),l=n(6395),f=n(9519),p=i&&i.prototype,m=u("species"),h=!1,d=o(r.PromiseRejectionEvent),g=a("Promise",(function(){var e=s(i),t=e!==String(i);if(!t&&66===f)return!0;if(l&&(!p.catch||!p.finally))return!0;if(!f||f<51||!/native code/.test(e)){var n=new i((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[m]=r,!(h=n.then((function(){}))instanceof r))return!0}return!(t||"BROWSER"!==c&&"DENO"!==c||d)}));e.exports={CONSTRUCTOR:g,REJECTION_EVENT:d,SUBCLASSING:h}},550:(e,t,n)=>{"use strict";var r=n(4576);e.exports=r.Promise},3438:(e,t,n)=>{"use strict";var r=n(8551),i=n(34),o=n(6043);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},537:(e,t,n)=>{"use strict";var r=n(550),i=n(4428),o=n(916).CONSTRUCTOR;e.exports=o||!i((function(e){r.all(e).then(void 0,(function(){}))}))},1056:(e,t,n)=>{"use strict";var r=n(4913).f;e.exports=function(e,t,n){n in e||r(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})}},8265:e=>{"use strict";var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},e.exports=t},6682:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),o=n(4901),a=n(2195),s=n(7323),u=TypeError;e.exports=function(e,t){var n=e.exec;if(o(n)){var c=r(n,e,t);return null!==c&&i(c),c}if("RegExp"===a(e))return r(s,e,t);throw new u("RegExp#exec called on incompatible receiver")}},7323:(e,t,n)=>{"use strict";var r,i,o=n(9565),a=n(9504),s=n(655),u=n(7979),c=n(8429),l=n(5745),f=n(2360),p=n(1181).get,m=n(3635),h=n(8814),d=l("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,y=g,x=a("".charAt),b=a("".indexOf),v=a("".replace),w=a("".slice),N=(i=/b*/g,o(g,r=/a/,"a"),o(g,i,"a"),0!==r.lastIndex||0!==i.lastIndex),E=c.BROKEN_CARET,A=void 0!==/()??/.exec("")[1];(N||A||E||m||h)&&(y=function(e){var t,n,r,i,a,c,l,m=this,h=p(m),S=s(e),M=h.raw;if(M)return M.lastIndex=m.lastIndex,t=o(y,M,S),m.lastIndex=M.lastIndex,t;var C=h.groups,T=E&&m.sticky,B=o(u,m),D=m.source,F=0,O=S;if(T&&(B=v(B,"y",""),-1===b(B,"g")&&(B+="g"),O=w(S,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==x(S,m.lastIndex-1))&&(D="(?: "+D+")",O=" "+O,F++),n=new RegExp("^(?:"+D+")",B)),A&&(n=new RegExp("^"+D+"$(?!\\s)",B)),N&&(r=m.lastIndex),i=o(g,T?n:m,O),T?i?(i.input=w(i.input,F),i[0]=w(i[0],F),i.index=m.lastIndex,m.lastIndex+=i[0].length):m.lastIndex=0:N&&i&&(m.lastIndex=m.global?i.index+i[0].length:r),A&&i&&i.length>1&&o(d,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&C)for(i.groups=c=f(null),a=0;a<C.length;a++)c[(l=C[a])[0]]=i[l[1]];return i}),e.exports=y},7979:(e,t,n)=>{"use strict";var r=n(8551);e.exports=function(){var e=r(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},1034:(e,t,n)=>{"use strict";var r=n(9565),i=n(9297),o=n(1625),a=n(7979),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||i(e,"flags")||!o(s,e)?t:r(a,e)}},8429:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp,o=r((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||r((function(){return!i("a","y").sticky})),s=o||r((function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},3635:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp;e.exports=r((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},8814:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp;e.exports=r((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},7750:(e,t,n)=>{"use strict";var r=n(4117),i=TypeError;e.exports=function(e){if(r(e))throw new i("Can't call method on "+e);return e}},3389:(e,t,n)=>{"use strict";var r=n(4576),i=n(3724),o=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!i)return r[e];var t=o(r,e);return t&&t.value}},7633:(e,t,n)=>{"use strict";var r=n(7751),i=n(2106),o=n(8227),a=n(3724),s=o("species");e.exports=function(e){var t=r(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},687:(e,t,n)=>{"use strict";var r=n(4913).f,i=n(9297),o=n(8227)("toStringTag");e.exports=function(e,t,n){e&&!n&&(e=e.prototype),e&&!i(e,o)&&r(e,o,{configurable:!0,value:t})}},6119:(e,t,n)=>{"use strict";var r=n(5745),i=n(3392),o=r("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),i=n(4576),o=n(9433),a="__core-js_shared__",s=e.exports=i[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.40.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},2293:(e,t,n)=>{"use strict";var r=n(8551),i=n(5548),o=n(4117),a=n(8227)("species");e.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||o(n=r(s)[a])?t:i(n)}},8183:(e,t,n)=>{"use strict";var r=n(9504),i=n(1291),o=n(655),a=n(7750),s=r("".charAt),u=r("".charCodeAt),c=r("".slice),l=function(e){return function(t,n){var r,l,f=o(a(t)),p=i(n),m=f.length;return p<0||p>=m?e?"":void 0:(r=u(f,p))<55296||r>56319||p+1===m||(l=u(f,p+1))<56320||l>57343?e?s(f,p):r:e?c(f,p,p+2):l-56320+(r-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},4495:(e,t,n)=>{"use strict";var r=n(9519),i=n(9039),o=n(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},9225:(e,t,n)=>{"use strict";var r,i,o,a,s=n(4576),u=n(8745),c=n(6080),l=n(4901),f=n(9297),p=n(9039),m=n(397),h=n(7680),d=n(4055),g=n(2812),y=n(9544),x=n(6193),b=s.setImmediate,v=s.clearImmediate,w=s.process,N=s.Dispatch,E=s.Function,A=s.MessageChannel,S=s.String,M=0,C={},T="onreadystatechange";p((function(){r=s.location}));var B=function(e){if(f(C,e)){var t=C[e];delete C[e],t()}},D=function(e){return function(){B(e)}},F=function(e){B(e.data)},O=function(e){s.postMessage(S(e),r.protocol+"//"+r.host)};b&&v||(b=function(e){g(arguments.length,1);var t=l(e)?e:E(e),n=h(arguments,1);return C[++M]=function(){u(t,void 0,n)},i(M),M},v=function(e){delete C[e]},x?i=function(e){w.nextTick(D(e))}:N&&N.now?i=function(e){N.now(D(e))}:A&&!y?(a=(o=new A).port2,o.port1.onmessage=F,i=c(a.postMessage,a)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&r&&"file:"!==r.protocol&&!p(O)?(i=O,s.addEventListener("message",F,!1)):i=T in d("script")?function(e){m.appendChild(d("script"))[T]=function(){m.removeChild(this),B(e)}}:function(e){setTimeout(D(e),0)}),e.exports={set:b,clear:v}},5610:(e,t,n)=>{"use strict";var r=n(1291),i=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):o(n,t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),i=n(7750);e.exports=function(e){return r(i(e))}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},8014:(e,t,n)=>{"use strict";var r=n(1291),i=Math.min;e.exports=function(e){var t=r(e);return t>0?i(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),i=Object;e.exports=function(e){return i(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),i=n(34),o=n(757),a=n(5966),s=n(4270),u=n(8227),c=TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var n,u=a(e,l);if(u){if(void 0===t&&(t="default"),n=r(u,e,t),!i(n)||o(n))return n;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6969:(e,t,n)=>{"use strict";var r=n(2777),i=n(757);e.exports=function(e){var t=r(e,"string");return i(t)?t:t+""}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},655:(e,t,n)=>{"use strict";var r=n(6955),i=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,n)=>{"use strict";var r=n(9504),i=0,o=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039);e.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},2812:e=>{"use strict";var t=TypeError;e.exports=function(e,n){if(e<n)throw new t("Not enough arguments");return e}},8622:(e,t,n)=>{"use strict";var r=n(4576),i=n(4901),o=r.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},8227:(e,t,n)=>{"use strict";var r=n(4576),i=n(5745),o=n(9297),a=n(3392),s=n(4495),u=n(7040),c=r.Symbol,l=i("wks"),f=u?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return o(l,e)||(l[e]=s&&o(c,e)?c[e]:f("Symbol."+e)),l[e]}},4423:(e,t,n)=>{"use strict";var r=n(6518),i=n(9617).includes,o=n(9039),a=n(6469);r({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},2712:(e,t,n)=>{"use strict";var r=n(6518),i=n(926).left,o=n(4598),a=n(9519);r({target:"Array",proto:!0,forced:!n(6193)&&a>79&&a<83||!o("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},6910:(e,t,n)=>{"use strict";var r=n(6518),i=n(9504),o=n(9306),a=n(8981),s=n(6198),u=n(4606),c=n(655),l=n(9039),f=n(4488),p=n(4598),m=n(3709),h=n(3763),d=n(9519),g=n(3607),y=[],x=i(y.sort),b=i(y.push),v=l((function(){y.sort(void 0)})),w=l((function(){y.sort(null)})),N=p("sort"),E=!l((function(){if(d)return d<70;if(!(m&&m>3)){if(h)return!0;if(g)return g<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)y.push({k:t+r,v:n})}for(y.sort((function(e,t){return t.v-e.v})),r=0;r<y.length;r++)t=y[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));r({target:"Array",proto:!0,forced:v||!w||!N||!E},{sort:function(e){void 0!==e&&o(e);var t=a(this);if(E)return void 0===e?x(t):x(t,e);var n,r,i=[],l=s(t);for(r=0;r<l;r++)r in t&&b(i,t[r]);for(f(i,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:c(t)>c(n)?1:-1}}(e)),n=s(i),r=0;r<n;)t[r]=i[r++];for(;r<l;)u(t,r++);return t}})},8111:(e,t,n)=>{"use strict";var r=n(6518),i=n(4576),o=n(679),a=n(8551),s=n(4901),u=n(2787),c=n(2106),l=n(4659),f=n(9039),p=n(9297),m=n(8227),h=n(7657).IteratorPrototype,d=n(3724),g=n(6395),y="constructor",x="Iterator",b=m("toStringTag"),v=TypeError,w=i[x],N=g||!s(w)||w.prototype!==h||!f((function(){w({})})),E=function(){if(o(this,h),u(this)===h)throw new v("Abstract class Iterator not directly constructable")},A=function(e,t){d?c(h,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===h)throw new v("You can't redefine this property");p(this,e)?this[e]=t:l(this,e,t)}}):h[e]=t};p(h,b)||A(b,x),!N&&p(h,y)&&h[y]!==Object||A(y,E),E.prototype=h,r({global:!0,constructor:!0,forced:N},{Iterator:E})},1148:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{every:function(e){a(this),o(e);var t=s(this),n=0;return!i(t,(function(t,r){if(!e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(8551),s=n(1767),u=n(9462),c=n(6319),l=n(6395),f=u((function(){for(var e,t,n=this.iterator,r=this.predicate,o=this.next;;){if(e=a(i(o,n)),this.done=!!e.done)return;if(t=e.value,c(n,r,[t,this.counter++],!0))return t}}));r({target:"Iterator",proto:!0,real:!0,forced:l},{filter:function(e){return a(this),o(e),new f(s(this),{predicate:e})}})},116:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{find:function(e){a(this),o(e);var t=s(this),n=0;return i(t,(function(t,r){if(e(t,n++))return r(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},7588:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{forEach:function(e){a(this),o(e);var t=s(this),n=0;i(t,(function(t){e(t,n++)}),{IS_RECORD:!0})}})},1701:(e,t,n)=>{"use strict";var r=n(6518),i=n(713);r({target:"Iterator",proto:!0,real:!0,forced:n(6395)},{map:i})},8237:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767),u=TypeError;r({target:"Iterator",proto:!0,real:!0},{reduce:function(e){a(this),o(e);var t=s(this),n=arguments.length<2,r=n?void 0:arguments[1],c=0;if(i(t,(function(t){n?(n=!1,r=t):r=e(r,t,c),c++}),{IS_RECORD:!0}),n)throw new u("Reduce of empty iterator with no initial value");return r}})},3579:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{some:function(e){a(this),o(e);var t=s(this),n=0;return i(t,(function(t,r){if(e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1806:(e,t,n)=>{"use strict";var r=n(6518),i=n(8551),o=n(2652),a=n(1767),s=[].push;r({target:"Iterator",proto:!0,real:!0},{toArray:function(){var e=[];return o(a(i(this)),s,{that:e,IS_RECORD:!0}),e}})},3110:(e,t,n)=>{"use strict";var r=n(6518),i=n(7751),o=n(8745),a=n(9565),s=n(9504),u=n(9039),c=n(4901),l=n(757),f=n(7680),p=n(6933),m=n(4495),h=String,d=i("JSON","stringify"),g=s(/./.exec),y=s("".charAt),x=s("".charCodeAt),b=s("".replace),v=s(1..toString),w=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,A=!m||u((function(){var e=i("Symbol")("stringify detection");return"[null]"!==d([e])||"{}"!==d({a:e})||"{}"!==d(Object(e))})),S=u((function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")})),M=function(e,t){var n=f(arguments),r=p(t);if(c(r)||void 0!==e&&!l(e))return n[1]=function(e,t){if(c(r)&&(t=a(r,this,h(e),t)),!l(t))return t},o(d,null,n)},C=function(e,t,n){var r=y(n,t-1),i=y(n,t+1);return g(N,e)&&!g(E,i)||g(E,e)&&!g(N,r)?"\\u"+v(x(e,0),16):e};d&&r({target:"JSON",stat:!0,arity:3,forced:A||S},{stringify:function(e,t,n){var r=f(arguments),i=o(A?M:d,null,r);return S&&"string"==typeof i?b(i,w,C):i}})},3921:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(4659);r({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,n){o(t,e,n)}),{AS_ENTRIES:!0}),t}})},6499:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(6043),s=n(1103),u=n(2652);r({target:"Promise",stat:!0,forced:n(537)},{all:function(e){var t=this,n=a.f(t),r=n.resolve,c=n.reject,l=s((function(){var n=o(t.resolve),a=[],s=0,l=1;u(e,(function(e){var o=s++,u=!1;l++,i(n,t,e).then((function(e){u||(u=!0,a[o]=e,--l||r(a))}),c)})),--l||r(a)}));return l.error&&c(l.value),n.promise}})},2003:(e,t,n)=>{"use strict";var r=n(6518),i=n(6395),o=n(916).CONSTRUCTOR,a=n(550),s=n(7751),u=n(4901),c=n(6840),l=a&&a.prototype;if(r({target:"Promise",proto:!0,forced:o,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&u(a)){var f=s("Promise").prototype.catch;l.catch!==f&&c(l,"catch",f,{unsafe:!0})}},436:(e,t,n)=>{"use strict";var r,i,o,a=n(6518),s=n(6395),u=n(6193),c=n(4576),l=n(9565),f=n(6840),p=n(2967),m=n(687),h=n(7633),d=n(9306),g=n(4901),y=n(34),x=n(679),b=n(2293),v=n(9225).set,w=n(1955),N=n(3138),E=n(1103),A=n(8265),S=n(1181),M=n(550),C=n(916),T=n(6043),B="Promise",D=C.CONSTRUCTOR,F=C.REJECTION_EVENT,O=C.SUBCLASSING,_=S.getterFor(B),I=S.set,z=M&&M.prototype,k=M,R=z,q=c.TypeError,P=c.document,j=c.process,U=T.f,L=U,$=!!(P&&P.createEvent&&c.dispatchEvent),H="unhandledrejection",G=function(e){var t;return!(!y(e)||!g(t=e.then))&&t},V=function(e,t){var n,r,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,f=e.domain;try{s?(a||(2===t.rejection&&X(t),t.rejection=1),!0===s?n=o:(f&&f.enter(),n=s(o),f&&(f.exit(),i=!0)),n===e.promise?c(new q("Promise-chain cycle")):(r=G(n))?l(r,n,u,c):u(n)):c(o)}catch(e){f&&!i&&f.exit(),c(e)}},Z=function(e,t){e.notified||(e.notified=!0,w((function(){for(var n,r=e.reactions;n=r.get();)V(n,e);e.notified=!1,t&&!e.rejection&&Y(e)})))},W=function(e,t,n){var r,i;$?((r=P.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),c.dispatchEvent(r)):r={promise:t,reason:n},!F&&(i=c["on"+e])?i(r):e===H&&N("Unhandled promise rejection",n)},Y=function(e){l(v,c,(function(){var t,n=e.facade,r=e.value;if(J(e)&&(t=E((function(){u?j.emit("unhandledRejection",r,n):W(H,n,r)})),e.rejection=u||J(e)?2:1,t.error))throw t.value}))},J=function(e){return 1!==e.rejection&&!e.parent},X=function(e){l(v,c,(function(){var t=e.facade;u?j.emit("rejectionHandled",t):W("rejectionhandled",t,e.value)}))},Q=function(e,t,n){return function(r){e(t,r,n)}},K=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Z(e,!0))},ee=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw new q("Promise can't be resolved itself");var r=G(t);r?w((function(){var n={done:!1};try{l(r,t,Q(ee,n,e),Q(K,n,e))}catch(t){K(n,t,e)}})):(e.value=t,e.state=1,Z(e,!1))}catch(t){K({done:!1},t,e)}}};if(D&&(R=(k=function(e){x(this,R),d(e),l(r,this);var t=_(this);try{e(Q(ee,t),Q(K,t))}catch(e){K(t,e)}}).prototype,(r=function(e){I(this,{type:B,done:!1,notified:!1,parent:!1,reactions:new A,rejection:!1,state:0,value:null})}).prototype=f(R,"then",(function(e,t){var n=_(this),r=U(b(this,k));return n.parent=!0,r.ok=!g(e)||e,r.fail=g(t)&&t,r.domain=u?j.domain:void 0,0===n.state?n.reactions.add(r):w((function(){V(r,n)})),r.promise})),i=function(){var e=new r,t=_(e);this.promise=e,this.resolve=Q(ee,t),this.reject=Q(K,t)},T.f=U=function(e){return e===k||void 0===e?new i(e):L(e)},!s&&g(M)&&z!==Object.prototype)){o=z.then,O||f(z,"then",(function(e,t){var n=this;return new k((function(e,t){l(o,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete z.constructor}catch(e){}p&&p(z,R)}a({global:!0,constructor:!0,wrap:!0,forced:D},{Promise:k}),m(k,B,!1,!0),h(B)},3362:(e,t,n)=>{"use strict";n(436),n(6499),n(2003),n(7743),n(1481),n(280)},7743:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(6043),s=n(1103),u=n(2652);r({target:"Promise",stat:!0,forced:n(537)},{race:function(e){var t=this,n=a.f(t),r=n.reject,c=s((function(){var a=o(t.resolve);u(e,(function(e){i(a,t,e).then(n.resolve,r)}))}));return c.error&&r(c.value),n.promise}})},1481:(e,t,n)=>{"use strict";var r=n(6518),i=n(6043);r({target:"Promise",stat:!0,forced:n(916).CONSTRUCTOR},{reject:function(e){var t=i.f(this);return(0,t.reject)(e),t.promise}})},280:(e,t,n)=>{"use strict";var r=n(6518),i=n(7751),o=n(6395),a=n(550),s=n(916).CONSTRUCTOR,u=n(3438),c=i("Promise"),l=o&&!s;r({target:"Promise",stat:!0,forced:o||s},{resolve:function(e){return u(l&&this===c?a:this,e)}})},4864:(e,t,n)=>{"use strict";var r=n(3724),i=n(4576),o=n(9504),a=n(2796),s=n(3167),u=n(6699),c=n(2360),l=n(8480).f,f=n(1625),p=n(788),m=n(655),h=n(1034),d=n(8429),g=n(1056),y=n(6840),x=n(9039),b=n(9297),v=n(1181).enforce,w=n(7633),N=n(8227),E=n(3635),A=n(8814),S=N("match"),M=i.RegExp,C=M.prototype,T=i.SyntaxError,B=o(C.exec),D=o("".charAt),F=o("".replace),O=o("".indexOf),_=o("".slice),I=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,z=/a/g,k=/a/g,R=new M(z)!==z,q=d.MISSED_STICKY,P=d.UNSUPPORTED_Y;if(a("RegExp",r&&(!R||q||E||A||x((function(){return k[S]=!1,M(z)!==z||M(k)===k||"/a/i"!==String(M(z,"i"))}))))){for(var j=function(e,t){var n,r,i,o,a,l,d=f(C,this),g=p(e),y=void 0===t,x=[],w=e;if(!d&&g&&y&&e.constructor===j)return e;if((g||f(C,e))&&(e=e.source,y&&(t=h(w))),e=void 0===e?"":m(e),t=void 0===t?"":m(t),w=e,E&&"dotAll"in z&&(r=!!t&&O(t,"s")>-1)&&(t=F(t,/s/g,"")),n=t,q&&"sticky"in z&&(i=!!t&&O(t,"y")>-1)&&P&&(t=F(t,/y/g,"")),A&&(o=function(e){for(var t,n=e.length,r=0,i="",o=[],a=c(null),s=!1,u=!1,l=0,f="";r<=n;r++){if("\\"===(t=D(e,r)))t+=D(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:if(i+=t,"?:"===_(e,r+1,r+3))continue;B(I,_(e,r+1))&&(r+=2,u=!0),l++;continue;case">"===t&&u:if(""===f||b(a,f))throw new T("Invalid capture group name");a[f]=!0,o[o.length]=[f,l],u=!1,f="";continue}u?f+=t:i+=t}return[i,o]}(e),e=o[0],x=o[1]),a=s(M(e,t),d?this:C,j),(r||i||x.length)&&(l=v(a),r&&(l.dotAll=!0,l.raw=j(function(e){for(var t,n=e.length,r=0,i="",o=!1;r<=n;r++)"\\"!==(t=D(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+D(e,++r);return i}(e),n)),i&&(l.sticky=!0),x.length&&(l.groups=x)),e!==w)try{u(a,"source",""===w?"(?:)":w)}catch(e){}return a},U=l(M),L=0;U.length>L;)g(j,M,U[L++]);C.constructor=j,j.prototype=C,y(i,"RegExp",j,{constructor:!0})}w("RegExp")},7465:(e,t,n)=>{"use strict";var r=n(3724),i=n(3635),o=n(2195),a=n(2106),s=n(1181).get,u=RegExp.prototype,c=TypeError;r&&i&&a(u,"dotAll",{configurable:!0,get:function(){if(this!==u){if("RegExp"===o(this))return!!s(this).dotAll;throw new c("Incompatible receiver, RegExp required")}}})},7495:(e,t,n)=>{"use strict";var r=n(6518),i=n(7323);r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},5440:(e,t,n)=>{"use strict";var r=n(8745),i=n(9565),o=n(9504),a=n(9228),s=n(9039),u=n(8551),c=n(4901),l=n(4117),f=n(1291),p=n(8014),m=n(655),h=n(7750),d=n(7829),g=n(5966),y=n(2478),x=n(6682),b=n(8227)("replace"),v=Math.max,w=Math.min,N=o([].concat),E=o([].push),A=o("".indexOf),S=o("".slice),M="$0"==="a".replace(/./,"$0"),C=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(e,t,n){var o=C?"$":"$0";return[function(e,n){var r=h(this),o=l(e)?void 0:g(e,b);return o?i(o,e,r,n):i(t,m(r),e,n)},function(e,i){var a=u(this),s=m(e);if("string"==typeof i&&-1===A(i,o)&&-1===A(i,"$<")){var l=n(t,a,s,i);if(l.done)return l.value}var h=c(i);h||(i=m(i));var g,b=a.global;b&&(g=a.unicode,a.lastIndex=0);for(var M,C=[];null!==(M=x(a,s))&&(E(C,M),b);)""===m(M[0])&&(a.lastIndex=d(s,p(a.lastIndex),g));for(var T,B="",D=0,F=0;F<C.length;F++){for(var O,_=m((M=C[F])[0]),I=v(w(f(M.index),s.length),0),z=[],k=1;k<M.length;k++)E(z,void 0===(T=M[k])?T:String(T));var R=M.groups;if(h){var q=N([_],z,I,s);void 0!==R&&E(q,R),O=m(r(i,void 0,q))}else O=y(_,s,I,z,R,i);I>=D&&(B+=S(s,D,I)+O,D=I+_.length)}return B+S(s,D)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!M||C)},9463:(e,t,n)=>{"use strict";var r=n(6518),i=n(3724),o=n(4576),a=n(9504),s=n(9297),u=n(4901),c=n(1625),l=n(655),f=n(2106),p=n(7740),m=o.Symbol,h=m&&m.prototype;if(i&&u(m)&&(!("description"in h)||void 0!==m().description)){var d={},g=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:l(arguments[0]),t=c(h,this)?new m(e):void 0===e?m():m(e);return""===e&&(d[t]=!0),t};p(g,m),g.prototype=h,h.constructor=g;var y="Symbol(description detection)"===String(m("description detection")),x=a(h.valueOf),b=a(h.toString),v=/^Symbol\((.*)\)[^)]+$/,w=a("".replace),N=a("".slice);f(h,"description",{configurable:!0,get:function(){var e=x(this);if(s(d,e))return"";var t=b(e),n=y?N(t,7,-1):w(t,v,"$1");return""===n?void 0:n}}),r({global:!0,constructor:!0,forced:!0},{Symbol:g})}},8992:(e,t,n)=>{"use strict";n(8111)},3215:(e,t,n)=>{"use strict";n(1148)},4520:(e,t,n)=>{"use strict";n(2489)},2577:(e,t,n)=>{"use strict";n(116)},3949:(e,t,n)=>{"use strict";n(7588)},1454:(e,t,n)=>{"use strict";n(1701)},8872:(e,t,n)=>{"use strict";n(8237)},7550:(e,t,n)=>{"use strict";n(3579)},1795:(e,t,n)=>{"use strict";n(1806)},2369:function(e){e.exports=function(){"use strict";function e(){return!0}function t(){return!1}function n(){}const r="Argument is not a typed-function.";return function i(){function o(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const a=[{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:o},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],s={name:"any",test:e,isAny:!0};let u,c,l=0,f={createCount:0};function p(e){const t=u.get(e);if(t)return t;let n='Unknown type "'+e+'"';const r=e.toLowerCase();let i;for(i of c)if(i.toLowerCase()===r){n+='. Did you mean "'+i+'" ?';break}throw new TypeError(n)}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const n=t?p(t).index:c.length,r=[];for(let t=0;t<e.length;++t){if(!e[t]||"string"!=typeof e[t].name||"function"!=typeof e[t].test)throw new TypeError("Object with properties {name: string, test: function} expected");const i=e[t].name;if(u.has(i))throw new TypeError('Duplicate type name "'+i+'"');r.push(i),u.set(i,{name:i,test:e[t].test,isAny:e[t].isAny,index:n+t,conversionsTo:[]})}const i=c.slice(n);c=c.slice(0,n).concat(r).concat(i);for(let e=n+r.length;e<c.length;++e)u.get(c[e]).index=e}function h(){u=new Map,c=[],l=0,m([s],!1)}function d(e){const t=c.filter((t=>{const n=u.get(t);return!n.isAny&&n.test(e)}));return t.length?t:["any"]}function g(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function y(e,t,n){if(!g(e))throw new TypeError(r);const i=n&&n.exact,o=N(Array.isArray(t)?t.join(","):t),a=x(o);if(!i||a in e.signatures){const t=e._typedFunctionData.signatureMap.get(a);if(t)return t}const s=o.length;let u,c;if(i){let t;for(t in u=[],e.signatures)u.push(e._typedFunctionData.signatureMap.get(t))}else u=e._typedFunctionData.signatures;for(let e=0;e<s;++e){const t=o[e],n=[];let r;for(r of u){const i=M(r.params,e);if(i&&(!t.restParam||i.restParam)){if(!i.hasAny){const e=w(i);if(t.types.some((t=>!e.has(t.name))))continue}n.push(r)}}if(u=n,0===u.length)break}for(c of u)if(c.params.length<=s)return c;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+x(o,", ")+"))")}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(t)}function b(e){const t=0===e.indexOf("..."),n=(t?e.length>3?e.slice(3):"any":e).split("|").map((e=>p(e.trim())));let r=!1,i=t?"...":"";return{types:n.map((function(e){return r=e.isAny||r,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:r,hasConversion:!1,restParam:t}}function v(e){const t=function(e){if(0===e.length)return[];const t=e.map(p);e.length>1&&t.sort(((e,t)=>e.index-t.index));let n=t[0].conversionsTo;if(1===e.length)return n;n=n.concat([]);const r=new Set(e);for(let e=1;e<t.length;++e){let i;for(i of t[e].conversionsTo)r.has(i.from)||(n.push(i),r.add(i.from))}return n}(e.types.map((e=>e.name)));let n=e.hasAny,r=e.name;const i=t.map((function(e){const t=p(e.from);return n=t.isAny||n,r+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:r,hasAny:n,hasConversion:i.length>0,restParam:e.restParam}}function w(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((t=>e.typeSet.add(t.name)))),e.typeSet}function N(e){const t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const n=e.trim();if(""===n)return t;const r=n.split(",");for(let e=0;e<r.length;++e){const n=b(r[e].trim());if(n.restParam&&e!==r.length-1)throw new SyntaxError('Unexpected rest parameter "'+r[e]+'": only allowed for the last parameter');if(0===n.types.length)return null;t.push(n)}return t}function E(e){const t=H(e);return!!t&&t.restParam}function A(t){if(t&&0!==t.types.length){if(1===t.types.length)return p(t.types[0].name).test;if(2===t.types.length){const e=p(t.types[0].name).test,n=p(t.types[1].name).test;return function(t){return e(t)||n(t)}}{const e=t.types.map((function(e){return p(e.name).test}));return function(t){for(let n=0;n<e.length;n++)if(e[n](t))return!0;return!1}}}return e}function S(e){let t,n,r;if(E(e)){t=$(e).map(A);const n=t.length,r=A(H(e)),i=function(e){for(let t=n;t<e.length;t++)if(!r(e[t]))return!1;return!0};return function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return i(e)&&e.length>=n+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(n=A(e[0]),function(e){return n(e[0])&&1===e.length}):2===e.length?(n=A(e[0]),r=A(e[1]),function(e){return n(e[0])&&r(e[1])&&2===e.length}):(t=e.map(A),function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return e.length===t.length})}function M(e,t){return t<e.length?e[t]:E(e)?H(e):null}function C(e,t){const n=M(e,t);return n?w(n):new Set}function T(e){return null===e.conversion||void 0===e.conversion}function B(e,t){const n=new Set;return e.forEach((e=>{const r=C(e.params,t);let i;for(i of r)n.add(i)})),n.has("any")?["any"]:Array.from(n)}function D(e,t,n){let r,i;const o=e||"unnamed";let a,s=n;for(a=0;a<t.length;a++){const e=[];if(s.forEach((n=>{const r=A(M(n.params,a));(a<n.params.length||E(n.params))&&r(t[a])&&e.push(n)})),0===e.length){if(i=B(s,a),i.length>0){const e=d(t[a]);return r=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+a+")"),r.data={category:"wrongType",fn:o,index:a,actual:e,expected:i},r}}else s=e}const u=s.map((function(e){return E(e.params)?1/0:e.params.length}));if(t.length<Math.min.apply(null,u))return i=B(s,a),r=new TypeError("Too few arguments in function "+o+" (expected: "+i.join(" or ")+", index: "+t.length+")"),r.data={category:"tooFewArgs",fn:o,index:t.length,expected:i},r;const c=Math.max.apply(null,u);if(t.length>c)return r=new TypeError("Too many arguments in function "+o+" (expected: "+c+", actual: "+t.length+")"),r.data={category:"tooManyArgs",fn:o,index:t.length,expectedLength:c},r;const l=[];for(let e=0;e<t.length;++e)l.push(d(t[e]).join("|"));return r=new TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+o+"."),r.data={category:"mismatch",actual:l},r}function F(e){let t=c.length+1;for(let n=0;n<e.types.length;n++)T(e.types[n])&&(t=Math.min(t,e.types[n].typeIndex));return t}function O(e){let t=l+1;for(let n=0;n<e.types.length;n++)T(e.types[n])||(t=Math.min(t,e.types[n].conversionIndex));return t}function _(e,t){if(e.hasAny){if(!t.hasAny)return 1}else if(t.hasAny)return-1;if(e.restParam){if(!t.restParam)return 1}else if(t.restParam)return-1;if(e.hasConversion){if(!t.hasConversion)return 1}else if(t.hasConversion)return-1;const n=F(e)-F(t);if(n<0)return-1;if(n>0)return 1;const r=O(e)-O(t);return r<0?-1:r>0?1:0}function I(e,t){const n=e.params,r=t.params,i=H(n),o=H(r),a=E(n),s=E(r);if(a&&i.hasAny){if(!s||!o.hasAny)return 1}else if(s&&o.hasAny)return-1;let u,c=0,l=0;for(u of n)u.hasAny&&++c,u.hasConversion&&++l;let f=0,p=0;for(u of r)u.hasAny&&++f,u.hasConversion&&++p;if(c!==f)return c-f;if(a&&i.hasConversion){if(!s||!o.hasConversion)return 1}else if(s&&o.hasConversion)return-1;if(l!==p)return l-p;if(a){if(!s)return 1}else if(s)return-1;const m=(n.length-r.length)*(a?-1:1);if(0!==m)return m;const h=[];let d,g=0;for(let e=0;e<n.length;++e){const t=_(n[e],r[e]);h.push(t),g+=t}if(0!==g)return g;for(d of h)if(0!==d)return d;return 0}function z(e,t){let n=t;if(e.some((e=>e.hasConversion))){const r=E(e),i=e.map(k);n=function(){const e=[],n=r?arguments.length-1:arguments.length;for(let t=0;t<n;t++)e[t]=i[t](arguments[t]);return r&&(e[n]=arguments[n].map(i[n])),t.apply(this,e)}}let r=n;if(E(e)){const t=e.length-1;r=function(){return n.apply(this,G(arguments,0,t).concat([G(arguments,t)]))}}return r}function k(e){let t,n,r,i;const o=[],a=[];switch(e.types.forEach((function(e){e.conversion&&(o.push(p(e.conversion.from).test),a.push(e.conversion.convert))})),a.length){case 0:return function(e){return e};case 1:return t=o[0],r=a[0],function(e){return t(e)?r(e):e};case 2:return t=o[0],n=o[1],r=a[0],i=a[1],function(e){return t(e)?r(e):n(e)?i(e):e};default:return function(e){for(let t=0;t<a.length;t++)if(o[t](e))return a[t](e);return e}}}function R(e){return function e(t,n,r){if(n<t.length){const a=t[n];let s=[];if(a.restParam){const e=a.types.filter(T);e.length<a.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(a)}else s=a.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return i=s,o=function(i){return e(t,n+1,r.concat([i]))},Array.prototype.concat.apply([],i.map(o))}var i,o;return[r]}(e,0,[])}function q(e,t){const n=Math.max(e.length,t.length);for(let r=0;r<n;r++){const n=C(e,r),i=C(t,r);let o,a=!1;for(o of i)if(n.has(o)){a=!0;break}if(!a)return!1}const r=e.length,i=t.length,o=E(e),a=E(t);return o?a?r===i:i>=r:a?r>=i:r===i}function P(e,t,n){const r=[];let i;for(i of e){let e=n[i];if("number"!=typeof e)throw new TypeError('No definition for referenced signature "'+i+'"');if(e=t[e],"function"!=typeof e)return!1;r.push(e)}return r}function j(e,t,n){const r=function(e){return e.map((e=>Y(e)?Z(e.referToSelf.callback):W(e)?V(e.referTo.references,e.referTo.callback):e))}(e),i=new Array(r.length).fill(!1);let o=!0;for(;o;){o=!1;let e=!0;for(let a=0;a<r.length;++a){if(i[a])continue;const s=r[a];if(Y(s))r[a]=s.referToSelf.callback(n),r[a].referToSelf=s.referToSelf,i[a]=!0,e=!1;else if(W(s)){const n=P(s.referTo.references,r,t);n?(r[a]=s.referTo.callback.apply(this,n),r[a].referTo=s.referTo,i[a]=!0,e=!1):o=!0}}if(e&&o)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return r}function U(e,r){if(f.createCount++,0===Object.keys(r).length)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&function(e){const t=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach((n=>{const r=e[n];if(t.test(r.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}))}(r);const i=[],o=[],a={},s=[];let u;for(u in r){if(!Object.prototype.hasOwnProperty.call(r,u))continue;const e=N(u);if(!e)continue;i.forEach((function(t){if(q(t,e))throw new TypeError('Conflicting signatures "'+x(t)+'" and "'+x(e)+'".')})),i.push(e);const t=o.length;o.push(r[u]);const n=e.map(v);let c;for(c of R(n)){const e=x(c);s.push({params:c,name:e,fn:t}),c.every((e=>!e.hasConversion))&&(a[e]=t)}}s.sort(I);const c=j(o,a,se);let l;for(l in a)Object.prototype.hasOwnProperty.call(a,l)&&(a[l]=c[a[l]]);const p=[],m=new Map;for(l of s)m.has(l.name)||(l.fn=c[l.fn],p.push(l),m.set(l.name,l));const h=p[0]&&p[0].params.length<=2&&!E(p[0].params),d=p[1]&&p[1].params.length<=2&&!E(p[1].params),g=p[2]&&p[2].params.length<=2&&!E(p[2].params),y=p[3]&&p[3].params.length<=2&&!E(p[3].params),b=p[4]&&p[4].params.length<=2&&!E(p[4].params),w=p[5]&&p[5].params.length<=2&&!E(p[5].params),M=h&&d&&g&&y&&b&&w;for(let e=0;e<p.length;++e)p[e].test=S(p[e].params);const C=h?A(p[0].params[0]):t,T=d?A(p[1].params[0]):t,B=g?A(p[2].params[0]):t,D=y?A(p[3].params[0]):t,F=b?A(p[4].params[0]):t,O=w?A(p[5].params[0]):t,_=h?A(p[0].params[1]):t,k=d?A(p[1].params[1]):t,P=g?A(p[2].params[1]):t,U=y?A(p[3].params[1]):t,L=b?A(p[4].params[1]):t,$=w?A(p[5].params[1]):t;for(let e=0;e<p.length;++e)p[e].implementation=z(p[e].params,p[e].fn);const H=h?p[0].implementation:n,G=d?p[1].implementation:n,V=g?p[2].implementation:n,Z=y?p[3].implementation:n,W=b?p[4].implementation:n,Y=w?p[5].implementation:n,J=h?p[0].params.length:-1,X=d?p[1].params.length:-1,Q=g?p[2].params.length:-1,K=y?p[3].params.length:-1,ee=b?p[4].params.length:-1,te=w?p[5].params.length:-1,ne=M?6:0,re=p.length,ie=p.map((e=>e.test)),oe=p.map((e=>e.implementation)),ae=function(){for(let e=ne;e<re;e++)if(ie[e](arguments))return oe[e].apply(this,arguments);return f.onMismatch(e,arguments,p)};function se(e,t){return arguments.length===J&&C(e)&&_(t)?H.apply(this,arguments):arguments.length===X&&T(e)&&k(t)?G.apply(this,arguments):arguments.length===Q&&B(e)&&P(t)?V.apply(this,arguments):arguments.length===K&&D(e)&&U(t)?Z.apply(this,arguments):arguments.length===ee&&F(e)&&L(t)?W.apply(this,arguments):arguments.length===te&&O(e)&&$(t)?Y.apply(this,arguments):ae.apply(this,arguments)}try{Object.defineProperty(se,"name",{value:e})}catch(e){}return se.signatures=a,se._typedFunctionData={signatures:p,signatureMap:m},se}function L(e,t,n){throw D(e,t,n)}function $(e){return G(e,0,e.length-1)}function H(e){return e[e.length-1]}function G(e,t,n){return Array.prototype.slice.call(e,t,n)}function V(e,t){return{referTo:{references:e,callback:t}}}function Z(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function W(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function Y(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function J(e,t){if(!e)return t;if(t&&t!==e){const n=new Error("Function names do not match (expected: "+e+", actual: "+t+")");throw n.data={actual:t,expected:e},n}return e}function X(e){let t;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(g(e[n])||"string"==typeof e[n].signature)&&(t=J(t,e[n].name));return t}function Q(e,t){let n;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(n in e&&t[n]!==e[n]){const r=new Error('Signature "'+n+'" is defined twice');throw r.data={signature:n,sourceFunction:t[n],destFunction:e[n]},r}e[n]=t[n]}}h(),m(a);const K=f;function ee(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw new SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return f=function(e){const t="string"==typeof e;let n=t?e:"";const r={};for(let e=t?1:0;e<arguments.length;++e){const i=arguments[e];let a,s={};if("function"==typeof i?(a=i.name,"string"==typeof i.signature?s[i.signature]=i:g(i)&&(s=i.signatures)):o(i)&&(s=i,t||(a=X(i))),0===Object.keys(s).length){const t=new TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:i},t}t||(n=J(n,a)),Q(r,s)}return U(n||"",r)},f.create=i,f.createCount=K.createCount,f.onMismatch=L,f.throwMismatchError=L,f.createError=D,f.clear=h,f.clearConversions=function(){let e;for(e of c)u.get(e).conversionsTo=[];l=0},f.addTypes=m,f._findType=p,f.referTo=function(){const e=$(arguments).map((e=>x(N(e)))),t=H(arguments);if("function"!=typeof t)throw new TypeError("Callback function expected as last argument");return V(e,t)},f.referToSelf=Z,f.convert=function(e,t){const n=p(t);if(n.test(e))return e;const r=n.conversionsTo;if(0===r.length)throw new Error("There are no conversions to "+t+" defined.");for(let t=0;t<r.length;t++)if(p(r[t].from).test(e))return r[t].convert(e);throw new Error("Cannot convert "+e+" to "+t)},f.findSignature=y,f.find=function(e,t,n){return y(e,t,n).implementation},f.isTypedFunction=g,f.warnAgainstDeprecatedThis=!0,f.addType=function(e,t){let n="any";!1!==t&&u.has("Object")&&(n="Object"),f.addTypes([e],n)},f.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};ee(e);const n=p(e.to),r=n.conversionsTo.find((t=>t.from===e.from));if(r){if(!t||!t.override)throw new Error('There is already a conversion from "'+e.from+'" to "'+n.name+'"');f.removeConversion({from:r.from,to:e.to,convert:r.convert})}n.conversionsTo.push({from:e.from,convert:e.convert,index:l++})},f.addConversions=function(e,t){e.forEach((e=>f.addConversion(e,t)))},f.removeConversion=function(e){ee(e);const t=p(e.to),n=function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n]}(t.conversionsTo,(t=>t.from===e.from));if(!n)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(n.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");const r=t.conversionsTo.indexOf(n);t.conversionsTo.splice(r,1)},f.resolve=function(e,t){if(!g(e))throw new TypeError(r);const n=e._typedFunctionData.signatures;for(let e=0;e<n.length;++e)if(n[e].test(t))return n[e];return null},f}()}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};return(()=>{"use strict";n.d(r,{default:()=>ax});var e={};n.r(e),n.d(e,{createAbs:()=>So,createAccessorNode:()=>Ip,createAcos:()=>Zl,createAcosh:()=>mf,createAcot:()=>df,createAcoth:()=>yf,createAcsc:()=>bf,createAcsch:()=>wf,createAdd:()=>xp,createAddScalar:()=>Do,createAnd:()=>$c,createAndTransform:()=>Jy,createArg:()=>ys,createArrayNode:()=>kp,createAsec:()=>Ef,createAsech:()=>Sf,createAsin:()=>Cf,createAsinh:()=>Tf,createAssignmentNode:()=>$p,createAtan:()=>Bf,createAtan2:()=>Ff,createAtanh:()=>_f,createAtomicMass:()=>Qg,createAvogadro:()=>Kg,createBellNumbers:()=>Cd,createBigNumberClass:()=>On,createBigint:()=>Ii,createBignumber:()=>Pi,createBin:()=>Qu,createBitAnd:()=>cs,createBitAndTransform:()=>Qy,createBitNot:()=>fs,createBitOr:()=>ms,createBitOrTransform:()=>Ky,createBitXor:()=>gs,createBlockNode:()=>Gp,createBohrMagneton:()=>Og,createBohrRadius:()=>qg,createBoltzmann:()=>ey,createBoolean:()=>qi,createCatalan:()=>Bd,createCbrt:()=>Io,createCeil:()=>Lo,createChain:()=>ih,createChainClass:()=>Xm,createClassicalElectronRadius:()=>Pg,createClone:()=>ei,createColumn:()=>_s,createColumnTransform:()=>Ny,createCombinations:()=>$h,createCombinationsWithRep:()=>Vh,createCompare:()=>Gc,createCompareNatural:()=>Yc,createCompareText:()=>Qc,createCompile:()=>Am,createComplex:()=>ji,createComplexClass:()=>Un,createComposition:()=>Fd,createConcat:()=>Fs,createConcatTransform:()=>qy,createConditionalNode:()=>Zp,createConductanceQuantum:()=>_g,createConj:()=>bs,createConstantNode:()=>nm,createCorr:()=>Ph,createCos:()=>zf,createCosh:()=>Rf,createCot:()=>qf,createCoth:()=>jf,createCoulomb:()=>Dg,createCount:()=>zs,createCreateUnit:()=>Gl,createCross:()=>Rs,createCsc:()=>Uf,createCsch:()=>$f,createCtranspose:()=>Du,createCube:()=>Ho,createCumSum:()=>Mh,createCumSumTransform:()=>Gy,createDeepEqual:()=>yl,createDenseMatrixClass:()=>Qr,createDerivative:()=>Gd,createDet:()=>oh,createDeuteronMass:()=>Gg,createDiag:()=>Ps,createDiff:()=>nu,createDiffTransform:()=>jy,createDistance:()=>Nh,createDivide:()=>vh,createDivideScalar:()=>lc,createDot:()=>Ep,createDotDivide:()=>Sc,createDotMultiply:()=>Ga,createDotPow:()=>Ec,createE:()=>lg,createEfimovFactor:()=>Xg,createEigs:()=>ch,createElectricConstant:()=>Tg,createElectronMass:()=>jg,createElementaryCharge:()=>Fg,createEqual:()=>el,createEqualScalar:()=>Fi,createEqualText:()=>rl,createErf:()=>Ru,createEvaluate:()=>Mm,createExp:()=>Go,createExpm:()=>fh,createExpm1:()=>Zo,createFactorial:()=>od,createFalse:()=>ig,createFaraday:()=>ty,createFermiCoupling:()=>Ug,createFft:()=>_u,createFibonacciHeapClass:()=>Dl,createFilter:()=>js,createFilterTransform:()=>Cy,createFineStructure:()=>Lg,createFirstRadiation:()=>ny,createFix:()=>Xo,createFlatten:()=>$s,createFloor:()=>na,createForEach:()=>Gs,createForEachTransform:()=>Ty,createFormat:()=>Xu,createFraction:()=>Ui,createFractionClass:()=>ir,createFreqz:()=>Xd,createFunctionAssignmentNode:()=>im,createFunctionNode:()=>vm,createGamma:()=>td,createGasConstant:()=>iy,createGcd:()=>ya,createGetMatrixDataType:()=>Ws,createGravitationConstant:()=>Ag,createGravity:()=>my,createHartreeEnergy:()=>$g,createHasNumericValue:()=>vi,createHelp:()=>nh,createHelpClass:()=>Jm,createHex:()=>ec,createHypot:()=>vp,createI:()=>xg,createIdentity:()=>Js,createIfft:()=>zu,createIm:()=>vs,createImmutableDenseMatrixClass:()=>Cl,createIndex:()=>Mp,createIndexClass:()=>Tl,createIndexNode:()=>am,createIndexTransform:()=>By,createInfinity:()=>ag,createIntersect:()=>Eh,createInv:()=>ah,createInverseConductanceQuantum:()=>Ig,createInvmod:()=>La,createIsInteger:()=>ci,createIsNaN:()=>Mi,createIsNegative:()=>gi,createIsNumeric:()=>xi,createIsPositive:()=>Ni,createIsPrime:()=>sc,createIsZero:()=>Ai,createKldivergence:()=>sd,createKlitzing:()=>Rg,createKron:()=>Qs,createLN10:()=>mg,createLN2:()=>pg,createLOG10E:()=>dg,createLOG2E:()=>hg,createLarger:()=>fl,createLargerEq:()=>hl,createLcm:()=>ba,createLeafCount:()=>_d,createLeftShift:()=>qc,createLgamma:()=>rd,createLog:()=>yc,createLog10:()=>Aa,createLog1p:()=>bc,createLog2:()=>Ma,createLoschmidt:()=>ry,createLsolve:()=>Tc,createLsolveAll:()=>Oc,createLup:()=>Dm,createLusolve:()=>Zm,createLyap:()=>bh,createMad:()=>Fh,createMagneticConstant:()=>Cg,createMagneticFluxQuantum:()=>zg,createMap:()=>eu,createMapSlices:()=>Co,createMapSlicesTransform:()=>wy,createMapTransform:()=>Dy,createMatrix:()=>$i,createMatrixClass:()=>ar,createMatrixFromColumns:()=>Yi,createMatrixFromFunction:()=>Gi,createMatrixFromRows:()=>Zi,createMax:()=>Sl,createMaxTransform:()=>Oy,createMean:()=>Th,createMeanTransform:()=>_y,createMedian:()=>Dh,createMin:()=>Ml,createMinTransform:()=>Iy,createMod:()=>ca,createMode:()=>Vu,createMolarMass:()=>fy,createMolarMassC12:()=>py,createMolarPlanckConstant:()=>oy,createMolarVolume:()=>ay,createMultinomial:()=>cd,createMultiply:()=>Ba,createMultiplyScalar:()=>Ca,createNaN:()=>sg,createNeutronMass:()=>Vg,createNode:()=>Tp,createNorm:()=>Np,createNot:()=>Cs,createNthRoot:()=>Fa,createNthRoots:()=>wc,createNuclearMagneton:()=>kg,createNull:()=>og,createNumber:()=>_i,createNumeric:()=>uc,createObjectNode:()=>um,createOct:()=>Ku,createOnes:()=>ru,createOperatorNode:()=>fm,createOr:()=>Ts,createOrTransform:()=>Xy,createParenthesisNode:()=>mm,createParse:()=>Nm,createParser:()=>Bm,createParserClass:()=>Cm,createPartitionSelect:()=>Nl,createPermutations:()=>fd,createPhi:()=>fg,createPi:()=>ug,createPickRandom:()=>yd,createPinv:()=>uh,createPlanckCharge:()=>yy,createPlanckConstant:()=>Sg,createPlanckLength:()=>hy,createPlanckMass:()=>dy,createPlanckTemperature:()=>xy,createPlanckTime:()=>gy,createPolynomialRoot:()=>Ym,createPow:()=>fc,createPrint:()=>rc,createPrintTransform:()=>Yy,createProd:()=>Yu,createProtonMass:()=>Hg,createQr:()=>Fm,createQuantileSeq:()=>kh,createQuantileSeqTransform:()=>$y,createQuantumOfCirculation:()=>Zg,createRandom:()=>vd,createRandomInt:()=>Ed,createRange:()=>uu,createRangeClass:()=>or,createRangeNode:()=>dm,createRangeTransform:()=>zy,createRationalize:()=>Zd,createRe:()=>ws,createReducedPlanckConstant:()=>Mg,createRelationalNode:()=>ym,createReplacer:()=>Kd,createReshape:()=>lu,createResize:()=>fu,createResolve:()=>Ud,createResultSet:()=>Ze,createReviver:()=>Qd,createRightArithShift:()=>jc,createRightLogShift:()=>Lc,createRotate:()=>mu,createRotationMatrix:()=>du,createRound:()=>hc,createRow:()=>gu,createRowTransform:()=>ky,createRydberg:()=>Wg,createSQRT1_2:()=>gg,createSQRT2:()=>yg,createSackurTetrode:()=>sy,createSchur:()=>yh,createSec:()=>Hf,createSech:()=>Vf,createSecondRadiation:()=>uy,createSetCartesian:()=>Kf,createSetDifference:()=>tp,createSetDistinct:()=>rp,createSetIntersect:()=>op,createSetIsSubset:()=>sp,createSetMultiplicity:()=>cp,createSetPowerset:()=>fp,createSetSize:()=>mp,createSetSymDifference:()=>dp,createSetUnion:()=>yp,createSign:()=>_a,createSimplify:()=>Rd,createSimplifyConstant:()=>qd,createSimplifyCore:()=>jd,createSin:()=>Zf,createSinh:()=>Yf,createSize:()=>xu,createSlu:()=>Hm,createSmaller:()=>ol,createSmallerEq:()=>ul,createSolveODE:()=>ku,createSort:()=>Al,createSpaClass:()=>Fl,createSparse:()=>$l,createSparseMatrixClass:()=>Oi,createSpeedOfLight:()=>Eg,createSplitUnit:()=>Xi,createSqrt:()=>Ia,createSqrtm:()=>mh,createSquare:()=>ka,createSqueeze:()=>vu,createStd:()=>Rh,createStdTransform:()=>Uy,createStefanBoltzmann:()=>cy,createStirlingS2:()=>Sd,createString:()=>ki,createSubset:()=>Nu,createSubsetTransform:()=>Ry,createSubtract:()=>qa,createSubtractScalar:()=>Oo,createSum:()=>Ah,createSumTransform:()=>Ly,createSylvester:()=>dh,createSymbolNode:()=>xm,createSymbolicEqual:()=>$d,createTan:()=>Jf,createTanh:()=>Xf,createTau:()=>cg,createThomsonCrossSection:()=>Yg,createTo:()=>oc,createTrace:()=>Ap,createTranspose:()=>Tu,createTrue:()=>rg,createTypeOf:()=>Ti,createTyped:()=>$e,createUnaryMinus:()=>No,createUnaryPlus:()=>Ao,createUnequal:()=>bl,createUnitClass:()=>Pl,createUnitFunction:()=>Ul,createUppercaseE:()=>vg,createUppercasePi:()=>bg,createUsolve:()=>Dc,createUsolveAll:()=>Ic,createVacuumImpedance:()=>Bg,createVariance:()=>Ih,createVarianceTransform:()=>Zy,createVersion:()=>wg,createWeakMixingAngle:()=>Jg,createWienDisplacement:()=>ly,createXgcd:()=>ja,createXor:()=>Bs,createZeros:()=>Ou,createZeta:()=>Hu,createZpk2tf:()=>Yd}),n(4423),n(7495),n(8992),n(7550);var t=n(2369);function i(e,t){if(a(e,t))return e[t];if("function"==typeof e[t]&&s(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function o(e,t,n){if(a(e,t))return e[t]=n,n;throw new Error('No access to property "'+t+'"')}function a(e,t){return!(!function(e){return"object"==typeof e&&e&&e.constructor===Object}(e)&&!Array.isArray(e)||!me(u,t)&&(t in Object.prototype||t in Function.prototype))}function s(e,t){return!(null==e||"function"!=typeof e[t]||me(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)||!me(c,t)&&(t in Object.prototype||t in Function.prototype))}n(6910),n(3215),n(4520),n(3949),n(1454),n(4864),n(7465);const u={length:!0,name:!0},c={toString:!0,valueOf:!0,toLocaleString:!0};class l{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 i(this.wrappedObject,e)}set(e,t){return o(this.wrappedObject,e,t),this}has(e){return a(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){a(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(const e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class f{constructor(e,t,n){this.a=e,this.b=t,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),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 p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,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 p(e,t){return{next:()=>{const n=e.next();return n.done?n:{value:t(n.value),done:!1}}}}function m(){return new Map}function h(e){if(!e)return m();if(k(e))return e;if(z(e))return new l(e);throw new Error("createMap can create maps from objects or Maps")}function d(e){return"number"==typeof e}function g(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 y(e){return"bigint"==typeof e}function x(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function b(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function v(e){return e&&!0===e.constructor.prototype.isUnit||!1}function w(e){return"string"==typeof e}const N=Array.isArray;function E(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function A(e){return Array.isArray(e)||E(e)}function S(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function M(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function C(e){return e&&!0===e.constructor.prototype.isRange||!1}function T(e){return e&&!0===e.constructor.prototype.isIndex||!1}function B(e){return"boolean"==typeof e}function D(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function F(e){return e&&!0===e.constructor.prototype.isHelp||!1}function O(e){return"function"==typeof e}function _(e){return e instanceof Date}function I(e){return e instanceof RegExp}function z(e){return!(!e||"object"!=typeof e||e.constructor!==Object||x(e)||b(e))}function k(e){return!!e&&(e instanceof Map||e instanceof l||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function R(e){return k(e)&&k(e.a)&&k(e.b)}function q(e){return k(e)&&z(e.wrappedObject)}function P(e){return null===e}function j(e){return void 0===e}function U(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function G(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function V(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function Z(e){return V(e)||K(e)&&1===e.args.length&&V(e.args[0])&&"-+~".includes(e.op)}function W(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function Y(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function J(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function X(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function Q(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function K(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ee(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function te(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function ne(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function re(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function ie(e){return e&&!0===e.constructor.prototype.isChain||!1}function oe(e){const t=typeof e;return"object"===t?null===e?"null":g(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function ae(e){const t=typeof e;if("number"===t||"bigint"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return ae(e)}));if(e instanceof Date)return new Date(e.valueOf());if(g(e))return e;if(z(e))return function(e,t){const n={};for(const r in e)me(e,r)&&(n[r]=t(e[r]));return n}(e,ae);if("function"===t)return e;throw new TypeError(`Cannot clone: unknown type of value (value: ${e})`)}function se(e,t){for(const n in t)me(t,n)&&(e[n]=t[n]);return e}function ue(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(const n in t)if(me(t,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(t[n]&&t[n].constructor===Object)void 0===e[n]&&(e[n]={}),e[n]&&e[n].constructor===Object?ue(e[n],t[n]):e[n]=t[n];else{if(Array.isArray(t[n]))throw new TypeError("Arrays are not supported by deepExtend");e[n]=t[n]}return e}function ce(e,t){let n,r,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(r=0,i=e.length;r<i;r++)if(!ce(e[r],t[r]))return!1;return!0}if("function"==typeof e)return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(n in e)if(!(n in t)||!ce(e[n],t[n]))return!1;for(n in t)if(!(n in e))return!1;return!0}return e===t}function le(e){const t={};return fe(e,t),t}function fe(e,t){for(const n in e)if(me(e,n)){const r=e[n];"object"==typeof r&&null!==r?fe(r,t):t[n]=r}}function pe(e,t,n){let r,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(r=n(),i=!1),r},set:function(e){r=e,i=!1},configurable:!0,enumerable:!0})}function me(e,t){return e&&Object.hasOwnProperty.call(e,t)}function he(e,t,n,r){function i(r){const i=function(e,t){const n={};for(let r=0;r<t.length;r++){const i=t[r],o=e[i];void 0!==o&&(n[i]=o)}return n}(r,t.map(ge));return function(e,t,n){if(!t.filter((e=>!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==n[e]))){const r=t.filter((e=>void 0===n[e]));throw new Error(`Cannot create function "${e}", some dependencies are missing: ${r.map((e=>`"${e}"`)).join(", ")}.`)}}(e,t,r),n(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),r&&(i.meta=r),i}function de(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function ge(e){return e&&"?"===e[0]?e.slice(1):e}function ye(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function xe(e,t){if("bigint"===t.number)try{BigInt(e)}catch(e){return t.numberFallback}return t.number}n(5440);const be=Math.sign||function(e){return e>0?1:e<0?-1:0},ve=Math.log2||function(e){return Math.log(e)/Math.LN2},we=Math.log10||function(e){return Math.log(e)/Math.LN10},Ne=Math.log1p||function(e){return Math.log(e+1)},Ee=Math.cbrt||function(e){if(0===e)return e;const t=e<0;let n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},Ae=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Se(e,t,n){const r={2:"0b",8:"0o",16:"0x"}[t];let i="";if(n){if(n<1)throw new Error("size must be in greater than 0");if(!ye(n))throw new Error("size must be an integer");if(e>2**(n-1)-1||e<-(2**(n-1)))throw new Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!ye(e))throw new Error("Value must be an integer");e<0&&(e+=2**n),i=`i${n}`}let o="";return e<0&&(e=-e,o="-"),`${o}${r}${e.toString(t)}${i}`}function Me(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";const{notation:n,precision:r,wordSize:i}=Ce(t);switch(n){case"fixed":return Be(e,r);case"exponential":return De(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Fe(Te(e),t),r=n.exponent,i=n.coefficients,o=r%3==0?r:r<0?r-3-r%3:r-r%3;if(d(t))for(;t>i.length||r-o+1>i.length;)i.push(0);else{const e=Math.abs(r-o)-(i.length-1);for(let t=0;t<e;t++)i.push(0)}let a=Math.abs(r-o),s=1;for(;a>0;)s++,a--;const u=i.slice(s).join(""),c=d(t)&&u.length||u.match(/[1-9]/)?"."+u:"",l=i.slice(0,s).join("")+c+"e"+(r>=0?"+":"")+o.toString();return n.sign+l}(e,r);case"bin":return Se(e,2,i);case"oct":return Se(e,8,i);case"hex":return Se(e,16,i);case"auto":return function(e,t,n){if(isNaN(e)||!isFinite(e))return String(e);const r=Ue(null==n?void 0:n.lowerExp,-3),i=Ue(null==n?void 0:n.upperExp,5),o=Te(e),a=t?Fe(o,t):o;if(a.exponent<r||a.exponent>=i)return De(e,t);{let e=a.coefficients;const n=a.exponent;e.length<t&&(e=e.concat(Oe(t-e.length))),e=e.concat(Oe(n-e.length+1+(e.length<t?t-e.length:0))),e=Oe(-n).concat(e);const r=n>0?n:0;return r<e.length-1&&e.splice(r+1,0,"."),a.sign+e.join("")}}(e,r,t).replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}));default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ce(e){let t,n,r="auto";if(void 0!==e)if(d(e))t=e;else if(g(e))t=e.toNumber();else{if(!z(e))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==e.precision&&(t=je(e.precision,(()=>{throw new Error('Option "precision" must be a number or BigNumber')}))),void 0!==e.wordSize&&(n=je(e.wordSize,(()=>{throw new Error('Option "wordSize" must be a number or BigNumber')}))),e.notation&&(r=e.notation)}return{notation:r,precision:t,wordSize:n}}function Te(e){const t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);const n=t[1],r=t[2];let i=parseFloat(t[4]||"0");const o=r.indexOf(".");i+=-1!==o?o-1:r.length-1;const a=r.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===a.length&&(a.push(0),i++),{sign:n,coefficients:a,exponent:i}}function Be(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Te(e),r="number"==typeof t?Fe(n,n.exponent+1+t):n;let i=r.coefficients,o=r.exponent+1;const a=o+(t||0);return i.length<a&&(i=i.concat(Oe(a-i.length))),o<0&&(i=Oe(1-o).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),r.sign+i.join("")}function De(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Te(e),r=t?Fe(n,t):n;let i=r.coefficients;const o=r.exponent;i.length<t&&(i=i.concat(Oe(t-i.length)));const a=i.shift();return r.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Fe(e,t){const n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=n.coefficients;for(;t<=0;)r.unshift(0),n.exponent++,t++;if(r.length>t&&r.splice(t,r.length-t)[0]>=5){let e=t-1;for(r[e]++;10===r[e];)r.pop(),0===e&&(r.unshift(0),n.exponent++,e++),e--,r[e]++}return n}function Oe(e){const t=[];for(let n=0;n<e;n++)t.push(0);return t}function _e(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-8,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n<=0)throw new Error("Relative tolerance must be greater than 0");if(r<0)throw new Error("Absolute tolerance must be at least 0");return!isNaN(e)&&!isNaN(t)&&(isFinite(e)&&isFinite(t)?e===t||Math.abs(e-t)<=Math.max(n*Math.max(Math.abs(e),Math.abs(t)),r):e===t)}const Ie=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},ze=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},ke=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Re=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},qe=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Pe=Math.tanh||function(e){const t=Math.exp(2*e);return(t-1)/(t+1)};function je(e,t){return d(e)?e:g(e)?e.toNumber():void t()}function Ue(e,t){return d(e)?e:g(e)?e.toNumber():t}let Le=function(){return Le=t.create,t};const $e=he("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){let{BigNumber:t,Complex:n,DenseMatrix:r,Fraction:i}=e;const o=Le();return o.clear(),o.addTypes([{name:"number",test:d},{name:"Complex",test:x},{name:"BigNumber",test:g},{name:"bigint",test:y},{name:"Fraction",test:b},{name:"Unit",test:v},{name:"identifier",test:e=>w&&/^[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\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\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\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}][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\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\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}]*$/u.test(e)},{name:"string",test:w},{name:"Chain",test:ie},{name:"Array",test:N},{name:"Matrix",test:E},{name:"DenseMatrix",test:S},{name:"SparseMatrix",test:M},{name:"Range",test:C},{name:"Index",test:T},{name:"boolean",test:B},{name:"ResultSet",test:D},{name:"Help",test:F},{name:"function",test:O},{name:"Date",test:_},{name:"RegExp",test:I},{name:"null",test:P},{name:"undefined",test:j},{name:"AccessorNode",test:U},{name:"ArrayNode",test:L},{name:"AssignmentNode",test:$},{name:"BlockNode",test:H},{name:"ConditionalNode",test:G},{name:"ConstantNode",test:V},{name:"FunctionNode",test:Y},{name:"FunctionAssignmentNode",test:W},{name:"IndexNode",test:J},{name:"Node",test:X},{name:"ObjectNode",test:Q},{name:"OperatorNode",test:K},{name:"ParenthesisNode",test:ee},{name:"RangeNode",test:te},{name:"RelationalNode",test:ne},{name:"SymbolNode",test:re},{name:"Map",test:k},{name:"Object",test:z}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||He(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return n||Ge(e),new n(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return n||Ge(e),new n(e.toNumber(),0)}},{from:"bigint",to:"number",convert:function(e){if(e>Number.MAX_SAFE_INTEGER)throw new 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 t||He(e),new t(e.toString())}},{from:"bigint",to:"Fraction",convert:function(e){return i||Ve(e),new i(e)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw new 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 n||Ge(e),new n(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||Ve(e);const t=new i(e);if(t.valueOf()!==e)throw new 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 t}},{from:"string",to:"number",convert:function(e){const t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||He(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(e){try{return BigInt(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(e){i||Ve(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){n||Ge(e);try{return new n(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||He(e),new t(+e)}},{from:"boolean",to:"bigint",convert:function(e){return BigInt(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||Ve(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return r||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new r(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),o.onMismatch=(e,t,n)=>{const r=o.createError(e,t,n);if(["wrongType","mismatch"].includes(r.data.category)&&1===t.length&&A(t[0])&&n.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=r.data,t}throw r},o.onMismatch=(e,t,n)=>{const r=o.createError(e,t,n);if(["wrongType","mismatch"].includes(r.data.category)&&1===t.length&&A(t[0])&&n.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=r.data,t}throw r},o}));function He(e){throw new Error(`Cannot convert value ${e} into a BigNumber: no class 'BigNumber' provided`)}function Ge(e){throw new Error(`Cannot convert value ${e} into a Complex number: no class 'Complex' provided`)}function Ve(e){throw new Error(`Cannot convert value ${e} into a Fraction, no class 'Fraction' provided.`)}const Ze=he("ResultSet",[],(()=>{function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}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(t){return new e(t.entries)},e}),{isClass:!0});var We,Ye,Je=9e15,Xe=1e9,Qe="0123456789abcdef",Ke="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",et="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",tt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Je,maxE:Je,crypto:!1},nt=!0,rt="[DecimalError] ",it=rt+"Invalid argument: ",ot=rt+"Precision limit exceeded",at=rt+"crypto unavailable",st="[object Decimal]",ut=Math.floor,ct=Math.pow,lt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ft=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,pt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,mt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ht=1e7,dt=Ke.length-1,gt=et.length-1,yt={toStringTag:st};function xt(e){var t,n,r,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=Bt(n)),o+=r;(n=7-(r=(a=e[t])+"").length)&&(o+=Bt(n))}else if(0===a)return"0";for(;a%10==0;)a/=10;return o+a}function bt(e,t,n){if(e!==~~e||e<t||e>n)throw Error(it+e)}function vt(e,t,n,r){var i,o,a,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=ct(10,7-t),s=e[i]%o|0,null==r?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),a=n<4&&99999==s||n>3&&49999==s||5e4==s||0==s):a=(n<4&&s+1==o||n>3&&s+1==o/2)&&(e[i+1]/o/100|0)==ct(10,t-2)-1||(s==o/2||0==s)&&!(e[i+1]/o/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),a=(r||n<4)&&9999==s||!r&&n>3&&4999==s):a=((r||n<4)&&s+1==o||!r&&n>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==ct(10,t-3)-1,a}function wt(e,t,n){for(var r,i,o=[0],a=0,s=e.length;a<s;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=Qe.indexOf(e.charAt(a++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}yt.absoluteValue=yt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Et(e)},yt.ceil=function(){return Et(new this.constructor(this),this.e+1,2)},yt.clampedTo=yt.clamp=function(e,t){var n=this,r=n.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(it+t);return n.cmp(e)<0?e:n.cmp(t)>0?t:new r(n)},yt.comparedTo=yt.cmp=function(e){var t,n,r,i,o=this,a=o.d,s=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!a||!s)return u&&c?u!==c?u:a===s?0:!a^u<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^u<0?1:-1;for(t=0,n=(r=a.length)<(i=s.length)?r:i;t<n;++t)if(a[t]!==s[t])return a[t]>s[t]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1},yt.cosine=yt.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;(r=t.d.length)<32?i=(1/Pt(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=qt(e,1,t.times(i),new e(1));for(var o=n;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=n,t}(r,jt(r,n)),r.precision=e,r.rounding=t,Et(2==Ye||3==Ye?n.neg():n,e,t,!0)):new r(1):new r(NaN)},yt.cubeRoot=yt.cbrt=function(){var e,t,n,r,i,o,a,s,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(nt=!1,(o=l.s*ct(l.s*l,1/3))&&Math.abs(o)!=1/0?r=new f(o.toString()):(n=xt(l.d),(o=((e=l.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=ct(n,1/3),e=ut((e+1)/3)-(e%3==(e<0?-1:2)),(r=new f(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=l.s),a=(e=f.precision)+3;;)if(c=(u=(s=r).times(s).times(s)).plus(l),r=Nt(c.plus(l).times(s),c.plus(u),a+2,1),xt(s.d).slice(0,a)===(n=xt(r.d)).slice(0,a)){if("9999"!=(n=n.slice(a-3,a+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(Et(r,e+1,1),t=!r.times(r).times(r).eq(l));break}if(!i&&(Et(s,e+1,0),s.times(s).times(s).eq(l))){r=s;break}a+=4,i=1}return nt=!0,Et(r,e,f.rounding,t)},yt.decimalPlaces=yt.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=7*((e=t.length-1)-ut(this.e/7)),e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},yt.dividedBy=yt.div=function(e){return Nt(this,new this.constructor(e))},yt.dividedToIntegerBy=yt.divToInt=function(e){var t=this.constructor;return Et(Nt(this,new t(e),0,1,1),t.precision,t.rounding)},yt.equals=yt.eq=function(e){return 0===this.cmp(e)},yt.floor=function(){return Et(new this.constructor(this),this.e+1,3)},yt.greaterThan=yt.gt=function(e){return this.cmp(e)>0},yt.greaterThanOrEqualTo=yt.gte=function(e){var t=this.cmp(e);return 1==t||0===t},yt.hyperbolicCosine=yt.cosh=function(){var e,t,n,r,i,o=this,a=o.constructor,s=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return s;n=a.precision,r=a.rounding,a.precision=n+Math.max(o.e,o.sd())+4,a.rounding=1,(i=o.d.length)<32?t=(1/Pt(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=qt(a,1,o.times(t),new a(1),!0);for(var u,c=e,l=new a(8);c--;)u=o.times(o),o=s.minus(u.times(l.minus(u.times(l))));return Et(o,a.precision=n,a.rounding=r,!0)},yt.hyperbolicSine=yt.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=qt(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=qt(o,2,i=i.times(1/Pt(5,e)),i,!0);for(var a,s=new o(5),u=new o(16),c=new o(20);e--;)a=i.times(i),i=i.times(s.plus(a.times(u.times(a).plus(c))))}return o.precision=t,o.rounding=n,Et(i,t,n,!0)},yt.hyperbolicTangent=yt.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Nt(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},yt.inverseCosine=yt.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return-1!==n?0===n?e.isNeg()?Ct(t,r,i):new t(0):new t(NaN):e.isZero()?Ct(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2))},yt.inverseHyperbolicCosine=yt.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,nt=!1,n=n.times(n).minus(1).sqrt().plus(n),nt=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},yt.inverseHyperbolicSine=yt.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,nt=!1,n=n.times(n).plus(1).sqrt().plus(n),nt=!0,r.precision=e,r.rounding=t,n.ln())},yt.inverseHyperbolicTangent=yt.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?Et(new o(i),e,t,!0):(o.precision=n=r-i.e,i=Nt(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},yt.inverseSine=yt.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?((e=Ct(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},yt.inverseTangent=yt.atan=function(){var e,t,n,r,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=gt)return(a=Ct(l,f+4,p).times(.25)).s=c.s,a}else{if(!c.s)return new l(NaN);if(f+4<=gt)return(a=Ct(l,f+4,p).times(.5)).s=c.s,a}for(l.precision=s=f+10,l.rounding=1,e=n=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(nt=!1,t=Math.ceil(s/7),r=1,u=c.times(c),a=new l(c),i=c;-1!==e;)if(i=i.times(u),o=a.minus(i.div(r+=2)),i=i.times(u),void 0!==(a=o.plus(i.div(r+=2))).d[t])for(e=t;a.d[e]===o.d[e]&&e--;);return n&&(a=a.times(2<<n-1)),nt=!0,Et(a,l.precision=f,l.rounding=p,!0)},yt.isFinite=function(){return!!this.d},yt.isInteger=yt.isInt=function(){return!!this.d&&ut(this.e/7)>this.d.length-2},yt.isNaN=function(){return!this.s},yt.isNegative=yt.isNeg=function(){return this.s<0},yt.isPositive=yt.isPos=function(){return this.s>0},yt.isZero=function(){return!!this.d&&0===this.d[0]},yt.lessThan=yt.lt=function(e){return this.cmp(e)<0},yt.lessThanOrEqualTo=yt.lte=function(e){return this.cmp(e)<1},yt.logarithm=yt.log=function(e){var t,n,r,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(nt=!1,a=It(c,s=f+5),r=t?Mt(l,s+10):It(e,s),vt((u=Nt(a,r,s,1)).d,i=f,p))do{if(a=It(c,s+=10),r=t?Mt(l,s+10):It(e,s),u=Nt(a,r,s,1),!o){+xt(u.d).slice(i+1,i+15)+1==1e14&&(u=Et(u,f+1,0));break}}while(vt(u.d,i+=10,p));return nt=!0,Et(u,f,p)},yt.minus=yt.sub=function(e){var t,n,r,i,o,a,s,u,c,l,f,p,m=this,h=m.constructor;if(e=new h(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new h(e.d||m.s!==e.s?m:NaN):e=new h(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,s=h.precision,u=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(m)}return nt?Et(e,s,u):e}if(n=ut(e.e/7),l=ut(m.e/7),c=c.slice(),o=l-n){for((f=o<0)?(t=c,o=-o,a=p.length):(t=p,n=l,a=c.length),o>(r=Math.max(Math.ceil(s/7),a)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((f=(r=c.length)<(a=p.length))&&(a=r),r=0;r<a;r++)if(c[r]!=p[r]){f=c[r]<p[r];break}o=0}for(f&&(t=c,c=p,p=t,e.s=-e.s),a=c.length,r=p.length-a;r>0;--r)c[a++]=0;for(r=p.length;r>o;){if(c[--r]<p[r]){for(i=r;i&&0===c[--i];)c[i]=ht-1;--c[i],c[r]+=ht}c[r]-=p[r]}for(;0===c[--a];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(e.d=c,e.e=St(c,n),nt?Et(e,s,u):e):new h(3===u?-0:0)},yt.modulo=yt.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?Et(new r(n),r.precision,r.rounding):(nt=!1,9==r.modulo?(t=Nt(n,e.abs(),0,3,1)).s*=e.s:t=Nt(n,e,0,r.modulo,1),t=t.times(e),nt=!0,n.minus(t))},yt.naturalExponential=yt.exp=function(){return _t(this)},yt.naturalLogarithm=yt.ln=function(){return It(this)},yt.negated=yt.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Et(e)},yt.plus=yt.add=function(e){var t,n,r,i,o,a,s,u,c,l,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new p(e.d||f.s===e.s?f:NaN)):e=new p(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,s=p.precision,u=p.rounding,!c[0]||!l[0])return l[0]||(e=new p(f)),nt?Et(e,s,u):e;if(o=ut(f.e/7),r=ut(e.e/7),c=c.slice(),i=o-r){for(i<0?(n=c,i=-i,a=l.length):(n=l,r=o,a=c.length),i>(a=(o=Math.ceil(s/7))>a?o+1:a+1)&&(i=a,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((a=c.length)-(i=l.length)<0&&(i=a,n=l,l=c,c=n),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/ht|0,c[i]%=ht;for(t&&(c.unshift(t),++r),a=c.length;0==c[--a];)c.pop();return e.d=c,e.e=St(c,r),nt?Et(e,s,u):e},yt.precision=yt.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(it+e);return n.d?(t=Tt(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},yt.round=function(){var e=this,t=e.constructor;return Et(new t(e),e.e+1,t.rounding)},yt.sine=yt.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:qt(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=qt(e,2,t=t.times(1/Pt(5,n)),t);for(var i,o=new e(5),a=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(s))));return t}(r,jt(r,n)),r.precision=e,r.rounding=t,Et(Ye>2?n.neg():n,e,t,!0)):new r(NaN)},yt.squareRoot=yt.sqrt=function(){var e,t,n,r,i,o,a=this,s=a.d,u=a.e,c=a.s,l=a.constructor;if(1!==c||!s||!s[0])return new l(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);for(nt=!1,0==(c=Math.sqrt(+a))||c==1/0?(((t=xt(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=ut((u+1)/2)-(u<0||u%2),r=new l(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new l(c.toString()),n=(u=l.precision)+3;;)if(r=(o=r).plus(Nt(a,o,n+2,1)).times(.5),xt(o.d).slice(0,n)===(t=xt(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Et(r,u+1,1),e=!r.times(r).eq(a));break}if(!i&&(Et(o,u+1,0),o.times(o).eq(a))){r=o;break}n+=4,i=1}return nt=!0,Et(r,u,l.rounding,e)},yt.tangent=yt.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=Nt(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,Et(2==Ye||4==Ye?n.neg():n,e,t,!0)):new r(NaN)},yt.times=yt.mul=function(e){var t,n,r,i,o,a,s,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(n=ut(l.e/7)+ut(e.e/7),(u=p.length)<(c=m.length)&&(o=p,p=m,m=o,a=u,u=c,c=a),o=[],r=a=u+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=u+r;i>r;)s=o[i]+m[r]*p[i-r-1]+t,o[i--]=s%ht|0,t=s/ht|0;o[i]=(o[i]+t)%ht|0}for(;!o[--a];)o.pop();return t?++n:o.shift(),e.d=o,e.e=St(o,n),nt?Et(e,f.precision,f.rounding):e},yt.toBinary=function(e,t){return Ut(this,2,e,t)},yt.toDecimalPlaces=yt.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(bt(e,0,Xe),void 0===t?t=r.rounding:bt(t,0,8),Et(n,e+n.e+1,t))},yt.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=At(r,!0):(bt(e,0,Xe),void 0===t?t=i.rounding:bt(t,0,8),n=At(r=Et(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},yt.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return void 0===e?n=At(i):(bt(e,0,Xe),void 0===t?t=o.rounding:bt(t,0,8),n=At(r=Et(new o(i),e+i.e+1,t),!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},yt.toFraction=function(e){var t,n,r,i,o,a,s,u,c,l,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=n=new d(1),r=u=new d(0),a=(o=(t=new d(r)).e=Tt(h)-m.e-1)%7,t.d[0]=ct(10,a<0?7+a:a),null==e)e=o>0?t:c;else{if(!(s=new d(e)).isInt()||s.lt(c))throw Error(it+s);e=s.gt(t)?o>0?t:c:s}for(nt=!1,s=new d(xt(h)),l=d.precision,d.precision=o=7*h.length*2;f=Nt(s,t,0,1,1),1!=(i=n.plus(f.times(r))).cmp(e);)n=r,r=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=s.minus(f.times(i)),s=i;return i=Nt(e.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=m.s,p=Nt(c,r,o,1).minus(m).abs().cmp(Nt(u,n,o,1).minus(m).abs())<1?[c,r]:[u,n],d.precision=l,nt=!0,p},yt.toHexadecimal=yt.toHex=function(e,t){return Ut(this,16,e,t)},yt.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:bt(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(nt=!1,n=Nt(n,e,0,t,1).times(e),nt=!0,Et(n)):(e.s=n.s,n=e),n},yt.toNumber=function(){return+this},yt.toOctal=function(e,t){return Ut(this,8,e,t)},yt.toPower=yt.pow=function(e){var t,n,r,i,o,a,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(ct(+s,c));if((s=new u(s)).eq(1))return s;if(r=u.precision,o=u.rounding,e.eq(1))return Et(s,r,o);if((t=ut(e.e/7))>=e.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=Dt(u,s,n,r),e.s<0?new u(1).div(i):Et(i,r,o);if((a=s.s)<0){if(t<e.d.length-1)return new u(NaN);if(1&e.d[t]||(a=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=a,s}return(t=0!=(n=ct(+s,c))&&isFinite(n)?new u(n+"").e:ut(c*(Math.log("0."+xt(s.d))/Math.LN10+s.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?a/0:0):(nt=!1,u.rounding=s.s=1,n=Math.min(12,(t+"").length),(i=_t(e.times(It(s,r+n)),r)).d&&vt((i=Et(i,r+5,1)).d,r,o)&&(t=r+10,+xt((i=Et(_t(e.times(It(s,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=Et(i,r+1,0))),i.s=a,nt=!0,u.rounding=o,Et(i,r,o))},yt.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=At(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(bt(e,1,Xe),void 0===t?t=i.rounding:bt(t,0,8),n=At(r=Et(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},yt.toSignificantDigits=yt.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(bt(e,1,Xe),void 0===t?t=n.rounding:bt(t,0,8)),Et(new n(this),e,t)},yt.toString=function(){var e=this,t=e.constructor,n=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},yt.truncated=yt.trunc=function(){return Et(new this.constructor(this),this.e+1,1)},yt.valueOf=yt.toJSON=function(){var e=this,t=e.constructor,n=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var Nt=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,a,s,u){var c,l,f,p,m,h,d,g,y,x,b,v,w,N,E,A,S,M,C,T,B=r.constructor,D=r.s==i.s?1:-1,F=r.d,O=i.d;if(!(F&&F[0]&&O&&O[0]))return new B(r.s&&i.s&&(F?!O||F[0]!=O[0]:O)?F&&0==F[0]||!O?0*D:D/0:NaN);for(u?(m=1,l=r.e-i.e):(u=ht,m=7,l=ut(r.e/m)-ut(i.e/m)),C=O.length,S=F.length,x=(y=new B(D)).d=[],f=0;O[f]==(F[f]||0);f++);if(O[f]>(F[f]||0)&&l--,null==o?(N=o=B.precision,a=B.rounding):N=s?o+(r.e-i.e)+1:o,N<0)x.push(1),h=!0;else{if(N=N/m+2|0,f=0,1==C){for(p=0,O=O[0],N++;(f<S||p)&&N--;f++)E=p*u+(F[f]||0),x[f]=E/O|0,p=E%O|0;h=p||f<S}else{for((p=u/(O[0]+1)|0)>1&&(O=e(O,p,u),F=e(F,p,u),C=O.length,S=F.length),A=C,v=(b=F.slice(0,C)).length;v<C;)b[v++]=0;(T=O.slice()).unshift(0),M=O[0],O[1]>=u/2&&++M;do{p=0,(c=t(O,b,C,v))<0?(w=b[0],C!=v&&(w=w*u+(b[1]||0)),(p=w/M|0)>1?(p>=u&&(p=u-1),1==(c=t(d=e(O,p,u),b,g=d.length,v=b.length))&&(p--,n(d,C<g?T:O,g,u))):(0==p&&(c=p=1),d=O.slice()),(g=d.length)<v&&d.unshift(0),n(b,d,v,u),-1==c&&(c=t(O,b,C,v=b.length))<1&&(p++,n(b,C<v?T:O,v,u)),v=b.length):0===c&&(p++,b=[0]),x[f++]=p,c&&b[0]?b[v++]=F[A]||0:(b=[F[A]],v=1)}while((A++<S||void 0!==b[0])&&N--);h=void 0!==b[0]}x[0]||x.shift()}if(1==m)y.e=l,We=h;else{for(f=1,p=x[0];p>=10;p/=10)f++;y.e=f+l*m-1,Et(y,s?o+y.e+1:o,a,h)}return y}}();function Et(e,t,n,r){var i,o,a,s,u,c,l,f,p,m=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((o=t-i)<0)o+=7,a=t,u=(l=f[p=0])/ct(10,i-a-1)%10|0;else if((p=Math.ceil((o+1)/7))>=(s=f.length)){if(!r)break e;for(;s++<=p;)f.push(0);l=u=0,i=1,a=(o%=7)-7+1}else{for(l=s=f[p],i=1;s>=10;s/=10)i++;u=(a=(o%=7)-7+i)<0?0:l/ct(10,i-a-1)%10|0}if(r=r||t<0||void 0!==f[p+1]||(a<0?l:l%ct(10,i-a-1)),c=n<4?(u||r)&&(0==n||n==(e.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?a>0?l/ct(10,i-a):0:f[p-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=ct(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=p,s=1,p--):(f.length=p+1,s=ct(10,7-o),f[p]=a>0?(l/ct(10,i-a)%ct(10,a)|0)*s:0),c)for(;;){if(0==p){for(o=1,a=f[0];a>=10;a/=10)o++;for(a=f[0]+=s,s=1;a>=10;a/=10)s++;o!=s&&(e.e++,f[0]==ht&&(f[0]=1));break}if(f[p]+=s,f[p]!=ht)break;f[p--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return nt&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function At(e,t,n){if(!e.isFinite())return zt(e);var r,i=e.e,o=xt(e.d),a=o.length;return t?(n&&(r=n-a)>0?o=o.charAt(0)+"."+o.slice(1)+Bt(r):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Bt(-i-1)+o,n&&(r=n-a)>0&&(o+=Bt(r))):i>=a?(o+=Bt(i+1-a),n&&(r=n-i-1)>0&&(o=o+"."+Bt(r))):((r=i+1)<a&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-a)>0&&(i+1===a&&(o+="."),o+=Bt(r))),o}function St(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function Mt(e,t,n){if(t>dt)throw nt=!0,n&&(e.precision=n),Error(ot);return Et(new e(Ke),t,1,!0)}function Ct(e,t,n){if(t>gt)throw Error(ot);return Et(new e(et),t,n,!0)}function Tt(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Bt(e){for(var t="";e--;)t+="0";return t}function Dt(e,t,n,r){var i,o=new e(1),a=Math.ceil(r/7+4);for(nt=!1;;){if(n%2&&Lt((o=o.times(t)).d,a)&&(i=!0),0===(n=ut(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}Lt((t=t.times(t)).d,a)}return nt=!0,o}function Ft(e){return 1&e.d[e.d.length-1]}function Ot(e,t,n){for(var r,i,o=new e(t[0]),a=0;++a<t.length;){if(!(i=new e(t[a])).s){o=i;break}((r=o.cmp(i))===n||0===r&&o.s===n)&&(o=i)}return o}function _t(e,t){var n,r,i,o,a,s,u,c=0,l=0,f=0,p=e.constructor,m=p.rounding,h=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(nt=!1,u=h):u=t,s=new p(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=r=Math.log(ct(2,f))/Math.LN10*2+5|0,n=o=a=new p(1),p.precision=u;;){if(o=Et(o.times(e),u,1),n=n.times(++l),xt((s=a.plus(Nt(o,n,u,1))).d).slice(0,u)===xt(a.d).slice(0,u)){for(i=f;i--;)a=Et(a.times(a),u,1);if(null!=t)return p.precision=h,a;if(!(c<3&&vt(a.d,u-r,m,c)))return Et(a,p.precision=h,m,nt=!0);p.precision=u+=10,n=o=s=new p(1),l=0,c++}a=s}}function It(e,t){var n,r,i,o,a,s,u,c,l,f,p,m=1,h=e,d=h.d,g=h.constructor,y=g.rounding,x=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==t?(nt=!1,l=x):l=t,g.precision=l+=10,r=(n=xt(d)).charAt(0),!(Math.abs(o=h.e)<15e14))return c=Mt(g,l+2,x).times(o+""),h=It(new g(r+"."+n.slice(1)),l-10).plus(c),g.precision=x,null==t?Et(h,x,y,nt=!0):h;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=xt((h=h.times(e)).d)).charAt(0),m++;for(o=h.e,r>1?(h=new g("0."+n),o++):h=new g(r+"."+n.slice(1)),f=h,u=a=h=Nt(h.minus(1),h.plus(1),l,1),p=Et(h.times(h),l,1),i=3;;){if(a=Et(a.times(p),l,1),xt((c=u.plus(Nt(a,new g(i),l,1))).d).slice(0,l)===xt(u.d).slice(0,l)){if(u=u.times(2),0!==o&&(u=u.plus(Mt(g,l+2,x).times(o+""))),u=Nt(u,new g(m),l,1),null!=t)return g.precision=x,u;if(!vt(u.d,l-10,y,s))return Et(u,g.precision=x,y,nt=!0);g.precision=l+=10,c=a=h=Nt(f.minus(1),f.plus(1),l,1),p=Et(h.times(h),l,1),i=s=1}u=c,i+=2}}function zt(e){return String(e.s*e.s/0)}function kt(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),nt&&(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 Rt(e,t){var n,r,i,o,a,s,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),mt.test(t))return kt(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ft.test(t))n=16,t=t.toLowerCase();else if(lt.test(t))n=2;else{if(!pt.test(t))throw Error(it+t);n=8}for((o=t.search(/p/i))>0?(u=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),a=(o=t.indexOf("."))>=0,r=e.constructor,a&&(o=(s=(t=t.replace(".","")).length)-o,i=Dt(r,new r(n),o,2*o)),o=l=(c=wt(t,n,ht)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*e.s):(e.e=St(c,l),e.d=c,nt=!1,a&&(e=Nt(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?ct(2,u):Dn.pow(2,u))),nt=!0,e)}function qt(e,t,n,r,i){var o,a,s,u,c=e.precision,l=Math.ceil(c/7);for(nt=!1,u=n.times(n),s=new e(r);;){if(a=Nt(s.times(u),new e(t++*t++),c,1),s=i?r.plus(a):r.minus(a),r=Nt(a.times(u),new e(t++*t++),c,1),void 0!==(a=s.plus(r)).d[l]){for(o=l;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=r,r=a,a=o}return nt=!0,a.d.length=l+1,a}function Pt(e,t){for(var n=e;--t;)n*=e;return n}function jt(e,t){var n,r=t.s<0,i=Ct(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return Ye=r?4:1,t;if((n=t.divToInt(i)).isZero())Ye=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return Ye=Ft(n)?r?2:3:r?4:1,t;Ye=Ft(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Ut(e,t,n,r){var i,o,a,s,u,c,l,f,p,m=e.constructor,h=void 0!==n;if(h?(bt(n,1,Xe),void 0===r?r=m.rounding:bt(r,0,8)):(n=m.precision,r=m.rounding),e.isFinite()){for(h?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,(a=(l=At(e)).indexOf("."))>=0&&(l=l.replace(".",""),(p=new m(1)).e=l.length-a,p.d=wt(At(p),10,i),p.e=p.d.length),o=u=(f=wt(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(a<0?o--:((e=new m(e)).d=f,e.e=o,f=(e=Nt(e,p,n,r,0,i)).d,o=e.e,c=We),a=f[n],s=i/2,c=c||void 0!==f[n+1],c=r<4?(void 0!==a||c)&&(0===r||r===(e.s<0?3:2)):a>s||a===s&&(4===r||c||6===r&&1&f[n-1]||r===(e.s<0?8:7)),f.length=n,c)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(u=f.length;!f[u-1];--u);for(a=0,l="";a<u;a++)l+=Qe.charAt(f[a]);if(h){if(u>1)if(16==t||8==t){for(a=16==t?4:3,--u;u%a;u++)l+="0";for(u=(f=wt(l,i,t)).length;!f[u-1];--u);for(a=1,l="1.";a<u;a++)l+=Qe.charAt(f[a])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}else l=h?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=zt(e);return e.s<0?"-"+l:l}function Lt(e,t){if(e.length>t)return e.length=t,!0}function $t(e){return new this(e).abs()}function Ht(e){return new this(e).acos()}function Gt(e){return new this(e).acosh()}function Vt(e,t){return new this(e).plus(t)}function Zt(e){return new this(e).asin()}function Wt(e){return new this(e).asinh()}function Yt(e){return new this(e).atan()}function Jt(e){return new this(e).atanh()}function Xt(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?Ct(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=Ct(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(Nt(e,t,o,1)),t=Ct(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Nt(e,t,o,1)):(n=Ct(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function Qt(e){return new this(e).cbrt()}function Kt(e){return Et(e=new this(e),e.e+1,2)}function en(e,t,n){return new this(e).clamp(t,n)}function tn(e){if(!e||"object"!=typeof e)throw Error(rt+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,Xe,"rounding",0,8,"toExpNeg",-Je,0,"toExpPos",0,Je,"maxE",0,Je,"minE",-Je,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=tt[n]),void 0!==(r=e[n])){if(!(ut(r)===r&&r>=o[t+1]&&r<=o[t+2]))throw Error(it+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=tt[n]),void 0!==(r=e[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(it+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(at);this[n]=!0}else this[n]=!1}return this}function nn(e){return new this(e).cos()}function rn(e){return new this(e).cosh()}function on(e,t){return new this(e).div(t)}function an(e){return new this(e).exp()}function sn(e){return Et(e=new this(e),e.e+1,3)}function un(){var e,t,n=new this(0);for(nt=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return nt=!0,new this(1/0);n=t}return nt=!0,n.sqrt()}function cn(e){return e instanceof Dn||e&&e.toStringTag===st||!1}function ln(e){return new this(e).ln()}function fn(e,t){return new this(e).log(t)}function pn(e){return new this(e).log(2)}function mn(e){return new this(e).log(10)}function hn(){return Ot(this,arguments,-1)}function dn(){return Ot(this,arguments,1)}function gn(e,t){return new this(e).mod(t)}function yn(e,t){return new this(e).mul(t)}function xn(e,t){return new this(e).pow(t)}function bn(e){var t,n,r,i,o=0,a=new this(1),s=[];if(void 0===e?e=this.precision:bt(e,1,Xe),r=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(at);for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(s.push(i%1e7),o+=4);o=r/4}else for(;o<r;)s[o++]=1e7*Math.random()|0;for(e%=7,(r=s[--o])&&e&&(i=ct(10,7-e),s[o]=(r/i|0)*i);0===s[o];o--)s.pop();if(o<0)n=0,s=[0];else{for(n=-1;0===s[0];n-=7)s.shift();for(r=1,i=s[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return a.e=n,a.d=s,a}function vn(e){return Et(e=new this(e),e.e+1,this.rounding)}function wn(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Nn(e){return new this(e).sin()}function En(e){return new this(e).sinh()}function An(e){return new this(e).sqrt()}function Sn(e,t){return new this(e).sub(t)}function Mn(){var e=0,t=arguments,n=new this(t[e]);for(nt=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return nt=!0,Et(n,this.precision,this.rounding)}function Cn(e){return new this(e).tan()}function Tn(e){return new this(e).tanh()}function Bn(e){return Et(e=new this(e),e.e+1,1)}yt[Symbol.for("nodejs.util.inspect.custom")]=yt.toString,yt[Symbol.toStringTag]="Decimal";var Dn=yt.constructor=function e(t){var n,r,i;function o(e){var t,n,r,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,cn(e))return i.s=e.s,void(nt?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"==(r=typeof e)){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;return void(nt?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):kt(i,e.toString())}if("string"===r)return 45===(n=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===n&&(e=e.slice(1)),i.s=1),mt.test(e)?kt(i,e):Rt(i,e);if("bigint"===r)return e<0?(e=-e,i.s=-1):i.s=1,kt(i,e.toString());throw Error(it+e)}if(o.prototype=yt,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=tn,o.clone=e,o.isDecimal=cn,o.abs=$t,o.acos=Ht,o.acosh=Gt,o.add=Vt,o.asin=Zt,o.asinh=Wt,o.atan=Yt,o.atanh=Jt,o.atan2=Xt,o.cbrt=Qt,o.ceil=Kt,o.clamp=en,o.cos=nn,o.cosh=rn,o.div=on,o.exp=an,o.floor=sn,o.hypot=un,o.ln=ln,o.log=fn,o.log10=mn,o.log2=pn,o.max=hn,o.min=dn,o.mod=gn,o.mul=yn,o.pow=xn,o.random=bn,o.round=vn,o.sign=wn,o.sin=Nn,o.sinh=En,o.sqrt=An,o.sub=Sn,o.sum=Mn,o.tan=Cn,o.tanh=Tn,o.trunc=Bn,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(tt);Ke=new Dn(Ke),et=new Dn(et);const Fn=Dn,On=he("BigNumber",["?on","config"],(e=>{let{on:t,config:n}=e;const r=Fn.clone({precision:n.precision,modulo:Fn.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t("config",(function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})})),r}),{isClass:!0}),_n=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},In=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},zn=function(e,t){return(e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},kn=function(){throw SyntaxError("Invalid Param")};function Rn(e,t){const n=Math.abs(e),r=Math.abs(t);return 0===e?Math.log(r):0===t?Math.log(n):n<3e3&&r<3e3?.5*Math.log(e*e+t*t):(e*=.5,t*=.5,.5*Math.log(e*e+t*t)+Math.LN2)}const qn={re:0,im:0},Pn=function(e,t){const n=qn;if(null==e)n.re=n.im=0;else if(void 0!==t)n.re=e,n.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)n.re=e.re,n.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return jn.INFINITY;n.re=e.abs*Math.cos(e.arg),n.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return jn.INFINITY;n.re=e.r*Math.cos(e.phi),n.im=e.r*Math.sin(e.phi)}else 2===e.length?(n.re=e[0],n.im=e[1]):kn();break;case"string":n.im=n.re=0;const t=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let r=1,i=0;null===t&&kn();for(let e=0;e<t.length;e++){const o=t[e];" "===o||"\t"===o||"\n"===o||("+"===o?r++:"-"===o?i++:"i"===o||"I"===o?(r+i===0&&kn()," "===t[e+1]||isNaN(t[e+1])?n.im+=parseFloat((i%2?"-":"")+"1"):(n.im+=parseFloat((i%2?"-":"")+t[e+1]),e++),r=i=0):((r+i===0||isNaN(o))&&kn(),"i"===t[e+1]||"I"===t[e+1]?(n.im+=parseFloat((i%2?"-":"")+o),e++):n.re+=parseFloat((i%2?"-":"")+o),r=i=0))}r+i>0&&kn();break;case"number":n.im=0,n.re=e;break;default:kn()}return isNaN(n.re)||isNaN(n.im),n};function jn(e,t){if(!(this instanceof jn))return new jn(e,t);const n=Pn(e,t);this.re=n.re,this.im=n.im}jn.prototype={re:0,im:0,sign:function(){const e=zn(this.re,this.im);return new jn(this.re/e,this.im/e)},add:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?jn.NAN:jn.INFINITY:new jn(this.re+n.re,this.im+n.im)},sub:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?jn.NAN:jn.INFINITY:new jn(this.re-n.re,this.im-n.im)},mul:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,a=0===n.re&&0===n.im;return r&&a||i&&o?jn.NAN:r||i?jn.INFINITY:0===n.im&&0===this.im?new jn(this.re*n.re,0):new jn(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,a=0===n.re&&0===n.im;if(o&&a||r&&i)return jn.NAN;if(a||r)return jn.INFINITY;if(o||i)return jn.ZERO;if(0===n.im)return new jn(this.re/n.re,this.im/n.re);if(Math.abs(n.re)<Math.abs(n.im)){const e=n.re/n.im,t=n.re*e+n.im;return new jn((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{const e=n.im/n.re,t=n.im*e+n.re;return new jn((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){const n=Pn(e,t),r=0===this.re&&0===this.im;if(0===n.re&&0===n.im)return jn.ONE;if(0===n.im){if(0===this.im&&this.re>0)return new jn(Math.pow(this.re,n.re),0);if(0===this.re)switch((n.re%4+4)%4){case 0:return new jn(Math.pow(this.im,n.re),0);case 1:return new jn(0,Math.pow(this.im,n.re));case 2:return new jn(-Math.pow(this.im,n.re),0);case 3:return new jn(0,-Math.pow(this.im,n.re))}}if(r&&n.re>0)return jn.ZERO;const i=Math.atan2(this.im,this.re),o=Rn(this.re,this.im);let a=Math.exp(n.re*o-n.im*i),s=n.im*o+n.re*i;return new jn(a*Math.cos(s),a*Math.sin(s))},sqrt:function(){const e=this.re,t=this.im;if(0===t)return e>=0?new jn(Math.sqrt(e),0):new jn(0,Math.sqrt(-e));const n=zn(e,t);let r=Math.sqrt(.5*(n+Math.abs(e))),i=Math.abs(t)/(2*r);return e>=0?new jn(r,t<0?-i:i):new jn(i,t<0?-r:r)},exp:function(){const e=Math.exp(this.re);return 0===this.im?new jn(e,0):new jn(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){const e=this.re,t=this.im;return new jn(Math.expm1(e)*Math.cos(t)+function(e){const t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;const n=e*e;return n*(n*(n*(n*(n*(n*(n*(n/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){const e=this.re,t=this.im;return 0===t&&e>0?new jn(Math.log(e),0):new jn(Rn(e,t),Math.atan2(t,e))},abs:function(){return zn(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){const e=this.re,t=this.im;return new jn(Math.sin(e)*_n(t),Math.cos(e)*In(t))},cos:function(){const e=this.re,t=this.im;return new jn(Math.cos(e)*_n(t),-Math.sin(e)*In(t))},tan:function(){const e=2*this.re,t=2*this.im,n=Math.cos(e)+_n(t);return new jn(Math.sin(e)/n,In(t)/n)},cot:function(){const e=2*this.re,t=2*this.im,n=Math.cos(e)-_n(t);return new jn(-Math.sin(e)/n,In(t)/n)},sec:function(){const e=this.re,t=this.im,n=.5*_n(2*t)+.5*Math.cos(2*e);return new jn(Math.cos(e)*_n(t)/n,Math.sin(e)*In(t)/n)},csc:function(){const e=this.re,t=this.im,n=.5*_n(2*t)-.5*Math.cos(2*e);return new jn(Math.sin(e)*_n(t)/n,-Math.cos(e)*In(t)/n)},asin:function(){const e=this.re,t=this.im,n=new jn(t*t-e*e+1,-2*e*t).sqrt(),r=new jn(n.re-t,n.im+e).log();return new jn(r.im,-r.re)},acos:function(){const e=this.re,t=this.im,n=new jn(t*t-e*e+1,-2*e*t).sqrt(),r=new jn(n.re-t,n.im+e).log();return new jn(Math.PI/2-r.im,r.re)},atan:function(){const e=this.re,t=this.im;if(0===e){if(1===t)return new jn(0,1/0);if(-1===t)return new jn(0,-1/0)}const n=e*e+(1-t)*(1-t),r=new jn((1-t*t-e*e)/n,-2*e/n).log();return new jn(-.5*r.im,.5*r.re)},acot:function(){const e=this.re,t=this.im;if(0===t)return new jn(Math.atan2(1,e),0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).atan():new jn(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(0,1/0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).acos():new jn(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(Math.PI/2,1/0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).asin():new jn(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){const e=this.re,t=this.im;return new jn(In(e)*Math.cos(t),_n(e)*Math.sin(t))},cosh:function(){const e=this.re,t=this.im;return new jn(_n(e)*Math.cos(t),In(e)*Math.sin(t))},tanh:function(){const e=2*this.re,t=2*this.im,n=_n(e)+Math.cos(t);return new jn(In(e)/n,Math.sin(t)/n)},coth:function(){const e=2*this.re,t=2*this.im,n=_n(e)-Math.cos(t);return new jn(In(e)/n,-Math.sin(t)/n)},csch:function(){const e=this.re,t=this.im,n=Math.cos(2*t)-_n(2*e);return new jn(-2*In(e)*Math.cos(t)/n,2*_n(e)*Math.sin(t)/n)},sech:function(){const e=this.re,t=this.im,n=Math.cos(2*t)+_n(2*e);return new jn(2*_n(e)*Math.cos(t)/n,-2*In(e)*Math.sin(t)/n)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;const t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){const e=this.acos();if(e.im<=0){const t=e.re;e.re=-e.im,e.im=t}else{const t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){const e=this.re,t=this.im,n=e>1&&0===t,r=1-e,i=1+e,o=r*r+t*t,a=0!==o?new jn((i*r-t*t)/o,(t*r+i*t)/o):new jn(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=Rn(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,n&&(a.im=-a.im),a},acoth:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(0,Math.PI/2);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).atanh():new jn(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){const e=this.re,t=this.im;if(0===t)return new jn(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).asinh():new jn(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){const e=this.re,t=this.im;if(this.isZero())return jn.INFINITY;const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).acosh():new jn(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return jn.INFINITY;if(this.isInfinite())return jn.ZERO;const e=this.re,t=this.im,n=e*e+t*t;return new jn(e/n,-t/n)},conjugate:function(){return new jn(this.re,-this.im)},neg:function(){return new jn(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new jn(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new jn(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new jn(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){const n=Pn(e,t);return Math.abs(n.re-this.re)<=jn.EPSILON&&Math.abs(n.im-this.im)<=jn.EPSILON},clone:function(){return new jn(this.re,this.im)},toString:function(){let e=this.re,t=this.im,n="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<jn.EPSILON&&(e=0),Math.abs(t)<jn.EPSILON&&(t=0),0===t?n+e:(0!==e?(n+=e,n+=" ",t<0?(t=-t,n+="-"):n+="+",n+=" "):t<0&&(t=-t,n+="-"),1!==t&&(n+=t),n+"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()}},jn.ZERO=new jn(0,0),jn.ONE=new jn(1,0),jn.I=new jn(0,1),jn.PI=new jn(Math.PI,0),jn.E=new jn(Math.E,0),jn.INFINITY=new jn(1/0,1/0),jn.NAN=new jn(NaN,NaN),jn.EPSILON=1e-15;const Un=he("Complex",[],(()=>(Object.defineProperty(jn,"name",{value:"Complex"}),jn.prototype.constructor=jn,jn.prototype.type="Complex",jn.prototype.isComplex=!0,jn.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},jn.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},jn.prototype.format=function(e){let t="",n=this.im,r=this.re;const i=Me(this.re,e),o=Me(this.im,e),a=d(e)?e:e?e.precision:null;if(null!==a){const e=Math.pow(10,-a);Math.abs(r/n)<e&&(r=0),Math.abs(n/r)<e&&(n=0)}return t=0===n?i:0===r?1===n?"i":-1===n?"-i":o+"i":n<0?-1===n?i+" - i":i+" - "+o.substring(1)+"i":1===n?i+" + i":i+" + "+o+"i",t},jn.fromPolar=function(e){switch(arguments.length){case 1:{const e=arguments[0];if("object"==typeof e)return jn(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{const e=arguments[0];let t=arguments[1];if(d(e)){if(v(t)&&t.hasBase("ANGLE")&&(t=t.toNumber("rad")),d(t))return new jn({r:e,phi:t});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},jn.prototype.valueOf=jn.prototype.toString,jn.fromJSON=function(e){return new jn(e)},jn.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},jn)),{isClass:!0});"undefined"==typeof BigInt&&(BigInt=function(e){if(isNaN(e))throw new Error("");return e});const Ln=BigInt(0),$n=BigInt(1),Hn=BigInt(2),Gn=BigInt(5),Vn=BigInt(10),Zn={s:$n,n:Ln,d:$n};function Wn(e,t){try{e=BigInt(e)}catch(e){throw nr()}return e*t}function Yn(e){return"bigint"==typeof e?e:Math.floor(e)}function Jn(e,t){if(t===Ln)throw tr();const n=Object.create(er.prototype);n.s=e<Ln?-$n:$n;const r=Kn(e=e<Ln?-e:e,t);return n.n=e/r,n.d=t/r,n}function Xn(e){const t={};let n=e,r=Hn,i=Gn-$n;for(;i<=n;){for(;n%r===Ln;)n/=r,t[r]=(t[r]||Ln)+$n;i+=$n+Hn*r++}return n!==e?n>1&&(t[n]=(t[n]||Ln)+$n):t[e]=(t[e]||Ln)+$n,t}const Qn=function(e,t){let n=Ln,r=$n,i=$n;if(null==e);else if(void 0!==t){if("bigint"==typeof e)n=e;else{if(isNaN(e))throw nr();if(e%1!=0)throw rr();n=BigInt(e)}if("bigint"==typeof t)r=t;else{if(isNaN(t))throw nr();if(t%1!=0)throw rr();r=BigInt(t)}i=n*r}else if("object"==typeof e){if("d"in e&&"n"in e)n=BigInt(e.n),r=BigInt(e.d),"s"in e&&(n*=BigInt(e.s));else if(0 in e)n=BigInt(e[0]),1 in e&&(r=BigInt(e[1]));else{if("bigint"!=typeof e)throw nr();n=e}i=n*r}else if("number"==typeof e){if(isNaN(e))throw nr();if(e<0&&(i=-$n,e=-e),e%1==0)n=BigInt(e);else if(e>0){let t=1,i=0,o=1,a=1,s=1,u=1e7;for(e>=1&&(t=10**Math.floor(1+Math.log10(e)),e/=t);o<=u&&s<=u;){let t=(i+a)/(o+s);if(e===t){o+s<=u?(n=i+a,r=o+s):s>o?(n=a,r=s):(n=i,r=o);break}e>t?(i+=a,o+=s):(a+=i,s+=o),o>u?(n=a,r=s):(n=i,r=o)}n=BigInt(n)*BigInt(t),r=BigInt(r)}}else if("string"==typeof e){let t=0,o=Ln,a=Ln,s=Ln,u=$n,c=$n,l=e.replace(/_/g,"").match(/\d+|./g);if(null===l)throw nr();if("-"===l[t]?(i=-$n,t++):"+"===l[t]&&t++,l.length===t+1?a=Wn(l[t++],i):"."===l[t+1]||"."===l[t]?("."!==l[t]&&(o=Wn(l[t++],i)),t++,(t+1===l.length||"("===l[t+1]&&")"===l[t+3]||"'"===l[t+1]&&"'"===l[t+3])&&(a=Wn(l[t],i),u=Vn**BigInt(l[t].length),t++),("("===l[t]&&")"===l[t+2]||"'"===l[t]&&"'"===l[t+2])&&(s=Wn(l[t+1],i),c=Vn**BigInt(l[t+1].length)-$n,t+=3)):"/"===l[t+1]||":"===l[t+1]?(a=Wn(l[t],i),u=Wn(l[t+2],$n),t+=3):"/"===l[t+3]&&" "===l[t+1]&&(o=Wn(l[t],i),a=Wn(l[t+2],i),u=Wn(l[t+4],$n),t+=5),!(l.length<=t))throw nr();r=u*c,i=n=s+r*o+c*a}else{if("bigint"!=typeof e)throw nr();n=e,i=e,r=$n}if(r===Ln)throw tr();Zn.s=i<Ln?-$n:$n,Zn.n=n<Ln?-n:n,Zn.d=r<Ln?-r:r};function Kn(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function er(e,t){if(Qn(e,t),!(this instanceof er))return Jn(Zn.s*Zn.n,Zn.d);e=Kn(Zn.d,Zn.n),this.s=Zn.s,this.n=Zn.n/e,this.d=Zn.d/e}var tr=function(){return new Error("Division by Zero")},nr=function(){return new Error("Invalid argument")},rr=function(){return new Error("Parameters must be integer")};er.prototype={s:$n,n:Ln,d:$n,abs:function(){return Jn(this.n,this.d)},neg:function(){return Jn(-this.s*this.n,this.d)},add:function(e,t){return Qn(e,t),Jn(this.s*this.n*Zn.d+Zn.s*this.d*Zn.n,this.d*Zn.d)},sub:function(e,t){return Qn(e,t),Jn(this.s*this.n*Zn.d-Zn.s*this.d*Zn.n,this.d*Zn.d)},mul:function(e,t){return Qn(e,t),Jn(this.s*Zn.s*this.n*Zn.n,this.d*Zn.d)},div:function(e,t){return Qn(e,t),Jn(this.s*Zn.s*this.n*Zn.d,this.d*Zn.n)},clone:function(){return Jn(this.s*this.n,this.d)},mod:function(e,t){if(void 0===e)return Jn(this.s*this.n%this.d,$n);if(Qn(e,t),Ln===Zn.n*this.d)throw tr();return Jn(this.s*(Zn.d*this.n)%(Zn.n*this.d),Zn.d*this.d)},gcd:function(e,t){return Qn(e,t),Jn(Kn(Zn.n,this.n)*Kn(Zn.d,this.d),Zn.d*this.d)},lcm:function(e,t){return Qn(e,t),Zn.n===Ln&&this.n===Ln?Jn(Ln,$n):Jn(Zn.n*this.n,Kn(Zn.n,this.n)*Kn(Zn.d,this.d))},inverse:function(){return Jn(this.s*this.d,this.n)},pow:function(e,t){if(Qn(e,t),Zn.d===$n)return Zn.s<Ln?Jn((this.s*this.d)**Zn.n,this.n**Zn.n):Jn((this.s*this.n)**Zn.n,this.d**Zn.n);if(this.s<Ln)return null;let n=Xn(this.n),r=Xn(this.d),i=$n,o=$n;for(let e in n)if("1"!==e){if("0"===e){i=Ln;break}if(n[e]*=Zn.n,n[e]%Zn.d!==Ln)return null;n[e]/=Zn.d,i*=BigInt(e)**n[e]}for(let e in r)if("1"!==e){if(r[e]*=Zn.n,r[e]%Zn.d!==Ln)return null;r[e]/=Zn.d,o*=BigInt(e)**r[e]}return Zn.s<Ln?Jn(o,i):Jn(i,o)},log:function(e,t){if(Qn(e,t),this.s<=Ln||Zn.s<=Ln)return null;const n={},r=Xn(Zn.n),i=Xn(Zn.d),o=Xn(this.n),a=Xn(this.d);for(const e in i)r[e]=(r[e]||Ln)-i[e];for(const e in a)o[e]=(o[e]||Ln)-a[e];for(const e in r)"1"!==e&&(n[e]=!0);for(const e in o)"1"!==e&&(n[e]=!0);let s=null,u=null;for(const e in n){const t=r[e]||Ln,n=o[e]||Ln;if(t===Ln){if(n!==Ln)return null;continue}let i=n,a=t;const c=Kn(i,a);if(i/=c,a/=c,null===s&&null===u)s=i,u=a;else if(i*u!=s*a)return null}return null!==s&&null!==u?Jn(s,u):null},equals:function(e,t){return Qn(e,t),this.s*this.n*Zn.d==Zn.s*Zn.n*this.d},lt:function(e,t){return Qn(e,t),this.s*this.n*Zn.d<Zn.s*Zn.n*this.d},lte:function(e,t){return Qn(e,t),this.s*this.n*Zn.d<=Zn.s*Zn.n*this.d},gt:function(e,t){return Qn(e,t),this.s*this.n*Zn.d>Zn.s*Zn.n*this.d},gte:function(e,t){return Qn(e,t),this.s*this.n*Zn.d>=Zn.s*Zn.n*this.d},compare:function(e,t){Qn(e,t);let n=this.s*this.n*Zn.d-Zn.s*Zn.n*this.d;return(Ln<n)-(n<Ln)},ceil:function(e){return e=Vn**BigInt(e||0),Jn(Yn(this.s*e*this.n/this.d)+(e*this.n%this.d>Ln&&this.s>=Ln?$n:Ln),e)},floor:function(e){return e=Vn**BigInt(e||0),Jn(Yn(this.s*e*this.n/this.d)-(e*this.n%this.d>Ln&&this.s<Ln?$n:Ln),e)},round:function(e){return e=Vn**BigInt(e||0),Jn(Yn(this.s*e*this.n/this.d)+this.s*((this.s>=Ln?$n:Ln)+Hn*(e*this.n%this.d)>this.d?$n:Ln),e)},roundTo:function(e,t){Qn(e,t);const n=this.n*Zn.d,r=this.d*Zn.n,i=n%r;let o=Yn(n/r);return i+i>=r&&o++,Jn(this.s*o*Zn.n,Zn.d)},divisible:function(e,t){return Qn(e,t),!(!(Zn.n*this.d)||this.n*Zn.d%(Zn.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(e){let t=this.n,n=this.d;e=e||15;let r=function(e,t){for(;t%Hn===Ln;t/=Hn);for(;t%Gn===Ln;t/=Gn);if(t===$n)return Ln;let n=Vn%t,r=1;for(;n!==$n;r++)if(n=n*Vn%t,r>2e3)return Ln;return BigInt(r)}(0,n),i=function(e,t,n){let r=$n,i=function(e,t,n){let r=$n;for(;t>Ln;e=e*e%n,t>>=$n)t&$n&&(r=r*e%n);return r}(Vn,n,t);for(let e=0;e<300;e++){if(r===i)return BigInt(e);r=r*Vn%t,i=i*Vn%t}return 0}(0,n,r),o=this.s<Ln?"-":"";if(o+=Yn(t/n),t%=n,t*=Vn,t&&(o+="."),r){for(let e=i;e--;)o+=Yn(t/n),t%=n,t*=Vn;o+="(";for(let e=r;e--;)o+=Yn(t/n),t%=n,t*=Vn;o+=")"}else for(let r=e;t&&r--;)o+=Yn(t/n),t%=n,t*=Vn;return o},toFraction:function(e){let t=this.n,n=this.d,r=this.s<Ln?"-":"";if(n===$n)r+=t;else{let i=Yn(t/n);e&&i>Ln&&(r+=i,r+=" ",t%=n),r+=t,r+="/",r+=n}return r},toLatex:function(e){let t=this.n,n=this.d,r=this.s<Ln?"-":"";if(n===$n)r+=t;else{let i=Yn(t/n);e&&i>Ln&&(r+=i,t%=n),r+="\\frac{",r+=t,r+="}{",r+=n,r+="}"}return r},toContinued:function(){let e=this.n,t=this.d,n=[];do{n.push(Yn(e/t));let r=e%t;e=t,t=r}while(e!==$n);return n},simplify:function(e){const t=BigInt(1/(e||.001)|0),n=this.abs(),r=n.toContinued();for(let e=1;e<r.length;e++){let i=Jn(r[e-1],$n);for(let t=e-2;t>=0;t--)i=i.inverse().add(r[t]);let o=i.sub(n);if(o.n*t<o.d)return i.mul(this.s)}return this}};const ir=he("Fraction",[],(()=>(Object.defineProperty(er,"name",{value:"Fraction"}),er.prototype.constructor=er,er.prototype.type="Fraction",er.prototype.isFraction=!0,er.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},er.fromJSON=function(e){return new er(e)},er)),{isClass:!0});n(3362),n(1795);const or=he("Range",[],(()=>{function e(t,n,r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");const i=null!=t,o=null!=n,a=null!=r;if(i)if(g(t))t=t.toNumber();else if("number"!=typeof t&&!y(t))throw new TypeError("Parameter start must be a number or bigint");if(o)if(g(n))n=n.toNumber();else if("number"!=typeof n&&!y(n))throw new TypeError("Parameter end must be a number or bigint");if(a)if(g(r))r=r.toNumber();else if("number"!=typeof r&&!y(r))throw new TypeError("Parameter step must be a number or bigint");this.start=i?parseFloat(t):0,this.end=o?parseFloat(n):0,this.step=a?parseFloat(r):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if("string"!=typeof t)return null;const n=t.split(":").map((function(e){return parseFloat(e)}));if(n.some((function(e){return isNaN(e)})))return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){let e=0;const t=this.start,n=this.step,r=this.end-t;return be(n)===be(r)?e=Math.ceil(r/n):0===r&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){const e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){const 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){let t=this.start;const n=this.step,r=this.end;let i=0;if(n>0)for(;t<r;)e(t,[i],this),t+=n,i++;else if(n<0)for(;t>r;)e(t,[i],this),t+=n,i++},e.prototype.map=function(e){const t=[];return this.forEach((function(n,r,i){t[r[0]]=e(n,r,i)})),t},e.prototype.toArray=function(){const e=[];return this.forEach((function(t,n){e[n[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){let t=Me(this.start,e);return 1!==this.step&&(t+=":"+Me(this.step,e)),t+=":"+Me(this.end,e),t},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(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0}),ar=he("Matrix",[],(()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e}),{isClass:!0});function sr(){return sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sr.apply(null,arguments)}function ur(e,t,n){const r=new(0,e.constructor)(2);let i="";if(n){if(n<1)throw new Error("size must be in greater than 0");if(!ye(n))throw new Error("size must be an integer");if(e.greaterThan(r.pow(n-1).sub(1))||e.lessThan(r.pow(n-1).mul(-1)))throw new Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(r.pow(n))),i=`i${n}`}switch(t){case 2:return`${e.toBinary()}${i}`;case 8:return`${e.toOctal()}${i}`;case 16:return`${e.toHexadecimal()}${i}`;default:throw new Error(`Base ${t} not supported `)}}function cr(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function lr(e,t){return d(e)?e:g(e)?e.toNumber():t}function fr(e,t){const n=e.length-t.length,r=e.length;return e.substring(n,r)===t}function pr(e,t){const n=function(e,t){return"number"==typeof e?Me(e,t):g(e)?function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";const{notation:n,precision:r,wordSize:i}=Ce(t);switch(n){case"fixed":return function(e,t){return e.toFixed(t)}(e,r);case"exponential":return cr(e,r);case"engineering":return function(e,t){const n=e.e,r=n%3==0?n:n<0?n-3-n%3:n-n%3;let i=e.mul(Math.pow(10,-r)).toPrecision(t);return i.includes("e")&&(i=new(0,e.constructor)(i).toFixed()),i+"e"+(n>=0?"+":"")+r.toString()}(e,r);case"bin":return ur(e,2,i);case"oct":return ur(e,8,i);case"hex":return ur(e,16,i);case"auto":{const n=lr(null==t?void 0:t.lowerExp,-3),i=lr(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";let o;const a=e.toSignificantDigits(r),s=a.e;return o=s>=n&&s<i?a.toFixed():cr(e,r),o.replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}))}default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t):function(e){return e&&"object"==typeof e&&"bigint"==typeof e.s&&"bigint"==typeof e.n&&"bigint"==typeof e.d||!1}(e)?t&&"decimal"===t.fraction?e.toString():`${e.s*e.n}/${e.d}`:Array.isArray(e)?gr(e,t):w(e)?mr(e):"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):"{"+Object.keys(e).map((n=>mr(n)+": "+pr(e[n],t))).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+"...":n}function mr(e){const t=String(e);let n="",r=0;for(;r<t.length;){const e=t.charAt(r);n+=e in hr?hr[e]:e,r++}return'"'+n+'"'}n(2712),n(8872);const hr={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function dr(e){let t=String(e);return t=t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),t}function gr(e,t){if(Array.isArray(e)){let n="[";const r=e.length;for(let i=0;i<r;i++)0!==i&&(n+=", "),n+=gr(e[i],t);return n+="]",n}return pr(e,t)}function yr(e,t){if(!w(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(e)+", index: 0)");if(!w(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(t)+", index: 1)");return e===t?0:e>t?1:-1}function xr(e,t,n){if(!(this instanceof xr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function br(e,t,n){if(!(this instanceof br))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),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=(new Error).stack}function vr(e){const t=[];for(;Array.isArray(e);)t.push(e.length),e=e[0];return t}function wr(e,t,n){let r;const i=e.length;if(i!==t[n])throw new xr(i,t[n]);if(n<t.length-1){const o=n+1;for(r=0;r<i;r++){const n=e[r];if(!Array.isArray(n))throw new xr(t.length-1,t.length,"<");wr(e[r],t,o)}}else for(r=0;r<i;r++)if(Array.isArray(e[r]))throw new xr(t.length+1,t.length,">")}function Nr(e,t){if(0===t.length){if(Array.isArray(e))throw new xr(e.length,0)}else wr(e,t,0)}function Er(e,t){const n=e.isMatrix?e._size:vr(e);t._sourceSize.forEach(((e,t)=>{if(null!==e&&e!==n[t])throw new xr(e,n[t])}))}function Ar(e,t){if(void 0!==e){if(!d(e)||!ye(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new br(e,t)}}function Sr(e){for(let t=0;t<e._dimensions.length;++t){const n=e._dimensions[t];if(n._data&&N(n._data)){if(0===n._size[0])return!0}else if(n.isRange){if(n.start===n.end)return!0}else if(w(n)&&0===n.length)return!0}return!1}function Mr(e,t,n){if(!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");return t.forEach((function(e){if(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+pr(t)+")")})),(d(e)||g(e))&&(e=[e]),Cr(e,t,0,void 0!==n?n:0),e}function Cr(e,t,n,r){let i,o;const a=e.length,s=t[n],u=Math.min(a,s);if(e.length=s,n<t.length-1){const a=n+1;for(i=0;i<u;i++)o=e[i],Array.isArray(o)||(o=[o],e[i]=o),Cr(o,t,a,r);for(i=u;i<s;i++)o=[],e[i]=o,Cr(o,t,a,r)}else{for(i=0;i<u;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=u;i<s;i++)e[i]=r}}function Tr(e,t){const n=zr(e),r=n.length;if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new xr(0,r,"!=");const i=Dr(t=Br(t,r));if(r!==i)throw new xr(i,r,"!=");try{return function(e,t){let n,r=e;for(let e=t.length-1;e>0;e--){const i=t[e];n=[];const o=r.length/i;for(let e=0;e<o;e++)n.push(r.slice(e*i,(e+1)*i));r=n}return r}(n,t)}catch(e){if(e instanceof xr)throw new xr(i,r,"!=");throw e}}function Br(e,t){const n=Dr(e),r=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw new Error("More than one wildcard in sizes");if(i>=0){if(t%n!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-n);r[i]=-t/n}return r}function Dr(e){return e.reduce(((e,t)=>e*t),1)}function Fr(e,t){const n=t||vr(e);for(;Array.isArray(e)&&1===e.length;)e=e[0],n.shift();let r=n.length;for(;1===n[r-1];)r--;return r<n.length&&(e=Or(e,r,0),n.length=r),e}function Or(e,t,n){let r,i;if(n<t){const o=n+1;for(r=0,i=e.length;r<i;r++)e[r]=Or(e[r],t,o)}else for(;Array.isArray(e);)e=e[0];return e}function _r(e,t,n,r){const i=r||vr(e);if(n)for(let t=0;t<n;t++)e=[e],i.unshift(1);for(e=Ir(e,t,0);i.length<t;)i.push(1);return e}function Ir(e,t,n){let r,i;if(Array.isArray(e)){const o=n+1;for(r=0,i=e.length;r<i;r++)e[r]=Ir(e[r],t,o)}else for(let r=n;r<t;r++)e=[e];return e}function zr(e){if(!Array.isArray(e))return e;const t=[];return e.forEach((function e(n){Array.isArray(n)?n.forEach(e):t.push(n)})),t}function kr(e,t){return Array.prototype.map.call(e,t)}function Rr(e,t){Array.prototype.forEach.call(e,t)}function qr(e,t){if(1!==vr(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(e=>t.test(e)))}function Pr(e,t){return Array.prototype.join.call(e,t)}function jr(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];let n=0;t[0]={value:e[0],identifier:0};for(let r=1;r<e.length;r++)e[r]===e[r-1]?n++:n=0,t.push({value:e[r],identifier:n});return t}function Ur(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];for(let n=0;n<e.length;n++)t.push(e[n].value);return t}function Lr(e,t){let n,r=0;for(let i=0;i<e.length;i++){const o=e[i],a=Array.isArray(o);if(0===i&&a&&(r=o.length),a&&o.length!==r)return;const s=a?Lr(o,t):t(o);if(void 0===n)n=s;else if(n!==s)return"mixed"}return n}function $r(e,t,n,r){if(r<n){if(e.length!==t.length)throw new xr(e.length,t.length);const i=[];for(let o=0;o<e.length;o++)i[o]=$r(e[o],t[o],n,r+1);return i}return e.concat(t)}function Hr(){const e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce((function(e,n){return $r(e,n,t,0)}),e[0]);throw new Error("Wrong number of arguments in function concat")}function Gr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t.map((e=>e.length)),i=Math.max(...r),o=new Array(i).fill(null);for(let e=0;e<t.length;e++){const n=t[e],a=r[e];for(let e=0;e<a;e++){const t=i-a+e;n[e]>o[t]&&(o[t]=n[e])}}for(let e=0;e<t.length;e++)Vr(t[e],o);return o}function Vr(e,t){const n=t.length,r=e.length;for(let i=0;i<r;i++){const o=n-r+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw new Error(`shape missmatch: missmatch is found in arg with shape (${e}) not possible to broadcast dimension ${r} with size ${e[i]} to size ${t[o]}`)}}function Zr(e,t){let n=vr(e);if(ce(n,t))return e;Vr(n,t);const r=Gr(n,t),i=r.length,o=[...Array(i-n.length).fill(1),...n];let a=function(e){return sr([],e)}(e);n.length<i&&(a=Tr(a,o),n=vr(a));for(let e=0;e<i;e++)n[e]<r[e]&&(s=a,u=r[e],c=e,a=Hr(...Array(u).fill(s),c),n=vr(a));var s,u,c;return a}function Wr(e,t){if(!Array.isArray(e))throw new Error("Array expected");const n=vr(e);if(t.length!==n.length)throw new xr(t.length,n.length);for(let e=0;e<t.length;e++)Ar(t[e],n[e]);return t.reduce(((e,t)=>e[t]),e)}function Yr(e,t,n,r){return Array.isArray(e)?e.map((function(e,i){return Yr(e,t.concat(i),n,r)})):r(e,t,n)}function Jr(e,n,r){if(t.isTypedFunction(e)){const i=(n.isMatrix?n.size():vr(n)).map((()=>0)),o=n.isMatrix?n.get(i):Wr(n,i),a=1===Object.keys(e.signatures).length,s=function(e,n,r,i){const o=[n,r,i];for(let n=3;n>0;n--){const r=o.slice(0,n);if(null!==t.resolve(e,r))return n}}(e,o,i,n),u=a?Object.values(e.signatures)[0]:e;return s>=1&&s<=3?function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Xr(u,n.slice(0,s),r,e.name)}:function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Xr(u,n,r,e.name)}}return e}function Xr(e,t,n,r){try{return e(...t)}catch(e){!function(e,t,n,r){var i;if(e instanceof TypeError&&"wrongType"===(null===(i=e.data)||void 0===i?void 0:i.category)){const e=[];throw e.push(`value: ${oe(t[0])}`),t.length>=2&&e.push(`index: ${oe(t[1])}`),t.length>=3&&e.push(`array: ${oe(t[2])}`),new TypeError(`Function ${n} cannot apply callback arguments ${r}(${e.join(", ")}) at index ${JSON.stringify(t[1])}`)}throw new TypeError(`Function ${n} cannot apply callback arguments to function ${r}: ${e.message}`)}(e,t,n,r)}}xr.prototype=new RangeError,xr.prototype.constructor=RangeError,xr.prototype.name="DimensionError",xr.prototype.isDimensionError=!0,br.prototype=new RangeError,br.prototype.constructor=RangeError,br.prototype.name="IndexError",br.prototype.isIndexError=!0,n(3110);const Qr=he("DenseMatrix",["Matrix"],(e=>{let{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))"DenseMatrix"===e.type?(this._data=ae(e._data),this._size=ae(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,Nr(this._data,this._size),this._datatype=t||e.datatype;else if(N(e))this._data=s(e),this._size=vr(this._data),Nr(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t}}function r(e,t,n,i){const o=i===n-1,a=t.dimension(i);return o?a.map((function(t){return Ar(t,e.length),e[t]})).valueOf():a.map((function(o){return Ar(o,e.length),r(e[o],t,n,i+1)})).valueOf()}function i(e,t,n,r,o){const a=o===r-1,s=t.dimension(o);a?s.forEach((function(t,r){Ar(t),e[t]=n[r[0]]})):s.forEach((function(a,s){Ar(a),i(e[a],t,n[s[0]],r,o+1)}))}function o(e,t,n){if(0===t.length){let t=e._data;for(;N(t);)t=t[0];return t}return e._size=t.slice(0),e._data=Mr(e._data,e._size,n),e}function a(e,t,n){const r=e._size.slice(0);let i=!1;for(;r.length<t.length;)r.push(0),i=!0;for(let e=0,n=t.length;e<n;e++)t[e]>r[e]&&(r[e]=t[e],i=!0);i&&o(e,r,n)}function s(e){return E(e)?s(e.valueOf()):N(e)?e.map(s):e}return n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},Object.defineProperty(n,"name",{value:"DenseMatrix"}),n.prototype.constructor=n,n.prototype.type="DenseMatrix",n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Lr(this._data,oe)},n.prototype.storage=function(){return"dense"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,o){switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());{const i=t.size();if(i.length!==e._size.length)throw new xr(i.length,e._size.length);const o=t.min(),a=t.max();for(let t=0,n=e._size.length;t<n;t++)Ar(o[t],e._size[t]),Ar(a[t],e._size[t]);return new n(r(e._data,t,i.length,0),e._datatype)}}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const o=t.size(),s=t.isScalar();let u;if(E(n)?(u=n.size(),n=n.valueOf()):u=vr(n),s){if(0!==u.length)throw new TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(!ce(u,o))try{u=vr(n=0===u.length?Zr([n],o):Zr(n,o))}catch(e){}if(o.length<e._size.length)throw new xr(o.length,e._size.length,"<");if(u.length<o.length){let e=0,t=0;for(;1===o[e]&&1===u[e];)e++;for(;1===o[e];)t++,e++;n=_r(n,o.length,t,u)}if(!ce(o,u))throw new xr(o,u,">");a(e,t.max().map((function(e){return e+1})),r);const s=o.length,c=0;i(e._data,t,n,s,c)}return e}(this,e,t,o);default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.get=function(e){return Wr(this._data,e)},n.prototype.set=function(e,t,n){if(!N(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new xr(e.length,this._size.length,"<");let r,i,o;const s=e.map((function(e){return e+1}));a(this,s,n);let u=this._data;for(r=0,i=e.length-1;r<i;r++)o=e[r],Ar(o,u.length),u=u[o];return o=e[e.length-1],Ar(o,u.length),u[o]=t,this},n.prototype.resize=function(e,t,n){if(!A(e))throw new TypeError("Array or Matrix expected");const r=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));return o(n?this.clone():this,r,t)},n.prototype.reshape=function(e,t){const n=t?this.clone():this;n._data=Tr(n._data,e);const r=n._size.reduce(((e,t)=>e*t));return n._size=Br(e,r),n},n.prototype.clone=function(){return new n({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},n.prototype.size=function(){return this._size.slice(0)},n.prototype._forEach=function(e){const t=this,n=t.size();if(1===n.length){for(let r=0;r<n[0];r++)e(t._data,r,[r]);return}const r=Array(n.length).fill(0),i=Array(n.length-1),o=i.length-1;i[0]=t._data[0];for(let e=0;e<o;e++)i[e+1]=i[e][0];for(r[o]=-1;;){let a;for(a=o;a>=0;a--){if(r[a]++,r[a]!==n[a]){i[a]=0===a?t._data[r[a]]:i[a-1][r[a]];for(let e=a;e<o;e++)i[e+1]=i[e][0];for(let t=0;t<n[i.length];t++)r[i.length]=t,e(i[o],t,r.slice(0));break}r[a]=0}if(-1===a)break}},n.prototype.map=function(e){const t=this,r=new n(t),i=Jr(e,t._data,"map");return r._forEach((function(e,n,r){e[n]=i(e[n],r,t)})),r},n.prototype.forEach=function(e){const t=this,n=Jr(e,t._data,"map");t._forEach((function(e,r,i){n(e[r],i,t)}))},n.prototype[Symbol.iterator]=function*(){const e=function*(t,n){if(N(t))for(let r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){const e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");const t=this._data;for(const r of t)e.push(new n([r],this._datatype));return e},n.prototype.columns=function(){const e=[],t=this.size();if(2!==t.length)throw new TypeError("Rows can only be returned for a 2D matrix.");const r=this._data;for(let i=0;i<t[1];i++){const t=r.map((e=>[e[i]]));e.push(new n(t,this._datatype))}return e},n.prototype.toArray=function(){return ae(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return pr(this._data,e)},n.prototype.toString=function(){return pr(this._data)},n.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,r=e<0?-e:0,i=this._size[0],o=this._size[1],a=Math.min(i-r,o-t),s=[];for(let e=0;e<a;e++)s[e]=this._data[e+r][e+t];return new n({data:s,size:[a],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),r){if(g(r)&&(r=r.toNumber()),!d(r)||!ye(r))throw new TypeError("The parameter k must be an integer number")}else r=0;const o=r>0?r:0,a=r<0?-r:0,s=e[0],u=e[1],c=Math.min(s-a,u-o);let l;if(N(t)){if(t.length!==c)throw new Error("Invalid value array length");l=function(e){return t[e]}}else if(E(t)){const e=t.size();if(1!==e.length||e[0]!==c)throw new Error("Invalid matrix length");l=function(e){return t.get([e])}}else l=function(){return t};i||(i=g(l(0))?l(0).mul(0):0);let f=[];if(e.length>0){f=Mr(f,e,i);for(let e=0;e<c;e++)f[e+a][e+o]=l(e)}return new n({data:f,size:[s,u]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return Ar(e,this._size[0]),Ar(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){const r=n[e];n[e]=n[t],n[t]=r},n}),{isClass:!0}),Kr="clone",ei=he(Kr,["typed"],(e=>{let{typed:t}=e;return t(Kr,{any:ae})}));function ti(e){const t=e.length,n=e[0].length;let r,i;const o=[];for(i=0;i<n;i++){const n=[];for(r=0;r<t;r++)n.push(e[r][i]);o.push(n)}return o}function ni(e){for(let t=0;t<e.length;t++)if(A(e[t]))return!0;return!1}function ri(e,t){E(e)&&(e=e.valueOf());for(let n=0,r=e.length;n<r;n++){const r=e[n];Array.isArray(r)?ri(r,t):t(r)}}function ii(e,t,n){return e&&"function"==typeof e.map?e.map((function(e){return ii(e,t,n)})):t(e)}function oi(e,t,n){const r=Array.isArray(e)?vr(e):e.size();if(t<0||t>=r.length)throw new br(t,r.length);return E(e)?e.create(ai(e.valueOf(),t,n),e.datatype()):ai(e,t,n)}function ai(e,t,n){let r,i,o,a;if(t<=0){if(Array.isArray(e[0])){for(a=ti(e),i=[],r=0;r<a.length;r++)i[r]=ai(a[r],t-1,n);return i}for(o=e[0],r=1;r<e.length;r++)o=n(o,e[r]);return o}for(i=[],r=0;r<e.length;r++)i[r]=ai(e[r],t-1,n);return i}function si(e,t,n,r,i,o,a,s,u,c,l){const f=e._values,p=e._index,m=e._ptr;let h,d,g,y;if(r)for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],n[y]!==o?(n[y]=o,a.push(y),c?(r[y]=u?s(f[h],l):s(l,f[h]),i[y]=o):r[y]=f[h]):(r[y]=u?s(f[h],r[y]):s(r[y],f[h]),i[y]=o);else for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],n[y]!==o?(n[y]=o,a.push(y)):i[y]=o}const ui="isInteger",ci=he(ui,["typed"],(e=>{let{typed:t}=e;return t(ui,{number:ye,BigNumber:function(e){return e.isInt()},bigint:function(e){return!0},Fraction:function(e){return 1n===e.d},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})}));n(2577);const li="number";function fi(e){return e<0}function pi(e){return e>0}function mi(e){return Number.isNaN(e)}function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-9,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n<=0)throw new Error("Relative tolerance must be greater than 0");if(r<0)throw new Error("Absolute tolerance must be at least 0");return!e.isNaN()&&!t.isNaN()&&(e.isFinite()&&t.isFinite()?!!e.eq(t)||e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(n),r)):e.eq(t))}fi.signature=li,pi.signature=li,mi.signature=li;const di="isNegative",gi=he(di,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(di,{number:e=>!_e(e,0,n.relTol,n.absTol)&&fi(e),BigNumber:e=>!hi(e,new e.constructor(0),n.relTol,n.absTol)&&e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0n,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),yi="isNumeric",xi=he(yi,["typed"],(e=>{let{typed:t}=e;return t(yi,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),bi="hasNumericValue",vi=he(bi,["typed","isNumeric"],(e=>{let{typed:t,isNumeric:n}=e;return t(bi,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})})),wi="isPositive",Ni=he(wi,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(wi,{number:e=>!_e(e,0,n.relTol,n.absTol)&&pi(e),BigNumber:e=>!(hi(e,new e.constructor(0),n.relTol,n.absTol)||e.isNeg()||e.isZero()||e.isNaN()),bigint:e=>e>0n,Fraction:e=>e.s>0n&&e.n>0n,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ei="isZero",Ai=he(Ei,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(Ei,{"number | BigNumber | Complex | Fraction":e=>n(e,0),bigint:e=>0n===e,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Si="isNaN",Mi=he(Si,["typed"],(e=>{let{typed:t}=e;return t(Si,{number:mi,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":t.referToSelf((e=>t=>ii(t,e)))})})),Ci="typeOf",Ti=he(Ci,["typed"],(e=>{let{typed:t}=e;return t(Ci,{any:oe})})),Bi=he("compareUnits",["typed"],(e=>{let{typed:t}=e;return{"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return t.find(e,[n.valueType(),r.valueType()])(n.value,r.value)}))}})),Di="equalScalar",Fi=he(Di,["typed","config"],(e=>{let{typed:t,config:n}=e;const r=Bi({typed:t});return t(Di,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||hi(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e===t},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,n,r){return _e(e.re,t.re,n,r)&&_e(e.im,t.im,n,r)}(e,t,n.relTol,n.absTol)}},r)})),Oi=(he(Di,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(Di,{"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)}})})),he("SparseMatrix",["typed","equalScalar","Matrix"],(e=>{let{typed:t,equalScalar:n,Matrix:r}=e;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))!function(e,t,n){"SparseMatrix"===t.type?(e._values=t._values?ae(t._values):void 0,e._index=ae(t._index),e._ptr=ae(t._ptr),e._size=ae(t._size),e._datatype=n||t._datatype):o(e,t.valueOf(),n||t._datatype)}(this,e,t);else if(e&&N(e.index)&&N(e.ptr)&&N(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(N(e))o(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function o(e,r,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;const o=r.length;let a=0,s=n,u=0;if(w(i)&&(s=t.find(n,[i,i])||n,u=t.convert(0,i)),o>0){let t=0;do{e._ptr.push(e._index.length);for(let n=0;n<o;n++){const i=r[n];if(N(i)){if(0===t&&a<i.length&&(a=i.length),t<i.length){const r=i[t];s(r,u)||(e._values.push(r),e._index.push(n))}}else 0===t&&a<1&&(a=1),s(i,u)||(e._values.push(i),e._index.push(n))}t++}while(t<a)}e._ptr.push(e._index.length),e._size=[o,a]}function a(e,t,n,r){if(n-t==0)return n;for(let i=t;i<n;i++)if(r[i]===e)return i;return t}function s(e,t,n,r,i,o,a){i.splice(e,0,r),o.splice(e,0,t);for(let e=n+1;e<a.length;e++)a[e]++}function u(e,r,i,o){let a=o||0,s=n,u=0;w(e._datatype)&&(s=t.find(n,[e._datatype,e._datatype])||n,u=t.convert(0,e._datatype),a=t.convert(a,e._datatype));const c=!s(a,u),l=e._size[0];let f,p,m,h=e._size[1];if(i>h){for(p=h;p<i;p++)if(e._ptr[p]=e._values.length,c)for(f=0;f<l;f++)e._values.push(a),e._index.push(f);e._ptr[i]=e._values.length}else 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,r>l){if(c){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]+t,m=e._ptr[p+1]+t;let n=0;for(f=l;f<r;f++,n++)e._values.splice(m+n,0,a),e._index.splice(m+n,0,f),t++}e._ptr[h]=e._values.length}}else if(r<l){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]-t;const n=e._ptr[p],i=e._ptr[p+1]-t;for(m=n;m<i;m++)f=e._index[m],f>r-1&&(e._values.splice(m,1),e._index.splice(m,1),t++)}e._ptr[p]=e._values.length}return e._size[0]=r,e._size[1]=i,e}function c(e,t,n,r,i){const o=r[0],a=r[1],s=[];let u,c;for(u=0;u<o;u++)for(s[u]=[],c=0;c<a;c++)s[u][c]=0;for(c=0;c<a;c++){const r=n[c],o=n[c+1];for(let n=r;n<o;n++)u=t[n],s[u][c]=e?i?ae(e[n]):e[n]:1}return s}return i.prototype=new r,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Lr(this._values,oe)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){const e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,n){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());const n=t.size();if(n.length!==e._size.length)throw new xr(n.length,e._size.length);let r,o,a,s;const u=t.min(),c=t.max();for(r=0,o=e._size.length;r<o;r++)Ar(u[r],e._size[r]),Ar(c[r],e._size[r]);const l=e._values,f=e._index,p=e._ptr,m=t.dimension(0),h=t.dimension(1),d=[],g=[];m.forEach((function(e,t){g[e]=t[0],d[e]=!0}));const y=l?[]:void 0,x=[],b=[];return h.forEach((function(e){for(b.push(x.length),a=p[e],s=p[e+1];a<s;a++)r=f[a],!0===d[r]&&(x.push(g[r]),y&&y.push(l[a]))})),b.push(x.length),new i({values:y,index:x,ptr:b,size:n,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const i=t.size(),o=t.isScalar();let a;if(E(n)?(a=n.size(),n=n.toArray()):a=vr(n),o){if(0!==a.length)throw new TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(1!==i.length&&2!==i.length)throw new xr(i.length,e._size.length,"<");if(a.length<i.length){let e=0,t=0;for(;1===i[e]&&1===a[e];)e++;for(;1===i[e];)t++,e++;n=_r(n,i.length,t,a)}if(!ce(i,a))throw new xr(i,a,">");if(1===i.length)t.dimension(0).forEach((function(t,i){Ar(t),e.set([t,0],n[i[0]],r)}));else{const i=t.dimension(0),o=t.dimension(1);i.forEach((function(t,i){Ar(t),o.forEach((function(o,a){Ar(o),e.set([t,o],n[i[0]][a[0]],r)}))}))}}return e}(this,e,t,n);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new xr(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");const t=e[0],n=e[1];Ar(t,this._size[0]),Ar(n,this._size[1]);const r=a(t,this._ptr[n],this._ptr[n+1],this._index);return r<this._ptr[n+1]&&this._index[r]===t?this._values[r]:0},i.prototype.set=function(e,r,i){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new xr(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");const o=e[0],c=e[1];let l=this._size[0],f=this._size[1],p=n,m=0;w(this._datatype)&&(p=t.find(n,[this._datatype,this._datatype])||n,m=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(u(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),Ar(o,l),Ar(c,f);const h=a(o,this._ptr[c],this._ptr[c+1],this._index);return h<this._ptr[c+1]&&this._index[h]===o?p(r,m)?function(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(let e=t+1;e<i.length;e++)i[e]--}(h,c,this._values,this._index,this._ptr):this._values[h]=r:p(r,m)||s(h,o,c,r,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,n){if(!A(e))throw new TypeError("Array or Matrix expected");const r=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));if(2!==r.length)throw new Error("Only two dimensions matrix are supported");return r.forEach((function(e){if(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+pr(r)+")")})),u(n?this.clone():this,r[0],r[1],t)},i.prototype.reshape=function(e,t){if(!N(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");e.forEach((function(t){if(!d(t)||!ye(t)||t<=-2||0===t)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+pr(e)+")")}));const n=this._size[0]*this._size[1];if(n!==(e=Br(e,n))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");const r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;const i=[];for(let e=0;e<r._ptr.length;e++)for(let t=0;t<r._ptr[e+1]-r._ptr[e];t++)i.push(e);const o=r._values.slice(),u=r._index.slice();for(let t=0;t<r._index.length;t++){const n=u[t],o=i[t],a=n*r._size[1]+o;i[t]=a%e[1],u[t]=Math.floor(a/e[1])}r._values.length=0,r._index.length=0,r._ptr.length=e[1]+1,r._size=e.slice();for(let e=0;e<r._ptr.length;e++)r._ptr[e]=0;for(let e=0;e<o.length;e++){const t=u[e],n=i[e],c=o[e];s(a(t,r._ptr[n],r._ptr[n+1],r._index),t,n,c,r._values,r._index,r._ptr)}return r},i.prototype.clone=function(){return new i({values:this._values?ae(this._values):void 0,index:ae(this._index),ptr:ae(this._ptr),size:ae(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,r){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");const o=this,a=this._size[0],s=this._size[1],u=Jr(e,o,"map");return function(e,r,a,s,c,l,f){const p=[],m=[],h=[];let d=n,g=0;w(e._datatype)&&(d=t.find(n,[e._datatype,e._datatype])||n,g=t.convert(0,e._datatype));const y=function(e,t,n){const r=function(e,t,n){return u(e,[t,n],o)}(e,t,n);d(r,g)||(p.push(r),m.push(t))};for(let t=0;t<=c;t++){h.push(p.length);const n=e._ptr[t],r=e._ptr[t+1];if(f)for(let i=n;i<r;i++){const n=e._index[i];n>=0&&n<=a&&y(e._values[i],n-0,t-0)}else{const i={};for(let t=n;t<r;t++)i[e._index[t]]=e._values[t];for(let e=0;e<=a;e++)y(e in i?i[e]:0,e-0,t-0)}}return h.push(p.length),new i({values:p,index:m,ptr:h,size:[a-0+1,c-0+1]})}(this,0,a-1,0,s-1,0,r)},i.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");const n=this,r=this._size[0],i=this._size[1],o=Jr(e,n,"forEach");for(let e=0;e<i;e++){const i=this._ptr[e],a=this._ptr[e+1];if(t)for(let t=i;t<a;t++){const r=this._index[t];o(this._values[t],[r,e],n)}else{const t={};for(let e=i;e<a;e++)t[this._index[e]]=this._values[e];for(let i=0;i<r;i++)o(i in t?t[i]:0,[i,e],n)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");const e=this._size[1];for(let t=0;t<e;t++){const e=this._ptr[t],n=this._ptr[t+1];for(let r=e;r<n;r++){const e=this._index[r];yield{value:this._values[r],index:[e,t]}}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){const t=this._size[0],n=this._size[1],r=this.density();let i="Sparse Matrix ["+pr(t,e)+" x "+pr(n,e)+"] density: "+pr(r,e)+"\n";for(let t=0;t<n;t++){const n=this._ptr[t],r=this._ptr[t+1];for(let o=n;o<r;o++)i+="\n ("+pr(this._index[o],e)+", "+pr(t,e)+") ==> "+(this._values?pr(this._values[o],e):"X")}return i},i.prototype.toString=function(){return pr(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(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,n=e<0?-e:0,r=this._size[0],o=this._size[1],a=Math.min(r-n,o-t),s=[],u=[],c=[];c[0]=0;for(let e=t;e<o&&s.length<a;e++){const r=this._ptr[e],i=this._ptr[e+1];for(let o=r;o<i;o++){const r=this._index[o];if(r===e-t+n){s.push(this._values[o]),u[s.length-1]=r-n;break}}}return c.push(s.length),new i({values:s,index:u,ptr:c,size:[a,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,r,o,a,s){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),o){if(g(o)&&(o=o.toNumber()),!d(o)||!ye(o))throw new TypeError("The parameter k must be an integer number")}else o=0;let u=n,c=0;w(s)&&(u=t.find(n,[s,s])||n,c=t.convert(0,s));const l=o>0?o:0,f=o<0?-o:0,p=e[0],m=e[1],h=Math.min(p-f,m-l);let y;if(N(r)){if(r.length!==h)throw new Error("Invalid value array length");y=function(e){return r[e]}}else if(E(r)){const e=r.size();if(1!==e.length||e[0]!==h)throw new Error("Invalid matrix length");y=function(e){return r.get([e])}}else y=function(){return r};const x=[],b=[],v=[];for(let e=0;e<m;e++){v.push(x.length);const t=e-l;if(t>=0&&t<h){const e=y(t);u(e,c)||(b.push(t+f),x.push(e))}}return v.push(x.length),new i({values:x,index:b,ptr:v,size:[p,m]})},i.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return Ar(e,this._size[0]),Ar(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,n,r,i){const o=r[e],a=r[e+1];for(let e=o;e<a;e++)i(n[e],t[e])},i._swapRows=function(e,t,n,r,i,o){for(let s=0;s<n;s++){const n=o[s],u=o[s+1],c=a(e,n,u,i),l=a(t,n,u,i);if(c<u&&l<u&&i[c]===e&&i[l]===t){if(r){const e=r[c];r[c]=r[l],r[l]=e}}else if(c<u&&i[c]===e&&(l>=u||i[l]!==t)){const e=r?r[c]:void 0;i.splice(l,0,t),r&&r.splice(l,0,e),i.splice(l<=c?c+1:c,1),r&&r.splice(l<=c?c+1:c,1)}else if(l<u&&i[l]===t&&(c>=u||i[c]!==e)){const t=r?r[l]:void 0;i.splice(c,0,e),r&&r.splice(c,0,t),i.splice(c<=l?l+1:l,1),r&&r.splice(c<=l?l+1:l,1)}}},i}),{isClass:!0})),_i=he("number",["typed"],(e=>{let{typed:t}=e;const n=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;const t=function(e){const t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);return t?{input:e,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null}(e);if(t)return function(e){const t=parseInt(e.integerPart,e.radix);let n=0;for(let t=0;t<e.fractionalPart.length;t++)n+=parseInt(e.fractionalPart[t],e.radix)/Math.pow(e.radix,t+1);const r=t+n;if(isNaN(r))throw new SyntaxError('String "'+e.input+'" is not a valid number');return r}(t);let n=0;const r=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);r&&(n=Number(r[2]),e=r[1]);let i=Number(e);if(isNaN(i))throw new SyntaxError('String "'+e+'" is not a valid number');if(r){if(i>2**n-1)throw new SyntaxError(`String "${e}" is out of range`);i>=2**(n-1)&&(i-=2**n)}return i},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))});return n.fromJSON=function(e){return parseFloat(e.value)},n})),Ii=he("bigint",["typed"],(e=>{let{typed:t}=e;const n=t("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":t.referToSelf((e=>t=>ii(t,e)))});return n.fromJSON=function(e){return BigInt(e.value)},n})),zi="string",ki=he(zi,["typed"],(e=>{let{typed:t}=e;return t(zi,{"":function(){return""},number:Me,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e))),any:function(e){return String(e)}})})),Ri="boolean",qi=he(Ri,["typed"],(e=>{let{typed:t}=e;return t(Ri,{"":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){const t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;const n=Number(e);if(""!==e&&!isNaN(n))return!!n;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Pi=he("bignumber",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("bignumber",{"":function(){return new n(0)},number:function(e){return new n(e+"")},string:function(e){const t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){const r=t[2],i=n(t[1]),o=new n(2).pow(Number(r));if(i.gt(o.sub(1)))throw new SyntaxError(`String "${e}" is out of range`);const a=new n(2).pow(Number(r)-1);return i.gte(a)?i.sub(o):i}return new n(e)},BigNumber:function(e){return e},bigint:function(e){return new n(e.toString())},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),Fraction:function(e){return new n(String(e.n)).div(String(e.d)).times(String(e.s))},null:function(e){return new n(0)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ji=he("complex",["typed","Complex"],(e=>{let{typed:t,Complex:n}=e;return t("complex",{"":function(){return n.ZERO},number:function(e){return new n(e,0)},"number, number":function(e,t){return new n(e,t)},"BigNumber, BigNumber":function(e,t){return new n(e.toNumber(),t.toNumber())},Fraction:function(e){return new n(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return n(e)},null:function(e){return n(0)},Object:function(e){if("re"in e&&"im"in e)return new n(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new n(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ui=he("fraction",["typed","Fraction"],(e=>{let{typed:t,Fraction:n}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new n(e)},string:function(e){return new n(e)},"number, number":function(e,t){return new n(e,t)},"bigint, bigint":function(e,t){return new n(e,t)},null:function(e){return new n(0)},BigNumber:function(e){return new n(e.toString())},bigint:function(e){return new n(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),Object:function(e){return new n(e)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Li="matrix",$i=he(Li,["typed","Matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,Matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(Li,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,n){if("dense"===t||"default"===t||void 0===t)return new r(e,n);if("sparse"===t)return new i(e,n);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})),Hi="matrixFromFunction",Gi=he(Hi,["typed","matrix","isZero"],(e=>{let{typed:t,matrix:n,isZero:r}=e;return t(Hi,{"Array | Matrix, function, string, string":function(e,t,n,r){return i(e,t,n,r)},"Array | Matrix, function, string":function(e,t,n){return i(e,t,n)},"Matrix, function":function(e,t){return i(e,t,"dense")},"Array, function":function(e,t){return i(e,t,"dense").toArray()},"Array | Matrix, string, function":function(e,t,n){return i(e,n,t)},"Array | Matrix, string, string, function":function(e,t,n,r){return i(e,r,t,n)}});function i(e,t,i,o){let a;return a=void 0!==o?n(i,o):n(i),a.resize(e),a.forEach((function(e,n){const i=t(n);r(i)||a.set(n,i)})),a}})),Vi="matrixFromRows",Zi=he(Vi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:n,flatten:r,size:i}=e;return t(Vi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return n(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");const t=a(e[0]),n=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));n.push(r(i))}return n}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Wi="matrixFromColumns",Yi=he(Wi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:n,flatten:r,size:i}=e;return t(Wi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return n(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");const t=a(e[0]),n=[];for(let e=0;e<t;e++)n[e]=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));const o=r(i);for(let e=0;e<t;e++)n[e].push(o[e])}return n}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Ji="splitUnit",Xi=he(Ji,["typed"],(e=>{let{typed:t}=e;return t(Ji,{"Unit, Array":function(e,t){return e.splitUnit(t)}})})),Qi="number",Ki="number, number";function eo(e){return Math.abs(e)}function to(e,t){return e+t}function no(e,t){return e-t}function ro(e,t){return e*t}function io(e){return-e}function oo(e){return e}function ao(e){return Ee(e)}function so(e){return e*e*e}function uo(e){return Math.exp(e)}function co(e){return Ae(e)}function lo(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;let n;const r=e*t;for(;0!==t;)n=t,t=e%n,e=n;return Math.abs(r/e)}function fo(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function po(e){return we(e)}function mo(e){return ve(e)}function ho(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const n=t<0;if(n&&(t=-t),0===t)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return n?1/0:0;if(!isFinite(e))return n?0:e;let r=Math.pow(Math.abs(e),1/t);return r=e<0?-r:r,n?1/r:r}function go(e){return be(e)}function yo(e){return e*e}function xo(e,t){let n,r,i,o,a=0,s=1,u=1,c=0;if(!ye(e)||!ye(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)r=Math.floor(e/t),i=e-r*t,n=a,a=s-r*a,s=n,n=u,u=c-r*u,c=n,e=t,t=i;return o=e<0?[-e,-s,-c]:[e,e?s:0,c],o}function bo(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function vo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ye(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Be(e,t))}eo.signature=Qi,to.signature=Ki,no.signature=Ki,ro.signature=Ki,io.signature=Qi,oo.signature=Qi,ao.signature=Qi,so.signature=Qi,uo.signature=Qi,co.signature=Qi,lo.signature=Ki,po.signature=Qi,mo.signature=Qi,go.signature=Qi,yo.signature=Qi,xo.signature=Ki,bo.signature=Ki;const wo="unaryMinus",No=he(wo,["typed"],(e=>{let{typed:t}=e;return t(wo,{number:io,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:t.referToSelf((e=>n=>{const r=n.clone();return r.value=t.find(e,r.valueType())(n.value),r})),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0)))})})),Eo="unaryPlus",Ao=he(Eo,["typed","config","numeric"],(e=>{let{typed:t,config:n,numeric:r}=e;return t(Eo,{number:oo,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":t.referToSelf((e=>t=>ii(t,e,!0))),boolean:function(e){return r(e?1:0,n.number)},string:function(e){return r(e,xe(e,n))}})})),So=he("abs",["typed"],(e=>{let{typed:t}=e;return t("abs",{number:eo,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0)))})})),Mo="mapSlices",Co=he(Mo,["typed","isInteger"],(e=>{let{typed:t,isInteger:n}=e;return t(Mo,{"Array | Matrix, number | BigNumber, function":function(e,t,r){if(!n(t))throw new TypeError("Integer number expected for dimension");const i=Array.isArray(e)?vr(e):e.size();if(t<0||t>=i.length)throw new br(t,i.length);return E(e)?e.create(To(e.valueOf(),t,r),e.datatype()):To(e,t,r)}})}),{formerly:"apply"});function To(e,t,n){let r,i,o;if(t<=0){if(Array.isArray(e[0])){for(o=function(e){const t=e.length,n=e[0].length;let r,i;const o=[];for(i=0;i<n;i++){const n=[];for(r=0;r<t;r++)n.push(e[r][i]);o.push(n)}return o}(e),i=[],r=0;r<o.length;r++)i[r]=To(o[r],t-1,n);return i}return n(e)}for(i=[],r=0;r<e.length;r++)i[r]=To(e[r],t-1,n);return i}const Bo="addScalar",Do=he(Bo,["typed"],(e=>{let{typed:t}=e;return t(Bo,{"number, number":to,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"bigint, bigint":function(e,t){return e+t},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(null===n.value||void 0===n.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(r))throw new Error("Units do not match");const i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i}))})})),Fo="subtractScalar",Oo=he(Fo,["typed"],(e=>{let{typed:t}=e;return t(Fo,{"number, number":no,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"bigint, bigint":function(e,t){return e-t},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(null===n.value||void 0===n.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(r))throw new Error("Units do not match");const i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i}))})})),_o="cbrt",Io=he(_o,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],(e=>{let{config:t,typed:n,isNegative:r,unaryMinus:i,matrix:o,Complex:a,BigNumber:s,Fraction:u}=e;return n(_o,{number:ao,Complex:c,"Complex, boolean":c,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&x(e.value)){let t=e.clone();return t.value=1,t=t.pow(1/3),t.value=c(e.value),t}{const t=r(e.value);let n;t&&(e.value=i(e.value)),n=g(e.value)?new s(1).div(3):b(e.value)?new u(1,3):1/3;const o=e.pow(n);return t&&(o.value=i(o.value)),o}}});function c(e,n){const r=e.arg()/3,i=e.abs(),s=new a(ao(i),0).mul(new a(0,r).exp());if(n){const e=[s,new a(ao(i),0).mul(new a(0,r+2*Math.PI/3).exp()),new a(ao(i),0).mul(new a(0,r-2*Math.PI/3).exp())];return"Array"===t.matrix?e:o(e)}return s}})),zo=he("matAlgo11xS0s",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=n,d=0,g=i;"string"==typeof l&&(m=l,h=t.find(n,[m,m]),d=t.convert(0,m),r=t.convert(r,m),g=t.find(i,[m,m]));const y=[],x=[],b=[];for(let e=0;e<p;e++){b[e]=x.length;for(let t=u[e],n=u[e+1],i=t;i<n;i++){const e=s[i],t=o?g(r,a[i]):g(a[i],r);h(t,d)||(x.push(e),y.push(t))}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:m})}})),ko=he("matAlgo12xSfs",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,r=t.convert(r,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let n=u[e],r=u[e+1],i=n;i<r;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let n=0;n<f;n++)0===e&&(d[n]=[]),y[n]===t?d[n][e]=o?h(r,g[n]):h(g[n],r):d[n][e]=o?h(r,0):h(0,r)}return new n({data:d,size:[f,p],datatype:m})}})),Ro=he("matAlgo14xDs",["typed"],(e=>{let{typed:t}=e;return function(e,r,i,o){const a=e._data,s=e._size,u=e._datatype;let c,l=i;"string"==typeof u&&(c=u,r=t.convert(r,c),l=t.find(i,[c,c]));const f=s.length>0?n(l,0,s,s[0],a,r,o):[];return e.createDenseMatrix({data:f,size:ae(s),datatype:c})};function n(e,t,r,i,o,a,s){const u=[];if(t===r.length-1)for(let t=0;t<i;t++)u[t]=s?e(a,o[t]):e(o[t],a);else for(let c=0;c<i;c++)u[c]=n(e,t+1,r,r[t+1],o[c],a,s);return u}})),qo="ceil",Po=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],jo=new Fn(10),Uo=he(qo,["typed","config","round"],(e=>{let{typed:t,config:n,round:r}=e;function i(e){const t=Math.ceil(e),i=r(e);return t===i?t:_e(e,i,n.relTol,n.absTol)&&!_e(e,t,n.relTol,n.absTol)?i:t}return t(qo,{number:i,"number, number":function(e,t){if(!ye(t))throw new RangeError("number of decimals in function ceil must be an integer");if(t<0||t>15)throw new RangeError("number of decimals in ceil number must be in range 0-15");const n=10**t;return i(e*n)/n}})})),Lo=he(qo,Po,(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=zo({typed:t,equalScalar:o}),c=ko({typed:t,DenseMatrix:s}),l=Ro({typed:t}),f=Uo({typed:t,config:n,round:r});function p(e){const t=(e,t)=>hi(e,t,n.relTol,n.absTol),i=e.ceil(),o=r(e);return i.eq(o)?i:t(e,o)&&!t(e,i)?o:i}return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:p,"BigNumber, BigNumber":function(e,t){const n=jo.pow(t);return p(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>ii(t,(t=>e(t,n)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(i(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>o(t,0)?a(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),$o="cube",Ho=he($o,["typed"],(e=>{let{typed:t}=e;return t($o,{number:so,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)}})})),Go=he("exp",["typed"],(e=>{let{typed:t}=e;return t("exp",{number:uo,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),Vo="expm1",Zo=he(Vo,["typed","Complex"],(e=>{let{typed:t,Complex:n}=e;return t(Vo,{number:co,Complex:function(e){const t=Math.exp(e.re);return new n(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),Wo="fix",Yo=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],Jo=he(Wo,["typed","ceil","floor"],(e=>{let{typed:t,ceil:n,floor:r}=e;return t(Wo,{number:function(e){return e>0?r(e):n(e)},"number, number":function(e,t){return e>0?r(e,t):n(e,t)}})})),Xo=he(Wo,Yo,(e=>{let{typed:t,Complex:n,matrix:r,ceil:i,floor:o,equalScalar:a,zeros:s,DenseMatrix:u}=e;const c=ko({typed:t,DenseMatrix:u}),l=Ro({typed:t}),f=Jo({typed:t,ceil:i,floor:o});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new n(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,t){return new n(e.re>0?o(e.re,t):i(e.re,t),e.im>0?o(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){const r=t.toNumber();return new n(e.re>0?o(e.re,r):i(e.re,r),e.im>0?o(e.im,r):i(e.im,r))},BigNumber:function(e){return e.isNegative()?i(e):o(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):o(e,t)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.s<0n?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0n?i(e,t):o(e,t)},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array | Matrix, number | BigNumber":t.referToSelf((e=>(t,n)=>ii(t,(t=>e(t,n)),!0))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(r(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>a(t,0)?s(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),Qo="floor",Ko=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],ea=new Fn(10),ta=he(Qo,["typed","config","round"],(e=>{let{typed:t,config:n,round:r}=e;function i(e){const t=Math.floor(e),i=r(e);return t===i?t:_e(e,i,n.relTol,n.absTol)&&!_e(e,t,n.relTol,n.absTol)?i:t}return t(Qo,{number:i,"number, number":function(e,t){if(!ye(t))throw new RangeError("number of decimals in function floor must be an integer");if(t<0||t>15)throw new RangeError("number of decimals in floor number must be in range 0 - 15");const n=10**t;return i(e*n)/n}})})),na=he(Qo,Ko,(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=zo({typed:t,equalScalar:o}),c=ko({typed:t,DenseMatrix:s}),l=Ro({typed:t}),f=ta({typed:t,config:n,round:r});function p(e){const t=(e,t)=>hi(e,t,n.relTol,n.absTol),i=e.floor(),o=r(e);return i.eq(o)?i:t(e,o)&&!t(e,i)?o:i}return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:p,"BigNumber, BigNumber":function(e,t){const n=ea.pow(t);return p(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>ii(t,(t=>e(t,n)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(i(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>o(t,0)?a(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),ra=he("matAlgo02xDS0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i,o){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=r._values,l=r._index,f=r._ptr,p=r._size,m=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(s.length!==p.length)throw new xr(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const h=s[0],d=s[1];let g,y=n,x=0,b=i;"string"==typeof u&&u===m&&"mixed"!==u&&(g=u,y=t.find(n,[g,g]),x=t.convert(0,g),b=t.find(i,[g,g]));const v=[],w=[],N=[];for(let e=0;e<d;e++){N[e]=w.length;for(let t=f[e],n=f[e+1],r=t;r<n;r++){const t=l[r],n=o?b(c[r],a[t][e]):b(a[t][e],c[r]);y(n,x)||(w.push(t),v.push(n))}}return N[d]=w.length,r.createSparseMatrix({values:v,index:w,ptr:N,size:[h,d],datatype:u===e._datatype&&m===r._datatype?g:void 0})}})),ia=he("matAlgo03xDSf",["typed"],(e=>{let{typed:t}=e;return function(e,n,r,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._values,c=n._index,l=n._ptr,f=n._size,p=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==f.length)throw new xr(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1];let d,g=0,y=r;"string"==typeof s&&s===p&&"mixed"!==s&&(d=s,g=t.convert(0,d),y=t.find(r,[d,d]));const x=[];for(let e=0;e<m;e++)x[e]=[];const b=[],v=[];for(let e=0;e<h;e++){const t=e+1;for(let n=l[e],r=l[e+1],a=n;a<r;a++){const n=c[a];b[n]=i?y(u[a],o[n][e]):y(o[n][e],u[a]),v[n]=t}for(let n=0;n<m;n++)v[n]===t?x[n][e]=b[n]:x[n][e]=i?y(g,o[n][e]):y(o[n][e],g)}return e.createDenseMatrix({data:x,size:[m,h],datatype:s===e._datatype&&p===n._datatype?d:void 0})}})),oa=he("matAlgo05xSfSf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=w?[]:void 0,M=[],C=[];let T,B,D,F;for(B=0;B<g;B++){E[B]=N.length;const e=B+1;for(D=s[B],F=s[B+1];D<F;D++)T=a[D],N.push(T),M[T]=e,A&&(A[T]=o[D]);for(D=p[B],F=p[B+1];D<F;D++)T=f[D],M[T]!==e&&N.push(T),C[T]=e,S&&(S[T]=l[D]);if(w)for(D=E[B];D<N.length;){T=N[D];const t=M[T],n=C[T];if(t===e||n===e){const r=v(t===e?A[T]:b,n===e?S[T]:b);x(r,b)?N.splice(D,1):(w.push(r),D++)}}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),aa=he("matAlgo13xDD",["typed"],(e=>{let{typed:t}=e;return function(e,r,i){const o=e._data,a=e._size,s=e._datatype,u=r._data,c=r._size,l=r._datatype,f=[];if(a.length!==c.length)throw new xr(a.length,c.length);for(let e=0;e<a.length;e++){if(a[e]!==c[e])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");f[e]=a[e]}let p,m=i;"string"==typeof s&&s===l&&(p=s,m=t.find(i,[p,p]));const h=f.length>0?n(m,0,f,f[0],o,u):[];return e.createDenseMatrix({data:h,size:f,datatype:p})};function n(e,t,r,i,o,a){const s=[];if(t===r.length-1)for(let t=0;t<i;t++)s[t]=e(o[t],a[t]);else for(let u=0;u<i;u++)s[u]=n(e,t+1,r,r[t+1],o[u],a[u]);return s}}));function sa(e,t){if(ce(e.size(),t.size()))return[e,t];const n=Gr(e.size(),t.size());return[e,t].map((e=>function(e,t){return ce(e.size(),t)?e:e.create(Zr(e.valueOf(),t),e.datatype())}(e,n)))}const ua=he("matrixAlgorithmSuite",["typed","matrix"],(e=>{let{typed:t,matrix:n}=e;const r=aa({typed:t}),i=Ro({typed:t});return function(e){const o=e.elop,a=e.SD||e.DS;let s;o?(s={"DenseMatrix, DenseMatrix":(e,t)=>r(...sa(e,t),o),"Array, Array":(e,t)=>r(...sa(n(e),n(t)),o).valueOf(),"Array, DenseMatrix":(e,t)=>r(...sa(n(e),t),o),"DenseMatrix, Array":(e,t)=>r(...sa(e,n(t)),o)},e.SS&&(s["SparseMatrix, SparseMatrix"]=(t,n)=>e.SS(...sa(t,n),o,!1)),e.DS&&(s["DenseMatrix, SparseMatrix"]=(t,n)=>e.DS(...sa(t,n),o,!1),s["Array, SparseMatrix"]=(t,r)=>e.DS(...sa(n(t),r),o,!1)),a&&(s["SparseMatrix, DenseMatrix"]=(e,t)=>a(...sa(t,e),o,!0),s["SparseMatrix, Array"]=(e,t)=>a(...sa(n(t),e),o,!0))):(s={"DenseMatrix, DenseMatrix":t.referToSelf((e=>(t,n)=>r(...sa(t,n),e))),"Array, Array":t.referToSelf((e=>(t,i)=>r(...sa(n(t),n(i)),e).valueOf())),"Array, DenseMatrix":t.referToSelf((e=>(t,i)=>r(...sa(n(t),i),e))),"DenseMatrix, Array":t.referToSelf((e=>(t,i)=>r(...sa(t,n(i)),e)))},e.SS&&(s["SparseMatrix, SparseMatrix"]=t.referToSelf((t=>(n,r)=>e.SS(...sa(n,r),t,!1)))),e.DS&&(s["DenseMatrix, SparseMatrix"]=t.referToSelf((t=>(n,r)=>e.DS(...sa(n,r),t,!1))),s["Array, SparseMatrix"]=t.referToSelf((t=>(r,i)=>e.DS(...sa(n(r),i),t,!1)))),a&&(s["SparseMatrix, DenseMatrix"]=t.referToSelf((e=>(t,n)=>a(...sa(n,t),e,!0))),s["SparseMatrix, Array"]=t.referToSelf((e=>(t,r)=>a(...sa(n(r),t),e,!0)))));const u=e.scalar||"any";(e.Ds||e.Ss)&&(o?(s["DenseMatrix,"+u]=(e,t)=>i(e,t,o,!1),s[u+", DenseMatrix"]=(e,t)=>i(t,e,o,!0),s["Array,"+u]=(e,t)=>i(n(e),t,o,!1).valueOf(),s[u+", Array"]=(e,t)=>i(n(t),e,o,!0).valueOf()):(s["DenseMatrix,"+u]=t.referToSelf((e=>(t,n)=>i(t,n,e,!1))),s[u+", DenseMatrix"]=t.referToSelf((e=>(t,n)=>i(n,t,e,!0))),s["Array,"+u]=t.referToSelf((e=>(t,r)=>i(n(t),r,e,!1).valueOf())),s[u+", Array"]=t.referToSelf((e=>(t,r)=>i(n(r),t,e,!0).valueOf()))));const c=void 0!==e.sS?e.sS:e.Ss;return o?(e.Ss&&(s["SparseMatrix,"+u]=(t,n)=>e.Ss(t,n,o,!1)),c&&(s[u+", SparseMatrix"]=(e,t)=>c(t,e,o,!0))):(e.Ss&&(s["SparseMatrix,"+u]=t.referToSelf((t=>(n,r)=>e.Ss(n,r,t,!1)))),c&&(s[u+", SparseMatrix"]=t.referToSelf((e=>(t,n)=>c(n,t,e,!0))))),o&&o.signatures&&se(s,o.signatures),s}})),ca=he("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s,concat:u}=e;const c=na({typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}),l=ra({typed:t,equalScalar:o}),f=ia({typed:t}),p=oa({typed:t,equalScalar:o}),m=zo({typed:t,equalScalar:o}),h=ko({typed:t,DenseMatrix:s});return t("mod",{"number, number":function(e,t){return 0===t?e:e-t*c(e/t)},"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(c(e.div(t))))},"bigint, bigint":function(e,t){if(0n===t)return e;if(e<0){const n=e%t;return 0n===n?n:n+t}return e%t},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(c(e.div(t))))}},ua({typed:t,matrix:i,concat:u})({SS:p,DS:f,SD:l,Ss:m,sS:h}))})),la=he("matAlgo01xDSid",["typed"],(e=>{let{typed:t}=e;return function(e,n,r,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._values,c=n._index,l=n._ptr,f=n._size,p=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==f.length)throw new xr(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1],d="string"==typeof s&&"mixed"!==s&&s===p?s:void 0,g=d?t.find(r,[d,d]):r;let y,x;const b=[];for(y=0;y<m;y++)b[y]=[];const v=[],w=[];for(x=0;x<h;x++){const e=x+1;for(let t=l[x],n=l[x+1],r=t;r<n;r++)y=c[r],v[y]=i?g(u[r],o[y][x]):g(o[y][x],u[r]),w[y]=e;for(y=0;y<m;y++)w[y]===e?b[y][x]=v[y]:b[y][x]=o[y][x]}return e.createDenseMatrix({data:b,size:[m,h],datatype:s===e._datatype&&p===n._datatype?d:void 0})}})),fa=he("matAlgo04xSidSid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=o&&l?[]:void 0,S=o&&l?[]:void 0,M=[],C=[];let T,B,D,F,O;for(B=0;B<g;B++){E[B]=N.length;const e=B+1;for(F=s[B],O=s[B+1],D=F;D<O;D++)T=a[D],N.push(T),M[T]=e,A&&(A[T]=o[D]);for(F=p[B],O=p[B+1],D=F;D<O;D++)if(T=f[D],M[T]===e){if(A){const e=v(A[T],l[D]);x(e,b)?M[T]=null:A[T]=e}}else N.push(T),C[T]=e,S&&(S[T]=l[D]);if(A&&S)for(D=E[B];D<N.length;)T=N[D],M[T]===e?(w[D]=A[T],D++):C[T]===e?(w[D]=S[T],D++):N.splice(D,1)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),pa=he("matAlgo10xSids",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,r=t.convert(r,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let n=u[e],r=u[e+1],i=n;i<r;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let n=0;n<f;n++)0===e&&(d[n]=[]),y[n]===t?d[n][e]=o?h(r,g[n]):h(g[n],r):d[n][e]=r}return new n({data:d,size:[f,p],datatype:m})}}));function ma(e,t,n,r){if(!(this instanceof ma))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=n,this.max=r,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(null!=r?"-"+r:"")+" expected)",this.stack=(new Error).stack}ma.prototype=new Error,ma.prototype.constructor=Error,ma.prototype.name="ArgumentsError",ma.prototype.isArgumentsError=!0;const ha="number | BigNumber | Fraction | Matrix | Array",da=`${ha}, ${ha}, ...${ha}`;function ga(e){return!e.some((e=>Array.isArray(e)))}const ya=he("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,config:r,round:i,equalScalar:o,zeros:a,BigNumber:s,DenseMatrix:u,concat:c}=e;const l=ca({typed:t,config:r,round:i,matrix:n,equalScalar:o,zeros:a,DenseMatrix:u,concat:c}),f=la({typed:t}),p=fa({typed:t,equalScalar:o}),m=pa({typed:t,DenseMatrix:u});return t("gcd",{"number, number":function(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function gcd must be integer numbers");let n;for(;0!==t;)n=l(e,t),e=t,t=n;return e<0?-e:e},"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");const n=new s(0);for(;!t.isZero();){const n=l(e,t);e=t,t=n}return e.lt(n)?e.neg():e},"Fraction, Fraction":(e,t)=>e.gcd(t)},ua({typed:t,matrix:n,concat:c})({SS:p,DS:f,Ss:m}),{[da]:t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i})),Array:t.referToSelf((e=>t=>{if(1===t.length&&Array.isArray(t[0])&&ga(t[0]))return e(...t[0]);if(ga(t))return e(...t);throw new ma("gcd() supports only 1d matrices!")})),Matrix:t.referToSelf((e=>t=>e(t.toArray())))})})),xa=he("matAlgo06xS0S0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=r._values,c=r._size,l=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(a.length!==c.length)throw new xr(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");const f=a[0],p=a[1];let m,h=n,d=0,g=i;"string"==typeof s&&s===l&&"mixed"!==s&&(m=s,h=t.find(n,[m,m]),d=t.convert(0,m),g=t.find(i,[m,m]));const y=o&&u?[]:void 0,x=[],b=[],v=y?[]:void 0,w=[],N=[];for(let t=0;t<p;t++){b[t]=x.length;const n=t+1;if(si(e,t,w,v,N,n,x,g),si(r,t,w,v,N,n,x,g),v){let e=b[t];for(;e<x.length;){const t=x[e];if(N[t]===n){const n=v[t];h(n,d)?x.splice(e,1):(y.push(n),e++)}else x.splice(e,1)}}else{let e=b[t];for(;e<x.length;)N[x[e]]!==n?x.splice(e,1):e++}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:s===e._datatype&&l===r._datatype?m:void 0})}})),ba=he("lcm",["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,concat:i}=e;const o=ra({typed:t,equalScalar:r}),a=xa({typed:t,equalScalar:r}),s=zo({typed:t,equalScalar:r}),u=ua({typed:t,matrix:n,concat:i}),c="number | BigNumber | Fraction | Matrix | Array",l={};return l[`${c}, ${c}, ...${c}`]=t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i})),t("lcm",{"number, number":lo,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(t.isZero())return t;const n=e.times(t);for(;!t.isZero();){const n=t;t=e.mod(n),e=n}return n.div(e).abs()},"Fraction, Fraction":(e,t)=>e.lcm(t)},u({SS:a,DS:o,Ss:s}),l)}));function va(e,t,n,r){return function(i){if(i>0||n.predictable){if(i<=0)return NaN;const n=i.toString(16),r=n.substring(0,15);return e*(n.length-r.length)+t(Number("0x"+r))}return r(i.toNumber())}}const wa="log10",Na=["typed","config","Complex"],Ea=po(16),Aa=he(wa,Na,(e=>{let{typed:t,config:n,Complex:r}=e;function i(e){return e.log().div(Math.LN10)}function o(e){return i(new r(e,0))}return t(wa,{number:function(e){return e>=0||n.predictable?po(e):o(e)},bigint:va(Ea,po,n,o),Complex:i,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log():o(e.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Sa="log2",Ma=he(Sa,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;function i(e){return o(new r(e,0))}return t(Sa,{number:function(e){return e>=0||n.predictable?mo(e):i(e)},bigint:va(4,mo,n,i),Complex:o,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log(2):i(e.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))});function o(e){const t=Math.sqrt(e.re*e.re+e.im*e.im);return new r(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),Ca=he("multiplyScalar",["typed"],(e=>{let{typed:t}=e;return t("multiplyScalar",{"number, number":ro,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"bigint, bigint":function(e,t){return e*t},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})})),Ta="multiply",Ba=he(Ta,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(e=>{let{typed:t,matrix:n,addScalar:r,multiplyScalar:i,equalScalar:o,dot:a}=e;const s=zo({typed:t,equalScalar:o}),u=Ro({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}const l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._datatype||n.getDataType(),l=a[0],f=a[1];let p,m=r,h=i;s&&c&&s===c&&"string"==typeof s&&"mixed"!==s&&(p=s,m=t.find(r,[p,p]),h=t.find(i,[p,p]));const d=[];for(let e=0;e<l;e++){const t=o[e];let n=h(t[0],u[0]);for(let e=1;e<f;e++)n=m(n,h(t[e],u[e]));d[e]=n}return e.createDenseMatrix({data:d,size:[l],datatype:s===e._datatype&&c===n._datatype?p:void 0})},"SparseMatrix, any":function(e,n){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=n._data,f=n._datatype||n.getDataType(),p=e._size[0],m=n._size[0],h=[],d=[],g=[];let y,x=r,b=i,v=o,w=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.find(i,[y,y]),v=t.find(o,[y,y]),w=t.convert(0,y));const N=[],E=[];g[0]=0;for(let e=0;e<m;e++){const t=l[e];if(!v(t,w))for(let n=u[e],r=u[e+1],i=n;i<r;i++){const e=s[i];E[e]?N[e]=x(N[e],b(t,a[i])):(E[e]=!0,d.push(e),N[e]=b(t,a[i]))}}for(let e=d.length,t=0;t<e;t++){const e=d[t];h[t]=N[e]}return g[1]=d.length,e.createSparseMatrix({values:h,index:d,ptr:g,size:[p,1],datatype:c===e._datatype&&f===n._datatype?y:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._size,l=n._datatype||n.getDataType(),f=a[0],p=a[1],m=c[1];let h,d=r,g=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&"mixed"!==s&&(h=s,d=t.find(r,[h,h]),g=t.find(i,[h,h]));const y=[];for(let e=0;e<f;e++){const t=o[e];y[e]=[];for(let n=0;n<m;n++){let r=g(t[0],u[0][n]);for(let e=1;e<p;e++)r=d(r,g(t[e],u[e][n]));y[e][n]=r}}return e.createDenseMatrix({data:y,size:[f,m],datatype:s===e._datatype&&l===n._datatype?h:void 0})},"DenseMatrix, SparseMatrix":function(e,n){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=n._values,l=n._index,f=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");const h=s[0],d=p[1];let g,y=r,x=i,b=o,v=0;u&&m&&u===m&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(r,[g,g]),x=t.find(i,[g,g]),b=t.find(o,[g,g]),v=t.convert(0,g));const w=[],N=[],E=[],A=n.createSparseMatrix({values:w,index:N,ptr:E,size:[h,d],datatype:u===e._datatype&&m===n._datatype?g:void 0});for(let e=0;e<d;e++){E[e]=N.length;const t=f[e],n=f[e+1];if(n>t){let e=0;for(let r=0;r<h;r++){const i=r+1;let o;for(let s=t;s<n;s++){const t=l[s];e!==i?(o=x(a[r][t],c[s]),e=i):o=y(o,x(a[r][t],c[s]))}e!==i||b(o,v)||(N.push(r),w.push(o))}}}return E[d]=N.length,A},"SparseMatrix, DenseMatrix":function(e,n){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=n._data,f=n._datatype||n.getDataType(),p=e._size[0],m=n._size[0],h=n._size[1];let d,g=r,y=i,x=o,b=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(d=c,g=t.find(r,[d,d]),y=t.find(i,[d,d]),x=t.find(o,[d,d]),b=t.convert(0,d));const v=[],w=[],N=[],E=e.createSparseMatrix({values:v,index:w,ptr:N,size:[p,h],datatype:c===e._datatype&&f===n._datatype?d:void 0}),A=[],S=[];for(let e=0;e<h;e++){N[e]=w.length;const t=e+1;for(let n=0;n<m;n++){const r=l[n][e];if(!x(r,b))for(let e=u[n],i=u[n+1],o=e;o<i;o++){const e=s[o];S[e]!==t?(S[e]=t,w.push(e),A[e]=y(r,a[o])):A[e]=g(A[e],y(r,a[o]))}}for(let t=N[e],n=w.length,r=t;r<n;r++){const e=w[r];v[r]=A[e]}}return N[h]=w.length,E},"SparseMatrix, SparseMatrix":function(e,n){const o=e._values,a=e._index,s=e._ptr,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=n._values,l=n._index,f=n._ptr,p=n._datatype||void 0===n._data?n._datatype:n.getDataType(),m=e._size[0],h=n._size[1],d=o&&c;let g,y=r,x=i;u&&p&&u===p&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(r,[g,g]),x=t.find(i,[g,g]));const b=d?[]:void 0,v=[],w=[],N=e.createSparseMatrix({values:b,index:v,ptr:w,size:[m,h],datatype:u===e._datatype&&p===n._datatype?g:void 0}),E=d?[]:void 0,A=[];let S,M,C,T,B,D,F,O;for(let e=0;e<h;e++){w[e]=v.length;const t=e+1;for(B=f[e],D=f[e+1],T=B;T<D;T++)if(O=l[T],d)for(M=s[O],C=s[O+1],S=M;S<C;S++)F=a[S],A[F]!==t?(A[F]=t,v.push(F),E[F]=x(c[T],o[S])):E[F]=y(E[F],x(c[T],o[S]));else for(M=s[O],C=s[O+1],S=M;S<C;S++)F=a[S],A[F]!==t&&(A[F]=t,v.push(F));if(d)for(let t=w[e],n=v.length,r=t;r<n;r++){const e=v[r];b[r]=E[e]}}return w[h]=v.length,N}});return t(Ta,i,{"Array, Array":t.referTo("Matrix, Matrix",(e=>(t,r)=>{c(vr(t),vr(r));const i=e(n(t),n(r));return E(i)?i.valueOf():i})),"Matrix, Matrix":function(e,n){const o=e.size(),s=n.size();return c(o,s),1===o.length?1===s.length?function(e,t,n){if(0===n)throw new Error("Cannot multiply two empty vectors");return a(e,t)}(e,n,o[0]):function(e,n){if("dense"!==n.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._size,l=n._datatype||n.getDataType(),f=a[0],p=c[1];let m,h=r,d=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(m=s,h=t.find(r,[m,m]),d=t.find(i,[m,m]));const g=[];for(let e=0;e<p;e++){let t=d(o[0],u[0][e]);for(let n=1;n<f;n++)t=h(t,d(o[n],u[n][e]));g[e]=t}return e.createDenseMatrix({data:g,size:[p],datatype:s===e._datatype&&l===n._datatype?m:void 0})}(e,n)}(e,n):1===s.length?l(e,n):f(e,n)},"Matrix, Array":t.referTo("Matrix,Matrix",(e=>(t,r)=>e(t,n(r)))),"Array, Matrix":t.referToSelf((e=>(t,r)=>e(n(t,r.storage()),r))),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return u(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return u(t,e,i,!0)},"Array, any":function(e,t){return u(n(e),t,i,!1).valueOf()},"any, Array":function(e,t){return u(n(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i}))})})),Da="nthRoot",Fa=he(Da,["typed","matrix","equalScalar","BigNumber","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,BigNumber:i,concat:o}=e;const a=la({typed:t}),s=ra({typed:t,equalScalar:r}),u=xa({typed:t,equalScalar:r}),c=zo({typed:t,equalScalar:r}),l=ua({typed:t,matrix:n,concat:o});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(Da,{number:ho,"number, number":ho,BigNumber:e=>p(e,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:t.referTo("DenseMatrix,number",(e=>t=>e(n(t),2).valueOf())),DenseMatrix:t.referTo("DenseMatrix,number",(e=>t=>e(t,2))),SparseMatrix:t.referTo("SparseMatrix,number",(e=>t=>e(t,2))),"SparseMatrix, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return u(t,n,e);throw new Error("Root must be non-zero")})),"DenseMatrix, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return a(t,n,e,!1);throw new Error("Root must be non-zero")})),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",(e=>(t,r)=>e(n(t),r))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return c(n,t,e,!0);throw new Error("Root must be non-zero")}))},l({scalar:"number | BigNumber",SD:s,Ss:c,sS:!1}));function p(e,t){const n=i.precision,r=i.clone({precision:n+2}),o=new i(0),a=new r(1),s=t.isNegative();if(s&&(t=t.neg()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return s?new r(1/0):0;if(!e.isFinite())return s?o:e;let u=e.abs().pow(a.div(t));return u=e.isNeg()?u.neg():u,new i((s?a.div(u):u).toPrecision(n))}})),Oa="sign",_a=he(Oa,["typed","BigNumber","Fraction","complex"],(e=>{let{typed:t,BigNumber:n,complex:r,Fraction:i}=e;return t(Oa,{number:go,Complex:function(e){return 0===e.im?r(go(e.re)):e.sign()},BigNumber:function(e){return new n(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return new i(e.s)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),Unit:t.referToSelf((e=>n=>{if(!n._isDerived()&&0!==n.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return t.find(e,n.valueType())(n.value)}))})})),Ia=he("sqrt",["config","typed","Complex"],(e=>{let{config:t,typed:n,Complex:r}=e;return n("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new r(e,0).sqrt()}})),za="square",ka=he(za,["typed"],(e=>{let{typed:t}=e;return t(za,{number:yo,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)}})})),Ra="subtract",qa=he(Ra,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,subtractScalar:i,unaryMinus:o,DenseMatrix:a,concat:s}=e;const u=la({typed:t}),c=ia({typed:t}),l=oa({typed:t,equalScalar:r}),f=pa({typed:t,DenseMatrix:a}),p=ko({typed:t,DenseMatrix:a}),m=ua({typed:t,matrix:n,concat:s});return t(Ra,{"any, any":i},m({elop:i,SS:l,DS:u,SD:c,Ss:p,sS:f}))})),Pa="xgcd",ja=he(Pa,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(Pa,{"number, number":function(e,t){const i=xo(e,t);return"Array"===n.matrix?i:r(i)},"BigNumber, BigNumber":function(e,t){let o,a,s;const u=new i(0),c=new i(1);let l,f=u,p=c,m=c,h=u;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)a=e.div(t).floor(),s=e.mod(t),o=f,f=p.minus(a.times(f)),p=o,o=m,m=h.minus(a.times(m)),h=o,e=t,t=s;return l=e.lt(u)?[e.neg(),p.neg(),h.neg()]:[e,e.isZero()?0:p,h],"Array"===n.matrix?l:r(l)}})})),Ua="invmod",La=he(Ua,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(e=>{let{typed:t,config:n,BigNumber:r,xgcd:i,equal:o,smaller:a,mod:s,add:u,isInteger:c}=e;return t(Ua,{"number, number":l,"BigNumber, BigNumber":l});function l(e,t){if(!c(e)||!c(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=s(e,t),o(t,0))throw new Error("Divisor must be non zero");let n=i(e,t);n=n.valueOf();let[l,f]=n;return o(l,r(1))?(f=s(f,t),a(f,r(0))&&(f=u(f,t)),f):NaN}})),$a=he("matAlgo09xS0Sf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=[];let M,C,T,B,D;for(C=0;C<g;C++){E[C]=N.length;const e=C+1;if(A)for(B=p[C],D=p[C+1],T=B;T<D;T++)M=f[T],S[M]=e,A[M]=l[T];for(B=s[C],D=s[C+1],T=B;T<D;T++)if(M=a[T],A){const t=S[M]===e?A[M]:b,n=v(o[T],t);x(n,b)||(N.push(M),w.push(n))}else N.push(M)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),Ha="dotMultiply",Ga=he(Ha,["typed","matrix","equalScalar","multiplyScalar","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,multiplyScalar:i,concat:o}=e;const a=ra({typed:t,equalScalar:r}),s=$a({typed:t,equalScalar:r}),u=zo({typed:t,equalScalar:r}),c=ua({typed:t,matrix:n,concat:o});return t(Ha,c({elop:i,SS:s,DS:a,Ss:u}))}));function Va(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new n(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new n(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new n(0):e}return Ya(e,t,(function(e,t){return e&t}))}function Za(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");const t=e.constructor,n=t.precision;t.config({precision:1e9});const r=e.plus(new t(1));return r.s=-r.s||null,t.config({precision:n}),r}function Wa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);const r=new n(-1);return e.isZero()||t.eq(r)||e.eq(t)?t:t.isZero()||e.eq(r)?e:e.isFinite()&&t.isFinite()?Ya(e,t,(function(e,t){return e|t})):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?r:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function Ya(e,t,n){const r=e.constructor;let i,o;const a=+(e.s<0),s=+(t.s<0);if(a){i=Ja(Za(e));for(let e=0;e<i.length;++e)i[e]^=1}else i=Ja(e);if(s){o=Ja(Za(t));for(let e=0;e<o.length;++e)o[e]^=1}else o=Ja(t);let u,c,l;i.length<=o.length?(u=i,c=o,l=a):(u=o,c=i,l=s);let f=u.length,p=c.length;const m=1^n(a,s);let h=new r(1^m),d=new r(1);const g=new r(2),y=r.precision;for(r.config({precision:1e9});f>0;)n(u[--f],c[--p])===m&&(h=h.plus(d)),d=d.times(g);for(;p>0;)n(l,c[--p])===m&&(h=h.plus(d)),d=d.times(g);return r.config({precision:y}),0===m&&(h.s=-h.s),h}function Ja(e){const t=e.d;let n=t[0]+"";for(let e=1;e<t.length;++e){let r=t[e]+"";for(let e=7-r.length;e--;)r="0"+r;n+=r}let r=n.length;for(;"0"===n.charAt(r);)r--;let i=e.e,o=n.slice(0,r+1||1);const a=o.length;if(i>0)if(++i>a)for(i-=a;i--;)o+="0";else i<a&&(o=o.slice(0,i)+"."+o.slice(i));const s=[0];for(let e=0;e<o.length;){let t=s.length;for(;t--;)s[t]*=10;s[0]+=parseInt(o.charAt(e++));for(let e=0;e<s.length;++e)s[e]>1&&(null!==s[e+1]&&void 0!==s[e+1]||(s[e+1]=0),s[e+1]+=s[e]>>1,s[e]&=1)}return s.reverse()}function Xa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new n(0);const r=new n(-1);return e.eq(r)?Za(t):t.eq(r)?Za(e):e.isFinite()&&t.isFinite()?Ya(e,t,(function(e,t){return e^t})):e.isFinite()||t.isFinite()?new n(e.isNegative()===t.isNegative()?1/0:-1/0):r}function Qa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");const n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new n(2).pow(t)):new n(NaN)}function Ka(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");const n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new n(2).pow(t)).floor():e.isNegative()?new n(-1):e.isFinite()?new n(0):new n(NaN)}const es="number, number";function ts(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitAnd");return e&t}function ns(e){if(!ye(e))throw new Error("Integer expected in function bitNot");return~e}function rs(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitOr");return e|t}function is(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitXor");return e^t}function os(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function leftShift");return e<<t}function as(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightArithShift");return e>>t}function ss(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}ts.signature=es,ns.signature="number",rs.signature=es,is.signature=es,os.signature=es,as.signature=es,ss.signature=es;const us="bitAnd",cs=he(us,["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,concat:i}=e;const o=ra({typed:t,equalScalar:r}),a=xa({typed:t,equalScalar:r}),s=zo({typed:t,equalScalar:r}),u=ua({typed:t,matrix:n,concat:i});return t(us,{"number, number":ts,"BigNumber, BigNumber":Va,"bigint, bigint":(e,t)=>e&t},u({SS:a,DS:o,Ss:s}))})),ls="bitNot",fs=he(ls,["typed"],(e=>{let{typed:t}=e;return t(ls,{number:ns,BigNumber:Za,bigint:e=>~e,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ps="bitOr",ms=he(ps,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=la({typed:t}),s=fa({typed:t,equalScalar:r}),u=pa({typed:t,DenseMatrix:i}),c=ua({typed:t,matrix:n,concat:o});return t(ps,{"number, number":rs,"BigNumber, BigNumber":Wa,"bigint, bigint":(e,t)=>e|t},c({SS:s,DS:a,Ss:u}))})),hs=he("matAlgo07xSSf",["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:n}=e;return function(e,i,o){const a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=i._size,c=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(a.length!==u.length)throw new xr(a.length,u.length);if(a[0]!==u[0]||a[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+u+")");const l=a[0],f=a[1];let p,m=0,h=o;"string"==typeof s&&s===c&&"mixed"!==s&&(p=s,m=t.convert(0,p),h=t.find(o,[p,p]));const d=[],g=[],y=new Array(f+1).fill(0),x=[],b=[],v=[],w=[];for(let t=0;t<f;t++){const n=t+1;let o=0;r(e,t,v,x,n),r(i,t,w,b,n);for(let e=0;e<l;e++){const t=h(v[e]===n?x[e]:m,w[e]===n?b[e]:m);0!==t&&!1!==t&&(g.push(e),d.push(t),o++)}y[t+1]=y[t]+o}return new n({values:d,index:g,ptr:y,size:[l,f],datatype:s===e._datatype&&c===i._datatype?p:void 0})};function r(e,t,n,r,i){const o=e._values,a=e._index,s=e._ptr;for(let e=s[t],u=s[t+1];e<u;e++){const t=a[e];n[t]=i,r[t]=o[e]}}})),ds="bitXor",gs=he(ds,["typed","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:o}=e;const a=ia({typed:t}),s=hs({typed:t,SparseMatrix:o}),u=ko({typed:t,DenseMatrix:r}),c=ua({typed:t,matrix:n,concat:i});return t(ds,{"number, number":is,"BigNumber, BigNumber":Xa,"bigint, bigint":(e,t)=>e^t},c({SS:s,DS:a,Ss:u}))})),ys=he("arg",["typed"],(e=>{let{typed:t}=e;return t("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":t.referToSelf((e=>t=>ii(t,e)))})})),xs="conj",bs=he(xs,["typed"],(e=>{let{typed:t}=e;return t(xs,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),vs=he("im",["typed"],(e=>{let{typed:t}=e;return t("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ws=he("re",["typed"],(e=>{let{typed:t}=e;return t("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ns="number, number";function Es(e){return!e}function As(e,t){return!(!e&&!t)}function Ss(e,t){return!!e!=!!t}function Ms(e,t){return!(!e||!t)}Es.signature="number",As.signature=Ns,Ss.signature=Ns,Ms.signature=Ns;const Cs=he("not",["typed"],(e=>{let{typed:t}=e;return t("not",{"null | undefined":()=>!0,number:Es,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ts=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=ia({typed:t}),s=oa({typed:t,equalScalar:r}),u=ko({typed:t,DenseMatrix:i}),c=ua({typed:t,matrix:n,concat:o});return t("or",{"number, number":As,"Complex, Complex":function(e,t){return 0!==e.re||0!==e.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"bigint, bigint":As,"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0)))},c({SS:s,DS:a,Ss:u}))})),Bs=he("xor",["typed","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:o}=e;const a=ia({typed:t}),s=hs({typed:t,SparseMatrix:o}),u=ko({typed:t,DenseMatrix:r}),c=ua({typed:t,matrix:n,concat:i});return t("xor",{"number, number":Ss,"Complex, Complex":function(e,t){return(0!==e.re||0!==e.im)!=(0!==t.re||0!==t.im)},"bigint, bigint":Ss,"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0)))},c({SS:s,DS:a,Ss:u}))})),Ds="concat",Fs=he(Ds,["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:n,isInteger:r}=e;return t(Ds,{"...Array | Matrix | number | BigNumber":function(e){let t;const i=e.length;let o,a=-1,s=!1;const u=[];for(t=0;t<i;t++){const n=e[t];if(E(n)&&(s=!0),d(n)||g(n)){if(t!==i-1)throw new Error("Dimension must be specified as last argument");if(o=a,a=n.valueOf(),!r(a))throw new TypeError("Integer number expected for dimension");if(a<0||t>0&&a>o)throw new br(a,o+1)}else{const e=ae(n).valueOf(),r=vr(e);if(u[t]=e,o=a,a=r.length-1,t>0&&a!==o)throw new xr(o+1,a+1)}}if(0===u.length)throw new SyntaxError("At least one matrix expected");let c=u.shift();for(;u.length;)c=Hr(c,u.shift(),a);return s?n(c):c},"...string":function(e){return e.join("")}})})),Os="column",_s=he(Os,["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;return t(Os,{"Matrix, number":o,"Array, number":function(e,t){return o(r(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Ar(t,e.size()[1]);const o=i(0,e.size()[0]),a=new n(o,t),s=e.subset(a);return E(s)?s:r([[s]])}})),Is="count",zs=he(Is,["typed","size","prod"],(e=>{let{typed:t,size:n,prod:r}=e;return t(Is,{string:function(e){return e.length},"Matrix | Array":function(e){return r(n(e))}})})),ks="cross",Rs=he(ks,["typed","matrix","subtract","multiply"],(e=>{let{typed:t,matrix:n,subtract:r,multiply:i}=e;return t(ks,{"Matrix, Matrix":function(e,t){return n(o(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(o(e.toArray(),t))},"Array, Matrix":function(e,t){return n(o(e,t.toArray()))},"Array, Array":o});function o(e,t){const n=Math.max(vr(e).length,vr(t).length);e=Fr(e),t=Fr(t);const o=vr(e),a=vr(t);if(1!==o.length||1!==a.length||3!==o[0]||3!==a[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+a.join(", ")+"])");const s=[r(i(e[1],t[2]),i(e[2],t[1])),r(i(e[2],t[0]),i(e[0],t[2])),r(i(e[0],t[1]),i(e[1],t[0]))];return n>1?[s]:s}})),qs="diag",Ps=he(qs,["typed","matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(qs,{Array:function(e){return o(e,0,vr(e),null)},"Array, number":function(e,t){return o(e,t,vr(e),null)},"Array, BigNumber":function(e,t){return o(e,t.toNumber(),vr(e),null)},"Array, string":function(e,t){return o(e,0,vr(e),t)},"Array, number, string":function(e,t,n){return o(e,t,vr(e),n)},"Array, BigNumber, string":function(e,t,n){return o(e,t.toNumber(),vr(e),n)},Matrix:function(e){return o(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return o(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return o(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return o(e,0,e.size(),t)},"Matrix, number, string":function(e,t,n){return o(e,t,e.size(),n)},"Matrix, BigNumber, string":function(e,t,n){return o(e,t.toNumber(),e.size(),n)}});function o(e,t,o,a){if(!ye(t))throw new TypeError("Second parameter in function diag must be an integer");const s=t>0?t:0,u=t<0?-t:0;switch(o.length){case 1:return function(e,t,n,o,a,s){const u=[o+a,o+s];if(n&&"sparse"!==n&&"dense"!==n)throw new TypeError(`Unknown matrix type ${n}"`);const c="sparse"===n?i.diagonal(u,e,t):r.diagonal(u,e,t);return null!==n?c:c.valueOf()}(e,t,a,o[0],u,s);case 2:return function(e,t,r,i,o,a){if(E(e)){const i=e.diagonal(t);return null!==r?r!==i.storage()?n(i,r):i:i.valueOf()}const s=Math.min(i[0]-o,i[1]-a),u=[];for(let t=0;t<s;t++)u[t]=e[t+o][t+a];return null!==r?n(u):u}(e,t,a,o,u,s)}throw new RangeError("Matrix for function diag must be 2 dimensional")}})),js=he("filter",["typed"],(e=>{let{typed:t}=e;return t("filter",{"Array, function":Us,"Matrix, function":function(e,t){return e.create(Us(e.valueOf(),t),e.datatype())},"Array, RegExp":qr,"Matrix, RegExp":function(e,t){return e.create(qr(e.valueOf(),t),e.datatype())}})}));function Us(e,t){const n=Jr(t,e,"filter");return function(e){if(1!==vr(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(function(e,t,r){return n(e,[t],r)}))}(e)}const Ls="flatten",$s=he(Ls,["typed"],(e=>{let{typed:t}=e;return t(Ls,{Array:function(e){return zr(e)},Matrix:function(e){return e.create(zr(e.toArray()),e.datatype())}})})),Hs="forEach",Gs=he(Hs,["typed"],(e=>{let{typed:t}=e;return t(Hs,{"Array, function":Vs,"Matrix, function":function(e,t){e.forEach(t)}})}));function Vs(e,t){Yr(e,[],e,Jr(t,e,Hs))}const Zs="getMatrixDataType",Ws=he(Zs,["typed"],(e=>{let{typed:t}=e;return t(Zs,{Array:function(e){return Lr(e,oe)},Matrix:function(e){return e.getDataType()}})})),Ys="identity",Js=he(Ys,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i,DenseMatrix:o,SparseMatrix:a}=e;return t(Ys,{"":function(){return"Matrix"===n.matrix?r([]):[]},string:function(e){return r(e)},"number | BigNumber":function(e){return u(e,e,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return u(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return u(e,t,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,n){return u(e,t,n)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?r(t):[];case 1:return u(e[0],e[0],t);case 2:return u(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function u(e,t,n){const r=g(e)||g(t)?i:null;if(g(e)&&(e=e.toNumber()),g(t)&&(t=t.toNumber()),!ye(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!ye(t)||t<1)throw new Error("Parameters in function identity must be positive integers");const s=r?new i(1):1,u=r?new r(0):0,c=[e,t];if(n){if("sparse"===n)return a.diagonal(c,s,0,u);if("dense"===n)return o.diagonal(c,s,0,u);throw new TypeError(`Unknown matrix type "${n}"`)}const l=Mr([],c,u),f=e<t?e:t;for(let e=0;e<f;e++)l[e][e]=s;return l}})),Xs="kron",Qs=he(Xs,["typed","matrix","multiplyScalar"],(e=>{let{typed:t,matrix:n,multiplyScalar:r}=e;return t(Xs,{"Matrix, Matrix":function(e,t){return n(i(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(i(e.toArray(),t))},"Array, Matrix":function(e,t){return n(i(e,t.toArray()))},"Array, Array":i});function i(e,t){if(1===vr(e).length&&(e=[e]),1===vr(t).length&&(t=[t]),vr(e).length>2||vr(t).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(t.length)+")");const n=[];let i=[];return e.map((function(e){return t.map((function(t){return i=[],n.push(i),e.map((function(e){return t.map((function(t){return i.push(r(e,t))}))}))}))}))&&n}})),Ks="map",eu=he(Ks,["typed"],(e=>{let{typed:t}=e;return t(Ks,{"Array, function":n,"Matrix, function":function(e,t){return e.map(t)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,r,i)=>function(e,r){if("function"!=typeof r)throw new Error("Last argument must be a callback function");const i=e[0].isMatrix,o=Gr(...e.map((e=>e.isMatrix?e.size():vr(e)))),a=i?(e,t)=>e.get(t):Wr,s=i?e.map((t=>t.isMatrix?t.create(Zr(t.toArray(),o),t.datatype()):e[0].create(Zr(t.valueOf(),o)))):e.map((e=>e.isMatrix?Zr(e.toArray(),o):Zr(e,o)));let u;if(t.isTypedFunction(r)){const e=o.map((()=>0)),n=s.map((t=>a(t,e))),i=function(e,n,r,i){return null!==t.resolve(e,[...n,r,...i])?2:null!==t.resolve(e,[...n,r])?1:(t.resolve(e,n),0)}(r,n,e,s);u=l(i)}else{const t=e.length,n=function(e,t){return e.length>t+1?2:e.length===t+1?1:0}(r,t);u=l(n)}const c=(e,t)=>u([e,...s.slice(1).map((e=>a(e,t)))],t);return i?s[0].map(c):n(s[0],c);function l(e){switch(e){case 0:return e=>r(...e);case 1:return(e,t)=>r(...e,t);case 2:return(e,t)=>r(...e,t,...s)}}}([e,r,...i.slice(0,i.length-1)],i[i.length-1])});function n(e,t){return Yr(e,[],e,Jr(t,e,Ks))}})),tu="diff",nu=he(tu,["typed","matrix","subtract","number"],(e=>{let{typed:t,matrix:n,subtract:r,number:i}=e;return t(tu,{"Array | Matrix":function(e){return E(e)?n(a(e.toArray())):a(e)},"Array | Matrix, number":function(e,t){if(!ye(t))throw new RangeError("Dimension must be a whole number");return E(e)?n(o(e.toArray(),t)):o(e,t)},"Array, BigNumber":t.referTo("Array,number",(e=>(t,n)=>e(t,i(n)))),"Matrix, BigNumber":t.referTo("Matrix,number",(e=>(t,n)=>e(t,i(n))))});function o(e,t){if(E(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){const n=[];return e.forEach((e=>{n.push(o(e,t-1))})),n}if(0===t)return a(e);throw RangeError("Cannot have negative dimension")}function a(e){const t=[],n=e.length;for(let r=1;r<n;r++)t.push(s(e[r-1],e[r]));return t}function s(e,t){E(e)&&(e=e.toArray()),E(t)&&(t=t.toArray());const n=Array.isArray(e),i=Array.isArray(t);if(n&&i)return function(e,t){if(e.length!==t.length)throw RangeError("Not all sub-arrays have the same length");const n=[],r=e.length;for(let i=0;i<r;i++)n.push(s(e[i],t[i]));return n}(e,t);if(!n&&!i)return r(t,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}})),ru=he("ones",["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t("ones",{"":function(){return"Array"===n.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===n.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const n=function(e){let t=!1;return e.forEach((function(e,n,r){g(e)&&(t=!0,r[n]=e.toNumber())})),t}(e),o=n?new i(1):1;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}))}(e),t){const n=r(t);return e.length>0?n.resize(e,o):n}{const t=[];return e.length>0?Mr(t,e,o):t}}}));function iu(){throw new Error('No "bignumber" implementation available')}function ou(){throw new Error('No "fraction" implementation available')}function au(){throw new Error('No "matrix" implementation available')}const su="range",uu=he(su,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;return t(su,{string:p,"string, boolean":p,number:function(e){throw new TypeError(`Too few arguments to function range(): ${e}`)},boolean:function(e){throw new TypeError(`Unexpected type of argument 1 to function range(): ${e}, number|bigint|BigNumber|Fraction`)},"number, number":function(e,t){return f(m(e,t,1,!1))},"number, number, number":function(e,t,n){return f(m(e,t,n,!1))},"number, number, boolean":function(e,t,n){return f(m(e,t,1,n))},"number, number, number, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"bigint, bigint|number":function(e,t){return f(m(e,t,1n,!1))},"number, bigint":function(e,t){return f(m(BigInt(e),t,1n,!1))},"bigint, bigint|number, bigint|number":function(e,t,n){return f(m(e,t,BigInt(n),!1))},"number, bigint, bigint|number":function(e,t,n){return f(m(BigInt(e),t,BigInt(n),!1))},"bigint, bigint|number, boolean":function(e,t,n){return f(m(e,t,1n,n))},"number, bigint, boolean":function(e,t,n){return f(m(BigInt(e),t,1n,n))},"bigint, bigint|number, bigint|number, boolean":function(e,t,n,r){return f(m(e,t,BigInt(n),r))},"number, bigint, bigint|number, boolean":function(e,t,n,r){return f(m(BigInt(e),t,BigInt(n),r))},"BigNumber, BigNumber":function(e,t){return f(m(e,t,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,n){return f(m(e,t,n,!1))},"BigNumber, BigNumber, boolean":function(e,t,n){return f(m(e,t,new(0,e.constructor)(1),n))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Fraction, Fraction":function(e,t){return f(m(e,t,1,!1))},"Fraction, Fraction, Fraction":function(e,t,n){return f(m(e,t,n,!1))},"Fraction, Fraction, boolean":function(e,t,n){return f(m(e,t,1,n))},"Fraction, Fraction, Fraction, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Unit, Unit, Unit":function(e,t,n){return f(m(e,t,n,!1))},"Unit, Unit, Unit, boolean":function(e,t,n,r){return f(m(e,t,n,r))}});function f(e){return"Matrix"===n.matrix?r?r(e):au():e}function p(e,t){const r=function(e){const t=e.split(":").map((function(e){return Number(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}(e);if(!r)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===n.number?(void 0===i&&iu(),f(m(i(r.start),i(r.end),i(r.step)))):f(m(r.start,r.end,r.step,t))}function m(e,t,n,r){const i=[],f=l(n)?r?a:o:r?u:s;let p=e;for(;f(p,t);)i.push(p),p=c(p,n);return i}})),cu="reshape",lu=he(cu,["typed","isInteger","matrix"],(e=>{let{typed:t,isInteger:n}=e;return t(cu,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach((function(e){if(!n(e))throw new TypeError("Invalid size for dimension: "+e)})),Tr(e,t)}})})),fu=he("resize",["config","matrix"],(e=>{let{config:t,matrix:n}=e;return function(e,r,i){if(2!==arguments.length&&3!==arguments.length)throw new ma("resize",arguments.length,2,3);if(E(r)&&(r=r.valueOf()),g(r[0])&&(r=r.map((function(e){return g(e)?e.toNumber():e}))),E(e))return e.resize(r,i,!0);if("string"==typeof e)return function(e,t,n){if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";if(1!==t.length)throw new xr(t.length,1);const r=t[0];if("number"!=typeof r||!ye(r))throw new TypeError("Invalid size, must contain positive integers (size: "+pr(t)+")");if(e.length>r)return e.substring(0,r);if(e.length<r){let t=e;for(let i=0,o=r-e.length;i<o;i++)t+=n;return t}return e}(e,r,i);const o=!Array.isArray(e)&&"Array"!==t.matrix;if(0===r.length){for(;Array.isArray(e);)e=e[0];return ae(e)}{Array.isArray(e)||(e=[e]);const t=Mr(e=ae(e),r,i);return o?n(t):t}}})),pu="rotate",mu=he(pu,["typed","multiply","rotationMatrix"],(e=>{let{typed:t,multiply:n,rotationMatrix:r}=e;return t(pu,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),n(r(t,o),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),n(r(t,o),e)}});function i(e,t){const n=Array.isArray(e)?vr(e):e.size();if(n.length>2)throw new RangeError(`Vector must be of dimensions 1x${t}`);if(2===n.length&&1!==n[1])throw new RangeError(`Vector must be of dimensions 1x${t}`);if(n[0]!==t)throw new RangeError(`Vector must be of dimensions 1x${t}`)}})),hu="rotationMatrix",du=he(hu,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(e=>{let{typed:t,config:n,multiplyScalar:r,addScalar:i,unaryMinus:o,norm:a,BigNumber:s,matrix:u,DenseMatrix:c,SparseMatrix:l,cos:f,sin:p}=e;return t(hu,{"":function(){return"Matrix"===n.matrix?u([]):[]},string:function(e){return u(e)},"number | BigNumber | Complex | Unit":function(e){return m(e,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return m(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){const n=u(t);return h(n),x(e,n,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){h(t);const r=t.storage()||("Matrix"===n.matrix?"dense":void 0);return x(e,t,r)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,n){const r=u(t);return h(r),x(e,r,n)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,n){return h(t),x(e,t,n)}});function m(e,t){const n=g(e)?new s(-1):-1,i=f(e),o=p(e);return y([[i,r(n,o)],[o,i]],t)}function h(e){const t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function d(e){return e.reduce(((e,t)=>r(e,t)))}function y(e,t){if(t){if("sparse"===t)return new l(e);if("dense"===t)return new c(e);throw new TypeError(`Unknown matrix type "${t}"`)}return e}function x(e,t,n){const r=a(t);if(0===r)throw new RangeError("Rotation around zero vector");const u=g(e)?s:null,c=u?new u(1):1,l=u?new u(-1):-1,m=u?new u(t.get([0])/r):t.get([0])/r,h=u?new u(t.get([1])/r):t.get([1])/r,x=u?new u(t.get([2])/r):t.get([2])/r,b=f(e),v=i(c,o(b)),w=p(e);return y([[i(b,d([m,m,v])),i(d([m,h,v]),d([l,x,w])),i(d([m,x,v]),d([h,w]))],[i(d([m,h,v]),d([x,w])),i(b,d([h,h,v])),i(d([h,x,v]),d([l,m,w]))],[i(d([m,x,v]),d([l,h,w])),i(d([h,x,v]),d([m,w])),i(b,d([x,x,v]))]],n)}})),gu=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;return t("row",{"Matrix, number":o,"Array, number":function(e,t){return o(r(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Ar(t,e.size()[0]);const o=i(0,e.size()[1]),a=new n(t,o),s=e.subset(a);return E(s)?s:r([[s]])}})),yu="size",xu=he(yu,["typed","config","?matrix"],(e=>{let{typed:t,config:n,matrix:r}=e;return t(yu,{Matrix:function(e){return e.create(e.size(),"number")},Array:vr,string:function(e){return"Array"===n.matrix?[e.length]:r([e.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===n.matrix?[]:r?r([],"dense","number"):au()}})})),bu="squeeze",vu=he(bu,["typed"],(e=>{let{typed:t}=e;return t(bu,{Array:function(e){return Fr(ae(e))},Matrix:function(e){const t=Fr(e.toArray());return Array.isArray(t)?e.create(t,e.datatype()):t},any:function(e){return ae(e)}})})),wu="subset",Nu=he(wu,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;return t(wu,{"Matrix, Index":function(e,t){return Sr(t)?n():(Er(e,t),e.subset(t))},"Array, Index":t.referTo("Matrix, Index",(function(e){return function(t,r){const i=e(n(t),r);return r.isScalar()?i:i.valueOf()}})),"Object, Index":Su,"string, Index":Eu,"Matrix, Index, any, any":function(e,t,n,o){return Sr(t)?e:(Er(e,t),e.clone().subset(t,function(e,t){if("string"==typeof e)throw new Error("can't boradcast a string");if(t._isScalar)return e;const n=t.size();if(!n.every((e=>e>0)))return e;try{return i(e,r(n))}catch(t){return e}}(n,t),o))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,i,o){const a=e(n(t),r,i,o);return a.isMatrix?a.valueOf():a}})),"Array, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,i){return e(n(t),r,i,void 0).valueOf()}})),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,n,r){return e(t,n,r,void 0)}})),"string, Index, string":Au,"string, Index, string, string":Au,"Object, Index, any":Mu})}));function Eu(e,t){if(!T(t))throw new TypeError("Index expected");if(Sr(t))return"";if(Er(Array.from(e),t),1!==t.size().length)throw new xr(t.size().length,1);const n=e.length;Ar(t.min()[0],n),Ar(t.max()[0],n);const r=t.dimension(0);let i="";return r.forEach((function(t){i+=e.charAt(t)})),i}function Au(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(Sr(t))return e;if(Er(Array.from(e),t),1!==t.size().length)throw new xr(t.size().length,1);if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";const i=t.dimension(0);if(i.size()[0]!==n.length)throw new xr(i.size()[0],n.length);const o=e.length;Ar(t.min()[0]),Ar(t.max()[0]);const a=[];for(let t=0;t<o;t++)a[t]=e.charAt(t);if(i.forEach((function(e,t){a[e]=n.charAt(t[0])})),a.length>o)for(let e=o-1,t=a.length;e<t;e++)a[e]||(a[e]=r);return a.join("")}function Su(e,t){if(Sr(t))return;if(1!==t.size().length)throw new xr(t.size(),1);const n=t.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");return i(e,n)}function Mu(e,t,n){if(Sr(t))return e;if(1!==t.size().length)throw new xr(t.size(),1);const r=t.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");const i=ae(e);return o(i,r,n),i}const Cu="transpose",Tu=he(Cu,["typed","matrix"],(e=>{let{typed:t,matrix:n}=e;return t(Cu,{Array:e=>r(n(e)).valueOf(),Matrix:r,any:ae});function r(e){const t=e.size();let n;switch(t.length){case 1:n=e.clone();break;case 2:{const r=t[0],i=t[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+pr(t)+")");switch(e.storage()){case"dense":n=function(e,t,n){const r=e._data,i=[];let o;for(let e=0;e<n;e++){o=i[e]=[];for(let n=0;n<t;n++)o[n]=ae(r[n][e])}return e.createDenseMatrix({data:i,size:[n,t],datatype:e._datatype})}(e,r,i);break;case"sparse":n=function(e,t,n){const r=e._values,i=e._index,o=e._ptr,a=r?[]:void 0,s=[],u=[],c=[];for(let e=0;e<t;e++)c[e]=0;let l,f,p;for(l=0,f=i.length;l<f;l++)c[i[l]]++;let m=0;for(let e=0;e<t;e++)u.push(m),m+=c[e],c[e]=u[e];for(u.push(m),p=0;p<n;p++)for(let e=o[p],t=o[p+1],n=e;n<t;n++){const e=c[i[n]]++;s[e]=p,r&&(a[e]=ae(r[n]))}return e.createSparseMatrix({values:a,index:s,ptr:u,size:[n,t],datatype:e._datatype})}(e,r,i)}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+pr(t)+")")}return n}})),Bu="ctranspose",Du=he(Bu,["typed","transpose","conj"],(e=>{let{typed:t,transpose:n,conj:r}=e;return t(Bu,{any:function(e){return r(n(e))}})})),Fu="zeros",Ou=he(Fu,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(Fu,{"":function(){return"Array"===n.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===n.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const n=function(e){let t=!1;return e.forEach((function(e,n,r){g(e)&&(t=!0,r[n]=e.toNumber())})),t}(e),o=n?new i(0):0;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}))}(e),t){const n=r(t);return e.length>0?n.resize(e,o):n}{const t=[];return e.length>0?Mr(t,e,o):t}}})),_u=he("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(e=>{let{typed:t,matrix:n,addScalar:r,multiplyScalar:i,divideScalar:o,exp:a,tau:s,i:u,dotDivide:c,conj:l,pow:f,ceil:p,log2:m}=e;return t("fft",{Array:h,Matrix:function(e){return e.create(h(e.valueOf()),e.datatype())}});function h(e){const t=vr(e);return 1===t.length?g(e,t[0]):d(e.map((e=>h(e,t.slice(1)))),0)}function d(e,t){const n=vr(e);if(0!==t)return new Array(n[0]).fill(0).map(((n,r)=>d(e[r],t-1)));if(1===n.length)return g(e);function r(e){const t=vr(e);return new Array(t[1]).fill(0).map(((n,r)=>new Array(t[0]).fill(0).map(((t,n)=>e[n][r]))))}return r(d(r(e),1))}function g(e){const t=e.length;if(1===t)return[e[0]];if(t%2==0){const n=[...g(e.filter(((e,t)=>t%2==0))),...g(e.filter(((e,t)=>t%2==1)))];for(let e=0;e<t/2;e++){const c=n[e],l=i(n[e+t/2],a(i(i(s,u),o(-e,t))));n[e]=r(c,l),n[e+t/2]=r(c,i(-1,l))}return n}return function(e){const t=e.length,n=a(o(i(-1,i(u,s)),t)),r=[];for(let e=1-t;e<t;e++)r.push(f(n,o(f(e,2),2)));const d=f(2,p(m(t+t-1))),y=[...new Array(t).fill(0).map(((n,o)=>i(e[o],r[t-1+o]))),...new Array(d-t).fill(0)],x=[...new Array(t+t-1).fill(0).map(((e,t)=>o(1,r[t]))),...new Array(d-(t+t-1)).fill(0)],b=g(y),v=g(x),w=new Array(d).fill(0).map(((e,t)=>i(b[t],v[t]))),N=c(l(h(l(w))),d),E=[];for(let e=t-1;e<t+t-1;e++)E.push(i(N[e],r[e]));return E}(e)}})),Iu="ifft",zu=he(Iu,["typed","fft","dotDivide","conj"],(e=>{let{typed:t,fft:n,dotDivide:r,conj:i}=e;return t(Iu,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);return r(i(n(i(e))),t.reduce(((e,t)=>e*t),1))}})})),ku=he("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,max:a,map:s,abs:u,isPositive:c,isNegative:l,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:y}=e;function x(e){return function(t,m,d,x){if(2!==m.length||!m.every(E)&&!m.every(v))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');const b=m[0],w=m[1],N=f(w,b),A=x.firstStep;if(void 0!==A&&!c(A))throw new Error('"firstStep" must be positive');const S=x.maxStep;if(void 0!==S&&!c(S))throw new Error('"maxStep" must be positive');const M=x.minStep;if(M&&l(M))throw new Error('"minStep" must be positive or zero');const C=[b,w,A,M,S].filter((e=>void 0!==e));if(!C.every(E)&&!C.every(v))throw new Error('Inconsistent type of "t" dependant variables');const T=x.tol?x.tol:1e-4,B=x.minDelta?x.minDelta:.2,D=x.maxDelta?x.maxDelta:5,F=x.maxIter?x.maxIter:1e4,O=[b,w,...d,S,M].some(g),[_,I,z,k]=O?[h(e.a),h(e.c),h(e.b),h(e.bp)]:[e.a,e.c,e.b,e.bp];let R=A?N?A:y(A):o(r(w,b),1);const q=[b],P=[d],j=r(z,k);let U=0,L=0;const $=function(e){return e?p:f}(N),H=function(e){const t=e?f:p;return function(e,i,o){const a=n(e,o);return t(a,i)?r(i,e):o}}(N);for(;$(q[U],w);){const e=[];R=H(q[U],w,R),e.push(t(q[U],P[U]));for(let r=1;r<I.length;++r)e.push(t(n(q[U],i(I[r],R)),n(P[U],i(R,_[r],e))));const r=a(u(s(i(j,e),(e=>v(e)?e.value:e))));r<T&&T/r>1/4&&(q.push(n(q[U],R)),P.push(n(P[U],i(R,z,e))),U++);let o=.84*(T/r)**.2;if(p(o,B)?o=B:f(o,D)&&(o=D),o=O?h(o):o,R=i(R,o),S&&f(u(R),S)?R=N?S:y(S):M&&p(u(R),M)&&(R=N?M:y(M)),L++,L>F)throw new Error("Maximum number of iterations reached, try changing options")}return{t:q,y:P}}}function b(e,t,n,r){return x({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,t,n,r)}function w(e,t,n,r){return x({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,t,n,r)}function N(e,t,n,r){const i=r.method?r.method:"RK45",o={RK23:b,RK45:w};if(i.toUpperCase()in o){const a={...r};return delete a.method,o[i.toUpperCase()](e,t,n,a)}{const e=Object.keys(o).map((e=>`"${e}"`)),t=`${e.slice(0,-1).join(", ")} and ${e.slice(-1)}`;throw new Error(`Unavailable method "${i}". Available methods are ${t}`)}}function E(e){return g(e)||d(e)}function A(e,t,n,r){const i=N(e,t.toArray(),n.toArray(),r);return{t:m(i.t),y:m(i.y)}}return t("solveODE",{"function, Array, Array, Object":N,"function, Matrix, Matrix, Object":A,"function, Array, Array":(e,t,n)=>N(e,t,n,{}),"function, Matrix, Matrix":(e,t,n)=>A(e,t,n,{}),"function, Array, number | BigNumber | Unit":(e,t,n)=>{const r=N(e,t,[n],{});return{t:r.t,y:r.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit":(e,t,n)=>{const r=N(e,t.toArray(),[n],{});return{t:m(r.t),y:m(r.y.map((e=>e[0])))}},"function, Array, number | BigNumber | Unit, Object":(e,t,n,r)=>{const i=N(e,t,[n],r);return{t:i.t,y:i.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit, Object":(e,t,n,r)=>{const i=N(e,t.toArray(),[n],r);return{t:m(i.t),y:m(i.y.map((e=>e[0])))}}})})),Ru=he("erf",["typed"],(e=>{let{typed:t}=e;return t("name",{number:function(e){const t=Math.abs(e);return t>=Lu?be(e):t<=qu?be(e)*function(e){const t=e*e;let n,r=ju[0][4]*t,i=t;for(n=0;n<3;n+=1)r=(r+ju[0][n])*t,i=(i+Uu[0][n])*t;return e*(r+ju[0][3])/(i+Uu[0][3])}(t):t<=4?be(e)*(1-function(e){let t,n=ju[1][8]*e,r=e;for(t=0;t<7;t+=1)n=(n+ju[1][t])*e,r=(r+Uu[1][t])*e;const i=(n+ju[1][7])/(r+Uu[1][7]),o=parseInt(16*e)/16,a=(e-o)*(e+o);return Math.exp(-o*o)*Math.exp(-a)*i}(t)):be(e)*(1-function(e){let t,n=1/(e*e),r=ju[2][5]*n,i=n;for(t=0;t<4;t+=1)r=(r+ju[2][t])*n,i=(i+Uu[2][t])*n;let o=n*(r+ju[2][4])/(i+Uu[2][4]);o=(Pu-o)/e,n=parseInt(16*e)/16;const a=(e-n)*(e+n);return Math.exp(-n*n)*Math.exp(-a)*o}(t))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),qu=.46875,Pu=.5641895835477563,ju=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Uu=[[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]],Lu=Math.pow(2,53),$u="zeta",Hu=he($u,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],(e=>{let{typed:t,config:n,multiply:r,pow:i,divide:o,factorial:a,equal:s,smallerEq:u,isNegative:c,gamma:l,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=e;return t($u,{number:e=>y(e,(e=>e),(()=>20)),BigNumber:e=>y(e,(e=>new d(e)),(()=>Math.abs(Math.log10(n.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):x(e,(e=>e),(e=>Math.round(19.5+.9*Math.abs(e.im))),(e=>e.re))}});function y(e,t,n){return s(e,0)?t(-.5):s(e,1)?t(NaN):isFinite(e)?x(e,t,n,(e=>e)):c(e)?t(NaN):t(1)}function x(e,t,n,a){const s=n(e);if(a(e)>-(s-1)/2)return function(e,t,n){const a=o(1,r(b(n(0),t),p(1,i(2,p(1,e)))));let s=n(0);for(let a=n(1);u(a,t);a=m(a,1))s=m(s,o(r((-1)**(a-1),b(a,t)),i(a,e)));return r(a,s)}(e,t(s),t);{let s=r(i(2,e),i(t(g),p(e,1)));return s=r(s,f(r(o(t(g),2),e))),s=r(s,l(p(1,e))),r(s,x(p(1,e),t,n,a))}}function b(e,t){let n=e;for(let s=e;u(s,t);s=m(s,1)){const e=o(r(a(m(t,p(s,1))),i(4,s)),r(a(p(t,s)),a(r(2,s))));n=m(n,e)}return r(t,n)}})),Gu="mode",Vu=he(Gu,["typed","isNaN","isNumeric"],(e=>{let{typed:t,isNaN:n,isNumeric:r}=e;return t(Gu,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=zr(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");const t={};let i=[],o=0;for(let a=0;a<e.length;a++){const s=e[a];if(r(s)&&n(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in t||(t[s]=0),t[s]++,t[s]===o?i.push(s):t[s]>o&&(o=t[s],i=[s])}return i}}));function Zu(e,t,n){let r;return String(e).includes("Unexpected type")?(r=arguments.length>2?" (type: "+oe(n)+", value: "+JSON.stringify(n)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+r)):String(e).includes("complex numbers")?(r=arguments.length>2?" (type: "+oe(n)+", value: "+JSON.stringify(n)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+r)):e}const Wu="prod",Yu=he(Wu,["typed","config","multiplyScalar","numeric"],(e=>{let{typed:t,config:n,multiplyScalar:r,numeric:i}=e;return t(Wu,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return o(e)}});function o(e){let t;if(ri(e,(function(e){try{t=void 0===t?e:r(t,e)}catch(t){throw Zu(t,"prod",e)}})),"string"==typeof t&&(t=i(t,xe(t,n))),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}})),Ju="format",Xu=he(Ju,["typed"],(e=>{let{typed:t}=e;return t(Ju,{any:pr,"any, Object | function | number | BigNumber":pr})})),Qu=he("bin",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("bin",{"number | BigNumber":function(e){return n(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"bin",wordSize:t})}})})),Ku=he("oct",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("oct",{"number | BigNumber":function(e){return n(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"oct",wordSize:t})}})})),ec=he("hex",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("hex",{"number | BigNumber":function(e){return n(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"hex",wordSize:t})}})})),tc=/\$([\w.]+)/g,nc="print",rc=he(nc,["typed"],(e=>{let{typed:t}=e;return t(nc,{"string, Object | Array":ic,"string, Object | Array, number | Object":ic})}));function ic(e,t,n){return e.replace(tc,(function(e,r){const i=r.split(".");let o=t[i.shift()];for(void 0!==o&&o.isMatrix&&(o=o.toArray());i.length&&void 0!==o;){const e=i.shift();o=e?o[e]:o+"."}return void 0!==o?w(o)?o:pr(o,n):e}))}const oc=he("to",["typed","matrix","concat"],(e=>{let{typed:t,matrix:n,concat:r}=e;return t("to",{"Unit, Unit | string":(e,t)=>e.to(t)},ua({typed:t,matrix:n,concat:r})({Ds:!0}))})),ac="isPrime",sc=he(ac,["typed"],(e=>{let{typed:t}=e;return t(ac,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(let t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;if(e%2n===0n||e%3n===0n)return!1;for(let t=5n;t*t<=e;t+=6n)if(e%t===0n||e%(t+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(Math.pow(2,32))){const t=e.toNumber();for(let e=5;e*e<=t;e+=6)if(t%e==0||t%(e+2)==0)return!1;return!0}function t(e,t,n){let r=1;for(;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(n)):(t=t.sub(1),r=e.mul(r).mod(n));return r}const n=e.constructor.clone({precision:2*e.toFixed(0).length});let r=0,i=(e=new n(e)).sub(1);for(;i.mod(2).eq(0);)i=i.div(2),r+=1;let o=null;if(e.lt("3317044064679887385961981"))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((t=>t<e));else{const t=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));o=[];for(let e=2;e<=t;e+=1)o.push(t)}for(let n=0;n<o.length;n+=1){const a=o[n],s=t(e.sub(e).add(a),i,e);if(!s.eq(1))for(let t=0,n=s;!n.eq(e.sub(1));t+=1,n=n.mul(n).mod(e))if(t===r-1)return!1}return!0},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),uc=he("numeric",["number","?bignumber","?fraction"],(e=>{let{number:t,bignumber:n,fraction:r}=e;const i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:n?e=>n(e):iu,bigint:e=>BigInt(e),Fraction:r?e=>r(e):ou};return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(arguments.length>2?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");const n=oe(e);if(!(n in i))throw new TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===n?e:o[t](e)}})),cc="divideScalar",lc=he(cc,["typed","numeric"],(e=>{let{typed:t,numeric:n}=e;return t(cc,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"bigint, bigint":function(e,t){return e/t},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})})),fc=he("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(e=>{let{typed:t,config:n,identity:r,multiply:i,matrix:o,inv:a,number:s,fraction:u,Complex:c}=e;return t("pow",{"number, number":l,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||n.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"bigint, bigint":(e,t)=>e**t,"Fraction, Fraction":function(e,t){const r=e.pow(t);if(null!=r)return r;if(n.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(e.valueOf(),t.valueOf())},"Array, number":f,"Array, BigNumber":function(e,t){return f(e,t.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,t){return p(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function l(e,t){if(n.predictable&&!ye(t)&&e<0)try{const n=u(t),r=s(n);if((t===r||Math.abs((t-r)/t)<1e-14)&&n.d%2n===1n)return(n.n%2n===0n?1:-1)*Math.pow(-e,t)}catch(e){}return n.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:ye(t)||e>=0||n.predictable?bo(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new c(e,0).pow(t,0)}function f(e,t){if(!ye(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");const n=vr(e);if(2!==n.length)throw new Error("For A^b, A must be 2 dimensional (A has "+n.length+" dimensions)");if(n[0]!==n[1])throw new Error("For A^b, A must be square (size is "+n[0]+"x"+n[1]+")");if(t<0)try{return f(a(e),-t)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+t+")");throw e}let o=r(n[0]).valueOf(),s=e;for(;t>=1;)1&~t||(o=i(s,o)),t>>=1,s=i(s,s);return o}function p(e,t){return o(f(e.valueOf(),t))}})),pc="Number of decimals in function round must be an integer",mc="round",hc=he(mc,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(e=>{let{typed:t,config:n,matrix:r,equalScalar:i,zeros:o,BigNumber:a,DenseMatrix:s}=e;const u=zo({typed:t,equalScalar:i}),c=ko({typed:t,DenseMatrix:s}),l=Ro({typed:t});function f(e){return Math.abs(Te(e).exponent)}return t(mc,{number:function(e){const t=vo(e,f(n.relTol));return vo(_e(e,t,n.relTol,n.absTol)?t:e)},"number, number":function(e,t){const r=f(n.relTol);if(t>=r)return vo(e,t);const i=vo(e,r);return vo(_e(e,i,n.relTol,n.absTol)?i:e,t)},"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(pc);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);const n=t.toNumber();return e.round(n)},BigNumber:function(e){const t=new a(e).toDecimalPlaces(f(n.relTol));return(hi(e,t,n.relTol,n.absTol)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);const r=f(n.relTol);if(t>=r)return e.toDecimalPlaces(t.toNumber());const i=e.toDecimalPlaces(r);return(hi(e,i,n.relTol,n.absTol)?i:e).toDecimalPlaces(t.toNumber())},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(pc);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);return e.round(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>l(r(t),n,e,!1).valueOf())),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf((e=>(t,n)=>i(t,0)?o(n.size(),n.storage()):c(n,t,e,!0))),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf((e=>(t,n)=>i(t,0)?o(n.size(),n.storage()):l(n,t,e,!0))),"number | Complex | BigNumber | Fraction, Array":t.referToSelf((e=>(t,n)=>l(r(n),t,e,!0).valueOf()))})})),dc=["config","typed","typeOf","divideScalar","Complex"],gc=Math.log(16),yc=he("log",dc,(e=>{let{typed:t,typeOf:n,config:r,divideScalar:i,Complex:o}=e;function a(e){return e.log()}function s(e){return a(new o(e,0))}return t("log",{number:function(e){return e>=0||r.predictable?fo(e):s(e)},bigint:va(gc,fo,r,s),Complex:a,BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():s(e.toNumber())},"any, any":t.referToSelf((e=>(t,r)=>{if("Fraction"===n(t)&&"Fraction"===n(r)){const e=t.log(r);if(null!==e)return e}return i(e(t),e(r))}))})})),xc="log1p",bc=he(xc,["typed","config","divideScalar","log","Complex"],(e=>{let{typed:t,config:n,divideScalar:r,log:i,Complex:o}=e;return t(xc,{number:function(e){return e>=-1||n.predictable?Ne(e):a(new o(e,0))},Complex:a,BigNumber:function(e){const t=e.plus(1);return!t.isNegative()||n.predictable?t.ln():a(new o(e.toNumber(),0))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e))),"any, any":t.referToSelf((e=>(t,n)=>r(e(t),i(n))))});function a(e){const t=e.re+1;return new o(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}})),vc="nthRoots",wc=he(vc,["config","typed","divideScalar","Complex"],(e=>{let{typed:t,config:n,divideScalar:r,Complex:i}=e;const o=[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 a(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];const n="number"==typeof e;let r;(n||0===e.re||0===e.im)&&(r=n?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);const a=e.arg(),s=e.abs(),u=[],c=Math.pow(s,1/t);for(let e=0;e<t;e++){const n=(r+4*e)/t;n!==Math.round(n)?u.push(new i({r:c,phi:(a+2*Math.PI*e)/t})):u.push(o[n%4](c))}return u}return t(vc,{Complex:function(e){return a(e,2)},"Complex, number":a})})),Nc="dotPow",Ec=he(Nc,["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,equalScalar:n,matrix:r,pow:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=zo({typed:t,equalScalar:n}),f=ko({typed:t,DenseMatrix:o}),p=ua({typed:t,matrix:r,concat:a}),m={};for(const e in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,e)&&(e.includes("Matrix")||e.includes("Array")||(m[e]=i.signatures[e]));const h=t(m);return t(Nc,p({elop:h,SS:c,DS:u,Ss:l,sS:f}))})),Ac="dotDivide",Sc=he(Ac,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,equalScalar:r,divideScalar:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ra({typed:t,equalScalar:r}),c=ia({typed:t}),l=hs({typed:t,SparseMatrix:s}),f=zo({typed:t,equalScalar:r}),p=ko({typed:t,DenseMatrix:o}),m=ua({typed:t,matrix:n,concat:a});return t(Ac,m({elop:i,SS:l,DS:c,SD:u,Ss:f,sS:p}))}));function Mc(e){let{DenseMatrix:t}=e;return function(e,n,r){const i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+pr(i)+")");const o=i[0];if(o!==i[1])throw new RangeError("Matrix must be square (size: "+pr(i)+")");let a=[];if(E(n)){const e=n.size(),i=n._data;if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[i[e]];return new t({data:a,size:[o,1],datatype:n._datatype})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(S(n)){if(r){a=[];for(let e=0;e<o;e++)a[e]=[i[e][0]];return new t({data:a,size:[o,1],datatype:n._datatype})}return n}if(M(n)){for(let e=0;e<o;e++)a[e]=[0];const e=n._values,r=n._index,i=n._ptr;for(let t=i[1],n=i[0];n<t;n++)a[r[n]][0]=e[n];return new t({data:a,size:[o,1],datatype:n._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(N(n)){const e=vr(n);if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[n[e]];return new t({data:a,size:[o,1]})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[n[e][0]];return new t({data:a,size:[o,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}const Cc="lsolve",Tc=he(Cc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Cc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=0;e<l;e++){const t=n[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e],d=m[e+1];for(let t=l;t<d;t++){const n=p[t];n===e?s=f[t]:n>e&&(u.push(f[t]),c.push(n))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const g=r(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];n[t]=[o(n[t][0]||0,i(g,u[e]))]}h[e]=[g]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).valueOf()}});function c(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=0;e<l;e++){const t=n[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=r(t,u);for(let t=e+1;t<c;t++)n[t]=[o(n[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),Bc="usolve",Dc=he(Bc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Bc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=l-1;e>=0;e--){const t=n[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e];for(let t=m[e+1]-1;t>=l;t--){const n=p[t];n===e?s=f[t]:n<e&&(u.push(f[t]),c.push(n))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const d=r(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];n[t]=[o(n[t][0],i(d,u[e]))]}h[e]=[d]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).valueOf()}});function c(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=l-1;e>=0;e--){const t=n[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=r(t,u);for(let t=e-1;t>=0;t--)n[t]=[o(n[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),Fc="lsolveAll",Oc=he(Fc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Fc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=0;e<l;e++){let t=n.length;for(let s=0;s<t;s++){const u=n[s],c=[],l=[],h=m[e],d=m[e+1];let g=0;for(let t=h;t<d;t++){const n=p[t];n===e?g=f[t]:n>e&&(c.push(f[t]),l.push(n))}if(a(g,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,n=l.length;e<n;e++){const n=l[e];t[n]=o(t[n],c[e])}n.push(t)}}else{if(0===s)return[];n.splice(s,1),s-=1,t-=1}else{u[e]=r(u[e],g);for(let t=0,n=l.length;t<n;t++){const n=l[t];u[n]=o(u[n],i(u[e],c[t]))}}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).map((e=>e.valueOf()))}});function c(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0],f=e._size[1];for(let e=0;e<f;e++){let t=n.length;for(let s=0;s<t;s++){const u=n[s];if(a(c[e][e],0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let n=e+1;n<f;n++)t[n]=o(t[n],c[n][e]);n.push(t)}}else{if(0===s)return[];n.splice(s,1),s-=1,t-=1}else{u[e]=r(u[e],c[e][e]);for(let t=e+1;t<f;t++)u[t]=o(u[t],i(u[e],c[t][e]))}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),_c="usolveAll",Ic=he(_c,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(_c,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=l-1;e>=0;e--){let t=n.length;for(let s=0;s<t;s++){const u=n[s],c=[],l=[],h=m[e];let d=0;for(let t=m[e+1]-1;t>=h;t--){const n=p[t];n===e?d=f[t]:n<e&&(c.push(f[t]),l.push(n))}if(a(d,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,n=l.length;e<n;e++){const n=l[e];t[n]=o(t[n],c[e])}n.push(t)}}else{if(0===s)return[];n.splice(s,1),s-=1,t-=1}else{u[e]=r(u[e],d);for(let t=0,n=l.length;t<n;t++){const n=l[t];u[n]=o(u[n],i(u[e],c[t]))}}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).map((e=>e.valueOf()))}});function c(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0];for(let t=e._size[1]-1;t>=0;t--){let e=n.length;for(let s=0;s<e;s++){const u=n[s];if(a(c[t][t],0))if(a(u[t],0)){if(0===s){const e=[...u];e[t]=1;for(let n=t-1;n>=0;n--)e[n]=o(e[n],c[n][t]);n.push(e)}}else{if(0===s)return[];n.splice(s,1),s-=1,e-=1}else{u[t]=r(u[t],c[t][t]);for(let e=t-1;e>=0;e--)u[e]=o(u[e],i(u[t],c[e][t]))}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),zc=he("matAlgo08xS0Sid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!o||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=[],N=[],E=[],A=[],S=[];let M,C,T,B;for(let e=0;e<g;e++){E[e]=N.length;const t=e+1;for(C=s[e],T=s[e+1],M=C;M<T;M++)B=a[M],S[B]=t,A[B]=o[M],N.push(B);for(C=p[e],T=p[e+1],M=C;M<T;M++)B=f[M],S[B]===t&&(A[B]=v(A[B],l[M]));for(M=E[e];M<N.length;){B=N[M];const e=A[B];x(e,b)?N.splice(M,1):(w.push(e),M++)}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),kc=he("useMatrixForArrayScalar",["typed","matrix"],(e=>{let{typed:t,matrix:n}=e;return{"Array, number":t.referTo("DenseMatrix, number",(e=>(t,r)=>e(n(t),r).valueOf())),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",(e=>(t,r)=>e(n(t),r).valueOf())),"number, Array":t.referTo("number, DenseMatrix",(e=>(t,r)=>e(t,n(r)).valueOf())),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",(e=>(t,r)=>e(t,n(r)).valueOf()))}})),Rc="leftShift",qc=he(Rc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=la({typed:t}),u=ra({typed:t,equalScalar:r}),c=zc({typed:t,equalScalar:r}),l=pa({typed:t,DenseMatrix:o}),f=zo({typed:t,equalScalar:r}),p=Ro({typed:t}),m=ua({typed:t,matrix:n,concat:a}),h=kc({typed:t,matrix:n});return t(Rc,{"number, number":os,"BigNumber, BigNumber":Qa,"bigint, bigint":(e,t)=>e<<t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Pc="rightArithShift",jc=he(Pc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=la({typed:t}),u=ra({typed:t,equalScalar:r}),c=zc({typed:t,equalScalar:r}),l=pa({typed:t,DenseMatrix:o}),f=zo({typed:t,equalScalar:r}),p=Ro({typed:t}),m=ua({typed:t,matrix:n,concat:a}),h=kc({typed:t,matrix:n});return t(Pc,{"number, number":as,"BigNumber, BigNumber":Ka,"bigint, bigint":(e,t)=>e>>t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Uc="rightLogShift",Lc=he(Uc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=la({typed:t}),u=ra({typed:t,equalScalar:r}),c=zc({typed:t,equalScalar:r}),l=pa({typed:t,DenseMatrix:o}),f=zo({typed:t,equalScalar:r}),p=Ro({typed:t}),m=ua({typed:t,matrix:n,concat:a}),h=kc({typed:t,matrix:n});return t(Uc,{"number, number":ss,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),$c=he("and",["typed","matrix","equalScalar","zeros","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=ra({typed:t,equalScalar:r}),u=xa({typed:t,equalScalar:r}),c=zo({typed:t,equalScalar:r}),l=Ro({typed:t}),f=ua({typed:t,matrix:n,concat:a});return t("and",{"number, number":Ms,"Complex, Complex":function(e,t){return!(0===e.re&&0===e.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(e,t){return!(e.isZero()||t.isZero()||e.isNaN()||t.isNaN())},"bigint, bigint":Ms,"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0))),"SparseMatrix, any":t.referToSelf((e=>(t,n)=>o(n)?i(t.size(),t.storage()):c(t,n,e,!1))),"DenseMatrix, any":t.referToSelf((e=>(t,n)=>o(n)?i(t.size(),t.storage()):l(t,n,e,!1))),"any, SparseMatrix":t.referToSelf((e=>(t,n)=>o(t)?i(t.size(),t.storage()):c(n,t,e,!0))),"any, DenseMatrix":t.referToSelf((e=>(t,n)=>o(t)?i(t.size(),t.storage()):l(n,t,e,!0))),"Array, any":t.referToSelf((e=>(t,r)=>e(n(t),r).valueOf())),"any, Array":t.referToSelf((e=>(t,r)=>e(t,n(r)).valueOf()))},f({SS:u,DS:s}))})),Hc="compare",Gc=he(Hc,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],(e=>{let{typed:t,config:n,equalScalar:r,matrix:i,BigNumber:o,Fraction:a,DenseMatrix:s,concat:u}=e;const c=ia({typed:t}),l=oa({typed:t,equalScalar:r}),f=ko({typed:t,DenseMatrix:s}),p=ua({typed:t,matrix:i,concat:u}),m=Bi({typed:t});return t(Hc,Vc({typed:t,config:n}),{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return hi(e,t,n.relTol,n.absTol)?new o(0):new o(e.cmp(t))},"bigint, bigint":function(e,t){return e===t?0n:e>t?1n:-1n},"Fraction, Fraction":function(e,t){return new a(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:l,DS:c,Ss:f}))})),Vc=he(Hc,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(Hc,{"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)?0:e>t?1:-1}})}));var Zc=n(1880);const Wc="compareNatural",Yc=he(Wc,["typed","compare"],(e=>{let{typed:t,compare:n}=e;const r=n.signatures["boolean,boolean"];return t(Wc,{"any, any":function e(t,a){const s=oe(t),u=oe(a);let c;if(!("number"!==s&&"BigNumber"!==s&&"Fraction"!==s||"number"!==u&&"BigNumber"!==u&&"Fraction"!==u))return c=n(t,a),"0"!==c.toString()?c>0?1:-1:Zc(s,u);const l=["Array","DenseMatrix","SparseMatrix"];if(l.includes(s)||l.includes(u))return c=i(e,t,a),0!==c?c:Zc(s,u);if(s!==u)return Zc(s,u);if("Complex"===s)return function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0}(t,a);if("Unit"===s)return t.equalBase(a)?e(t.value,a.value):o(e,t.formatUnits(),a.formatUnits());if("boolean"===s)return r(t,a);if("string"===s)return Zc(t,a);if("Object"===s)return function(e,t,n){const r=Object.keys(t),i=Object.keys(n);r.sort(Zc),i.sort(Zc);const a=o(e,r,i);if(0!==a)return a;for(let o=0;o<r.length;o++){const a=e(t[r[o]],n[i[o]]);if(0!==a)return a}return 0}(e,t,a);if("null"===s)return 0;if("undefined"===s)return 0;throw new TypeError('Unsupported type of value "'+s+'"')}});function i(e,t,n){return M(t)&&M(n)?o(e,t.toJSON().values,n.toJSON().values):M(t)?i(e,t.toArray(),n):M(n)?i(e,t,n.toArray()):S(t)?i(e,t.toJSON().data,n):S(n)?i(e,t,n.toJSON().data):Array.isArray(t)?Array.isArray(n)?o(e,t,n):i(e,t,[n]):i(e,[t],n)}function o(e,t,n){for(let r=0,i=Math.min(t.length,n.length);r<i;r++){const i=e(t[r],n[r]);if(0!==i)return i}return t.length>n.length?1:t.length<n.length?-1:0}})),Jc="compareText",Xc=["typed","matrix","concat"];yr.signature="any, any";const Qc=he(Jc,Xc,(e=>{let{typed:t,matrix:n,concat:r}=e;const i=ua({typed:t,matrix:n,concat:r});return t(Jc,yr,i({elop:yr,Ds:!0}))})),Kc="equal",el=he(Kc,["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ia({typed:t}),u=hs({typed:t,SparseMatrix:a}),c=ko({typed:t,DenseMatrix:i}),l=ua({typed:t,matrix:n,concat:o});return t(Kc,tl({typed:t,equalScalar:r}),l({elop:r,SS:u,DS:s,Ss:c}))})),tl=he(Kc,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(Kc,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:n(e,t)}})})),nl="equalText",rl=he(nl,["typed","compareText","isZero"],(e=>{let{typed:t,compareText:n,isZero:r}=e;return t(nl,{"any, any":function(e,t){return r(n(e,t))}})})),il="smaller",ol=he(il,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=ko({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:i,concat:a}),p=Bi({typed:t});function m(e,t){return e.lt(t)&&!hi(e,t,n.relTol,n.absTol)}return t(il,al({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<t,"BigNumber, BigNumber":m,"bigint, bigint":(e,t)=>e<t,"Fraction, Fraction":(e,t)=>-1===e.compare(t),"Fraction, BigNumber":function(e,t){return m(r(e),t)},"BigNumber, Fraction":function(e,t){return m(e,r(t))},"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:l}))})),al=he(il,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(il,{"number, number":function(e,t){return e<t&&!_e(e,t,n.relTol,n.absTol)}})})),sl="smallerEq",ul=he(sl,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ia({typed:t}),u=hs({typed:t,SparseMatrix:a}),c=ko({typed:t,DenseMatrix:i}),l=ua({typed:t,matrix:r,concat:o}),f=Bi({typed:t});return t(sl,cl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<=t,"BigNumber, BigNumber":function(e,t){return e.lte(t)||hi(e,t,n.relTol,n.absTol)},"bigint, bigint":(e,t)=>e<=t,"Fraction, Fraction":(e,t)=>1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),cl=he(sl,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(sl,{"number, number":function(e,t){return e<=t||_e(e,t,n.relTol,n.absTol)}})})),ll="larger",fl=he(ll,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=ko({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:i,concat:a}),p=Bi({typed:t});function m(e,t){return e.gt(t)&&!hi(e,t,n.relTol,n.absTol)}return t(ll,pl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>t,"BigNumber, BigNumber":m,"bigint, bigint":(e,t)=>e>t,"Fraction, Fraction":(e,t)=>1===e.compare(t),"Fraction, BigNumber":function(e,t){return m(r(e),t)},"BigNumber, Fraction":function(e,t){return m(e,r(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:l}))})),pl=he(ll,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(ll,{"number, number":function(e,t){return e>t&&!_e(e,t,n.relTol,n.absTol)}})})),ml="largerEq",hl=he(ml,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ia({typed:t}),u=hs({typed:t,SparseMatrix:a}),c=ko({typed:t,DenseMatrix:i}),l=ua({typed:t,matrix:r,concat:o}),f=Bi({typed:t});return t(ml,dl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>=t,"BigNumber, BigNumber":function(e,t){return e.gte(t)||hi(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e>=t},"Fraction, Fraction":(e,t)=>-1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),dl=he(ml,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(ml,{"number, number":function(e,t){return e>=t||_e(e,t,n.relTol,n.absTol)}})})),gl="deepEqual",yl=he(gl,["typed","equal"],(e=>{let{typed:t,equal:n}=e;return t(gl,{"any, any":function(e,t){return r(e.valueOf(),t.valueOf())}});function r(e,t){if(Array.isArray(e)){if(Array.isArray(t)){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(!r(e[i],t[i]))return!1;return!0}return!1}return!Array.isArray(t)&&n(e,t)}})),xl="unequal",bl=he(xl,["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,equalScalar:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=ko({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:i,concat:a});return t(xl,vl({typed:t,equalScalar:r}),f({elop:function(e,t){return!r(e,t)},SS:c,DS:u,Ss:l}))})),vl=he(xl,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(xl,{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:!n(e,t)}})})),wl="partitionSelect",Nl=he(wl,["typed","isNumeric","isNaN","compare"],(e=>{let{typed:t,isNumeric:n,isNaN:r,compare:i}=e;const o=i,a=(e,t)=>-i(e,t);return t(wl,{"Array | Matrix, number":function(e,t){return s(e,t,o)},"Array | Matrix, number, string":function(e,t,n){if("asc"===n)return s(e,t,o);if("desc"===n)return s(e,t,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(e,t,n){if(!ye(t)||t<0)throw new Error("k must be a non-negative integer");if(E(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),t,n)}if(Array.isArray(e))return u(e,t,n)}function u(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(let t=0;t<e.length;t++)if(n(e[t])&&r(e[t]))return e[t];let o=0,a=e.length-1;for(;o<a;){let n=o,r=a;const s=e[Math.floor(Math.random()*(a-o+1))+o];for(;n<r;)if(i(e[n],s)>=0){const t=e[r];e[r]=e[n],e[n]=t,--r}else++n;i(e[n],s)>0&&--n,t<=n?a=n:o=n+1}return e[t]}})),El="sort",Al=he(El,["typed","matrix","compare","compareNatural"],(e=>{let{typed:t,matrix:n,compare:r,compareNatural:i}=e;const o=r,a=(e,t)=>-r(e,t);return t(El,{Array:function(e){return u(e),e.sort(o)},Matrix:function(e){return c(e),n(e.toArray().sort(o),e.storage())},"Array, function":function(e,t){return u(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),n(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return u(e),e.sort(s(t))},"Matrix, string":function(e,t){return c(e),n(e.toArray().sort(s(t)),e.storage())}});function s(e){if("asc"===e)return o;if("desc"===e)return a;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==vr(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),Sl=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:n,numeric:r,larger:i}=e;return t("max",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return oi(e,t.valueOf(),o)},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function max");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Zu(e,"max",t)}}function a(e){let t;if(ri(e,(function(e){try{"number"==typeof e&&isNaN(e)?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Zu(t,"max",e)}})),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=r(t,xe(t,n))),t}})),Ml=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:n,numeric:r,smaller:i}=e;return t("min",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return oi(e,t.valueOf(),o)},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function min");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Zu(e,"min",t)}}function a(e){let t;if(ri(e,(function(e){try{"number"==typeof e&&isNaN(e)?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Zu(t,"min",e)}})),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=r(t,xe(t,n))),t}})),Cl=he("ImmutableDenseMatrix",["smaller","DenseMatrix"],(e=>{let{smaller:t,DenseMatrix:n}=e;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e)||N(e)){const r=new n(e,t);this._data=r._data,this._size=r._size,this._datatype=r._datatype,this._min=null,this._max=null}else if(e&&N(e.data)&&N(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 new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return r.prototype=new n,r.prototype.type="ImmutableDenseMatrix",r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(e){switch(arguments.length){case 1:{const t=n.prototype.subset.call(this,e);return E(t)?new r({data:t._data,size:t._size,datatype:t._datatype}):t}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},r.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},r.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},r.prototype.clone=function(){return new r({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},r.prototype.min=function(){if(null===this._min){let e=null;this.forEach((function(n){(null===e||t(n,e))&&(e=n)})),this._min=null!==e?e:void 0}return this._min},r.prototype.max=function(){if(null===this._max){let e=null;this.forEach((function(n){(null===e||t(e,n))&&(e=n)})),this._max=null!==e?e:void 0}return this._max},r}),{isClass:!0}),Tl=he("Index",["ImmutableDenseMatrix","getMatrixDataType"],(e=>{let{ImmutableDenseMatrix:t,getMatrixDataType:n}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(let e=0,t=arguments.length;e<t;e++){const t=arguments[e],r=N(t),o=E(t),a=typeof t;let s=null;if(C(t))this._dimensions.push(t),this._isScalar=!1;else if(r||o){let e;"boolean"===n(t)?(r&&(e=i(Bl(t).valueOf())),o&&(e=i(Bl(t._data).valueOf())),s=t.valueOf().length):e=i(t.valueOf()),this._dimensions.push(e);const a=e.size();1===a.length&&1===a[0]&&null===s||(this._isScalar=!1)}else if("number"===a)this._dimensions.push(i([t]));else if("bigint"===a)this._dimensions.push(i([Number(t)]));else{if("string"!==a)throw new TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");this._dimensions.push(t)}this._sourceSize.push(s)}}function i(e){for(let t=0,n=e.length;t<n;t++)if("number"!=typeof e[t]||!ye(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new t(e)}return r.prototype.type="Index",r.prototype.isIndex=!0,r.prototype.clone=function(){const e=new r;return e._dimensions=ae(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},r.create=function(e){const t=new r;return r.apply(t,e),t},r.prototype.size=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e[t]="string"==typeof n?1:n.size()[0]}return e},r.prototype.max=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e[t]="string"==typeof n?n:n.max()}return e},r.prototype.min=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e[t]="string"==typeof n?n:n.min()}return e},r.prototype.forEach=function(e){for(let t=0,n=this._dimensions.length;t<n;t++)e(this._dimensions[t],t,this)},r.prototype.dimension=function(e){return"number"!=typeof e?null:this._dimensions[e]||null},r.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e.push("string"==typeof n?n:n.toArray())}return e},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(e){return r.create(e.dimensions)},r}),{isClass:!0});function Bl(e){const t=[];return e.forEach(((e,n)=>{e&&t.push(n)})),t}const Dl=he("FibonacciHeap",["smaller","larger"],(e=>{let{smaller:t,larger:n}=e;const r=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function o(e,t,n){t.left.right=t.right,t.right.left=t.left,n.degree--,n.child===t&&(n.child=t.right),0===n.degree&&(n.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function a(e,t){const n=t.parent;n&&(t.mark?(o(e,t,n),a(n)):t.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,n){const r={key:e,value:n,degree:0};if(this._minimum){const n=this._minimum;r.left=n,r.right=n.right,n.right=r,r.right.left=r,t(e,n.key)&&(this._minimum=r)}else r.left=r,r.right=r,this._minimum=r;return this._size++,r},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(){const e=this._minimum;if(null===e)return e;let i=this._minimum,o=e.degree,a=e.child;for(;o>0;){const e=a.right;a.left.right=a.right,a.right.left=a.left,a.left=i,a.right=i.right,i.right=a,a.right.left=a,a.parent=null,a=e,o--}return e.left.right=e.right,e.right.left=e.left,e===e.right?i=null:(i=e.right,i=function(e,i){const o=Math.floor(Math.log(i)*r)+1,a=new Array(o);let u,c=0,l=e;if(l)for(c++,l=l.right;l!==e;)c++,l=l.right;for(;c>0;){let e=l.degree;const t=l.right;for(;u=a[e],u;){if(n(l.key,u.key)){const e=u;u=l,l=e}s(u,l),a[e]=null,e++}a[e]=l,l=t,c--}e=null;for(let n=0;n<o;n++)u=a[n],u&&(e?(u.left.right=u.right,u.right.left=u.left,u.left=e,u.right=e.right,e.right=u,u.right.left=u,t(u.key,e.key)&&(e=u)):e=u);return e}(i,this._size)),this._size--,this._minimum=i,e},i.prototype.remove=function(e){this._minimum=function(e,n){n.key=-1;const r=n.parent;return r&&t(n.key,r.key)&&(o(e,n,r),a(e,r)),t(n.key,e.key)&&(e=n),e}(this._minimum,e),this.extractMinimum()};const s=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1};return i}),{isClass:!0}),Fl=he("Spa",["addScalar","equalScalar","FibonacciHeap"],(e=>{let{addScalar:t,equalScalar:n,FibonacciHeap:r}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new r}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{const n=this._heap.insert(e,t);this._values[e]=n}},i.prototype.get=function(e){const t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,n){let r=this._values[e];r?r.value=t(r.value,n):(r=this._heap.insert(e,n),this._values[e]=r)},i.prototype.forEach=function(e,t,r){const i=this._heap,o=this._values,a=[];let s=i.extractMinimum();for(s&&a.push(s);s&&s.key<=t;)s.key>=e&&(n(s.value,0)||r(s.key,s.value,this)),s=i.extractMinimum(),s&&a.push(s);for(let e=0;e<a.length;e++){const t=a[e];s=i.insert(t.key,t.value),o[s.key]=s}},i.prototype.swap=function(e,t){let n=this._values[e],r=this._values[t];if(!n&&r)n=this._heap.insert(e,r.value),this._heap.remove(r),this._values[e]=n,this._values[t]=void 0;else if(n&&!r)r=this._heap.insert(t,n.value),this._heap.remove(n),this._values[t]=r,this._values[e]=void 0;else if(n&&r){const e=n.value;n.value=r.value,r.value=e}},i}),{isClass:!0});function Ol(e){let t=0,n=1,r=Object.create(null),i=Object.create(null),o=0;const a=function(e){const a=i[e];if(a&&(delete r[a],delete i[e],--t,n===a)){if(!t)return o=0,void(n=1);for(;!Object.prototype.hasOwnProperty.call(r,++n););}};return e=Math.abs(e),{hit:function(s){const u=i[s],c=++o;if(r[c]=s,i[s]=c,!u){if(++t,t<=e)return;return s=r[n],a(s),s}if(delete r[u],n===u)for(;!Object.prototype.hasOwnProperty.call(r,++n););},delete:a,clear:function(){t=o=0,n=1,r=Object.create(null),i=Object.create(null)}}}function _l(e){let{hasher:t,limit:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=null==n?Number.POSITIVE_INFINITY:n,t=null==t?JSON.stringify:t,function r(){"object"!=typeof r.cache&&(r.cache={values:new Map,lru:Ol(n||Number.POSITIVE_INFINITY)});const i=[];for(let e=0;e<arguments.length;e++)i[e]=arguments[e];const o=t(i);if(r.cache.values.has(o))return r.cache.lru.hit(o),r.cache.values.get(o);const a=e.apply(e,i);return r.cache.values.set(o,a),r.cache.values.delete(r.cache.lru.hit(o)),a}}const Il=_l((function(e){return new e(1).exp()}),{hasher:ql}),zl=_l((function(e){return new e(1).plus(new e(5).sqrt()).div(2)}),{hasher:ql}),kl=_l((function(e){return e.acos(-1)}),{hasher:ql}),Rl=_l((function(e){return kl(e).times(2)}),{hasher:ql});function ql(e){return e[0].precision}const Pl=he("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],(e=>{let{on:t,config:n,addScalar:r,subtractScalar:i,multiplyScalar:o,divideScalar:a,pow:s,abs:u,fix:c,round:l,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:y}=e;const b=h;function w(e,t){if(!(this instanceof w))throw new Error("Constructor must be called with the new operator");if(null!=e&&!p(e)&&!x(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===t)this.units=[],this.dimensions=z.map((e=>0));else if("string"==typeof t){const e=w.parse(t);this.units=e.units,this.dimensions=e.dimensions}else{if(!v(t)||null!==t.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map((e=>sr({},e)))}this.value=this._normalize(e)}let N,E,A;function S(){for(;" "===A||"\t"===A;)C()}function M(e){return e>="0"&&e<="9"}function C(){E++,A=N.charAt(E)}function T(e){E=e,A=N.charAt(E)}function B(){let e="";const t=E;if("+"===A?C():"-"===A&&(e+=A,C()),!function(e){return e>="0"&&e<="9"||"."===e}(A))return T(t),null;if("."===A){if(e+=A,C(),!M(A))return T(t),null}else{for(;M(A);)e+=A,C();"."===A&&(e+=A,C())}for(;M(A);)e+=A,C();if("E"===A||"e"===A){let t="";const n=E;if(t+=A,C(),"+"!==A&&"-"!==A||(t+=A,C()),!M(A))return T(n),e;for(e+=t;M(A);)e+=A,C()}return e}function D(){let e="";for(;M(A)||w.isValidAlpha(A);)e+=A,C();const t=e.charAt(0);return w.isValidAlpha(t)?e:null}function F(e){return A===e?(C(),e):null}Object.defineProperty(w,"name",{value:"Unit"}),w.prototype.constructor=w,w.prototype.type="Unit",w.prototype.isUnit=!0,w.parse=function(e,t){if(t=t||{},N=e,E=-1,A="","string"!=typeof N)throw new TypeError("Invalid argument in Unit.parse, string expected");const r=new w;r.units=[];let i=1,o=!1;C(),S();const a=B();let s=null;if(a){if("BigNumber"===n.number)s=new g(a);else if("Fraction"===n.number)try{s=new y(a)}catch(e){s=parseFloat(a)}else s=parseFloat(a);S(),F("*")?(i=1,o=!0):F("/")&&(i=-1,o=!0)}const u=[];let c=1;for(;;){for(S();"("===A;)u.push(i),c*=i,i=1,C(),S();let t;if(!A)break;{const e=A;if(t=D(),null===t)throw new SyntaxError('Unexpected "'+e+'" in "'+N+'" at index '+E.toString())}const n=O(t);if(null===n)throw new SyntaxError('Unit "'+t+'" not found.');let a=i*c;if(S(),F("^")){S();const t=B();if(null===t)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');a*=t}r.units.push({unit:n.unit,prefix:n.prefix,power:a});for(let e=0;e<z.length;e++)r.dimensions[e]+=(n.unit.dimensions[e]||0)*a;for(S();")"===A;){if(0===u.length)throw new SyntaxError('Unmatched ")" in "'+N+'" at index '+E.toString());c/=u.pop(),C(),S()}if(o=!1,F("*")?(i=1,o=!0):F("/")?(i=-1,o=!0):i=1,n.unit.base){const e=n.unit.base.key;U.auto[e]={unit:n.unit,prefix:n.prefix}}}if(S(),A)throw new SyntaxError('Could not parse: "'+e+'"');if(o)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==u.length)throw new SyntaxError('Unmatched "(" in "'+N+'"');if(0===r.units.length&&!t.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return r.value=void 0!==s?r._normalize(s):null,r},w.prototype.clone=function(){const e=new w;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=ae(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(let t=0;t<this.units.length;t++){e.units[t]={};for(const n in this.units[t])me(this.units[t],n)&&(e.units[t][n]=this.units[t][n])}return e},w.prototype.valueType=function(){return oe(this.value)},w.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},w.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;let t=e;const n=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const r=n(this.units[e].unit.value),i=n(this.units[e].prefix.value),a=n(this.units[e].power);t=o(t,s(o(r,i),a))}return t},w.prototype._denormalize=function(e,t){if(null==e||0===this.units.length)return e;let n=e;const r=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const t=r(this.units[e].unit.value),i=r(this.units[e].prefix.value),u=r(this.units[e].power);n=a(n,s(o(t,i),u))}return n};const O=_l((e=>{if(me(q,e)){const t=q[e];return{unit:t,prefix:t.prefixes[""]}}for(const t in q)if(me(q,t)&&fr(e,t)){const n=q[t],r=e.length-t.length,i=e.substring(0,r),o=me(n.prefixes,i)?n.prefixes[i]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null}),{hasher:e=>e[0],limit:100});function _(e){return e.equalBase(k.NONE)&&null!==e.value&&!n.predictable?e.value:e}w.isValuelessUnit=function(e){return null!==O(e)},w.prototype.hasBase=function(e){if("string"==typeof e&&(e=k[e]),!e)return!1;for(let t=0;t<z.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equalBase=function(e){for(let t=0;t<z.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equals=function(e){return this.equalBase(e)&&f(this.value,e.value)},w.prototype.multiply=function(e){const t=this.clone(),n=v(e)?e:new w(e);for(let e=0;e<z.length;e++)t.dimensions[e]=(this.dimensions[e]||0)+(n.dimensions[e]||0);for(let e=0;e<n.units.length;e++){const r={...n.units[e]};t.units.push(r)}if(null!==this.value||null!==n.value){const e=null===this.value?this._normalize(1):this.value,r=null===n.value?n._normalize(1):n.value;t.value=o(e,r)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.divideInto=function(e){return new w(e).divide(this)},w.prototype.divide=function(e){const t=this.clone(),n=v(e)?e:new w(e);for(let e=0;e<z.length;e++)t.dimensions[e]=(this.dimensions[e]||0)-(n.dimensions[e]||0);for(let e=0;e<n.units.length;e++){const r={...n.units[e],power:-n.units[e].power};t.units.push(r)}if(null!==this.value||null!==n.value){const e=null===this.value?this._normalize(1):this.value,r=null===n.value?n._normalize(1):n.value;t.value=a(e,r)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.pow=function(e){const t=this.clone();for(let n=0;n<z.length;n++)t.dimensions[n]=(this.dimensions[n]||0)*e;for(let n=0;n<t.units.length;n++)t.units[n].power*=e;return null!==t.value?t.value=s(t.value,e):t.value=null,t.skipAutomaticSimplification=!1,_(t)},w.prototype.abs=function(){const e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units.length||0===e.units[0].unit.offset)e.value=u(e.value);else{const t=e._numberConverter(),n=t(e.units[0].unit.value),a=t(e.units[0].unit.offset),s=o(n,a);e.value=i(u(r(e.value,s)),s)}for(const t in e.units)"VA"!==e.units[t].unit.name&&"VAR"!==e.units[t].unit.name||(e.units[t].unit=q.W);return e},w.prototype.to=function(e){const t=null===this.value?this._normalize(1):this.value;let n;if("string"==typeof e)n=w.parse(e);else{if(!v(e))throw new Error("String or Unit expected as parameter");n=e.clone()}if(!this.equalBase(n))throw new Error(`Units do not match ('${n.toString()}' != '${this.toString()}')`);if(null!==n.value)throw new Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||0===this.units.length||0===n.units.length||this.units[0].unit.offset===n.units[0].unit.offset)n.value=ae(t);else{const e=w._getNumberConverter(oe(t)),a=this.units[0].unit.value,s=this.units[0].unit.offset,u=o(a,s),c=n.units[0].unit.value,l=n.units[0].unit.offset,f=o(c,l);n.value=r(t,e(i(u,f)))}return n.fixPrefix=!0,n.skipAutomaticSimplification=!0,n},w.prototype.toNumber=function(e){return b(this.toNumeric(e))},w.prototype.toNumeric=function(e){let t;return t=e?this.to(e):this.clone(),t._isDerived()||0===t.units.length?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},w.prototype.toString=function(){return this.format()},w.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},w.fromJSON=function(e){var t;const n=new w(e.value,null!==(t=e.unit)&&void 0!==t?t:void 0);return n.fixPrefix=e.fixPrefix||!1,n},w.prototype.valueOf=w.prototype.toString,w.prototype.simplify=function(){const e=this.clone(),t=[];let n;for(const t in L)if(me(L,t)&&e.hasBase(k[t])){n=t;break}if("NONE"===n)e.units=[];else{let r;if(n&&me(L,n)&&(r=L[n]),r)e.units=[{unit:r.unit,prefix:r.prefix,power:1}];else{let n=!1;for(let r=0;r<z.length;r++){const i=z[r];Math.abs(e.dimensions[r]||0)>1e-12&&(me(L,i)?t.push({unit:L[i].unit,prefix:L[i].prefix,power:e.dimensions[r]||0}):n=!0)}t.length<e.units.length&&!n&&(e.units=t)}}return e},w.prototype.toSI=function(){const e=this.clone(),t=[];for(let n=0;n<z.length;n++){const r=z[n];if(Math.abs(e.dimensions[n]||0)>1e-12){if(!me(U.si,r))throw new Error("Cannot express custom unit "+r+" in SI units");t.push({unit:U.si[r].unit,prefix:U.si[r].prefix,power:e.dimensions[n]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value?(e.value=null,this.to(e)):e},w.prototype.formatUnits=function(){let e="",t="",n=0,r=0;for(let t=0;t<this.units.length;t++)this.units[t].power>0?(n++,e+=" "+this.units[t].prefix.name+this.units[t].unit.name,Math.abs(this.units[t].power-1)>1e-15&&(e+="^"+this.units[t].power)):this.units[t].power<0&&r++;if(r>0)for(let e=0;e<this.units.length;e++)this.units[e].power<0&&(n>0?(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,Math.abs(this.units[e].power+1)>1e-15&&(t+="^"+-this.units[e].power)):(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,t+="^"+this.units[e].power));e=e.substr(1),t=t.substr(1),n>1&&r>0&&(e="("+e+")"),r>1&&n>0&&(t="("+t+")");let i=e;return n>0&&r>0&&(i+=" / "),i+=t,i},w.prototype.format=function(e){const t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify();let n=!1;void 0!==t.value&&null!==t.value&&x(t.value)&&(n=Math.abs(t.value.re)<1e-14);for(const e in t.units)me(t.units,e)&&t.units[e].unit&&("VA"===t.units[e].unit.name&&n?t.units[e].unit=q.VAR:"VAR"!==t.units[e].unit.name||n||(t.units[e].unit=q.VA));1!==t.units.length||t.fixPrefix||Math.abs(t.units[0].power-Math.round(t.units[0].power))<1e-14&&(t.units[0].prefix=t._bestPrefix());const r=t._denormalize(t.value);let i=null!==t.value?m(r,e||{}):"";const o=t.formatUnits();return t.value&&x(t.value)&&(i="("+i+")"),o.length>0&&i.length>0&&(i+=" "),i+=o,i},w.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");const e=null!==this.value?u(this.value):0,t=u(this.units[0].unit.value);let n=this.units[0].prefix;if(0===e)return n;const r=this.units[0].power;let i=Math.log(e/Math.pow(n.value*t,r))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return n;i=Math.abs(i);const o=this.units[0].unit.prefixes;for(const a in o)if(me(o,a)){const s=o[a];if(s.scientific){const o=Math.abs(Math.log(e/Math.pow(s.value*t,r))/Math.LN10-1.2);(o<i||o===i&&s.name.length<n.name.length)&&(n=s,i=o)}}return n},w.prototype.splitUnit=function(e){let t=this.clone();const n=[];for(let r=0;r<e.length&&(t=t.to(e[r]),r!==e.length-1);r++){const o=t.toNumeric(),a=l(o);let s;s=f(a,o)?a:c(t.toNumeric());const u=new w(s,e[r].toString());n.push(u),t=i(t,u)}let o=0;for(let e=0;e<n.length;e++)o=r(o,n[e].value);return f(o,this.value)&&(t.value=0),n.push(t),n};const I={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},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:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),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:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};I.SHORTLONG=sr({},I.SHORT,I.LONG),I.BINARY_SHORT=sr({},I.BINARY_SHORT_SI,I.BINARY_SHORT_IEC),I.BINARY_LONG=sr({},I.BINARY_LONG_SI,I.BINARY_LONG_IEC);const z=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],k={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(const e in k)me(k,e)&&(k[e].key=e);const R={name:"",base:{},value:1,offset:0,dimensions:z.map((e=>0))},q={meter:{name:"meter",base:k.LENGTH,prefixes:I.LONG,value:1,offset:0},inch:{name:"inch",base:k.LENGTH,prefixes:I.NONE,value:.0254,offset:0},foot:{name:"foot",base:k.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yard:{name:"yard",base:k.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mile:{name:"mile",base:k.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},link:{name:"link",base:k.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rod:{name:"rod",base:k.LENGTH,prefixes:I.NONE,value:5.0292,offset:0},chain:{name:"chain",base:k.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:k.LENGTH,prefixes:I.NONE,value:1e-10,offset:0},m:{name:"m",base:k.LENGTH,prefixes:I.SHORT,value:1,offset:0},in:{name:"in",base:k.LENGTH,prefixes:I.NONE,value:.0254,offset:0},ft:{name:"ft",base:k.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yd:{name:"yd",base:k.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mi:{name:"mi",base:k.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},li:{name:"li",base:k.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rd:{name:"rd",base:k.LENGTH,prefixes:I.NONE,value:5.02921,offset:0},ch:{name:"ch",base:k.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},mil:{name:"mil",base:k.LENGTH,prefixes:I.NONE,value:254e-7,offset:0},m2:{name:"m2",base:k.SURFACE,prefixes:I.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:k.SURFACE,prefixes:I.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:k.SURFACE,prefixes:I.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:k.SURFACE,prefixes:I.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:k.SURFACE,prefixes:I.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:k.SURFACE,prefixes:I.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:k.SURFACE,prefixes:I.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:k.SURFACE,prefixes:I.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:k.SURFACE,prefixes:I.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:k.SURFACE,prefixes:I.NONE,value:1e4,offset:0},m3:{name:"m3",base:k.VOLUME,prefixes:I.CUBIC,value:1,offset:0},L:{name:"L",base:k.VOLUME,prefixes:I.SHORT,value:.001,offset:0},l:{name:"l",base:k.VOLUME,prefixes:I.SHORT,value:.001,offset:0},litre:{name:"litre",base:k.VOLUME,prefixes:I.LONG,value:.001,offset:0},cuin:{name:"cuin",base:k.VOLUME,prefixes:I.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:k.VOLUME,prefixes:I.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:k.VOLUME,prefixes:I.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:k.VOLUME,prefixes:I.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:k.VOLUME,prefixes:I.NONE,value:15e-6,offset:0},drop:{name:"drop",base:k.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:k.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},minim:{name:"minim",base:k.VOLUME,prefixes:I.NONE,value:6.1611519921875e-8,offset:0},fluiddram:{name:"fluiddram",base:k.VOLUME,prefixes:I.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:k.VOLUME,prefixes:I.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:k.VOLUME,prefixes:I.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:k.VOLUME,prefixes:I.NONE,value:1e-6,offset:0},cup:{name:"cup",base:k.VOLUME,prefixes:I.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:k.VOLUME,prefixes:I.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:k.VOLUME,prefixes:I.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:k.VOLUME,prefixes:I.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:k.VOLUME,prefixes:I.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:k.VOLUME,prefixes:I.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:k.VOLUME,prefixes:I.NONE,value:.238480942392,offset:0},g:{name:"g",base:k.MASS,prefixes:I.SHORT,value:.001,offset:0},gram:{name:"gram",base:k.MASS,prefixes:I.LONG,value:.001,offset:0},ton:{name:"ton",base:k.MASS,prefixes:I.SHORT,value:907.18474,offset:0},t:{name:"t",base:k.MASS,prefixes:I.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:k.MASS,prefixes:I.LONG,value:1e3,offset:0},grain:{name:"grain",base:k.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:k.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:k.MASS,prefixes:I.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:k.MASS,prefixes:I.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:k.MASS,prefixes:I.NONE,value:45.359237,offset:0},stick:{name:"stick",base:k.MASS,prefixes:I.NONE,value:.115,offset:0},stone:{name:"stone",base:k.MASS,prefixes:I.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:k.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:k.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:k.MASS,prefixes:I.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:k.MASS,prefixes:I.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:k.MASS,prefixes:I.NONE,value:45.359237,offset:0},s:{name:"s",base:k.TIME,prefixes:I.SHORT,value:1,offset:0},min:{name:"min",base:k.TIME,prefixes:I.NONE,value:60,offset:0},h:{name:"h",base:k.TIME,prefixes:I.NONE,value:3600,offset:0},second:{name:"second",base:k.TIME,prefixes:I.LONG,value:1,offset:0},sec:{name:"sec",base:k.TIME,prefixes:I.LONG,value:1,offset:0},minute:{name:"minute",base:k.TIME,prefixes:I.NONE,value:60,offset:0},hour:{name:"hour",base:k.TIME,prefixes:I.NONE,value:3600,offset:0},day:{name:"day",base:k.TIME,prefixes:I.NONE,value:86400,offset:0},week:{name:"week",base:k.TIME,prefixes:I.NONE,value:604800,offset:0},month:{name:"month",base:k.TIME,prefixes:I.NONE,value:2629800,offset:0},year:{name:"year",base:k.TIME,prefixes:I.NONE,value:31557600,offset:0},decade:{name:"decade",base:k.TIME,prefixes:I.NONE,value:315576e3,offset:0},century:{name:"century",base:k.TIME,prefixes:I.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:k.TIME,prefixes:I.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:k.FREQUENCY,prefixes:I.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:k.FREQUENCY,prefixes:I.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:k.ANGLE,prefixes:I.SHORT,value:1,offset:0},radian:{name:"radian",base:k.ANGLE,prefixes:I.LONG,value:1,offset:0},deg:{name:"deg",base:k.ANGLE,prefixes:I.SHORT,value:null,offset:0},degree:{name:"degree",base:k.ANGLE,prefixes:I.LONG,value:null,offset:0},grad:{name:"grad",base:k.ANGLE,prefixes:I.SHORT,value:null,offset:0},gradian:{name:"gradian",base:k.ANGLE,prefixes:I.LONG,value:null,offset:0},cycle:{name:"cycle",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},A:{name:"A",base:k.CURRENT,prefixes:I.SHORT,value:1,offset:0},ampere:{name:"ampere",base:k.CURRENT,prefixes:I.LONG,value:1,offset:0},K:{name:"K",base:k.TEMPERATURE,prefixes:I.SHORT,value:1,offset:0},degC:{name:"degC",base:k.TEMPERATURE,prefixes:I.SHORT,value:1,offset:273.15},degF:{name:"degF",base:k.TEMPERATURE,prefixes:I.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:k.TEMPERATURE,prefixes:I.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:k.TEMPERATURE,prefixes:I.LONG,value:1,offset:0},celsius:{name:"celsius",base:k.TEMPERATURE,prefixes:I.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:k.TEMPERATURE,prefixes:I.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:k.TEMPERATURE,prefixes:I.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:k.AMOUNT_OF_SUBSTANCE,prefixes:I.SHORT,value:1,offset:0},mole:{name:"mole",base:k.AMOUNT_OF_SUBSTANCE,prefixes:I.LONG,value:1,offset:0},cd:{name:"cd",base:k.LUMINOUS_INTENSITY,prefixes:I.SHORT,value:1,offset:0},candela:{name:"candela",base:k.LUMINOUS_INTENSITY,prefixes:I.LONG,value:1,offset:0},N:{name:"N",base:k.FORCE,prefixes:I.SHORT,value:1,offset:0},newton:{name:"newton",base:k.FORCE,prefixes:I.LONG,value:1,offset:0},dyn:{name:"dyn",base:k.FORCE,prefixes:I.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:k.FORCE,prefixes:I.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:k.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:k.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:k.FORCE,prefixes:I.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:k.FORCE,prefixes:I.NONE,value:9.80665,offset:0},J:{name:"J",base:k.ENERGY,prefixes:I.SHORT,value:1,offset:0},joule:{name:"joule",base:k.ENERGY,prefixes:I.LONG,value:1,offset:0},erg:{name:"erg",base:k.ENERGY,prefixes:I.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:k.ENERGY,prefixes:I.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:k.ENERGY,prefixes:I.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:k.ENERGY,prefixes:I.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:k.ENERGY,prefixes:I.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:k.POWER,prefixes:I.SHORT,value:1,offset:0},watt:{name:"watt",base:k.POWER,prefixes:I.LONG,value:1,offset:0},hp:{name:"hp",base:k.POWER,prefixes:I.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:k.POWER,prefixes:I.SHORT,value:d.I,offset:0},VA:{name:"VA",base:k.POWER,prefixes:I.SHORT,value:1,offset:0},Pa:{name:"Pa",base:k.PRESSURE,prefixes:I.SHORT,value:1,offset:0},psi:{name:"psi",base:k.PRESSURE,prefixes:I.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:k.PRESSURE,prefixes:I.NONE,value:101325,offset:0},bar:{name:"bar",base:k.PRESSURE,prefixes:I.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:k.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:k.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:k.PRESSURE,prefixes:I.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:k.PRESSURE,prefixes:I.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:k.ELECTRIC_CHARGE,prefixes:I.LONG,value:1,offset:0},C:{name:"C",base:k.ELECTRIC_CHARGE,prefixes:I.SHORT,value:1,offset:0},farad:{name:"farad",base:k.ELECTRIC_CAPACITANCE,prefixes:I.LONG,value:1,offset:0},F:{name:"F",base:k.ELECTRIC_CAPACITANCE,prefixes:I.SHORT,value:1,offset:0},volt:{name:"volt",base:k.ELECTRIC_POTENTIAL,prefixes:I.LONG,value:1,offset:0},V:{name:"V",base:k.ELECTRIC_POTENTIAL,prefixes:I.SHORT,value:1,offset:0},ohm:{name:"ohm",base:k.ELECTRIC_RESISTANCE,prefixes:I.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:k.ELECTRIC_INDUCTANCE,prefixes:I.LONG,value:1,offset:0},H:{name:"H",base:k.ELECTRIC_INDUCTANCE,prefixes:I.SHORT,value:1,offset:0},siemens:{name:"siemens",base:k.ELECTRIC_CONDUCTANCE,prefixes:I.LONG,value:1,offset:0},S:{name:"S",base:k.ELECTRIC_CONDUCTANCE,prefixes:I.SHORT,value:1,offset:0},weber:{name:"weber",base:k.MAGNETIC_FLUX,prefixes:I.LONG,value:1,offset:0},Wb:{name:"Wb",base:k.MAGNETIC_FLUX,prefixes:I.SHORT,value:1,offset:0},tesla:{name:"tesla",base:k.MAGNETIC_FLUX_DENSITY,prefixes:I.LONG,value:1,offset:0},T:{name:"T",base:k.MAGNETIC_FLUX_DENSITY,prefixes:I.SHORT,value:1,offset:0},b:{name:"b",base:k.BIT,prefixes:I.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:k.BIT,prefixes:I.BINARY_LONG,value:1,offset:0},B:{name:"B",base:k.BIT,prefixes:I.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:k.BIT,prefixes:I.BINARY_LONG,value:8,offset:0}},P={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 j(e){if("BigNumber"===e.number){const e=kl(g);q.rad.value=new g(1),q.deg.value=e.div(180),q.grad.value=e.div(200),q.cycle.value=e.times(2),q.arcsec.value=e.div(648e3),q.arcmin.value=e.div(10800)}else q.rad.value=1,q.deg.value=Math.PI/180,q.grad.value=Math.PI/200,q.cycle.value=2*Math.PI,q.arcsec.value=Math.PI/648e3,q.arcmin.value=Math.PI/10800;q.radian.value=q.rad.value,q.degree.value=q.deg.value,q.gradian.value=q.grad.value}j(n),t&&t("config",(function(e,t){e.number!==t.number&&j(e)}));const U={si:{NONE:{unit:R,prefix:I.NONE[""]},LENGTH:{unit:q.m,prefix:I.SHORT[""]},MASS:{unit:q.g,prefix:I.SHORT.k},TIME:{unit:q.s,prefix:I.SHORT[""]},CURRENT:{unit:q.A,prefix:I.SHORT[""]},TEMPERATURE:{unit:q.K,prefix:I.SHORT[""]},LUMINOUS_INTENSITY:{unit:q.cd,prefix:I.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:q.mol,prefix:I.SHORT[""]},ANGLE:{unit:q.rad,prefix:I.SHORT[""]},BIT:{unit:q.bits,prefix:I.SHORT[""]},FORCE:{unit:q.N,prefix:I.SHORT[""]},ENERGY:{unit:q.J,prefix:I.SHORT[""]},POWER:{unit:q.W,prefix:I.SHORT[""]},PRESSURE:{unit:q.Pa,prefix:I.SHORT[""]},ELECTRIC_CHARGE:{unit:q.C,prefix:I.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:q.F,prefix:I.SHORT[""]},ELECTRIC_POTENTIAL:{unit:q.V,prefix:I.SHORT[""]},ELECTRIC_RESISTANCE:{unit:q.ohm,prefix:I.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:q.H,prefix:I.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:q.S,prefix:I.SHORT[""]},MAGNETIC_FLUX:{unit:q.Wb,prefix:I.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:q.T,prefix:I.SHORT[""]},FREQUENCY:{unit:q.Hz,prefix:I.SHORT[""]}}};U.cgs=JSON.parse(JSON.stringify(U.si)),U.cgs.LENGTH={unit:q.m,prefix:I.SHORT.c},U.cgs.MASS={unit:q.g,prefix:I.SHORT[""]},U.cgs.FORCE={unit:q.dyn,prefix:I.SHORT[""]},U.cgs.ENERGY={unit:q.erg,prefix:I.NONE[""]},U.us=JSON.parse(JSON.stringify(U.si)),U.us.LENGTH={unit:q.ft,prefix:I.NONE[""]},U.us.MASS={unit:q.lbm,prefix:I.NONE[""]},U.us.TEMPERATURE={unit:q.degF,prefix:I.NONE[""]},U.us.FORCE={unit:q.lbf,prefix:I.NONE[""]},U.us.ENERGY={unit:q.BTU,prefix:I.BTU[""]},U.us.POWER={unit:q.hp,prefix:I.NONE[""]},U.us.PRESSURE={unit:q.psi,prefix:I.NONE[""]},U.auto=JSON.parse(JSON.stringify(U.si));let L=U.auto;w.setUnitSystem=function(e){if(!me(U,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(U).join(", "));L=U[e]},w.getUnitSystem=function(){for(const e in U)if(me(U,e)&&U[e]===L)return e},w.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new g(String(e.n)).div(String(e.d)).times(String(e.s)):new g(e+"")},Fraction:function(e){return new y(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?h(e):e}},w.prototype._numberConverter=function(){const e=w.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},w._getNumberConverter=function(e){if(!w.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return w.typeConverters[e]};for(const e in q)if(me(q,e)){const t=q[e];t.dimensions=t.base.dimensions}for(const e in P)if(me(P,e)){const t=q[P[e]],n={};for(const e in t)me(t,e)&&(n[e]=t[e]);n.name=e,q[e]=n}return w.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},w.createUnit=function(e,t){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(const t in e)if(me(e,t)&&w.deleteUnit(t),e[t].aliases)for(let n=0;n<e[t].aliases.length;n++)w.deleteUnit(e[t].aliases[n]);let n;for(const t in e)me(e,t)&&(n=w.createUnitSingle(t,e[t]));return n},w.createUnitSingle=function(e,t){if(null==t&&(t={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(me(q,e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(let t=0;t<e.length;t++){if(A=e.charAt(t),0===t&&!w.isValidAlpha(A))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!w.isValidAlpha(A)&&!M(A))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);let n,r,i,o=null,a=[],s=0;if(t&&"Unit"===t.type)o=t.clone();else if("string"==typeof t)""!==t&&(n=t);else{if("object"!=typeof t)throw new TypeError('Cannot create unit "'+e+'" from "'+t.toString()+'": expecting "string" or "Unit" or "Object"');n=t.definition,r=t.prefixes,s=t.offset,i=t.baseName,t.aliases&&(a=t.aliases.valueOf())}if(a)for(let e=0;e<a.length;e++)if(me(q,a[e]))throw new Error('Cannot create alias "'+a[e]+'": a unit with that name already exists');if(n&&"string"==typeof n&&!o)try{o=w.parse(n,{allowNoUnits:!0})}catch(t){throw t.message='Could not create unit "'+e+'" from "'+n+'": '+t.message,t}else n&&"Unit"===n.type&&(o=n.clone());a=a||[],s=s||0,r=r&&r.toUpperCase&&I[r.toUpperCase()]||I.NONE;let u={};if(o){u={name:e,value:o.value,dimensions:o.dimensions.slice(0),prefixes:r,offset:s};let t=!1;for(const e in k)if(me(k,e)){let n=!0;for(let t=0;t<z.length;t++)if(Math.abs((u.dimensions[t]||0)-(k[e].dimensions[t]||0))>1e-12){n=!1;break}if(n){t=!0,u.base=k[e];break}}if(!t){i=i||e+"_STUFF";const t={dimensions:o.dimensions.slice(0)};t.key=i,k[i]=t,L[i]={unit:u,prefix:I.NONE[""]},u.base=k[i]}}else{if(i=i||e+"_STUFF",z.indexOf(i)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');z.push(i);for(const e in k)me(k,e)&&(k[e].dimensions[z.length-1]=0);const t={dimensions:[]};for(let e=0;e<z.length;e++)t.dimensions[e]=0;t.dimensions[z.length-1]=1,t.key=i,k[i]=t,u={name:e,value:1,dimensions:k[i].dimensions.slice(0),prefixes:r,offset:s,base:k[i]},L[i]={unit:u,prefix:I.NONE[""]}}w.UNITS[e]=u;for(let e=0;e<a.length;e++){const t=a[e],n={};for(const e in u)me(u,e)&&(n[e]=u[e]);n.name=t,w.UNITS[t]=n}return delete O.cache,new w(null,e)},w.deleteUnit=function(e){delete w.UNITS[e],delete O.cache},w.PREFIXES=I,w.BASE_DIMENSIONS=z,w.BASE_UNITS=k,w.UNIT_SYSTEMS=U,w.UNITS=q,w}),{isClass:!0}),jl="unit",Ul=he(jl,["typed","Unit"],(e=>{let{typed:t,Unit:n}=e;return t(jl,{Unit:function(e){return e.clone()},string:function(e){return n.isValuelessUnit(e)?new n(null,e):n.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new n(e,t)},"number | BigNumber | Fraction":function(e){return new n(e)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ll="sparse",$l=he(Ll,["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:n}=e;return t(Ll,{"":function(){return new n([])},string:function(e){return new n([],e)},"Array | Matrix":function(e){return new n(e)},"Array | Matrix, string":function(e,t){return new n(e,t)}})})),Hl="createUnit",Gl=he(Hl,["typed","Unit"],(e=>{let{typed:t,Unit:n}=e;return t(Hl,{"Object, Object":function(e,t){return n.createUnit(e,t)},Object:function(e){return n.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,r){const i={};return i[e]=t,n.createUnit(i,r)},"string, Unit | string | Object":function(e,t){const r={};return r[e]=t,n.createUnit(r,{})},string:function(e){const t={};return t[e]={},n.createUnit(t,{})}})})),Vl="acos",Zl=he(Vl,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Vl,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.acos(e):new r(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),Wl="number";function Yl(e){return Ie(e)}function Jl(e){return Math.atan(1/e)}function Xl(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function Ql(e){return Math.asin(1/e)}function Kl(e){const t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function ef(e){return Math.acos(1/e)}function tf(e){const t=1/e,n=Math.sqrt(t*t-1);return Math.log(n+t)}function nf(e){return ze(e)}function rf(e){return ke(e)}function of(e){return 1/Math.tan(e)}function af(e){const t=Math.exp(2*e);return(t+1)/(t-1)}function sf(e){return 1/Math.sin(e)}function uf(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*be(e)}function cf(e){return 1/Math.cos(e)}function lf(e){return 2/(Math.exp(e)+Math.exp(-e))}function ff(e){return qe(e)}Yl.signature=Wl,Jl.signature=Wl,Xl.signature=Wl,Ql.signature=Wl,Kl.signature=Wl,ef.signature=Wl,tf.signature=Wl,nf.signature=Wl,rf.signature=Wl,of.signature=Wl,af.signature=Wl,sf.signature=Wl,uf.signature=Wl,cf.signature=Wl,lf.signature=Wl,ff.signature=Wl;const pf="acosh",mf=he(pf,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(pf,{number:function(e){return e>=1||n.predictable?Yl(e):e<=-1?new r(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new r(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})})),hf="acot",df=he(hf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(hf,{number:Jl,Complex:function(e){return e.acot()},BigNumber:function(e){return new n(1).div(e).atan()}})})),gf="acoth",yf=he(gf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(gf,{number:function(e){return e>=1||e<=-1||n.predictable?Xl(e):new r(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),xf="acsc",bf=he(xf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(xf,{number:function(e){return e<=-1||e>=1||n.predictable?Ql(e):new r(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),vf="acsch",wf=he(vf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(vf,{number:Kl,Complex:function(e){return e.acsch()},BigNumber:function(e){return new n(1).div(e).asinh()}})})),Nf="asec",Ef=he(Nf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Nf,{number:function(e){return e<=-1||e>=1||n.predictable?ef(e):new r(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),Af="asech",Sf=he(Af,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Af,{number:function(e){if(e<=1&&e>=-1||n.predictable){const t=1/e;if(t>0||n.predictable)return tf(e);const i=Math.sqrt(t*t-1);return new r(Math.log(i-t),Math.PI)}return new r(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),Mf="asin",Cf=he(Mf,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Mf,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.asin(e):new r(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),Tf=he("asinh",["typed"],(e=>{let{typed:t}=e;return t("asinh",{number:nf,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),Bf=he("atan",["typed"],(e=>{let{typed:t}=e;return t("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),Df="atan2",Ff=he(Df,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,BigNumber:i,DenseMatrix:o,concat:a}=e;const s=ra({typed:t,equalScalar:r}),u=ia({typed:t}),c=$a({typed:t,equalScalar:r}),l=zo({typed:t,equalScalar:r}),f=ko({typed:t,DenseMatrix:o}),p=ua({typed:t,matrix:n,concat:a});return t(Df,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,t)=>i.atan2(e,t)},p({scalar:"number | BigNumber",SS:c,DS:u,SD:s,Ss:l,sS:f}))})),Of="atanh",_f=he(Of,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Of,{number:function(e){return e<=1&&e>=-1||n.predictable?rf(e):new r(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),If=he("trigUnit",["typed"],(e=>{let{typed:t}=e;return{Unit:t.referToSelf((e=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(e,n.valueType())(n.value)}))}})),zf=he("cos",["typed"],(e=>{let{typed:t}=e;const n=If({typed:t});return t("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},n)})),kf="cosh",Rf=he(kf,["typed"],(e=>{let{typed:t}=e;return t(kf,{number:Re,"Complex | BigNumber":e=>e.cosh()})})),qf=he("cot",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("cot",{number:of,Complex:e=>e.cot(),BigNumber:e=>new n(1).div(e.tan())},If({typed:t}))})),Pf="coth",jf=he(Pf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Pf,{number:af,Complex:e=>e.coth(),BigNumber:e=>new n(1).div(e.tanh())})})),Uf=he("csc",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("csc",{number:sf,Complex:e=>e.csc(),BigNumber:e=>new n(1).div(e.sin())},If({typed:t}))})),Lf="csch",$f=he(Lf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Lf,{number:uf,Complex:e=>e.csch(),BigNumber:e=>new n(1).div(e.sinh())})})),Hf=he("sec",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("sec",{number:cf,Complex:e=>e.sec(),BigNumber:e=>new n(1).div(e.cos())},If({typed:t}))})),Gf="sech",Vf=he(Gf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Gf,{number:lf,Complex:e=>e.sech(),BigNumber:e=>new n(1).div(e.cosh())})})),Zf=he("sin",["typed"],(e=>{let{typed:t}=e;const n=If({typed:t});return t("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},n)})),Wf="sinh",Yf=he(Wf,["typed"],(e=>{let{typed:t}=e;return t(Wf,{number:ff,"Complex | BigNumber":e=>e.sinh()})})),Jf=he("tan",["typed"],(e=>{let{typed:t}=e;const n=If({typed:t});return t("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},n)})),Xf=he("tanh",["typed"],(e=>{let{typed:t}=e;return t("tanh",{number:Pe,"Complex | BigNumber":e=>e.tanh()})})),Qf="setCartesian",Kf=he(Qf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Qf,{"Array | Matrix, Array | Matrix":function(e,t){let s=[];if(0!==r(n(e),new o(0))&&0!==r(n(t),new o(0))){const n=zr(Array.isArray(e)?e:e.toArray()).sort(i),r=zr(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)s.push([n[e],r[t]])}return Array.isArray(e)&&Array.isArray(t)?s:new a(s)}})})),ep="setDifference",tp=he(ep,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(ep,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===r(n(e),new o(0)))s=[];else{if(0===r(n(t),new o(0)))return zr(e.toArray());{const n=jr(zr(Array.isArray(e)?e:e.toArray()).sort(i)),r=jr(zr(Array.isArray(t)?t:t.toArray()).sort(i));let o;s=[];for(let e=0;e<n.length;e++){o=!1;for(let t=0;t<r.length;t++)if(0===i(n[e].value,r[t].value)&&n[e].identifier===r[t].identifier){o=!0;break}o||s.push(n[e])}}}return Array.isArray(e)&&Array.isArray(t)?Ur(s):new a(Ur(s))}})})),np="setDistinct",rp=he(np,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(np,{"Array | Matrix":function(e){let t;if(0===r(n(e),new o(0)))t=[];else{const n=zr(Array.isArray(e)?e:e.toArray()).sort(i);t=[],t.push(n[0]);for(let e=1;e<n.length;e++)0!==i(n[e],n[e-1])&&t.push(n[e])}return Array.isArray(e)?t:new a(t)}})})),ip="setIntersect",op=he(ip,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(ip,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===r(n(e),new o(0))||0===r(n(t),new o(0)))s=[];else{const n=jr(zr(Array.isArray(e)?e:e.toArray()).sort(i)),r=jr(zr(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)if(0===i(n[e].value,r[t].value)&&n[e].identifier===r[t].identifier){s.push(n[e]);break}}return Array.isArray(e)&&Array.isArray(t)?Ur(s):new a(Ur(s))}})})),ap="setIsSubset",sp=he(ap,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(ap,{"Array | Matrix, Array | Matrix":function(e,t){if(0===r(n(e),new o(0)))return!0;if(0===r(n(t),new o(0)))return!1;const a=jr(zr(Array.isArray(e)?e:e.toArray()).sort(i)),s=jr(zr(Array.isArray(t)?t:t.toArray()).sort(i));let u;for(let e=0;e<a.length;e++){u=!1;for(let t=0;t<s.length;t++)if(0===i(a[e].value,s[t].value)&&a[e].identifier===s[t].identifier){u=!0;break}if(!1===u)return!1}return!0}})})),up="setMultiplicity",cp=he(up,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(up,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===r(n(t),new o(0)))return 0;const a=zr(Array.isArray(t)?t:t.toArray());let s=0;for(let t=0;t<a.length;t++)0===i(a[t],e)&&s++;return s}})})),lp="setPowerset",fp=he(lp,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(lp,{"Array | Matrix":function(e){if(0===r(n(e),new o(0)))return[];const t=zr(Array.isArray(e)?e:e.toArray()).sort(i),s=[];let u=0;for(;u.toString(2).length<=t.length;)s.push(a(t,u.toString(2).split("").reverse())),u++;return function(e){let t=[];for(let n=e.length-1;n>0;n--)for(let r=0;r<n;r++)e[r].length>e[r+1].length&&(t=e[r],e[r]=e[r+1],e[r+1]=t);return e}(s)}});function a(e,t){const n=[];for(let r=0;r<t.length;r++)"1"===t[r]&&n.push(e[r]);return n}})),pp="setSize",mp=he(pp,["typed","compareNatural"],(e=>{let{typed:t,compareNatural:n}=e;return t(pp,{"Array | Matrix":function(e){return Array.isArray(e)?zr(e).length:zr(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return Array.isArray(e)?zr(e).length:zr(e.toArray()).length;{const t=zr(Array.isArray(e)?e:e.toArray()).sort(n);let r=1;for(let e=1;e<t.length;e++)0!==n(t[e],t[e-1])&&r++;return r}}})})),hp="setSymDifference",dp=he(hp,["typed","size","concat","subset","setDifference","Index"],(e=>{let{typed:t,size:n,concat:r,subset:i,setDifference:o,Index:a}=e;return t(hp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(n(e),new a(0)))return zr(t);if(0===i(n(t),new a(0)))return zr(e);const s=zr(e),u=zr(t);return r(o(s,u),o(u,s))}})})),gp="setUnion",yp=he(gp,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],(e=>{let{typed:t,size:n,concat:r,subset:i,setIntersect:o,setSymDifference:a,Index:s}=e;return t(gp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(n(e),new s(0)))return zr(t);if(0===i(n(t),new s(0)))return zr(e);const u=zr(e),c=zr(t);return r(a(u,c),o(u,c))}})})),xp=he("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],(e=>{let{typed:t,matrix:n,addScalar:r,equalScalar:i,DenseMatrix:o,SparseMatrix:a,concat:s}=e;const u=la({typed:t}),c=fa({typed:t,equalScalar:i}),l=pa({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:n,concat:s});return t("add",{"any, any":r,"any, any, ...any":t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i}))},f({elop:r,DS:u,SS:c,Ss:l}))})),bp="hypot",vp=he(bp,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],(e=>{let{typed:t,abs:n,addScalar:r,divideScalar:i,multiplyScalar:o,sqrt:a,smaller:s,isPositive:u}=e;return t(bp,{"... number | BigNumber":c,Array:c,Matrix:e=>c(zr(e.toArray()))});function c(e){let t=0,c=0;for(let a=0;a<e.length;a++){if(x(e[a]))throw new TypeError("Unexpected type of argument to hypot");const l=n(e[a]);s(c,l)?(t=o(t,o(i(c,l),i(c,l))),t=r(t,1),c=l):t=r(t,u(l)?o(i(l,c),i(l,c)):l)}return o(c,a(t))}})),wp="norm",Np=he(wp,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],(e=>{let{typed:t,abs:n,add:r,pow:i,conj:o,sqrt:a,multiply:s,equalScalar:u,larger:c,smaller:l,matrix:f,ctranspose:p,eigs:m}=e;return t(wp,{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,t){return h(f(e),t)},"Matrix, number | BigNumber | string":function(e,t){return h(e,t)}});function h(e,t){const f=e.size();if(1===f.length)return function(e,t){if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){let t=0;return e.forEach((function(e){const r=n(e);c(r,t)&&(t=r)}),!0),t}(e);if(t===Number.NEGATIVE_INFINITY||"-inf"===t)return function(e){let t;return e.forEach((function(e){const r=n(e);t&&!l(r,t)||(t=r)}),!0),t||0}(e);if("fro"===t)return h(e,2);if("number"==typeof t&&!isNaN(t)){if(!u(t,0)){let o=0;return e.forEach((function(e){o=r(i(n(e),t),o)}),!0),i(o,1/t)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}(e,t);if(2===f.length){if(f[0]&&f[1])return function(e,t){if(1===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[1],s=r(t[a]||0,n(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[0],s=r(t[a]||0,n(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if("fro"===t)return function(e){let t=0;return e.forEach((function(e,n){t=r(t,s(e,o(e)))})),n(a(t))}(e);if(2===t)return function(e){const t=e.size();if(t[0]!==t[1])throw new RangeError("Invalid matrix dimensions");const r=p(e),i=s(r,e),o=m(i).values.toArray(),u=o[o.length-1];return n(a(u))}(e);throw new Error("Unsupported parameter value "+t)}(e,t);throw new RangeError("Invalid matrix dimensions")}}})),Ep=he("dot",["typed","addScalar","multiplyScalar","conj","size"],(e=>{let{typed:t,addScalar:n,multiplyScalar:r,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){const u=a(e,o),c=E(e)?e._data:e,l=E(e)?e._datatype||e.getDataType():void 0,f=E(o)?o._data:o,p=E(o)?o._datatype||o.getDataType():void 0,m=2===s(e).length,h=2===s(o).length;let d=n,g=r;if(l&&p&&l===p&&"string"==typeof l&&"mixed"!==l){const e=l;d=t.find(n,[e,e]),g=t.find(r,[e,e])}if(!m&&!h){let e=g(i(c[0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t]));return e}if(!m&&h){let e=g(i(c[0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t][0]));return e}if(m&&!h){let e=g(i(c[0][0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t]));return e}if(m&&h){let e=g(i(c[0][0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t][0]));return e}},"SparseMatrix, SparseMatrix":function(e,t){a(e,t);const i=e._index,o=e._values,s=t._index,u=t._values;let c=0;const l=n,f=r;let p=0,m=0;for(;p<i.length&&m<s.length;){const e=i[p],t=s[m];e<t?p++:e>t?m++:e===t&&(c=l(c,f(o[p],u[m])),p++,m++)}return c}});function a(e,t){const n=s(e),r=s(t);let i,o;if(1===n.length)i=n[0];else{if(2!==n.length||1!==n[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+n.join(", ")+")");i=n[0]}if(1===r.length)o=r[0];else{if(2!==r.length||1!==r[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+r.join(", ")+")");o=r[0]}if(i!==o)throw new RangeError("Vectors must have equal length ("+i+" != "+o+")");if(0===i)throw new RangeError("Cannot calculate the dot product of empty vectors");return i}function s(e){return E(e)?e.size():o(e)}})),Ap=he("trace",["typed","matrix","add"],(e=>{let{typed:t,matrix:n,add:r}=e;return t("trace",{Array:function(e){return i(n(e))},SparseMatrix:function(e){const t=e._values,n=e._index,i=e._ptr,o=e._size,a=o[0],s=o[1];if(a===s){let e=0;if(t.length>0)for(let o=0;o<s;o++){const a=i[o],s=i[o+1];for(let i=a;i<s;i++){const a=n[i];if(a===o){e=r(e,t[i]);break}if(a>o)break}}return e}throw new RangeError("Matrix must be square (size: "+pr(o)+")")},DenseMatrix:i,any:ae});function i(e){const t=e._size,n=e._data;switch(t.length){case 1:if(1===t[0])return ae(n[0]);throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const e=t[0];if(e===t[1]){let t=0;for(let i=0;i<e;i++)t=r(t,n[i][i]);return t}throw new RangeError("Matrix must be square (size: "+pr(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}}})),Sp="index",Mp=he(Sp,["typed","Index"],(e=>{let{typed:t,Index:n}=e;return t(Sp,{"...number | string | BigNumber | Range | Array | Matrix":function(e){const t=e.map((function(e){return g(e)?e.toNumber():N(e)||E(e)?e.map((function(e){return g(e)?e.toNumber():e})):e})),r=new n;return n.apply(r,t),r}})})),Cp=new Set(["end"]),Tp=he("Node",["mathWithTransform"],(e=>{let{mathWithTransform:t}=e;return class{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){const e=this._compile(t,{}),n={};return{evaluate:function(t){const r=h(t);return function(e){for(const t of[...Cp])if(e.has(t))throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(r),e(r,n,null)}}}_compile(e,t){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw new Error("Cannot run forEach on a Node interface")}map(e){throw new Error("Cannot run map on a Node interface")}_ifNode(e){if(!X(e))throw new TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),function e(t,n){t.forEach((function(t,r,i){n(t,r,i),e(t,n)}))}(this,e)}transform(e){return function t(n,r,i){const o=e(n,r,i);return o!==n?o:n.map(t)}(this,null,null)}filter(e){const t=[];return this.traverse((function(n,r,i){e(n,r,i)&&t.push(n)})),t}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map((function(e){return e.cloneDeep()}))}equals(e){return!!e&&this.type===e.type&&ce(this,e)}toString(e){const t=this._getCustomString(e);return void 0!==t?t:this._toString(e)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){const t=this._getCustomString(e);return void 0!==t?t:this._toHTML(e)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(e){const t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)}_toTex(e){throw new 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 new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}}),{isClass:!0,isNode:!0});function Bp(e){return Bp="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},Bp(e)}function Dp(e,t,n){return(t=function(e){var t=function(e){if("object"!=Bp(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Bp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Bp(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fp(e){return e&&e.isIndexError?new br(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function Op(e){let{subset:t}=e;return function(e,n){try{if(Array.isArray(e))return t(e,n);if(e&&"function"==typeof e.subset)return e.subset(n);if("string"==typeof e)return t(e,n);if("object"==typeof e){if(!n.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return i(e,n.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Fp(e)}}}const _p="AccessorNode",Ip=he(_p,["subset","Node"],(e=>{let{subset:t,Node:n}=e;const r=Op({subset:t});function o(e){return!(U(e)||L(e)||V(e)||Y(e)||Q(e)||ee(e)||re(e))}class a extends n{constructor(e,t){if(super(),!X(e))throw new TypeError('Node expected for parameter "object"');if(!J(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=t}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return _p}get isAccessorNode(){return!0}_compile(e,t){const n=this.object._compile(e,t),o=this.index._compile(e,t);if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,r,o){return i(n(t,r,o),e)}}return function(e,t,i){const a=n(e,t,i),s=o(e,t,a);return r(a,s)}}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){let t=this.object.toString(e);return o(this.object)&&(t="("+t+")"),t+this.index.toString(e)}_toHTML(e){let t=this.object.toHTML(e);return o(this.object)&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+this.index.toHTML(e)}_toTex(e){let t=this.object.toTex(e);return o(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)}toJSON(){return{mathjs:_p,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return Dp(a,"name",_p),a}),{isClass:!0,isNode:!0}),zp="ArrayNode",kp=he(zp,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(X))throw new TypeError("Array containing Nodes expected")}get type(){return zp}get isArrayNode(){return!0}_compile(e,t){const n=kr(this.items,(function(n){return n._compile(e,t)}));if("Array"!==e.config.matrix){const t=e.matrix;return function(e,r,i){return t(kr(n,(function(t){return t(e,r,i)})))}}return function(e,t,r){return kr(n,(function(n){return n(e,t,r)}))}}forEach(e){for(let t=0;t<this.items.length;t++)e(this.items[t],"items["+t+"]",this)}map(e){const t=[];for(let n=0;n<this.items.length;n++)t[n]=this._ifNode(e(this.items[n],"items["+n+"]",this));return new n(t)}clone(){return new n(this.items.slice(0))}_toString(e){return"["+this.items.map((function(t){return t.toString(e)})).join(", ")+"]"}toJSON(){return{mathjs:zp,items:this.items}}static fromJSON(e){return new n(e.items)}_toHTML(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map((function(t){return t.toHTML(e)})).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){return function t(n,r){const i=n.some(L)&&!n.every(L),o=r||i,a=o?"&":"\\\\",s=n.map((function(n){return n.items?t(n.items,!r):n.toTex(e)})).join(a);return i||!o||o&&!r?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return Dp(n,"name",zp),n}),{isClass:!0,isNode:!0}),Rp=[{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:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function qp(e,t){if(!t||"auto"!==t)return e;let n=e;for(;ee(n);)n=n.content;return n}function Pp(e,t,n,r){let i=e;"keep"!==t&&(i=e.getContent());const o=i.getIdentifier();let a=null;for(let e=0;e<Rp.length;e++)if(o in Rp[e]){a=e;break}if("OperatorNode:multiply"===o&&i.implicit&&"show"!==n){const e=qp(i.args[0],t);V(e)&&r&&"OperatorNode:divide"===r.getIdentifier()&&Z(qp(r.args[0],t))||"OperatorNode:divide"===e.getIdentifier()&&Z(qp(e.args[0],t))&&V(qp(e.args[1]))||(a+=1)}return a}function jp(e,t){let n=e;"keep"!==t&&(n=e.getContent());const r=n.getIdentifier(),i=Pp(n,t);if(null===i)return null;const o=Rp[i][r];if(me(o,"associativity")){if("left"===o.associativity)return"left";if("right"===o.associativity)return"right";throw Error("'"+r+"' has the invalid associativity '"+o.associativity+"'.")}return null}function Up(e,t,n){const r="keep"!==n?e.getContent():e,i="keep"!==n?e.getContent():t,o=r.getIdentifier(),a=i.getIdentifier(),s=Pp(r,n);if(null===s)return null;const u=Rp[s][o];if(me(u,"associativeWith")&&u.associativeWith instanceof Array){for(let e=0;e<u.associativeWith.length;e++)if(u.associativeWith[e]===a)return!0;return!1}return null}const Lp="AssignmentNode",$p=he(Lp,["subset","?matrix","Node"],(e=>{let{subset:t,matrix:n,Node:r}=e;const a=Op({subset:t}),s=function(e){let{subset:t,matrix:n}=e;return function(e,r,i){try{if(Array.isArray(e))return n(e).subset(r,i).valueOf().forEach(((t,n)=>{e[n]=t})),e;if(e&&"function"==typeof e.subset)return e.subset(r,i);if("string"==typeof e)return t(e,r,i);if("object"==typeof e){if(!r.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return o(e,r.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Fp(e)}}}({subset:t,matrix:n});function u(e,t,n){t||(t="keep");const r=Pp(e,t,n),i=Pp(e.value,t,n);return"all"===t||null!==i&&i<=r}class c extends r{constructor(e,t,n){if(super(),this.object=e,this.index=n?t:null,this.value=n||t,!re(e)&&!U(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(re(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!J(this.index))throw new TypeError('IndexNode expected as "index"');if(!X(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Lp}get isAssignmentNode(){return!0}_compile(e,t){const n=this.object._compile(e,t),r=this.index?this.index._compile(e,t):null,u=this.value._compile(e,t),c=this.object.name;if(this.index){if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,r,i){const a=n(t,r,i),s=u(t,r,i);return o(a,e,s),s}}if(re(this.object))return function(e,t,i){const o=n(e,t,i),a=u(e,t,i),l=r(e,t,o);return e.set(c,s(o,l,a)),a};{const n=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){const e=this.object.index.getObjectProperty();return function(t,a,c){const l=n(t,a,c),f=i(l,e),p=r(t,a,f),m=u(t,a,c);return o(l,e,s(f,p,m)),m}}{const i=this.object.index._compile(e,t);return function(e,t,o){const c=n(e,t,o),l=i(e,t,c),f=a(c,l),p=r(e,t,f),m=u(e,t,o);return s(c,l,s(f,p,m)),m}}}}if(!re(this.object))throw new TypeError("SymbolNode expected as object");return function(e,t,n){const r=u(e,t,n);return e.set(c,r),r}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){const t=this._ifNode(e(this.object,"object",this)),n=this.index?this._ifNode(e(this.index,"index",this)):null,r=this._ifNode(e(this.value,"value",this));return new c(t,n,r)}clone(){return new c(this.object,this.index,this.value)}_toString(e){const t=this.object.toString(e),n=this.index?this.index.toString(e):"";let r=this.value.toString(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r="("+r+")"),t+n+" = "+r}toJSON(){return{mathjs:Lp,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new c(e.object,e.index,e.value)}_toHTML(e){const t=this.object.toHTML(e),n=this.index?this.index.toHTML(e):"";let r=this.value.toHTML(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r='<span class="math-paranthesis math-round-parenthesis">(</span>'+r+'<span class="math-paranthesis math-round-parenthesis">)</span>'),t+n+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+r}_toTex(e){const t=this.object.toTex(e),n=this.index?this.index.toTex(e):"";let r=this.value.toTex(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r=`\\left(${r}\\right)`),t+n+"="+r}}return Dp(c,"name",Lp),c}),{isClass:!0,isNode:!0}),Hp="BlockNode",Gp=he(Hp,["ResultSet","Node"],(e=>{let{ResultSet:t,Node:n}=e;class r extends n{constructor(e){if(super(),!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){const t=e&&e.node,n=!e||void 0===e.visible||e.visible;if(!X(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof n)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:n}}))}get type(){return Hp}get isBlockNode(){return!0}_compile(e,n){const r=kr(this.blocks,(function(t){return{evaluate:t.node._compile(e,n),visible:t.visible}}));return function(e,n,i){const o=[];return Rr(r,(function(t){const r=t.evaluate(e,n,i);t.visible&&o.push(r)})),new t(o)}}forEach(e){for(let t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)}map(e){const t=[];for(let n=0;n<this.blocks.length;n++){const r=this.blocks[n],i=this._ifNode(e(r.node,"blocks["+n+"].node",this));t[n]={node:i,visible:r.visible}}return new r(t)}clone(){const e=this.blocks.map((function(e){return{node:e.node,visible:e.visible}}));return new r(e)}_toString(e){return this.blocks.map((function(t){return t.node.toString(e)+(t.visible?"":";")})).join("\n")}toJSON(){return{mathjs:Hp,blocks:this.blocks}}static fromJSON(e){return new r(e.blocks)}_toHTML(e){return this.blocks.map((function(t){return t.node.toHTML(e)+(t.visible?"":'<span class="math-separator">;</span>')})).join('<span class="math-separator"><br /></span>')}_toTex(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")}}return Dp(r,"name",Hp),r}),{isClass:!0,isNode:!0}),Vp="ConditionalNode",Zp=he(Vp,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e,t,n){if(super(),!X(e))throw new TypeError("Parameter condition must be a Node");if(!X(t))throw new TypeError("Parameter trueExpr must be a Node");if(!X(n))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=n}get type(){return Vp}get isConditionalNode(){return!0}_compile(e,t){const n=this.condition._compile(e,t),r=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,o){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(g(e))return!e.isZero();if(x(e))return!(!e.re&&!e.im);if(v(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+oe(e)+'"')}(n(e,t,o))?r(e,t,o):i(e,t,o)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new n(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Pp(this,t,e&&e.implicit);let r=this.condition.toString(e);const i=Pp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=n)&&(r="("+r+")");let o=this.trueExpr.toString(e);const a=Pp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(o="("+o+")");let s=this.falseExpr.toString(e);const u=Pp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s="("+s+")"),r+" ? "+o+" : "+s}toJSON(){return{mathjs:Vp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new n(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Pp(this,t,e&&e.implicit);let r=this.condition.toHTML(e);const i=Pp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=n)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>');let o=this.trueExpr.toHTML(e);const a=Pp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>');let s=this.falseExpr.toHTML(e);const u=Pp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+'<span class="math-operator math-conditional-operator">?</span>'+o+'<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 Dp(n,"name",Vp),n}),{isClass:!0,isNode:!0});var Wp=n(3144);const Yp={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{?}"},Jp={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"},Xp={abs:{1:"\\left|${args[0]}\\right|"},add:{2:`\\left(\${args[0]}${Jp.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]}${Jp.dotDivide}\${args[1]}\\right)`},dotMultiply:{2:`\\left(\${args[0]}${Jp.dotMultiply}\${args[1]}\\right)`},dotPow:{2:`\\left(\${args[0]}${Jp.dotPow}\${args[1]}\\right)`},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:`\\left(e${Jp.pow}{\${args[0]}}-1\\right)`,fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},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]}${Jp.mod}\${args[1]}\\right)`},multiply:{2:`\\left(\${args[0]}${Jp.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)${Jp.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]}${Jp.subtract}\${args[1]}\\right)`},unaryMinus:{1:`${Jp.unaryMinus}\\left(\${args[0]}\\right)`},unaryPlus:{1:`${Jp.unaryPlus}\\left(\${args[0]}\\right)`},bitAnd:{2:`\\left(\${args[0]}${Jp.bitAnd}\${args[1]}\\right)`},bitNot:{1:Jp.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:`\\left(\${args[0]}${Jp.bitOr}\${args[1]}\\right)`},bitXor:{2:`\\left(\${args[0]}${Jp.bitXor}\${args[1]}\\right)`},leftShift:{2:`\\left(\${args[0]}${Jp.leftShift}\${args[1]}\\right)`},rightArithShift:{2:`\\left(\${args[0]}${Jp.rightArithShift}\${args[1]}\\right)`},rightLogShift:{2:`\\left(\${args[0]}${Jp.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]}${Jp.and}\${args[1]}\\right)`},not:{1:Jp.not+"\\left(${args[0]}\\right)"},or:{2:`\\left(\${args[0]}${Jp.or}\${args[1]}\\right)`},xor:{2:`\\left(\${args[0]}${Jp.xor}\${args[1]}\\right)`},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:`\\left(\${args[0]}\\right)${Jp.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]}}${Jp.pow}{\\frac{1}{2}}`},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:`\\left(\${args[0]}\\right)${Jp.transpose}`},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:`\\left(\${args[0]}\\right)${Jp.factorial}`},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:`\\left(\${args[0]}${Jp.equal}\${args[1]}\\right)`},larger:{2:`\\left(\${args[0]}${Jp.larger}\${args[1]}\\right)`},largerEq:{2:`\\left(\${args[0]}${Jp.largerEq}\${args[1]}\\right)`},smaller:{2:`\\left(\${args[0]}${Jp.smaller}\${args[1]}\\right)`},smallerEq:{2:`\\left(\${args[0]}${Jp.smallerEq}\${args[1]}\\right)`},unequal:{2:`\\left(\${args[0]}${Jp.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]}${Jp.to}\${args[1]}\\right)`},numeric:function(e,t){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)+${Yp.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)"}},Qp={deg:"^\\circ"};function Kp(e){return Wp(e,{preserveFormatting:!0})}function em(e,t){return(t=void 0!==t&&t)?me(Qp,e)?Qp[e]:"\\mathrm{"+Kp(e)+"}":me(Yp,e)?Yp[e]:Kp(e)}const tm="ConstantNode",nm=he(tm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){super(),this.value=e}get type(){return tm}get isConstantNode(){return!0}_compile(e,t){const n=this.value;return function(){return n}}forEach(e){}map(e){return this.clone()}clone(){return new n(this.value)}_toString(e){return pr(this.value,e)}_toHTML(e){const t=this._toString(e);switch(oe(this.value)){case"number":case"bigint":case"BigNumber":case"Fraction":return'<span class="math-number">'+t+"</span>";case"string":return'<span class="math-string">'+t+"</span>";case"boolean":return'<span class="math-boolean">'+t+"</span>";case"null":return'<span class="math-null-symbol">'+t+"</span>";case"undefined":return'<span class="math-undefined">'+t+"</span>";default:return'<span class="math-symbol">'+t+"</span>"}}toJSON(){return{mathjs:tm,value:this.value}}static fromJSON(e){return new n(e.value)}_toTex(e){const t=this._toString(e),n=oe(this.value);switch(n){case"string":return"\\mathtt{"+Kp(t)+"}";case"number":case"BigNumber":{if(!("BigNumber"===n?this.value.isFinite():isFinite(this.value)))return this.value.valueOf()<0?"-\\infty":"\\infty";const e=t.toLowerCase().indexOf("e");return-1!==e?t.substring(0,e)+"\\cdot10^{"+t.substring(e+1)+"}":t}case"bigint":return t.toString();case"Fraction":return this.value.toLatex();default:return t}}}return Dp(n,"name",tm),n}),{isClass:!0,isNode:!0}),rm="FunctionAssignmentNode",im=he(rm,["typed","Node"],(e=>{let{typed:t,Node:n}=e;function r(e,t,n){const r=Pp(e,t,n),i=Pp(e.expr,t,n);return"all"===t||null!==i&&i<=r}class i extends n{constructor(e,t,n){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!X(n))throw new TypeError('Node expected for parameter "expr"');if(Cp.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');const r=new Set;for(const e of t){const t="string"==typeof e?e:e.name;if(r.has(t))throw new Error(`Duplicate parameter name "${t}"`);r.add(t)}this.name=e,this.params=t.map((function(e){return e&&e.name||e})),this.types=t.map((function(e){return e&&e.type||"any"})),this.expr=n}get type(){return rm}get isFunctionAssignmentNode(){return!0}_compile(e,n){const r=Object.create(n);Rr(this.params,(function(e){r[e]=!0}));const i=this.expr._compile(e,r),o=this.name,a=this.params,s=Pr(this.types,","),u=o+"("+Pr(this.params,", ")+")";return function(e,n,r){const c={};c[s]=function(){const t=Object.create(n);for(let e=0;e<a.length;e++)t[a[e]]=arguments[e];return i(e,t,r)};const l=t(o,c);return l.syntax=u,e.set(o,l),l}}forEach(e){e(this.expr,"expr",this)}map(e){const t=this._ifNode(e(this.expr,"expr",this));return new i(this.name,this.params.slice(0),t)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let n=this.expr.toString(e);return r(this,t,e&&e.implicit)&&(n="("+n+")"),this.name+"("+this.params.join(", ")+") = "+n}toJSON(){const e=this.types;return{mathjs:rm,name:this.name,params:this.params.map((function(t,n){return{name:t,type:e[n]}})),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=[];for(let e=0;e<this.params.length;e++)n.push('<span class="math-symbol math-parameter">'+dr(this.params[e])+"</span>");let i=this.expr.toHTML(e);return r(this,t,e&&e.implicit)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+dr(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+n.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>'+i}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let n=this.expr.toTex(e);return r(this,t,e&&e.implicit)&&(n=`\\left(${n}\\right)`),"\\mathrm{"+this.name+"}\\left("+this.params.map(em).join(",")+"\\right)="+n}}return Dp(i,"name",rm),i}),{isClass:!0,isNode:!0}),om="IndexNode",am=he(om,["Node","size"],(e=>{let{Node:t,size:n}=e;class r extends t{constructor(e,t){if(super(),this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(X))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return om}get isIndexNode(){return!0}_compile(e,t){const r=kr(this.dimensions,(function(r,i){if(r.filter((e=>e.isSymbolNode&&"end"===e.name)).length>0){const o=Object.create(t);o.end=!0;const a=r._compile(e,o);return function(e,t,r){if(!E(r)&&!N(r)&&!w(r))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+oe(r));const o=n(r).valueOf(),s=Object.create(t);return s.end=o[i],a(e,s,r)}}return r._compile(e,t)})),o=i(e,"index");return function(e,t,n){const i=kr(r,(function(r){return r(e,t,n)}));return o(...i)}}forEach(e){for(let t=0;t<this.dimensions.length;t++)e(this.dimensions[t],"dimensions["+t+"]",this)}map(e){const t=[];for(let n=0;n<this.dimensions.length;n++)t[n]=this._ifNode(e(this.dimensions[n],"dimensions["+n+"]",this));return new r(t,this.dotNotation)}clone(){return new r(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&V(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:om,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new r(e.dimensions,e.dotNotation)}_toHTML(e){const t=[];for(let e=0;e<this.dimensions.length;e++)t[e]=this.dimensions[e].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+dr(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){const t=this.dimensions.map((function(t){return t.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"}}return Dp(r,"name",om),r}),{isClass:!0,isNode:!0}),sm="ObjectNode",um=he(sm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every((function(t){return X(e[t])}))))throw new TypeError("Object containing Nodes expected")}get type(){return sm}get isObjectNode(){return!0}_compile(e,t){const n={};for(const r in this.properties)if(me(this.properties,r)){const o=mr(r),a=JSON.parse(o),s=i(this.properties,r);n[a]=s._compile(e,t)}return function(e,t,r){const i={};for(const o in n)me(n,o)&&(i[o]=n[o](e,t,r));return i}}forEach(e){for(const t in this.properties)me(this.properties,t)&&e(this.properties[t],"properties["+mr(t)+"]",this)}map(e){const t={};for(const n in this.properties)me(this.properties,n)&&(t[n]=this._ifNode(e(this.properties[n],"properties["+mr(n)+"]",this)));return new n(t)}clone(){const e={};for(const t in this.properties)me(this.properties,t)&&(e[t]=this.properties[t]);return new n(e)}_toString(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push(mr(n)+": "+this.properties[n].toString(e));return"{"+t.join(", ")+"}"}toJSON(){return{mathjs:sm,properties:this.properties}}static fromJSON(e){return new n(e.properties)}_toHTML(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push('<span class="math-symbol math-property">'+dr(n)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[n].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push("\\mathbf{"+n+":} & "+this.properties[n].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"}}return Dp(n,"name",sm),n}),{isClass:!0,isNode:!0});function cm(e,t){return new f(e,new l(t),new Set(Object.keys(t)))}const lm="OperatorNode",fm=he(lm,["Node"],(e=>{let{Node:t}=e;function n(e,t){let r=e;if("auto"===t)for(;ee(r);)r=r.content;return!!V(r)||!!K(r)&&n(r.args[0],t)}function r(e,t,r,i,o){const a=Pp(e,t,r),s=jp(e,t);if("all"===t||i.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return i.map((function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}}));let u;switch(i.length){case 0:u=[];break;case 1:{const n=Pp(i[0],t,r,e);if(o&&null!==n){let r,o;if("keep"===t?(r=i[0].getIdentifier(),o=e.getIdentifier()):(r=i[0].getContent().getIdentifier(),o=e.getContent().getIdentifier()),!1===Rp[a][o].latexLeftParens){u=[!1];break}if(!1===Rp[n][r].latexParens){u=[!1];break}}if(null===n){u=[!1];break}if(n<=a){u=[!0];break}u=[!1]}break;case 2:{let n;const c=Pp(i[0],t,r,e),l=Up(e,i[0],t);let f;n=null!==c&&(c===a&&"right"===s&&!l||c<a);const p=Pp(i[1],t,r,e),m=Up(e,i[1],t);if(f=null!==p&&(p===a&&"left"===s&&!m||p<a),o){let r,i,o;"keep"===t?(r=e.getIdentifier(),i=e.args[0].getIdentifier(),o=e.args[1].getIdentifier()):(r=e.getContent().getIdentifier(),i=e.args[0].getContent().getIdentifier(),o=e.args[1].getContent().getIdentifier()),null!==c&&(!1===Rp[a][r].latexLeftParens&&(n=!1),!1===Rp[c][i].latexParens&&(n=!1)),null!==p&&(!1===Rp[a][r].latexRightParens&&(f=!1),!1===Rp[p][o].latexParens&&(f=!1))}u=[n,f]}break;default:"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()||(u=i.map((function(n){const i=Pp(n,t,r,e),o=Up(e,n,t),u=jp(n,t);return null!==i&&(a===i&&s===u&&!o||i<a)})))}if(i.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==t&&"hide"===r)for(let e=1;e<u.length;++e)!n(i[e],t)||u[e-1]||"keep"===t&&ee(i[e-1])||(u[e]=!0);return u}class o extends t{constructor(e,t,n,r,i){if(super(),"string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof t)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(n)||!n.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===r,this.isPercentage=!0===i,this.op=e,this.fn=t,this.args=n||[]}get type(){return lm}get isOperatorNode(){return!0}_compile(e,t){if("string"!=typeof this.fn||!s(e,this.fn))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');const n=i(e,this.fn),r=kr(this.args,(function(n){return n._compile(e,t)}));if("function"==typeof n&&!0===n.rawArgs){const t=this.args;return function(r,i,o){return n(t,e,cm(r,i))}}if(1===r.length){const e=r[0];return function(t,r,i){return n(e(t,r,i))}}if(2===r.length){const e=r[0],t=r[1];return function(r,i,o){return n(e(r,i,o),t(r,i,o))}}return function(e,t,i){return n.apply(null,kr(r,(function(n){return n(e,t,i)})))}}forEach(e){for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=[];for(let n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new o(this.op,this.fn,t,this.implicit,this.isPercentage)}clone(){return new o(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){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!1);if(1===i.length){const n=jp(this,t);let r=i[0].toString(e);o[0]&&(r="("+r+")");const a=/[a-zA-Z]+/.test(this.op);return"right"===n?this.op+(a?" ":"")+r:"left"===n?r+(a?" ":"")+this.op:r+this.op}if(2===i.length){let t=i[0].toString(e),r=i[1].toString(e);return o[0]&&(t="("+t+")"),o[1]&&(r="("+r+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t+" "+r:t+" "+this.op+" "+r}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,n){return t=t.toString(e),o[n]&&(t="("+t+")"),t}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t.join(" "):t.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:lm,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new o(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!1);if(1===i.length){const n=jp(this,t);let r=i[0].toHTML(e);return o[0]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===n?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+dr(this.op)+"</span>"+r:r+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+dr(this.op)+"</span>"}if(2===i.length){let t=i[0].toHTML(e),r=i[1].toHTML(e);return o[0]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+r:t+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dr(this.op)+"</span>"+r}{const t=i.map((function(t,n){return t=t.toHTML(e),o[n]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):t.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dr(this.op)+"</span>"):'<span class="math-function">'+dr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!0);let a=Jp[this.fn];if(a=void 0===a?this.op:a,1===i.length){const n=jp(this,t);let r=i[0].toTex(e);return o[0]&&(r=`\\left(${r}\\right)`),"right"===n?a+r:r+a}if(2===i.length){const r=i[0];let s=r.toTex(e);o[0]&&(s=`\\left(${s}\\right)`);let u,c=i[1].toTex(e);switch(o[1]&&(c=`\\left(${c}\\right)`),u="keep"===t?r.getIdentifier():r.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return a+"{"+s+"}{"+c+"}";case"OperatorNode:pow":switch(s="{"+s+"}",c="{"+c+"}",u){case"ConditionalNode":case"OperatorNode:divide":s=`\\left(${s}\\right)`}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return s+"~"+c}return s+a+c}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,n){return t=t.toTex(e),o[n]&&(t=`\\left(${t}\\right)`),t}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?t.join("~"):t.join(a)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(t){return t.toTex(e)})).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return Dp(o,"name",lm),o}),{isClass:!0,isNode:!0}),pm="ParenthesisNode",mm=he(pm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),!X(e))throw new TypeError('Node expected for parameter "content"');this.content=e}get type(){return pm}get isParenthesisNode(){return!0}_compile(e,t){return this.content._compile(e,t)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){const t=e(this.content,"content",this);return new n(t)}clone(){return new n(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:pm,content:this.content}}static fromJSON(e){return new n(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(${this.content.toTex(e)}\\right)`:this.content.toTex(e)}}return Dp(n,"name",pm),n}),{isClass:!0,isNode:!0}),hm="RangeNode",dm=he(hm,["Node"],(e=>{let{Node:t}=e;function n(e,t,n){const r=Pp(e,t,n),i={},o=Pp(e.start,t,n);if(i.start=null!==o&&o<=r||"all"===t,e.step){const o=Pp(e.step,t,n);i.step=null!==o&&o<=r||"all"===t}const a=Pp(e.end,t,n);return i.end=null!==a&&a<=r||"all"===t,i}class r extends t{constructor(e,t,n){if(super(),!X(e))throw new TypeError("Node expected");if(!X(t))throw new TypeError("Node expected");if(n&&!X(n))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=n||null}get type(){return hm}get isRangeNode(){return!0}needsEnd(){return this.filter((function(e){return re(e)&&"end"===e.name})).length>0}_compile(e,t){const n=e.range,r=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){const o=this.step._compile(e,t);return function(e,t,a){return n(r(e,t,a),i(e,t,a),o(e,t,a))}}return function(e,t,o){return n(r(e,t,o),i(e,t,o))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new r(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 r(this.start,this.end,this.step&&this.step)}_toString(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r,i=this.start.toString(e);if(t.start&&(i="("+i+")"),r=i,this.step){let n=this.step.toString(e);t.step&&(n="("+n+")"),r+=":"+n}let o=this.end.toString(e);return t.end&&(o="("+o+")"),r+=":"+o,r}toJSON(){return{mathjs:hm,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new r(e.start,e.end,e.step)}_toHTML(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r,i=this.start.toHTML(e);if(t.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r=i,this.step){let n=this.step.toHTML(e);t.step&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+n}let o=this.end.toHTML(e);return t.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,r}_toTex(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r=this.start.toTex(e);if(t.start&&(r=`\\left(${r}\\right)`),this.step){let n=this.step.toTex(e);t.step&&(n=`\\left(${n}\\right)`),r+=":"+n}let i=this.end.toTex(e);return t.end&&(i=`\\left(${i}\\right)`),r+=":"+i,r}}return Dp(r,"name",hm),r}),{isClass:!0,isNode:!0}),gm="RelationalNode",ym=he(gm,["Node"],(e=>{let{Node:t}=e;const n={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class r extends t{constructor(e,t){if(super(),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(t))throw new TypeError("Parameter params must be an array");if(e.length!==t.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=t}get type(){return gm}get isRelationalNode(){return!0}_compile(e,t){const n=this,r=this.params.map((n=>n._compile(e,t)));return function(t,o,a){let s,u=r[0](t,o,a);for(let c=0;c<n.conditionals.length;c++)if(s=u,u=r[c+1](t,o,a),!i(e,n.conditionals[c])(s,u))return!1;return!0}}forEach(e){this.params.forEach(((t,n)=>e(t,"params["+n+"]",this)),this)}map(e){return new r(this.conditionals.slice(),this.params.map(((t,n)=>this._ifNode(e(t,"params["+n+"]",this))),this))}clone(){return new r(this.conditionals,this.params)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Pp(this,t,e&&e.implicit),i=this.params.map((function(n,i){const o=Pp(n,t,e&&e.implicit);return"all"===t||null!==o&&o<=r?"("+n.toString(e)+")":n.toString(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+=" "+n[this.conditionals[e]],o+=" "+i[e+1];return o}toJSON(){return{mathjs:gm,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new r(e.conditionals,e.params)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Pp(this,t,e&&e.implicit),i=this.params.map((function(n,i){const o=Pp(n,t,e&&e.implicit);return"all"===t||null!==o&&o<=r?'<span class="math-parenthesis math-round-parenthesis">(</span>'+n.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':n.toHTML(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dr(n[this.conditionals[e]])+"</span>"+i[e+1];return o}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Pp(this,t,e&&e.implicit),r=this.params.map((function(r,i){const o=Pp(r,t,e&&e.implicit);return"all"===t||null!==o&&o<=n?"\\left("+r.toTex(e)+"\right)":r.toTex(e)}));let i=r[0];for(let e=0;e<this.conditionals.length;e++)i+=Jp[this.conditionals[e]]+r[e+1];return i}}return Dp(r,"name",gm),r}),{isClass:!0,isNode:!0}),xm=he("SymbolNode",["math","?Unit","Node"],(e=>{let{math:t,Unit:n,Node:r}=e;function o(e){return!!n&&n.isValuelessUnit(e)}class a extends r{constructor(e){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(e,t){const r=this.name;if(!0===t[r])return function(e,t,n){return i(t,r)};if(r in e)return function(t,n,o){return t.has(r)?t.get(r):i(e,r)};{const e=o(r);return function(t,i,o){return t.has(r)?t.get(r):e?new n(null,r):a.onUndefinedSymbol(r)}}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw new Error("Undefined symbol "+e)}clone(){return new a(this.name)}_toString(e){return this.name}_toHTML(e){const t=dr(this.name);return"true"===t||"false"===t?'<span class="math-symbol math-boolean">'+t+"</span>":"i"===t?'<span class="math-symbol math-imaginary-symbol">'+t+"</span>":"Infinity"===t?'<span class="math-symbol math-infinity-symbol">'+t+"</span>":"NaN"===t?'<span class="math-symbol math-nan-symbol">'+t+"</span>":"null"===t?'<span class="math-symbol math-null-symbol">'+t+"</span>":"undefined"===t?'<span class="math-symbol math-undefined-symbol">'+t+"</span>":'<span class="math-symbol">'+t+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){let n=!1;void 0===t[this.name]&&o(this.name)&&(n=!0);const r=em(this.name,n);return"\\"===r[0]?r:" "+r}}return a}),{isClass:!0,isNode:!0}),bm="FunctionNode",vm=he(bm,["math","Node","SymbolNode"],(e=>{var t;let{math:n,Node:r,SymbolNode:o}=e;const a=e=>pr(e,{truncate:78});function u(e,t,n){let r="";const i=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi;let o,a=0;for(;null!==(o=i.exec(e));)if(r+=e.substring(a,o.index),a=o.index,"$$"===o[0])r+="$",a++;else{a+=o[0].length;const e=t[o[1]];if(!e)throw new ReferenceError("Template: Property "+o[1]+" does not exist.");if(void 0===o[2])switch(typeof e){case"string":r+=e;break;case"object":if(X(e))r+=e.toTex(n);else{if(!Array.isArray(e))throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes");r+=e.map((function(e,t){if(X(e))return e.toTex(n);throw new TypeError("Template: "+o[1]+"["+t+"] is not a Node.")})).join(",")}break;default:throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes")}else{if(!X(e[o[2]]&&e[o[2]]))throw new TypeError("Template: "+o[1]+"["+o[2]+"] is not a Node.");r+=e[o[2]].toTex(n)}}return r+=e.slice(a),r}class c extends r{constructor(e,t){if(super(),"string"==typeof e&&(e=new o(e)),!X(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[]}get name(){return this.fn.name||""}get type(){return bm}get isFunctionNode(){return!0}_compile(e,t){const n=this.args.map((n=>n._compile(e,t)));if(!re(this.fn)){if(U(this.fn)&&J(this.fn.index)&&this.fn.index.isObjectProperty()){const r=this.fn.object._compile(e,t),i=this.fn.index.getObjectProperty(),o=this.args;return function(t,a,u){const c=r(t,a,u),l=function(e,t){if(!s(e,t))throw new Error('No access to method "'+t+'"');return e[t]}(c,i);if(null!=l&&l.rawArgs)return l(o,e,cm(t,a));{const e=n.map((e=>e(t,a,u)));return l.apply(c,e)}}}{const r=this.fn.toString(),i=this.fn._compile(e,t),o=this.args;return function(t,s,u){const c=i(t,s,u);if("function"!=typeof c)throw new TypeError(`Expression '${r}' did not evaluate to a function; value is:\n ${a(c)}`);if(c.rawArgs)return c(o,e,cm(t,s));{const e=n.map((e=>e(t,s,u)));return c.apply(c,e)}}}}{const r=this.fn.name;if(t[r]){const t=this.args;return function(o,s,u){const c=i(s,r);if("function"!=typeof c)throw new TypeError(`Argument '${r}' was not a function; received: ${a(c)}`);if(c.rawArgs)return c(t,e,cm(o,s));{const e=n.map((e=>e(o,s,u)));return c.apply(c,e)}}}{const t=r in e?i(e,r):void 0,o="function"==typeof t&&!0===t.rawArgs,s=t=>{let n;if(t.has(r))n=t.get(r);else{if(!(r in e))return c.onUndefinedFunction(r);n=i(e,r)}if("function"==typeof n)return n;throw new TypeError(`'${r}' is not a function; its value is:\n ${a(n)}`)};if(o){const t=this.args;return function(r,i,o){const a=s(r);return!0===a.rawArgs?a(t,e,cm(r,i)):a(...n.map((e=>e(r,i,o))))}}switch(n.length){case 0:return function(e,t,n){return s(e)()};case 1:return function(e,t,r){return s(e)((0,n[0])(e,t,r))};case 2:return function(e,t,r){const i=s(e),o=n[0],a=n[1];return i(o(e,t,r),a(e,t,r))};default:return function(e,t,r){return s(e)(...n.map((n=>n(e,t,r))))}}}}}forEach(e){e(this.fn,"fn",this);for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=this._ifNode(e(this.fn,"fn",this)),n=[];for(let t=0;t<this.args.length;t++)n[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new c(t,n)}clone(){return new c(this.fn,this.args.slice(0))}toString(e){let t;const n=this.fn.toString(e);return e&&"object"==typeof e.handler&&me(e.handler,n)&&(t=e.handler[n](this,e)),void 0!==t?t:super.toString(e)}_toString(e){const t=this.args.map((function(t){return t.toString(e)}));return(W(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+t.join(", ")+")"}toJSON(){return{mathjs:bm,fn:this.fn,args:this.args}}_toHTML(e){const t=this.args.map((function(t){return t.toHTML(e)}));return'<span class="math-function">'+dr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(e){let t;return e&&"object"==typeof e.handler&&me(e.handler,this.name)&&(t=e.handler[this.name](this,e)),void 0!==t?t:super.toTex(e)}_toTex(e){const t=this.args.map((function(t){return t.toTex(e)}));let r,i;switch(Xp[this.name]&&(r=Xp[this.name]),!n[this.name]||"function"!=typeof n[this.name].toTex&&"object"!=typeof n[this.name].toTex&&"string"!=typeof n[this.name].toTex||(r=n[this.name].toTex),typeof r){case"function":i=r(this,e);break;case"string":i=u(r,this,e);break;case"object":switch(typeof r[t.length]){case"function":i=r[t.length](this,e);break;case"string":i=u(r[t.length],this,e)}}return void 0!==i?i:u("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return t=c,Dp(c,"name",bm),Dp(c,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),Dp(c,"fromJSON",(function(e){return new t(e.fn,e.args)})),c}),{isClass:!0,isNode:!0}),wm="parse",Nm=he(wm,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(e=>{let{typed:t,numeric:n,config:r,AccessorNode:i,ArrayNode:o,AssignmentNode:a,BlockNode:s,ConditionalNode:u,ConstantNode:c,FunctionAssignmentNode:l,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:y,SymbolNode:x}=e;const b=t(wm,{string:function(e){return k(e,{})},"Array | Matrix":function(e){return v(e,{})},"string, Object":function(e,t){return k(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":v});function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=void 0!==t.nodes?t.nodes:{};return ii(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return k(e,n)}))}const w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},N={",":!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},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function C(e,t){return e.expression.substr(e.index,t)}function T(e){return C(e,1)}function B(e){e.index++}function D(e){return e.expression.charAt(e.index-1)}function F(e){return e.expression.charAt(e.index+1)}function O(e){for(e.tokenType=w.NULL,e.token="",e.comment="";;){if("#"===T(e))for(;"\n"!==T(e)&&""!==T(e);)e.comment+=T(e),B(e);if(!b.isWhitespace(T(e),e.nestingLevel))break;B(e)}if(""===T(e))return void(e.tokenType=w.DELIMITER);if("\n"===T(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=T(e),void B(e);const t=T(e),n=C(e,2),r=C(e,3);if(3===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,B(e),B(e),void B(e);if(2===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,B(e),void B(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void B(e);if(b.isDigitDot(t)){e.tokenType=w.NUMBER;const t=C(e,2);if("0b"===t||"0o"===t||"0x"===t){for(e.token+=T(e),B(e),e.token+=T(e),B(e);b.isHexDigit(T(e));)e.token+=T(e),B(e);if("."===T(e))for(e.token+=".",B(e);b.isHexDigit(T(e));)e.token+=T(e),B(e);else if("i"===T(e))for(e.token+="i",B(e);b.isDigit(T(e));)e.token+=T(e),B(e);return}if("."===T(e)){if(e.token+=T(e),B(e),!b.isDigit(T(e)))return void(e.tokenType=w.DELIMITER)}else{for(;b.isDigit(T(e));)e.token+=T(e),B(e);b.isDecimalMark(T(e),F(e))&&(e.token+=T(e),B(e))}for(;b.isDigit(T(e));)e.token+=T(e),B(e);if("E"===T(e)||"e"===T(e))if(b.isDigit(F(e))||"-"===F(e)||"+"===F(e)){if(e.token+=T(e),B(e),"+"!==T(e)&&"-"!==T(e)||(e.token+=T(e),B(e)),!b.isDigit(T(e)))throw ue(e,'Digit expected, got "'+T(e)+'"');for(;b.isDigit(T(e));)e.token+=T(e),B(e);if(b.isDecimalMark(T(e),F(e)))throw ue(e,'Digit expected, got "'+T(e)+'"')}else if("."===F(e))throw B(e),ue(e,'Digit expected, got "'+T(e)+'"')}else{if(!b.isAlpha(T(e),D(e),F(e))){for(e.tokenType=w.UNKNOWN;""!==T(e);)e.token+=T(e),B(e);throw ue(e,'Syntax error in part "'+e.token+'"')}for(;b.isAlpha(T(e),D(e),F(e))||b.isDigit(T(e));)e.token+=T(e),B(e);me(E,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}function _(e){do{O(e)}while("\n"===e.token)}function I(e){e.nestingLevel++}function z(e){e.nestingLevel--}function k(e,t){const n={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};sr(n,{expression:e,extraNodes:t}),O(n);const r=function(e){let t;const n=[];let r;for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment));"\n"===e.token||";"===e.token;)0===n.length&&t&&(r=";"!==e.token,n.push({node:t,visible:r})),O(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment),r=";"!==e.token,n.push({node:t,visible:r}));return n.length>0?new s(n):(t||(t=new c(void 0),e.comment&&(t.comment=e.comment)),t)}(n);if(""!==n.token)throw n.tokenType===w.DELIMITER?ce(n,"Unexpected operator "+n.token):ue(n,'Unexpected part "'+n.token+'"');return r}function R(e){let t,n,r,i;const o=function(e){let t=function(e){let t=q(e);for(;"or"===e.token;)_(e),t=new h("or","or",[t,q(e)]);return t}(e);for(;"?"===e.token;){const n=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,_(e);const r=t,i=R(e);if(":"!==e.token)throw ue(e,"False part of conditional expression expected");e.conditionalLevel=null,_(e);const o=R(e);t=new u(r,i,o),e.conditionalLevel=n}return t}(e);if("="===e.token){if(re(o))return t=o.name,_(e),r=R(e),new a(new x(t),r);if(U(o))return _(e),r=R(e),new a(o.object,o.index,r);if(Y(o)&&re(o.fn)&&(i=!0,n=[],t=o.name,o.args.forEach((function(e,t){re(e)?n[t]=e.name:i=!1})),i))return _(e),r=R(e),new l(t,n,r);throw ue(e,"Invalid left hand side of assignment operator =")}return o}function q(e){let t=P(e);for(;"xor"===e.token;)_(e),t=new h("xor","xor",[t,P(e)]);return t}function P(e){let t=j(e);for(;"and"===e.token;)_(e),t=new h("and","and",[t,j(e)]);return t}function j(e){let t=L(e);for(;"|"===e.token;)_(e),t=new h("|","bitOr",[t,L(e)]);return t}function L(e){let t=$(e);for(;"^|"===e.token;)_(e),t=new h("^|","bitXor",[t,$(e)]);return t}function $(e){let t=H(e);for(;"&"===e.token;)_(e),t=new h("&","bitAnd",[t,H(e)]);return t}function H(e){const t=[G(e)],n=[],r={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};for(;me(r,e.token);){const i={name:e.token,fn:r[e.token]};n.push(i),_(e),t.push(G(e))}return 1===t.length?t[0]:2===t.length?new h(n[0].name,n[0].fn,t):new y(n.map((e=>e.fn)),t)}function G(e){let t,n,r,i;t=W(e);const o={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};for(;me(o,e.token);)n=e.token,r=o[n],_(e),i=[t,W(e)],t=new h(n,r,i);return t}function W(e){let t,n,r,i;t=J(e);const o={to:"to",in:"to"};for(;me(o,e.token);)n=e.token,r=o[n],_(e),"in"===n&&""===e.token?t=new h("*","multiply",[t,new x("in")],!0):(i=[t,J(e)],t=new h(n,r,i));return t}function J(e){let t;const n=[];if(t=":"===e.token?new c(1):X(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(n.push(t);":"===e.token&&n.length<3;)_(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?n.push(new x("end")):n.push(X(e));t=3===n.length?new g(n[0],n[2],n[1]):new g(n[0],n[1])}return t}function X(e){let t,n,r,i;t=Q(e);const o={"+":"add","-":"subtract"};for(;me(o,e.token);){n=e.token,r=o[n],_(e);const a=Q(e);i=a.isPercentage?[t,new h("*","multiply",[t,a])]:[t,a],t=new h(n,r,i)}return t}function Q(e){let t,n,r,i;t=ee(e),n=t;const o={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};for(;me(o,e.token);)if(r=e.token,i=o[r],_(e),"%"===r&&e.tokenType===w.DELIMITER&&"("!==e.token)if(""!==e.token&&o[e.token]){const a=new h("/","divide",[t,new c(100)],!1,!0);r=e.token,i=o[r],_(e),n=ee(e),t=new h(r,i,[a,n])}else t=new h("/","divide",[t,new c(100)],!1,!0);else n=ee(e),t=new h(r,i,[t,n]);return t}function ee(e){let t,n;for(t=te(e),n=t;e.tokenType===w.SYMBOL||"in"===e.token&&V(t)||"in"===e.token&&K(t)&&"unaryMinus"===t.fn&&V(t.args[0])||!(e.tokenType!==w.NUMBER||V(n)||K(n)&&"!"!==n.op)||"("===e.token;)n=te(e),t=new h("*","multiply",[t,n],!0);return t}function te(e){let t=ne(e),n=t;const r=[];for(;"/"===e.token&&Z(n);){if(r.push(sr({},e)),_(e),e.tokenType!==w.NUMBER){sr(e,r.pop());break}if(r.push(sr({},e)),_(e),e.tokenType!==w.SYMBOL&&"("!==e.token&&"in"!==e.token){r.pop(),sr(e,r.pop());break}sr(e,r.pop()),r.pop(),n=ne(e),t=new h("/","divide",[t,n])}return t}function ne(e){let t,i,a;const s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return me(s,e.token)?(a=s[e.token],t=e.token,_(e),i=[ne(e)],new h(t,a,i)):function(e){let t,i,a,s;return t=function(e){let t,i,a,s;t=function(e){let t=[];if(e.tokenType===w.SYMBOL&&me(e.extraNodes,e.token)){const n=e.extraNodes[e.token];if(O(e),"("===e.token){if(t=[],I(e),O(e),")"!==e.token)for(t.push(R(e));","===e.token;)O(e),t.push(R(e));if(")"!==e.token)throw ue(e,"Parenthesis ) expected");z(e),O(e)}return new n(t)}return function(e){let t,i;return e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E?(i=e.token,O(e),t=me(A,i)?new c(A[i]):S.includes(i)?new c(n(i,"number")):new x(i),t=ie(e,t),t):function(e){let t,i;return'"'===e.token||"'"===e.token?(i=oe(e,e.token),t=new c(i),t=ie(e,t),t):function(e){let t,i,a,s;if("["===e.token){if(I(e),O(e),"]"!==e.token){const n=ae(e);if(";"===e.token){for(a=1,i=[n];";"===e.token;)O(e),"]"!==e.token&&(i[a]=ae(e),a++);if("]"!==e.token)throw ue(e,"End of matrix ] expected");z(e),O(e),s=i[0].items.length;for(let t=1;t<a;t++)if(i[t].items.length!==s)throw ce(e,"Column dimensions mismatch ("+i[t].items.length+" !== "+s+")");t=new o(i)}else{if("]"!==e.token)throw ue(e,"End of matrix ] expected");z(e),O(e),t=n}}else z(e),O(e),t=new o([]);return ie(e,t)}return function(e){if("{"===e.token){let t;I(e);const n={};do{if(O(e),"}"!==e.token){if('"'===e.token||"'"===e.token)t=oe(e,e.token);else{if(!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ue(e,"Symbol or string expected as object key");t=e.token,O(e)}if(":"!==e.token)throw ue(e,"Colon : expected after object key");O(e),n[t]=R(e)}}while(","===e.token);if("}"!==e.token)throw ue(e,"Comma , or bracket } expected after object value");z(e),O(e);let r=new m(n);return r=ie(e,r),r}return function(e){let t;if(e.tokenType===w.NUMBER){t=e.token,O(e);const i=xe(t,r),o=n(t,i);return new c(o)}return function(e){let t;if("("===e.token){if(I(e),O(e),t=R(e),")"!==e.token)throw ue(e,"Parenthesis ) expected");return z(e),O(e),t=new d(t),t=ie(e,t),t}return function(e){throw""===e.token?ue(e,"Unexpected end of expression"):ue(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e);const u={"!":"factorial","'":"ctranspose"};for(;me(u,e.token);)i=e.token,a=u[i],O(e),s=[t],t=new h(i,a,s),t=ie(e,t);return t}(e),("^"===e.token||".^"===e.token)&&(i=e.token,a="^"===i?"pow":"dotPow",_(e),s=[t,ne(e)],t=new h(i,a,s)),t}(e)}function ie(e,t,n){let r;for(;("("===e.token||"["===e.token||"."===e.token)&&(!n||n.includes(e.token));)if(r=[],"("===e.token){if(!re(t)&&!U(t))return t;if(I(e),O(e),")"!==e.token)for(r.push(R(e));","===e.token;)O(e),r.push(R(e));if(")"!==e.token)throw ue(e,"Parenthesis ) expected");z(e),O(e),t=new f(t,r)}else if("["===e.token){if(I(e),O(e),"]"!==e.token)for(r.push(R(e));","===e.token;)O(e),r.push(R(e));if("]"!==e.token)throw ue(e,"Parenthesis ] expected");z(e),O(e),t=new i(t,new p(r))}else{if(O(e),!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ue(e,"Property name expected after dot");r.push(new c(e.token)),O(e),t=new i(t,new p(r,!0))}return t}function oe(e,t){let n="";for(;""!==T(e)&&T(e)!==t;)if("\\"===T(e)){B(e);const t=T(e),r=M[t];if(void 0!==r)n+=r,e.index+=1;else{if("u"!==t)throw ue(e,`Bad escape character \\${t}`);{const t=e.expression.slice(e.index+1,e.index+5);if(!/^[0-9A-Fa-f]{4}$/.test(t))throw ue(e,`Invalid unicode character \\u${t}`);n+=String.fromCharCode(parseInt(t,16)),e.index+=5}}}else n+=T(e),B(e);if(O(e),e.token!==t)throw ue(e,`End of string ${t} expected`);return O(e),n}function ae(e){const t=[R(e)];let n=1;for(;","===e.token;)O(e),"]"!==e.token&&";"!==e.token&&(t[n]=R(e),n++);return new o(t)}function se(e){return e.index-e.token.length+1}function ue(e,t){const n=se(e),r=new SyntaxError(t+" (char "+n+")");return r.char=n,r}function ce(e,t){const n=se(e),r=new SyntaxError(t+" (char "+n+")");return r.char=n,r}return b.isAlpha=function(e,t,n){return b.isValidLatinOrGreek(e)||b.isValidMathSymbol(e,n)||b.isValidMathSymbol(t,e)},b.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},b.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\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(t)},b.isWhitespace=function(e,t){return" "===e||"\t"===e||"\n"===e&&t>0},b.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},b.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},b.isDigit=function(e){return e>="0"&&e<="9"},b.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},t.addConversion({from:"string",to:"Node",convert:b}),b})),Em="compile",Am=he(Em,["typed","parse"],(e=>{let{typed:t,parse:n}=e;return t(Em,{string:function(e){return n(e).compile()},"Array | Matrix":function(e){return ii(e,(function(e){return n(e).compile()}))}})})),Sm="evaluate",Mm=he(Sm,["typed","parse"],(e=>{let{typed:t,parse:n}=e;return t(Sm,{string:function(e){const t=m();return n(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return n(e).compile().evaluate(t)},"Array | Matrix":function(e){const t=m();return ii(e,(function(e){return n(e).compile().evaluate(t)}))},"Array | Matrix, Map | Object":function(e,t){return ii(e,(function(e){return n(e).compile().evaluate(t)}))}})})),Cm=he("Parser",["evaluate","parse"],(e=>{let{evaluate:t,parse:n}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:m(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(e){return t(e,this.scope)},r.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},r.prototype.getAll=function(){return function(e){if(e instanceof l)return e.wrappedObject;const t={};for(const n of e.keys())o(t,n,e.get(n));return t}(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(e,t){if(!function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){const r=e.charAt(t-1),i=e.charAt(t),o=e.charAt(t+1);if(!(n.isAlpha(i,r,o)||t>0&&n.isDigit(i)))return!1}return!0}(e))throw new Error(`Invalid variable name: '${e}'. Variable names must follow the specified rules.`);return this.scope.set(e,t),t},r.prototype.remove=function(e){this.scope.delete(e)},r.prototype.clear=function(){this.scope.clear()},r}),{isClass:!0}),Tm="parser",Bm=he(Tm,["typed","Parser"],(e=>{let{typed:t,Parser:n}=e;return t(Tm,{"":function(){return new n}})})),Dm=he("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(e=>{let{typed:t,matrix:n,abs:r,addScalar:i,divideScalar:o,multiplyScalar:a,subtractScalar:s,larger:u,equalScalar:c,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return t("lup",{DenseMatrix:function(e){return h(e)},SparseMatrix:function(e){return function(e){const t=e._size[0],n=e._size[1],i=Math.min(t,n),s=e._values,f=e._index,h=e._ptr,d=[],g=[],y=[],x=[t,i],b=[],v=[],w=[],N=[i,n];let E,A,S;const M=[],C=[];for(E=0;E<t;E++)M[E]=E,C[E]=E;const T=function(e,t){const n=C[e],r=C[t];M[n]=t,M[r]=e,C[e]=r,C[t]=n};for(A=0;A<n;A++){const e=new m;A<t&&(y.push(d.length),d.push(1),g.push(A)),w.push(b.length);const n=h[A],i=h[A+1];for(S=n;S<i;S++)E=f[S],e.set(M[E],s[S]);A>0&&e.forEach(0,A-1,(function(t,n){p._forEachRow(t,d,g,y,(function(r,i){r>t&&e.accumulate(r,l(a(i,n)))}))}));let C=A,B=e.get(A),D=r(B);e.forEach(A+1,t-1,(function(e,t){const n=r(t);u(n,D)&&(C=e,D=n,B=t)})),A!==C&&(p._swapRows(A,C,x[1],d,g,y),p._swapRows(A,C,N[1],b,v,w),e.swap(A,C),T(A,C)),e.forEach(0,t-1,(function(e,t){e<=A?(b.push(t),v.push(e)):(t=o(t,B),c(t,0)||(d.push(t),g.push(e)))}))}return w.push(b.length),y.push(d.length),{L:new p({values:d,index:g,ptr:y,size:x}),U:new p({values:b,index:v,ptr:w,size:N}),p:M,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){const t=h(n(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function h(e){const t=e._size[0],n=e._size[1];let l=Math.min(t,n);const p=ae(e._data),m=[],h=[t,l],d=[],g=[l,n];let y,x,b;const v=[];for(y=0;y<t;y++)v[y]=y;for(x=0;x<n;x++){if(x>0)for(y=0;y<t;y++){const e=Math.min(y,x);let t=0;for(b=0;b<e;b++)t=i(t,a(p[y][b],p[b][x]));p[y][x]=s(p[y][x],t)}let e=x,n=0,l=0;for(y=x;y<t;y++){const t=p[y][x],i=r(t);u(i,n)&&(e=y,n=i,l=t)}if(x!==e&&(v[x]=[v[e],v[e]=v[x]][0],f._swapRows(x,e,p)),x<t)for(y=x+1;y<t;y++){const e=p[y][x];c(e,0)||(p[y][x]=o(p[y][x],l))}}for(x=0;x<n;x++)for(y=0;y<t;y++)0===x&&(y<n&&(d[y]=[]),m[y]=[]),y<x?(y<n&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=0)):y!==x?(y<n&&(d[y][x]=0),x<t&&(m[y][x]=p[y][x])):(y<n&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=1));const w=new f({data:m,size:h}),N=new f({data:d,size:g}),E=[];for(y=0,l=v.length;y<l;y++)E[v[y]]=y;return{L:w,U:N,p:E,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}})),Fm=he("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],(e=>{let{typed:t,matrix:n,zeros:r,identity:i,isZero:o,equal:a,sign:s,sqrt:u,conj:c,unaryMinus:l,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=e;return sr(t("qr",{DenseMatrix:function(e){return y(e)},SparseMatrix:function(e){return function(){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){const t=y(n(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:g});function g(e){const t=e._size[0],n=e._size[1],d=i([t],"dense"),g=d._data,y=e.clone(),x=y._data;let b,v,w;const N=r([t],"");for(w=0;w<Math.min(n,t);++w){const e=x[w][w],r=l(a(e,0)?1:s(e)),i=c(r);let d=0;for(b=w;b<t;b++)d=f(d,m(x[b][w],c(x[b][w])));const y=m(r,u(d));if(!o(y)){const r=h(e,y);for(N[w]=1,b=w+1;b<t;b++)N[b]=p(x[b][w],r);const o=l(c(p(r,y)));let a;for(v=w;v<n;v++){for(a=0,b=w;b<t;b++)a=f(a,m(c(N[b]),x[b][v]));for(a=m(a,o),b=w;b<t;b++)x[b][v]=m(h(x[b][v],m(N[b],a)),i)}for(b=0;b<t;b++){for(a=0,v=w;v<t;v++)a=f(a,m(g[b][v],N[v]));for(a=m(a,o),v=w;v<t;++v)g[b][v]=p(h(g[b][v],m(a,c(N[v]))),i)}}}return{Q:d,R:y,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function y(e){const t=g(e),n=t.R._data;if(e._data.length>0){const e="Complex"===n[0][0].type?d(0):0;for(let t=0;t<n.length;++t)for(let r=0;r<t&&r<(n[0]||[]).length;++r)n[t][r]=e}return t}}));function Om(e,t,n,r,i,o,a){let s=0;for(n[a]=e;s>=0;){const e=n[a+s],u=n[r+e];-1===u?(s--,o[t++]=e):(n[r+e]=n[i+u],++s,n[a+s]=u)}return t}function _m(e){return-e-2}const Im=he("csAmd",["add","multiply","transpose"],(e=>{let{add:t,multiply:n,transpose:r}=e;return function(e,a){if(!a||e<=0||e>3)return null;const s=a._size,u=s[0],c=s[1];let l=0,f=Math.max(16,10*Math.sqrt(c));f=Math.min(c-2,f);const p=function(e,i,o,a,s){const u=r(i);if(1===e&&a===o)return t(i,u);if(2===e){const e=u._index,t=u._ptr;let a=0;for(let n=0;n<o;n++){let r=t[n];if(t[n]=a,!(t[n+1]-r>s))for(const i=t[n+1];r<i;r++)e[a++]=e[r]}return t[o]=a,i=r(u),n(u,i)}return n(u,i)}(e,a,u,c,f);!function(e,t){const n=e._values,r=e._index,i=e._ptr,o=e._size[1];let a=0;for(let e=0;e<o;e++){let o=i[e];for(i[e]=a;o<i[e+1];o++)t(r[o],e,n?n[o]:1,null)&&(r[a]=r[o],n&&(n[a]=n[o]),a++)}i[o]=a,r.splice(a,r.length-a),n&&n.splice(a,n.length-a)}(p,o);const m=p._index,h=p._ptr;let d=h[c];const g=[],y=[],x=c+1,b=2*(c+1),v=3*(c+1),w=4*(c+1),N=5*(c+1),E=6*(c+1),A=7*(c+1),S=g;let M,C,T,B,D,F,O,_,I,z,k,R,q,P,j,U,L=function(e,t,n,r,o,a,s,u,c,l,f,p){for(let r=0;r<e;r++)n[0+r]=t[r+1]-t[r];n[0+e]=0;for(let t=0;t<=e;t++)n[o+t]=-1,a[t]=-1,n[s+t]=-1,n[u+t]=-1,n[c+t]=1,n[l+t]=1,n[f+t]=0,n[p+t]=n[0+t];const m=i(0,0,n,l,e);return n[f+e]=-2,t[e]=-1,n[l+e]=0,m}(c,h,y,0,v,S,b,A,x,E,w,N),$=function(e,t,n,r,i,o,a,s,u,c,l){let f=0;for(let p=0;p<e;p++){const m=n[r+p];if(0===m)n[i+p]=-2,f++,t[p]=-1,n[o+p]=0;else if(m>a)n[s+p]=0,n[i+p]=-1,f++,t[p]=_m(e),n[s+e]++;else{const e=n[u+m];-1!==e&&(c[e]=p),n[l+p]=n[u+m],n[u+m]=p}}return f}(c,h,y,N,w,E,f,x,v,S,b),H=0;for(;$<c;){for(T=-1;H<c&&-1===(T=y[v+H]);H++);-1!==y[b+T]&&(S[y[b+T]]=-1),y[v+H]=y[b+T];const e=y[w+T];let t=y[x+T];$+=t;let n=0;y[x+T]=-t;let r=h[T];const o=0===e?r:d;let a=o;for(B=1;B<=e+1;B++){for(B>e?(F=T,O=r,_=y[0+T]-e):(F=m[r++],O=h[F],_=y[0+F]),D=1;D<=_;D++)M=m[O++],(I=y[x+M])<=0||(n+=I,y[x+M]=-I,m[a++]=M,-1!==y[b+M]&&(S[y[b+M]]=S[M]),-1!==S[M]?y[b+S[M]]=y[b+M]:y[v+y[N+M]]=y[b+M]);F!==T&&(h[F]=_m(T),y[E+F]=0)}for(0!==e&&(d=a),y[N+T]=n,h[T]=o,y[0+T]=a-o,y[w+T]=-2,L=i(L,l,y,E,c),z=o;z<a;z++){if(M=m[z],(k=y[w+M])<=0)continue;I=-y[x+M];const e=L-I;for(r=h[M],R=h[M]+k-1;r<=R;r++)F=m[r],y[E+F]>=L?y[E+F]-=I:0!==y[E+F]&&(y[E+F]=y[N+F]+e)}for(z=o;z<a;z++){for(M=m[z],R=h[M],q=R+y[w+M]-1,P=R,j=0,U=0,r=R;r<=q;r++)if(F=m[r],0!==y[E+F]){const e=y[E+F]-L;e>0?(U+=e,m[P++]=F,j+=F):(h[F]=_m(T),y[E+F]=0)}y[w+M]=P-R+1;const e=P,i=R+y[0+M];for(r=q+1;r<i;r++){C=m[r];const e=y[x+C];e<=0||(U+=e,m[P++]=C,j+=C)}0===U?(h[M]=_m(T),I=-y[x+M],n-=I,t+=I,$+=I,y[x+M]=0,y[w+M]=-1):(y[N+M]=Math.min(y[N+M],U),m[P]=m[e],m[e]=m[R],m[R]=T,y[0+M]=P-R+1,j=(j<0?-j:j)%c,y[b+M]=y[A+j],y[A+j]=M,S[M]=j)}for(y[N+T]=n,l=Math.max(l,n),L=i(L+l,l,y,E,c),z=o;z<a;z++)if(M=m[z],!(y[x+M]>=0))for(j=S[M],M=y[A+j],y[A+j]=-1;-1!==M&&-1!==y[b+M];M=y[b+M],L++){for(_=y[0+M],k=y[w+M],r=h[M]+1;r<=h[M]+_-1;r++)y[E+m[r]]=L;let e=M;for(C=y[b+M];-1!==C;){let t=y[0+C]===_&&y[w+C]===k;for(r=h[C]+1;t&&r<=h[C]+_-1;r++)y[E+m[r]]!==L&&(t=0);t?(h[C]=_m(M),y[x+M]+=y[x+C],y[x+C]=0,y[w+C]=-1,C=y[b+C],y[b+e]=C):(e=C,C=y[b+C])}}for(r=o,z=o;z<a;z++)M=m[z],(I=-y[x+M])<=0||(y[x+M]=I,U=y[N+M]+n-I,U=Math.min(U,c-$-I),-1!==y[v+U]&&(S[y[v+U]]=M),y[b+M]=y[v+U],S[M]=-1,y[v+U]=M,H=Math.min(H,U),y[N+M]=U,m[r++]=M);y[x+T]=t,0==(y[0+T]=r-o)&&(h[T]=-1,y[E+T]=0),0!==e&&(d=r)}for(M=0;M<c;M++)h[M]=_m(h[M]);for(C=0;C<=c;C++)y[v+C]=-1;for(C=c;C>=0;C--)y[x+C]>0||(y[b+C]=y[v+h[C]],y[v+h[C]]=C);for(F=c;F>=0;F--)y[x+F]<=0||-1!==h[F]&&(y[b+F]=y[v+h[F]],y[v+h[F]]=F);for(T=0,M=0;M<=c;M++)-1===h[M]&&(T=Om(M,T,y,v,b,g,E));return g.splice(g.length-1,1),g};function i(e,t,n,r,i){if(e<2||e+t<0){for(let e=0;e<i;e++)0!==n[r+e]&&(n[r+e]=1);e=2}return e}function o(e,t){return e!==t}}));function zm(e,t,n,r,i,o,a){let s,u,c,l=0;if(e<=t||n[r+t]<=n[i+e])return-1;n[i+e]=n[r+t];const f=n[o+e];if(n[o+e]=t,-1===f)l=1,c=e;else{for(l=2,c=f;c!==n[a+c];c=n[a+c]);for(s=f;s!==c;s=u)u=n[a+s],n[a+s]=c}return{jleaf:l,q:c}}const km=he("csCounts",["transpose"],(e=>{let{transpose:t}=e;return function(e,n,r,i){if(!e||!n||!r)return null;const o=e._size,a=o[0],s=o[1];let u,c,l,f,p,m,h;const d=4*s+(i?s+a+1:0),g=[],y=s,x=2*s,b=3*s,v=4*s,w=5*s+1;for(l=0;l<d;l++)g[l]=-1;const N=[],E=t(e),A=E._index,S=E._ptr;for(l=0;l<s;l++)for(c=r[l],N[c]=-1===g[b+c]?1:0;-1!==c&&-1===g[b+c];c=n[c])g[b+c]=l;if(i){for(l=0;l<s;l++)g[r[l]]=l;for(u=0;u<a;u++){for(l=s,m=S[u],h=S[u+1],p=m;p<h;p++)l=Math.min(l,g[A[p]]);g[w+u]=g[v+l],g[v+l]=u}}for(u=0;u<s;u++)g[0+u]=u;for(l=0;l<s;l++){for(c=r[l],-1!==n[c]&&N[n[c]]--,f=i?g[v+l]:c;-1!==f;f=i?g[w+f]:-1)for(p=S[f];p<S[f+1];p++){u=A[p];const e=zm(u,c,g,b,y,x,0);e.jleaf>=1&&N[c]++,2===e.jleaf&&N[e.q]--}-1!==n[c]&&(g[0+c]=n[c])}for(c=0;c<s;c++)-1!==n[c]&&(N[n[c]]+=N[c]);return N}})),Rm=he("csSqr",["add","multiply","transpose"],(e=>{let{add:t,multiply:n,transpose:r}=e;const i=Im({add:t,multiply:n,transpose:r}),o=km({transpose:r});return function(e,t,n){const r=t._ptr,a=t._size[1];let s;const u={};if(u.q=i(e,t),e&&!u.q)return null;if(n){const n=e?function(e,t,n){const r=e._values,i=e._index,o=e._ptr,a=e._size,s=e._datatype,u=a[0],c=a[1],l=null,f=[],p=[];let m=0;for(let e=0;e<c;e++){p[e]=m;const t=n?n[e]:e;for(let e=o[t],n=o[t+1],a=e;a<n;a++){const e=i[a];f[m]=e,l&&(l[m]=r[a]),m++}}return p[c]=m,e.createSparseMatrix({values:l,index:f,ptr:p,size:[u,c],datatype:s})}(t,0,u.q):t;u.parent=function(e){if(!e)return null;const t=e._index,n=e._ptr,r=e._size,i=r[0],o=r[1],a=[],s=[],u=o;let c,l;for(c=0;c<i;c++)s[u+c]=-1;for(let e=0;e<o;e++){a[e]=-1,s[0+e]=-1;for(let r=n[e],i=n[e+1],o=r;o<i;o++){const n=t[o];for(c=s[u+n];-1!==c&&c<e;c=l)l=s[0+c],s[0+c]=e,-1===l&&(a[c]=e);s[u+n]=e}}return a}(n);const r=function(e,t){if(!e)return null;let n,r=0;const i=[],o=[],a=t,s=2*t;for(n=0;n<t;n++)o[0+n]=-1;for(n=t-1;n>=0;n--)-1!==e[n]&&(o[a+n]=o[0+e[n]],o[0+e[n]]=n);for(n=0;n<t;n++)-1===e[n]&&(r=Om(n,r,o,0,a,i,s));return i}(u.parent,a);if(u.cp=o(n,u.parent,r,1),n&&u.parent&&u.cp&&function(e,t){const n=e._ptr,r=e._index,i=e._size,o=i[0],a=i[1];t.pinv=[],t.leftmost=[];const s=t.parent,u=t.pinv,c=t.leftmost,l=[],f=o,p=o+a,m=o+2*a;let h,d,g,y,x;for(d=0;d<a;d++)l[f+d]=-1,l[p+d]=-1,l[m+d]=0;for(h=0;h<o;h++)c[h]=-1;for(d=a-1;d>=0;d--)for(y=n[d],x=n[d+1],g=y;g<x;g++)c[r[g]]=d;for(h=o-1;h>=0;h--)u[h]=-1,d=c[h],-1!==d&&(0==l[m+d]++&&(l[p+d]=h),l[0+h]=l[f+d],l[f+d]=h);for(t.lnz=0,t.m2=o,d=0;d<a;d++){if(h=l[f+d],t.lnz++,h<0&&(h=t.m2++),u[h]=d,--m[d]<=0)continue;t.lnz+=l[m+d];const e=s[d];-1!==e&&(0===l[m+e]&&(l[p+e]=l[p+d]),l[0+l[p+d]]=l[f+e],l[f+e]=l[0+h],l[m+e]+=l[m+d])}for(h=0;h<o;h++)u[h]<0&&(u[h]=d++);return!0}(n,u))for(u.unz=0,s=0;s<a;s++)u.unz+=u.cp[s]}else u.unz=4*r[a]+a,u.lnz=u.unz;return u}}));function qm(e,t){return e[t]<0}function Pm(e,t){e[t]=_m(e[t])}function jm(e){return e<0?_m(e):e}function Um(e,t,n,r,i){const o=t._index,a=t._ptr,s=t._size[1];let u,c,l,f=0;for(r[0]=e;f>=0;){e=r[f];const t=i?i[e]:e;qm(a,e)||(Pm(a,e),r[s+f]=t<0?0:jm(a[t]));let p=1;for(c=r[s+f],l=t<0?0:jm(a[t+1]);c<l;c++)if(u=o[c],!qm(a,u)){r[s+f]=c,r[++f]=u,p=0;break}p&&(f--,r[--n]=e)}return n}const Lm=he("csSpsolve",["divideScalar","multiply","subtract"],(e=>{let{divideScalar:t,multiply:n,subtract:r}=e;return function(e,i,o,a,s,u,c){const l=e._values,f=e._index,p=e._ptr,m=e._size[1],h=i._values,d=i._index,g=i._ptr;let y,x,b,v;const w=function(e,t,n,r,i){const o=e._ptr,a=e._size,s=t._index,u=t._ptr,c=a[1];let l,f,p,m=c;for(f=u[n],p=u[n+1],l=f;l<p;l++){const t=s[l];qm(o,t)||(m=Um(t,e,m,r,i))}for(l=m;l<c;l++)Pm(o,r[l]);return m}(e,i,o,a,u);for(y=w;y<m;y++)s[a[y]]=0;for(x=g[o],b=g[o+1],y=x;y<b;y++)s[d[y]]=h[y];for(let e=w;e<m;e++){const i=a[e],o=u?u[i]:i;if(!(o<0))for(x=p[o],b=p[o+1],s[i]=t(s[i],l[c?x:b-1]),y=c?x+1:x,v=c?b:b-1;y<v;y++){const e=f[y];s[e]=r(s[e],n(l[y],s[i]))}}return w}})),$m=he("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],(e=>{let{abs:t,divideScalar:n,multiply:r,subtract:i,larger:o,largerEq:a,SparseMatrix:s}=e;const u=Lm({divideScalar:n,multiply:r,subtract:i});return function(e,i,c){if(!e)return null;const l=e._size[1];let f,p=100,m=100;i&&(f=i.q,p=i.lnz||p,m=i.unz||m);const h=[],d=[],g=[],y=new s({values:h,index:d,ptr:g,size:[l,l]}),x=[],b=[],v=[],w=new s({values:x,index:b,ptr:v,size:[l,l]}),N=[];let E,A;const S=[],M=[];for(E=0;E<l;E++)S[E]=0,N[E]=-1,g[E+1]=0;p=0,m=0;for(let i=0;i<l;i++){g[i]=p,v[i]=m;const s=f?f[i]:i,w=u(y,e,s,M,S,N,1);let C=-1,T=-1;for(A=w;A<l;A++)if(E=M[A],N[E]<0){const e=t(S[E]);o(e,T)&&(T=e,C=E)}else b[m]=N[E],x[m++]=S[E];if(-1===C||T<=0)return null;N[s]<0&&a(t(S[s]),r(T,c))&&(C=s);const B=S[C];for(b[m]=i,x[m++]=B,N[C]=i,d[p]=C,h[p++]=1,A=w;A<l;A++)E=M[A],N[E]<0&&(d[p]=E,h[p++]=n(S[E],B)),S[E]=0}for(g[l]=p,v[l]=m,A=0;A<p;A++)d[A]=N[d[A]];return h.splice(p,h.length-p),d.splice(p,d.length-p),x.splice(m,x.length-m),b.splice(m,b.length-m),{L:y,U:w,pinv:N}}})),Hm=he("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],(e=>{let{typed:t,abs:n,add:r,multiply:i,transpose:o,divideScalar:a,subtract:s,larger:u,largerEq:c,SparseMatrix:l}=e;const f=Rm({add:r,multiply:i,transpose:o}),p=$m({abs:n,divideScalar:a,multiply:i,subtract:s,larger:u,largerEq:c,SparseMatrix:l});return t("slu",{"SparseMatrix, number, number":function(e,t,n){if(!ye(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(n<0||n>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");const r=f(t,e,!1),i=p(e,r,n);return{L:i.L,U:i.U,p:i.pinv,q:r.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function Gm(e,t){let n;const r=t.length,i=[];if(e)for(n=0;n<r;n++)i[e[n]]=t[n];else for(n=0;n<r;n++)i[n]=t[n];return i}const Vm="lusolve",Zm=he(Vm,["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],(e=>{let{typed:t,matrix:n,lup:r,slu:i,usolve:o,lsolve:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Vm,{"Array, Array | Matrix":function(e,t){e=n(e);const i=r(e);return l(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){const n=r(e);return l(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){const n=r(e);return l(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,n,r){const o=i(e,n,r);return l(o.L,o.U,o.p,o.q,t)},"Object, Array | Matrix":function(e,t){return l(e.L,e.U,e.p,e.q,t)}});function c(e){if(E(e))return e;if(N(e))return n(e);throw new TypeError("Invalid Matrix LU decomposition")}function l(e,t,n,r,i){e=c(e),t=c(t),n&&((i=u(e,i,!0))._data=Gm(n,i._data));const s=a(e,i),l=o(t,s);return r&&(l._data=Gm(r,l._data)),l}})),Wm="polynomialRoot",Ym=he(Wm,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],(e=>{let{typed:t,isZero:n,equalScalar:r,add:i,subtract:o,multiply:a,divide:s,sqrt:u,unaryMinus:c,cbrt:l,typeOf:f,im:p,re:m}=e;return t(Wm,{"number|Complex, ...number|Complex":(e,t)=>{const h=[e,...t];for(;h.length>0&&n(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError(`Polynomial [${e}, ${t}] must have a non-zero non-constant coefficient`);switch(h.length){case 2:return[c(s(h[0],h[1]))];case 3:{const[e,t,n]=h,i=a(2,n),l=a(t,t),f=a(4,n,e);if(r(l,f))return[s(c(t),i)];const p=u(o(l,f));return[s(o(p,t),i),s(o(c(p),t),i)]}case 4:{const[e,t,n,d]=h,g=c(a(3,d)),y=a(n,n),x=a(3,d,t),b=i(a(2,n,n,n),a(27,d,d,e)),v=a(9,d,n,t);if(r(y,x)&&r(b,v))return[s(n,g)];const w=o(y,x),N=o(b,v),E=i(a(18,d,n,t,e),a(n,n,t,t)),A=i(a(4,n,n,n,e),a(4,d,t,t,t),a(27,d,d,e,e));if(r(E,A))return[s(o(a(4,d,n,t),i(a(9,d,d,e),a(n,n,n))),a(d,w)),s(o(a(9,d,e),a(n,t)),a(2,w))];let S;return S=r(y,x)?N:s(i(N,u(o(a(N,N),a(4,w,w,w)))),2),l(S,!0).toArray().map((e=>s(i(n,e,s(w,e)),g))).map((e=>"Complex"===f(e)&&r(m(e),m(e)+p(e))?m(e):e))}default:throw new RangeError(`only implemented for cubic or lower-order polynomials, not ${h}`)}}})}));n(9463);const Jm=he("Help",["evaluate"],(e=>{let{evaluate:t}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return n.prototype.type="Help",n.prototype.isHelp=!0,n.prototype.toString=function(){const e=this.doc||{};let n="\n";if(e.name&&(n+="Name: "+e.name+"\n\n"),e.category&&(n+="Category: "+e.category+"\n\n"),e.description&&(n+="Description:\n "+e.description+"\n\n"),e.syntax&&(n+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){n+="Examples:\n";let r=!1;const i=t("config()"),o={config:e=>(r=!0,t("config(newConfig)",{newConfig:e}))};for(let r=0;r<e.examples.length;r++){const i=e.examples[r];let a;n+=" "+i+"\n";try{a=t(i,o)}catch(e){a=e}void 0===a||F(a)||(n+=" "+pr(a,{precision:14})+"\n")}n+="\n",r&&t("config(originalConfig)",{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(n+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(n+="See also: "+e.seealso.join(", ")+"\n"),n},n.prototype.toJSON=function(){const e=ae(this.doc);return e.mathjs="Help",e},n.fromJSON=function(e){const t={};return Object.keys(e).filter((e=>"mathjs"!==e)).forEach((n=>{t[n]=e[n]})),new n(t)},n.prototype.valueOf=n.prototype.toString,n}),{isClass:!0}),Xm=he("Chain",["?on","math","typed"],(e=>{let{on:t,math:n,typed:r}=e;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");ie(e)?this.value=e.value:this.value=e}function o(e,t){pe(i.prototype,e,(function(){const e=t();if("function"==typeof e)return a(e)}))}function a(e){return function(){if(0===arguments.length)return new i(e(this.value));const t=[this.value];for(let e=0;e<arguments.length;e++)t[e+1]=arguments[e];if(r.isTypedFunction(e)){const n=r.resolve(e,t);if(1===n.params.length)throw new Error("chain function "+e.name+" cannot match rest parameter between chain value and additional arguments.");return new i(n.implementation.apply(e,t))}return new i(e.apply(e,t))}}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 pr(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,t){if("string"==typeof e)n=e,"function"==typeof(r=t)&&(i.prototype[n]=a(r));else for(const t in e)me(e,t)&&void 0===s[t]&&o(t,(()=>e[t]));var n,r};const s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(n),t&&t("import",(function(e,t,n){n||o(e,t)})),i}),{isClass:!0}),Qm={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"]},Km={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"]},eh={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,den)","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:Qm,E:Qm,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"]},pi:Km,PI:Km,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"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},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, 1], [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 cubic 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:["divide"]},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"]},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"]},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(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:[]},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:[]},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"]},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 callback to each slice of A along dimension dim.",examples:["A = [[1, 2], [3, 4]]","mapSlices(A, 1, sum)","mapSlices(A, 2, product)"],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","ones","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"]},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)"],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","ones","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","ones","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","ones","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.",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"]},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.",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.",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.",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","sum","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"]},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"]},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:[]},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"]},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"]}},th="help",nh=he(th,["typed","mathWithTransform","Help"],(e=>{let{typed:t,mathWithTransform:n,Help:r}=e;return t(th,{any:function(e){let t,o=e;if("string"!=typeof e)for(t in n)if(me(n,t)&&e===n[t]){o=t;break}const a=i(eh,o);if(!a){const e="function"==typeof o?o.name:o;throw new Error('No documentation found on "'+e+'"')}return new r(a)}})})),rh="chain",ih=he(rh,["typed","Chain"],(e=>{let{typed:t,Chain:n}=e;return t(rh,{"":function(){return new n},any:function(e){return new n(e)}})})),oh=he("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],(e=>{let{typed:t,matrix:n,subtractScalar:r,multiply:i,divideScalar:o,isZero:a,unaryMinus:s}=e;return t("det",{any:function(e){return ae(e)},"Array | Matrix":function(e){let t;switch(t=E(e)?e.size():Array.isArray(e)?(e=n(e)).size():[],t.length){case 0:return ae(e);case 1:if(1===t[0])return ae(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const n=t[0],u=t[1];if(n===u)return function(e,t){if(1===t)return ae(e[0][0]);if(2===t)return r(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));{let n=!1;const u=new Array(t).fill(0).map(((e,t)=>t));for(let s=0;s<t;s++){let c=u[s];if(a(e[c][s])){let r;for(r=s+1;r<t;r++)if(!a(e[u[r]][s])){c=u[r],u[r]=u[s],u[s]=c,n=!n;break}if(r===t)return e[c][s]}const l=e[c][s],f=0===s?1:e[u[s-1]][s-1];for(let n=s+1;n<t;n++){const a=u[n];for(let n=s+1;n<t;n++)e[a][n]=o(r(i(e[a][n],l),i(e[a][s],e[c][n])),f)}}const c=e[u[t-1]][t-1];return n?s(c):c}}(e.clone().valueOf(),n);if(0===u)return 1;throw new RangeError("Matrix must be square (size: "+pr(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}}})})),ah=he("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],(e=>{let{typed:t,matrix:n,divideScalar:r,addScalar:i,multiply:o,unaryMinus:a,det:s,identity:u,abs:c}=e;return t("inv",{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:if(1===t[0])return E(e)?n([r(1,e.valueOf()[0])]):[r(1,e[0])];throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const r=t[0],i=t[1];if(r===i)return E(e)?n(l(e.valueOf(),r,i),e.storage()):l(e,r,i);throw new RangeError("Matrix must be square (size: "+pr(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}},any:function(e){return r(1,e)}});function l(e,t,n){let l,f,p,m,h;if(1===t){if(m=e[0][0],0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,m)]]}if(2===t){const t=s(e);if(0===t)throw Error("Cannot calculate inverse, determinant is zero");return[[r(e[1][1],t),r(a(e[0][1]),t)],[r(a(e[1][0]),t),r(e[0][0],t)]]}{const s=e.concat();for(l=0;l<t;l++)s[l]=s[l].concat();const m=u(t).valueOf();for(let e=0;e<n;e++){let u=c(s[e][e]),d=e;for(l=e+1;l<t;)c(s[l][e])>u&&(u=c(s[l][e]),d=l),l++;if(0===u)throw Error("Cannot calculate inverse, determinant is zero");l=d,l!==e&&(h=s[e],s[e]=s[l],s[l]=h,h=m[e],m[e]=m[l],m[l]=h);const g=s[e],y=m[e];for(l=0;l<t;l++){const t=s[l],u=m[l];if(l!==e){if(0!==t[e]){for(p=r(a(t[e]),g[e]),f=e;f<n;f++)t[f]=i(t[f],o(p,g[f]));for(f=0;f<n;f++)u[f]=i(u[f],o(p,y[f]))}}else{for(p=g[e],f=e;f<n;f++)t[f]=r(t[f],p);for(f=0;f<n;f++)u[f]=r(u[f],p)}}}return m}}})),sh="pinv",uh=he(sh,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],(e=>{let{typed:t,matrix:n,inv:r,deepEqual:i,equal:o,dotDivide:a,dot:s,ctranspose:u,divideScalar:c,multiply:l,add:f,Complex:p}=e;return t(sh,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:return d(e)?u(e):1===t[0]?r(e):a(u(e),s(e,e));case 2:{if(d(e))return u(e);const i=t[0],o=t[1];if(i===o)try{return r(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return E(e)?n(m(e.valueOf(),i,o),e.storage()):m(e,i,o)}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}},any:function(e){return o(e,0)?ae(e):c(1,e)}});function m(e,t,n){const{C:i,F:o}=function(e,t,n){const r=function(e,t,n){const r=ae(e);let i=0;for(let e=0;e<t;e++){if(n<=i)return r;let o=e;for(;h(r[o][i]);)if(o++,t===o&&(o=e,i++,n===i))return r;[r[o],r[e]]=[r[e],r[o]];let s=r[e][i];for(let t=0;t<n;t++)r[e][t]=a(r[e][t],s);for(let o=0;o<t;o++)if(o!==e){s=r[o][i];for(let t=0;t<n;t++)r[o][t]=f(r[o][t],l(-1,l(s,r[e][t])))}i++}return r}(e,t,n);return{C:e.map(((e,n)=>e.filter(((e,n)=>n<t&&!h(s(r[n],r[n])))))),F:r.filter(((e,t)=>!h(s(r[t],r[t]))))}}(e,t,n),c=l(r(l(u(i),i)),u(i)),p=l(u(o),r(l(o,u(o))));return l(p,c)}function h(e){return o(f(e,p(1,1)),f(0,p(1,1)))}function d(e){return i(f(e,p(1,1)),f(l(e,0),p(1,1)))}}));const ch=he("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=>{let{config:t,typed:n,matrix:r,addScalar:i,subtract:o,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:y,add:v,larger:w,column:N,flatten:E,number:A,complex:S,sqrt:M,diag:C,size:T,reshape:B,qr:D,usolve:F,usolveAll:O,im:_,re:I,smaller:z,matrixFromColumns:k,dot:R}=e;const q=function(e){let{config:t,addScalar:n,subtract:r,abs:i,atan:o,cos:a,sin:s,multiplyScalar:u,inv:c,bignumber:l,multiply:f,add:p}=e;function m(e,n,r){const i=n-e;return Math.abs(i)<=t.relTol?Math.PI/4:.5*Math.atan(2*r/(n-e))}function h(e,n,a){const s=r(n,e);return i(s)<=t.relTol?l(-1).acos().div(4):u(.5,o(f(2,a,c(s))))}function d(e,t,n,r){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=Array(i).fill(0),u=Array(i).fill(0);for(let t=0;t<i;t++)s[t]=o*e[t][n]-a*e[t][r],u[t]=a*e[t][n]+o*e[t][r];for(let t=0;t<i;t++)e[t][n]=s[t],e[t][r]=u[t];return e}function g(e,t,i,o){const c=e.length,f=a(t),p=s(t),m=Array(c).fill(l(0)),h=Array(c).fill(l(0));for(let t=0;t<c;t++)m[t]=r(u(f,e[t][i]),u(p,e[t][o])),h[t]=n(u(p,e[t][i]),u(f,e[t][o]));for(let t=0;t<c;t++)e[t][i]=m[t],e[t][o]=h[t];return e}function y(e,t,i,o){const c=e.length,m=l(a(t)),h=l(s(t)),d=u(m,m),g=u(h,h),y=Array(c).fill(l(0)),x=Array(c).fill(l(0)),b=f(l(2),m,h,e[i][o]),v=n(r(u(d,e[i][i]),b),u(g,e[o][o])),w=p(u(g,e[i][i]),b,u(d,e[o][o]));for(let t=0;t<c;t++)y[t]=r(u(m,e[i][t]),u(h,e[o][t])),x[t]=n(u(h,e[i][t]),u(m,e[o][t]));e[i][i]=v,e[o][o]=w,e[i][o]=l(0),e[o][i]=l(0);for(let t=0;t<c;t++)t!==i&&t!==o&&(e[i][t]=y[t],e[t][i]=y[t],e[o][t]=x[t],e[t][o]=x[t]);return e}function x(e,t,n,r){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=o*o,u=a*a,c=Array(i).fill(0),l=Array(i).fill(0),f=s*e[n][n]-2*o*a*e[n][r]+u*e[r][r],p=u*e[n][n]+2*o*a*e[n][r]+s*e[r][r];for(let t=0;t<i;t++)c[t]=o*e[n][t]-a*e[r][t],l[t]=a*e[n][t]+o*e[r][t];e[n][n]=f,e[r][r]=p,e[n][r]=0,e[r][n]=0;for(let t=0;t<i;t++)t!==n&&t!==r&&(e[n][t]=c[t],e[t][n]=c[t],e[r][t]=l[t],e[t][r]=l[t]);return e}function b(e){const t=e.length;let n=0,r=[0,1];for(let i=0;i<t;i++)for(let o=i+1;o<t;o++)Math.abs(n)<Math.abs(e[i][o])&&(n=Math.abs(e[i][o]),r=[i,o]);return[r,n]}function v(e){const t=e.length;let n=0,r=[0,1];for(let o=0;o<t;o++)for(let a=o+1;a<t;a++)i(n)<i(e[o][a])&&(n=i(e[o][a]),r=[o,a]);return[r,n]}function w(e,t,n){const r=e.length,o=Array(r);let a;if(n){a=Array(r);for(let e=0;e<r;e++)a[e]=Array(r)}for(let s=0;s<r;s++){let u=0,c=e[0];for(let t=0;t<e.length;t++)i(e[t])<i(c)&&(u=t,c=e[u]);if(o[s]=e.splice(u,1)[0],n)for(let e=0;e<r;e++)a[s][e]=t[e][u],t[e].splice(u,1)}if(!n)return{values:o};const s=a.map(((e,t)=>({value:o[t],vector:e})));return{values:o,eigenvectors:s}}return function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.relTol,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if("number"===o)return function(e,t,n){const r=e.length,i=Math.abs(t/r);let o,a;if(n){a=new Array(r);for(let e=0;e<r;e++)a[e]=Array(r).fill(0),a[e][e]=1}let s=b(e);for(;Math.abs(s[1])>=Math.abs(i);){const t=s[0][0],r=s[0][1];o=m(e[t][t],e[r][r],e[t][r]),e=x(e,o,t,r),n&&(a=d(a,o,t,r)),s=b(e)}const u=Array(r).fill(0);for(let t=0;t<r;t++)u[t]=e[t][t];return w(ae(u),a,n)}(e,r,a);if("BigNumber"===o)return function(e,t,n){const r=e.length,o=i(t/r);let a,s;if(n){s=new Array(r);for(let e=0;e<r;e++)s[e]=Array(r).fill(0),s[e][e]=1}let u=v(e);for(;i(u[1])>=i(o);){const t=u[0][0],r=u[0][1];a=h(e[t][t],e[r][r],e[t][r]),e=y(e,a,t,r),n&&(s=g(s,a,t,r)),u=v(e)}const c=Array(r).fill(0);for(let t=0;t<r;t++)c[t]=e[t][t];return w(ae(c),s,n)}(e,r,a);throw TypeError("Unsupported data type: "+o)}}({config:t,addScalar:i,subtract:o,column:N,flatten:E,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,inv:m,bignumber:h,complex:S,multiply:y,add:v}),P=function(e){let{addScalar:t,subtract:n,flatten:r,multiply:i,multiplyScalar:o,divideScalar:a,sqrt:s,abs:u,bignumber:c,diag:l,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:g,equal:y,complex:x,larger:b,smaller:v,matrixFromColumns:w,dot:N}=e;function E(e,r,i,a){const u=t(e,a),c=n(o(e,a),o(r,i)),l=o(u,.5),f=o(s(n(o(u,u),o(4,c))),.5);return[t(l,f),n(l,f)]}function A(e,t,r,i,o,a,s,l){const f="BigNumber"===l,p="Complex"===l,m=f?c(0):p?x(0):0,h=f?c(1):p?x(1):1;if(v(u(r),s))return[[h,m],[m,h]];if(b(u(n(o,a)),s))return[[n(o,i),n(a,i)],[r,r]];const d=n(e,o),g=n(i,o);return v(u(t),s)&&v(u(g),s)?[[d,h],[r,m]]:[[t,m],[g,h]]}function S(e,t){for(let n=0;n<e.length;n++)e[n].push(...Array(t-e[n].length).fill(0));for(let n=e.length;n<t;n++)e.push(Array(t).fill(0)),e[n][n]=1;return e}function M(e,t,n){for(let r=0;r<e.length;r++)if(n(e[r],t))return r;return-1}function C(e,t,n,r,i){const o="BigNumber"===i?c(1e3):1e3;let a,s=0;for(;s<5;++s){a=T(t,n,i);try{a=d(e,a)}catch(e){continue}if(b(D(a),o))break}if(s>=5)return null;for(s=0;;){const t=d(e,a);if(v(D(B(a,[t])),r))break;if(++s>=10)return null;a=F(t)}return a}function T(e,t,n){const r="BigNumber"===n,i="Complex"===n;let o=Array(e).fill(0).map((e=>2*Math.random()-1));return r&&(o=o.map((e=>c(e)))),i&&(o=o.map((e=>x(e)))),o=B(o,t),F(o,n)}function B(e,t){const r=f(e);for(let o of t)o=p(o,r),e=n(e,i(a(N(o,e),N(o,o)),o));return e}function D(e){return u(s(N(e,e)))}function F(e,t){const n="Complex"===t,r="BigNumber"===t?c(1):n?x(1):1;return i(a(r,D(e)),e)}return function(e,s,f,p){let d=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const w=function(e,n,r,i,s){const f="BigNumber"===i,p="Complex"===i,m=f?c(0):0,h=f?c(1):p?x(1):1,d=f?c(1):1,g=f?c(10):2,w=o(g,g);let N;s&&(N=Array(n).fill(h));let E=!1;for(;!E;){E=!0;for(let r=0;r<n;r++){let i=m,c=m;for(let o=0;o<n;o++)r!==o&&(i=t(i,u(e[o][r])),c=t(c,u(e[r][o])));if(!y(i,0)&&!y(c,0)){let u=d,l=i;const f=a(c,g),p=o(c,g);for(;v(l,f);)l=o(l,w),u=o(u,g);for(;b(l,p);)l=a(l,w),u=a(u,g);if(v(a(t(l,c),u),o(t(i,c),.95))){E=!1;const t=a(1,u);for(let i=0;i<n;i++)r!==i&&(e[r][i]=o(e[r][i],t),e[i][r]=o(e[i][r],u));s&&(N[r]=o(N[r],t))}}}}return s?l(N):null}(e,s,0,p,d);!function(e,r,i,s,l,f){const p="BigNumber"===s,m="Complex"===s,h=p?c(0):m?x(0):0;p&&(i=c(i));for(let s=0;s<r-2;s++){let c=0,p=h;for(let t=s+1;t<r;t++){const n=e[t][s];v(u(p),u(n))&&(p=n,c=t)}if(!v(u(p),i)){if(c!==s+1){const t=e[c];e[c]=e[s+1],e[s+1]=t;for(let t=0;t<r;t++){const n=e[t][c];e[t][c]=e[t][s+1],e[t][s+1]=n}if(l){const e=f[c];f[c]=f[s+1],f[s+1]=e}}for(let i=s+2;i<r;i++){const u=a(e[i][s],p);if(0!==u){for(let t=0;t<r;t++)e[i][t]=n(e[i][t],o(u,e[s+1][t]));for(let n=0;n<r;n++)e[n][s+1]=t(e[n][s+1],o(u,e[n][i]));if(l)for(let e=0;e<r;e++)f[i][e]=n(f[i][e],o(u,f[s+1][e]))}}}}}(e,s,f,p,d,w);const{values:N,C:T}=function(e,r,o,a,s){const f="BigNumber"===a,p="Complex"===a,m=f?c(1):p?x(1):1;f&&(o=c(o));let d=ae(e);const g=[];let y=r;const b=[];let w=s?l(Array(r).fill(m)):void 0,N=s?l(Array(y).fill(m)):void 0,M=0;for(;M<=100;){M+=1;const e=d[y-1][y-1];for(let t=0;t<y;t++)d[t][t]=n(d[t][t],e);const{Q:c,R:f}=h(d);d=i(f,c);for(let n=0;n<y;n++)d[n][n]=t(d[n][n],e);if(s&&(N=i(N,c)),1===y||v(u(d[y-1][y-2]),o)){M=0,g.push(d[y-1][y-1]),s&&(b.unshift([[1]]),S(N,r),w=i(w,N),y>1&&(N=l(Array(y-1).fill(m)))),y-=1,d.pop();for(let e=0;e<y;e++)d[e].pop()}else if(2===y||v(u(d[y-2][y-3]),o)){M=0;const e=E(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1]);g.push(...e),s&&(b.unshift(A(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1],e[0],e[1],o,a)),S(N,r),w=i(w,N),y>2&&(N=l(Array(y-2).fill(m)))),y-=2,d.pop(),d.pop();for(let e=0;e<y;e++)d[e].pop(),d[e].pop()}if(0===y)break}if(g.sort(((e,t)=>+n(u(e),u(t)))),M>100){const e=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw e.values=g,e.vectors=[],e}const C=s?i(w,function(e,t){const n=[];for(let e=0;e<t;e++)n[e]=Array(t).fill(0);let r=0;for(const t of e){const e=t.length;for(let i=0;i<e;i++)for(let o=0;o<e;o++)n[r+i][r+o]=t[i][o];r+=e}return n}(b,r)):void 0;return{values:g,C}}(e,s,f,p,d);if(d){const t=function(e,t,o,a,s,u,f){const p=m(o),h=i(p,e,o),d="BigNumber"===f,b="Complex"===f,v=d?c(0):b?x(0):0,w=d?c(1):b?x(1):1,N=[],E=[];for(const e of s){const t=M(N,e,y);-1===t?(N.push(e),E.push(1)):E[t]+=1}const A=[],S=N.length,T=Array(t).fill(v),B=l(Array(t).fill(w));for(let e=0;e<S;e++){const s=N[e],c=n(h,i(s,B));let l=g(c,T);for(l.shift();l.length<E[e];){const e=C(c,t,l,u,f);if(null===e)break;l.push(e)}const p=i(m(a),o);l=l.map((e=>i(p,e))),A.push(...l.map((e=>({value:s,vector:r(e)}))))}return A}(e,s,T,w,N,f,p);return{values:N,eigenvectors:t}}return{values:N}}}({config:t,addScalar:i,subtract:o,multiply:y,multiplyScalar:f,flatten:E,divideScalar:p,sqrt:M,abs:s,bignumber:h,diag:C,size:T,reshape:B,qr:D,inv:m,usolve:F,usolveAll:O,equal:a,complex:S,larger:w,smaller:z,matrixFromColumns:k,dot:R});return n("eigs",{Array:function(e){return j(r(e))},"Array, number|BigNumber":function(e,t){return j(r(e),{precision:t})},"Array, Object":(e,t)=>j(r(e),t),Matrix:function(e){return j(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return j(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){const n={matricize:!0};return sr(n,t),j(e,n)}});function j(e){var n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=!("eigenvectors"in i)||i.eigenvectors,u=function(e,t,n){const r=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw new RangeError(`Matrix must be square (size: ${pr(i)})`);const a=i[0];if(function(e,t,n){for(let r=0;r<t;r++)for(let i=0;i<t;i++)if(w(h(s(_(e[r][i]))),n))return!1;return!0}(r,a,t)&&(function(e,t){for(let n=0;n<t;n++)for(let r=0;r<t;r++)e[n][r]=I(e[n][r])}(r,a),function(e,t,n){for(let r=0;r<t;r++)for(let i=r;i<t;i++)if(w(h(s(o(e[r][i],e[i][r]))),n))return!1;return!0}(r,a,t))){const i=U(e,r,a);return q(r,a,t,i,n)}const u=U(e,r,a);return P(r,a,t,u,n)}(e,null!==(n=i.precision)&&void 0!==n?n:t.relTol,a);return i.matricize&&(u.values=r(u.values),a&&(u.eigenvectors=u.eigenvectors.map((e=>{let{value:t,vector:n}=e;return{value:t,vector:r(n)}})))),a&&Object.defineProperty(u,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),u}function U(e,t,n){const r=e.datatype();if("number"===r||"BigNumber"===r||"Complex"===r)return r;let i=!1,o=!1,a=!1;for(let e=0;e<n;e++)for(let r=0;r<n;r++){const n=t[e][r];if(d(n)||b(n))i=!0;else if(g(n))o=!0;else{if(!x(n))throw TypeError("Unsupported type in Matrix: "+oe(n));a=!0}}if(o&&a&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),a){for(let e=0;e<n;e++)for(let r=0;r<n;r++)t[e][r]=S(t[e][r]);return"Complex"}if(o){for(let e=0;e<n;e++)for(let r=0;r<n;r++)t[e][r]=h(t[e][r]);return"BigNumber"}if(i){for(let e=0;e<n;e++)for(let r=0;r<n;r++)t[e][r]=A(t[e][r]);return"number"}throw TypeError("Matrix contains unsupported types only.")}})),lh="expm",fh=he(lh,["typed","abs","add","identity","inv","multiply"],(e=>{let{typed:t,abs:n,add:r,identity:i,inv:o,multiply:a}=e;return t(lh,{Matrix:function(e){const t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+pr(t)+")");const u=t[0],c=function(e){const t=e.size()[0];let r=0;for(let i=0;i<t;i++){let o=0;for(let r=0;r<t;r++)o+=n(e.get([i,r]));r=Math.max(o,r)}return r}(e),l=function(e){for(let t=0;t<30;t++)for(let n=0;n<=t;n++){const r=t-n;if(s(e,n,r)<1e-15)return{q:n,j:r}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(c),f=l.q,p=l.j,m=a(e,Math.pow(2,-p));let h=i(u),d=i(u),g=1,y=m,x=-1;for(let e=1;e<=f;e++)e>1&&(y=a(y,m),x=-x),g=g*(f-e+1)/((2*f-e+1)*e),h=r(h,a(g,y)),d=r(d,a(g*x,y));let b=a(o(d),h);for(let e=0;e<p;e++)b=a(b,b);return M(e)?e.createSparseMatrix(b):b}});function s(e,t,n){let r=1;for(let e=2;e<=t;e++)r*=e;let i=r;for(let e=t+1;e<=2*t;e++)i*=e;const o=i*(2*t+1);return 8*Math.pow(e/Math.pow(2,n),2*t)*r*r/(i*o)}})),ph="sqrtm",mh=he(ph,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],(e=>{let{typed:t,abs:n,add:r,multiply:i,map:o,sqrt:a,subtract:s,inv:u,size:c,max:l,identity:f}=e;const p=1e-6;function m(e){let t,o=0,a=e,m=f(c(e));do{const e=a;if(a=i(.5,r(e,u(m))),m=i(.5,r(m,u(e))),t=l(n(s(a,e))),t>p&&++o>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>p);return a}return t(ph,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:if(1===t[0])return o(e,a);throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:if(t[0]===t[1])return m(e);throw new RangeError("Matrix must be square (size: "+pr(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+pr(t)+")")}}})})),hh="sylvester",dh=he(hh,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(e=>{let{typed:t,schur:n,matrixFromColumns:r,matrix:i,multiply:o,range:a,concat:s,transpose:u,index:c,subset:l,add:f,subtract:p,identity:m,lusolve:h,abs:d}=e;return t(hh,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,t,n){return g(i(e),t,n)},"Array, Array, Matrix":function(e,t,n){return g(i(e),i(t),n)},"Array, Matrix, Array":function(e,t,n){return g(i(e),t,i(n))},"Matrix, Array, Matrix":function(e,t,n){return g(e,i(t),n)},"Matrix, Array, Array":function(e,t,n){return g(e,i(t),i(n))},"Matrix, Matrix, Array":function(e,t,n){return g(e,t,i(n))},"Array, Array, Array":function(e,t,n){return g(i(e),i(t),i(n)).toArray()}});function g(e,t,g){const y=t.size()[0],x=e.size()[0],b=n(e),v=b.T,w=b.U,N=n(o(-1,t)),E=N.T,A=N.U,S=o(o(u(w),g),A),M=a(0,x),C=[],T=(e,t)=>s(e,t,1),B=(e,t)=>s(e,t,0);for(let e=0;e<y;e++)if(e<y-1&&d(l(E,c(e+1,e)))>1e-5){let t=B(l(S,c(M,e)),l(S,c(M,e+1)));for(let n=0;n<e;n++)t=f(t,B(o(C[n],l(E,c(n,e))),o(C[n],l(E,c(n,e+1)))));const n=o(m(x),o(-1,l(E,c(e,e)))),r=o(m(x),o(-1,l(E,c(e+1,e)))),i=o(m(x),o(-1,l(E,c(e,e+1)))),s=o(m(x),o(-1,l(E,c(e+1,e+1)))),u=B(T(f(v,n),r),T(i,f(v,s))),p=h(u,t);C[e]=p.subset(c(a(0,x),0)),C[e+1]=p.subset(c(a(x,2*x),0)),e++}else{let t=l(S,c(M,e));for(let n=0;n<e;n++)t=f(t,o(C[n],l(E,c(n,e))));const n=l(E,c(e,e)),r=p(v,o(n,m(x)));C[e]=h(r,t)}const D=i(r(...C));return o(w,o(D,u(A)))}})),gh="schur",yh=he(gh,["typed","matrix","identity","multiply","qr","norm","subtract"],(e=>{let{typed:t,matrix:n,identity:r,multiply:i,qr:o,norm:a,subtract:s}=e;return t(gh,{Array:function(e){const t=u(n(e));return{U:t.U.valueOf(),T:t.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){const t=e.size()[0];let n,u=e,c=r(t),l=0;do{n=u;const e=o(u),t=e.Q,r=e.R;if(u=i(r,t),c=i(c,t),l++>100)break}while(a(s(u,n))>1e-4);return{U:c,T:u}}})),xh="lyap",bh=he(xh,["typed","matrix","sylvester","multiply","transpose"],(e=>{let{typed:t,matrix:n,sylvester:r,multiply:i,transpose:o}=e;return t(xh,{"Matrix, Matrix":function(e,t){return r(e,o(e),i(-1,t))},"Array, Matrix":function(e,t){return r(n(e),o(n(e)),i(-1,t))},"Matrix, Array":function(e,t){return r(e,o(n(e)),n(i(-1,t)))},"Array, Array":function(e,t){return r(n(e),o(n(e)),n(i(-1,t))).toArray()}})})),vh=he("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(e=>{let{typed:t,matrix:n,multiply:r,equalScalar:i,divideScalar:o,inv:a}=e;const s=zo({typed:t,equalScalar:i}),u=Ro({typed:t});return t("divide",se({"Array | Matrix, Array | Matrix":function(e,t){return r(e,a(t))},"DenseMatrix, any":function(e,t){return u(e,t,o,!1)},"SparseMatrix, any":function(e,t){return s(e,t,o,!1)},"Array, any":function(e,t){return u(n(e),t,o,!1).valueOf()},"any, Array | Matrix":function(e,t){return r(e,a(t))}},o.signatures))})),wh="distance",Nh=he(wh,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(e=>{let{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:o,deepEqual:a,sqrt:s,abs:u}=e;return t(wh,{"Array, Array, Array":function(e,t,n){if(2===e.length&&2===t.length&&2===n.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!l(n))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(a(t,n))throw new TypeError("LinePoint1 should not be same with LinePoint2");const o=r(n[1],t[1]),s=r(t[0],n[0]),u=r(i(n[0],t[1]),i(t[0],n[1]));return d(e[0],e[1],o,s,u)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,n){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(n).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!l(n))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(a(h(t),h(n)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in n&&"lineTwoPtY"in n){const o=r(n.lineTwoPtY,t.lineOnePtY),a=r(t.lineOnePtX,n.lineTwoPtX),s=r(i(n.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,n.lineTwoPtY));return d(e.pointX,e.pointY,o,a,s)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return d(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!f(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(e.length===t.length&&e.length>0){if(!p(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return x(e,t)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,t){if(2===Object.keys(e).length&&3===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in t&&"yCoeffLine"in t&&"constant"in t)return d(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return y(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in t&&"pointTwoY"in t)return x([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in t&&"pointTwoY"in t&&"pointTwoZ"in t)return x([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&c(e[0][0])&&c(e[0][1])){if(e.some((e=>2!==e.length||!c(e[0])||!c(e[1]))))return!1}else{if(!(3===e[0].length&&c(e[0][0])&&c(e[0][1])&&c(e[0][2])))return!1;if(e.some((e=>3!==e.length||!c(e[0])||!c(e[1])||!c(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){const t=[];let n=[],r=[];for(let i=0;i<e.length-1;i++)for(let o=i+1;o<e.length;o++)2===e[0].length?(n=[e[i][0],e[i][1]],r=[e[o][0],e[o][1]]):3===e[0].length&&(n=[e[i][0],e[i][1],e[i][2]],r=[e[o][0],e[o][1],e[o][2]]),t.push(x(n,r));return t}(e)}});function c(e){return"number"==typeof e||g(e)}function l(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])}function f(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])}function p(e){return Array.isArray(e)||(e=h(e)),e.every(c)}function m(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])&&c(e[3])&&c(e[4])&&c(e[5])}function h(e){const t=Object.keys(e),n=[];for(let r=0;r<t.length;r++)n.push(e[t[r]]);return n}function d(e,t,r,a,c){const l=u(n(n(i(r,e),i(a,t)),c)),f=s(n(i(r,r),i(a,a)));return o(l,f)}function y(e,t,a,u,c,l,f,p,m){let h=[r(i(r(c,t),m),i(r(l,a),p)),r(i(r(l,a),f),i(r(u,e),m)),r(i(r(u,e),p),i(r(c,t),f))];h=s(n(n(i(h[0],h[0]),i(h[1],h[1])),i(h[2],h[2])));const d=s(n(n(i(f,f),i(p,p)),i(m,m)));return o(h,d)}function x(e,t){const o=e.length;let a=0,u=0;for(let s=0;s<o;s++)u=r(e[s],t[s]),a=n(i(u,u),a);return s(a)}})),Eh=he("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],(e=>{let{typed:t,config:n,abs:r,add:i,addScalar:o,matrix:a,multiply:s,multiplyScalar:u,divideScalar:c,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=e;return t("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(e,t,n){const r=g(e.valueOf(),t.valueOf(),n.valueOf());return null===r?null:a(r)},"Matrix, Matrix, Matrix, Matrix":function(e,t,n,r){const i=y(e.valueOf(),t.valueOf(),n.valueOf(),r.valueOf());return null===i?null:a(i)}});function g(e,t,n){if(e=x(e),t=x(t),n=x(n),!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&d(e[0])&&d(e[1])&&d(e[2])&&d(e[3])}(n))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,n,r,i,a,s,f,p,m){const h=u(e,s),d=u(r,s),g=u(t,f),y=u(i,f),x=u(n,p),b=u(a,p),v=l(l(l(m,h),g),x),w=l(l(l(o(o(d,y),b),h),g),x),N=c(v,w);return[o(e,u(N,l(r,e))),o(t,u(N,l(i,t))),o(n,u(N,l(a,n)))]}(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],n[3])}function y(e,t,a,m){if(e=x(e),t=x(t),a=x(a),m=x(m),2===e.length){if(!b(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(a))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,a,p){const m=e,d=a,g=l(m,t),y=l(d,p),x=l(u(g[0],y[1]),u(y[0],g[1]));if(h(x))return null;if(f(r(x),n.relTol))return null;const b=u(y[0],m[1]),v=u(y[1],m[0]),w=u(y[0],d[1]),N=u(y[1],d[0]),E=c(o(l(l(b,v),w),N),x);return i(s(g,E),m)}(e,t,a,m)}if(3===e.length){if(!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!v(a))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!v(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,n,r,i,a,s,f,m,d,g,y){const x=w(e,s,d,s,t,f,g,f,n,m,y,m),b=w(d,s,r,e,g,f,i,t,y,m,a,n),v=w(e,s,r,e,t,f,i,t,n,m,a,n),N=w(d,s,d,s,g,f,g,f,y,m,y,m),E=w(r,e,r,e,i,t,i,t,a,n,a,n),A=l(u(x,b),u(v,N)),S=l(u(E,N),u(b,b));if(h(S))return null;const M=c(A,S),C=c(o(x,u(M,b)),N),T=o(e,u(M,l(r,e))),B=o(t,u(M,l(i,t))),D=o(n,u(M,l(a,n))),F=o(s,u(C,l(d,s))),O=o(f,u(C,l(g,f))),_=o(m,u(C,l(y,m)));return p(T,F)&&p(B,O)&&p(D,_)?[T,B,D]:null}(e[0],e[1],e[2],t[0],t[1],t[2],a[0],a[1],a[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function x(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every((e=>Array.isArray(e)&&1===e.length))?m(e):e}function b(e){return 2===e.length&&d(e[0])&&d(e[1])}function v(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,t,n,r,i,a,s,c,f,p,m,h){const d=u(l(e,t),l(n,r)),g=u(l(i,a),l(s,c)),y=u(l(f,p),l(m,h));return o(o(d,g),y)}})),Ah=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:n,add:r,numeric:i}=e;return t("sum",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){try{return oi(e,t,r)}catch(e){throw Zu(e,"sum")}},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function sum");return o(e)}});function o(e){let t;return ri(e,(function(e){try{t=void 0===t?e:r(t,e)}catch(t){throw Zu(t,"sum",e)}})),void 0===t&&(t=i(0,n.number)),"string"==typeof t&&(t=i(t,xe(t,n))),t}})),Sh="cumsum",Mh=he(Sh,["typed","add","unaryPlus"],(e=>{let{typed:t,add:n,unaryPlus:r}=e;return t(Sh,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":a,"Matrix, number | BigNumber":function(e,t){return e.create(a(e.valueOf(),t),e.datatype())},"...":function(e){if(ni(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return o(e)}catch(e){throw Zu(e,Sh)}}function o(e){if(0===e.length)return[];const t=[r(e[0])];for(let r=1;r<e.length;++r)t.push(n(t[r-1],e[r]));return t}function a(e,t){const n=vr(e);if(t<0||t>=n.length)throw new br(t,n.length);try{return s(e,t)}catch(e){throw Zu(e,Sh)}}function s(e,t){let n,r,i;if(t<=0){const a=e[0][0];if(Array.isArray(a)){for(i=ti(e),r=[],n=0;n<i.length;n++)r[n]=s(i[n],t-1);return r}return o(e)}for(r=[],n=0;n<e.length;n++)r[n]=s(e[n],t-1);return r}})),Ch="mean",Th=he(Ch,["typed","add","divide"],(e=>{let{typed:t,add:n,divide:r}=e;return t(Ch,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){try{const i=oi(e,t,n),o=Array.isArray(e)?vr(e):e.size();return r(i,o[t])}catch(e){throw Zu(e,"mean")}},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){let t,i=0;if(ri(e,(function(e){try{t=void 0===t?e:n(t,e),i++}catch(t){throw Zu(t,"mean",e)}})),0===i)throw new Error("Cannot calculate the mean of an empty array");return r(t,i)}})),Bh="median",Dh=he(Bh,["typed","add","divide","compare","partitionSelect"],(e=>{let{typed:t,add:n,divide:r,compare:i,partitionSelect:o}=e;function a(e){try{const t=(e=zr(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){const n=t/2-1,r=o(e,n+1);let a=e[n];for(let t=0;t<n;++t)i(e[t],a)>0&&(a=e[t]);return u(a,r)}{const n=o(e,(t-1)/2);return s(n)}}catch(e){throw Zu(e,"median")}}const s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),u=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return r(n(e,t),2)}});return t(Bh,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function median");return a(e)}})})),Fh=he("mad",["typed","abs","map","median","subtract"],(e=>{let{typed:t,abs:n,map:r,median:i,subtract:o}=e;return t("mad",{"Array | Matrix":a,"...":function(e){return a(e)}});function a(e){if(0===(e=zr(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{const t=i(e);return i(r(e,(function(e){return n(o(e,t))})))}catch(e){throw e instanceof TypeError&&e.message.includes("median")?new TypeError(e.message.replace("median","mad")):Zu(e,"mad")}}})),Oh="unbiased",_h="variance",Ih=he(_h,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s}=e;return t(_h,{"Array | Matrix":function(e){return u(e,Oh)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(e,t){return c(e,t,Oh)},"Array | Matrix, number | BigNumber, string":c,"...":function(e){return u(e,Oh)}});function u(e,t){let a,u=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(ri(e,(function(e){try{a=void 0===a?e:n(a,e),u++}catch(t){throw Zu(t,"variance",e)}})),0===u)throw new Error("Cannot calculate variance of an empty array");const c=o(a,u);if(a=void 0,ri(e,(function(e){const t=r(e,c);a=void 0===a?i(t,t):n(a,i(t,t))})),s(a))return a;switch(t){case"uncorrected":return o(a,u);case"biased":return o(a,u+1);case"unbiased":{const e=g(a)?a.mul(0):0;return 1===u?e:o(a,u-1)}default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function c(e,t,n){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return a(e,t,(e=>u(e,n)))}catch(e){throw Zu(e,"variance")}}})),zh="quantileSeq",kh=he(zh,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],(e=>{let{typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m}=e;return t(zh,{"Array | Matrix, number | BigNumber":(e,t)=>g(e,t,!1),"Array | Matrix, number | BigNumber, number":(e,t,n)=>h(e,t,!1,n,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>h(e,t,n,r,g),"Array | Matrix, Array | Matrix":(e,t)=>y(e,t,!1),"Array | Matrix, Array | Matrix, number":(e,t,n)=>h(e,t,!1,n,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>h(e,t,n,r,y)});function h(e,t,n,r,i){return m(e,r,(e=>i(e,t,n)))}function g(e,t,i){let a;const s=e.valueOf();if(l(t,0))throw new Error("N/prob must be non-negative");if(f(t,1))return d(t)?x(s,t,i):n(x(s,t,i));if(p(t,1)){if(!c(t))throw new Error("N must be a positive integer");if(p(t,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");const e=r(t,1);a=[];for(let n=0;l(n,t);n++){const t=o(n+1,e);a.push(x(s,t,i))}return d(t)?a:n(a)}}function y(e,t,n){const r=e.valueOf(),i=t.valueOf(),o=[];for(let e=0;e<i.length;++e)o.push(x(r,i[e],n));return o}function x(e,t,n){const o=zr(e),l=o.length;if(0===l)throw new Error("Cannot calculate quantile of an empty sequence");const f=d(t)?t*(l-1):t.times(l-1),p=d(t)?Math.floor(f):f.floor().toNumber(),m=d(t)?f%1:f.minus(p);if(c(f))return n?o[f]:s(o,d(t)?f:f.valueOf());let h,g;if(n)h=o[p],g=o[p+1];else{g=s(o,p+1),h=o[p];for(let e=0;e<p;++e)u(o[e],h)>0&&(h=o[e])}return r(a(h,i(1,m)),a(g,m))}})),Rh=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:n,sqrt:r,variance:i}=e;return t("std",{"Array | Matrix":o,"Array | Matrix, string":o,"Array | Matrix, number | BigNumber":o,"Array | Matrix, number | BigNumber, string":o,"...":function(e){return o(e)}});function o(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{const e=i.apply(null,arguments);return A(e)?n(e,r):r(e)}catch(e){throw e instanceof TypeError&&e.message.includes(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),qh="corr",Ph=he(qh,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],(e=>{let{typed:t,matrix:n,sqrt:r,sum:i,add:o,subtract:a,multiply:s,pow:u,divide:c}=e;return t(qh,{"Array, Array":function(e,t){return l(e,t)},"Matrix, Matrix":function(e,t){const r=l(e.toArray(),t.toArray());return Array.isArray(r)?n(r):r}});function l(e,t){const n=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(let r=0;r<e.length;r++){if(e[r].length!==t[r].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");n.push(f(e[r],t[r]))}return n}if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(e,t)}function f(e,t){const n=e.length,l=i(e),f=i(t),p=e.reduce(((e,n,r)=>o(e,s(n,t[r]))),0),m=i(e.map((e=>u(e,2)))),h=i(t.map((e=>u(e,2)))),d=a(s(n,p),s(l,f)),g=r(s(a(s(n,m),u(l,2)),a(s(n,h),u(f,2))));return c(d,g)}}));function jh(e,t){if(t<e)return 1;if(t===e)return t;const n=t+e>>1;return jh(e,n)*jh(n+1,t)}function Uh(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");const n=e-t;let r=1,i=2;const o=t<n?t:n;for(let a=t<n?n+1:t+1;a<=e;++a)for(r*=a;i<=o&&r%i==0;)r/=i,++i;return i<=o&&(r/=jh(i,o)),r}Uh.signature="number, number";const Lh="combinations",$h=he(Lh,["typed"],(e=>{let{typed:t}=e;return t(Lh,{"number, number":Uh,"BigNumber, BigNumber":function(e,t){const n=e.constructor;let r,i;const o=e.minus(t),a=new n(1);if(!Hh(e)||!Hh(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(e))throw new TypeError("k must be less than n in function combinations");if(r=a,t.lt(o))for(i=a;i.lte(o);i=i.plus(a))r=r.times(t.plus(i)).dividedBy(i);else for(i=a;i.lte(t);i=i.plus(a))r=r.times(o.plus(i)).dividedBy(i);return r}})}));function Hh(e){return e.isInteger()&&e.gte(0)}const Gh="combinationsWithRep",Vh=he(Gh,["typed"],(e=>{let{typed:t}=e;return t(Gh,{"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return t<e-1?jh(e,e+t-1)/jh(1,t):jh(t+1,e+t-1)/jh(1,e-1)},"BigNumber, BigNumber":function(e,t){let n,r;const i=new(0,e.constructor)(1),o=e.minus(i);if(!Zh(e)||!Zh(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(n=i,t.lt(o))for(r=i;r.lte(o);r=r.plus(i))n=n.times(t.plus(r)).dividedBy(r);else for(r=i;r.lte(t);r=r.plus(i))n=n.times(o.plus(r)).dividedBy(r);return n}})}));function Zh(e){return e.isInteger()&&e.gte(0)}function Wh(e){let t;if(ye(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:jh(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Wh(1-e));if(e>=171.35)return 1/0;if(e>85){const t=e*e,n=t*e,r=n*e,i=r*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*r)+163879/(209018880*i)+5246819/(75246796800*i*e))}--e,t=Jh[0];for(let n=1;n<Jh.length;++n)t+=Jh[n]/(e+n);const n=e+Yh+.5;return Math.sqrt(2*Math.PI)*Math.pow(n,e+.5)*Math.exp(-n)*t}Wh.signature="number";const Yh=4.7421875,Jh=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Xh=.9189385332046728,Qh=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Kh(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))-Kh(1-e);const t=5+(e-=1)+.5;let n=Qh[0];for(let t=6;t>=1;t--)n+=Qh[t]/(e+t);return Xh+(e+.5)*Math.log(t)-t+Math.log(n)}Kh.signature="number";const ed="gamma",td=he(ed,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(e=>{let{typed:t,config:n,multiplyScalar:r,pow:i,BigNumber:o,Complex:a}=e;return t(ed,{number:Wh,Complex:function e(t){if(0===t.im)return Wh(t.re);if(t.re<.5){const n=new a(1-t.re,-t.im),r=new a(Math.PI*t.re,Math.PI*t.im);return new a(Math.PI).div(r.sin()).div(e(n))}t=new a(t.re-1,t.im);let n=new a(Jh[0],0);for(let e=1;e<Jh.length;++e){const r=new a(Jh[e],0);n=n.add(r.div(t.add(e)))}const r=new a(t.re+Yh+.5,t.im),i=Math.sqrt(2*Math.PI),o=r.pow(t.add(.5)),s=r.neg().exp();return n.mul(i).mul(o).mul(s)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new o(1/0):s(e.minus(1));if(!e.isFinite())return new o(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(e){if(e<8)return new o([1,1,2,6,24,120,720,5040][e]);const t=n.precision+(0|Math.log(e.toNumber())),r=o.clone({precision:t});if(e%2==1)return e.times(s(new o(e-1)));let i=e,a=new r(e),u=e.toNumber();for(;i>2;)i-=2,u+=i,a=a.times(u);return new o(a.toPrecision(o.precision))}})),nd="lgamma",rd=he(nd,["Complex","typed"],(e=>{let{Complex:t,typed:n}=e;const r=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return n(nd,{number:Kh,Complex:function e(n){if(n.isNaN())return new t(NaN,NaN);if(0===n.im)return new t(Kh(n.re),0);if(n.re>=7||Math.abs(n.im)>=7)return i(n);if(n.re<=.1){const i=(r=6.283185307179586,(!0^((a=n.im)>0||!(a<0)&&1/a==1/0)?-r:r)*Math.floor(.5*n.re+.25)),o=n.mul(Math.PI).sin().log(),s=e(new t(1-n.re,-n.im));return new t(1.1447298858494002,i).sub(o).sub(s)}return n.im>=0?o(n):o(n.conjugate()).conjugate();var r,a},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){const n=e.sub(.5).mul(e.log()).sub(e).add(Xh),i=new t(1,0).div(e),o=i.div(e);let a=r[0],s=r[1];const u=2*o.re,c=o.re*o.re+o.im*o.im;for(let e=2;e<8;e++){const t=s;s=-c*a+r[e],a=u*a+t}const l=i.mul(o.mul(a).add(s));return n.add(l)}function o(e){let n=0,r=0,o=e;for(e=e.add(1);e.re<=7;){o=o.mul(e);const t=o.im<0?1:0;0!==t&&0===r&&n++,r=t,e=e.add(1)}return i(e).sub(o.log()).sub(new t(0,2*n*Math.PI*1))}})),id="factorial",od=he(id,["typed","gamma"],(e=>{let{typed:t,gamma:n}=e;return t(id,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return n(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return n(e.plus(1))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ad="kldivergence",sd=he(ad,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(e=>{let{typed:t,matrix:n,divide:r,sum:i,multiply:o,map:a,dotDivide:s,log:u,isNumeric:c}=e;return t(ad,{"Array, Array":function(e,t){return l(n(e),n(t))},"Matrix, Array":function(e,t){return l(e,n(t))},"Array, Matrix":function(e,t){return l(n(e),t)},"Matrix, Matrix":function(e,t){return l(e,t)}});function l(e,t){const n=t.size().length,l=e.size().length;if(n>1)throw new Error("first object must be one dimensional");if(l>1)throw new Error("second object must be one dimensional");if(n!==l)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(t))throw new Error("Sum of elements in second object must be non zero");const f=r(e,i(e)),p=r(t,i(t)),m=i(o(f,a(s(f,p),(e=>u(e)))));return c(m)?m:Number.NaN}})),ud="multinomial",cd=he(ud,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(e=>{let{typed:t,add:n,divide:r,multiply:i,factorial:o,isInteger:a,isPositive:s}=e;return t(ud,{"Array | Matrix":function(e){let t=0,u=1;return ri(e,(function(e){if(!a(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=n(t,e),u=i(u,o(e))})),r(o(t),u)}})})),ld="permutations",fd=he(ld,["typed","factorial"],(e=>{let{typed:t,factorial:n}=e;return t(ld,{"number | BigNumber":n,"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");return jh(e-t+1,e)},"BigNumber, BigNumber":function(e,t){let n,r;if(!pd(e)||!pd(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(n=e.mul(0).add(1),r=e.minus(t).plus(1);r.lte(e);r=r.plus(1))n=n.times(r);return n}})}));function pd(e){return e.isInteger()&&e.gte(0)}var md=n(7391);const hd=md(Date.now());function dd(e){let t;var n;return t=null===(n=e)?hd:md(String(n)),function(){return t()}}const gd="pickRandom",yd=he(gd,["typed","config","?on"],(e=>{let{typed:t,config:n,on:r}=e,i=dd(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=dd(e.randomSeed))})),t(gd,{"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,t){return o(e,t)},"Array | Matrix, number":function(e,t){return o(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return o(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,n){return o(e,{number:n,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,n){return o(e,{number:t,weights:n})}});function o(e,t){let{number:n,weights:r,elementWise:o=!0}=t;const a=void 0===n;a&&(n=1);const s=E(e)?e.create:E(r)?r.create:null;e=e.valueOf(),r&&(r=r.valueOf()),!0===o&&(e=zr(e),r=zr(r));let u=0;if(void 0!==r){if(r.length!==e.length)throw new Error("Weights must have the same length as possibles");for(let e=0,t=r.length;e<t;e++){if(!d(r[e])||r[e]<0)throw new Error("Weights must be an array of positive numbers");u+=r[e]}}const c=e.length,l=[];let f;for(;l.length<n;){if(void 0===r)f=e[Math.floor(i()*c)];else{let t=i()*u;for(let n=0,i=e.length;n<i;n++)if(t-=r[n],t<0){f=e[n];break}}l.push(f)}return a?l[0]:s?s(l):l}}));function xd(e,t){const n=[];if((e=e.slice(0)).length>1)for(let r=0,i=e.shift();r<i;r++)n.push(xd(e,t));else for(let r=0,i=e.shift();r<i;r++)n.push(t());return n}const bd="random",vd=he(bd,["typed","config","?on"],(e=>{let{typed:t,config:n,on:r}=e,i=dd(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=dd(e.randomSeed))})),t(bd,{"":()=>a(0,1),number:e=>a(0,e),"number, number":(e,t)=>a(e,t),"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,n)=>o(e,t,n)});function o(e,t,n){const r=xd(e.valueOf(),(()=>a(t,n)));return E(e)?e.create(r,"number"):r}function a(e,t){return e+i()*(t-e)}})),wd="randomInt",Nd=2n**30n,Ed=he(wd,["typed","config","log2","?on"],(e=>{let{typed:t,config:n,log2:r,on:i}=e,o=dd(n.randomSeed);return i&&i("config",(function(e,t){e.randomSeed!==t.randomSeed&&(o=dd(e.randomSeed))})),t(wd,{"":()=>s(0,2),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),bigint:e=>u(0n,e),"bigint, bigint":u,"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,t)=>a(e,0,t),"Array | Matrix, number, number":(e,t,n)=>a(e,t,n)});function a(e,t,n){const r=xd(e.valueOf(),(()=>s(t,n)));return E(e)?e.create(r,"number"):r}function s(e,t){return Math.floor(e+o()*(t-e))}function u(e,t){const n=t-e;if(n<=Nd)return e+BigInt(s(0,Number(n)));const i=r(n);let a=n;for(;a>=n;){a=0n;for(let e=0;e<i;++e)a=2n*a+(o()<.5?0n:1n)}return e+a}})),Ad="stirlingS2",Sd=he(Ad,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],(e=>{let{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:o,pow:a,factorial:s,combinations:u,isNegative:c,isInteger:l,number:f,bignumber:p,larger:m}=e;const h=[],g=[];return t(Ad,{"number | BigNumber, number | BigNumber":function(e,t){if(!l(e)||c(e)||!l(t)||c(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");const r=!(d(e)&&d(t)),o=r?g:h,a=r?p:f,s=f(e),u=f(t);if(o[s]&&o[s].length>u)return o[s][u];for(let e=0;e<=s;++e){if(o[e]||(o[e]=[a(0===e?1:0)]),0===e)continue;const t=o[e],r=o[e-1];for(let o=t.length;o<=e&&o<=u;++o)t[o]=o===e?1:n(i(a(o),r[o]),r[o-1])}return o[s][u]}})})),Md="bellNumbers",Cd=he(Md,["typed","addScalar","isNegative","isInteger","stirlingS2"],(e=>{let{typed:t,addScalar:n,isNegative:r,isInteger:i,stirlingS2:o}=e;return t(Md,{"number | BigNumber":function(e){if(!i(e)||r(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");let t=0;for(let r=0;r<=e;r++)t=n(t,o(e,r));return t}})})),Td="catalan",Bd=he(Td,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(e=>{let{typed:t,addScalar:n,divideScalar:r,multiplyScalar:i,combinations:o,isNegative:a,isInteger:s}=e;return t(Td,{"number | BigNumber":function(e){if(!s(e)||a(e))throw new TypeError("Non-negative integer value expected in function catalan");return r(o(i(e,2),e),n(e,1))}})})),Dd="composition",Fd=he(Dd,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(e=>{let{typed:t,addScalar:n,combinations:r,isPositive:i,isNegative:o,isInteger:a,larger:s}=e;return t(Dd,{"number | BigNumber, number | BigNumber":function(e,t){if(!(a(e)&&i(e)&&a(t)&&i(t)))throw new TypeError("Positive integer value expected in function composition");if(s(t,e))throw new TypeError("k must be less than or equal to n in function composition");return r(n(e,-1),n(t,-1))}})})),Od="leafCount",_d=he(Od,["parse","typed"],(e=>{let{parse:t,typed:n}=e;function r(e){let t=0;return e.forEach((e=>{t+=r(e)})),t||1}return n(Od,{Node:function(e){return r(e)}})}));function Id(e){return V(e)||K(e)&&e.isUnary()&&V(e.args[0])}function zd(e){return!!V(e)||!(!Y(e)&&!K(e)||!e.args.every(zd))||!(!ee(e)||!zd(e.content))}const kd=he("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],(e=>{let{FunctionNode:t,OperatorNode:n,SymbolNode:r}=e;const i=!0,o=!1,a="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:o,total:i,commutative:o,associative:o},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:o,total:i,commutative:o,associative:o},paren:{trivial:i,total:i,commutative:i,associative:o},defaultF:{trivial:o,total:i,commutative:o,associative:o}};function u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,r=a;if("string"==typeof e?r=e:K(e)?r=e.fn.toString():Y(e)?r=e.name:ee(e)&&(r="paren"),me(n,r)){const e=n[r];if(me(e,t))return e[t];if(me(s,r))return s[r][t]}if(me(n,a)){const e=n[a];return me(e,t)?e[t]:s[a][t]}if(me(s,r)){const e=s[r];if(me(e,t))return e[t]}return s[a][t]}function c(e){return u(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)}function l(e,t){let n;const r=[],i=function(e){for(let t=0;t<e.args.length;t++){const o=e.args[t];K(o)&&n===o.op?i(o):r.push(o)}};return c(e,t)?(n=e.op,i(e),r):e.args}function f(e){return K(e)?function(t){try{return new n(e.op,e.fn,t,e.implicit)}catch(e){return console.error(e),[]}}:function(n){return new t(new r(e.name),n)}}return{createMakeNodeFunction:f,hasProperty:u,isCommutative:function(e){return u(e,"commutative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)},isAssociative:c,mergeContext:function(e,t){const n={...e};for(const r in t)me(e,r)?n[r]={...t[r],...e[r]}:n[r]=t[r];return n},flatten:function e(t,n){if(!t.args||0===t.args.length)return t;t.args=l(t,n);for(let r=0;r<t.args.length;r++)e(t.args[r],n)},allChildren:l,unflattenr:function e(t,n){if(!t.args||0===t.args.length)return;const r=f(t),i=t.args.length;for(let r=0;r<i;r++)e(t.args[r],n);if(i>2&&c(t,n)){let e=t.args.pop();for(;t.args.length>0;)e=r([t.args.pop(),e]);t.args=e.args}},unflattenl:function e(t,n){if(!t.args||0===t.args.length)return;const r=f(t),i=t.args.length;for(let r=0;r<i;r++)e(t.args[r],n);if(i>2&&c(t,n)){let e=t.args.shift();for(;t.args.length>0;)e=r([e,t.args.shift()]);t.args=e.args}},defaultContext:s,realContext:{divide:{total:o},log:{total:o}},positiveContext:{subtract:{total:o},abs:{trivial:i},log:{total:i}}}})),Rd=he("simplify",["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],(e=>{let{typed:t,parse:n,equal:r,resolve:i,simplifyConstant:o,simplifyCore:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:d,ParenthesisNode:g,SymbolNode:y,replacer:x}=e;const{hasProperty:b,isCommutative:v,isAssociative:w,mergeContext:N,flatten:E,unflattenr:A,unflattenl:S,createMakeNodeFunction:M,defaultContext:C,realContext:T,positiveContext:B}=kd({FunctionNode:l,OperatorNode:d,SymbolNode:y});t.addConversion({from:"Object",to:"Map",convert:h});const D=t("simplify",{Node:k,"Node, Map":(e,t)=>k(e,!1,t),"Node, Map, Object":(e,t,n)=>k(e,!1,t,n),"Node, Array":k,"Node, Array, Map":k,"Node, Array, Map, Object":k});function F(e){return e.transform((function(e){return ee(e)?F(e.content):e}))}t.removeConversion({from:"Object",to:"Map",convert:h}),D.defaultContext=C,D.realContext=T,D.positiveContext=B;const O={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};function _(e,t){const r={};if(e.s){const t=e.s.split("->");if(2!==t.length)throw SyntaxError("Could not parse rule: "+e.s);r.l=t[0],r.r=t[1]}else r.l=e.l,r.r=e.r;r.l=F(n(r.l)),r.r=F(n(r.r));for(const t of["imposeContext","repeat","assuming"])t in e&&(r[t]=e[t]);if(e.evaluate&&(r.evaluate=n(e.evaluate)),w(r.l,t)){const e=!v(r.l,t);let n;e&&(n=z());const i=M(r.l),o=z();r.expanded={},r.expanded.l=i([r.l,o]),E(r.expanded.l,t),A(r.expanded.l,t),r.expanded.r=i([r.r,o]),e&&(r.expandedNC1={},r.expandedNC1.l=i([n,r.l]),r.expandedNC1.r=i([n,r.r]),r.expandedNC2={},r.expandedNC2.l=i([n,r.expanded.l]),r.expandedNC2.r=i([n,r.expanded.r]))}return r}D.rules=[a,{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}}},o,{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}}},o,{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"}];let I=0;function z(){return new y("_p"+I++)}function k(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m(),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=r.consoleDebug;t=function(e,t){const n=[];for(let r=0;r<e.length;r++){let i,o=e[r];const a=typeof o;switch(a){case"string":o={s:o};case"object":i=_(o,t);break;case"function":i=o;break;default:throw TypeError("Unsupported type of rule: "+a)}n.push(i)}return n}(t||D.rules,r.context);let a=i(e,n);a=F(a);const s={};let u=a.toString({parenthesis:"all"});for(;!s[u];){s[u]=!0,I=0;let e=u;o&&console.log("Working on: ",u);for(let n=0;n<t.length;n++){let i="";if("function"==typeof t[n]?(a=t[n](a,r),o&&(i=t[n].name)):(E(a,r.context),a=q(a,t[n],r.context),o&&(i=`${t[n].l.toString()} -> ${t[n].r.toString()}`)),o){const t=a.toString({parenthesis:"all"});t!==e&&(console.log("Applying",i,"produced",t),e=t)}S(a,r.context)}u=a.toString({parenthesis:"all"})}return a}function R(e,t,n){let r=e;if(e)for(let i=0;i<e.length;++i){const o=q(e[i],t,n);o!==e[i]&&(r===e&&(r=e.slice()),r[i]=o)}return r}function q(e,t,n){if(t.assuming)for(const r in t.assuming)for(const i in t.assuming[r])if(b(r,i,n)!==t.assuming[r][i])return e;const r=N(t.imposeContext,n);let i=e;if(i instanceof d||i instanceof l){const e=R(i.args,t,n);e!==i.args&&(i=i.clone(),i.args=e)}else if(i instanceof g){if(i.content){const e=q(i.content,t,n);e!==i.content&&(i=new g(e))}}else if(i instanceof u){const e=R(i.items,t,n);e!==i.items&&(i=new u(e))}else if(i instanceof s){let e=i.object;i.object&&(e=q(i.object,t,n));let r=i.index;i.index&&(r=q(i.index,t,n)),e===i.object&&r===i.index||(i=new s(e,r))}else if(i instanceof f){const e=R(i.dimensions,t,n);e!==i.dimensions&&(i=new f(e))}else if(i instanceof p){let e=!1;const r={};for(const o in i.properties)r[o]=q(i.properties[o],t,n),r[o]!==i.properties[o]&&(e=!0);e&&(i=new p(r))}let o=t.r,a=U(t.l,i,r)[0];if(!a&&t.expanded&&(o=t.expanded.r,a=U(t.expanded.l,i,r)[0]),!a&&t.expandedNC1&&(o=t.expandedNC1.r,a=U(t.expandedNC1.l,i,r)[0],a||(o=t.expandedNC2.r,a=U(t.expandedNC2.l,i,r)[0])),a){const e=i.implicit;i=o.clone(),e&&"implicit"in o&&(i.implicit=!0),i=i.transform((function(e){return e.isSymbolNode&&me(a.placeholders,e.name)?a.placeholders[e.name].clone():e}))}return t.repeat&&i!==e&&(i=q(i,t,n)),i}function P(e,t){const n={placeholders:{}};if(!e.placeholders&&!t.placeholders)return n;if(!e.placeholders)return t;if(!t.placeholders)return e;for(const r in e.placeholders)if(me(e.placeholders,r)&&(n.placeholders[r]=e.placeholders[r],me(t.placeholders,r)&&!L(e.placeholders[r],t.placeholders[r])))return null;for(const e in t.placeholders)me(t.placeholders,e)&&(n.placeholders[e]=t.placeholders[e]);return n}function j(e,t){const n=[];if(0===e.length||0===t.length)return n;let r;for(let i=0;i<e.length;i++)for(let o=0;o<t.length;o++)r=P(e[i],t[o]),r&&n.push(r);return n}function U(e,t,n,i){let o=[{placeholders:{}}];if(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l){if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof l&&e.name!==t.name)return[];if(!(1===t.args.length&&1===e.args.length||!w(t,n)&&t.args.length===e.args.length||i)){if(t.args.length>=2&&2===e.args.length){const r=function(e,t){const n=[];let r,i;const o=M(e);if(v(e,t))for(let t=0;t<e.args.length;t++)i=e.args.slice(0),i.splice(t,1),r=1===i.length?i[0]:o(i),n.push(o([e.args[t],r]));else for(let t=1;t<e.args.length;t++){let a=e.args[0];t>1&&(a=o(e.args.slice(0,t))),i=e.args.slice(t),r=1===i.length?i[0]:o(i),n.push(o([a,r]))}return n}(t,n);let i=[];for(let t=0;t<r.length;t++){const o=U(e,r[t],n,!0);i=i.concat(o)}return i}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}{let r=[];for(let i=0;i<e.args.length;i++){const o=U(e.args[i],t.args[i],n);if(0===o.length)break;r.push(o)}if(r.length!==e.args.length){if(!v(t,n)||1===e.args.length)return[];if(e.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");const i=U(e.args[0],t.args[1],n);if(0===i.length)return[];const o=U(e.args[1],t.args[0],n);if(0===o.length)return[];r=[i,o]}o=function(e){if(0===e.length)return e;const t=e.reduce(j),n=[],r={};for(let e=0;e<t.length;e++){const i=JSON.stringify(t[e],x);r[i]||(r[i]=!0,n.push(t[e]))}return n}(r)}}else if(e instanceof y){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(O[e.name]){if(e.name!==t.name)return[]}else switch(e.name[1]>="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":o[0].placeholders[e.name]=t;break;case"c":case"cl":if(!V(t))return[];o[0].placeholders[e.name]=t;break;case"v":if(V(t))return[];o[0].placeholders[e.name]=t;break;case"vl":if(!re(t))return[];o[0].placeholders[e.name]=t;break;case"cd":if(!Id(t))return[];o[0].placeholders[e.name]=t;break;case"vd":if(Id(t))return[];o[0].placeholders[e.name]=t;break;case"ce":if(!zd(t))return[];o[0].placeholders[e.name]=t;break;case"ve":if(zd(t))return[];o[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof c))return[];if(!r(e.value,t.value))return[]}return o}function L(e,t){if(e instanceof c&&t instanceof c){if(!r(e.value,t.value))return!1}else if(e instanceof y&&t instanceof y){if(e.name!==t.name)return!1}else{if(!(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l))return!1;if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof l&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(let n=0;n<e.args.length;n++)if(!L(e.args[n],t.args[n]))return!1}return!0}return D})),qd=he("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],(e=>{let{typed:t,config:n,mathWithTransform:r,matrix:i,fraction:o,bignumber:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=e;const{isCommutative:d,isAssociative:g,allChildren:y,createMakeNodeFunction:x}=kd({FunctionNode:l,OperatorNode:m,SymbolNode:h}),v=t("simplifyConstant",{Node:e=>S(D(e,{})),"Node, Object":function(e,t){return S(D(e,t))}});function w(e){return b(e)?e.valueOf():e instanceof Array?e.map(w):E(e)?i(w(e.valueOf())):e}function N(e,t,n){try{return r[e].apply(null,t)}catch(i){return t=t.map(w),C(r[e].apply(null,t),n)}}const A=t({Fraction:function(e){const t=e=>"BigNumber"===n.number&&a?a(e):Number(e),r=e.s*e.n,i=r<0n?new m("-","unaryMinus",[new c(-t(r))]):new c(t(r));return 1n===e.d?i:new m("/","divide",[i,new c(t(e.d))])},number:function(e){return e<0?T(new c(-e)):new c(e)},BigNumber:function(e){return e<0?T(new c(-e)):new c(e)},bigint:function(e){return e<0n?T(new c(-e)):new c(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new c(e)},Matrix:function(e){return new u(e.valueOf().map((e=>A(e))))}});function S(e){return X(e)?e:A(e)}function M(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&o){const n=o(e),r=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(n.valueOf()===e&&n.n<r&&n.d<r)return n}return e}const C=t({"string, Object":function(e,t){const r=xe(e,n);return"BigNumber"===r?(void 0===a&&iu(),a(e)):"bigint"===r?BigInt(e):"Fraction"===r?(void 0===o&&ou(),o(e)):M(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return M(e,t)},"bigint, Object":function(e,t){return e},"Complex, Object":function(e,t){return 0!==e.im?e:M(e.re,t)},"Matrix, Object":function(e,t){return i(M(e.valueOf()))},"Array, Object":function(e,t){return e.map(M)}});function T(e){return new m("-","unaryMinus",[e])}function B(e,t,n,r){const i=t.shift(),o=t.reduce(((t,i)=>{if(!X(i)){const n=t.pop();if(X(n))return[n,i];try{return t.push(N(e,[n,i],r)),t}catch(e){t.push(n)}}t.push(S(t.pop()));const o=1===t.length?t[0]:n(t);return[n([o,S(i)])]}),[i]);return 1===o.length?o[0]:n([o[0],A(o[1])])}function D(e,t){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":case"bigint":return C(e.value,t);case"string":return e.value;default:if(!isNaN(e.value))return C(e.value,t)}return e;case"FunctionNode":if(r[e.name]&&r[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){const n=e.args.map((e=>D(e,t)));if(!n.some(X))try{return N(e.name,n,t)}catch(e){}if("size"===e.name&&1===n.length&&L(n[0])){const e=[];let t=n[0];for(;L(t);)e.push(t.items.length),t=t.items[0];return i(e)}return new l(e.name,n.map(S))}case"OperatorNode":{const n=e.fn.toString();let r,i;const o=x(e);if(K(e)&&e.isUnary())r=[D(e.args[0],t)],i=X(r[0])?o(r):N(n,r,t);else if(g(e,t.context))if(r=y(e,t.context),r=r.map((e=>D(e,t))),d(n,t.context)){const e=[],a=[];for(let t=0;t<r.length;t++)X(r[t])?a.push(r[t]):e.push(r[t]);e.length>1?(i=B(n,e,o,t),a.unshift(i),i=B(n,a,o,t)):i=B(n,r,o,t)}else i=B(n,r,o,t);else r=e.args.map((e=>D(e,t))),i=B(n,r,o,t);return i}case"ParenthesisNode":return D(e.content,t);case"AccessorNode":return function(e,t,n){if(!J(t))return new s(S(e),S(t));if(L(e)||E(e)){const r=Array.from(t.dimensions);for(;r.length>0;)if(V(r[0])&&"string"!=typeof r[0].value){const t=C(r.shift().value,n);L(e)?e=e.items[t-1]:(e=e.valueOf()[t-1])instanceof Array&&(e=i(e))}else{if(!(r.length>1&&V(r[1])&&"string"!=typeof r[1].value))break;{const t=C(r[1].value,n),o=[],a=L(e)?e.items:e.valueOf();for(const n of a)if(L(n))o.push(n.items[t-1]);else{if(!E(e))break;o.push(n[t-1])}if(o.length!==a.length)break;e=L(e)?new u(o):i(o),r.splice(1,1)}}return r.length===t.dimensions.length?new s(S(e),t):r.length>0?(t=new f(r),new s(S(e),t)):e}if(Q(e)&&1===t.dimensions.length&&V(t.dimensions[0])){const n=t.dimensions[0].value;return n in e.properties?e.properties[n]:new c}return new s(S(e),t)}(D(e.object,t),D(e.index,t),t);case"ArrayNode":{const n=e.items.map((e=>D(e,t)));return n.some(X)?new u(n.map(S)):i(n)}case"IndexNode":return new f(e.dimensions.map((e=>v(e,t))));case"ObjectNode":{const n={};for(const r in e.properties)n[r]=v(e.properties[r],t);return new p(n)}default:throw new Error(`Unimplemented node type in simplifyConstant: ${e.type}`)}}return v})),Pd="simplifyCore",jd=he(Pd,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,parse:n,equal:r,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,AccessorNode:l,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:y,SymbolNode:x}=e;const b=new p(0),v=new p(1),w=new p(!0),N=new p(!1);function E(e){return K(e)&&["and","not","or"].includes(e.op)}const{hasProperty:A,isCommutative:S}=kd({FunctionNode:m,OperatorNode:g,SymbolNode:x});function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t?t.context:void 0;if(A(e,"trivial",n)){if(Y(e)&&1===e.args.length)return M(e.args[0],t);let n=!1,r=0;if(e.forEach((e=>{++r,1===r&&(n=M(e,t))})),1===r)return n}let o=e;if(Y(o)){const e=function(e){const t="OperatorNode:"+e;for(const e of Rp)if(t in e)return e[t].op;return null}(o.name);if(!e)return new m(M(o.fn),o.args.map((e=>M(e,t))));if(o.args.length>2&&A(o,"associative",n))for(;o.args.length>2;){const t=o.args.pop(),n=o.args.pop();o.args.push(new g(e,o.name,[t,n]))}o=new g(e,o.name,o.args)}if(K(o)&&o.isUnary()){const e=M(o.args[0],t);if("~"===o.op&&K(e)&&e.isUnary()&&"~"===e.op)return e.args[0];if("not"===o.op&&K(e)&&e.isUnary()&&"not"===e.op&&E(e.args[0]))return e.args[0];let n=!0;if("-"===o.op&&K(e)&&(e.isBinary()&&"subtract"===e.fn&&(o=new g("-","subtract",[e.args[1],e.args[0]]),n=!1),e.isUnary()&&"-"===e.op))return e.args[0];if(n)return new g(o.op,o.fn,[e])}if(K(o)&&o.isBinary()){const e=M(o.args[0],t);let a=M(o.args[1],t);if("+"===o.op){if(V(e)&&i(e.value))return a;if(V(a)&&i(a.value))return e;K(a)&&a.isUnary()&&"-"===a.op&&(a=a.args[0],o=new g("-","subtract",[e,a]))}if("-"===o.op)return K(a)&&a.isUnary()&&"-"===a.op?M(new g("+","add",[e,a.args[0]]),t):V(e)&&i(e.value)?M(new g("-","unaryMinus",[a])):V(a)&&i(a.value)?e:new g(o.op,o.fn,[e,a]);if("*"===o.op){if(V(e)){if(i(e.value))return b;if(r(e.value,1))return a}if(V(a)){if(i(a.value))return b;if(r(a.value,1))return e;if(S(o,n))return new g(o.op,o.fn,[a,e],o.implicit)}return new g(o.op,o.fn,[e,a],o.implicit)}if("/"===o.op)return V(e)&&i(e.value)?b:V(a)&&r(a.value,1)?e:new g(o.op,o.fn,[e,a]);if("^"===o.op&&V(a)){if(i(a.value))return v;if(r(a.value,1))return e}if("and"===o.op){if(V(e)){if(!e.value)return N;if(E(a))return a;if(V(a))return a.value?w:N}if(V(a)){if(!a.value)return N;if(E(e))return e}}if("or"===o.op){if(V(e)){if(e.value)return w;if(E(a))return a}if(V(a)){if(a.value)return w;if(E(e))return e}}return new g(o.op,o.fn,[e,a])}if(K(o))return new g(o.op,o.fn,o.args.map((e=>M(e,t))));if(L(o))return new f(o.items.map((e=>M(e,t))));if(U(o))return new l(M(o.object,t),M(o.index,t));if(J(o))return new h(o.dimensions.map((e=>M(e,t))));if(Q(o)){const e={};for(const n in o.properties)e[n]=M(o.properties[n],t);return new d(e)}return o}return t(Pd,{Node:M,"Node,Object":M})})),Ud=he("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(e=>{let{typed:t,parse:n,ConstantNode:r,FunctionNode:i,OperatorNode:o,ParenthesisNode:a}=e;function s(e,t){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(re(e)){if(u.has(e.name)){const e=Array.from(u).join(", ");throw new ReferenceError(`recursive loop of variable definitions among {${e}}`)}const i=t.get(e.name);if(X(i)){const n=new Set(u);return n.add(e.name),s(i,t,n)}return"number"==typeof i?n(String(i)):void 0!==i?new r(i):e}if(K(e)){const n=e.args.map((function(e){return s(e,t,u)}));return new o(e.op,e.fn,n,e.implicit)}if(ee(e))return new a(s(e.content,t,u));if(Y(e)){const n=e.args.map((function(e){return s(e,t,u)}));return new i(e.name,n)}return e.map((e=>s(e,t,u)))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,t)=>s(e,h(t)),"Array | Matrix":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array | Matrix, null | undefined":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array, Object":t.referTo("Array,Map",(e=>(t,n)=>e(t,h(n)))),"Matrix, Object":t.referTo("Matrix,Map",(e=>(t,n)=>e(t,h(n)))),"Array | Matrix, Map":t.referToSelf((e=>(t,n)=>t.map((t=>e(t,n)))))})})),Ld="symbolicEqual",$d=he(Ld,["parse","simplify","typed","OperatorNode"],(e=>{let{parse:t,simplify:n,typed:r,OperatorNode:i}=e;function o(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new i("-","subtract",[e,t]),a=n(o,{},r);return V(a)&&!a.value}return r(Ld,{"Node, Node":o,"Node, Node, Object":o})})),Hd="derivative",Gd=he(Hd,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,config:n,parse:r,simplify:i,equal:o,isZero:a,numeric:s,ConstantNode:u,FunctionNode:c,OperatorNode:l,ParenthesisNode:f,SymbolNode:p}=e;function m(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0};const r=new Map,o=t.name,a=x(e,(function e(t){const n=r.get(t);if(void 0!==n)return n;const i=y(e,t,o);return r.set(t,i),i}));return n.simplify?i(a):a}function h(e){const t=r(e);if(!t.isSymbolNode)throw new TypeError(`Invalid variable. Cannot parse ${JSON.stringify(e)} into a variable in function derivative`);return t}const d=t(Hd,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m,"Node, string":(e,t)=>m(e,h(t)),"Node, string, Object":(e,t,n)=>m(e,h(t),n)});d._simplify=!0,d.toTex=function(e){return g.apply(null,e.args)};const g=t("_derivTex",{"Node, SymbolNode":function(e,t){return V(e)&&"string"===oe(e.value)?g(r(e.value).toString(),t.toString(),1):g(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===oe(t.value))return g(e,r(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,n){return g(e.toString(),t.name,n.value)},"string, string, number":function(e,t,n){let r;return r=1===n?"{d\\over d"+t+"}":"{d^{"+n+"}\\over d"+t+"^{"+n+"}}",r+`\\left[${e}\\right]`}}),y=t("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(e,t,n){return t.name!==n},"function, ParenthesisNode, string":function(e,t,n){return e(t.content,n)},"function, FunctionAssignmentNode, string":function(e,t,n){return!t.params.includes(n)||e(t.expr,n)},"function, FunctionNode | OperatorNode, string":function(e,t,n){return t.args.every((t=>e(t,n)))}}),x=t("_derivative",{"ConstantNode, function":function(){return b(0)},"SymbolNode, function":function(e,t){return t(e)?b(0):b(1)},"ParenthesisNode, function":function(e,t){return new f(x(e.content,t))},"FunctionAssignmentNode, function":function(e,t){return t(e)?b(0):x(e.expr,t)},"FunctionNode, function":function(e,t){if(t(e))return b(0);const n=e.args[0];let r,i,o,a,s=!1,u=!1;switch(e.name){case"cbrt":s=!0,i=new l("*","multiply",[b(3),new l("^","pow",[n,new l("/","divide",[b(2),b(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,i=new l("*","multiply",[b(2),new c("sqrt",[n])]);else if(2===e.args.length)return r=new l("/","divide",[b(1),e.args[1]]),x(new l("^","pow",[n,r]),t);break;case"log10":r=b(10);case"log":if(r||1!==e.args.length){if(1===e.args.length&&r||2===e.args.length&&t(e.args[1]))i=new l("*","multiply",[n.clone(),new c("log",[r||e.args[1]])]),s=!0;else if(2===e.args.length)return x(new l("/","divide",[new c("log",[n]),new c("log",[e.args[1]])]),t)}else i=n.clone(),s=!0;break;case"pow":if(2===e.args.length)return x(new l("^","pow",[n,e.args[1]]),t);break;case"exp":i=new c("exp",[n.clone()]);break;case"sin":i=new c("cos",[n.clone()]);break;case"cos":i=new l("-","unaryMinus",[new c("sin",[n.clone()])]);break;case"tan":i=new l("^","pow",[new c("sec",[n.clone()]),b(2)]);break;case"sec":i=new l("*","multiply",[e,new c("tan",[n.clone()])]);break;case"csc":u=!0,i=new l("*","multiply",[e,new c("cot",[n.clone()])]);break;case"cot":u=!0,i=new l("^","pow",[new c("csc",[n.clone()]),b(2)]);break;case"asin":s=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])]);break;case"acos":s=!0,u=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])]);break;case"atan":s=!0,i=new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)]);break;case"asec":s=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acsc":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acot":s=!0,u=!0,i=new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)]);break;case"sinh":i=new c("cosh",[n.clone()]);break;case"cosh":i=new c("sinh",[n.clone()]);break;case"tanh":i=new l("^","pow",[new c("sech",[n.clone()]),b(2)]);break;case"sech":u=!0,i=new l("*","multiply",[e,new c("tanh",[n.clone()])]);break;case"csch":u=!0,i=new l("*","multiply",[e,new c("coth",[n.clone()])]);break;case"coth":u=!0,i=new l("^","pow",[new c("csch",[n.clone()]),b(2)]);break;case"asinh":s=!0,i=new c("sqrt",[new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)])]);break;case"acosh":s=!0,i=new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])]);break;case"atanh":s=!0,i=new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])]);break;case"asech":s=!0,u=!0,i=new l("*","multiply",[n.clone(),new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])])]);break;case"acsch":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acoth":s=!0,u=!0,i=new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])]);break;case"abs":i=new l("/","divide",[new c(new p("abs"),[n.clone()]),n.clone()]);break;default:throw new 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?(o="/",a="divide"):(o="*",a="multiply");let f=x(n,t);return u&&(f=new l("-","unaryMinus",[f])),new l(o,a,[f,i])},"OperatorNode, function":function(e,t){if(t(e))return b(0);if("+"===e.op)return new l(e.op,e.fn,e.args.map((function(e){return x(e,t)})));if("-"===e.op){if(e.isUnary())return new l(e.op,e.fn,[x(e.args[0],t)]);if(e.isBinary())return new l(e.op,e.fn,[x(e.args[0],t),x(e.args[1],t)])}if("*"===e.op){const n=e.args.filter((function(e){return t(e)}));if(n.length>0){const r=e.args.filter((function(e){return!t(e)})),i=1===r.length?r[0]:new l("*","multiply",r),o=n.concat(x(i,t));return new l("*","multiply",o)}return new l("+","add",e.args.map((function(n){return new l("*","multiply",e.args.map((function(e){return e===n?x(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){const n=e.args[0],r=e.args[1];return t(r)?new l("/","divide",[x(n,t),r]):t(n)?new l("*","multiply",[new l("-","unaryMinus",[n]),new l("/","divide",[x(r,t),new l("^","pow",[r.clone(),b(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[x(n,t),r.clone()]),new l("*","multiply",[n.clone(),x(r,t)])]),new l("^","pow",[r.clone(),b(2)])])}if("^"===e.op&&e.isBinary()){const n=e.args[0],r=e.args[1];if(t(n))return V(n)&&(a(n.value)||o(n.value,1))?b(0):new l("*","multiply",[e,new l("*","multiply",[new c("log",[n.clone()]),x(r.clone(),t)])]);if(t(r)){if(V(r)){if(a(r.value))return b(0);if(o(r.value,1))return x(n,t)}const e=new l("^","pow",[n.clone(),new l("-","subtract",[r,b(1)])]);return new l("*","multiply",[r.clone(),new l("*","multiply",[x(n,t),e])])}return new l("*","multiply",[new l("^","pow",[n.clone(),r.clone()]),new l("+","add",[new l("*","multiply",[x(n,t),new l("/","divide",[r.clone(),n.clone()])]),new l("*","multiply",[x(r,t),new c("log",[n.clone()])])])])}throw new 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 b(e,t){return new u(s(e,t||xe(String(e),n)))}return d})),Vd="rationalize",Zd=he(Vd,["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=>{let{config:t,typed:n,equal:r,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,parse:l,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:x,ArrayNode:b,ConstantNode:v,FunctionNode:w,IndexNode:N,ObjectNode:E,OperatorNode:A,SymbolNode:S,ParenthesisNode:M}=e;function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=function(){const e=[p,{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"}],t=[{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)"}],n=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],r={};return r.firstRules=e.concat(t,n),r.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)"}],r.sucDivRules=n,r.firstRulesAgain=e.concat(t),r.finalRules=[p,{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))"}],r}(),i=function(e,t,n,r){const i=[],o=m(e,r,t,{exactFractions:!1}),a="+-*"+((n=!!n)?"/":"");!function e(t){const n=t.type;if("FunctionNode"===n)throw new Error("There is an unsolved function call");if("OperatorNode"===n)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!ye(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(!a.includes(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(let n=0;n<t.args.length;n++)e(t.args[n])}else if("SymbolNode"===n){const e=t.name;-1===i.indexOf(e)&&i.push(e)}else if("ParenthesisNode"===n)e(t.content);else if("ConstantNode"!==n)throw new Error("type "+n+" is not allowed in polynomial expression")}(o);const s={};return s.expression=o,s.variables=i,s}(e,t,!0,r.firstRules),o=i.variables.length,a={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,o>=1){let t,n;e=T(e);let i,o=!0,u=!1;for(e=m(e,r.firstRules,{},a);n=o?r.distrDivRules:r.sucDivRules,o=!o,i=(e=m(e,n,{},s)).toString(),i!==t;)u=!0,t=i;u&&(e=m(e,r.firstRulesAgain,{},a)),e=m(e,r.finalRules,{},a)}const u=[],c={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===o&&(e.args[0]=B(e.args[0],u),e.args[1]=B(e.args[1])),n&&(c.numerator=e.args[0],c.denominator=e.args[1])):(1===o&&(e=B(e,u)),n&&(c.numerator=e,c.denominator=null)),n?(c.coefficients=u,c.variables=i.variables,c.expression=e,c):e}return n(Vd,{Node:C,"Node, boolean":(e,t)=>C(e,{},t),"Node, Object":C,"Node, Object, boolean":C});function T(e,t,n){const r=e.type,i=arguments.length>1;if("OperatorNode"===r&&e.isBinary()){let r,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(r=parseFloat(e.args[1].value),o=r>=2&&ye(r))),o){if(r>2){const t=e.args[0],n=new A("^","pow",[e.args[0].cloneDeep(),new v(r-1)]);e=new A("*","multiply",[t,n])}else e=new A("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===n?t.content=e:t.args[n]=e)}}if("ParenthesisNode"===r)T(e.content,e,"content");else if("ConstantNode"!==r&&"SymbolNode"!==r)for(let t=0;t<e.args.length;t++)T(e.args[t],e,t);if(!i)return e}function B(e,t){void 0===t&&(t=[]),t[0]=0;let n=0,r="";!function e(i,o,a){const s=i.type;if("FunctionNode"===s)throw new Error("There is an unsolved function call");if("OperatorNode"===s){if(!"+-*^".includes(i.op))throw new Error("Operator "+i.op+" invalid");if(null!==o){if(("unaryMinus"===i.fn||"pow"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn&&"multiply"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"multiply"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"unaryMinus"===i.fn)&&0!==a.noFil)throw new Error("Invalid "+i.op+" placing")}"^"!==i.op&&"*"!==i.op||(a.fire=i.op);for(let t=0;t<i.args.length;t++)"unaryMinus"===i.fn&&(a.oper="-"),"+"!==i.op&&"subtract"!==i.fn||(a.fire="",a.cte=1,a.oper=0===t?"+":i.op),a.noFil=t,e(i.args[t],i,a)}else if("SymbolNode"===s){if(i.name!==r&&""!==r)throw new Error("There is more than one variable");if(r=i.name,null===o)return void(t[1]=1);if("^"===o.op&&0!==a.noFil)throw new Error("In power the variable should be the first parameter");if("*"===o.op&&1!==a.noFil)throw new Error("In multiply the variable should be the second parameter");""!==a.fire&&"*"!==a.fire||(n<1&&(t[1]=0),t[1]+=a.cte*("+"===a.oper?1:-1),n=Math.max(1,n))}else{if("ConstantNode"!==s)throw new Error("Type "+s+" is not allowed");{const e=parseFloat(i.value);if(null===o)return void(t[0]=e);if("^"===o.op){if(1!==a.noFil)throw new Error("Constant cannot be powered");if(!ye(e)||e<=0)throw new Error("Non-integer exponent is not allowed");for(let r=n+1;r<e;r++)t[r]=0;return e>n&&(t[e]=0),t[e]+=a.cte*("+"===a.oper?1:-1),void(n=Math.max(e,n))}a.cte=e,""===a.fire&&(t[0]+=a.cte*("+"===a.oper?1:-1))}}}(e,null,{cte:1,oper:"+",fire:""}),n=t.length-1;let i,o=!0;for(let e=n;e>=0;e--){if(0===t[e])continue;let n=new v(o?t[e]:Math.abs(t[e]));const a=t[e]<0?"-":"+";if(e>0){let i=new S(r);if(e>1){const t=new v(e);i=new A("^","pow",[i,t])}n=-1===t[e]&&o?new A("-","unaryMinus",[i]):1===Math.abs(t[e])?i:new A("*","multiply",[n,i])}i=o?n:"+"===a?new A("+","add",[i,n]):new A("-","subtract",[i,n]),o=!1}return o?new v(0):i}})),Wd="zpk2tf",Yd=he(Wd,["typed","add","multiply","Complex","number"],(e=>{let{typed:t,add:n,multiply:r,Complex:i,number:o}=e;return t(Wd,{"Array,Array,number":function(e,t,n){return a(e,t,n)},"Array,Array":function(e,t){return a(e,t,1)},"Matrix,Matrix,number":function(e,t,n){return a(e.valueOf(),t.valueOf(),n)},"Matrix,Matrix":function(e,t){return a(e.valueOf(),t.valueOf(),1)}});function a(e,t,n){e.some((e=>"BigNumber"===e.type))&&(e=e.map((e=>o(e)))),t.some((e=>"BigNumber"===e.type))&&(t=t.map((e=>o(e))));let a=[i(1,0)],u=[i(1,0)];for(let t=0;t<e.length;t++){let n=e[t];"number"==typeof n&&(n=i(n,0)),a=s(a,[i(1,0),i(-n.re,-n.im)])}for(let e=0;e<t.length;e++){let n=t[e];"number"==typeof n&&(n=i(n,0)),u=s(u,[i(1,0),i(-n.re,-n.im)])}for(let e=0;e<a.length;e++)a[e]=r(a[e],n);return[a,u]}function s(e,t){const o=[];for(let a=0;a<e.length+t.length-1;a++){o[a]=i(0,0);for(let i=0;i<e.length;i++)a-i>=0&&a-i<t.length&&(o[a]=n(o[a],r(e[i],t[a-i])))}return o}})),Jd="freqz",Xd=he(Jd,["typed","add","multiply","Complex","divide","matrix"],(e=>{let{typed:t,add:n,multiply:r,Complex:i,divide:o,matrix:a}=e;return t(Jd,{"Array, Array":function(e,t){return s(e,t,u(512))},"Array, Array, Array":function(e,t,n){return s(e,t,n)},"Array, Array, number":function(e,t,n){if(n<0)throw new Error("w must be a positive number");return s(e,t,u(n))},"Matrix, Matrix":function(e,t){const n=u(512),{w:r,h:i}=s(e.valueOf(),t.valueOf(),n);return{w:a(r),h:a(i)}},"Matrix, Matrix, Matrix":function(e,t,n){const{h:r}=s(e.valueOf(),t.valueOf(),n.valueOf());return{h:a(r),w:a(n)}},"Matrix, Matrix, number":function(e,t,n){if(n<0)throw new Error("w must be a positive number");const r=u(n),{h:i}=s(e.valueOf(),t.valueOf(),r);return{h:a(i),w:a(r)}}});function s(e,t,a){const s=[],u=[];for(let o=0;o<a.length;o++){let c=i(0,0),l=i(0,0);for(let t=0;t<e.length;t++)c=n(c,r(e[t],i(Math.cos(-t*a[o]),Math.sin(-t*a[o]))));for(let e=0;e<t.length;e++)l=n(l,r(t[e],i(Math.cos(-e*a[o]),Math.sin(-e*a[o]))));s.push(c),u.push(l)}const c=[];for(let e=0;e<s.length;e++)c.push(o(s[e],u[e]));return{h:c,w:a}}function u(e){const t=[];for(let n=0;n<e;n++)t.push(n/e*Math.PI);return t}})),Qd=he("reviver",["classes"],(e=>{let{classes:t}=e;return function(e,n){const r=t[n&&n.mathjs];return r&&"function"==typeof r.fromJSON?r.fromJSON(n):n}})),Kd=he("replacer",[],(()=>function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?"bigint"==typeof t?{mathjs:"bigint",value:String(t)}:t:{mathjs:"number",value:String(t)}})),eg=Math.PI,tg=2*Math.PI,ng=Math.E,rg=he("true",[],(()=>!0)),ig=he("false",[],(()=>!1)),og=he("null",[],(()=>null)),ag=Ng("Infinity",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1/0):1/0})),sg=Ng("NaN",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(NaN):NaN})),ug=Ng("pi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?kl(n):eg})),cg=Ng("tau",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?Rl(n):tg})),lg=Ng("e",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?Il(n):ng})),fg=Ng("phi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?zl(n):1.618033988749895})),pg=Ng("LN2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).ln():Math.LN2})),mg=Ng("LN10",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(10).ln():Math.LN10})),hg=Ng("LOG2E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(2).ln()):Math.LOG2E})),dg=Ng("LOG10E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(10).ln()):Math.LOG10E})),gg=Ng("SQRT1_2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n("0.5").sqrt():Math.SQRT1_2})),yg=Ng("SQRT2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).sqrt():Math.SQRT2})),xg=Ng("i",["Complex"],(e=>{let{Complex:t}=e;return t.I})),bg=he("PI",["pi"],(e=>{let{pi:t}=e;return t})),vg=he("E",["e"],(e=>{let{e:t}=e;return t})),wg=he("version",[],(()=>"14.2.0"));function Ng(e,t,n){return he(e,t,n,{recreateOnConfigChange:!0})}const Eg=by("speedOfLight","299792458","m s^-1"),Ag=by("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),Sg=by("planckConstant","6.62607015e-34","J s"),Mg=by("reducedPlanckConstant","1.0545718176461565e-34","J s"),Cg=by("magneticConstant","1.25663706212e-6","N A^-2"),Tg=by("electricConstant","8.8541878128e-12","F m^-1"),Bg=by("vacuumImpedance","376.730313667","ohm"),Dg=by("coulomb","8.987551792261171e9","N m^2 C^-2"),Fg=by("elementaryCharge","1.602176634e-19","C"),Og=by("bohrMagneton","9.2740100783e-24","J T^-1"),_g=by("conductanceQuantum","7.748091729863649e-5","S"),Ig=by("inverseConductanceQuantum","12906.403729652257","ohm"),zg=by("magneticFluxQuantum","2.0678338484619295e-15","Wb"),kg=by("nuclearMagneton","5.0507837461e-27","J T^-1"),Rg=by("klitzing","25812.807459304513","ohm"),qg=by("bohrRadius","5.29177210903e-11","m"),Pg=by("classicalElectronRadius","2.8179403262e-15","m"),jg=by("electronMass","9.1093837015e-31","kg"),Ug=by("fermiCoupling","1.1663787e-5","GeV^-2"),Lg=vy("fineStructure",.0072973525693),$g=by("hartreeEnergy","4.3597447222071e-18","J"),Hg=by("protonMass","1.67262192369e-27","kg"),Gg=by("deuteronMass","3.3435830926e-27","kg"),Vg=by("neutronMass","1.6749271613e-27","kg"),Zg=by("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Wg=by("rydberg","10973731.568160","m^-1"),Yg=by("thomsonCrossSection","6.6524587321e-29","m^2"),Jg=vy("weakMixingAngle",.2229),Xg=vy("efimovFactor",22.7),Qg=by("atomicMass","1.66053906660e-27","kg"),Kg=by("avogadro","6.02214076e23","mol^-1"),ey=by("boltzmann","1.380649e-23","J K^-1"),ty=by("faraday","96485.33212331001","C mol^-1"),ny=by("firstRadiation","3.7417718521927573e-16","W m^2"),ry=by("loschmidt","2.686780111798444e25","m^-3"),iy=by("gasConstant","8.31446261815324","J K^-1 mol^-1"),oy=by("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),ay=by("molarVolume","0.022413969545014137","m^3 mol^-1"),sy=vy("sackurTetrode",-1.16487052358),uy=by("secondRadiation","0.014387768775039337","m K"),cy=by("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),ly=by("wienDisplacement","2.897771955e-3","m K"),fy=by("molarMass","0.99999999965e-3","kg mol^-1"),py=by("molarMassC12","11.9999999958e-3","kg mol^-1"),my=by("gravity","9.80665","m s^-2"),hy=by("planckLength","1.616255e-35","m"),dy=by("planckMass","2.176435e-8","kg"),gy=by("planckTime","5.391245e-44","s"),yy=by("planckCharge","1.87554603778e-18","C"),xy=by("planckTemperature","1.416785e+32","K");function by(e,t,n){return he(e,["config","Unit","BigNumber"],(e=>{let{config:r,Unit:i,BigNumber:o}=e;const a=new i("BigNumber"===r.number?new o(t):parseFloat(t),n);return a.fixPrefix=!0,a}))}function vy(e,t){return he(e,["config","BigNumber"],(e=>{let{config:n,BigNumber:r}=e;return"BigNumber"===n.number?new r(t):t}))}const wy=he("mapSlices",["typed","isInteger"],(e=>{let{typed:t,isInteger:n}=e;const r=Co({typed:t,isInteger:n});return t("mapSlices",{"...any":function(e){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1));try{return r.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0,...Co.meta}),Ny=he("column",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;const o=_s({typed:t,Index:n,matrix:r,range:i});return t("column",{"...any":function(e){const t=e.length-1,n=e[t];d(n)&&(e[t]=n-1);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0});function Ey(e,t,n){const r=e.filter((function(e){return re(e)&&!(e.name in t)&&!n.has(e.name)}))[0];if(!r)throw new Error('No undefined variable found in inline expression "'+e+'"');const i=r.name,o=new Map,a=new f(n,o,new Set([i])),s=e.compile();return function(e){return o.set(i,e),s.evaluate(a)}}n(3921);const Ay=he("transformCallback",["typed"],(e=>{let{typed:t}=e;return function(e,r){return t.isTypedFunction(e)?n(e,r):Sy(e,e.length,r)};function n(e,r){const i=Object.fromEntries(Object.entries(e.signatures).map((e=>{let[i,o]=e;const a=i.split(",").length;return t.isTypedFunction(o)?[i,n(o,r)]:[i,Sy(o,a,r)]})));return"string"==typeof e.name?t(e.name,i):t(i)}}));function Sy(e,t,n){return t===n?e:t===n+1?function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];const o=r.slice(0,n),a=My(r[n]);return e(...o,a)}:t>n+1?function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];const o=r.slice(0,n),a=My(r[n]),s=r.slice(n+1);return e(...o,a,...s)}:e}function My(e){return e.map((e=>e+1))}const Cy=he("filter",["typed"],(e=>{let{typed:t}=e;function n(e,n,i){const o=js({typed:t}),a=Ay({typed:t});if(0===e.length)return o();let s=e[0];if(1===e.length)return o(s);const u=e.length-1;let c=e[u];return s&&(s=r(s,i)),c&&(c=re(c)||W(c)?r(c,i):Ey(c,n,i)),o(s,a(c,u))}function r(e,t){return e.compile().evaluate(t)}return n.rawArgs=!0,n}),{isTransformFunction:!0}),Ty=he("forEach",["typed"],(e=>{let{typed:t}=e;const n=Gs({typed:t}),r=Ay({typed:t});function i(e,t,i){if(0===e.length)return n();let a=e[0];if(1===e.length)return n(a);const s=e.length-1;let u=e[s];return a&&(a=o(a,i)),u&&(u=re(u)||W(u)?o(u,i):Ey(u,t,i)),n(a,r(u,s))}function o(e,t){return e.compile().evaluate(t)}return i.rawArgs=!0,i}),{isTransformFunction:!0}),By=he("index",["Index","getMatrixDataType"],(e=>{let{Index:t,getMatrixDataType:n}=e;return function(){const e=[];for(let t=0,r=arguments.length;t<r;t++){let r=arguments[t];if(C(r))r.start--,r.end-=r.step>0?0:2;else if(r&&!0===r.isSet)r=r.map((function(e){return e-1}));else if(N(r)||E(r))"boolean"!==n(r)&&(r=r.map((function(e){return e-1})));else if(d(r)||y(r))r--;else if(g(r))r=r.toNumber()-1;else if("string"!=typeof r)throw new TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");e[t]=r}const r=new t;return t.apply(r,e),r}}),{isTransformFunction:!0}),Dy=he("map",["typed"],(e=>{let{typed:t}=e;const n=eu({typed:t}),r=Ay({typed:t});function i(e,t,i){if(0===e.length)return n();if(1===e.length)return n(e[0]);const o=e.length-1;let a=e.slice(0,o),s=e[o];return a=a.map((e=>u(e,i))),s&&(s=re(s)||W(s)?u(s,i):Ey(s,t,i)),n(...a,r(s,o));function u(e,t){return e.compile().evaluate(t)}}return i.rawArgs=!0,i}),{isTransformFunction:!0});function Fy(e){if(2===e.length&&A(e[0])){const n=(e=e.slice())[1];(d(t=n)||g(t))&&(e[1]=function(e){return d(e)?e-1:g(e)?e.minus(1):e}(n))}var t;return e}const Oy=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:n,numeric:r,larger:i}=e;const o=Sl({typed:t,config:n,numeric:r,larger:i});return t("max",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),_y=he("mean",["typed","add","divide"],(e=>{let{typed:t,add:n,divide:r}=e;const i=Th({typed:t,add:n,divide:r});return t("mean",{"...any":function(e){e=Fy(e);try{return i.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Iy=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:n,numeric:r,smaller:i}=e;const o=Ml({typed:t,config:n,numeric:r,smaller:i});return t("min",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),zy=he("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;const f=uu({typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),f.apply(null,e)}})}),{isTransformFunction:!0}),ky=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;const o=gu({typed:t,Index:n,matrix:r,range:i});return t("row",{"...any":function(e){const t=e.length-1,n=e[t];d(n)&&(e[t]=n-1);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Ry=he("subset",["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;const o=Nu({typed:t,matrix:n,zeros:r,add:i});return t("subset",{"...any":function(e){try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),qy=he("concat",["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:n,isInteger:r}=e;const i=Fs({typed:t,matrix:n,isInteger:r});return t("concat",{"...any":function(e){const t=e.length-1,n=e[t];d(n)?e[t]=n-1:g(n)&&(e[t]=n.minus(1));try{return i.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Py="diff",jy=he(Py,["typed","matrix","subtract","number","bignumber"],(e=>{let{typed:t,matrix:n,subtract:r,number:i,bignumber:o}=e;const a=nu({typed:t,matrix:n,subtract:r,number:i,bignumber:o});return t(Py,{"...any":function(e){e=Fy(e);try{return a.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Uy=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:n,sqrt:r,variance:i}=e;const o=Rh({typed:t,map:n,sqrt:r,variance:i});return t("std",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Ly=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:n,add:r,numeric:i}=e;const o=Ah({typed:t,config:n,add:r,numeric:i});return t("sum",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),$y=he("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],(e=>{let{typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m}=e;const h=kh({typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m});return t("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(e,t,n)=>h(e,t,d(n)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>h(e,t,n,d(r)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(e,t,n)=>h(e,t,d(n)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>h(e,t,n,d(r))});function d(e){return Fy([[],e])[1]}}),{isTransformFunction:!0}),Hy="cumsum",Gy=he(Hy,["typed","add","unaryPlus"],(e=>{let{typed:t,add:n,unaryPlus:r}=e;const i=Mh({typed:t,add:n,unaryPlus:r});return t(Hy,{"...any":function(e){if(2===e.length&&A(e[0])){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Vy="variance",Zy=he(Vy,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s}=e;const u=Ih({typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s});return t(Vy,{"...any":function(e){e=Fy(e);try{return u.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Wy="print",Yy=he(Wy,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;const o=rc({typed:t,matrix:n,zeros:r,add:i});return t(Wy,{"string, Object | Array":function(e,t){return o(a(e),t)},"string, Object | Array, number | Object":function(e,t,n){return o(a(e),t,n)}});function a(e){return e.replace(tc,(e=>"$"+e.slice(1).split(".").map((function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e})).join(".")))}}),{isTransformFunction:!0}),Jy=he("and",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=$c({typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a});function u(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)&&!s(r,!0))return!1;const i=e[1].compile().evaluate(n);return s(r,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Xy=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=Ts({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o});function s(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)&&a(r,!1))return!0;const i=e[1].compile().evaluate(n);return a(r,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0}),Qy=he("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=cs({typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a});function u(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)){if(isNaN(r))return NaN;if(0===r||!1===r)return 0}const i=e[1].compile().evaluate(n);return s(r,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Ky=he("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=ms({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o});function s(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)){if(isNaN(r))return NaN;if(-1===r)return-1;if(!0===r)return 1}const i=e[1].compile().evaluate(n);return a(r,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0});var ex=n(1504);const tx={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null},nx=["Matrix","Array"],rx=["number","BigNumber","Fraction"];function ix(e,t){function n(r){if(r){if(void 0!==r.epsilon){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');const e=ae(r);return e.relTol=r.epsilon,e.absTol=.001*r.epsilon,delete e.epsilon,n(e)}const i=ae(e);ox(r,"matrix",nx),ox(r,"number",rx),ue(e,r);const o=ae(e),a=ae(r);return t("config",o,i,a),o}return ae(e)}return n.MATRIX_OPTIONS=nx,n.NUMBER_OPTIONS=rx,Object.keys(tx).forEach((t=>{Object.defineProperty(n,t,{get:()=>e[t],enumerable:!0,configurable:!0})})),n}function ox(e,t,n){void 0===e[t]||n.includes(e[t])||console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+n.map((e=>JSON.stringify(e))).join(", ")+".")}const ax=function e(n,r){const i=sr({},tx,r);if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");const o=function(e){const t=new ex;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}({isNumber:d,isComplex:x,isBigNumber:g,isBigInt:y,isFraction:b,isUnit:v,isString:w,isArray:N,isMatrix:E,isCollection:A,isDenseMatrix:S,isSparseMatrix:M,isRange:C,isIndex:T,isBoolean:B,isResultSet:D,isHelp:F,isFunction:O,isDate:_,isRegExp:I,isObject:z,isMap:k,isPartitionedMap:R,isObjectWrappingMap:q,isNull:P,isUndefined:j,isAccessorNode:U,isArrayNode:L,isAssignmentNode:$,isBlockNode:H,isConditionalNode:G,isConstantNode:V,isFunctionAssignmentNode:W,isFunctionNode:Y,isIndexNode:J,isNode:X,isObjectNode:Q,isOperatorNode:K,isParenthesisNode:ee,isRangeNode:te,isRelationalNode:ne,isSymbolNode:re,isChain:ie});o.config=ix(i,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};const a={};function s(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.typed.apply(o.typed,t)}s.isTypedFunction=t.isTypedFunction;const u=function(e,t,n,r){function i(t,i,a){var s,u;if(a.wrap&&"function"==typeof i&&(i=function(e){const t=function(){const t=[];for(let e=0,n=arguments.length;e<n;e++){const n=arguments[e];t[e]=n&&n.valueOf()}return e.apply(n,t)};return e.transform&&(t.transform=e.transform),t}(i)),"function"==typeof(u=i)&&"string"==typeof u.signature&&(i=e(t,{[i.signature]:i})),e.isTypedFunction(n[t])&&e.isTypedFunction(i))return i=a.override?e(t,i.signatures):e(n[t],i),n[t]=i,delete r[t],o(t,i),void n.emit("import",t,(function(){return i}));const c=void 0!==n[t],l=null===(s=n.Unit)||void 0===s?void 0:s.isValuelessUnit(t);if(!c&&!l||a.override)return n[t]=i,delete r[t],o(t,i),void n.emit("import",t,(function(){return i}));if(!a.silent)throw new Error('Cannot import "'+t+'": already exists')}function o(e,t){t&&"function"==typeof t.transform?(n.expression.transform[e]=t.transform,u(e)&&(n.expression.mathWithTransform[e]=t.transform)):(delete n.expression.transform[e],u(e)&&(n.expression.mathWithTransform[e]=t))}function a(e){delete n.expression.transform[e],u(e)?n.expression.mathWithTransform[e]=n[e]:delete n.expression.mathWithTransform[e]}function s(t,i){var o,s;let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(u.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(u));const f=c(t)?n.expression.transform:n,p=u in n.expression.transform,m=me(f,u)?f[u]:void 0,h=function(){const r={};t.dependencies.map(ge).forEach((e=>{if(e.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?r.math=n:"mathWithTransform"===e?r.mathWithTransform=n.expression.mathWithTransform:"classes"===e?r.classes=n:r[e]=n[e]}));const o=t(r);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"');if(void 0===m||i.override)return o;if(e.isTypedFunction(m)&&e.isTypedFunction(o))return e(m,o);if(i.silent)return m;throw new Error('Cannot import "'+u+'": already exists')},d=null!==(o=null===(s=t.meta)||void 0===s?void 0:s.formerly)&&void 0!==o?o:"",g=c(t)||function(e){return!(e.fn.includes(".")||me(l,e.fn)||e.meta&&e.meta.isClass)}(t),y=n.expression.mathWithTransform;t.meta&&!1===t.meta.lazy?(f[u]=h(),d&&(f[d]=f[u]),m&&p?(a(u),d&&a(d)):g&&(pe(y,u,(()=>f[u])),d&&pe(y,d,(()=>f[u])))):(pe(f,u,h),d&&pe(f,d,h),m&&p?(a(u),d&&a(d)):g&&(pe(y,u,(()=>f[u])),d&&pe(y,d,(()=>f[u])))),r[u]=t,n.emit("import",u,h)}function u(e){return!me(l,e)}function c(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}const l={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){const n=arguments.length;if(1!==n&&2!==n)throw new ma("import",n,1,2);t||(t={});const r={};!function e(n,r,i){if(Array.isArray(r))r.forEach((t=>e(n,t)));else if("object"==typeof r)for(const t in r)me(r,t)&&e(n,r[t],t);else if(de(r)||void 0!==i){const e=de(r)?c(r)?r.fn+".transform":r.fn:i;if(me(n,e)&&n[e]!==r&&!t.silent)throw new Error('Cannot import "'+e+'" twice');n[e]=r}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}(r,e);for(const e in r)if(me(r,e)){const n=r[e];if(de(n))s(n,t);else if("function"==typeof(o=n)||"number"==typeof o||"string"==typeof o||"boolean"==typeof o||null===o||v(o)||x(o)||g(o)||b(o)||E(o)||Array.isArray(o))i(e,n,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}var o}}(s,0,o,a);return o.import=u,o.on("config",(()=>{Object.values(a).forEach((e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&u(e,{override:!0})}))})),o.create=e.bind(null,n),o.factory=he,o.import(Object.values(le(n))),o.ArgumentsError=ma,o.DimensionError=xr,o.IndexError=br,o}(e)})(),r.default})()));
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,(()=>(()=>{var e={3144:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},r={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},i=function(e,n){return t({},e,n)};e.exports=function(e){for(var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.preserveFormatting,s=void 0!==a&&a,u=o.escapeMapFn,c=void 0===u?i:u,l=String(e),f="",p=c(t({},n),s?t({},r):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,n){e||l.length>=t.length&&l.slice(0,t.length)===t&&(f+=p[m[n]],l=l.slice(t.length,l.length),e=!0)})),e||(f+=l.slice(0,1),l=l.slice(1,l.length))};l;)h();return f}},1880:e=>{e.exports=function e(t,n){"use strict";var r,i,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,a=/(^[ ]*|[ ]*$)/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,c=/^0/,l=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},f=l(t).replace(a,"")||"",p=l(n).replace(a,"")||"",m=f.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||d&&p.match(s)&&Date.parse(p)||null;if(g){if(d<g)return-1;if(d>g)return 1}for(var y=0,x=Math.max(m.length,h.length);y<x;y++){if(r=!(m[y]||"").match(c)&&parseFloat(m[y])||m[y]||0,i=!(h[y]||"").match(c)&&parseFloat(h[y])||h[y]||0,isNaN(r)!==isNaN(i))return isNaN(r)?1:-1;if(typeof r!=typeof i&&(r+="",i+=""),r<i)return-1;if(r>i)return 1}return 0}},7391:(e,t,n)=>{var r=n(7180),i=n(3181),o=n(3031),a=n(9067),s=n(6833),u=n(6098),c=n(4801);c.alea=r,c.xor128=i,c.xorwow=o,c.xorshift7=a,c.xor4096=s,c.tychei=u,e.exports=c},7180:function(e,t,n){var r;!function(e,i){function o(e){var t,n=this,r=(t=4022871197,function(e){e=String(e);for(var n=0;n<e.length;n++){var r=.02519603282416938*(t+=e.charCodeAt(n));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)});n.next=function(){var e=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=e-(n.c=0|e)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(e),n.s0<0&&(n.s0+=1),n.s1-=r(e),n.s1<0&&(n.s1+=1),n.s2-=r(e),n.s2<0&&(n.s2+=1),r=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var n=new o(e),r=t&&t.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.alea=s}(0,e=n.nmd(e),n.amdD)},6098:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.next=function(){var e=t.b,n=t.c,r=t.d,i=t.a;return e=e<<25^e>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^n,t.c=n=n-r|0,t.d=r<<16^n>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):n+=e;for(var r=0;r<n.length+20;r++)t.b^=0|n.charCodeAt(r),t.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function s(e,t){var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.tychei=s}(0,e=n.nmd(e),n.amdD)},3181:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function s(e,t){var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xor128=s}(0,e=n.nmd(e),n.amdD)},6833:function(e,t,n){var r;!function(e,i){function o(e){var t=this;t.next=function(){var e,n,r=t.w,i=t.X,o=t.i;return t.w=r=r+1640531527|0,n=i[o+34&127],e=i[o=o+1&127],n^=n<<13,e^=e<<17,n^=n>>>15,e^=e>>>12,n=i[o]=n^e,t.i=o,n+(r^r>>>16)|0},function(e,t){var n,r,i,o,a,s=[],u=128;for(t===(0|t)?(r=t,t=null):(t+="\0",r=0,u=Math.max(u,t.length)),i=0,o=-32;o<u;++o)t&&(r^=t.charCodeAt((o+32)%t.length)),0===o&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,o>=0&&(a=a+1640531527|0,i=0==(n=s[127&o]^=r+a)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,o=512;o>0;--o)r=s[i+34&127],n=s[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[i]=r^n;e.w=a,e.X=s,e.i=i}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&(r.X&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xor4096=s}(0,e=n.nmd(e),n.amdD)},9067:function(e,t,n){var r;!function(e,i){function o(e){var t=this;t.next=function(){var e,n,r=t.x,i=t.i;return e=r[i],n=(e^=e>>>7)^e<<24,n^=(e=r[i+1&7])^e>>>10,n^=(e=r[i+3&7])^e>>>3,n^=(e=r[i+4&7])^e<<7,e=r[i+7&7],n^=(e^=e<<13)^e<<9,r[i]=n,t.i=i+1&7,n},function(e,t){var n,r=[];if(t===(0|t))r[0]=t;else for(t=""+t,n=0;n<t.length;++n)r[7&n]=r[7&n]<<15^t.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],e.x=r,e.i=0,n=256;n>0;--n)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&(r.x&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xorshift7=s}(0,e=n.nmd(e),n.amdD)},3031:function(e,t,n){var r;!function(e,i){function o(e){var t=this,n="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:n+=e;for(var r=0;r<n.length+64;r++)t.x^=0|n.charCodeAt(r),r==n.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function s(e,t){var n=new o(e),r=t&&t.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var e=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&a(r,n),i.state=function(){return a(n,{})}),i}i&&i.exports?i.exports=s:n.amdD&&n.amdO?void 0===(r=function(){return s}.call(t,n,t,i))||(i.exports=r):this.xorwow=s}(0,e=n.nmd(e),n.amdD)},4801:function(e,t,n){var r;!function(i,o,a){var s,u=256,c=a.pow(u,6),l=a.pow(2,52),f=2*l,p=255;function m(e,t,n){var r=[],p=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,x(o)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(u):(e=new Uint8Array(u),(i.crypto||i.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=i.navigator,n=t&&t.plugins;return[+new Date,i,n,i.screen,x(o)]}}():e,3),r),m=new h(r),b=function(){for(var e=m.g(6),t=c,n=0;e<l;)e=(e+n)*u,t*=u,n=m.g(1);for(;e>=f;)e/=2,t/=2,n>>>=1;return(e+n)/t};return b.int32=function(){return 0|m.g(4)},b.quick=function(){return m.g(4)/4294967296},b.double=b,y(x(m.S),o),(t.pass||n||function(e,t,n,r){return r&&(r.S&&d(r,m),e.state=function(){return d(m,{})}),n?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,n=e.length,r=this,i=0,o=r.i=r.j=0,a=r.S=[];for(n||(e=[n++]);i<u;)a[i]=i++;for(i=0;i<u;i++)a[i]=a[o=p&o+e[i%n]+(t=a[i])],a[o]=t;(r.g=function(e){for(var t,n=0,i=r.i,o=r.j,a=r.S;e--;)t=a[i=p&i+1],n=n*u+a[p&(a[i]=a[o=p&o+t])+(a[o]=t)];return r.i=i,r.j=o,n})(u)}function d(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var n,r=[],i=typeof e;if(t&&"object"==i)for(n in e)try{r.push(g(e[n],t-1))}catch(e){}return r.length?r:"string"==i?e:e+"\0"}function y(e,t){for(var n,r=e+"",i=0;i<r.length;)t[p&i]=p&(n^=19*t[p&i])+r.charCodeAt(i++);return x(t)}function x(e){return String.fromCharCode.apply(0,e)}if(y(a.random(),o),e.exports){e.exports=m;try{s=n(1234)}catch(e){}}else void 0===(r=function(){return m}.call(t,n,t,e))||(e.exports=r)}("undefined"!=typeof self?self:this,[],Math)},1504:e=>{function t(){}t.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,i=n.length;r<i;r++)n[r].fn.apply(n[r].ctx,t);return this},off:function(e,t){var n=this.e||(this.e={}),r=n[e],i=[];if(r&&t)for(var o=0,a=r.length;o<a;o++)r[o].fn!==t&&r[o].fn._!==t&&i.push(r[o]);return i.length?n[e]=i:delete n[e],this}},e.exports=t,e.exports.TinyEmitter=t},1234:()=>{},9306:(e,t,n)=>{"use strict";var r=n(4901),i=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a function")}},5548:(e,t,n)=>{"use strict";var r=n(3517),i=n(6823),o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not a constructor")}},3506:(e,t,n)=>{"use strict";var r=n(3925),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},6469:(e,t,n)=>{"use strict";var r=n(8227),i=n(2360),o=n(4913).f,a=r("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},7829:(e,t,n)=>{"use strict";var r=n(8183).charAt;e.exports=function(e,t,n){return t+(n?r(e,t).length:1)}},679:(e,t,n)=>{"use strict";var r=n(1625),i=TypeError;e.exports=function(e,t){if(r(t,e))return e;throw new i("Incorrect invocation")}},8551:(e,t,n)=>{"use strict";var r=n(34),i=String,o=TypeError;e.exports=function(e){if(r(e))return e;throw new o(i(e)+" is not an object")}},9617:(e,t,n)=>{"use strict";var r=n(5397),i=n(5610),o=n(6198),a=function(e){return function(t,n,a){var s=r(t),u=o(s);if(0===u)return!e&&-1;var c,l=i(a,u);if(e&&n!=n){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((e||l in s)&&s[l]===n)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},4598:(e,t,n)=>{"use strict";var r=n(9039);e.exports=function(e,t){var n=[][e];return!!n&&r((function(){n.call(null,t||function(){return 1},1)}))}},926:(e,t,n)=>{"use strict";var r=n(9306),i=n(8981),o=n(7055),a=n(6198),s=TypeError,u="Reduce of empty array with no initial value",c=function(e){return function(t,n,c,l){var f=i(t),p=o(f),m=a(f);if(r(n),0===m&&c<2)throw new s(u);var h=e?m-1:0,d=e?-1:1;if(c<2)for(;;){if(h in p){l=p[h],h+=d;break}if(h+=d,e?h<0:m<=h)throw new s(u)}for(;e?h>=0:m>h;h+=d)h in p&&(l=n(l,p[h],h,f));return l}};e.exports={left:c(!1),right:c(!0)}},7680:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r([].slice)},4488:(e,t,n)=>{"use strict";var r=n(7680),i=Math.floor,o=function(e,t){var n=e.length;if(n<8)for(var a,s,u=1;u<n;){for(s=u,a=e[u];s&&t(e[s-1],a)>0;)e[s]=e[--s];s!==u++&&(e[s]=a)}else for(var c=i(n/2),l=o(r(e,0,c),t),f=o(r(e,c),t),p=l.length,m=f.length,h=0,d=0;h<p||d<m;)e[h+d]=h<p&&d<m?t(l[h],f[d])<=0?l[h++]:f[d++]:h<p?l[h++]:f[d++];return e};e.exports=o},6319:(e,t,n)=>{"use strict";var r=n(8551),i=n(9539);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){i(e,"throw",t)}}},4428:(e,t,n)=>{"use strict";var r=n(8227)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[r]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var n=!1;try{var o={};o[r]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},2195:(e,t,n)=>{"use strict";var r=n(9504),i=r({}.toString),o=r("".slice);e.exports=function(e){return o(i(e),8,-1)}},6955:(e,t,n)=>{"use strict";var r=n(2140),i=n(4901),o=n(2195),a=n(8227)("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}());e.exports=r?o:function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?n:u?o(t):"Object"===(r=o(t))&&i(t.callee)?"Arguments":r}},7740:(e,t,n)=>{"use strict";var r=n(9297),i=n(5031),o=n(7347),a=n(4913);e.exports=function(e,t,n){for(var s=i(t),u=a.f,c=o.f,l=0;l<s.length;l++){var f=s[l];r(e,f)||n&&r(n,f)||u(e,f,c(t,f))}}},2211:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},6699:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),o=n(6980);e.exports=r?function(e,t,n){return i.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4659:(e,t,n)=>{"use strict";var r=n(3724),i=n(4913),o=n(6980);e.exports=function(e,t,n){r?i.f(e,t,o(0,n)):e[t]=n}},2106:(e,t,n)=>{"use strict";var r=n(283),i=n(4913);e.exports=function(e,t,n){return n.get&&r(n.get,t,{getter:!0}),n.set&&r(n.set,t,{setter:!0}),i.f(e,t,n)}},6840:(e,t,n)=>{"use strict";var r=n(4901),i=n(4913),o=n(283),a=n(9433);e.exports=function(e,t,n,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:t;if(r(n)&&o(n,c,s),s.global)u?e[t]=n:a(t,n);else{try{s.unsafe?e[t]&&(u=!0):delete e[t]}catch(e){}u?e[t]=n:i.f(e,t,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6279:(e,t,n)=>{"use strict";var r=n(6840);e.exports=function(e,t,n){for(var i in t)r(e,i,t[i],n);return e}},9433:(e,t,n)=>{"use strict";var r=n(4576),i=Object.defineProperty;e.exports=function(e,t){try{i(r,e,{value:t,configurable:!0,writable:!0})}catch(n){r[e]=t}return t}},4606:(e,t,n)=>{"use strict";var r=n(6823),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw new i("Cannot delete property "+r(t)+" of "+r(e))}},3724:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,n)=>{"use strict";var r=n(4576),i=n(34),o=r.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:(e,t,n)=>{"use strict";var r=n(2839).match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},3763:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/MSIE|Trident/.test(r)},4265:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/ipad|iphone|ipod/i.test(r)&&"undefined"!=typeof Pebble},9544:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(r)},6193:(e,t,n)=>{"use strict";var r=n(4215);e.exports="NODE"===r},7860:(e,t,n)=>{"use strict";var r=n(2839);e.exports=/web0s(?!.*chrome)/i.test(r)},2839:(e,t,n)=>{"use strict";var r=n(4576).navigator,i=r&&r.userAgent;e.exports=i?String(i):""},9519:(e,t,n)=>{"use strict";var r,i,o=n(4576),a=n(2839),s=o.process,u=o.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(i=(r=l.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!i&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(i=+r[1]),e.exports=i},3607:(e,t,n)=>{"use strict";var r=n(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},4215:(e,t,n)=>{"use strict";var r=n(4576),i=n(2839),o=n(2195),a=function(e){return i.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},6518:(e,t,n)=>{"use strict";var r=n(4576),i=n(7347).f,o=n(6699),a=n(6840),s=n(9433),u=n(7740),c=n(2796);e.exports=function(e,t){var n,l,f,p,m,h=e.target,d=e.global,g=e.stat;if(n=d?r:g?r[h]||s(h,{}):r[h]&&r[h].prototype)for(l in t){if(p=t[l],f=e.dontCallGetSet?(m=i(n,l))&&m.value:n[l],!c(d?l:h+(g?".":"#")+l,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(e.sham||f&&f.sham)&&o(p,"sham",!0),a(n,l,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9228:(e,t,n)=>{"use strict";n(7495);var r=n(9565),i=n(6840),o=n(7323),a=n(9039),s=n(8227),u=n(6699),c=s("species"),l=RegExp.prototype;e.exports=function(e,t,n,f){var p=s(e),m=!a((function(){var t={};return t[p]=function(){return 7},7!==""[e](t)})),h=m&&!a((function(){var t=!1,n=/a/;return"split"===e&&((n={}).constructor={},n.constructor[c]=function(){return n},n.flags="",n[p]=/./[p]),n.exec=function(){return t=!0,null},n[p](""),!t}));if(!m||!h||n){var d=/./[p],g=t(p,""[e],(function(e,t,n,i,a){var s=t.exec;return s===o||s===l.exec?m&&!a?{done:!0,value:r(d,t,n,i)}:{done:!0,value:r(e,n,t,i)}:{done:!1}}));i(String.prototype,e,g[0]),i(l,p,g[1])}f&&u(l[p],"sham",!0)}},8745:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(o):function(){return a.apply(o,arguments)})},6080:(e,t,n)=>{"use strict";var r=n(7476),i=n(9306),o=n(616),a=r(r.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},616:(e,t,n)=>{"use strict";var r=n(9039);e.exports=!r((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype.call;e.exports=r?i.bind(i):function(){return i.apply(i,arguments)}},350:(e,t,n)=>{"use strict";var r=n(3724),i=n(9297),o=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=i(o,"name"),u=s&&"something"===function(){}.name,c=s&&(!r||r&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},6706:(e,t,n)=>{"use strict";var r=n(9504),i=n(9306);e.exports=function(e,t,n){try{return r(i(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},7476:(e,t,n)=>{"use strict";var r=n(2195),i=n(9504);e.exports=function(e){if("Function"===r(e))return i(e)}},9504:(e,t,n)=>{"use strict";var r=n(616),i=Function.prototype,o=i.call,a=r&&i.bind.bind(o,o);e.exports=r?a:function(e){return function(){return o.apply(e,arguments)}}},7751:(e,t,n)=>{"use strict";var r=n(4576),i=n(4901);e.exports=function(e,t){return arguments.length<2?(n=r[e],i(n)?n:void 0):r[e]&&r[e][t];var n}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},851:(e,t,n)=>{"use strict";var r=n(6955),i=n(5966),o=n(4117),a=n(6269),s=n(8227)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[r(e)]}},81:(e,t,n)=>{"use strict";var r=n(9565),i=n(9306),o=n(8551),a=n(6823),s=n(851),u=TypeError;e.exports=function(e,t){var n=arguments.length<2?s(e):t;if(i(n))return o(r(n,e));throw new u(a(e)+" is not iterable")}},6933:(e,t,n)=>{"use strict";var r=n(9504),i=n(4376),o=n(4901),a=n(2195),s=n(655),u=r([].push);e.exports=function(e){if(o(e))return e;if(i(e)){for(var t=e.length,n=[],r=0;r<t;r++){var c=e[r];"string"==typeof c?u(n,c):"number"!=typeof c&&"Number"!==a(c)&&"String"!==a(c)||u(n,s(c))}var l=n.length,f=!0;return function(e,t){if(f)return f=!1,t;if(i(this))return t;for(var r=0;r<l;r++)if(n[r]===e)return t}}}},5966:(e,t,n)=>{"use strict";var r=n(9306),i=n(4117);e.exports=function(e,t){var n=e[t];return i(n)?void 0:r(n)}},2478:(e,t,n)=>{"use strict";var r=n(9504),i=n(8981),o=Math.floor,a=r("".charAt),s=r("".replace),u=r("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,n,r,f,p){var m=n+e.length,h=r.length,d=l;return void 0!==f&&(f=i(f),d=c),s(p,d,(function(i,s){var c;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return u(t,0,n);case"'":return u(t,m);case"<":c=f[u(s,1,-1)];break;default:var l=+s;if(0===l)return i;if(l>h){var p=o(l/10);return 0===p?i:p<=h?void 0===r[p-1]?a(s,1):r[p-1]+a(s,1):i}c=r[l-1]}return void 0===c?"":c}))}},4576:function(e){"use strict";var t=function(e){return e&&e.Math===Math&&e};e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||t("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,n)=>{"use strict";var r=n(9504),i=n(8981),o=r({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},421:e=>{"use strict";e.exports={}},3138:e=>{"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},397:(e,t,n)=>{"use strict";var r=n(7751);e.exports=r("document","documentElement")},5917:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039),o=n(4055);e.exports=!r&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(2195),a=Object,s=r("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},3167:(e,t,n)=>{"use strict";var r=n(4901),i=n(34),o=n(2967);e.exports=function(e,t,n){var a,s;return o&&r(a=t.constructor)&&a!==n&&i(s=a.prototype)&&s!==n.prototype&&o(e,s),e}},3706:(e,t,n)=>{"use strict";var r=n(9504),i=n(4901),o=n(7629),a=r(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},1181:(e,t,n)=>{"use strict";var r,i,o,a=n(8622),s=n(4576),u=n(34),c=n(6699),l=n(9297),f=n(7629),p=n(6119),m=n(421),h="Object already initialized",d=s.TypeError,g=s.WeakMap;if(a||f.state){var y=f.state||(f.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,r=function(e,t){if(y.has(e))throw new d(h);return t.facade=e,y.set(e,t),t},i=function(e){return y.get(e)||{}},o=function(e){return y.has(e)}}else{var x=p("state");m[x]=!0,r=function(e,t){if(l(e,x))throw new d(h);return t.facade=e,c(e,x,t),t},i=function(e){return l(e,x)?e[x]:{}},o=function(e){return l(e,x)}}e.exports={set:r,get:i,has:o,enforce:function(e){return o(e)?i(e):r(e,{})},getterFor:function(e){return function(t){var n;if(!u(t)||(n=i(t)).type!==e)throw new d("Incompatible receiver, "+e+" required");return n}}}},4209:(e,t,n)=>{"use strict";var r=n(8227),i=n(6269),o=r("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},4376:(e,t,n)=>{"use strict";var r=n(2195);e.exports=Array.isArray||function(e){return"Array"===r(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},3517:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(4901),a=n(6955),s=n(7751),u=n(3706),c=function(){},l=s("Reflect","construct"),f=/^\s*(?:class|function)\b/,p=r(f.exec),m=!f.test(c),h=function(e){if(!o(e))return!1;try{return l(c,[],e),!0}catch(e){return!1}},d=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return m||!!p(f,u(e))}catch(e){return!0}};d.sham=!0,e.exports=!l||i((function(){var e;return h(h.call)||!h(Object)||!h((function(){e=!0}))||e}))?d:h},2796:(e,t,n)=>{"use strict";var r=n(9039),i=n(4901),o=/#|\.prototype\./,a=function(e,t){var n=u[s(e)];return n===l||n!==c&&(i(t)?r(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,n)=>{"use strict";var r=n(4901);e.exports=function(e){return"object"==typeof e?null!==e:r(e)}},3925:(e,t,n)=>{"use strict";var r=n(34);e.exports=function(e){return r(e)||null===e}},6395:e=>{"use strict";e.exports=!1},788:(e,t,n)=>{"use strict";var r=n(34),i=n(2195),o=n(8227)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},757:(e,t,n)=>{"use strict";var r=n(7751),i=n(4901),o=n(1625),a=n(7040),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=r("Symbol");return i(t)&&o(t.prototype,s(e))}},2652:(e,t,n)=>{"use strict";var r=n(6080),i=n(9565),o=n(8551),a=n(6823),s=n(4209),u=n(6198),c=n(1625),l=n(81),f=n(851),p=n(9539),m=TypeError,h=function(e,t){this.stopped=e,this.result=t},d=h.prototype;e.exports=function(e,t,n){var g,y,x,b,v,w,N,E=n&&n.that,A=!(!n||!n.AS_ENTRIES),S=!(!n||!n.IS_RECORD),M=!(!n||!n.IS_ITERATOR),C=!(!n||!n.INTERRUPTED),T=r(t,E),B=function(e){return g&&p(g,"normal",e),new h(!0,e)},D=function(e){return A?(o(e),C?T(e[0],e[1],B):T(e[0],e[1])):C?T(e,B):T(e)};if(S)g=e.iterator;else if(M)g=e;else{if(!(y=f(e)))throw new m(a(e)+" is not iterable");if(s(y)){for(x=0,b=u(e);b>x;x++)if((v=D(e[x]))&&c(d,v))return v;return new h(!1)}g=l(e,y)}for(w=S?e.next:g.next;!(N=i(w,g)).done;){try{v=D(N.value)}catch(e){p(g,"throw",e)}if("object"==typeof v&&v&&c(d,v))return v}return new h(!1)}},9539:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),o=n(5966);e.exports=function(e,t,n){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw n;return n}a=r(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw n;if(s)throw a;return i(a),n}},9462:(e,t,n)=>{"use strict";var r=n(9565),i=n(2360),o=n(6699),a=n(6279),s=n(8227),u=n(1181),c=n(5966),l=n(7657).IteratorPrototype,f=n(2529),p=n(9539),m=s("toStringTag"),h="IteratorHelper",d="WrapForValidIterator",g=u.set,y=function(e){var t=u.getterFor(e?d:h);return a(i(l),{next:function(){var n=t(this);if(e)return n.nextHandler();if(n.done)return f(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:f(r,n.done)}catch(e){throw n.done=!0,e}},return:function(){var n=t(this),i=n.iterator;if(n.done=!0,e){var o=c(i,"return");return o?r(o,i):f(void 0,!0)}if(n.inner)try{p(n.inner.iterator,"normal")}catch(e){return p(i,"throw",e)}return i&&p(i,"normal"),f(void 0,!0)}})},x=y(!0),b=y(!1);o(b,m,"Iterator Helper"),e.exports=function(e,t,n){var r=function(r,i){i?(i.iterator=r.iterator,i.next=r.next):i=r,i.type=t?d:h,i.returnHandlerResult=!!n,i.nextHandler=e,i.counter=0,i.done=!1,g(this,i)};return r.prototype=t?x:b,r}},713:(e,t,n)=>{"use strict";var r=n(9565),i=n(9306),o=n(8551),a=n(1767),s=n(9462),u=n(6319),c=s((function(){var e=this.iterator,t=o(r(this.next,e));if(!(this.done=!!t.done))return u(e,this.mapper,[t.value,this.counter++],!0)}));e.exports=function(e){return o(this),i(e),new c(a(this),{mapper:e})}},7657:(e,t,n)=>{"use strict";var r,i,o,a=n(9039),s=n(4901),u=n(34),c=n(2360),l=n(2787),f=n(6840),p=n(8227),m=n(6395),h=p("iterator"),d=!1;[].keys&&("next"in(o=[].keys())?(i=l(l(o)))!==Object.prototype&&(r=i):d=!0),!u(r)||a((function(){var e={};return r[h].call(e)!==e}))?r={}:m&&(r=c(r)),s(r[h])||f(r,h,(function(){return this})),e.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:d}},6269:e=>{"use strict";e.exports={}},6198:(e,t,n)=>{"use strict";var r=n(8014);e.exports=function(e){return r(e.length)}},283:(e,t,n)=>{"use strict";var r=n(9504),i=n(9039),o=n(4901),a=n(9297),s=n(3724),u=n(350).CONFIGURABLE,c=n(3706),l=n(1181),f=l.enforce,p=l.get,m=String,h=Object.defineProperty,d=r("".slice),g=r("".replace),y=r([].join),x=s&&!i((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),v=e.exports=function(e,t,n){"Symbol("===d(m(t),0,7)&&(t="["+g(m(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!a(e,"name")||u&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),x&&n&&a(n,"arity")&&e.length!==n.arity&&h(e,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var r=f(e);return a(r,"source")||(r.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=v((function(){return o(this)&&p(this).source||c(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var r=+e;return(r>0?n:t)(r)}},1955:(e,t,n)=>{"use strict";var r,i,o,a,s,u=n(4576),c=n(3389),l=n(6080),f=n(9225).set,p=n(8265),m=n(9544),h=n(4265),d=n(7860),g=n(6193),y=u.MutationObserver||u.WebKitMutationObserver,x=u.document,b=u.process,v=u.Promise,w=c("queueMicrotask");if(!w){var N=new p,E=function(){var e,t;for(g&&(e=b.domain)&&e.exit();t=N.get();)try{t()}catch(e){throw N.head&&r(),e}e&&e.enter()};m||g||d||!y||!x?!h&&v&&v.resolve?((a=v.resolve(void 0)).constructor=v,s=l(a.then,a),r=function(){s(E)}):g?r=function(){b.nextTick(E)}:(f=l(f,u),r=function(){f(E)}):(i=!0,o=x.createTextNode(""),new y(E).observe(o,{characterData:!0}),r=function(){o.data=i=!i}),w=function(e){N.head||r(),N.add(e)}}e.exports=w},6043:(e,t,n)=>{"use strict";var r=n(9306),i=TypeError,o=function(e){var t,n;this.promise=new e((function(e,r){if(void 0!==t||void 0!==n)throw new i("Bad Promise constructor");t=e,n=r})),this.resolve=r(t),this.reject=r(n)};e.exports.f=function(e){return new o(e)}},2360:(e,t,n)=>{"use strict";var r,i=n(8551),o=n(6801),a=n(8727),s=n(421),u=n(397),c=n(4055),l=n(6119),f="prototype",p="script",m=l("IE_PROTO"),h=function(){},d=function(e){return"<"+p+">"+e+"</"+p+">"},g=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}var e,t,n;y="undefined"!=typeof document?document.domain&&r?g(r):(t=c("iframe"),n="java"+p+":",t.style.display="none",u.appendChild(t),t.src=String(n),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):g(r);for(var i=a.length;i--;)delete y[f][a[i]];return y()};s[m]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(h[f]=i(e),n=new h,h[f]=null,n[m]=e):n=y(),void 0===t?n:o.f(n,t)}},6801:(e,t,n)=>{"use strict";var r=n(3724),i=n(8686),o=n(4913),a=n(8551),s=n(5397),u=n(1072);t.f=r&&!i?Object.defineProperties:function(e,t){a(e);for(var n,r=s(t),i=u(t),c=i.length,l=0;c>l;)o.f(e,n=i[l++],r[n]);return e}},4913:(e,t,n)=>{"use strict";var r=n(3724),i=n(5917),o=n(8686),a=n(8551),s=n(6969),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",p="configurable",m="writable";t.f=r?o?function(e,t,n){if(a(e),t=s(t),a(n),"function"==typeof e&&"prototype"===t&&"value"in n&&m in n&&!n[m]){var r=l(e,t);r&&r[m]&&(e[t]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:f in n?n[f]:r[f],writable:!1})}return c(e,t,n)}:c:function(e,t,n){if(a(e),t=s(t),a(n),i)try{return c(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7347:(e,t,n)=>{"use strict";var r=n(3724),i=n(9565),o=n(8773),a=n(6980),s=n(5397),u=n(6969),c=n(9297),l=n(5917),f=Object.getOwnPropertyDescriptor;t.f=r?f:function(e,t){if(e=s(e),t=u(t),l)try{return f(e,t)}catch(e){}if(c(e,t))return a(!i(o.f,e,t),e[t])}},8480:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,i)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},2787:(e,t,n)=>{"use strict";var r=n(9297),i=n(4901),o=n(8981),a=n(6119),s=n(2211),u=a("IE_PROTO"),c=Object,l=c.prototype;e.exports=s?c.getPrototypeOf:function(e){var t=o(e);if(r(t,u))return t[u];var n=t.constructor;return i(n)&&t instanceof n?n.prototype:t instanceof c?l:null}},1625:(e,t,n)=>{"use strict";var r=n(9504);e.exports=r({}.isPrototypeOf)},1828:(e,t,n)=>{"use strict";var r=n(9504),i=n(9297),o=n(5397),a=n(9617).indexOf,s=n(421),u=r([].push);e.exports=function(e,t){var n,r=o(e),c=0,l=[];for(n in r)!i(s,n)&&i(r,n)&&u(l,n);for(;t.length>c;)i(r,n=t[c++])&&(~a(l,n)||u(l,n));return l}},1072:(e,t,n)=>{"use strict";var r=n(1828),i=n(8727);e.exports=Object.keys||function(e){return r(e,i)}},8773:(e,t)=>{"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,i=r&&!n.call({1:2},1);t.f=i?function(e){var t=r(this,e);return!!t&&t.enumerable}:n},2967:(e,t,n)=>{"use strict";var r=n(6706),i=n(34),o=n(7750),a=n(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=r(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,r){return o(n),a(r),i(n)?(t?e(n,r):n.__proto__=r,n):n}}():void 0)},4270:(e,t,n)=>{"use strict";var r=n(9565),i=n(4901),o=n(34),a=TypeError;e.exports=function(e,t){var n,s;if("string"===t&&i(n=e.toString)&&!o(s=r(n,e)))return s;if(i(n=e.valueOf)&&!o(s=r(n,e)))return s;if("string"!==t&&i(n=e.toString)&&!o(s=r(n,e)))return s;throw new a("Can't convert object to primitive value")}},5031:(e,t,n)=>{"use strict";var r=n(7751),i=n(9504),o=n(8480),a=n(3717),s=n(8551),u=i([].concat);e.exports=r("Reflect","ownKeys")||function(e){var t=o.f(s(e)),n=a.f;return n?u(t,n(e)):t}},1103:e=>{"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},916:(e,t,n)=>{"use strict";var r=n(4576),i=n(550),o=n(4901),a=n(2796),s=n(3706),u=n(8227),c=n(4215),l=n(6395),f=n(9519),p=i&&i.prototype,m=u("species"),h=!1,d=o(r.PromiseRejectionEvent),g=a("Promise",(function(){var e=s(i),t=e!==String(i);if(!t&&66===f)return!0;if(l&&(!p.catch||!p.finally))return!0;if(!f||f<51||!/native code/.test(e)){var n=new i((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};if((n.constructor={})[m]=r,!(h=n.then((function(){}))instanceof r))return!0}return!(t||"BROWSER"!==c&&"DENO"!==c||d)}));e.exports={CONSTRUCTOR:g,REJECTION_EVENT:d,SUBCLASSING:h}},550:(e,t,n)=>{"use strict";var r=n(4576);e.exports=r.Promise},3438:(e,t,n)=>{"use strict";var r=n(8551),i=n(34),o=n(6043);e.exports=function(e,t){if(r(e),i(t)&&t.constructor===e)return t;var n=o.f(e);return(0,n.resolve)(t),n.promise}},537:(e,t,n)=>{"use strict";var r=n(550),i=n(4428),o=n(916).CONSTRUCTOR;e.exports=o||!i((function(e){r.all(e).then(void 0,(function(){}))}))},1056:(e,t,n)=>{"use strict";var r=n(4913).f;e.exports=function(e,t,n){n in e||r(e,n,{configurable:!0,get:function(){return t[n]},set:function(e){t[n]=e}})}},8265:e=>{"use strict";var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},n=this.tail;n?n.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},e.exports=t},6682:(e,t,n)=>{"use strict";var r=n(9565),i=n(8551),o=n(4901),a=n(2195),s=n(7323),u=TypeError;e.exports=function(e,t){var n=e.exec;if(o(n)){var c=r(n,e,t);return null!==c&&i(c),c}if("RegExp"===a(e))return r(s,e,t);throw new u("RegExp#exec called on incompatible receiver")}},7323:(e,t,n)=>{"use strict";var r,i,o=n(9565),a=n(9504),s=n(655),u=n(7979),c=n(8429),l=n(5745),f=n(2360),p=n(1181).get,m=n(3635),h=n(8814),d=l("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,y=g,x=a("".charAt),b=a("".indexOf),v=a("".replace),w=a("".slice),N=(i=/b*/g,o(g,r=/a/,"a"),o(g,i,"a"),0!==r.lastIndex||0!==i.lastIndex),E=c.BROKEN_CARET,A=void 0!==/()??/.exec("")[1];(N||A||E||m||h)&&(y=function(e){var t,n,r,i,a,c,l,m=this,h=p(m),S=s(e),M=h.raw;if(M)return M.lastIndex=m.lastIndex,t=o(y,M,S),m.lastIndex=M.lastIndex,t;var C=h.groups,T=E&&m.sticky,B=o(u,m),D=m.source,F=0,O=S;if(T&&(B=v(B,"y",""),-1===b(B,"g")&&(B+="g"),O=w(S,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==x(S,m.lastIndex-1))&&(D="(?: "+D+")",O=" "+O,F++),n=new RegExp("^(?:"+D+")",B)),A&&(n=new RegExp("^"+D+"$(?!\\s)",B)),N&&(r=m.lastIndex),i=o(g,T?n:m,O),T?i?(i.input=w(i.input,F),i[0]=w(i[0],F),i.index=m.lastIndex,m.lastIndex+=i[0].length):m.lastIndex=0:N&&i&&(m.lastIndex=m.global?i.index+i[0].length:r),A&&i&&i.length>1&&o(d,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&C)for(i.groups=c=f(null),a=0;a<C.length;a++)c[(l=C[a])[0]]=i[l[1]];return i}),e.exports=y},7979:(e,t,n)=>{"use strict";var r=n(8551);e.exports=function(){var e=r(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},1034:(e,t,n)=>{"use strict";var r=n(9565),i=n(9297),o=n(1625),a=n(7979),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||i(e,"flags")||!o(s,e)?t:r(a,e)}},8429:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp,o=r((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||r((function(){return!i("a","y").sticky})),s=o||r((function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},3635:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp;e.exports=r((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},8814:(e,t,n)=>{"use strict";var r=n(9039),i=n(4576).RegExp;e.exports=r((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},7750:(e,t,n)=>{"use strict";var r=n(4117),i=TypeError;e.exports=function(e){if(r(e))throw new i("Can't call method on "+e);return e}},3389:(e,t,n)=>{"use strict";var r=n(4576),i=n(3724),o=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!i)return r[e];var t=o(r,e);return t&&t.value}},7633:(e,t,n)=>{"use strict";var r=n(7751),i=n(2106),o=n(8227),a=n(3724),s=o("species");e.exports=function(e){var t=r(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},687:(e,t,n)=>{"use strict";var r=n(4913).f,i=n(9297),o=n(8227)("toStringTag");e.exports=function(e,t,n){e&&!n&&(e=e.prototype),e&&!i(e,o)&&r(e,o,{configurable:!0,value:t})}},6119:(e,t,n)=>{"use strict";var r=n(5745),i=n(3392),o=r("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},7629:(e,t,n)=>{"use strict";var r=n(6395),i=n(4576),o=n(9433),a="__core-js_shared__",s=e.exports=i[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.40.0",mode:r?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,n)=>{"use strict";var r=n(7629);e.exports=function(e,t){return r[e]||(r[e]=t||{})}},2293:(e,t,n)=>{"use strict";var r=n(8551),i=n(5548),o=n(4117),a=n(8227)("species");e.exports=function(e,t){var n,s=r(e).constructor;return void 0===s||o(n=r(s)[a])?t:i(n)}},8183:(e,t,n)=>{"use strict";var r=n(9504),i=n(1291),o=n(655),a=n(7750),s=r("".charAt),u=r("".charCodeAt),c=r("".slice),l=function(e){return function(t,n){var r,l,f=o(a(t)),p=i(n),m=f.length;return p<0||p>=m?e?"":void 0:(r=u(f,p))<55296||r>56319||p+1===m||(l=u(f,p+1))<56320||l>57343?e?s(f,p):r:e?c(f,p,p+2):l-56320+(r-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},4495:(e,t,n)=>{"use strict";var r=n(9519),i=n(9039),o=n(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},9225:(e,t,n)=>{"use strict";var r,i,o,a,s=n(4576),u=n(8745),c=n(6080),l=n(4901),f=n(9297),p=n(9039),m=n(397),h=n(7680),d=n(4055),g=n(2812),y=n(9544),x=n(6193),b=s.setImmediate,v=s.clearImmediate,w=s.process,N=s.Dispatch,E=s.Function,A=s.MessageChannel,S=s.String,M=0,C={},T="onreadystatechange";p((function(){r=s.location}));var B=function(e){if(f(C,e)){var t=C[e];delete C[e],t()}},D=function(e){return function(){B(e)}},F=function(e){B(e.data)},O=function(e){s.postMessage(S(e),r.protocol+"//"+r.host)};b&&v||(b=function(e){g(arguments.length,1);var t=l(e)?e:E(e),n=h(arguments,1);return C[++M]=function(){u(t,void 0,n)},i(M),M},v=function(e){delete C[e]},x?i=function(e){w.nextTick(D(e))}:N&&N.now?i=function(e){N.now(D(e))}:A&&!y?(a=(o=new A).port2,o.port1.onmessage=F,i=c(a.postMessage,a)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&r&&"file:"!==r.protocol&&!p(O)?(i=O,s.addEventListener("message",F,!1)):i=T in d("script")?function(e){m.appendChild(d("script"))[T]=function(){m.removeChild(this),B(e)}}:function(e){setTimeout(D(e),0)}),e.exports={set:b,clear:v}},5610:(e,t,n)=>{"use strict";var r=n(1291),i=Math.max,o=Math.min;e.exports=function(e,t){var n=r(e);return n<0?i(n+t,0):o(n,t)}},5397:(e,t,n)=>{"use strict";var r=n(7055),i=n(7750);e.exports=function(e){return r(i(e))}},1291:(e,t,n)=>{"use strict";var r=n(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:r(t)}},8014:(e,t,n)=>{"use strict";var r=n(1291),i=Math.min;e.exports=function(e){var t=r(e);return t>0?i(t,9007199254740991):0}},8981:(e,t,n)=>{"use strict";var r=n(7750),i=Object;e.exports=function(e){return i(r(e))}},2777:(e,t,n)=>{"use strict";var r=n(9565),i=n(34),o=n(757),a=n(5966),s=n(4270),u=n(8227),c=TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var n,u=a(e,l);if(u){if(void 0===t&&(t="default"),n=r(u,e,t),!i(n)||o(n))return n;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6969:(e,t,n)=>{"use strict";var r=n(2777),i=n(757);e.exports=function(e){var t=r(e,"string");return i(t)?t:t+""}},2140:(e,t,n)=>{"use strict";var r={};r[n(8227)("toStringTag")]="z",e.exports="[object z]"===String(r)},655:(e,t,n)=>{"use strict";var r=n(6955),i=String;e.exports=function(e){if("Symbol"===r(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,n)=>{"use strict";var r=n(9504),i=0,o=Math.random(),a=r(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},7040:(e,t,n)=>{"use strict";var r=n(4495);e.exports=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,n)=>{"use strict";var r=n(3724),i=n(9039);e.exports=r&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},2812:e=>{"use strict";var t=TypeError;e.exports=function(e,n){if(e<n)throw new t("Not enough arguments");return e}},8622:(e,t,n)=>{"use strict";var r=n(4576),i=n(4901),o=r.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},8227:(e,t,n)=>{"use strict";var r=n(4576),i=n(5745),o=n(9297),a=n(3392),s=n(4495),u=n(7040),c=r.Symbol,l=i("wks"),f=u?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return o(l,e)||(l[e]=s&&o(c,e)?c[e]:f("Symbol."+e)),l[e]}},4423:(e,t,n)=>{"use strict";var r=n(6518),i=n(9617).includes,o=n(9039),a=n(6469);r({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},2712:(e,t,n)=>{"use strict";var r=n(6518),i=n(926).left,o=n(4598),a=n(9519);r({target:"Array",proto:!0,forced:!n(6193)&&a>79&&a<83||!o("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},6910:(e,t,n)=>{"use strict";var r=n(6518),i=n(9504),o=n(9306),a=n(8981),s=n(6198),u=n(4606),c=n(655),l=n(9039),f=n(4488),p=n(4598),m=n(3709),h=n(3763),d=n(9519),g=n(3607),y=[],x=i(y.sort),b=i(y.push),v=l((function(){y.sort(void 0)})),w=l((function(){y.sort(null)})),N=p("sort"),E=!l((function(){if(d)return d<70;if(!(m&&m>3)){if(h)return!0;if(g)return g<603;var e,t,n,r,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)y.push({k:t+r,v:n})}for(y.sort((function(e,t){return t.v-e.v})),r=0;r<y.length;r++)t=y[r].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));r({target:"Array",proto:!0,forced:v||!w||!N||!E},{sort:function(e){void 0!==e&&o(e);var t=a(this);if(E)return void 0===e?x(t):x(t,e);var n,r,i=[],l=s(t);for(r=0;r<l;r++)r in t&&b(i,t[r]);for(f(i,function(e){return function(t,n){return void 0===n?-1:void 0===t?1:void 0!==e?+e(t,n)||0:c(t)>c(n)?1:-1}}(e)),n=s(i),r=0;r<n;)t[r]=i[r++];for(;r<l;)u(t,r++);return t}})},8111:(e,t,n)=>{"use strict";var r=n(6518),i=n(4576),o=n(679),a=n(8551),s=n(4901),u=n(2787),c=n(2106),l=n(4659),f=n(9039),p=n(9297),m=n(8227),h=n(7657).IteratorPrototype,d=n(3724),g=n(6395),y="constructor",x="Iterator",b=m("toStringTag"),v=TypeError,w=i[x],N=g||!s(w)||w.prototype!==h||!f((function(){w({})})),E=function(){if(o(this,h),u(this)===h)throw new v("Abstract class Iterator not directly constructable")},A=function(e,t){d?c(h,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===h)throw new v("You can't redefine this property");p(this,e)?this[e]=t:l(this,e,t)}}):h[e]=t};p(h,b)||A(b,x),!N&&p(h,y)&&h[y]!==Object||A(y,E),E.prototype=h,r({global:!0,constructor:!0,forced:N},{Iterator:E})},1148:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{every:function(e){a(this),o(e);var t=s(this),n=0;return!i(t,(function(t,r){if(!e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(8551),s=n(1767),u=n(9462),c=n(6319),l=n(6395),f=u((function(){for(var e,t,n=this.iterator,r=this.predicate,o=this.next;;){if(e=a(i(o,n)),this.done=!!e.done)return;if(t=e.value,c(n,r,[t,this.counter++],!0))return t}}));r({target:"Iterator",proto:!0,real:!0,forced:l},{filter:function(e){return a(this),o(e),new f(s(this),{predicate:e})}})},116:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{find:function(e){a(this),o(e);var t=s(this),n=0;return i(t,(function(t,r){if(e(t,n++))return r(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},7588:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{forEach:function(e){a(this),o(e);var t=s(this),n=0;i(t,(function(t){e(t,n++)}),{IS_RECORD:!0})}})},1701:(e,t,n)=>{"use strict";var r=n(6518),i=n(713);r({target:"Iterator",proto:!0,real:!0,forced:n(6395)},{map:i})},8237:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767),u=TypeError;r({target:"Iterator",proto:!0,real:!0},{reduce:function(e){a(this),o(e);var t=s(this),n=arguments.length<2,r=n?void 0:arguments[1],c=0;if(i(t,(function(t){n?(n=!1,r=t):r=e(r,t,c),c++}),{IS_RECORD:!0}),n)throw new u("Reduce of empty iterator with no initial value");return r}})},3579:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(9306),a=n(8551),s=n(1767);r({target:"Iterator",proto:!0,real:!0},{some:function(e){a(this),o(e);var t=s(this),n=0;return i(t,(function(t,r){if(e(t,n++))return r()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1806:(e,t,n)=>{"use strict";var r=n(6518),i=n(8551),o=n(2652),a=n(1767),s=[].push;r({target:"Iterator",proto:!0,real:!0},{toArray:function(){var e=[];return o(a(i(this)),s,{that:e,IS_RECORD:!0}),e}})},3110:(e,t,n)=>{"use strict";var r=n(6518),i=n(7751),o=n(8745),a=n(9565),s=n(9504),u=n(9039),c=n(4901),l=n(757),f=n(7680),p=n(6933),m=n(4495),h=String,d=i("JSON","stringify"),g=s(/./.exec),y=s("".charAt),x=s("".charCodeAt),b=s("".replace),v=s(1..toString),w=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,A=!m||u((function(){var e=i("Symbol")("stringify detection");return"[null]"!==d([e])||"{}"!==d({a:e})||"{}"!==d(Object(e))})),S=u((function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")})),M=function(e,t){var n=f(arguments),r=p(t);if(c(r)||void 0!==e&&!l(e))return n[1]=function(e,t){if(c(r)&&(t=a(r,this,h(e),t)),!l(t))return t},o(d,null,n)},C=function(e,t,n){var r=y(n,t-1),i=y(n,t+1);return g(N,e)&&!g(E,i)||g(E,e)&&!g(N,r)?"\\u"+v(x(e,0),16):e};d&&r({target:"JSON",stat:!0,arity:3,forced:A||S},{stringify:function(e,t,n){var r=f(arguments),i=o(A?M:d,null,r);return S&&"string"==typeof i?b(i,w,C):i}})},3921:(e,t,n)=>{"use strict";var r=n(6518),i=n(2652),o=n(4659);r({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,n){o(t,e,n)}),{AS_ENTRIES:!0}),t}})},6499:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(6043),s=n(1103),u=n(2652);r({target:"Promise",stat:!0,forced:n(537)},{all:function(e){var t=this,n=a.f(t),r=n.resolve,c=n.reject,l=s((function(){var n=o(t.resolve),a=[],s=0,l=1;u(e,(function(e){var o=s++,u=!1;l++,i(n,t,e).then((function(e){u||(u=!0,a[o]=e,--l||r(a))}),c)})),--l||r(a)}));return l.error&&c(l.value),n.promise}})},2003:(e,t,n)=>{"use strict";var r=n(6518),i=n(6395),o=n(916).CONSTRUCTOR,a=n(550),s=n(7751),u=n(4901),c=n(6840),l=a&&a.prototype;if(r({target:"Promise",proto:!0,forced:o,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&u(a)){var f=s("Promise").prototype.catch;l.catch!==f&&c(l,"catch",f,{unsafe:!0})}},436:(e,t,n)=>{"use strict";var r,i,o,a=n(6518),s=n(6395),u=n(6193),c=n(4576),l=n(9565),f=n(6840),p=n(2967),m=n(687),h=n(7633),d=n(9306),g=n(4901),y=n(34),x=n(679),b=n(2293),v=n(9225).set,w=n(1955),N=n(3138),E=n(1103),A=n(8265),S=n(1181),M=n(550),C=n(916),T=n(6043),B="Promise",D=C.CONSTRUCTOR,F=C.REJECTION_EVENT,O=C.SUBCLASSING,_=S.getterFor(B),I=S.set,z=M&&M.prototype,k=M,R=z,q=c.TypeError,P=c.document,j=c.process,U=T.f,L=U,$=!!(P&&P.createEvent&&c.dispatchEvent),H="unhandledrejection",G=function(e){var t;return!(!y(e)||!g(t=e.then))&&t},V=function(e,t){var n,r,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,f=e.domain;try{s?(a||(2===t.rejection&&X(t),t.rejection=1),!0===s?n=o:(f&&f.enter(),n=s(o),f&&(f.exit(),i=!0)),n===e.promise?c(new q("Promise-chain cycle")):(r=G(n))?l(r,n,u,c):u(n)):c(o)}catch(e){f&&!i&&f.exit(),c(e)}},Z=function(e,t){e.notified||(e.notified=!0,w((function(){for(var n,r=e.reactions;n=r.get();)V(n,e);e.notified=!1,t&&!e.rejection&&Y(e)})))},W=function(e,t,n){var r,i;$?((r=P.createEvent("Event")).promise=t,r.reason=n,r.initEvent(e,!1,!0),c.dispatchEvent(r)):r={promise:t,reason:n},!F&&(i=c["on"+e])?i(r):e===H&&N("Unhandled promise rejection",n)},Y=function(e){l(v,c,(function(){var t,n=e.facade,r=e.value;if(J(e)&&(t=E((function(){u?j.emit("unhandledRejection",r,n):W(H,n,r)})),e.rejection=u||J(e)?2:1,t.error))throw t.value}))},J=function(e){return 1!==e.rejection&&!e.parent},X=function(e){l(v,c,(function(){var t=e.facade;u?j.emit("rejectionHandled",t):W("rejectionhandled",t,e.value)}))},Q=function(e,t,n){return function(r){e(t,r,n)}},K=function(e,t,n){e.done||(e.done=!0,n&&(e=n),e.value=t,e.state=2,Z(e,!0))},ee=function(e,t,n){if(!e.done){e.done=!0,n&&(e=n);try{if(e.facade===t)throw new q("Promise can't be resolved itself");var r=G(t);r?w((function(){var n={done:!1};try{l(r,t,Q(ee,n,e),Q(K,n,e))}catch(t){K(n,t,e)}})):(e.value=t,e.state=1,Z(e,!1))}catch(t){K({done:!1},t,e)}}};if(D&&(R=(k=function(e){x(this,R),d(e),l(r,this);var t=_(this);try{e(Q(ee,t),Q(K,t))}catch(e){K(t,e)}}).prototype,(r=function(e){I(this,{type:B,done:!1,notified:!1,parent:!1,reactions:new A,rejection:!1,state:0,value:null})}).prototype=f(R,"then",(function(e,t){var n=_(this),r=U(b(this,k));return n.parent=!0,r.ok=!g(e)||e,r.fail=g(t)&&t,r.domain=u?j.domain:void 0,0===n.state?n.reactions.add(r):w((function(){V(r,n)})),r.promise})),i=function(){var e=new r,t=_(e);this.promise=e,this.resolve=Q(ee,t),this.reject=Q(K,t)},T.f=U=function(e){return e===k||void 0===e?new i(e):L(e)},!s&&g(M)&&z!==Object.prototype)){o=z.then,O||f(z,"then",(function(e,t){var n=this;return new k((function(e,t){l(o,n,e,t)})).then(e,t)}),{unsafe:!0});try{delete z.constructor}catch(e){}p&&p(z,R)}a({global:!0,constructor:!0,wrap:!0,forced:D},{Promise:k}),m(k,B,!1,!0),h(B)},3362:(e,t,n)=>{"use strict";n(436),n(6499),n(2003),n(7743),n(1481),n(280)},7743:(e,t,n)=>{"use strict";var r=n(6518),i=n(9565),o=n(9306),a=n(6043),s=n(1103),u=n(2652);r({target:"Promise",stat:!0,forced:n(537)},{race:function(e){var t=this,n=a.f(t),r=n.reject,c=s((function(){var a=o(t.resolve);u(e,(function(e){i(a,t,e).then(n.resolve,r)}))}));return c.error&&r(c.value),n.promise}})},1481:(e,t,n)=>{"use strict";var r=n(6518),i=n(6043);r({target:"Promise",stat:!0,forced:n(916).CONSTRUCTOR},{reject:function(e){var t=i.f(this);return(0,t.reject)(e),t.promise}})},280:(e,t,n)=>{"use strict";var r=n(6518),i=n(7751),o=n(6395),a=n(550),s=n(916).CONSTRUCTOR,u=n(3438),c=i("Promise"),l=o&&!s;r({target:"Promise",stat:!0,forced:o||s},{resolve:function(e){return u(l&&this===c?a:this,e)}})},4864:(e,t,n)=>{"use strict";var r=n(3724),i=n(4576),o=n(9504),a=n(2796),s=n(3167),u=n(6699),c=n(2360),l=n(8480).f,f=n(1625),p=n(788),m=n(655),h=n(1034),d=n(8429),g=n(1056),y=n(6840),x=n(9039),b=n(9297),v=n(1181).enforce,w=n(7633),N=n(8227),E=n(3635),A=n(8814),S=N("match"),M=i.RegExp,C=M.prototype,T=i.SyntaxError,B=o(C.exec),D=o("".charAt),F=o("".replace),O=o("".indexOf),_=o("".slice),I=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,z=/a/g,k=/a/g,R=new M(z)!==z,q=d.MISSED_STICKY,P=d.UNSUPPORTED_Y;if(a("RegExp",r&&(!R||q||E||A||x((function(){return k[S]=!1,M(z)!==z||M(k)===k||"/a/i"!==String(M(z,"i"))}))))){for(var j=function(e,t){var n,r,i,o,a,l,d=f(C,this),g=p(e),y=void 0===t,x=[],w=e;if(!d&&g&&y&&e.constructor===j)return e;if((g||f(C,e))&&(e=e.source,y&&(t=h(w))),e=void 0===e?"":m(e),t=void 0===t?"":m(t),w=e,E&&"dotAll"in z&&(r=!!t&&O(t,"s")>-1)&&(t=F(t,/s/g,"")),n=t,q&&"sticky"in z&&(i=!!t&&O(t,"y")>-1)&&P&&(t=F(t,/y/g,"")),A&&(o=function(e){for(var t,n=e.length,r=0,i="",o=[],a=c(null),s=!1,u=!1,l=0,f="";r<=n;r++){if("\\"===(t=D(e,r)))t+=D(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:if(i+=t,"?:"===_(e,r+1,r+3))continue;B(I,_(e,r+1))&&(r+=2,u=!0),l++;continue;case">"===t&&u:if(""===f||b(a,f))throw new T("Invalid capture group name");a[f]=!0,o[o.length]=[f,l],u=!1,f="";continue}u?f+=t:i+=t}return[i,o]}(e),e=o[0],x=o[1]),a=s(M(e,t),d?this:C,j),(r||i||x.length)&&(l=v(a),r&&(l.dotAll=!0,l.raw=j(function(e){for(var t,n=e.length,r=0,i="",o=!1;r<=n;r++)"\\"!==(t=D(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+D(e,++r);return i}(e),n)),i&&(l.sticky=!0),x.length&&(l.groups=x)),e!==w)try{u(a,"source",""===w?"(?:)":w)}catch(e){}return a},U=l(M),L=0;U.length>L;)g(j,M,U[L++]);C.constructor=j,j.prototype=C,y(i,"RegExp",j,{constructor:!0})}w("RegExp")},7465:(e,t,n)=>{"use strict";var r=n(3724),i=n(3635),o=n(2195),a=n(2106),s=n(1181).get,u=RegExp.prototype,c=TypeError;r&&i&&a(u,"dotAll",{configurable:!0,get:function(){if(this!==u){if("RegExp"===o(this))return!!s(this).dotAll;throw new c("Incompatible receiver, RegExp required")}}})},7495:(e,t,n)=>{"use strict";var r=n(6518),i=n(7323);r({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},5440:(e,t,n)=>{"use strict";var r=n(8745),i=n(9565),o=n(9504),a=n(9228),s=n(9039),u=n(8551),c=n(4901),l=n(4117),f=n(1291),p=n(8014),m=n(655),h=n(7750),d=n(7829),g=n(5966),y=n(2478),x=n(6682),b=n(8227)("replace"),v=Math.max,w=Math.min,N=o([].concat),E=o([].push),A=o("".indexOf),S=o("".slice),M="$0"==="a".replace(/./,"$0"),C=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(e,t,n){var o=C?"$":"$0";return[function(e,n){var r=h(this),o=l(e)?void 0:g(e,b);return o?i(o,e,r,n):i(t,m(r),e,n)},function(e,i){var a=u(this),s=m(e);if("string"==typeof i&&-1===A(i,o)&&-1===A(i,"$<")){var l=n(t,a,s,i);if(l.done)return l.value}var h=c(i);h||(i=m(i));var g,b=a.global;b&&(g=a.unicode,a.lastIndex=0);for(var M,C=[];null!==(M=x(a,s))&&(E(C,M),b);)""===m(M[0])&&(a.lastIndex=d(s,p(a.lastIndex),g));for(var T,B="",D=0,F=0;F<C.length;F++){for(var O,_=m((M=C[F])[0]),I=v(w(f(M.index),s.length),0),z=[],k=1;k<M.length;k++)E(z,void 0===(T=M[k])?T:String(T));var R=M.groups;if(h){var q=N([_],z,I,s);void 0!==R&&E(q,R),O=m(r(i,void 0,q))}else O=y(_,s,I,z,R,i);I>=D&&(B+=S(s,D,I)+O,D=I+_.length)}return B+S(s,D)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!M||C)},9463:(e,t,n)=>{"use strict";var r=n(6518),i=n(3724),o=n(4576),a=n(9504),s=n(9297),u=n(4901),c=n(1625),l=n(655),f=n(2106),p=n(7740),m=o.Symbol,h=m&&m.prototype;if(i&&u(m)&&(!("description"in h)||void 0!==m().description)){var d={},g=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:l(arguments[0]),t=c(h,this)?new m(e):void 0===e?m():m(e);return""===e&&(d[t]=!0),t};p(g,m),g.prototype=h,h.constructor=g;var y="Symbol(description detection)"===String(m("description detection")),x=a(h.valueOf),b=a(h.toString),v=/^Symbol\((.*)\)[^)]+$/,w=a("".replace),N=a("".slice);f(h,"description",{configurable:!0,get:function(){var e=x(this);if(s(d,e))return"";var t=b(e),n=y?N(t,7,-1):w(t,v,"$1");return""===n?void 0:n}}),r({global:!0,constructor:!0,forced:!0},{Symbol:g})}},8992:(e,t,n)=>{"use strict";n(8111)},3215:(e,t,n)=>{"use strict";n(1148)},4520:(e,t,n)=>{"use strict";n(2489)},2577:(e,t,n)=>{"use strict";n(116)},3949:(e,t,n)=>{"use strict";n(7588)},1454:(e,t,n)=>{"use strict";n(1701)},8872:(e,t,n)=>{"use strict";n(8237)},7550:(e,t,n)=>{"use strict";n(3579)},1795:(e,t,n)=>{"use strict";n(1806)},2369:function(e){e.exports=function(){"use strict";function e(){return!0}function t(){return!1}function n(){}const r="Argument is not a typed-function.";return function i(){function o(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const a=[{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:o},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],s={name:"any",test:e,isAny:!0};let u,c,l=0,f={createCount:0};function p(e){const t=u.get(e);if(t)return t;let n='Unknown type "'+e+'"';const r=e.toLowerCase();let i;for(i of c)if(i.toLowerCase()===r){n+='. Did you mean "'+i+'" ?';break}throw new TypeError(n)}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const n=t?p(t).index:c.length,r=[];for(let t=0;t<e.length;++t){if(!e[t]||"string"!=typeof e[t].name||"function"!=typeof e[t].test)throw new TypeError("Object with properties {name: string, test: function} expected");const i=e[t].name;if(u.has(i))throw new TypeError('Duplicate type name "'+i+'"');r.push(i),u.set(i,{name:i,test:e[t].test,isAny:e[t].isAny,index:n+t,conversionsTo:[]})}const i=c.slice(n);c=c.slice(0,n).concat(r).concat(i);for(let e=n+r.length;e<c.length;++e)u.get(c[e]).index=e}function h(){u=new Map,c=[],l=0,m([s],!1)}function d(e){const t=c.filter((t=>{const n=u.get(t);return!n.isAny&&n.test(e)}));return t.length?t:["any"]}function g(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function y(e,t,n){if(!g(e))throw new TypeError(r);const i=n&&n.exact,o=N(Array.isArray(t)?t.join(","):t),a=x(o);if(!i||a in e.signatures){const t=e._typedFunctionData.signatureMap.get(a);if(t)return t}const s=o.length;let u,c;if(i){let t;for(t in u=[],e.signatures)u.push(e._typedFunctionData.signatureMap.get(t))}else u=e._typedFunctionData.signatures;for(let e=0;e<s;++e){const t=o[e],n=[];let r;for(r of u){const i=M(r.params,e);if(i&&(!t.restParam||i.restParam)){if(!i.hasAny){const e=w(i);if(t.types.some((t=>!e.has(t.name))))continue}n.push(r)}}if(u=n,0===u.length)break}for(c of u)if(c.params.length<=s)return c;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+x(o,", ")+"))")}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(t)}function b(e){const t=0===e.indexOf("..."),n=(t?e.length>3?e.slice(3):"any":e).split("|").map((e=>p(e.trim())));let r=!1,i=t?"...":"";return{types:n.map((function(e){return r=e.isAny||r,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:r,hasConversion:!1,restParam:t}}function v(e){const t=function(e){if(0===e.length)return[];const t=e.map(p);e.length>1&&t.sort(((e,t)=>e.index-t.index));let n=t[0].conversionsTo;if(1===e.length)return n;n=n.concat([]);const r=new Set(e);for(let e=1;e<t.length;++e){let i;for(i of t[e].conversionsTo)r.has(i.from)||(n.push(i),r.add(i.from))}return n}(e.types.map((e=>e.name)));let n=e.hasAny,r=e.name;const i=t.map((function(e){const t=p(e.from);return n=t.isAny||n,r+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:r,hasAny:n,hasConversion:i.length>0,restParam:e.restParam}}function w(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((t=>e.typeSet.add(t.name)))),e.typeSet}function N(e){const t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const n=e.trim();if(""===n)return t;const r=n.split(",");for(let e=0;e<r.length;++e){const n=b(r[e].trim());if(n.restParam&&e!==r.length-1)throw new SyntaxError('Unexpected rest parameter "'+r[e]+'": only allowed for the last parameter');if(0===n.types.length)return null;t.push(n)}return t}function E(e){const t=H(e);return!!t&&t.restParam}function A(t){if(t&&0!==t.types.length){if(1===t.types.length)return p(t.types[0].name).test;if(2===t.types.length){const e=p(t.types[0].name).test,n=p(t.types[1].name).test;return function(t){return e(t)||n(t)}}{const e=t.types.map((function(e){return p(e.name).test}));return function(t){for(let n=0;n<e.length;n++)if(e[n](t))return!0;return!1}}}return e}function S(e){let t,n,r;if(E(e)){t=$(e).map(A);const n=t.length,r=A(H(e)),i=function(e){for(let t=n;t<e.length;t++)if(!r(e[t]))return!1;return!0};return function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return i(e)&&e.length>=n+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(n=A(e[0]),function(e){return n(e[0])&&1===e.length}):2===e.length?(n=A(e[0]),r=A(e[1]),function(e){return n(e[0])&&r(e[1])&&2===e.length}):(t=e.map(A),function(e){for(let n=0;n<t.length;n++)if(!t[n](e[n]))return!1;return e.length===t.length})}function M(e,t){return t<e.length?e[t]:E(e)?H(e):null}function C(e,t){const n=M(e,t);return n?w(n):new Set}function T(e){return null===e.conversion||void 0===e.conversion}function B(e,t){const n=new Set;return e.forEach((e=>{const r=C(e.params,t);let i;for(i of r)n.add(i)})),n.has("any")?["any"]:Array.from(n)}function D(e,t,n){let r,i;const o=e||"unnamed";let a,s=n;for(a=0;a<t.length;a++){const e=[];if(s.forEach((n=>{const r=A(M(n.params,a));(a<n.params.length||E(n.params))&&r(t[a])&&e.push(n)})),0===e.length){if(i=B(s,a),i.length>0){const e=d(t[a]);return r=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+a+")"),r.data={category:"wrongType",fn:o,index:a,actual:e,expected:i},r}}else s=e}const u=s.map((function(e){return E(e.params)?1/0:e.params.length}));if(t.length<Math.min.apply(null,u))return i=B(s,a),r=new TypeError("Too few arguments in function "+o+" (expected: "+i.join(" or ")+", index: "+t.length+")"),r.data={category:"tooFewArgs",fn:o,index:t.length,expected:i},r;const c=Math.max.apply(null,u);if(t.length>c)return r=new TypeError("Too many arguments in function "+o+" (expected: "+c+", actual: "+t.length+")"),r.data={category:"tooManyArgs",fn:o,index:t.length,expectedLength:c},r;const l=[];for(let e=0;e<t.length;++e)l.push(d(t[e]).join("|"));return r=new TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+o+"."),r.data={category:"mismatch",actual:l},r}function F(e){let t=c.length+1;for(let n=0;n<e.types.length;n++)T(e.types[n])&&(t=Math.min(t,e.types[n].typeIndex));return t}function O(e){let t=l+1;for(let n=0;n<e.types.length;n++)T(e.types[n])||(t=Math.min(t,e.types[n].conversionIndex));return t}function _(e,t){if(e.hasAny){if(!t.hasAny)return 1}else if(t.hasAny)return-1;if(e.restParam){if(!t.restParam)return 1}else if(t.restParam)return-1;if(e.hasConversion){if(!t.hasConversion)return 1}else if(t.hasConversion)return-1;const n=F(e)-F(t);if(n<0)return-1;if(n>0)return 1;const r=O(e)-O(t);return r<0?-1:r>0?1:0}function I(e,t){const n=e.params,r=t.params,i=H(n),o=H(r),a=E(n),s=E(r);if(a&&i.hasAny){if(!s||!o.hasAny)return 1}else if(s&&o.hasAny)return-1;let u,c=0,l=0;for(u of n)u.hasAny&&++c,u.hasConversion&&++l;let f=0,p=0;for(u of r)u.hasAny&&++f,u.hasConversion&&++p;if(c!==f)return c-f;if(a&&i.hasConversion){if(!s||!o.hasConversion)return 1}else if(s&&o.hasConversion)return-1;if(l!==p)return l-p;if(a){if(!s)return 1}else if(s)return-1;const m=(n.length-r.length)*(a?-1:1);if(0!==m)return m;const h=[];let d,g=0;for(let e=0;e<n.length;++e){const t=_(n[e],r[e]);h.push(t),g+=t}if(0!==g)return g;for(d of h)if(0!==d)return d;return 0}function z(e,t){let n=t;if(e.some((e=>e.hasConversion))){const r=E(e),i=e.map(k);n=function(){const e=[],n=r?arguments.length-1:arguments.length;for(let t=0;t<n;t++)e[t]=i[t](arguments[t]);return r&&(e[n]=arguments[n].map(i[n])),t.apply(this,e)}}let r=n;if(E(e)){const t=e.length-1;r=function(){return n.apply(this,G(arguments,0,t).concat([G(arguments,t)]))}}return r}function k(e){let t,n,r,i;const o=[],a=[];switch(e.types.forEach((function(e){e.conversion&&(o.push(p(e.conversion.from).test),a.push(e.conversion.convert))})),a.length){case 0:return function(e){return e};case 1:return t=o[0],r=a[0],function(e){return t(e)?r(e):e};case 2:return t=o[0],n=o[1],r=a[0],i=a[1],function(e){return t(e)?r(e):n(e)?i(e):e};default:return function(e){for(let t=0;t<a.length;t++)if(o[t](e))return a[t](e);return e}}}function R(e){return function e(t,n,r){if(n<t.length){const a=t[n];let s=[];if(a.restParam){const e=a.types.filter(T);e.length<a.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(a)}else s=a.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return i=s,o=function(i){return e(t,n+1,r.concat([i]))},Array.prototype.concat.apply([],i.map(o))}var i,o;return[r]}(e,0,[])}function q(e,t){const n=Math.max(e.length,t.length);for(let r=0;r<n;r++){const n=C(e,r),i=C(t,r);let o,a=!1;for(o of i)if(n.has(o)){a=!0;break}if(!a)return!1}const r=e.length,i=t.length,o=E(e),a=E(t);return o?a?r===i:i>=r:a?r>=i:r===i}function P(e,t,n){const r=[];let i;for(i of e){let e=n[i];if("number"!=typeof e)throw new TypeError('No definition for referenced signature "'+i+'"');if(e=t[e],"function"!=typeof e)return!1;r.push(e)}return r}function j(e,t,n){const r=function(e){return e.map((e=>Y(e)?Z(e.referToSelf.callback):W(e)?V(e.referTo.references,e.referTo.callback):e))}(e),i=new Array(r.length).fill(!1);let o=!0;for(;o;){o=!1;let e=!0;for(let a=0;a<r.length;++a){if(i[a])continue;const s=r[a];if(Y(s))r[a]=s.referToSelf.callback(n),r[a].referToSelf=s.referToSelf,i[a]=!0,e=!1;else if(W(s)){const n=P(s.referTo.references,r,t);n?(r[a]=s.referTo.callback.apply(this,n),r[a].referTo=s.referTo,i[a]=!0,e=!1):o=!0}}if(e&&o)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return r}function U(e,r){if(f.createCount++,0===Object.keys(r).length)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&function(e){const t=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach((n=>{const r=e[n];if(t.test(r.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}))}(r);const i=[],o=[],a={},s=[];let u;for(u in r){if(!Object.prototype.hasOwnProperty.call(r,u))continue;const e=N(u);if(!e)continue;i.forEach((function(t){if(q(t,e))throw new TypeError('Conflicting signatures "'+x(t)+'" and "'+x(e)+'".')})),i.push(e);const t=o.length;o.push(r[u]);const n=e.map(v);let c;for(c of R(n)){const e=x(c);s.push({params:c,name:e,fn:t}),c.every((e=>!e.hasConversion))&&(a[e]=t)}}s.sort(I);const c=j(o,a,se);let l;for(l in a)Object.prototype.hasOwnProperty.call(a,l)&&(a[l]=c[a[l]]);const p=[],m=new Map;for(l of s)m.has(l.name)||(l.fn=c[l.fn],p.push(l),m.set(l.name,l));const h=p[0]&&p[0].params.length<=2&&!E(p[0].params),d=p[1]&&p[1].params.length<=2&&!E(p[1].params),g=p[2]&&p[2].params.length<=2&&!E(p[2].params),y=p[3]&&p[3].params.length<=2&&!E(p[3].params),b=p[4]&&p[4].params.length<=2&&!E(p[4].params),w=p[5]&&p[5].params.length<=2&&!E(p[5].params),M=h&&d&&g&&y&&b&&w;for(let e=0;e<p.length;++e)p[e].test=S(p[e].params);const C=h?A(p[0].params[0]):t,T=d?A(p[1].params[0]):t,B=g?A(p[2].params[0]):t,D=y?A(p[3].params[0]):t,F=b?A(p[4].params[0]):t,O=w?A(p[5].params[0]):t,_=h?A(p[0].params[1]):t,k=d?A(p[1].params[1]):t,P=g?A(p[2].params[1]):t,U=y?A(p[3].params[1]):t,L=b?A(p[4].params[1]):t,$=w?A(p[5].params[1]):t;for(let e=0;e<p.length;++e)p[e].implementation=z(p[e].params,p[e].fn);const H=h?p[0].implementation:n,G=d?p[1].implementation:n,V=g?p[2].implementation:n,Z=y?p[3].implementation:n,W=b?p[4].implementation:n,Y=w?p[5].implementation:n,J=h?p[0].params.length:-1,X=d?p[1].params.length:-1,Q=g?p[2].params.length:-1,K=y?p[3].params.length:-1,ee=b?p[4].params.length:-1,te=w?p[5].params.length:-1,ne=M?6:0,re=p.length,ie=p.map((e=>e.test)),oe=p.map((e=>e.implementation)),ae=function(){for(let e=ne;e<re;e++)if(ie[e](arguments))return oe[e].apply(this,arguments);return f.onMismatch(e,arguments,p)};function se(e,t){return arguments.length===J&&C(e)&&_(t)?H.apply(this,arguments):arguments.length===X&&T(e)&&k(t)?G.apply(this,arguments):arguments.length===Q&&B(e)&&P(t)?V.apply(this,arguments):arguments.length===K&&D(e)&&U(t)?Z.apply(this,arguments):arguments.length===ee&&F(e)&&L(t)?W.apply(this,arguments):arguments.length===te&&O(e)&&$(t)?Y.apply(this,arguments):ae.apply(this,arguments)}try{Object.defineProperty(se,"name",{value:e})}catch(e){}return se.signatures=a,se._typedFunctionData={signatures:p,signatureMap:m},se}function L(e,t,n){throw D(e,t,n)}function $(e){return G(e,0,e.length-1)}function H(e){return e[e.length-1]}function G(e,t,n){return Array.prototype.slice.call(e,t,n)}function V(e,t){return{referTo:{references:e,callback:t}}}function Z(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function W(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function Y(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function J(e,t){if(!e)return t;if(t&&t!==e){const n=new Error("Function names do not match (expected: "+e+", actual: "+t+")");throw n.data={actual:t,expected:e},n}return e}function X(e){let t;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(g(e[n])||"string"==typeof e[n].signature)&&(t=J(t,e[n].name));return t}function Q(e,t){let n;for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(n in e&&t[n]!==e[n]){const r=new Error('Signature "'+n+'" is defined twice');throw r.data={signature:n,sourceFunction:t[n],destFunction:e[n]},r}e[n]=t[n]}}h(),m(a);const K=f;function ee(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw new SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return f=function(e){const t="string"==typeof e;let n=t?e:"";const r={};for(let e=t?1:0;e<arguments.length;++e){const i=arguments[e];let a,s={};if("function"==typeof i?(a=i.name,"string"==typeof i.signature?s[i.signature]=i:g(i)&&(s=i.signatures)):o(i)&&(s=i,t||(a=X(i))),0===Object.keys(s).length){const t=new TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:i},t}t||(n=J(n,a)),Q(r,s)}return U(n||"",r)},f.create=i,f.createCount=K.createCount,f.onMismatch=L,f.throwMismatchError=L,f.createError=D,f.clear=h,f.clearConversions=function(){let e;for(e of c)u.get(e).conversionsTo=[];l=0},f.addTypes=m,f._findType=p,f.referTo=function(){const e=$(arguments).map((e=>x(N(e)))),t=H(arguments);if("function"!=typeof t)throw new TypeError("Callback function expected as last argument");return V(e,t)},f.referToSelf=Z,f.convert=function(e,t){const n=p(t);if(n.test(e))return e;const r=n.conversionsTo;if(0===r.length)throw new Error("There are no conversions to "+t+" defined.");for(let t=0;t<r.length;t++)if(p(r[t].from).test(e))return r[t].convert(e);throw new Error("Cannot convert "+e+" to "+t)},f.findSignature=y,f.find=function(e,t,n){return y(e,t,n).implementation},f.isTypedFunction=g,f.warnAgainstDeprecatedThis=!0,f.addType=function(e,t){let n="any";!1!==t&&u.has("Object")&&(n="Object"),f.addTypes([e],n)},f.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};ee(e);const n=p(e.to),r=n.conversionsTo.find((t=>t.from===e.from));if(r){if(!t||!t.override)throw new Error('There is already a conversion from "'+e.from+'" to "'+n.name+'"');f.removeConversion({from:r.from,to:e.to,convert:r.convert})}n.conversionsTo.push({from:e.from,convert:e.convert,index:l++})},f.addConversions=function(e,t){e.forEach((e=>f.addConversion(e,t)))},f.removeConversion=function(e){ee(e);const t=p(e.to),n=function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return e[n]}(t.conversionsTo,(t=>t.from===e.from));if(!n)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(n.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");const r=t.conversionsTo.indexOf(n);t.conversionsTo.splice(r,1)},f.resolve=function(e,t){if(!g(e))throw new TypeError(r);const n=e._typedFunctionData.signatures;for(let e=0;e<n.length;++e)if(n[e].test(t))return n[e];return null},f}()}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.amdD=function(){throw new Error("define cannot be used indirect")},n.amdO={},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};return(()=>{"use strict";n.d(r,{default:()=>ax});var e={};n.r(e),n.d(e,{createAbs:()=>So,createAccessorNode:()=>Ip,createAcos:()=>Zl,createAcosh:()=>mf,createAcot:()=>df,createAcoth:()=>yf,createAcsc:()=>bf,createAcsch:()=>wf,createAdd:()=>xp,createAddScalar:()=>Do,createAnd:()=>$c,createAndTransform:()=>Jy,createArg:()=>ys,createArrayNode:()=>kp,createAsec:()=>Ef,createAsech:()=>Sf,createAsin:()=>Cf,createAsinh:()=>Tf,createAssignmentNode:()=>$p,createAtan:()=>Bf,createAtan2:()=>Ff,createAtanh:()=>_f,createAtomicMass:()=>Qg,createAvogadro:()=>Kg,createBellNumbers:()=>Cd,createBigNumberClass:()=>On,createBigint:()=>Ii,createBignumber:()=>Pi,createBin:()=>Qu,createBitAnd:()=>cs,createBitAndTransform:()=>Qy,createBitNot:()=>fs,createBitOr:()=>ms,createBitOrTransform:()=>Ky,createBitXor:()=>gs,createBlockNode:()=>Gp,createBohrMagneton:()=>Og,createBohrRadius:()=>qg,createBoltzmann:()=>ey,createBoolean:()=>qi,createCatalan:()=>Bd,createCbrt:()=>Io,createCeil:()=>Lo,createChain:()=>ih,createChainClass:()=>Xm,createClassicalElectronRadius:()=>Pg,createClone:()=>ei,createColumn:()=>_s,createColumnTransform:()=>Ny,createCombinations:()=>$h,createCombinationsWithRep:()=>Vh,createCompare:()=>Gc,createCompareNatural:()=>Yc,createCompareText:()=>Qc,createCompile:()=>Am,createComplex:()=>ji,createComplexClass:()=>Un,createComposition:()=>Fd,createConcat:()=>Fs,createConcatTransform:()=>qy,createConditionalNode:()=>Zp,createConductanceQuantum:()=>_g,createConj:()=>bs,createConstantNode:()=>nm,createCorr:()=>Ph,createCos:()=>zf,createCosh:()=>Rf,createCot:()=>qf,createCoth:()=>jf,createCoulomb:()=>Dg,createCount:()=>zs,createCreateUnit:()=>Gl,createCross:()=>Rs,createCsc:()=>Uf,createCsch:()=>$f,createCtranspose:()=>Du,createCube:()=>Ho,createCumSum:()=>Mh,createCumSumTransform:()=>Gy,createDeepEqual:()=>yl,createDenseMatrixClass:()=>Qr,createDerivative:()=>Gd,createDet:()=>oh,createDeuteronMass:()=>Gg,createDiag:()=>Ps,createDiff:()=>nu,createDiffTransform:()=>jy,createDistance:()=>Nh,createDivide:()=>vh,createDivideScalar:()=>lc,createDot:()=>Ep,createDotDivide:()=>Sc,createDotMultiply:()=>Ga,createDotPow:()=>Ec,createE:()=>lg,createEfimovFactor:()=>Xg,createEigs:()=>ch,createElectricConstant:()=>Tg,createElectronMass:()=>jg,createElementaryCharge:()=>Fg,createEqual:()=>el,createEqualScalar:()=>Fi,createEqualText:()=>rl,createErf:()=>Ru,createEvaluate:()=>Mm,createExp:()=>Go,createExpm:()=>fh,createExpm1:()=>Zo,createFactorial:()=>od,createFalse:()=>ig,createFaraday:()=>ty,createFermiCoupling:()=>Ug,createFft:()=>_u,createFibonacciHeapClass:()=>Dl,createFilter:()=>js,createFilterTransform:()=>Cy,createFineStructure:()=>Lg,createFirstRadiation:()=>ny,createFix:()=>Xo,createFlatten:()=>$s,createFloor:()=>na,createForEach:()=>Gs,createForEachTransform:()=>Ty,createFormat:()=>Xu,createFraction:()=>Ui,createFractionClass:()=>ir,createFreqz:()=>Xd,createFunctionAssignmentNode:()=>im,createFunctionNode:()=>vm,createGamma:()=>td,createGasConstant:()=>iy,createGcd:()=>ya,createGetMatrixDataType:()=>Ws,createGravitationConstant:()=>Ag,createGravity:()=>my,createHartreeEnergy:()=>$g,createHasNumericValue:()=>vi,createHelp:()=>nh,createHelpClass:()=>Jm,createHex:()=>ec,createHypot:()=>vp,createI:()=>xg,createIdentity:()=>Js,createIfft:()=>zu,createIm:()=>vs,createImmutableDenseMatrixClass:()=>Cl,createIndex:()=>Mp,createIndexClass:()=>Tl,createIndexNode:()=>am,createIndexTransform:()=>By,createInfinity:()=>ag,createIntersect:()=>Eh,createInv:()=>ah,createInverseConductanceQuantum:()=>Ig,createInvmod:()=>La,createIsInteger:()=>ci,createIsNaN:()=>Mi,createIsNegative:()=>gi,createIsNumeric:()=>xi,createIsPositive:()=>Ni,createIsPrime:()=>sc,createIsZero:()=>Ai,createKldivergence:()=>sd,createKlitzing:()=>Rg,createKron:()=>Qs,createLN10:()=>mg,createLN2:()=>pg,createLOG10E:()=>dg,createLOG2E:()=>hg,createLarger:()=>fl,createLargerEq:()=>hl,createLcm:()=>ba,createLeafCount:()=>_d,createLeftShift:()=>qc,createLgamma:()=>rd,createLog:()=>yc,createLog10:()=>Aa,createLog1p:()=>bc,createLog2:()=>Ma,createLoschmidt:()=>ry,createLsolve:()=>Tc,createLsolveAll:()=>Oc,createLup:()=>Dm,createLusolve:()=>Zm,createLyap:()=>bh,createMad:()=>Fh,createMagneticConstant:()=>Cg,createMagneticFluxQuantum:()=>zg,createMap:()=>eu,createMapSlices:()=>Co,createMapSlicesTransform:()=>wy,createMapTransform:()=>Dy,createMatrix:()=>$i,createMatrixClass:()=>ar,createMatrixFromColumns:()=>Yi,createMatrixFromFunction:()=>Gi,createMatrixFromRows:()=>Zi,createMax:()=>Sl,createMaxTransform:()=>Oy,createMean:()=>Th,createMeanTransform:()=>_y,createMedian:()=>Dh,createMin:()=>Ml,createMinTransform:()=>Iy,createMod:()=>ca,createMode:()=>Vu,createMolarMass:()=>fy,createMolarMassC12:()=>py,createMolarPlanckConstant:()=>oy,createMolarVolume:()=>ay,createMultinomial:()=>cd,createMultiply:()=>Ba,createMultiplyScalar:()=>Ca,createNaN:()=>sg,createNeutronMass:()=>Vg,createNode:()=>Tp,createNorm:()=>Np,createNot:()=>Cs,createNthRoot:()=>Fa,createNthRoots:()=>wc,createNuclearMagneton:()=>kg,createNull:()=>og,createNumber:()=>_i,createNumeric:()=>uc,createObjectNode:()=>um,createOct:()=>Ku,createOnes:()=>ru,createOperatorNode:()=>fm,createOr:()=>Ts,createOrTransform:()=>Xy,createParenthesisNode:()=>mm,createParse:()=>Nm,createParser:()=>Bm,createParserClass:()=>Cm,createPartitionSelect:()=>Nl,createPermutations:()=>fd,createPhi:()=>fg,createPi:()=>ug,createPickRandom:()=>yd,createPinv:()=>uh,createPlanckCharge:()=>yy,createPlanckConstant:()=>Sg,createPlanckLength:()=>hy,createPlanckMass:()=>dy,createPlanckTemperature:()=>xy,createPlanckTime:()=>gy,createPolynomialRoot:()=>Ym,createPow:()=>fc,createPrint:()=>rc,createPrintTransform:()=>Yy,createProd:()=>Yu,createProtonMass:()=>Hg,createQr:()=>Fm,createQuantileSeq:()=>kh,createQuantileSeqTransform:()=>$y,createQuantumOfCirculation:()=>Zg,createRandom:()=>vd,createRandomInt:()=>Ed,createRange:()=>uu,createRangeClass:()=>or,createRangeNode:()=>dm,createRangeTransform:()=>zy,createRationalize:()=>Zd,createRe:()=>ws,createReducedPlanckConstant:()=>Mg,createRelationalNode:()=>ym,createReplacer:()=>Kd,createReshape:()=>lu,createResize:()=>fu,createResolve:()=>Ud,createResultSet:()=>Ze,createReviver:()=>Qd,createRightArithShift:()=>jc,createRightLogShift:()=>Lc,createRotate:()=>mu,createRotationMatrix:()=>du,createRound:()=>hc,createRow:()=>gu,createRowTransform:()=>ky,createRydberg:()=>Wg,createSQRT1_2:()=>gg,createSQRT2:()=>yg,createSackurTetrode:()=>sy,createSchur:()=>yh,createSec:()=>Hf,createSech:()=>Vf,createSecondRadiation:()=>uy,createSetCartesian:()=>Kf,createSetDifference:()=>tp,createSetDistinct:()=>rp,createSetIntersect:()=>op,createSetIsSubset:()=>sp,createSetMultiplicity:()=>cp,createSetPowerset:()=>fp,createSetSize:()=>mp,createSetSymDifference:()=>dp,createSetUnion:()=>yp,createSign:()=>_a,createSimplify:()=>Rd,createSimplifyConstant:()=>qd,createSimplifyCore:()=>jd,createSin:()=>Zf,createSinh:()=>Yf,createSize:()=>xu,createSlu:()=>Hm,createSmaller:()=>ol,createSmallerEq:()=>ul,createSolveODE:()=>ku,createSort:()=>Al,createSpaClass:()=>Fl,createSparse:()=>$l,createSparseMatrixClass:()=>Oi,createSpeedOfLight:()=>Eg,createSplitUnit:()=>Xi,createSqrt:()=>Ia,createSqrtm:()=>mh,createSquare:()=>ka,createSqueeze:()=>vu,createStd:()=>Rh,createStdTransform:()=>Uy,createStefanBoltzmann:()=>cy,createStirlingS2:()=>Sd,createString:()=>ki,createSubset:()=>Nu,createSubsetTransform:()=>Ry,createSubtract:()=>qa,createSubtractScalar:()=>Oo,createSum:()=>Ah,createSumTransform:()=>Ly,createSylvester:()=>dh,createSymbolNode:()=>xm,createSymbolicEqual:()=>$d,createTan:()=>Jf,createTanh:()=>Xf,createTau:()=>cg,createThomsonCrossSection:()=>Yg,createTo:()=>oc,createTrace:()=>Ap,createTranspose:()=>Tu,createTrue:()=>rg,createTypeOf:()=>Ti,createTyped:()=>$e,createUnaryMinus:()=>No,createUnaryPlus:()=>Ao,createUnequal:()=>bl,createUnitClass:()=>Pl,createUnitFunction:()=>Ul,createUppercaseE:()=>vg,createUppercasePi:()=>bg,createUsolve:()=>Dc,createUsolveAll:()=>Ic,createVacuumImpedance:()=>Bg,createVariance:()=>Ih,createVarianceTransform:()=>Zy,createVersion:()=>wg,createWeakMixingAngle:()=>Jg,createWienDisplacement:()=>ly,createXgcd:()=>ja,createXor:()=>Bs,createZeros:()=>Ou,createZeta:()=>Hu,createZpk2tf:()=>Yd}),n(4423),n(7495),n(8992),n(7550);var t=n(2369);function i(e,t){if(a(e,t))return e[t];if("function"==typeof e[t]&&s(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function o(e,t,n){if(a(e,t))return e[t]=n,n;throw new Error('No access to property "'+t+'"')}function a(e,t){return!(!function(e){return"object"==typeof e&&e&&e.constructor===Object}(e)&&!Array.isArray(e)||!me(u,t)&&(t in Object.prototype||t in Function.prototype))}function s(e,t){return!(null==e||"function"!=typeof e[t]||me(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)||!me(c,t)&&(t in Object.prototype||t in Function.prototype))}n(6910),n(3215),n(4520),n(3949),n(1454),n(4864),n(7465);const u={length:!0,name:!0},c={toString:!0,valueOf:!0,toLocaleString:!0};class l{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 i(this.wrappedObject,e)}set(e,t){return o(this.wrappedObject,e,t),this}has(e){return a(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){a(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(const e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class f{constructor(e,t,n){this.a=e,this.b=t,this.bKeys=n,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),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 p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,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 p(e,t){return{next:()=>{const n=e.next();return n.done?n:{value:t(n.value),done:!1}}}}function m(){return new Map}function h(e){if(!e)return m();if(k(e))return e;if(z(e))return new l(e);throw new Error("createMap can create maps from objects or Maps")}function d(e){return"number"==typeof e}function g(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 y(e){return"bigint"==typeof e}function x(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function b(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function v(e){return e&&!0===e.constructor.prototype.isUnit||!1}function w(e){return"string"==typeof e}const N=Array.isArray;function E(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function A(e){return Array.isArray(e)||E(e)}function S(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function M(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function C(e){return e&&!0===e.constructor.prototype.isRange||!1}function T(e){return e&&!0===e.constructor.prototype.isIndex||!1}function B(e){return"boolean"==typeof e}function D(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function F(e){return e&&!0===e.constructor.prototype.isHelp||!1}function O(e){return"function"==typeof e}function _(e){return e instanceof Date}function I(e){return e instanceof RegExp}function z(e){return!(!e||"object"!=typeof e||e.constructor!==Object||x(e)||b(e))}function k(e){return!!e&&(e instanceof Map||e instanceof l||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function R(e){return k(e)&&k(e.a)&&k(e.b)}function q(e){return k(e)&&z(e.wrappedObject)}function P(e){return null===e}function j(e){return void 0===e}function U(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function G(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function V(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function Z(e){return V(e)||K(e)&&1===e.args.length&&V(e.args[0])&&"-+~".includes(e.op)}function W(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function Y(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function J(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function X(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function Q(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function K(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ee(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function te(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function ne(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function re(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function ie(e){return e&&!0===e.constructor.prototype.isChain||!1}function oe(e){const t=typeof e;return"object"===t?null===e?"null":g(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function ae(e){const t=typeof e;if("number"===t||"bigint"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return ae(e)}));if(e instanceof Date)return new Date(e.valueOf());if(g(e))return e;if(z(e))return function(e,t){const n={};for(const r in e)me(e,r)&&(n[r]=t(e[r]));return n}(e,ae);if("function"===t)return e;throw new TypeError(`Cannot clone: unknown type of value (value: ${e})`)}function se(e,t){for(const n in t)me(t,n)&&(e[n]=t[n]);return e}function ue(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(const n in t)if(me(t,n)&&!(n in Object.prototype)&&!(n in Function.prototype))if(t[n]&&t[n].constructor===Object)void 0===e[n]&&(e[n]={}),e[n]&&e[n].constructor===Object?ue(e[n],t[n]):e[n]=t[n];else{if(Array.isArray(t[n]))throw new TypeError("Arrays are not supported by deepExtend");e[n]=t[n]}return e}function ce(e,t){let n,r,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(r=0,i=e.length;r<i;r++)if(!ce(e[r],t[r]))return!1;return!0}if("function"==typeof e)return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(n in e)if(!(n in t)||!ce(e[n],t[n]))return!1;for(n in t)if(!(n in e))return!1;return!0}return e===t}function le(e){const t={};return fe(e,t),t}function fe(e,t){for(const n in e)if(me(e,n)){const r=e[n];"object"==typeof r&&null!==r?fe(r,t):t[n]=r}}function pe(e,t,n){let r,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(r=n(),i=!1),r},set:function(e){r=e,i=!1},configurable:!0,enumerable:!0})}function me(e,t){return e&&Object.hasOwnProperty.call(e,t)}function he(e,t,n,r){function i(r){const i=function(e,t){const n={};for(let r=0;r<t.length;r++){const i=t[r],o=e[i];void 0!==o&&(n[i]=o)}return n}(r,t.map(ge));return function(e,t,n){if(!t.filter((e=>!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==n[e]))){const r=t.filter((e=>void 0===n[e]));throw new Error(`Cannot create function "${e}", some dependencies are missing: ${r.map((e=>`"${e}"`)).join(", ")}.`)}}(e,t,r),n(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),r&&(i.meta=r),i}function de(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function ge(e){return e&&"?"===e[0]?e.slice(1):e}function ye(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function xe(e,t){if("bigint"===t.number)try{BigInt(e)}catch(e){return t.numberFallback}return t.number}n(5440);const be=Math.sign||function(e){return e>0?1:e<0?-1:0},ve=Math.log2||function(e){return Math.log(e)/Math.LN2},we=Math.log10||function(e){return Math.log(e)/Math.LN10},Ne=Math.log1p||function(e){return Math.log(e+1)},Ee=Math.cbrt||function(e){if(0===e)return e;const t=e<0;let n;return t&&(e=-e),isFinite(e)?(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3):n=e,t?-n:n},Ae=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Se(e,t,n){const r={2:"0b",8:"0o",16:"0x"}[t];let i="";if(n){if(n<1)throw new Error("size must be in greater than 0");if(!ye(n))throw new Error("size must be an integer");if(e>2**(n-1)-1||e<-(2**(n-1)))throw new Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!ye(e))throw new Error("Value must be an integer");e<0&&(e+=2**n),i=`i${n}`}let o="";return e<0&&(e=-e,o="-"),`${o}${r}${e.toString(t)}${i}`}function Me(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";const{notation:n,precision:r,wordSize:i}=Ce(t);switch(n){case"fixed":return Be(e,r);case"exponential":return De(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Fe(Te(e),t),r=n.exponent,i=n.coefficients,o=r%3==0?r:r<0?r-3-r%3:r-r%3;if(d(t))for(;t>i.length||r-o+1>i.length;)i.push(0);else{const e=Math.abs(r-o)-(i.length-1);for(let t=0;t<e;t++)i.push(0)}let a=Math.abs(r-o),s=1;for(;a>0;)s++,a--;const u=i.slice(s).join(""),c=d(t)&&u.length||u.match(/[1-9]/)?"."+u:"",l=i.slice(0,s).join("")+c+"e"+(r>=0?"+":"")+o.toString();return n.sign+l}(e,r);case"bin":return Se(e,2,i);case"oct":return Se(e,8,i);case"hex":return Se(e,16,i);case"auto":return function(e,t,n){if(isNaN(e)||!isFinite(e))return String(e);const r=Ue(null==n?void 0:n.lowerExp,-3),i=Ue(null==n?void 0:n.upperExp,5),o=Te(e),a=t?Fe(o,t):o;if(a.exponent<r||a.exponent>=i)return De(e,t);{let e=a.coefficients;const n=a.exponent;e.length<t&&(e=e.concat(Oe(t-e.length))),e=e.concat(Oe(n-e.length+1+(e.length<t?t-e.length:0))),e=Oe(-n).concat(e);const r=n>0?n:0;return r<e.length-1&&e.splice(r+1,0,"."),a.sign+e.join("")}}(e,r,t).replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}));default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ce(e){let t,n,r="auto";if(void 0!==e)if(d(e))t=e;else if(g(e))t=e.toNumber();else{if(!z(e))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==e.precision&&(t=je(e.precision,(()=>{throw new Error('Option "precision" must be a number or BigNumber')}))),void 0!==e.wordSize&&(n=je(e.wordSize,(()=>{throw new Error('Option "wordSize" must be a number or BigNumber')}))),e.notation&&(r=e.notation)}return{notation:r,precision:t,wordSize:n}}function Te(e){const t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);const n=t[1],r=t[2];let i=parseFloat(t[4]||"0");const o=r.indexOf(".");i+=-1!==o?o-1:r.length-1;const a=r.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===a.length&&(a.push(0),i++),{sign:n,coefficients:a,exponent:i}}function Be(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Te(e),r="number"==typeof t?Fe(n,n.exponent+1+t):n;let i=r.coefficients,o=r.exponent+1;const a=o+(t||0);return i.length<a&&(i=i.concat(Oe(a-i.length))),o<0&&(i=Oe(1-o).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),r.sign+i.join("")}function De(e,t){if(isNaN(e)||!isFinite(e))return String(e);const n=Te(e),r=t?Fe(n,t):n;let i=r.coefficients;const o=r.exponent;i.length<t&&(i=i.concat(Oe(t-i.length)));const a=i.shift();return r.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Fe(e,t){const n={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=n.coefficients;for(;t<=0;)r.unshift(0),n.exponent++,t++;if(r.length>t&&r.splice(t,r.length-t)[0]>=5){let e=t-1;for(r[e]++;10===r[e];)r.pop(),0===e&&(r.unshift(0),n.exponent++,e++),e--,r[e]++}return n}function Oe(e){const t=[];for(let n=0;n<e;n++)t.push(0);return t}function _e(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-8,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n<=0)throw new Error("Relative tolerance must be greater than 0");if(r<0)throw new Error("Absolute tolerance must be at least 0");return!isNaN(e)&&!isNaN(t)&&(isFinite(e)&&isFinite(t)?e===t||Math.abs(e-t)<=Math.max(n*Math.max(Math.abs(e),Math.abs(t)),r):e===t)}const Ie=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},ze=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},ke=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Re=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},qe=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Pe=Math.tanh||function(e){const t=Math.exp(2*e);return(t-1)/(t+1)};function je(e,t){return d(e)?e:g(e)?e.toNumber():void t()}function Ue(e,t){return d(e)?e:g(e)?e.toNumber():t}let Le=function(){return Le=t.create,t};const $e=he("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){let{BigNumber:t,Complex:n,DenseMatrix:r,Fraction:i}=e;const o=Le();return o.clear(),o.addTypes([{name:"number",test:d},{name:"Complex",test:x},{name:"BigNumber",test:g},{name:"bigint",test:y},{name:"Fraction",test:b},{name:"Unit",test:v},{name:"identifier",test:e=>w&&/^[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\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\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\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}][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\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\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}]*$/u.test(e)},{name:"string",test:w},{name:"Chain",test:ie},{name:"Array",test:N},{name:"Matrix",test:E},{name:"DenseMatrix",test:S},{name:"SparseMatrix",test:M},{name:"Range",test:C},{name:"Index",test:T},{name:"boolean",test:B},{name:"ResultSet",test:D},{name:"Help",test:F},{name:"function",test:O},{name:"Date",test:_},{name:"RegExp",test:I},{name:"null",test:P},{name:"undefined",test:j},{name:"AccessorNode",test:U},{name:"ArrayNode",test:L},{name:"AssignmentNode",test:$},{name:"BlockNode",test:H},{name:"ConditionalNode",test:G},{name:"ConstantNode",test:V},{name:"FunctionNode",test:Y},{name:"FunctionAssignmentNode",test:W},{name:"IndexNode",test:J},{name:"Node",test:X},{name:"ObjectNode",test:Q},{name:"OperatorNode",test:K},{name:"ParenthesisNode",test:ee},{name:"RangeNode",test:te},{name:"RelationalNode",test:ne},{name:"SymbolNode",test:re},{name:"Map",test:k},{name:"Object",test:z}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||He(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return n||Ge(e),new n(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return n||Ge(e),new n(e.toNumber(),0)}},{from:"bigint",to:"number",convert:function(e){if(e>Number.MAX_SAFE_INTEGER)throw new 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 t||He(e),new t(e.toString())}},{from:"bigint",to:"Fraction",convert:function(e){return i||Ve(e),new i(e)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw new 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 n||Ge(e),new n(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||Ve(e);const t=new i(e);if(t.valueOf()!==e)throw new 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 t}},{from:"string",to:"number",convert:function(e){const t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||He(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(e){try{return BigInt(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(e){i||Ve(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){n||Ge(e);try{return new n(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||He(e),new t(+e)}},{from:"boolean",to:"bigint",convert:function(e){return BigInt(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||Ve(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return r||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new r(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),o.onMismatch=(e,t,n)=>{const r=o.createError(e,t,n);if(["wrongType","mismatch"].includes(r.data.category)&&1===t.length&&A(t[0])&&n.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=r.data,t}throw r},o.onMismatch=(e,t,n)=>{const r=o.createError(e,t,n);if(["wrongType","mismatch"].includes(r.data.category)&&1===t.length&&A(t[0])&&n.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=r.data,t}throw r},o}));function He(e){throw new Error(`Cannot convert value ${e} into a BigNumber: no class 'BigNumber' provided`)}function Ge(e){throw new Error(`Cannot convert value ${e} into a Complex number: no class 'Complex' provided`)}function Ve(e){throw new Error(`Cannot convert value ${e} into a Fraction, no class 'Fraction' provided.`)}const Ze=he("ResultSet",[],(()=>{function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}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(t){return new e(t.entries)},e}),{isClass:!0});var We,Ye,Je=9e15,Xe=1e9,Qe="0123456789abcdef",Ke="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",et="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",tt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Je,maxE:Je,crypto:!1},nt=!0,rt="[DecimalError] ",it=rt+"Invalid argument: ",ot=rt+"Precision limit exceeded",at=rt+"crypto unavailable",st="[object Decimal]",ut=Math.floor,ct=Math.pow,lt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ft=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,pt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,mt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ht=1e7,dt=Ke.length-1,gt=et.length-1,yt={toStringTag:st};function xt(e){var t,n,r,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;t<i;t++)(n=7-(r=e[t]+"").length)&&(o+=Bt(n)),o+=r;(n=7-(r=(a=e[t])+"").length)&&(o+=Bt(n))}else if(0===a)return"0";for(;a%10==0;)a/=10;return o+a}function bt(e,t,n){if(e!==~~e||e<t||e>n)throw Error(it+e)}function vt(e,t,n,r){var i,o,a,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=ct(10,7-t),s=e[i]%o|0,null==r?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),a=n<4&&99999==s||n>3&&49999==s||5e4==s||0==s):a=(n<4&&s+1==o||n>3&&s+1==o/2)&&(e[i+1]/o/100|0)==ct(10,t-2)-1||(s==o/2||0==s)&&!(e[i+1]/o/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),a=(r||n<4)&&9999==s||!r&&n>3&&4999==s):a=((r||n<4)&&s+1==o||!r&&n>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==ct(10,t-3)-1,a}function wt(e,t,n){for(var r,i,o=[0],a=0,s=e.length;a<s;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=Qe.indexOf(e.charAt(a++)),r=0;r<o.length;r++)o[r]>n-1&&(void 0===o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}yt.absoluteValue=yt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Et(e)},yt.ceil=function(){return Et(new this.constructor(this),this.e+1,2)},yt.clampedTo=yt.clamp=function(e,t){var n=this,r=n.constructor;if(e=new r(e),t=new r(t),!e.s||!t.s)return new r(NaN);if(e.gt(t))throw Error(it+t);return n.cmp(e)<0?e:n.cmp(t)>0?t:new r(n)},yt.comparedTo=yt.cmp=function(e){var t,n,r,i,o=this,a=o.d,s=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!a||!s)return u&&c?u!==c?u:a===s?0:!a^u<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^u<0?1:-1;for(t=0,n=(r=a.length)<(i=s.length)?r:i;t<n;++t)if(a[t]!==s[t])return a[t]>s[t]^u<0?1:-1;return r===i?0:r>i^u<0?1:-1},yt.cosine=yt.cos=function(){var e,t,n=this,r=n.constructor;return n.d?n.d[0]?(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r,i;if(t.isZero())return t;(r=t.d.length)<32?i=(1/Pt(4,n=Math.ceil(r/3))).toString():(n=16,i="2.3283064365386962890625e-10"),e.precision+=n,t=qt(e,1,t.times(i),new e(1));for(var o=n;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=n,t}(r,jt(r,n)),r.precision=e,r.rounding=t,Et(2==Ye||3==Ye?n.neg():n,e,t,!0)):new r(1):new r(NaN)},yt.cubeRoot=yt.cbrt=function(){var e,t,n,r,i,o,a,s,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(nt=!1,(o=l.s*ct(l.s*l,1/3))&&Math.abs(o)!=1/0?r=new f(o.toString()):(n=xt(l.d),(o=((e=l.e)-n.length+1)%3)&&(n+=1==o||-2==o?"0":"00"),o=ct(n,1/3),e=ut((e+1)/3)-(e%3==(e<0?-1:2)),(r=new f(n=o==1/0?"5e"+e:(n=o.toExponential()).slice(0,n.indexOf("e")+1)+e)).s=l.s),a=(e=f.precision)+3;;)if(c=(u=(s=r).times(s).times(s)).plus(l),r=Nt(c.plus(l).times(s),c.plus(u),a+2,1),xt(s.d).slice(0,a)===(n=xt(r.d)).slice(0,a)){if("9999"!=(n=n.slice(a-3,a+1))&&(i||"4999"!=n)){+n&&(+n.slice(1)||"5"!=n.charAt(0))||(Et(r,e+1,1),t=!r.times(r).times(r).eq(l));break}if(!i&&(Et(s,e+1,0),s.times(s).times(s).eq(l))){r=s;break}a+=4,i=1}return nt=!0,Et(r,e,f.rounding,t)},yt.decimalPlaces=yt.dp=function(){var e,t=this.d,n=NaN;if(t){if(n=7*((e=t.length-1)-ut(this.e/7)),e=t[e])for(;e%10==0;e/=10)n--;n<0&&(n=0)}return n},yt.dividedBy=yt.div=function(e){return Nt(this,new this.constructor(e))},yt.dividedToIntegerBy=yt.divToInt=function(e){var t=this.constructor;return Et(Nt(this,new t(e),0,1,1),t.precision,t.rounding)},yt.equals=yt.eq=function(e){return 0===this.cmp(e)},yt.floor=function(){return Et(new this.constructor(this),this.e+1,3)},yt.greaterThan=yt.gt=function(e){return this.cmp(e)>0},yt.greaterThanOrEqualTo=yt.gte=function(e){var t=this.cmp(e);return 1==t||0===t},yt.hyperbolicCosine=yt.cosh=function(){var e,t,n,r,i,o=this,a=o.constructor,s=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return s;n=a.precision,r=a.rounding,a.precision=n+Math.max(o.e,o.sd())+4,a.rounding=1,(i=o.d.length)<32?t=(1/Pt(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=qt(a,1,o.times(t),new a(1),!0);for(var u,c=e,l=new a(8);c--;)u=o.times(o),o=s.minus(u.times(l.minus(u.times(l))));return Et(o,a.precision=n,a.rounding=r,!0)},yt.hyperbolicSine=yt.sinh=function(){var e,t,n,r,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,n=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(r=i.d.length)<3)i=qt(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(r))>16?16:0|e,i=qt(o,2,i=i.times(1/Pt(5,e)),i,!0);for(var a,s=new o(5),u=new o(16),c=new o(20);e--;)a=i.times(i),i=i.times(s.plus(a.times(u.times(a).plus(c))))}return o.precision=t,o.rounding=n,Et(i,t,n,!0)},yt.hyperbolicTangent=yt.tanh=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+7,r.rounding=1,Nt(n.sinh(),n.cosh(),r.precision=e,r.rounding=t)):new r(n.s)},yt.inverseCosine=yt.acos=function(){var e=this,t=e.constructor,n=e.abs().cmp(1),r=t.precision,i=t.rounding;return-1!==n?0===n?e.isNeg()?Ct(t,r,i):new t(0):new t(NaN):e.isZero()?Ct(t,r+4,i).times(.5):(t.precision=r+6,t.rounding=1,e=new t(1).minus(e).div(e.plus(1)).sqrt().atan(),t.precision=r,t.rounding=i,e.times(2))},yt.inverseHyperbolicCosine=yt.acosh=function(){var e,t,n=this,r=n.constructor;return n.lte(1)?new r(n.eq(1)?0:NaN):n.isFinite()?(e=r.precision,t=r.rounding,r.precision=e+Math.max(Math.abs(n.e),n.sd())+4,r.rounding=1,nt=!1,n=n.times(n).minus(1).sqrt().plus(n),nt=!0,r.precision=e,r.rounding=t,n.ln()):new r(n)},yt.inverseHyperbolicSine=yt.asinh=function(){var e,t,n=this,r=n.constructor;return!n.isFinite()||n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+2*Math.max(Math.abs(n.e),n.sd())+6,r.rounding=1,nt=!1,n=n.times(n).plus(1).sqrt().plus(n),nt=!0,r.precision=e,r.rounding=t,n.ln())},yt.inverseHyperbolicTangent=yt.atanh=function(){var e,t,n,r,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,r=i.sd(),Math.max(r,e)<2*-i.e-1?Et(new o(i),e,t,!0):(o.precision=n=r-i.e,i=Nt(i.plus(1),new o(1).minus(i),n+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},yt.inverseSine=yt.asin=function(){var e,t,n,r,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),n=o.precision,r=o.rounding,-1!==t?0===t?((e=Ct(o,n+4,r).times(.5)).s=i.s,e):new o(NaN):(o.precision=n+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=n,o.rounding=r,i.times(2)))},yt.inverseTangent=yt.atan=function(){var e,t,n,r,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=gt)return(a=Ct(l,f+4,p).times(.25)).s=c.s,a}else{if(!c.s)return new l(NaN);if(f+4<=gt)return(a=Ct(l,f+4,p).times(.5)).s=c.s,a}for(l.precision=s=f+10,l.rounding=1,e=n=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(nt=!1,t=Math.ceil(s/7),r=1,u=c.times(c),a=new l(c),i=c;-1!==e;)if(i=i.times(u),o=a.minus(i.div(r+=2)),i=i.times(u),void 0!==(a=o.plus(i.div(r+=2))).d[t])for(e=t;a.d[e]===o.d[e]&&e--;);return n&&(a=a.times(2<<n-1)),nt=!0,Et(a,l.precision=f,l.rounding=p,!0)},yt.isFinite=function(){return!!this.d},yt.isInteger=yt.isInt=function(){return!!this.d&&ut(this.e/7)>this.d.length-2},yt.isNaN=function(){return!this.s},yt.isNegative=yt.isNeg=function(){return this.s<0},yt.isPositive=yt.isPos=function(){return this.s>0},yt.isZero=function(){return!!this.d&&0===this.d[0]},yt.lessThan=yt.lt=function(e){return this.cmp(e)<0},yt.lessThanOrEqualTo=yt.lte=function(e){return this.cmp(e)<1},yt.logarithm=yt.log=function(e){var t,n,r,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(null==e)e=new l(10),t=!0;else{if(n=(e=new l(e)).d,e.s<0||!n||!n[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(n=c.d,c.s<0||!n||!n[0]||c.eq(1))return new l(n&&!n[0]?-1/0:1!=c.s?NaN:n?0:1/0);if(t)if(n.length>1)o=!0;else{for(i=n[0];i%10==0;)i/=10;o=1!==i}if(nt=!1,a=It(c,s=f+5),r=t?Mt(l,s+10):It(e,s),vt((u=Nt(a,r,s,1)).d,i=f,p))do{if(a=It(c,s+=10),r=t?Mt(l,s+10):It(e,s),u=Nt(a,r,s,1),!o){+xt(u.d).slice(i+1,i+15)+1==1e14&&(u=Et(u,f+1,0));break}}while(vt(u.d,i+=10,p));return nt=!0,Et(u,f,p)},yt.minus=yt.sub=function(e){var t,n,r,i,o,a,s,u,c,l,f,p,m=this,h=m.constructor;if(e=new h(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new h(e.d||m.s!==e.s?m:NaN):e=new h(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,s=h.precision,u=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(m)}return nt?Et(e,s,u):e}if(n=ut(e.e/7),l=ut(m.e/7),c=c.slice(),o=l-n){for((f=o<0)?(t=c,o=-o,a=p.length):(t=p,n=l,a=c.length),o>(r=Math.max(Math.ceil(s/7),a)+2)&&(o=r,t.length=1),t.reverse(),r=o;r--;)t.push(0);t.reverse()}else{for((f=(r=c.length)<(a=p.length))&&(a=r),r=0;r<a;r++)if(c[r]!=p[r]){f=c[r]<p[r];break}o=0}for(f&&(t=c,c=p,p=t,e.s=-e.s),a=c.length,r=p.length-a;r>0;--r)c[a++]=0;for(r=p.length;r>o;){if(c[--r]<p[r]){for(i=r;i&&0===c[--i];)c[i]=ht-1;--c[i],c[r]+=ht}c[r]-=p[r]}for(;0===c[--a];)c.pop();for(;0===c[0];c.shift())--n;return c[0]?(e.d=c,e.e=St(c,n),nt?Et(e,s,u):e):new h(3===u?-0:0)},yt.modulo=yt.mod=function(e){var t,n=this,r=n.constructor;return e=new r(e),!n.d||!e.s||e.d&&!e.d[0]?new r(NaN):!e.d||n.d&&!n.d[0]?Et(new r(n),r.precision,r.rounding):(nt=!1,9==r.modulo?(t=Nt(n,e.abs(),0,3,1)).s*=e.s:t=Nt(n,e,0,r.modulo,1),t=t.times(e),nt=!0,n.minus(t))},yt.naturalExponential=yt.exp=function(){return _t(this)},yt.naturalLogarithm=yt.ln=function(){return It(this)},yt.negated=yt.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Et(e)},yt.plus=yt.add=function(e){var t,n,r,i,o,a,s,u,c,l,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new p(e.d||f.s===e.s?f:NaN)):e=new p(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,s=p.precision,u=p.rounding,!c[0]||!l[0])return l[0]||(e=new p(f)),nt?Et(e,s,u):e;if(o=ut(f.e/7),r=ut(e.e/7),c=c.slice(),i=o-r){for(i<0?(n=c,i=-i,a=l.length):(n=l,r=o,a=c.length),i>(a=(o=Math.ceil(s/7))>a?o+1:a+1)&&(i=a,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for((a=c.length)-(i=l.length)<0&&(i=a,n=l,l=c,c=n),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/ht|0,c[i]%=ht;for(t&&(c.unshift(t),++r),a=c.length;0==c[--a];)c.pop();return e.d=c,e.e=St(c,r),nt?Et(e,s,u):e},yt.precision=yt.sd=function(e){var t,n=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(it+e);return n.d?(t=Tt(n.d),e&&n.e+1>t&&(t=n.e+1)):t=NaN,t},yt.round=function(){var e=this,t=e.constructor;return Et(new t(e),e.e+1,t.rounding)},yt.sine=yt.sin=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+Math.max(n.e,n.sd())+7,r.rounding=1,n=function(e,t){var n,r=t.d.length;if(r<3)return t.isZero()?t:qt(e,2,t,t);n=(n=1.4*Math.sqrt(r))>16?16:0|n,t=qt(e,2,t=t.times(1/Pt(5,n)),t);for(var i,o=new e(5),a=new e(16),s=new e(20);n--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(s))));return t}(r,jt(r,n)),r.precision=e,r.rounding=t,Et(Ye>2?n.neg():n,e,t,!0)):new r(NaN)},yt.squareRoot=yt.sqrt=function(){var e,t,n,r,i,o,a=this,s=a.d,u=a.e,c=a.s,l=a.constructor;if(1!==c||!s||!s[0])return new l(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);for(nt=!1,0==(c=Math.sqrt(+a))||c==1/0?(((t=xt(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=ut((u+1)/2)-(u<0||u%2),r=new l(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):r=new l(c.toString()),n=(u=l.precision)+3;;)if(r=(o=r).plus(Nt(a,o,n+2,1)).times(.5),xt(o.d).slice(0,n)===(t=xt(r.d)).slice(0,n)){if("9999"!=(t=t.slice(n-3,n+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Et(r,u+1,1),e=!r.times(r).eq(a));break}if(!i&&(Et(o,u+1,0),o.times(o).eq(a))){r=o;break}n+=4,i=1}return nt=!0,Et(r,u,l.rounding,e)},yt.tangent=yt.tan=function(){var e,t,n=this,r=n.constructor;return n.isFinite()?n.isZero()?new r(n):(e=r.precision,t=r.rounding,r.precision=e+10,r.rounding=1,(n=n.sin()).s=1,n=Nt(n,new r(1).minus(n.times(n)).sqrt(),e+10,0),r.precision=e,r.rounding=t,Et(2==Ye||4==Ye?n.neg():n,e,t,!0)):new r(NaN)},yt.times=yt.mul=function(e){var t,n,r,i,o,a,s,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(n=ut(l.e/7)+ut(e.e/7),(u=p.length)<(c=m.length)&&(o=p,p=m,m=o,a=u,u=c,c=a),o=[],r=a=u+c;r--;)o.push(0);for(r=c;--r>=0;){for(t=0,i=u+r;i>r;)s=o[i]+m[r]*p[i-r-1]+t,o[i--]=s%ht|0,t=s/ht|0;o[i]=(o[i]+t)%ht|0}for(;!o[--a];)o.pop();return t?++n:o.shift(),e.d=o,e.e=St(o,n),nt?Et(e,f.precision,f.rounding):e},yt.toBinary=function(e,t){return Ut(this,2,e,t)},yt.toDecimalPlaces=yt.toDP=function(e,t){var n=this,r=n.constructor;return n=new r(n),void 0===e?n:(bt(e,0,Xe),void 0===t?t=r.rounding:bt(t,0,8),Et(n,e+n.e+1,t))},yt.toExponential=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=At(r,!0):(bt(e,0,Xe),void 0===t?t=i.rounding:bt(t,0,8),n=At(r=Et(new i(r),e+1,t),!0,e+1)),r.isNeg()&&!r.isZero()?"-"+n:n},yt.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return void 0===e?n=At(i):(bt(e,0,Xe),void 0===t?t=o.rounding:bt(t,0,8),n=At(r=Et(new o(i),e+i.e+1,t),!1,e+r.e+1)),i.isNeg()&&!i.isZero()?"-"+n:n},yt.toFraction=function(e){var t,n,r,i,o,a,s,u,c,l,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=n=new d(1),r=u=new d(0),a=(o=(t=new d(r)).e=Tt(h)-m.e-1)%7,t.d[0]=ct(10,a<0?7+a:a),null==e)e=o>0?t:c;else{if(!(s=new d(e)).isInt()||s.lt(c))throw Error(it+s);e=s.gt(t)?o>0?t:c:s}for(nt=!1,s=new d(xt(h)),l=d.precision,d.precision=o=7*h.length*2;f=Nt(s,t,0,1,1),1!=(i=n.plus(f.times(r))).cmp(e);)n=r,r=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=s.minus(f.times(i)),s=i;return i=Nt(e.minus(n),r,0,1,1),u=u.plus(i.times(c)),n=n.plus(i.times(r)),u.s=c.s=m.s,p=Nt(c,r,o,1).minus(m).abs().cmp(Nt(u,n,o,1).minus(m).abs())<1?[c,r]:[u,n],d.precision=l,nt=!0,p},yt.toHexadecimal=yt.toHex=function(e,t){return Ut(this,16,e,t)},yt.toNearest=function(e,t){var n=this,r=n.constructor;if(n=new r(n),null==e){if(!n.d)return n;e=new r(1),t=r.rounding}else{if(e=new r(e),void 0===t?t=r.rounding:bt(t,0,8),!n.d)return e.s?n:e;if(!e.d)return e.s&&(e.s=n.s),e}return e.d[0]?(nt=!1,n=Nt(n,e,0,t,1).times(e),nt=!0,Et(n)):(e.s=n.s,n=e),n},yt.toNumber=function(){return+this},yt.toOctal=function(e,t){return Ut(this,8,e,t)},yt.toPower=yt.pow=function(e){var t,n,r,i,o,a,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(ct(+s,c));if((s=new u(s)).eq(1))return s;if(r=u.precision,o=u.rounding,e.eq(1))return Et(s,r,o);if((t=ut(e.e/7))>=e.d.length-1&&(n=c<0?-c:c)<=9007199254740991)return i=Dt(u,s,n,r),e.s<0?new u(1).div(i):Et(i,r,o);if((a=s.s)<0){if(t<e.d.length-1)return new u(NaN);if(1&e.d[t]||(a=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=a,s}return(t=0!=(n=ct(+s,c))&&isFinite(n)?new u(n+"").e:ut(c*(Math.log("0."+xt(s.d))/Math.LN10+s.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?a/0:0):(nt=!1,u.rounding=s.s=1,n=Math.min(12,(t+"").length),(i=_t(e.times(It(s,r+n)),r)).d&&vt((i=Et(i,r+5,1)).d,r,o)&&(t=r+10,+xt((i=Et(_t(e.times(It(s,t+n)),t),t+5,1)).d).slice(r+1,r+15)+1==1e14&&(i=Et(i,r+1,0))),i.s=a,nt=!0,u.rounding=o,Et(i,r,o))},yt.toPrecision=function(e,t){var n,r=this,i=r.constructor;return void 0===e?n=At(r,r.e<=i.toExpNeg||r.e>=i.toExpPos):(bt(e,1,Xe),void 0===t?t=i.rounding:bt(t,0,8),n=At(r=Et(new i(r),e,t),e<=r.e||r.e<=i.toExpNeg,e)),r.isNeg()&&!r.isZero()?"-"+n:n},yt.toSignificantDigits=yt.toSD=function(e,t){var n=this.constructor;return void 0===e?(e=n.precision,t=n.rounding):(bt(e,1,Xe),void 0===t?t=n.rounding:bt(t,0,8)),Et(new n(this),e,t)},yt.toString=function(){var e=this,t=e.constructor,n=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+n:n},yt.truncated=yt.trunc=function(){return Et(new this.constructor(this),this.e+1,1)},yt.valueOf=yt.toJSON=function(){var e=this,t=e.constructor,n=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+n:n};var Nt=function(){function e(e,t,n){var r,i=0,o=e.length;for(e=e.slice();o--;)r=e[o]*t+i,e[o]=r%n|0,i=r/n|0;return i&&e.unshift(i),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;)e.shift()}return function(r,i,o,a,s,u){var c,l,f,p,m,h,d,g,y,x,b,v,w,N,E,A,S,M,C,T,B=r.constructor,D=r.s==i.s?1:-1,F=r.d,O=i.d;if(!(F&&F[0]&&O&&O[0]))return new B(r.s&&i.s&&(F?!O||F[0]!=O[0]:O)?F&&0==F[0]||!O?0*D:D/0:NaN);for(u?(m=1,l=r.e-i.e):(u=ht,m=7,l=ut(r.e/m)-ut(i.e/m)),C=O.length,S=F.length,x=(y=new B(D)).d=[],f=0;O[f]==(F[f]||0);f++);if(O[f]>(F[f]||0)&&l--,null==o?(N=o=B.precision,a=B.rounding):N=s?o+(r.e-i.e)+1:o,N<0)x.push(1),h=!0;else{if(N=N/m+2|0,f=0,1==C){for(p=0,O=O[0],N++;(f<S||p)&&N--;f++)E=p*u+(F[f]||0),x[f]=E/O|0,p=E%O|0;h=p||f<S}else{for((p=u/(O[0]+1)|0)>1&&(O=e(O,p,u),F=e(F,p,u),C=O.length,S=F.length),A=C,v=(b=F.slice(0,C)).length;v<C;)b[v++]=0;(T=O.slice()).unshift(0),M=O[0],O[1]>=u/2&&++M;do{p=0,(c=t(O,b,C,v))<0?(w=b[0],C!=v&&(w=w*u+(b[1]||0)),(p=w/M|0)>1?(p>=u&&(p=u-1),1==(c=t(d=e(O,p,u),b,g=d.length,v=b.length))&&(p--,n(d,C<g?T:O,g,u))):(0==p&&(c=p=1),d=O.slice()),(g=d.length)<v&&d.unshift(0),n(b,d,v,u),-1==c&&(c=t(O,b,C,v=b.length))<1&&(p++,n(b,C<v?T:O,v,u)),v=b.length):0===c&&(p++,b=[0]),x[f++]=p,c&&b[0]?b[v++]=F[A]||0:(b=[F[A]],v=1)}while((A++<S||void 0!==b[0])&&N--);h=void 0!==b[0]}x[0]||x.shift()}if(1==m)y.e=l,We=h;else{for(f=1,p=x[0];p>=10;p/=10)f++;y.e=f+l*m-1,Et(y,s?o+y.e+1:o,a,h)}return y}}();function Et(e,t,n,r){var i,o,a,s,u,c,l,f,p,m=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((o=t-i)<0)o+=7,a=t,u=(l=f[p=0])/ct(10,i-a-1)%10|0;else if((p=Math.ceil((o+1)/7))>=(s=f.length)){if(!r)break e;for(;s++<=p;)f.push(0);l=u=0,i=1,a=(o%=7)-7+1}else{for(l=s=f[p],i=1;s>=10;s/=10)i++;u=(a=(o%=7)-7+i)<0?0:l/ct(10,i-a-1)%10|0}if(r=r||t<0||void 0!==f[p+1]||(a<0?l:l%ct(10,i-a-1)),c=n<4?(u||r)&&(0==n||n==(e.s<0?3:2)):u>5||5==u&&(4==n||r||6==n&&(o>0?a>0?l/ct(10,i-a):0:f[p-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=ct(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=p,s=1,p--):(f.length=p+1,s=ct(10,7-o),f[p]=a>0?(l/ct(10,i-a)%ct(10,a)|0)*s:0),c)for(;;){if(0==p){for(o=1,a=f[0];a>=10;a/=10)o++;for(a=f[0]+=s,s=1;a>=10;a/=10)s++;o!=s&&(e.e++,f[0]==ht&&(f[0]=1));break}if(f[p]+=s,f[p]!=ht)break;f[p--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return nt&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function At(e,t,n){if(!e.isFinite())return zt(e);var r,i=e.e,o=xt(e.d),a=o.length;return t?(n&&(r=n-a)>0?o=o.charAt(0)+"."+o.slice(1)+Bt(r):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Bt(-i-1)+o,n&&(r=n-a)>0&&(o+=Bt(r))):i>=a?(o+=Bt(i+1-a),n&&(r=n-i-1)>0&&(o=o+"."+Bt(r))):((r=i+1)<a&&(o=o.slice(0,r)+"."+o.slice(r)),n&&(r=n-a)>0&&(i+1===a&&(o+="."),o+=Bt(r))),o}function St(e,t){var n=e[0];for(t*=7;n>=10;n/=10)t++;return t}function Mt(e,t,n){if(t>dt)throw nt=!0,n&&(e.precision=n),Error(ot);return Et(new e(Ke),t,1,!0)}function Ct(e,t,n){if(t>gt)throw Error(ot);return Et(new e(et),t,n,!0)}function Tt(e){var t=e.length-1,n=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function Bt(e){for(var t="";e--;)t+="0";return t}function Dt(e,t,n,r){var i,o=new e(1),a=Math.ceil(r/7+4);for(nt=!1;;){if(n%2&&Lt((o=o.times(t)).d,a)&&(i=!0),0===(n=ut(n/2))){n=o.d.length-1,i&&0===o.d[n]&&++o.d[n];break}Lt((t=t.times(t)).d,a)}return nt=!0,o}function Ft(e){return 1&e.d[e.d.length-1]}function Ot(e,t,n){for(var r,i,o=new e(t[0]),a=0;++a<t.length;){if(!(i=new e(t[a])).s){o=i;break}((r=o.cmp(i))===n||0===r&&o.s===n)&&(o=i)}return o}function _t(e,t){var n,r,i,o,a,s,u,c=0,l=0,f=0,p=e.constructor,m=p.rounding,h=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(nt=!1,u=h):u=t,s=new p(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=r=Math.log(ct(2,f))/Math.LN10*2+5|0,n=o=a=new p(1),p.precision=u;;){if(o=Et(o.times(e),u,1),n=n.times(++l),xt((s=a.plus(Nt(o,n,u,1))).d).slice(0,u)===xt(a.d).slice(0,u)){for(i=f;i--;)a=Et(a.times(a),u,1);if(null!=t)return p.precision=h,a;if(!(c<3&&vt(a.d,u-r,m,c)))return Et(a,p.precision=h,m,nt=!0);p.precision=u+=10,n=o=s=new p(1),l=0,c++}a=s}}function It(e,t){var n,r,i,o,a,s,u,c,l,f,p,m=1,h=e,d=h.d,g=h.constructor,y=g.rounding,x=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==t?(nt=!1,l=x):l=t,g.precision=l+=10,r=(n=xt(d)).charAt(0),!(Math.abs(o=h.e)<15e14))return c=Mt(g,l+2,x).times(o+""),h=It(new g(r+"."+n.slice(1)),l-10).plus(c),g.precision=x,null==t?Et(h,x,y,nt=!0):h;for(;r<7&&1!=r||1==r&&n.charAt(1)>3;)r=(n=xt((h=h.times(e)).d)).charAt(0),m++;for(o=h.e,r>1?(h=new g("0."+n),o++):h=new g(r+"."+n.slice(1)),f=h,u=a=h=Nt(h.minus(1),h.plus(1),l,1),p=Et(h.times(h),l,1),i=3;;){if(a=Et(a.times(p),l,1),xt((c=u.plus(Nt(a,new g(i),l,1))).d).slice(0,l)===xt(u.d).slice(0,l)){if(u=u.times(2),0!==o&&(u=u.plus(Mt(g,l+2,x).times(o+""))),u=Nt(u,new g(m),l,1),null!=t)return g.precision=x,u;if(!vt(u.d,l-10,y,s))return Et(u,g.precision=x,y,nt=!0);g.precision=l+=10,c=a=h=Nt(f.minus(1),f.plus(1),l,1),p=Et(h.times(h),l,1),i=s=1}u=c,i+=2}}function zt(e){return String(e.s*e.s/0)}function kt(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;48===t.charCodeAt(r);r++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(r,i)){if(i-=r,e.e=n=n-r-1,e.d=[],r=(n+1)%7,n<0&&(r+=7),r<i){for(r&&e.d.push(+t.slice(0,r)),i-=7;r<i;)e.d.push(+t.slice(r,r+=7));r=7-(t=t.slice(r)).length}else r-=i;for(;r--;)t+="0";e.d.push(+t),nt&&(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 Rt(e,t){var n,r,i,o,a,s,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),mt.test(t))return kt(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ft.test(t))n=16,t=t.toLowerCase();else if(lt.test(t))n=2;else{if(!pt.test(t))throw Error(it+t);n=8}for((o=t.search(/p/i))>0?(u=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),a=(o=t.indexOf("."))>=0,r=e.constructor,a&&(o=(s=(t=t.replace(".","")).length)-o,i=Dt(r,new r(n),o,2*o)),o=l=(c=wt(t,n,ht)).length-1;0===c[o];--o)c.pop();return o<0?new r(0*e.s):(e.e=St(c,l),e.d=c,nt=!1,a&&(e=Nt(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?ct(2,u):Dn.pow(2,u))),nt=!0,e)}function qt(e,t,n,r,i){var o,a,s,u,c=e.precision,l=Math.ceil(c/7);for(nt=!1,u=n.times(n),s=new e(r);;){if(a=Nt(s.times(u),new e(t++*t++),c,1),s=i?r.plus(a):r.minus(a),r=Nt(a.times(u),new e(t++*t++),c,1),void 0!==(a=s.plus(r)).d[l]){for(o=l;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=r,r=a,a=o}return nt=!0,a.d.length=l+1,a}function Pt(e,t){for(var n=e;--t;)n*=e;return n}function jt(e,t){var n,r=t.s<0,i=Ct(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return Ye=r?4:1,t;if((n=t.divToInt(i)).isZero())Ye=r?3:2;else{if((t=t.minus(n.times(i))).lte(o))return Ye=Ft(n)?r?2:3:r?4:1,t;Ye=Ft(n)?r?1:4:r?3:2}return t.minus(i).abs()}function Ut(e,t,n,r){var i,o,a,s,u,c,l,f,p,m=e.constructor,h=void 0!==n;if(h?(bt(n,1,Xe),void 0===r?r=m.rounding:bt(r,0,8)):(n=m.precision,r=m.rounding),e.isFinite()){for(h?(i=2,16==t?n=4*n-3:8==t&&(n=3*n-2)):i=t,(a=(l=At(e)).indexOf("."))>=0&&(l=l.replace(".",""),(p=new m(1)).e=l.length-a,p.d=wt(At(p),10,i),p.e=p.d.length),o=u=(f=wt(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(a<0?o--:((e=new m(e)).d=f,e.e=o,f=(e=Nt(e,p,n,r,0,i)).d,o=e.e,c=We),a=f[n],s=i/2,c=c||void 0!==f[n+1],c=r<4?(void 0!==a||c)&&(0===r||r===(e.s<0?3:2)):a>s||a===s&&(4===r||c||6===r&&1&f[n-1]||r===(e.s<0?8:7)),f.length=n,c)for(;++f[--n]>i-1;)f[n]=0,n||(++o,f.unshift(1));for(u=f.length;!f[u-1];--u);for(a=0,l="";a<u;a++)l+=Qe.charAt(f[a]);if(h){if(u>1)if(16==t||8==t){for(a=16==t?4:3,--u;u%a;u++)l+="0";for(u=(f=wt(l,i,t)).length;!f[u-1];--u);for(a=1,l="1.";a<u;a++)l+=Qe.charAt(f[a])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}else l=h?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=zt(e);return e.s<0?"-"+l:l}function Lt(e,t){if(e.length>t)return e.length=t,!0}function $t(e){return new this(e).abs()}function Ht(e){return new this(e).acos()}function Gt(e){return new this(e).acosh()}function Vt(e,t){return new this(e).plus(t)}function Zt(e){return new this(e).asin()}function Wt(e){return new this(e).asinh()}function Yt(e){return new this(e).atan()}function Jt(e){return new this(e).atanh()}function Xt(e,t){e=new this(e),t=new this(t);var n,r=this.precision,i=this.rounding,o=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?Ct(this,r,i):new this(0)).s=e.s:!e.d||t.isZero()?(n=Ct(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,n=this.atan(Nt(e,t,o,1)),t=Ct(this,o,1),this.precision=r,this.rounding=i,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(Nt(e,t,o,1)):(n=Ct(this,o,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function Qt(e){return new this(e).cbrt()}function Kt(e){return Et(e=new this(e),e.e+1,2)}function en(e,t,n){return new this(e).clamp(t,n)}function tn(e){if(!e||"object"!=typeof e)throw Error(rt+"Object expected");var t,n,r,i=!0===e.defaults,o=["precision",1,Xe,"rounding",0,8,"toExpNeg",-Je,0,"toExpPos",0,Je,"maxE",0,Je,"minE",-Je,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(n=o[t],i&&(this[n]=tt[n]),void 0!==(r=e[n])){if(!(ut(r)===r&&r>=o[t+1]&&r<=o[t+2]))throw Error(it+n+": "+r);this[n]=r}if(n="crypto",i&&(this[n]=tt[n]),void 0!==(r=e[n])){if(!0!==r&&!1!==r&&0!==r&&1!==r)throw Error(it+n+": "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(at);this[n]=!0}else this[n]=!1}return this}function nn(e){return new this(e).cos()}function rn(e){return new this(e).cosh()}function on(e,t){return new this(e).div(t)}function an(e){return new this(e).exp()}function sn(e){return Et(e=new this(e),e.e+1,3)}function un(){var e,t,n=new this(0);for(nt=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)n.d&&(n=n.plus(t.times(t)));else{if(t.s)return nt=!0,new this(1/0);n=t}return nt=!0,n.sqrt()}function cn(e){return e instanceof Dn||e&&e.toStringTag===st||!1}function ln(e){return new this(e).ln()}function fn(e,t){return new this(e).log(t)}function pn(e){return new this(e).log(2)}function mn(e){return new this(e).log(10)}function hn(){return Ot(this,arguments,-1)}function dn(){return Ot(this,arguments,1)}function gn(e,t){return new this(e).mod(t)}function yn(e,t){return new this(e).mul(t)}function xn(e,t){return new this(e).pow(t)}function bn(e){var t,n,r,i,o=0,a=new this(1),s=[];if(void 0===e?e=this.precision:bt(e,1,Xe),r=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(r));o<r;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(at);for(t=crypto.randomBytes(r*=4);o<r;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(s.push(i%1e7),o+=4);o=r/4}else for(;o<r;)s[o++]=1e7*Math.random()|0;for(e%=7,(r=s[--o])&&e&&(i=ct(10,7-e),s[o]=(r/i|0)*i);0===s[o];o--)s.pop();if(o<0)n=0,s=[0];else{for(n=-1;0===s[0];n-=7)s.shift();for(r=1,i=s[0];i>=10;i/=10)r++;r<7&&(n-=7-r)}return a.e=n,a.d=s,a}function vn(e){return Et(e=new this(e),e.e+1,this.rounding)}function wn(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Nn(e){return new this(e).sin()}function En(e){return new this(e).sinh()}function An(e){return new this(e).sqrt()}function Sn(e,t){return new this(e).sub(t)}function Mn(){var e=0,t=arguments,n=new this(t[e]);for(nt=!1;n.s&&++e<t.length;)n=n.plus(t[e]);return nt=!0,Et(n,this.precision,this.rounding)}function Cn(e){return new this(e).tan()}function Tn(e){return new this(e).tanh()}function Bn(e){return Et(e=new this(e),e.e+1,1)}yt[Symbol.for("nodejs.util.inspect.custom")]=yt.toString,yt[Symbol.toStringTag]="Decimal";var Dn=yt.constructor=function e(t){var n,r,i;function o(e){var t,n,r,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,cn(e))return i.s=e.s,void(nt?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"==(r=typeof e)){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(t=0,n=e;n>=10;n/=10)t++;return void(nt?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):kt(i,e.toString())}if("string"===r)return 45===(n=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===n&&(e=e.slice(1)),i.s=1),mt.test(e)?kt(i,e):Rt(i,e);if("bigint"===r)return e<0?(e=-e,i.s=-1):i.s=1,kt(i,e.toString());throw Error(it+e)}if(o.prototype=yt,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=tn,o.clone=e,o.isDecimal=cn,o.abs=$t,o.acos=Ht,o.acosh=Gt,o.add=Vt,o.asin=Zt,o.asinh=Wt,o.atan=Yt,o.atanh=Jt,o.atan2=Xt,o.cbrt=Qt,o.ceil=Kt,o.clamp=en,o.cos=nn,o.cosh=rn,o.div=on,o.exp=an,o.floor=sn,o.hypot=un,o.ln=ln,o.log=fn,o.log10=mn,o.log2=pn,o.max=hn,o.min=dn,o.mod=gn,o.mul=yn,o.pow=xn,o.random=bn,o.round=vn,o.sign=wn,o.sin=Nn,o.sinh=En,o.sqrt=An,o.sub=Sn,o.sum=Mn,o.tan=Cn,o.tanh=Tn,o.trunc=Bn,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],n=0;n<i.length;)t.hasOwnProperty(r=i[n++])||(t[r]=this[r]);return o.config(t),o}(tt);Ke=new Dn(Ke),et=new Dn(et);const Fn=Dn,On=he("BigNumber",["?on","config"],(e=>{let{on:t,config:n}=e;const r=Fn.clone({precision:n.precision,modulo:Fn.EUCLID});return r.prototype=Object.create(r.prototype),r.prototype.type="BigNumber",r.prototype.isBigNumber=!0,r.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},r.fromJSON=function(e){return new r(e.value)},t&&t("config",(function(e,t){e.precision!==t.precision&&r.config({precision:e.precision})})),r}),{isClass:!0}),_n=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},In=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},zn=function(e,t){return(e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},kn=function(){throw SyntaxError("Invalid Param")};function Rn(e,t){const n=Math.abs(e),r=Math.abs(t);return 0===e?Math.log(r):0===t?Math.log(n):n<3e3&&r<3e3?.5*Math.log(e*e+t*t):(e*=.5,t*=.5,.5*Math.log(e*e+t*t)+Math.LN2)}const qn={re:0,im:0},Pn=function(e,t){const n=qn;if(null==e)n.re=n.im=0;else if(void 0!==t)n.re=e,n.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)n.re=e.re,n.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return jn.INFINITY;n.re=e.abs*Math.cos(e.arg),n.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return jn.INFINITY;n.re=e.r*Math.cos(e.phi),n.im=e.r*Math.sin(e.phi)}else 2===e.length?(n.re=e[0],n.im=e[1]):kn();break;case"string":n.im=n.re=0;const t=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let r=1,i=0;null===t&&kn();for(let e=0;e<t.length;e++){const o=t[e];" "===o||"\t"===o||"\n"===o||("+"===o?r++:"-"===o?i++:"i"===o||"I"===o?(r+i===0&&kn()," "===t[e+1]||isNaN(t[e+1])?n.im+=parseFloat((i%2?"-":"")+"1"):(n.im+=parseFloat((i%2?"-":"")+t[e+1]),e++),r=i=0):((r+i===0||isNaN(o))&&kn(),"i"===t[e+1]||"I"===t[e+1]?(n.im+=parseFloat((i%2?"-":"")+o),e++):n.re+=parseFloat((i%2?"-":"")+o),r=i=0))}r+i>0&&kn();break;case"number":n.im=0,n.re=e;break;default:kn()}return isNaN(n.re)||isNaN(n.im),n};function jn(e,t){if(!(this instanceof jn))return new jn(e,t);const n=Pn(e,t);this.re=n.re,this.im=n.im}jn.prototype={re:0,im:0,sign:function(){const e=zn(this.re,this.im);return new jn(this.re/e,this.im/e)},add:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?jn.NAN:jn.INFINITY:new jn(this.re+n.re,this.im+n.im)},sub:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im));return r||i?r&&i?jn.NAN:jn.INFINITY:new jn(this.re-n.re,this.im-n.im)},mul:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,a=0===n.re&&0===n.im;return r&&a||i&&o?jn.NAN:r||i?jn.INFINITY:0===n.im&&0===this.im?new jn(this.re*n.re,0):new jn(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(e,t){const n=Pn(e,t),r=this.isInfinite(),i=!(isFinite(n.re)&&isFinite(n.im)),o=0===this.re&&0===this.im,a=0===n.re&&0===n.im;if(o&&a||r&&i)return jn.NAN;if(a||r)return jn.INFINITY;if(o||i)return jn.ZERO;if(0===n.im)return new jn(this.re/n.re,this.im/n.re);if(Math.abs(n.re)<Math.abs(n.im)){const e=n.re/n.im,t=n.re*e+n.im;return new jn((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{const e=n.im/n.re,t=n.im*e+n.re;return new jn((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){const n=Pn(e,t),r=0===this.re&&0===this.im;if(0===n.re&&0===n.im)return jn.ONE;if(0===n.im){if(0===this.im&&this.re>0)return new jn(Math.pow(this.re,n.re),0);if(0===this.re)switch((n.re%4+4)%4){case 0:return new jn(Math.pow(this.im,n.re),0);case 1:return new jn(0,Math.pow(this.im,n.re));case 2:return new jn(-Math.pow(this.im,n.re),0);case 3:return new jn(0,-Math.pow(this.im,n.re))}}if(r&&n.re>0)return jn.ZERO;const i=Math.atan2(this.im,this.re),o=Rn(this.re,this.im);let a=Math.exp(n.re*o-n.im*i),s=n.im*o+n.re*i;return new jn(a*Math.cos(s),a*Math.sin(s))},sqrt:function(){const e=this.re,t=this.im;if(0===t)return e>=0?new jn(Math.sqrt(e),0):new jn(0,Math.sqrt(-e));const n=zn(e,t);let r=Math.sqrt(.5*(n+Math.abs(e))),i=Math.abs(t)/(2*r);return e>=0?new jn(r,t<0?-i:i):new jn(i,t<0?-r:r)},exp:function(){const e=Math.exp(this.re);return 0===this.im?new jn(e,0):new jn(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){const e=this.re,t=this.im;return new jn(Math.expm1(e)*Math.cos(t)+function(e){const t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;const n=e*e;return n*(n*(n*(n*(n*(n*(n*(n/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){const e=this.re,t=this.im;return 0===t&&e>0?new jn(Math.log(e),0):new jn(Rn(e,t),Math.atan2(t,e))},abs:function(){return zn(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){const e=this.re,t=this.im;return new jn(Math.sin(e)*_n(t),Math.cos(e)*In(t))},cos:function(){const e=this.re,t=this.im;return new jn(Math.cos(e)*_n(t),-Math.sin(e)*In(t))},tan:function(){const e=2*this.re,t=2*this.im,n=Math.cos(e)+_n(t);return new jn(Math.sin(e)/n,In(t)/n)},cot:function(){const e=2*this.re,t=2*this.im,n=Math.cos(e)-_n(t);return new jn(-Math.sin(e)/n,In(t)/n)},sec:function(){const e=this.re,t=this.im,n=.5*_n(2*t)+.5*Math.cos(2*e);return new jn(Math.cos(e)*_n(t)/n,Math.sin(e)*In(t)/n)},csc:function(){const e=this.re,t=this.im,n=.5*_n(2*t)-.5*Math.cos(2*e);return new jn(Math.sin(e)*_n(t)/n,-Math.cos(e)*In(t)/n)},asin:function(){const e=this.re,t=this.im,n=new jn(t*t-e*e+1,-2*e*t).sqrt(),r=new jn(n.re-t,n.im+e).log();return new jn(r.im,-r.re)},acos:function(){const e=this.re,t=this.im,n=new jn(t*t-e*e+1,-2*e*t).sqrt(),r=new jn(n.re-t,n.im+e).log();return new jn(Math.PI/2-r.im,r.re)},atan:function(){const e=this.re,t=this.im;if(0===e){if(1===t)return new jn(0,1/0);if(-1===t)return new jn(0,-1/0)}const n=e*e+(1-t)*(1-t),r=new jn((1-t*t-e*e)/n,-2*e/n).log();return new jn(-.5*r.im,.5*r.re)},acot:function(){const e=this.re,t=this.im;if(0===t)return new jn(Math.atan2(1,e),0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).atan():new jn(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(0,1/0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).acos():new jn(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(Math.PI/2,1/0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).asin():new jn(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){const e=this.re,t=this.im;return new jn(In(e)*Math.cos(t),_n(e)*Math.sin(t))},cosh:function(){const e=this.re,t=this.im;return new jn(_n(e)*Math.cos(t),In(e)*Math.sin(t))},tanh:function(){const e=2*this.re,t=2*this.im,n=_n(e)+Math.cos(t);return new jn(In(e)/n,Math.sin(t)/n)},coth:function(){const e=2*this.re,t=2*this.im,n=_n(e)-Math.cos(t);return new jn(In(e)/n,-Math.sin(t)/n)},csch:function(){const e=this.re,t=this.im,n=Math.cos(2*t)-_n(2*e);return new jn(-2*In(e)*Math.cos(t)/n,2*_n(e)*Math.sin(t)/n)},sech:function(){const e=this.re,t=this.im,n=Math.cos(2*t)+_n(2*e);return new jn(2*_n(e)*Math.cos(t)/n,-2*In(e)*Math.sin(t)/n)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;const t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){const e=this.acos();if(e.im<=0){const t=e.re;e.re=-e.im,e.im=t}else{const t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){const e=this.re,t=this.im,n=e>1&&0===t,r=1-e,i=1+e,o=r*r+t*t,a=0!==o?new jn((i*r-t*t)/o,(t*r+i*t)/o):new jn(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=Rn(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,n&&(a.im=-a.im),a},acoth:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new jn(0,Math.PI/2);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).atanh():new jn(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){const e=this.re,t=this.im;if(0===t)return new jn(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).asinh():new jn(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){const e=this.re,t=this.im;if(this.isZero())return jn.INFINITY;const n=e*e+t*t;return 0!==n?new jn(e/n,-t/n).acosh():new jn(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return jn.INFINITY;if(this.isInfinite())return jn.ZERO;const e=this.re,t=this.im,n=e*e+t*t;return new jn(e/n,-t/n)},conjugate:function(){return new jn(this.re,-this.im)},neg:function(){return new jn(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new jn(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new jn(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new jn(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){const n=Pn(e,t);return Math.abs(n.re-this.re)<=jn.EPSILON&&Math.abs(n.im-this.im)<=jn.EPSILON},clone:function(){return new jn(this.re,this.im)},toString:function(){let e=this.re,t=this.im,n="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<jn.EPSILON&&(e=0),Math.abs(t)<jn.EPSILON&&(t=0),0===t?n+e:(0!==e?(n+=e,n+=" ",t<0?(t=-t,n+="-"):n+="+",n+=" "):t<0&&(t=-t,n+="-"),1!==t&&(n+=t),n+"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()}},jn.ZERO=new jn(0,0),jn.ONE=new jn(1,0),jn.I=new jn(0,1),jn.PI=new jn(Math.PI,0),jn.E=new jn(Math.E,0),jn.INFINITY=new jn(1/0,1/0),jn.NAN=new jn(NaN,NaN),jn.EPSILON=1e-15;const Un=he("Complex",[],(()=>(Object.defineProperty(jn,"name",{value:"Complex"}),jn.prototype.constructor=jn,jn.prototype.type="Complex",jn.prototype.isComplex=!0,jn.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},jn.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},jn.prototype.format=function(e){let t="",n=this.im,r=this.re;const i=Me(this.re,e),o=Me(this.im,e),a=d(e)?e:e?e.precision:null;if(null!==a){const e=Math.pow(10,-a);Math.abs(r/n)<e&&(r=0),Math.abs(n/r)<e&&(n=0)}return t=0===n?i:0===r?1===n?"i":-1===n?"-i":o+"i":n<0?-1===n?i+" - i":i+" - "+o.substring(1)+"i":1===n?i+" + i":i+" + "+o+"i",t},jn.fromPolar=function(e){switch(arguments.length){case 1:{const e=arguments[0];if("object"==typeof e)return jn(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{const e=arguments[0];let t=arguments[1];if(d(e)){if(v(t)&&t.hasBase("ANGLE")&&(t=t.toNumber("rad")),d(t))return new jn({r:e,phi:t});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},jn.prototype.valueOf=jn.prototype.toString,jn.fromJSON=function(e){return new jn(e)},jn.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},jn)),{isClass:!0});"undefined"==typeof BigInt&&(BigInt=function(e){if(isNaN(e))throw new Error("");return e});const Ln=BigInt(0),$n=BigInt(1),Hn=BigInt(2),Gn=BigInt(5),Vn=BigInt(10),Zn={s:$n,n:Ln,d:$n};function Wn(e,t){try{e=BigInt(e)}catch(e){throw nr()}return e*t}function Yn(e){return"bigint"==typeof e?e:Math.floor(e)}function Jn(e,t){if(t===Ln)throw tr();const n=Object.create(er.prototype);n.s=e<Ln?-$n:$n;const r=Kn(e=e<Ln?-e:e,t);return n.n=e/r,n.d=t/r,n}function Xn(e){const t={};let n=e,r=Hn,i=Gn-$n;for(;i<=n;){for(;n%r===Ln;)n/=r,t[r]=(t[r]||Ln)+$n;i+=$n+Hn*r++}return n!==e?n>1&&(t[n]=(t[n]||Ln)+$n):t[e]=(t[e]||Ln)+$n,t}const Qn=function(e,t){let n=Ln,r=$n,i=$n;if(null==e);else if(void 0!==t){if("bigint"==typeof e)n=e;else{if(isNaN(e))throw nr();if(e%1!=0)throw rr();n=BigInt(e)}if("bigint"==typeof t)r=t;else{if(isNaN(t))throw nr();if(t%1!=0)throw rr();r=BigInt(t)}i=n*r}else if("object"==typeof e){if("d"in e&&"n"in e)n=BigInt(e.n),r=BigInt(e.d),"s"in e&&(n*=BigInt(e.s));else if(0 in e)n=BigInt(e[0]),1 in e&&(r=BigInt(e[1]));else{if("bigint"!=typeof e)throw nr();n=e}i=n*r}else if("number"==typeof e){if(isNaN(e))throw nr();if(e<0&&(i=-$n,e=-e),e%1==0)n=BigInt(e);else if(e>0){let t=1,i=0,o=1,a=1,s=1,u=1e7;for(e>=1&&(t=10**Math.floor(1+Math.log10(e)),e/=t);o<=u&&s<=u;){let t=(i+a)/(o+s);if(e===t){o+s<=u?(n=i+a,r=o+s):s>o?(n=a,r=s):(n=i,r=o);break}e>t?(i+=a,o+=s):(a+=i,s+=o),o>u?(n=a,r=s):(n=i,r=o)}n=BigInt(n)*BigInt(t),r=BigInt(r)}}else if("string"==typeof e){let t=0,o=Ln,a=Ln,s=Ln,u=$n,c=$n,l=e.replace(/_/g,"").match(/\d+|./g);if(null===l)throw nr();if("-"===l[t]?(i=-$n,t++):"+"===l[t]&&t++,l.length===t+1?a=Wn(l[t++],i):"."===l[t+1]||"."===l[t]?("."!==l[t]&&(o=Wn(l[t++],i)),t++,(t+1===l.length||"("===l[t+1]&&")"===l[t+3]||"'"===l[t+1]&&"'"===l[t+3])&&(a=Wn(l[t],i),u=Vn**BigInt(l[t].length),t++),("("===l[t]&&")"===l[t+2]||"'"===l[t]&&"'"===l[t+2])&&(s=Wn(l[t+1],i),c=Vn**BigInt(l[t+1].length)-$n,t+=3)):"/"===l[t+1]||":"===l[t+1]?(a=Wn(l[t],i),u=Wn(l[t+2],$n),t+=3):"/"===l[t+3]&&" "===l[t+1]&&(o=Wn(l[t],i),a=Wn(l[t+2],i),u=Wn(l[t+4],$n),t+=5),!(l.length<=t))throw nr();r=u*c,i=n=s+r*o+c*a}else{if("bigint"!=typeof e)throw nr();n=e,i=e,r=$n}if(r===Ln)throw tr();Zn.s=i<Ln?-$n:$n,Zn.n=n<Ln?-n:n,Zn.d=r<Ln?-r:r};function Kn(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function er(e,t){if(Qn(e,t),!(this instanceof er))return Jn(Zn.s*Zn.n,Zn.d);e=Kn(Zn.d,Zn.n),this.s=Zn.s,this.n=Zn.n/e,this.d=Zn.d/e}var tr=function(){return new Error("Division by Zero")},nr=function(){return new Error("Invalid argument")},rr=function(){return new Error("Parameters must be integer")};er.prototype={s:$n,n:Ln,d:$n,abs:function(){return Jn(this.n,this.d)},neg:function(){return Jn(-this.s*this.n,this.d)},add:function(e,t){return Qn(e,t),Jn(this.s*this.n*Zn.d+Zn.s*this.d*Zn.n,this.d*Zn.d)},sub:function(e,t){return Qn(e,t),Jn(this.s*this.n*Zn.d-Zn.s*this.d*Zn.n,this.d*Zn.d)},mul:function(e,t){return Qn(e,t),Jn(this.s*Zn.s*this.n*Zn.n,this.d*Zn.d)},div:function(e,t){return Qn(e,t),Jn(this.s*Zn.s*this.n*Zn.d,this.d*Zn.n)},clone:function(){return Jn(this.s*this.n,this.d)},mod:function(e,t){if(void 0===e)return Jn(this.s*this.n%this.d,$n);if(Qn(e,t),Ln===Zn.n*this.d)throw tr();return Jn(this.s*(Zn.d*this.n)%(Zn.n*this.d),Zn.d*this.d)},gcd:function(e,t){return Qn(e,t),Jn(Kn(Zn.n,this.n)*Kn(Zn.d,this.d),Zn.d*this.d)},lcm:function(e,t){return Qn(e,t),Zn.n===Ln&&this.n===Ln?Jn(Ln,$n):Jn(Zn.n*this.n,Kn(Zn.n,this.n)*Kn(Zn.d,this.d))},inverse:function(){return Jn(this.s*this.d,this.n)},pow:function(e,t){if(Qn(e,t),Zn.d===$n)return Zn.s<Ln?Jn((this.s*this.d)**Zn.n,this.n**Zn.n):Jn((this.s*this.n)**Zn.n,this.d**Zn.n);if(this.s<Ln)return null;let n=Xn(this.n),r=Xn(this.d),i=$n,o=$n;for(let e in n)if("1"!==e){if("0"===e){i=Ln;break}if(n[e]*=Zn.n,n[e]%Zn.d!==Ln)return null;n[e]/=Zn.d,i*=BigInt(e)**n[e]}for(let e in r)if("1"!==e){if(r[e]*=Zn.n,r[e]%Zn.d!==Ln)return null;r[e]/=Zn.d,o*=BigInt(e)**r[e]}return Zn.s<Ln?Jn(o,i):Jn(i,o)},log:function(e,t){if(Qn(e,t),this.s<=Ln||Zn.s<=Ln)return null;const n={},r=Xn(Zn.n),i=Xn(Zn.d),o=Xn(this.n),a=Xn(this.d);for(const e in i)r[e]=(r[e]||Ln)-i[e];for(const e in a)o[e]=(o[e]||Ln)-a[e];for(const e in r)"1"!==e&&(n[e]=!0);for(const e in o)"1"!==e&&(n[e]=!0);let s=null,u=null;for(const e in n){const t=r[e]||Ln,n=o[e]||Ln;if(t===Ln){if(n!==Ln)return null;continue}let i=n,a=t;const c=Kn(i,a);if(i/=c,a/=c,null===s&&null===u)s=i,u=a;else if(i*u!=s*a)return null}return null!==s&&null!==u?Jn(s,u):null},equals:function(e,t){return Qn(e,t),this.s*this.n*Zn.d==Zn.s*Zn.n*this.d},lt:function(e,t){return Qn(e,t),this.s*this.n*Zn.d<Zn.s*Zn.n*this.d},lte:function(e,t){return Qn(e,t),this.s*this.n*Zn.d<=Zn.s*Zn.n*this.d},gt:function(e,t){return Qn(e,t),this.s*this.n*Zn.d>Zn.s*Zn.n*this.d},gte:function(e,t){return Qn(e,t),this.s*this.n*Zn.d>=Zn.s*Zn.n*this.d},compare:function(e,t){Qn(e,t);let n=this.s*this.n*Zn.d-Zn.s*Zn.n*this.d;return(Ln<n)-(n<Ln)},ceil:function(e){return e=Vn**BigInt(e||0),Jn(Yn(this.s*e*this.n/this.d)+(e*this.n%this.d>Ln&&this.s>=Ln?$n:Ln),e)},floor:function(e){return e=Vn**BigInt(e||0),Jn(Yn(this.s*e*this.n/this.d)-(e*this.n%this.d>Ln&&this.s<Ln?$n:Ln),e)},round:function(e){return e=Vn**BigInt(e||0),Jn(Yn(this.s*e*this.n/this.d)+this.s*((this.s>=Ln?$n:Ln)+Hn*(e*this.n%this.d)>this.d?$n:Ln),e)},roundTo:function(e,t){Qn(e,t);const n=this.n*Zn.d,r=this.d*Zn.n,i=n%r;let o=Yn(n/r);return i+i>=r&&o++,Jn(this.s*o*Zn.n,Zn.d)},divisible:function(e,t){return Qn(e,t),!(!(Zn.n*this.d)||this.n*Zn.d%(Zn.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(e){let t=this.n,n=this.d;e=e||15;let r=function(e,t){for(;t%Hn===Ln;t/=Hn);for(;t%Gn===Ln;t/=Gn);if(t===$n)return Ln;let n=Vn%t,r=1;for(;n!==$n;r++)if(n=n*Vn%t,r>2e3)return Ln;return BigInt(r)}(0,n),i=function(e,t,n){let r=$n,i=function(e,t,n){let r=$n;for(;t>Ln;e=e*e%n,t>>=$n)t&$n&&(r=r*e%n);return r}(Vn,n,t);for(let e=0;e<300;e++){if(r===i)return BigInt(e);r=r*Vn%t,i=i*Vn%t}return 0}(0,n,r),o=this.s<Ln?"-":"";if(o+=Yn(t/n),t%=n,t*=Vn,t&&(o+="."),r){for(let e=i;e--;)o+=Yn(t/n),t%=n,t*=Vn;o+="(";for(let e=r;e--;)o+=Yn(t/n),t%=n,t*=Vn;o+=")"}else for(let r=e;t&&r--;)o+=Yn(t/n),t%=n,t*=Vn;return o},toFraction:function(e){let t=this.n,n=this.d,r=this.s<Ln?"-":"";if(n===$n)r+=t;else{let i=Yn(t/n);e&&i>Ln&&(r+=i,r+=" ",t%=n),r+=t,r+="/",r+=n}return r},toLatex:function(e){let t=this.n,n=this.d,r=this.s<Ln?"-":"";if(n===$n)r+=t;else{let i=Yn(t/n);e&&i>Ln&&(r+=i,t%=n),r+="\\frac{",r+=t,r+="}{",r+=n,r+="}"}return r},toContinued:function(){let e=this.n,t=this.d,n=[];do{n.push(Yn(e/t));let r=e%t;e=t,t=r}while(e!==$n);return n},simplify:function(e){const t=BigInt(1/(e||.001)|0),n=this.abs(),r=n.toContinued();for(let e=1;e<r.length;e++){let i=Jn(r[e-1],$n);for(let t=e-2;t>=0;t--)i=i.inverse().add(r[t]);let o=i.sub(n);if(o.n*t<o.d)return i.mul(this.s)}return this}};const ir=he("Fraction",[],(()=>(Object.defineProperty(er,"name",{value:"Fraction"}),er.prototype.constructor=er,er.prototype.type="Fraction",er.prototype.isFraction=!0,er.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},er.fromJSON=function(e){return new er(e)},er)),{isClass:!0});n(3362),n(1795);const or=he("Range",[],(()=>{function e(t,n,r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");const i=null!=t,o=null!=n,a=null!=r;if(i)if(g(t))t=t.toNumber();else if("number"!=typeof t&&!y(t))throw new TypeError("Parameter start must be a number or bigint");if(o)if(g(n))n=n.toNumber();else if("number"!=typeof n&&!y(n))throw new TypeError("Parameter end must be a number or bigint");if(a)if(g(r))r=r.toNumber();else if("number"!=typeof r&&!y(r))throw new TypeError("Parameter step must be a number or bigint");this.start=i?parseFloat(t):0,this.end=o?parseFloat(n):0,this.step=a?parseFloat(r):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if("string"!=typeof t)return null;const n=t.split(":").map((function(e){return parseFloat(e)}));if(n.some((function(e){return isNaN(e)})))return null;switch(n.length){case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[2],n[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){let e=0;const t=this.start,n=this.step,r=this.end-t;return be(n)===be(r)?e=Math.ceil(r/n):0===r&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){const e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){const 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){let t=this.start;const n=this.step,r=this.end;let i=0;if(n>0)for(;t<r;)e(t,[i],this),t+=n,i++;else if(n<0)for(;t>r;)e(t,[i],this),t+=n,i++},e.prototype.map=function(e){const t=[];return this.forEach((function(n,r,i){t[r[0]]=e(n,r,i)})),t},e.prototype.toArray=function(){const e=[];return this.forEach((function(t,n){e[n[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){let t=Me(this.start,e);return 1!==this.step&&(t+=":"+Me(this.step,e)),t+=":"+Me(this.end,e),t},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(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0}),ar=he("Matrix",[],(()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,n){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,n){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e}),{isClass:!0});function sr(){return sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},sr.apply(null,arguments)}function ur(e,t,n){const r=new(0,e.constructor)(2);let i="";if(n){if(n<1)throw new Error("size must be in greater than 0");if(!ye(n))throw new Error("size must be an integer");if(e.greaterThan(r.pow(n-1).sub(1))||e.lessThan(r.pow(n-1).mul(-1)))throw new Error(`Value must be in range [-2^${n-1}, 2^${n-1}-1]`);if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(r.pow(n))),i=`i${n}`}switch(t){case 2:return`${e.toBinary()}${i}`;case 8:return`${e.toOctal()}${i}`;case 16:return`${e.toHexadecimal()}${i}`;default:throw new Error(`Base ${t} not supported `)}}function cr(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function lr(e,t){return d(e)?e:g(e)?e.toNumber():t}function fr(e,t){const n=e.length-t.length,r=e.length;return e.substring(n,r)===t}function pr(e,t){const n=function(e,t){return"number"==typeof e?Me(e,t):g(e)?function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";const{notation:n,precision:r,wordSize:i}=Ce(t);switch(n){case"fixed":return function(e,t){return e.toFixed(t)}(e,r);case"exponential":return cr(e,r);case"engineering":return function(e,t){const n=e.e,r=n%3==0?n:n<0?n-3-n%3:n-n%3;let i=e.mul(Math.pow(10,-r)).toPrecision(t);return i.includes("e")&&(i=new(0,e.constructor)(i).toFixed()),i+"e"+(n>=0?"+":"")+r.toString()}(e,r);case"bin":return ur(e,2,i);case"oct":return ur(e,8,i);case"hex":return ur(e,16,i);case"auto":{const n=lr(null==t?void 0:t.lowerExp,-3),i=lr(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";let o;const a=e.toSignificantDigits(r),s=a.e;return o=s>=n&&s<i?a.toFixed():cr(e,r),o.replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}))}default:throw new Error('Unknown notation "'+n+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t):function(e){return e&&"object"==typeof e&&"bigint"==typeof e.s&&"bigint"==typeof e.n&&"bigint"==typeof e.d||!1}(e)?t&&"decimal"===t.fraction?e.toString():`${e.s*e.n}/${e.d}`:Array.isArray(e)?gr(e,t):w(e)?mr(e):"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):"{"+Object.keys(e).map((n=>mr(n)+": "+pr(e[n],t))).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+"...":n}function mr(e){const t=String(e);let n="",r=0;for(;r<t.length;){const e=t.charAt(r);n+=e in hr?hr[e]:e,r++}return'"'+n+'"'}n(2712),n(8872);const hr={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function dr(e){let t=String(e);return t=t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),t}function gr(e,t){if(Array.isArray(e)){let n="[";const r=e.length;for(let i=0;i<r;i++)0!==i&&(n+=", "),n+=gr(e[i],t);return n+="]",n}return pr(e,t)}function yr(e,t){if(!w(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(e)+", index: 0)");if(!w(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(t)+", index: 1)");return e===t?0:e>t?1:-1}function xr(e,t,n){if(!(this instanceof xr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=n,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function br(e,t,n){if(!(this instanceof br))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=n),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=(new Error).stack}function vr(e){const t=[];for(;Array.isArray(e);)t.push(e.length),e=e[0];return t}function wr(e,t,n){let r;const i=e.length;if(i!==t[n])throw new xr(i,t[n]);if(n<t.length-1){const o=n+1;for(r=0;r<i;r++){const n=e[r];if(!Array.isArray(n))throw new xr(t.length-1,t.length,"<");wr(e[r],t,o)}}else for(r=0;r<i;r++)if(Array.isArray(e[r]))throw new xr(t.length+1,t.length,">")}function Nr(e,t){if(0===t.length){if(Array.isArray(e))throw new xr(e.length,0)}else wr(e,t,0)}function Er(e,t){const n=e.isMatrix?e._size:vr(e);t._sourceSize.forEach(((e,t)=>{if(null!==e&&e!==n[t])throw new xr(e,n[t])}))}function Ar(e,t){if(void 0!==e){if(!d(e)||!ye(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new br(e,t)}}function Sr(e){for(let t=0;t<e._dimensions.length;++t){const n=e._dimensions[t];if(n._data&&N(n._data)){if(0===n._size[0])return!0}else if(n.isRange){if(n.start===n.end)return!0}else if(w(n)&&0===n.length)return!0}return!1}function Mr(e,t,n){if(!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");return t.forEach((function(e){if(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+pr(t)+")")})),(d(e)||g(e))&&(e=[e]),Cr(e,t,0,void 0!==n?n:0),e}function Cr(e,t,n,r){let i,o;const a=e.length,s=t[n],u=Math.min(a,s);if(e.length=s,n<t.length-1){const a=n+1;for(i=0;i<u;i++)o=e[i],Array.isArray(o)||(o=[o],e[i]=o),Cr(o,t,a,r);for(i=u;i<s;i++)o=[],e[i]=o,Cr(o,t,a,r)}else{for(i=0;i<u;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=u;i<s;i++)e[i]=r}}function Tr(e,t){const n=zr(e),r=n.length;if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new xr(0,r,"!=");const i=Dr(t=Br(t,r));if(r!==i)throw new xr(i,r,"!=");try{return function(e,t){let n,r=e;for(let e=t.length-1;e>0;e--){const i=t[e];n=[];const o=r.length/i;for(let e=0;e<o;e++)n.push(r.slice(e*i,(e+1)*i));r=n}return r}(n,t)}catch(e){if(e instanceof xr)throw new xr(i,r,"!=");throw e}}function Br(e,t){const n=Dr(e),r=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw new Error("More than one wildcard in sizes");if(i>=0){if(t%n!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-n);r[i]=-t/n}return r}function Dr(e){return e.reduce(((e,t)=>e*t),1)}function Fr(e,t){const n=t||vr(e);for(;Array.isArray(e)&&1===e.length;)e=e[0],n.shift();let r=n.length;for(;1===n[r-1];)r--;return r<n.length&&(e=Or(e,r,0),n.length=r),e}function Or(e,t,n){let r,i;if(n<t){const o=n+1;for(r=0,i=e.length;r<i;r++)e[r]=Or(e[r],t,o)}else for(;Array.isArray(e);)e=e[0];return e}function _r(e,t,n,r){const i=r||vr(e);if(n)for(let t=0;t<n;t++)e=[e],i.unshift(1);for(e=Ir(e,t,0);i.length<t;)i.push(1);return e}function Ir(e,t,n){let r,i;if(Array.isArray(e)){const o=n+1;for(r=0,i=e.length;r<i;r++)e[r]=Ir(e[r],t,o)}else for(let r=n;r<t;r++)e=[e];return e}function zr(e){if(!Array.isArray(e))return e;const t=[];return e.forEach((function e(n){Array.isArray(n)?n.forEach(e):t.push(n)})),t}function kr(e,t){return Array.prototype.map.call(e,t)}function Rr(e,t){Array.prototype.forEach.call(e,t)}function qr(e,t){if(1!==vr(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(e=>t.test(e)))}function Pr(e,t){return Array.prototype.join.call(e,t)}function jr(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];let n=0;t[0]={value:e[0],identifier:0};for(let r=1;r<e.length;r++)e[r]===e[r-1]?n++:n=0,t.push({value:e[r],identifier:n});return t}function Ur(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];for(let n=0;n<e.length;n++)t.push(e[n].value);return t}function Lr(e,t){let n,r=0;for(let i=0;i<e.length;i++){const o=e[i],a=Array.isArray(o);if(0===i&&a&&(r=o.length),a&&o.length!==r)return;const s=a?Lr(o,t):t(o);if(void 0===n)n=s;else if(n!==s)return"mixed"}return n}function $r(e,t,n,r){if(r<n){if(e.length!==t.length)throw new xr(e.length,t.length);const i=[];for(let o=0;o<e.length;o++)i[o]=$r(e[o],t[o],n,r+1);return i}return e.concat(t)}function Hr(){const e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce((function(e,n){return $r(e,n,t,0)}),e[0]);throw new Error("Wrong number of arguments in function concat")}function Gr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];const r=t.map((e=>e.length)),i=Math.max(...r),o=new Array(i).fill(null);for(let e=0;e<t.length;e++){const n=t[e],a=r[e];for(let e=0;e<a;e++){const t=i-a+e;n[e]>o[t]&&(o[t]=n[e])}}for(let e=0;e<t.length;e++)Vr(t[e],o);return o}function Vr(e,t){const n=t.length,r=e.length;for(let i=0;i<r;i++){const o=n-r+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw new Error(`shape missmatch: missmatch is found in arg with shape (${e}) not possible to broadcast dimension ${r} with size ${e[i]} to size ${t[o]}`)}}function Zr(e,t){let n=vr(e);if(ce(n,t))return e;Vr(n,t);const r=Gr(n,t),i=r.length,o=[...Array(i-n.length).fill(1),...n];let a=function(e){return sr([],e)}(e);n.length<i&&(a=Tr(a,o),n=vr(a));for(let e=0;e<i;e++)n[e]<r[e]&&(s=a,u=r[e],c=e,a=Hr(...Array(u).fill(s),c),n=vr(a));var s,u,c;return a}function Wr(e,t){if(!Array.isArray(e))throw new Error("Array expected");const n=vr(e);if(t.length!==n.length)throw new xr(t.length,n.length);for(let e=0;e<t.length;e++)Ar(t[e],n[e]);return t.reduce(((e,t)=>e[t]),e)}function Yr(e,t,n,r){return Array.isArray(e)?e.map((function(e,i){return Yr(e,t.concat(i),n,r)})):r(e,t,n)}function Jr(e,n,r){if(t.isTypedFunction(e)){const i=(n.isMatrix?n.size():vr(n)).map((()=>0)),o=n.isMatrix?n.get(i):Wr(n,i),a=1===Object.keys(e.signatures).length,s=function(e,n,r,i){const o=[n,r,i];for(let n=3;n>0;n--){const r=o.slice(0,n);if(null!==t.resolve(e,r))return n}}(e,o,i,n),u=a?Object.values(e.signatures)[0]:e;return s>=1&&s<=3?function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Xr(u,n.slice(0,s),r,e.name)}:function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return Xr(u,n,r,e.name)}}return e}function Xr(e,t,n,r){try{return e(...t)}catch(e){!function(e,t,n,r){var i;if(e instanceof TypeError&&"wrongType"===(null===(i=e.data)||void 0===i?void 0:i.category)){const e=[];throw e.push(`value: ${oe(t[0])}`),t.length>=2&&e.push(`index: ${oe(t[1])}`),t.length>=3&&e.push(`array: ${oe(t[2])}`),new TypeError(`Function ${n} cannot apply callback arguments ${r}(${e.join(", ")}) at index ${JSON.stringify(t[1])}`)}throw new TypeError(`Function ${n} cannot apply callback arguments to function ${r}: ${e.message}`)}(e,t,n,r)}}xr.prototype=new RangeError,xr.prototype.constructor=RangeError,xr.prototype.name="DimensionError",xr.prototype.isDimensionError=!0,br.prototype=new RangeError,br.prototype.constructor=RangeError,br.prototype.name="IndexError",br.prototype.isIndexError=!0,n(3110);const Qr=he("DenseMatrix",["Matrix"],(e=>{let{Matrix:t}=e;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))"DenseMatrix"===e.type?(this._data=ae(e._data),this._size=ae(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,Nr(this._data,this._size),this._datatype=t||e.datatype;else if(N(e))this._data=s(e),this._size=vr(this._data),Nr(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t}}function r(e,t,n,i){const o=i===n-1,a=t.dimension(i);return o?a.map((function(t){return Ar(t,e.length),e[t]})).valueOf():a.map((function(o){return Ar(o,e.length),r(e[o],t,n,i+1)})).valueOf()}function i(e,t,n,r,o){const a=o===r-1,s=t.dimension(o);a?s.forEach((function(t,r){Ar(t),e[t]=n[r[0]]})):s.forEach((function(a,s){Ar(a),i(e[a],t,n[s[0]],r,o+1)}))}function o(e,t,n){if(0===t.length){let t=e._data;for(;N(t);)t=t[0];return t}return e._size=t.slice(0),e._data=Mr(e._data,e._size,n),e}function a(e,t,n){const r=e._size.slice(0);let i=!1;for(;r.length<t.length;)r.push(0),i=!0;for(let e=0,n=t.length;e<n;e++)t[e]>r[e]&&(r[e]=t[e],i=!0);i&&o(e,r,n)}function s(e){return E(e)?s(e.valueOf()):N(e)?e.map(s):e}return n.prototype=new t,n.prototype.createDenseMatrix=function(e,t){return new n(e,t)},Object.defineProperty(n,"name",{value:"DenseMatrix"}),n.prototype.constructor=n,n.prototype.type="DenseMatrix",n.prototype.isDenseMatrix=!0,n.prototype.getDataType=function(){return Lr(this._data,oe)},n.prototype.storage=function(){return"dense"},n.prototype.datatype=function(){return this._datatype},n.prototype.create=function(e,t){return new n(e,t)},n.prototype.subset=function(e,t,o){switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());{const i=t.size();if(i.length!==e._size.length)throw new xr(i.length,e._size.length);const o=t.min(),a=t.max();for(let t=0,n=e._size.length;t<n;t++)Ar(o[t],e._size[t]),Ar(a[t],e._size[t]);return new n(r(e._data,t,i.length,0),e._datatype)}}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const o=t.size(),s=t.isScalar();let u;if(E(n)?(u=n.size(),n=n.valueOf()):u=vr(n),s){if(0!==u.length)throw new TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(!ce(u,o))try{u=vr(n=0===u.length?Zr([n],o):Zr(n,o))}catch(e){}if(o.length<e._size.length)throw new xr(o.length,e._size.length,"<");if(u.length<o.length){let e=0,t=0;for(;1===o[e]&&1===u[e];)e++;for(;1===o[e];)t++,e++;n=_r(n,o.length,t,u)}if(!ce(o,u))throw new xr(o,u,">");a(e,t.max().map((function(e){return e+1})),r);const s=o.length,c=0;i(e._data,t,n,s,c)}return e}(this,e,t,o);default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.get=function(e){return Wr(this._data,e)},n.prototype.set=function(e,t,n){if(!N(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new xr(e.length,this._size.length,"<");let r,i,o;const s=e.map((function(e){return e+1}));a(this,s,n);let u=this._data;for(r=0,i=e.length-1;r<i;r++)o=e[r],Ar(o,u.length),u=u[o];return o=e[e.length-1],Ar(o,u.length),u[o]=t,this},n.prototype.resize=function(e,t,n){if(!A(e))throw new TypeError("Array or Matrix expected");const r=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));return o(n?this.clone():this,r,t)},n.prototype.reshape=function(e,t){const n=t?this.clone():this;n._data=Tr(n._data,e);const r=n._size.reduce(((e,t)=>e*t));return n._size=Br(e,r),n},n.prototype.clone=function(){return new n({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},n.prototype.size=function(){return this._size.slice(0)},n.prototype._forEach=function(e){const t=this,n=t.size();if(1===n.length){for(let r=0;r<n[0];r++)e(t._data,r,[r]);return}const r=Array(n.length).fill(0),i=Array(n.length-1),o=i.length-1;i[0]=t._data[0];for(let e=0;e<o;e++)i[e+1]=i[e][0];for(r[o]=-1;;){let a;for(a=o;a>=0;a--){if(r[a]++,r[a]!==n[a]){i[a]=0===a?t._data[r[a]]:i[a-1][r[a]];for(let e=a;e<o;e++)i[e+1]=i[e][0];for(let t=0;t<n[i.length];t++)r[i.length]=t,e(i[o],t,r.slice(0));break}r[a]=0}if(-1===a)break}},n.prototype.map=function(e){const t=this,r=new n(t),i=Jr(e,t._data,"map");return r._forEach((function(e,n,r){e[n]=i(e[n],r,t)})),r},n.prototype.forEach=function(e){const t=this,n=Jr(e,t._data,"map");t._forEach((function(e,r,i){n(e[r],i,t)}))},n.prototype[Symbol.iterator]=function*(){const e=function*(t,n){if(N(t))for(let r=0;r<t.length;r++)yield*e(t[r],n.concat(r));else yield{value:t,index:n}};yield*e(this._data,[])},n.prototype.rows=function(){const e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");const t=this._data;for(const r of t)e.push(new n([r],this._datatype));return e},n.prototype.columns=function(){const e=[],t=this.size();if(2!==t.length)throw new TypeError("Rows can only be returned for a 2D matrix.");const r=this._data;for(let i=0;i<t[1];i++){const t=r.map((e=>[e[i]]));e.push(new n(t,this._datatype))}return e},n.prototype.toArray=function(){return ae(this._data)},n.prototype.valueOf=function(){return this._data},n.prototype.format=function(e){return pr(this._data,e)},n.prototype.toString=function(){return pr(this._data)},n.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,r=e<0?-e:0,i=this._size[0],o=this._size[1],a=Math.min(i-r,o-t),s=[];for(let e=0;e<a;e++)s[e]=this._data[e+r][e+t];return new n({data:s,size:[a],datatype:this._datatype})},n.diagonal=function(e,t,r,i){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),r){if(g(r)&&(r=r.toNumber()),!d(r)||!ye(r))throw new TypeError("The parameter k must be an integer number")}else r=0;const o=r>0?r:0,a=r<0?-r:0,s=e[0],u=e[1],c=Math.min(s-a,u-o);let l;if(N(t)){if(t.length!==c)throw new Error("Invalid value array length");l=function(e){return t[e]}}else if(E(t)){const e=t.size();if(1!==e.length||e[0]!==c)throw new Error("Invalid matrix length");l=function(e){return t.get([e])}}else l=function(){return t};i||(i=g(l(0))?l(0).mul(0):0);let f=[];if(e.length>0){f=Mr(f,e,i);for(let e=0;e<c;e++)f[e+a][e+o]=l(e)}return new n({data:f,size:[s,u]})},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return Ar(e,this._size[0]),Ar(t,this._size[0]),n._swapRows(e,t,this._data),this},n._swapRows=function(e,t,n){const r=n[e];n[e]=n[t],n[t]=r},n}),{isClass:!0}),Kr="clone",ei=he(Kr,["typed"],(e=>{let{typed:t}=e;return t(Kr,{any:ae})}));function ti(e){const t=e.length,n=e[0].length;let r,i;const o=[];for(i=0;i<n;i++){const n=[];for(r=0;r<t;r++)n.push(e[r][i]);o.push(n)}return o}function ni(e){for(let t=0;t<e.length;t++)if(A(e[t]))return!0;return!1}function ri(e,t){E(e)&&(e=e.valueOf());for(let n=0,r=e.length;n<r;n++){const r=e[n];Array.isArray(r)?ri(r,t):t(r)}}function ii(e,t,n){return e&&"function"==typeof e.map?e.map((function(e){return ii(e,t,n)})):t(e)}function oi(e,t,n){const r=Array.isArray(e)?vr(e):e.size();if(t<0||t>=r.length)throw new br(t,r.length);return E(e)?e.create(ai(e.valueOf(),t,n),e.datatype()):ai(e,t,n)}function ai(e,t,n){let r,i,o,a;if(t<=0){if(Array.isArray(e[0])){for(a=ti(e),i=[],r=0;r<a.length;r++)i[r]=ai(a[r],t-1,n);return i}for(o=e[0],r=1;r<e.length;r++)o=n(o,e[r]);return o}for(i=[],r=0;r<e.length;r++)i[r]=ai(e[r],t-1,n);return i}function si(e,t,n,r,i,o,a,s,u,c,l){const f=e._values,p=e._index,m=e._ptr;let h,d,g,y;if(r)for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],n[y]!==o?(n[y]=o,a.push(y),c?(r[y]=u?s(f[h],l):s(l,f[h]),i[y]=o):r[y]=f[h]):(r[y]=u?s(f[h],r[y]):s(r[y],f[h]),i[y]=o);else for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],n[y]!==o?(n[y]=o,a.push(y)):i[y]=o}const ui="isInteger",ci=he(ui,["typed"],(e=>{let{typed:t}=e;return t(ui,{number:ye,BigNumber:function(e){return e.isInt()},bigint:function(e){return!0},Fraction:function(e){return 1n===e.d},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})}));n(2577);const li="number";function fi(e){return e<0}function pi(e){return e>0}function mi(e){return Number.isNaN(e)}function hi(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-9,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(n<=0)throw new Error("Relative tolerance must be greater than 0");if(r<0)throw new Error("Absolute tolerance must be at least 0");return!e.isNaN()&&!t.isNaN()&&(e.isFinite()&&t.isFinite()?!!e.eq(t)||e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(n),r)):e.eq(t))}fi.signature=li,pi.signature=li,mi.signature=li;const di="isNegative",gi=he(di,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(di,{number:e=>!_e(e,0,n.relTol,n.absTol)&&fi(e),BigNumber:e=>!hi(e,new e.constructor(0),n.relTol,n.absTol)&&e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0n,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),yi="isNumeric",xi=he(yi,["typed"],(e=>{let{typed:t}=e;return t(yi,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),bi="hasNumericValue",vi=he(bi,["typed","isNumeric"],(e=>{let{typed:t,isNumeric:n}=e;return t(bi,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return n(e)}})})),wi="isPositive",Ni=he(wi,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(wi,{number:e=>!_e(e,0,n.relTol,n.absTol)&&pi(e),BigNumber:e=>!(hi(e,new e.constructor(0),n.relTol,n.absTol)||e.isNeg()||e.isZero()||e.isNaN()),bigint:e=>e>0n,Fraction:e=>e.s>0n&&e.n>0n,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ei="isZero",Ai=he(Ei,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(Ei,{"number | BigNumber | Complex | Fraction":e=>n(e,0),bigint:e=>0n===e,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Si="isNaN",Mi=he(Si,["typed"],(e=>{let{typed:t}=e;return t(Si,{number:mi,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":t.referToSelf((e=>t=>ii(t,e)))})})),Ci="typeOf",Ti=he(Ci,["typed"],(e=>{let{typed:t}=e;return t(Ci,{any:oe})})),Bi=he("compareUnits",["typed"],(e=>{let{typed:t}=e;return{"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(!n.equalBase(r))throw new Error("Cannot compare units with different base");return t.find(e,[n.valueType(),r.valueType()])(n.value,r.value)}))}})),Di="equalScalar",Fi=he(Di,["typed","config"],(e=>{let{typed:t,config:n}=e;const r=Bi({typed:t});return t(Di,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||hi(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e===t},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,n,r){return _e(e.re,t.re,n,r)&&_e(e.im,t.im,n,r)}(e,t,n.relTol,n.absTol)}},r)})),Oi=(he(Di,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(Di,{"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)}})})),he("SparseMatrix",["typed","equalScalar","Matrix"],(e=>{let{typed:t,equalScalar:n,Matrix:r}=e;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))!function(e,t,n){"SparseMatrix"===t.type?(e._values=t._values?ae(t._values):void 0,e._index=ae(t._index),e._ptr=ae(t._ptr),e._size=ae(t._size),e._datatype=n||t._datatype):o(e,t.valueOf(),n||t._datatype)}(this,e,t);else if(e&&N(e.index)&&N(e.ptr)&&N(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(N(e))o(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function o(e,r,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;const o=r.length;let a=0,s=n,u=0;if(w(i)&&(s=t.find(n,[i,i])||n,u=t.convert(0,i)),o>0){let t=0;do{e._ptr.push(e._index.length);for(let n=0;n<o;n++){const i=r[n];if(N(i)){if(0===t&&a<i.length&&(a=i.length),t<i.length){const r=i[t];s(r,u)||(e._values.push(r),e._index.push(n))}}else 0===t&&a<1&&(a=1),s(i,u)||(e._values.push(i),e._index.push(n))}t++}while(t<a)}e._ptr.push(e._index.length),e._size=[o,a]}function a(e,t,n,r){if(n-t==0)return n;for(let i=t;i<n;i++)if(r[i]===e)return i;return t}function s(e,t,n,r,i,o,a){i.splice(e,0,r),o.splice(e,0,t);for(let e=n+1;e<a.length;e++)a[e]++}function u(e,r,i,o){let a=o||0,s=n,u=0;w(e._datatype)&&(s=t.find(n,[e._datatype,e._datatype])||n,u=t.convert(0,e._datatype),a=t.convert(a,e._datatype));const c=!s(a,u),l=e._size[0];let f,p,m,h=e._size[1];if(i>h){for(p=h;p<i;p++)if(e._ptr[p]=e._values.length,c)for(f=0;f<l;f++)e._values.push(a),e._index.push(f);e._ptr[i]=e._values.length}else 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,r>l){if(c){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]+t,m=e._ptr[p+1]+t;let n=0;for(f=l;f<r;f++,n++)e._values.splice(m+n,0,a),e._index.splice(m+n,0,f),t++}e._ptr[h]=e._values.length}}else if(r<l){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]-t;const n=e._ptr[p],i=e._ptr[p+1]-t;for(m=n;m<i;m++)f=e._index[m],f>r-1&&(e._values.splice(m,1),e._index.splice(m,1),t++)}e._ptr[p]=e._values.length}return e._size[0]=r,e._size[1]=i,e}function c(e,t,n,r,i){const o=r[0],a=r[1],s=[];let u,c;for(u=0;u<o;u++)for(s[u]=[],c=0;c<a;c++)s[u][c]=0;for(c=0;c<a;c++){const r=n[c],o=n[c+1];for(let n=r;n<o;n++)u=t[n],s[u][c]=e?i?ae(e[n]):e[n]:1}return s}return i.prototype=new r,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Lr(this._values,oe)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){const e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,n){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());const n=t.size();if(n.length!==e._size.length)throw new xr(n.length,e._size.length);let r,o,a,s;const u=t.min(),c=t.max();for(r=0,o=e._size.length;r<o;r++)Ar(u[r],e._size[r]),Ar(c[r],e._size[r]);const l=e._values,f=e._index,p=e._ptr,m=t.dimension(0),h=t.dimension(1),d=[],g=[];m.forEach((function(e,t){g[e]=t[0],d[e]=!0}));const y=l?[]:void 0,x=[],b=[];return h.forEach((function(e){for(b.push(x.length),a=p[e],s=p[e+1];a<s;a++)r=f[a],!0===d[r]&&(x.push(g[r]),y&&y.push(l[a]))})),b.push(x.length),new i({values:y,index:x,ptr:b,size:n,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const i=t.size(),o=t.isScalar();let a;if(E(n)?(a=n.size(),n=n.toArray()):a=vr(n),o){if(0!==a.length)throw new TypeError("Scalar expected");e.set(t.min(),n,r)}else{if(1!==i.length&&2!==i.length)throw new xr(i.length,e._size.length,"<");if(a.length<i.length){let e=0,t=0;for(;1===i[e]&&1===a[e];)e++;for(;1===i[e];)t++,e++;n=_r(n,i.length,t,a)}if(!ce(i,a))throw new xr(i,a,">");if(1===i.length)t.dimension(0).forEach((function(t,i){Ar(t),e.set([t,0],n[i[0]],r)}));else{const i=t.dimension(0),o=t.dimension(1);i.forEach((function(t,i){Ar(t),o.forEach((function(o,a){Ar(o),e.set([t,o],n[i[0]][a[0]],r)}))}))}}return e}(this,e,t,n);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new xr(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");const t=e[0],n=e[1];Ar(t,this._size[0]),Ar(n,this._size[1]);const r=a(t,this._ptr[n],this._ptr[n+1],this._index);return r<this._ptr[n+1]&&this._index[r]===t?this._values[r]:0},i.prototype.set=function(e,r,i){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new xr(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");const o=e[0],c=e[1];let l=this._size[0],f=this._size[1],p=n,m=0;w(this._datatype)&&(p=t.find(n,[this._datatype,this._datatype])||n,m=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(u(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),Ar(o,l),Ar(c,f);const h=a(o,this._ptr[c],this._ptr[c+1],this._index);return h<this._ptr[c+1]&&this._index[h]===o?p(r,m)?function(e,t,n,r,i){n.splice(e,1),r.splice(e,1);for(let e=t+1;e<i.length;e++)i[e]--}(h,c,this._values,this._index,this._ptr):this._values[h]=r:p(r,m)||s(h,o,c,r,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,n){if(!A(e))throw new TypeError("Array or Matrix expected");const r=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));if(2!==r.length)throw new Error("Only two dimensions matrix are supported");return r.forEach((function(e){if(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+pr(r)+")")})),u(n?this.clone():this,r[0],r[1],t)},i.prototype.reshape=function(e,t){if(!N(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");e.forEach((function(t){if(!d(t)||!ye(t)||t<=-2||0===t)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+pr(e)+")")}));const n=this._size[0]*this._size[1];if(n!==(e=Br(e,n))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");const r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;const i=[];for(let e=0;e<r._ptr.length;e++)for(let t=0;t<r._ptr[e+1]-r._ptr[e];t++)i.push(e);const o=r._values.slice(),u=r._index.slice();for(let t=0;t<r._index.length;t++){const n=u[t],o=i[t],a=n*r._size[1]+o;i[t]=a%e[1],u[t]=Math.floor(a/e[1])}r._values.length=0,r._index.length=0,r._ptr.length=e[1]+1,r._size=e.slice();for(let e=0;e<r._ptr.length;e++)r._ptr[e]=0;for(let e=0;e<o.length;e++){const t=u[e],n=i[e],c=o[e];s(a(t,r._ptr[n],r._ptr[n+1],r._index),t,n,c,r._values,r._index,r._ptr)}return r},i.prototype.clone=function(){return new i({values:this._values?ae(this._values):void 0,index:ae(this._index),ptr:ae(this._ptr),size:ae(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,r){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");const o=this,a=this._size[0],s=this._size[1],u=Jr(e,o,"map");return function(e,r,a,s,c,l,f){const p=[],m=[],h=[];let d=n,g=0;w(e._datatype)&&(d=t.find(n,[e._datatype,e._datatype])||n,g=t.convert(0,e._datatype));const y=function(e,t,n){const r=function(e,t,n){return u(e,[t,n],o)}(e,t,n);d(r,g)||(p.push(r),m.push(t))};for(let t=0;t<=c;t++){h.push(p.length);const n=e._ptr[t],r=e._ptr[t+1];if(f)for(let i=n;i<r;i++){const n=e._index[i];n>=0&&n<=a&&y(e._values[i],n-0,t-0)}else{const i={};for(let t=n;t<r;t++)i[e._index[t]]=e._values[t];for(let e=0;e<=a;e++)y(e in i?i[e]:0,e-0,t-0)}}return h.push(p.length),new i({values:p,index:m,ptr:h,size:[a-0+1,c-0+1]})}(this,0,a-1,0,s-1,0,r)},i.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");const n=this,r=this._size[0],i=this._size[1],o=Jr(e,n,"forEach");for(let e=0;e<i;e++){const i=this._ptr[e],a=this._ptr[e+1];if(t)for(let t=i;t<a;t++){const r=this._index[t];o(this._values[t],[r,e],n)}else{const t={};for(let e=i;e<a;e++)t[this._index[e]]=this._values[e];for(let i=0;i<r;i++)o(i in t?t[i]:0,[i,e],n)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");const e=this._size[1];for(let t=0;t<e;t++){const e=this._ptr[t],n=this._ptr[t+1];for(let r=e;r<n;r++){const e=this._index[r];yield{value:this._values[r],index:[e,t]}}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){const t=this._size[0],n=this._size[1],r=this.density();let i="Sparse Matrix ["+pr(t,e)+" x "+pr(n,e)+"] density: "+pr(r,e)+"\n";for(let t=0;t<n;t++){const n=this._ptr[t],r=this._ptr[t+1];for(let o=n;o<r;o++)i+="\n ("+pr(this._index[o],e)+", "+pr(t,e)+") ==> "+(this._values?pr(this._values[o],e):"X")}return i},i.prototype.toString=function(){return pr(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(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,n=e<0?-e:0,r=this._size[0],o=this._size[1],a=Math.min(r-n,o-t),s=[],u=[],c=[];c[0]=0;for(let e=t;e<o&&s.length<a;e++){const r=this._ptr[e],i=this._ptr[e+1];for(let o=r;o<i;o++){const r=this._index[o];if(r===e-t+n){s.push(this._values[o]),u[s.length-1]=r-n;break}}}return c.push(s.length),new i({values:s,index:u,ptr:c,size:[a,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,r,o,a,s){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),o){if(g(o)&&(o=o.toNumber()),!d(o)||!ye(o))throw new TypeError("The parameter k must be an integer number")}else o=0;let u=n,c=0;w(s)&&(u=t.find(n,[s,s])||n,c=t.convert(0,s));const l=o>0?o:0,f=o<0?-o:0,p=e[0],m=e[1],h=Math.min(p-f,m-l);let y;if(N(r)){if(r.length!==h)throw new Error("Invalid value array length");y=function(e){return r[e]}}else if(E(r)){const e=r.size();if(1!==e.length||e[0]!==h)throw new Error("Invalid matrix length");y=function(e){return r.get([e])}}else y=function(){return r};const x=[],b=[],v=[];for(let e=0;e<m;e++){v.push(x.length);const t=e-l;if(t>=0&&t<h){const e=y(t);u(e,c)||(b.push(t+f),x.push(e))}}return v.push(x.length),new i({values:x,index:b,ptr:v,size:[p,m]})},i.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return Ar(e,this._size[0]),Ar(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,n,r,i){const o=r[e],a=r[e+1];for(let e=o;e<a;e++)i(n[e],t[e])},i._swapRows=function(e,t,n,r,i,o){for(let s=0;s<n;s++){const n=o[s],u=o[s+1],c=a(e,n,u,i),l=a(t,n,u,i);if(c<u&&l<u&&i[c]===e&&i[l]===t){if(r){const e=r[c];r[c]=r[l],r[l]=e}}else if(c<u&&i[c]===e&&(l>=u||i[l]!==t)){const e=r?r[c]:void 0;i.splice(l,0,t),r&&r.splice(l,0,e),i.splice(l<=c?c+1:c,1),r&&r.splice(l<=c?c+1:c,1)}else if(l<u&&i[l]===t&&(c>=u||i[c]!==e)){const t=r?r[l]:void 0;i.splice(c,0,e),r&&r.splice(c,0,t),i.splice(c<=l?l+1:l,1),r&&r.splice(c<=l?l+1:l,1)}}},i}),{isClass:!0})),_i=he("number",["typed"],(e=>{let{typed:t}=e;const n=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;const t=function(e){const t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);return t?{input:e,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null}(e);if(t)return function(e){const t=parseInt(e.integerPart,e.radix);let n=0;for(let t=0;t<e.fractionalPart.length;t++)n+=parseInt(e.fractionalPart[t],e.radix)/Math.pow(e.radix,t+1);const r=t+n;if(isNaN(r))throw new SyntaxError('String "'+e.input+'" is not a valid number');return r}(t);let n=0;const r=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);r&&(n=Number(r[2]),e=r[1]);let i=Number(e);if(isNaN(i))throw new SyntaxError('String "'+e+'" is not a valid number');if(r){if(i>2**n-1)throw new SyntaxError(`String "${e}" is out of range`);i>=2**(n-1)&&(i-=2**n)}return i},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))});return n.fromJSON=function(e){return parseFloat(e.value)},n})),Ii=he("bigint",["typed"],(e=>{let{typed:t}=e;const n=t("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":t.referToSelf((e=>t=>ii(t,e)))});return n.fromJSON=function(e){return BigInt(e.value)},n})),zi="string",ki=he(zi,["typed"],(e=>{let{typed:t}=e;return t(zi,{"":function(){return""},number:Me,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e))),any:function(e){return String(e)}})})),Ri="boolean",qi=he(Ri,["typed"],(e=>{let{typed:t}=e;return t(Ri,{"":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){const t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;const n=Number(e);if(""!==e&&!isNaN(n))return!!n;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Pi=he("bignumber",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("bignumber",{"":function(){return new n(0)},number:function(e){return new n(e+"")},string:function(e){const t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){const r=t[2],i=n(t[1]),o=new n(2).pow(Number(r));if(i.gt(o.sub(1)))throw new SyntaxError(`String "${e}" is out of range`);const a=new n(2).pow(Number(r)-1);return i.gte(a)?i.sub(o):i}return new n(e)},BigNumber:function(e){return e},bigint:function(e){return new n(e.toString())},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),Fraction:function(e){return new n(String(e.n)).div(String(e.d)).times(String(e.s))},null:function(e){return new n(0)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ji=he("complex",["typed","Complex"],(e=>{let{typed:t,Complex:n}=e;return t("complex",{"":function(){return n.ZERO},number:function(e){return new n(e,0)},"number, number":function(e,t){return new n(e,t)},"BigNumber, BigNumber":function(e,t){return new n(e.toNumber(),t.toNumber())},Fraction:function(e){return new n(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return n(e)},null:function(e){return n(0)},Object:function(e){if("re"in e&&"im"in e)return new n(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new n(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ui=he("fraction",["typed","Fraction"],(e=>{let{typed:t,Fraction:n}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new n(e)},string:function(e){return new n(e)},"number, number":function(e,t){return new n(e,t)},"bigint, bigint":function(e,t){return new n(e,t)},null:function(e){return new n(0)},BigNumber:function(e){return new n(e.toString())},bigint:function(e){return new n(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf((e=>t=>{const n=t.clone();return n.value=e(t.value),n})),Object:function(e){return new n(e)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Li="matrix",$i=he(Li,["typed","Matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,Matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(Li,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,n){if("dense"===t||"default"===t||void 0===t)return new r(e,n);if("sparse"===t)return new i(e,n);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})),Hi="matrixFromFunction",Gi=he(Hi,["typed","matrix","isZero"],(e=>{let{typed:t,matrix:n,isZero:r}=e;return t(Hi,{"Array | Matrix, function, string, string":function(e,t,n,r){return i(e,t,n,r)},"Array | Matrix, function, string":function(e,t,n){return i(e,t,n)},"Matrix, function":function(e,t){return i(e,t,"dense")},"Array, function":function(e,t){return i(e,t,"dense").toArray()},"Array | Matrix, string, function":function(e,t,n){return i(e,n,t)},"Array | Matrix, string, string, function":function(e,t,n,r){return i(e,r,t,n)}});function i(e,t,i,o){let a;return a=void 0!==o?n(i,o):n(i),a.resize(e),a.forEach((function(e,n){const i=t(n);r(i)||a.set(n,i)})),a}})),Vi="matrixFromRows",Zi=he(Vi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:n,flatten:r,size:i}=e;return t(Vi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return n(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");const t=a(e[0]),n=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));n.push(r(i))}return n}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Wi="matrixFromColumns",Yi=he(Wi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:n,flatten:r,size:i}=e;return t(Wi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return n(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");const t=a(e[0]),n=[];for(let e=0;e<t;e++)n[e]=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));const o=r(i);for(let e=0;e<t;e++)n[e].push(o[e])}return n}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Ji="splitUnit",Xi=he(Ji,["typed"],(e=>{let{typed:t}=e;return t(Ji,{"Unit, Array":function(e,t){return e.splitUnit(t)}})})),Qi="number",Ki="number, number";function eo(e){return Math.abs(e)}function to(e,t){return e+t}function no(e,t){return e-t}function ro(e,t){return e*t}function io(e){return-e}function oo(e){return e}function ao(e){return Ee(e)}function so(e){return e*e*e}function uo(e){return Math.exp(e)}function co(e){return Ae(e)}function lo(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;let n;const r=e*t;for(;0!==t;)n=t,t=e%n,e=n;return Math.abs(r/e)}function fo(e,t){return t?Math.log(e)/Math.log(t):Math.log(e)}function po(e){return we(e)}function mo(e){return ve(e)}function ho(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const n=t<0;if(n&&(t=-t),0===t)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return n?1/0:0;if(!isFinite(e))return n?0:e;let r=Math.pow(Math.abs(e),1/t);return r=e<0?-r:r,n?1/r:r}function go(e){return be(e)}function yo(e){return e*e}function xo(e,t){let n,r,i,o,a=0,s=1,u=1,c=0;if(!ye(e)||!ye(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)r=Math.floor(e/t),i=e-r*t,n=a,a=s-r*a,s=n,n=u,u=c-r*u,c=n,e=t,t=i;return o=e<0?[-e,-s,-c]:[e,e?s:0,c],o}function bo(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function vo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ye(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(Be(e,t))}eo.signature=Qi,to.signature=Ki,no.signature=Ki,ro.signature=Ki,io.signature=Qi,oo.signature=Qi,ao.signature=Qi,so.signature=Qi,uo.signature=Qi,co.signature=Qi,lo.signature=Ki,po.signature=Qi,mo.signature=Qi,go.signature=Qi,yo.signature=Qi,xo.signature=Ki,bo.signature=Ki;const wo="unaryMinus",No=he(wo,["typed"],(e=>{let{typed:t}=e;return t(wo,{number:io,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:t.referToSelf((e=>n=>{const r=n.clone();return r.value=t.find(e,r.valueType())(n.value),r})),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0)))})})),Eo="unaryPlus",Ao=he(Eo,["typed","config","numeric"],(e=>{let{typed:t,config:n,numeric:r}=e;return t(Eo,{number:oo,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":t.referToSelf((e=>t=>ii(t,e,!0))),boolean:function(e){return r(e?1:0,n.number)},string:function(e){return r(e,xe(e,n))}})})),So=he("abs",["typed"],(e=>{let{typed:t}=e;return t("abs",{number:eo,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0)))})})),Mo="mapSlices",Co=he(Mo,["typed","isInteger"],(e=>{let{typed:t,isInteger:n}=e;return t(Mo,{"Array | Matrix, number | BigNumber, function":function(e,t,r){if(!n(t))throw new TypeError("Integer number expected for dimension");const i=Array.isArray(e)?vr(e):e.size();if(t<0||t>=i.length)throw new br(t,i.length);return E(e)?e.create(To(e.valueOf(),t,r),e.datatype()):To(e,t,r)}})}),{formerly:"apply"});function To(e,t,n){let r,i,o;if(t<=0){if(Array.isArray(e[0])){for(o=function(e){const t=e.length,n=e[0].length;let r,i;const o=[];for(i=0;i<n;i++){const n=[];for(r=0;r<t;r++)n.push(e[r][i]);o.push(n)}return o}(e),i=[],r=0;r<o.length;r++)i[r]=To(o[r],t-1,n);return i}return n(e)}for(i=[],r=0;r<e.length;r++)i[r]=To(e[r],t-1,n);return i}const Bo="addScalar",Do=he(Bo,["typed"],(e=>{let{typed:t}=e;return t(Bo,{"number, number":to,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"bigint, bigint":function(e,t){return e+t},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(null===n.value||void 0===n.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(r))throw new Error("Units do not match");const i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i}))})})),Fo="subtractScalar",Oo=he(Fo,["typed"],(e=>{let{typed:t}=e;return t(Fo,{"number, number":no,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"bigint, bigint":function(e,t){return e-t},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf((e=>(n,r)=>{if(null===n.value||void 0===n.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(r))throw new Error("Units do not match");const i=n.clone();return i.value=t.find(e,[i.valueType(),r.valueType()])(i.value,r.value),i.fixPrefix=!1,i}))})})),_o="cbrt",Io=he(_o,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],(e=>{let{config:t,typed:n,isNegative:r,unaryMinus:i,matrix:o,Complex:a,BigNumber:s,Fraction:u}=e;return n(_o,{number:ao,Complex:c,"Complex, boolean":c,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&x(e.value)){let t=e.clone();return t.value=1,t=t.pow(1/3),t.value=c(e.value),t}{const t=r(e.value);let n;t&&(e.value=i(e.value)),n=g(e.value)?new s(1).div(3):b(e.value)?new u(1,3):1/3;const o=e.pow(n);return t&&(o.value=i(o.value)),o}}});function c(e,n){const r=e.arg()/3,i=e.abs(),s=new a(ao(i),0).mul(new a(0,r).exp());if(n){const e=[s,new a(ao(i),0).mul(new a(0,r+2*Math.PI/3).exp()),new a(ao(i),0).mul(new a(0,r-2*Math.PI/3).exp())];return"Array"===t.matrix?e:o(e)}return s}})),zo=he("matAlgo11xS0s",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=n,d=0,g=i;"string"==typeof l&&(m=l,h=t.find(n,[m,m]),d=t.convert(0,m),r=t.convert(r,m),g=t.find(i,[m,m]));const y=[],x=[],b=[];for(let e=0;e<p;e++){b[e]=x.length;for(let t=u[e],n=u[e+1],i=t;i<n;i++){const e=s[i],t=o?g(r,a[i]):g(a[i],r);h(t,d)||(x.push(e),y.push(t))}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:m})}})),ko=he("matAlgo12xSfs",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,r=t.convert(r,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let n=u[e],r=u[e+1],i=n;i<r;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let n=0;n<f;n++)0===e&&(d[n]=[]),y[n]===t?d[n][e]=o?h(r,g[n]):h(g[n],r):d[n][e]=o?h(r,0):h(0,r)}return new n({data:d,size:[f,p],datatype:m})}})),Ro=he("matAlgo14xDs",["typed"],(e=>{let{typed:t}=e;return function(e,r,i,o){const a=e._data,s=e._size,u=e._datatype;let c,l=i;"string"==typeof u&&(c=u,r=t.convert(r,c),l=t.find(i,[c,c]));const f=s.length>0?n(l,0,s,s[0],a,r,o):[];return e.createDenseMatrix({data:f,size:ae(s),datatype:c})};function n(e,t,r,i,o,a,s){const u=[];if(t===r.length-1)for(let t=0;t<i;t++)u[t]=s?e(a,o[t]):e(o[t],a);else for(let c=0;c<i;c++)u[c]=n(e,t+1,r,r[t+1],o[c],a,s);return u}})),qo="ceil",Po=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],jo=new Fn(10),Uo=he(qo,["typed","config","round"],(e=>{let{typed:t,config:n,round:r}=e;function i(e){const t=Math.ceil(e),i=r(e);return t===i?t:_e(e,i,n.relTol,n.absTol)&&!_e(e,t,n.relTol,n.absTol)?i:t}return t(qo,{number:i,"number, number":function(e,t){if(!ye(t))throw new RangeError("number of decimals in function ceil must be an integer");if(t<0||t>15)throw new RangeError("number of decimals in ceil number must be in range 0-15");const n=10**t;return i(e*n)/n}})})),Lo=he(qo,Po,(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=zo({typed:t,equalScalar:o}),c=ko({typed:t,DenseMatrix:s}),l=Ro({typed:t}),f=Uo({typed:t,config:n,round:r});function p(e){const t=(e,t)=>hi(e,t,n.relTol,n.absTol),i=e.ceil(),o=r(e);return i.eq(o)?i:t(e,o)&&!t(e,i)?o:i}return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:p,"BigNumber, BigNumber":function(e,t){const n=jo.pow(t);return p(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>ii(t,(t=>e(t,n)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(i(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>o(t,0)?a(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),$o="cube",Ho=he($o,["typed"],(e=>{let{typed:t}=e;return t($o,{number:so,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)}})})),Go=he("exp",["typed"],(e=>{let{typed:t}=e;return t("exp",{number:uo,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),Vo="expm1",Zo=he(Vo,["typed","Complex"],(e=>{let{typed:t,Complex:n}=e;return t(Vo,{number:co,Complex:function(e){const t=Math.exp(e.re);return new n(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),Wo="fix",Yo=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],Jo=he(Wo,["typed","ceil","floor"],(e=>{let{typed:t,ceil:n,floor:r}=e;return t(Wo,{number:function(e){return e>0?r(e):n(e)},"number, number":function(e,t){return e>0?r(e,t):n(e,t)}})})),Xo=he(Wo,Yo,(e=>{let{typed:t,Complex:n,matrix:r,ceil:i,floor:o,equalScalar:a,zeros:s,DenseMatrix:u}=e;const c=ko({typed:t,DenseMatrix:u}),l=Ro({typed:t}),f=Jo({typed:t,ceil:i,floor:o});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new n(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,t){return new n(e.re>0?o(e.re,t):i(e.re,t),e.im>0?o(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){const r=t.toNumber();return new n(e.re>0?o(e.re,r):i(e.re,r),e.im>0?o(e.im,r):i(e.im,r))},BigNumber:function(e){return e.isNegative()?i(e):o(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):o(e,t)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.s<0n?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0n?i(e,t):o(e,t)},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array | Matrix, number | BigNumber":t.referToSelf((e=>(t,n)=>ii(t,(t=>e(t,n)),!0))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(r(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>a(t,0)?s(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),Qo="floor",Ko=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],ea=new Fn(10),ta=he(Qo,["typed","config","round"],(e=>{let{typed:t,config:n,round:r}=e;function i(e){const t=Math.floor(e),i=r(e);return t===i?t:_e(e,i,n.relTol,n.absTol)&&!_e(e,t,n.relTol,n.absTol)?i:t}return t(Qo,{number:i,"number, number":function(e,t){if(!ye(t))throw new RangeError("number of decimals in function floor must be an integer");if(t<0||t>15)throw new RangeError("number of decimals in floor number must be in range 0 - 15");const n=10**t;return i(e*n)/n}})})),na=he(Qo,Ko,(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=zo({typed:t,equalScalar:o}),c=ko({typed:t,DenseMatrix:s}),l=Ro({typed:t}),f=ta({typed:t,config:n,round:r});function p(e){const t=(e,t)=>hi(e,t,n.relTol,n.absTol),i=e.floor(),o=r(e);return i.eq(o)?i:t(e,o)&&!t(e,i)?o:i}return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:p,"BigNumber, BigNumber":function(e,t){const n=ea.pow(t);return p(e.mul(n)).div(n)},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>ii(t,(t=>e(t,n)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,n)=>l(i(n),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,n)=>o(t,0)?a(n.size(),n.storage()):"dense"===n.storage()?l(n,t,e,!0):c(n,t,e,!0)))})})),ra=he("matAlgo02xDS0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i,o){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=r._values,l=r._index,f=r._ptr,p=r._size,m=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(s.length!==p.length)throw new xr(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const h=s[0],d=s[1];let g,y=n,x=0,b=i;"string"==typeof u&&u===m&&"mixed"!==u&&(g=u,y=t.find(n,[g,g]),x=t.convert(0,g),b=t.find(i,[g,g]));const v=[],w=[],N=[];for(let e=0;e<d;e++){N[e]=w.length;for(let t=f[e],n=f[e+1],r=t;r<n;r++){const t=l[r],n=o?b(c[r],a[t][e]):b(a[t][e],c[r]);y(n,x)||(w.push(t),v.push(n))}}return N[d]=w.length,r.createSparseMatrix({values:v,index:w,ptr:N,size:[h,d],datatype:u===e._datatype&&m===r._datatype?g:void 0})}})),ia=he("matAlgo03xDSf",["typed"],(e=>{let{typed:t}=e;return function(e,n,r,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._values,c=n._index,l=n._ptr,f=n._size,p=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==f.length)throw new xr(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1];let d,g=0,y=r;"string"==typeof s&&s===p&&"mixed"!==s&&(d=s,g=t.convert(0,d),y=t.find(r,[d,d]));const x=[];for(let e=0;e<m;e++)x[e]=[];const b=[],v=[];for(let e=0;e<h;e++){const t=e+1;for(let n=l[e],r=l[e+1],a=n;a<r;a++){const n=c[a];b[n]=i?y(u[a],o[n][e]):y(o[n][e],u[a]),v[n]=t}for(let n=0;n<m;n++)v[n]===t?x[n][e]=b[n]:x[n][e]=i?y(g,o[n][e]):y(o[n][e],g)}return e.createDenseMatrix({data:x,size:[m,h],datatype:s===e._datatype&&p===n._datatype?d:void 0})}})),oa=he("matAlgo05xSfSf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=w?[]:void 0,M=[],C=[];let T,B,D,F;for(B=0;B<g;B++){E[B]=N.length;const e=B+1;for(D=s[B],F=s[B+1];D<F;D++)T=a[D],N.push(T),M[T]=e,A&&(A[T]=o[D]);for(D=p[B],F=p[B+1];D<F;D++)T=f[D],M[T]!==e&&N.push(T),C[T]=e,S&&(S[T]=l[D]);if(w)for(D=E[B];D<N.length;){T=N[D];const t=M[T],n=C[T];if(t===e||n===e){const r=v(t===e?A[T]:b,n===e?S[T]:b);x(r,b)?N.splice(D,1):(w.push(r),D++)}}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),aa=he("matAlgo13xDD",["typed"],(e=>{let{typed:t}=e;return function(e,r,i){const o=e._data,a=e._size,s=e._datatype,u=r._data,c=r._size,l=r._datatype,f=[];if(a.length!==c.length)throw new xr(a.length,c.length);for(let e=0;e<a.length;e++){if(a[e]!==c[e])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");f[e]=a[e]}let p,m=i;"string"==typeof s&&s===l&&(p=s,m=t.find(i,[p,p]));const h=f.length>0?n(m,0,f,f[0],o,u):[];return e.createDenseMatrix({data:h,size:f,datatype:p})};function n(e,t,r,i,o,a){const s=[];if(t===r.length-1)for(let t=0;t<i;t++)s[t]=e(o[t],a[t]);else for(let u=0;u<i;u++)s[u]=n(e,t+1,r,r[t+1],o[u],a[u]);return s}}));function sa(e,t){if(ce(e.size(),t.size()))return[e,t];const n=Gr(e.size(),t.size());return[e,t].map((e=>function(e,t){return ce(e.size(),t)?e:e.create(Zr(e.valueOf(),t),e.datatype())}(e,n)))}const ua=he("matrixAlgorithmSuite",["typed","matrix"],(e=>{let{typed:t,matrix:n}=e;const r=aa({typed:t}),i=Ro({typed:t});return function(e){const o=e.elop,a=e.SD||e.DS;let s;o?(s={"DenseMatrix, DenseMatrix":(e,t)=>r(...sa(e,t),o),"Array, Array":(e,t)=>r(...sa(n(e),n(t)),o).valueOf(),"Array, DenseMatrix":(e,t)=>r(...sa(n(e),t),o),"DenseMatrix, Array":(e,t)=>r(...sa(e,n(t)),o)},e.SS&&(s["SparseMatrix, SparseMatrix"]=(t,n)=>e.SS(...sa(t,n),o,!1)),e.DS&&(s["DenseMatrix, SparseMatrix"]=(t,n)=>e.DS(...sa(t,n),o,!1),s["Array, SparseMatrix"]=(t,r)=>e.DS(...sa(n(t),r),o,!1)),a&&(s["SparseMatrix, DenseMatrix"]=(e,t)=>a(...sa(t,e),o,!0),s["SparseMatrix, Array"]=(e,t)=>a(...sa(n(t),e),o,!0))):(s={"DenseMatrix, DenseMatrix":t.referToSelf((e=>(t,n)=>r(...sa(t,n),e))),"Array, Array":t.referToSelf((e=>(t,i)=>r(...sa(n(t),n(i)),e).valueOf())),"Array, DenseMatrix":t.referToSelf((e=>(t,i)=>r(...sa(n(t),i),e))),"DenseMatrix, Array":t.referToSelf((e=>(t,i)=>r(...sa(t,n(i)),e)))},e.SS&&(s["SparseMatrix, SparseMatrix"]=t.referToSelf((t=>(n,r)=>e.SS(...sa(n,r),t,!1)))),e.DS&&(s["DenseMatrix, SparseMatrix"]=t.referToSelf((t=>(n,r)=>e.DS(...sa(n,r),t,!1))),s["Array, SparseMatrix"]=t.referToSelf((t=>(r,i)=>e.DS(...sa(n(r),i),t,!1)))),a&&(s["SparseMatrix, DenseMatrix"]=t.referToSelf((e=>(t,n)=>a(...sa(n,t),e,!0))),s["SparseMatrix, Array"]=t.referToSelf((e=>(t,r)=>a(...sa(n(r),t),e,!0)))));const u=e.scalar||"any";(e.Ds||e.Ss)&&(o?(s["DenseMatrix,"+u]=(e,t)=>i(e,t,o,!1),s[u+", DenseMatrix"]=(e,t)=>i(t,e,o,!0),s["Array,"+u]=(e,t)=>i(n(e),t,o,!1).valueOf(),s[u+", Array"]=(e,t)=>i(n(t),e,o,!0).valueOf()):(s["DenseMatrix,"+u]=t.referToSelf((e=>(t,n)=>i(t,n,e,!1))),s[u+", DenseMatrix"]=t.referToSelf((e=>(t,n)=>i(n,t,e,!0))),s["Array,"+u]=t.referToSelf((e=>(t,r)=>i(n(t),r,e,!1).valueOf())),s[u+", Array"]=t.referToSelf((e=>(t,r)=>i(n(r),t,e,!0).valueOf()))));const c=void 0!==e.sS?e.sS:e.Ss;return o?(e.Ss&&(s["SparseMatrix,"+u]=(t,n)=>e.Ss(t,n,o,!1)),c&&(s[u+", SparseMatrix"]=(e,t)=>c(t,e,o,!0))):(e.Ss&&(s["SparseMatrix,"+u]=t.referToSelf((t=>(n,r)=>e.Ss(n,r,t,!1)))),c&&(s[u+", SparseMatrix"]=t.referToSelf((e=>(t,n)=>c(n,t,e,!0))))),o&&o.signatures&&se(s,o.signatures),s}})),ca=he("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s,concat:u}=e;const c=na({typed:t,config:n,round:r,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}),l=ra({typed:t,equalScalar:o}),f=ia({typed:t}),p=oa({typed:t,equalScalar:o}),m=zo({typed:t,equalScalar:o}),h=ko({typed:t,DenseMatrix:s});return t("mod",{"number, number":function(e,t){return 0===t?e:e-t*c(e/t)},"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(c(e.div(t))))},"bigint, bigint":function(e,t){if(0n===t)return e;if(e<0){const n=e%t;return 0n===n?n:n+t}return e%t},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(c(e.div(t))))}},ua({typed:t,matrix:i,concat:u})({SS:p,DS:f,SD:l,Ss:m,sS:h}))})),la=he("matAlgo01xDSid",["typed"],(e=>{let{typed:t}=e;return function(e,n,r,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._values,c=n._index,l=n._ptr,f=n._size,p=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==f.length)throw new xr(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1],d="string"==typeof s&&"mixed"!==s&&s===p?s:void 0,g=d?t.find(r,[d,d]):r;let y,x;const b=[];for(y=0;y<m;y++)b[y]=[];const v=[],w=[];for(x=0;x<h;x++){const e=x+1;for(let t=l[x],n=l[x+1],r=t;r<n;r++)y=c[r],v[y]=i?g(u[r],o[y][x]):g(o[y][x],u[r]),w[y]=e;for(y=0;y<m;y++)w[y]===e?b[y][x]=v[y]:b[y][x]=o[y][x]}return e.createDenseMatrix({data:b,size:[m,h],datatype:s===e._datatype&&p===n._datatype?d:void 0})}})),fa=he("matAlgo04xSidSid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=o&&l?[]:void 0,S=o&&l?[]:void 0,M=[],C=[];let T,B,D,F,O;for(B=0;B<g;B++){E[B]=N.length;const e=B+1;for(F=s[B],O=s[B+1],D=F;D<O;D++)T=a[D],N.push(T),M[T]=e,A&&(A[T]=o[D]);for(F=p[B],O=p[B+1],D=F;D<O;D++)if(T=f[D],M[T]===e){if(A){const e=v(A[T],l[D]);x(e,b)?M[T]=null:A[T]=e}}else N.push(T),C[T]=e,S&&(S[T]=l[D]);if(A&&S)for(D=E[B];D<N.length;)T=N[D],M[T]===e?(w[D]=A[T],D++):C[T]===e?(w[D]=S[T],D++):N.splice(D,1)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),pa=he("matAlgo10xSids",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:n}=e;return function(e,r,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,r=t.convert(r,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let n=u[e],r=u[e+1],i=n;i<r;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let n=0;n<f;n++)0===e&&(d[n]=[]),y[n]===t?d[n][e]=o?h(r,g[n]):h(g[n],r):d[n][e]=r}return new n({data:d,size:[f,p],datatype:m})}}));function ma(e,t,n,r){if(!(this instanceof ma))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=n,this.max=r,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+n+(null!=r?"-"+r:"")+" expected)",this.stack=(new Error).stack}ma.prototype=new Error,ma.prototype.constructor=Error,ma.prototype.name="ArgumentsError",ma.prototype.isArgumentsError=!0;const ha="number | BigNumber | Fraction | Matrix | Array",da=`${ha}, ${ha}, ...${ha}`;function ga(e){return!e.some((e=>Array.isArray(e)))}const ya=he("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,config:r,round:i,equalScalar:o,zeros:a,BigNumber:s,DenseMatrix:u,concat:c}=e;const l=ca({typed:t,config:r,round:i,matrix:n,equalScalar:o,zeros:a,DenseMatrix:u,concat:c}),f=la({typed:t}),p=fa({typed:t,equalScalar:o}),m=pa({typed:t,DenseMatrix:u});return t("gcd",{"number, number":function(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function gcd must be integer numbers");let n;for(;0!==t;)n=l(e,t),e=t,t=n;return e<0?-e:e},"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");const n=new s(0);for(;!t.isZero();){const n=l(e,t);e=t,t=n}return e.lt(n)?e.neg():e},"Fraction, Fraction":(e,t)=>e.gcd(t)},ua({typed:t,matrix:n,concat:c})({SS:p,DS:f,Ss:m}),{[da]:t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i})),Array:t.referToSelf((e=>t=>{if(1===t.length&&Array.isArray(t[0])&&ga(t[0]))return e(...t[0]);if(ga(t))return e(...t);throw new ma("gcd() supports only 1d matrices!")})),Matrix:t.referToSelf((e=>t=>e(t.toArray())))})})),xa=he("matAlgo06xS0S0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=r._values,c=r._size,l=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(a.length!==c.length)throw new xr(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");const f=a[0],p=a[1];let m,h=n,d=0,g=i;"string"==typeof s&&s===l&&"mixed"!==s&&(m=s,h=t.find(n,[m,m]),d=t.convert(0,m),g=t.find(i,[m,m]));const y=o&&u?[]:void 0,x=[],b=[],v=y?[]:void 0,w=[],N=[];for(let t=0;t<p;t++){b[t]=x.length;const n=t+1;if(si(e,t,w,v,N,n,x,g),si(r,t,w,v,N,n,x,g),v){let e=b[t];for(;e<x.length;){const t=x[e];if(N[t]===n){const n=v[t];h(n,d)?x.splice(e,1):(y.push(n),e++)}else x.splice(e,1)}}else{let e=b[t];for(;e<x.length;)N[x[e]]!==n?x.splice(e,1):e++}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:s===e._datatype&&l===r._datatype?m:void 0})}})),ba=he("lcm",["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,concat:i}=e;const o=ra({typed:t,equalScalar:r}),a=xa({typed:t,equalScalar:r}),s=zo({typed:t,equalScalar:r}),u=ua({typed:t,matrix:n,concat:i}),c="number | BigNumber | Fraction | Matrix | Array",l={};return l[`${c}, ${c}, ...${c}`]=t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i})),t("lcm",{"number, number":lo,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(t.isZero())return t;const n=e.times(t);for(;!t.isZero();){const n=t;t=e.mod(n),e=n}return n.div(e).abs()},"Fraction, Fraction":(e,t)=>e.lcm(t)},u({SS:a,DS:o,Ss:s}),l)}));function va(e,t,n,r){return function(i){if(i>0||n.predictable){if(i<=0)return NaN;const n=i.toString(16),r=n.substring(0,15);return e*(n.length-r.length)+t(Number("0x"+r))}return r(i.toNumber())}}const wa="log10",Na=["typed","config","Complex"],Ea=po(16),Aa=he(wa,Na,(e=>{let{typed:t,config:n,Complex:r}=e;function i(e){return e.log().div(Math.LN10)}function o(e){return i(new r(e,0))}return t(wa,{number:function(e){return e>=0||n.predictable?po(e):o(e)},bigint:va(Ea,po,n,o),Complex:i,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log():o(e.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Sa="log2",Ma=he(Sa,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;function i(e){return o(new r(e,0))}return t(Sa,{number:function(e){return e>=0||n.predictable?mo(e):i(e)},bigint:va(4,mo,n,i),Complex:o,BigNumber:function(e){return!e.isNegative()||n.predictable?e.log(2):i(e.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))});function o(e){const t=Math.sqrt(e.re*e.re+e.im*e.im);return new r(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),Ca=he("multiplyScalar",["typed"],(e=>{let{typed:t}=e;return t("multiplyScalar",{"number, number":ro,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"bigint, bigint":function(e,t){return e*t},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})})),Ta="multiply",Ba=he(Ta,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(e=>{let{typed:t,matrix:n,addScalar:r,multiplyScalar:i,equalScalar:o,dot:a}=e;const s=zo({typed:t,equalScalar:o}),u=Ro({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}const l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._datatype||n.getDataType(),l=a[0],f=a[1];let p,m=r,h=i;s&&c&&s===c&&"string"==typeof s&&"mixed"!==s&&(p=s,m=t.find(r,[p,p]),h=t.find(i,[p,p]));const d=[];for(let e=0;e<l;e++){const t=o[e];let n=h(t[0],u[0]);for(let e=1;e<f;e++)n=m(n,h(t[e],u[e]));d[e]=n}return e.createDenseMatrix({data:d,size:[l],datatype:s===e._datatype&&c===n._datatype?p:void 0})},"SparseMatrix, any":function(e,n){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=n._data,f=n._datatype||n.getDataType(),p=e._size[0],m=n._size[0],h=[],d=[],g=[];let y,x=r,b=i,v=o,w=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.find(i,[y,y]),v=t.find(o,[y,y]),w=t.convert(0,y));const N=[],E=[];g[0]=0;for(let e=0;e<m;e++){const t=l[e];if(!v(t,w))for(let n=u[e],r=u[e+1],i=n;i<r;i++){const e=s[i];E[e]?N[e]=x(N[e],b(t,a[i])):(E[e]=!0,d.push(e),N[e]=b(t,a[i]))}}for(let e=d.length,t=0;t<e;t++){const e=d[t];h[t]=N[e]}return g[1]=d.length,e.createSparseMatrix({values:h,index:d,ptr:g,size:[p,1],datatype:c===e._datatype&&f===n._datatype?y:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._size,l=n._datatype||n.getDataType(),f=a[0],p=a[1],m=c[1];let h,d=r,g=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&"mixed"!==s&&(h=s,d=t.find(r,[h,h]),g=t.find(i,[h,h]));const y=[];for(let e=0;e<f;e++){const t=o[e];y[e]=[];for(let n=0;n<m;n++){let r=g(t[0],u[0][n]);for(let e=1;e<p;e++)r=d(r,g(t[e],u[e][n]));y[e][n]=r}}return e.createDenseMatrix({data:y,size:[f,m],datatype:s===e._datatype&&l===n._datatype?h:void 0})},"DenseMatrix, SparseMatrix":function(e,n){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=n._values,l=n._index,f=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");const h=s[0],d=p[1];let g,y=r,x=i,b=o,v=0;u&&m&&u===m&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(r,[g,g]),x=t.find(i,[g,g]),b=t.find(o,[g,g]),v=t.convert(0,g));const w=[],N=[],E=[],A=n.createSparseMatrix({values:w,index:N,ptr:E,size:[h,d],datatype:u===e._datatype&&m===n._datatype?g:void 0});for(let e=0;e<d;e++){E[e]=N.length;const t=f[e],n=f[e+1];if(n>t){let e=0;for(let r=0;r<h;r++){const i=r+1;let o;for(let s=t;s<n;s++){const t=l[s];e!==i?(o=x(a[r][t],c[s]),e=i):o=y(o,x(a[r][t],c[s]))}e!==i||b(o,v)||(N.push(r),w.push(o))}}}return E[d]=N.length,A},"SparseMatrix, DenseMatrix":function(e,n){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=n._data,f=n._datatype||n.getDataType(),p=e._size[0],m=n._size[0],h=n._size[1];let d,g=r,y=i,x=o,b=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(d=c,g=t.find(r,[d,d]),y=t.find(i,[d,d]),x=t.find(o,[d,d]),b=t.convert(0,d));const v=[],w=[],N=[],E=e.createSparseMatrix({values:v,index:w,ptr:N,size:[p,h],datatype:c===e._datatype&&f===n._datatype?d:void 0}),A=[],S=[];for(let e=0;e<h;e++){N[e]=w.length;const t=e+1;for(let n=0;n<m;n++){const r=l[n][e];if(!x(r,b))for(let e=u[n],i=u[n+1],o=e;o<i;o++){const e=s[o];S[e]!==t?(S[e]=t,w.push(e),A[e]=y(r,a[o])):A[e]=g(A[e],y(r,a[o]))}}for(let t=N[e],n=w.length,r=t;r<n;r++){const e=w[r];v[r]=A[e]}}return N[h]=w.length,E},"SparseMatrix, SparseMatrix":function(e,n){const o=e._values,a=e._index,s=e._ptr,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=n._values,l=n._index,f=n._ptr,p=n._datatype||void 0===n._data?n._datatype:n.getDataType(),m=e._size[0],h=n._size[1],d=o&&c;let g,y=r,x=i;u&&p&&u===p&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(r,[g,g]),x=t.find(i,[g,g]));const b=d?[]:void 0,v=[],w=[],N=e.createSparseMatrix({values:b,index:v,ptr:w,size:[m,h],datatype:u===e._datatype&&p===n._datatype?g:void 0}),E=d?[]:void 0,A=[];let S,M,C,T,B,D,F,O;for(let e=0;e<h;e++){w[e]=v.length;const t=e+1;for(B=f[e],D=f[e+1],T=B;T<D;T++)if(O=l[T],d)for(M=s[O],C=s[O+1],S=M;S<C;S++)F=a[S],A[F]!==t?(A[F]=t,v.push(F),E[F]=x(c[T],o[S])):E[F]=y(E[F],x(c[T],o[S]));else for(M=s[O],C=s[O+1],S=M;S<C;S++)F=a[S],A[F]!==t&&(A[F]=t,v.push(F));if(d)for(let t=w[e],n=v.length,r=t;r<n;r++){const e=v[r];b[r]=E[e]}}return w[h]=v.length,N}});return t(Ta,i,{"Array, Array":t.referTo("Matrix, Matrix",(e=>(t,r)=>{c(vr(t),vr(r));const i=e(n(t),n(r));return E(i)?i.valueOf():i})),"Matrix, Matrix":function(e,n){const o=e.size(),s=n.size();return c(o,s),1===o.length?1===s.length?function(e,t,n){if(0===n)throw new Error("Cannot multiply two empty vectors");return a(e,t)}(e,n,o[0]):function(e,n){if("dense"!==n.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,n){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=n._data,c=n._size,l=n._datatype||n.getDataType(),f=a[0],p=c[1];let m,h=r,d=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(m=s,h=t.find(r,[m,m]),d=t.find(i,[m,m]));const g=[];for(let e=0;e<p;e++){let t=d(o[0],u[0][e]);for(let n=1;n<f;n++)t=h(t,d(o[n],u[n][e]));g[e]=t}return e.createDenseMatrix({data:g,size:[p],datatype:s===e._datatype&&l===n._datatype?m:void 0})}(e,n)}(e,n):1===s.length?l(e,n):f(e,n)},"Matrix, Array":t.referTo("Matrix,Matrix",(e=>(t,r)=>e(t,n(r)))),"Array, Matrix":t.referToSelf((e=>(t,r)=>e(n(t,r.storage()),r))),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return u(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return u(t,e,i,!0)},"Array, any":function(e,t){return u(n(e),t,i,!1).valueOf()},"any, Array":function(e,t){return u(n(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i}))})})),Da="nthRoot",Fa=he(Da,["typed","matrix","equalScalar","BigNumber","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,BigNumber:i,concat:o}=e;const a=la({typed:t}),s=ra({typed:t,equalScalar:r}),u=xa({typed:t,equalScalar:r}),c=zo({typed:t,equalScalar:r}),l=ua({typed:t,matrix:n,concat:o});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(Da,{number:ho,"number, number":ho,BigNumber:e=>p(e,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:t.referTo("DenseMatrix,number",(e=>t=>e(n(t),2).valueOf())),DenseMatrix:t.referTo("DenseMatrix,number",(e=>t=>e(t,2))),SparseMatrix:t.referTo("SparseMatrix,number",(e=>t=>e(t,2))),"SparseMatrix, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return u(t,n,e);throw new Error("Root must be non-zero")})),"DenseMatrix, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return a(t,n,e,!1);throw new Error("Root must be non-zero")})),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",(e=>(t,r)=>e(n(t),r))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>{if(1===n.density())return c(n,t,e,!0);throw new Error("Root must be non-zero")}))},l({scalar:"number | BigNumber",SD:s,Ss:c,sS:!1}));function p(e,t){const n=i.precision,r=i.clone({precision:n+2}),o=new i(0),a=new r(1),s=t.isNegative();if(s&&(t=t.neg()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return s?new r(1/0):0;if(!e.isFinite())return s?o:e;let u=e.abs().pow(a.div(t));return u=e.isNeg()?u.neg():u,new i((s?a.div(u):u).toPrecision(n))}})),Oa="sign",_a=he(Oa,["typed","BigNumber","Fraction","complex"],(e=>{let{typed:t,BigNumber:n,complex:r,Fraction:i}=e;return t(Oa,{number:go,Complex:function(e){return 0===e.im?r(go(e.re)):e.sign()},BigNumber:function(e){return new n(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return new i(e.s)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),Unit:t.referToSelf((e=>n=>{if(!n._isDerived()&&0!==n.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return t.find(e,n.valueType())(n.value)}))})})),Ia=he("sqrt",["config","typed","Complex"],(e=>{let{config:t,typed:n,Complex:r}=e;return n("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new r(e,0).sqrt()}})),za="square",ka=he(za,["typed"],(e=>{let{typed:t}=e;return t(za,{number:yo,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)}})})),Ra="subtract",qa=he(Ra,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,subtractScalar:i,unaryMinus:o,DenseMatrix:a,concat:s}=e;const u=la({typed:t}),c=ia({typed:t}),l=oa({typed:t,equalScalar:r}),f=pa({typed:t,DenseMatrix:a}),p=ko({typed:t,DenseMatrix:a}),m=ua({typed:t,matrix:n,concat:s});return t(Ra,{"any, any":i},m({elop:i,SS:l,DS:u,SD:c,Ss:p,sS:f}))})),Pa="xgcd",ja=he(Pa,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(Pa,{"number, number":function(e,t){const i=xo(e,t);return"Array"===n.matrix?i:r(i)},"BigNumber, BigNumber":function(e,t){let o,a,s;const u=new i(0),c=new i(1);let l,f=u,p=c,m=c,h=u;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)a=e.div(t).floor(),s=e.mod(t),o=f,f=p.minus(a.times(f)),p=o,o=m,m=h.minus(a.times(m)),h=o,e=t,t=s;return l=e.lt(u)?[e.neg(),p.neg(),h.neg()]:[e,e.isZero()?0:p,h],"Array"===n.matrix?l:r(l)}})})),Ua="invmod",La=he(Ua,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(e=>{let{typed:t,config:n,BigNumber:r,xgcd:i,equal:o,smaller:a,mod:s,add:u,isInteger:c}=e;return t(Ua,{"number, number":l,"BigNumber, BigNumber":l});function l(e,t){if(!c(e)||!c(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=s(e,t),o(t,0))throw new Error("Divisor must be non zero");let n=i(e,t);n=n.valueOf();let[l,f]=n;return o(l,r(1))?(f=s(f,t),a(f,r(0))&&(f=u(f,t)),f):NaN}})),$a=he("matAlgo09xS0Sf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=[];let M,C,T,B,D;for(C=0;C<g;C++){E[C]=N.length;const e=C+1;if(A)for(B=p[C],D=p[C+1],T=B;T<D;T++)M=f[T],S[M]=e,A[M]=l[T];for(B=s[C],D=s[C+1],T=B;T<D;T++)if(M=a[T],A){const t=S[M]===e?A[M]:b,n=v(o[T],t);x(n,b)||(N.push(M),w.push(n))}else N.push(M)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),Ha="dotMultiply",Ga=he(Ha,["typed","matrix","equalScalar","multiplyScalar","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,multiplyScalar:i,concat:o}=e;const a=ra({typed:t,equalScalar:r}),s=$a({typed:t,equalScalar:r}),u=zo({typed:t,equalScalar:r}),c=ua({typed:t,matrix:n,concat:o});return t(Ha,c({elop:i,SS:s,DS:a,Ss:u}))}));function Va(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new n(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new n(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new n(0):e}return Ya(e,t,(function(e,t){return e&t}))}function Za(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");const t=e.constructor,n=t.precision;t.config({precision:1e9});const r=e.plus(new t(1));return r.s=-r.s||null,t.config({precision:n}),r}function Wa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);const r=new n(-1);return e.isZero()||t.eq(r)||e.eq(t)?t:t.isZero()||e.eq(r)?e:e.isFinite()&&t.isFinite()?Ya(e,t,(function(e,t){return e|t})):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?r:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function Ya(e,t,n){const r=e.constructor;let i,o;const a=+(e.s<0),s=+(t.s<0);if(a){i=Ja(Za(e));for(let e=0;e<i.length;++e)i[e]^=1}else i=Ja(e);if(s){o=Ja(Za(t));for(let e=0;e<o.length;++e)o[e]^=1}else o=Ja(t);let u,c,l;i.length<=o.length?(u=i,c=o,l=a):(u=o,c=i,l=s);let f=u.length,p=c.length;const m=1^n(a,s);let h=new r(1^m),d=new r(1);const g=new r(2),y=r.precision;for(r.config({precision:1e9});f>0;)n(u[--f],c[--p])===m&&(h=h.plus(d)),d=d.times(g);for(;p>0;)n(l,c[--p])===m&&(h=h.plus(d)),d=d.times(g);return r.config({precision:y}),0===m&&(h.s=-h.s),h}function Ja(e){const t=e.d;let n=t[0]+"";for(let e=1;e<t.length;++e){let r=t[e]+"";for(let e=7-r.length;e--;)r="0"+r;n+=r}let r=n.length;for(;"0"===n.charAt(r);)r--;let i=e.e,o=n.slice(0,r+1||1);const a=o.length;if(i>0)if(++i>a)for(i-=a;i--;)o+="0";else i<a&&(o=o.slice(0,i)+"."+o.slice(i));const s=[0];for(let e=0;e<o.length;){let t=s.length;for(;t--;)s[t]*=10;s[0]+=parseInt(o.charAt(e++));for(let e=0;e<s.length;++e)s[e]>1&&(null!==s[e+1]&&void 0!==s[e+1]||(s[e+1]=0),s[e+1]+=s[e]>>1,s[e]&=1)}return s.reverse()}function Xa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");const n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new n(0);const r=new n(-1);return e.eq(r)?Za(t):t.eq(r)?Za(e):e.isFinite()&&t.isFinite()?Ya(e,t,(function(e,t){return e^t})):e.isFinite()||t.isFinite()?new n(e.isNegative()===t.isNegative()?1/0:-1/0):r}function Qa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");const n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new n(2).pow(t)):new n(NaN)}function Ka(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");const n=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new n(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new n(2).pow(t)).floor():e.isNegative()?new n(-1):e.isFinite()?new n(0):new n(NaN)}const es="number, number";function ts(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitAnd");return e&t}function ns(e){if(!ye(e))throw new Error("Integer expected in function bitNot");return~e}function rs(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitOr");return e|t}function is(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitXor");return e^t}function os(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function leftShift");return e<<t}function as(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightArithShift");return e>>t}function ss(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}ts.signature=es,ns.signature="number",rs.signature=es,is.signature=es,os.signature=es,as.signature=es,ss.signature=es;const us="bitAnd",cs=he(us,["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,concat:i}=e;const o=ra({typed:t,equalScalar:r}),a=xa({typed:t,equalScalar:r}),s=zo({typed:t,equalScalar:r}),u=ua({typed:t,matrix:n,concat:i});return t(us,{"number, number":ts,"BigNumber, BigNumber":Va,"bigint, bigint":(e,t)=>e&t},u({SS:a,DS:o,Ss:s}))})),ls="bitNot",fs=he(ls,["typed"],(e=>{let{typed:t}=e;return t(ls,{number:ns,BigNumber:Za,bigint:e=>~e,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ps="bitOr",ms=he(ps,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=la({typed:t}),s=fa({typed:t,equalScalar:r}),u=pa({typed:t,DenseMatrix:i}),c=ua({typed:t,matrix:n,concat:o});return t(ps,{"number, number":rs,"BigNumber, BigNumber":Wa,"bigint, bigint":(e,t)=>e|t},c({SS:s,DS:a,Ss:u}))})),hs=he("matAlgo07xSSf",["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:n}=e;return function(e,i,o){const a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=i._size,c=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(a.length!==u.length)throw new xr(a.length,u.length);if(a[0]!==u[0]||a[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+u+")");const l=a[0],f=a[1];let p,m=0,h=o;"string"==typeof s&&s===c&&"mixed"!==s&&(p=s,m=t.convert(0,p),h=t.find(o,[p,p]));const d=[],g=[],y=new Array(f+1).fill(0),x=[],b=[],v=[],w=[];for(let t=0;t<f;t++){const n=t+1;let o=0;r(e,t,v,x,n),r(i,t,w,b,n);for(let e=0;e<l;e++){const t=h(v[e]===n?x[e]:m,w[e]===n?b[e]:m);0!==t&&!1!==t&&(g.push(e),d.push(t),o++)}y[t+1]=y[t]+o}return new n({values:d,index:g,ptr:y,size:[l,f],datatype:s===e._datatype&&c===i._datatype?p:void 0})};function r(e,t,n,r,i){const o=e._values,a=e._index,s=e._ptr;for(let e=s[t],u=s[t+1];e<u;e++){const t=a[e];n[t]=i,r[t]=o[e]}}})),ds="bitXor",gs=he(ds,["typed","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:o}=e;const a=ia({typed:t}),s=hs({typed:t,SparseMatrix:o}),u=ko({typed:t,DenseMatrix:r}),c=ua({typed:t,matrix:n,concat:i});return t(ds,{"number, number":is,"BigNumber, BigNumber":Xa,"bigint, bigint":(e,t)=>e^t},c({SS:s,DS:a,Ss:u}))})),ys=he("arg",["typed"],(e=>{let{typed:t}=e;return t("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":t.referToSelf((e=>t=>ii(t,e)))})})),xs="conj",bs=he(xs,["typed"],(e=>{let{typed:t}=e;return t(xs,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),vs=he("im",["typed"],(e=>{let{typed:t}=e;return t("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ws=he("re",["typed"],(e=>{let{typed:t}=e;return t("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ns="number, number";function Es(e){return!e}function As(e,t){return!(!e&&!t)}function Ss(e,t){return!!e!=!!t}function Ms(e,t){return!(!e||!t)}Es.signature="number",As.signature=Ns,Ss.signature=Ns,Ms.signature=Ns;const Cs=he("not",["typed"],(e=>{let{typed:t}=e;return t("not",{"null | undefined":()=>!0,number:Es,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:t.referToSelf((e=>n=>t.find(e,n.valueType())(n.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ts=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=ia({typed:t}),s=oa({typed:t,equalScalar:r}),u=ko({typed:t,DenseMatrix:i}),c=ua({typed:t,matrix:n,concat:o});return t("or",{"number, number":As,"Complex, Complex":function(e,t){return 0!==e.re||0!==e.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"bigint, bigint":As,"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0)))},c({SS:s,DS:a,Ss:u}))})),Bs=he("xor",["typed","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,concat:i,SparseMatrix:o}=e;const a=ia({typed:t}),s=hs({typed:t,SparseMatrix:o}),u=ko({typed:t,DenseMatrix:r}),c=ua({typed:t,matrix:n,concat:i});return t("xor",{"number, number":Ss,"Complex, Complex":function(e,t){return(0!==e.re||0!==e.im)!=(0!==t.re||0!==t.im)},"bigint, bigint":Ss,"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0)))},c({SS:s,DS:a,Ss:u}))})),Ds="concat",Fs=he(Ds,["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:n,isInteger:r}=e;return t(Ds,{"...Array | Matrix | number | BigNumber":function(e){let t;const i=e.length;let o,a=-1,s=!1;const u=[];for(t=0;t<i;t++){const n=e[t];if(E(n)&&(s=!0),d(n)||g(n)){if(t!==i-1)throw new Error("Dimension must be specified as last argument");if(o=a,a=n.valueOf(),!r(a))throw new TypeError("Integer number expected for dimension");if(a<0||t>0&&a>o)throw new br(a,o+1)}else{const e=ae(n).valueOf(),r=vr(e);if(u[t]=e,o=a,a=r.length-1,t>0&&a!==o)throw new xr(o+1,a+1)}}if(0===u.length)throw new SyntaxError("At least one matrix expected");let c=u.shift();for(;u.length;)c=Hr(c,u.shift(),a);return s?n(c):c},"...string":function(e){return e.join("")}})})),Os="column",_s=he(Os,["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;return t(Os,{"Matrix, number":o,"Array, number":function(e,t){return o(r(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Ar(t,e.size()[1]);const o=i(0,e.size()[0]),a=new n(o,t),s=e.subset(a);return E(s)?s:r([[s]])}})),Is="count",zs=he(Is,["typed","size","prod"],(e=>{let{typed:t,size:n,prod:r}=e;return t(Is,{string:function(e){return e.length},"Matrix | Array":function(e){return r(n(e))}})})),ks="cross",Rs=he(ks,["typed","matrix","subtract","multiply"],(e=>{let{typed:t,matrix:n,subtract:r,multiply:i}=e;return t(ks,{"Matrix, Matrix":function(e,t){return n(o(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(o(e.toArray(),t))},"Array, Matrix":function(e,t){return n(o(e,t.toArray()))},"Array, Array":o});function o(e,t){const n=Math.max(vr(e).length,vr(t).length);e=Fr(e),t=Fr(t);const o=vr(e),a=vr(t);if(1!==o.length||1!==a.length||3!==o[0]||3!==a[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+a.join(", ")+"])");const s=[r(i(e[1],t[2]),i(e[2],t[1])),r(i(e[2],t[0]),i(e[0],t[2])),r(i(e[0],t[1]),i(e[1],t[0]))];return n>1?[s]:s}})),qs="diag",Ps=he(qs,["typed","matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,matrix:n,DenseMatrix:r,SparseMatrix:i}=e;return t(qs,{Array:function(e){return o(e,0,vr(e),null)},"Array, number":function(e,t){return o(e,t,vr(e),null)},"Array, BigNumber":function(e,t){return o(e,t.toNumber(),vr(e),null)},"Array, string":function(e,t){return o(e,0,vr(e),t)},"Array, number, string":function(e,t,n){return o(e,t,vr(e),n)},"Array, BigNumber, string":function(e,t,n){return o(e,t.toNumber(),vr(e),n)},Matrix:function(e){return o(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return o(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return o(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return o(e,0,e.size(),t)},"Matrix, number, string":function(e,t,n){return o(e,t,e.size(),n)},"Matrix, BigNumber, string":function(e,t,n){return o(e,t.toNumber(),e.size(),n)}});function o(e,t,o,a){if(!ye(t))throw new TypeError("Second parameter in function diag must be an integer");const s=t>0?t:0,u=t<0?-t:0;switch(o.length){case 1:return function(e,t,n,o,a,s){const u=[o+a,o+s];if(n&&"sparse"!==n&&"dense"!==n)throw new TypeError(`Unknown matrix type ${n}"`);const c="sparse"===n?i.diagonal(u,e,t):r.diagonal(u,e,t);return null!==n?c:c.valueOf()}(e,t,a,o[0],u,s);case 2:return function(e,t,r,i,o,a){if(E(e)){const i=e.diagonal(t);return null!==r?r!==i.storage()?n(i,r):i:i.valueOf()}const s=Math.min(i[0]-o,i[1]-a),u=[];for(let t=0;t<s;t++)u[t]=e[t+o][t+a];return null!==r?n(u):u}(e,t,a,o,u,s)}throw new RangeError("Matrix for function diag must be 2 dimensional")}})),js=he("filter",["typed"],(e=>{let{typed:t}=e;return t("filter",{"Array, function":Us,"Matrix, function":function(e,t){return e.create(Us(e.valueOf(),t),e.datatype())},"Array, RegExp":qr,"Matrix, RegExp":function(e,t){return e.create(qr(e.valueOf(),t),e.datatype())}})}));function Us(e,t){const n=Jr(t,e,"filter");return function(e){if(1!==vr(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(function(e,t,r){return n(e,[t],r)}))}(e)}const Ls="flatten",$s=he(Ls,["typed"],(e=>{let{typed:t}=e;return t(Ls,{Array:function(e){return zr(e)},Matrix:function(e){return e.create(zr(e.toArray()),e.datatype())}})})),Hs="forEach",Gs=he(Hs,["typed"],(e=>{let{typed:t}=e;return t(Hs,{"Array, function":Vs,"Matrix, function":function(e,t){e.forEach(t)}})}));function Vs(e,t){Yr(e,[],e,Jr(t,e,Hs))}const Zs="getMatrixDataType",Ws=he(Zs,["typed"],(e=>{let{typed:t}=e;return t(Zs,{Array:function(e){return Lr(e,oe)},Matrix:function(e){return e.getDataType()}})})),Ys="identity",Js=he(Ys,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i,DenseMatrix:o,SparseMatrix:a}=e;return t(Ys,{"":function(){return"Matrix"===n.matrix?r([]):[]},string:function(e){return r(e)},"number | BigNumber":function(e){return u(e,e,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return u(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return u(e,t,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,n){return u(e,t,n)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?r(t):[];case 1:return u(e[0],e[0],t);case 2:return u(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function u(e,t,n){const r=g(e)||g(t)?i:null;if(g(e)&&(e=e.toNumber()),g(t)&&(t=t.toNumber()),!ye(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!ye(t)||t<1)throw new Error("Parameters in function identity must be positive integers");const s=r?new i(1):1,u=r?new r(0):0,c=[e,t];if(n){if("sparse"===n)return a.diagonal(c,s,0,u);if("dense"===n)return o.diagonal(c,s,0,u);throw new TypeError(`Unknown matrix type "${n}"`)}const l=Mr([],c,u),f=e<t?e:t;for(let e=0;e<f;e++)l[e][e]=s;return l}})),Xs="kron",Qs=he(Xs,["typed","matrix","multiplyScalar"],(e=>{let{typed:t,matrix:n,multiplyScalar:r}=e;return t(Xs,{"Matrix, Matrix":function(e,t){return n(i(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return n(i(e.toArray(),t))},"Array, Matrix":function(e,t){return n(i(e,t.toArray()))},"Array, Array":i});function i(e,t){if(1===vr(e).length&&(e=[e]),1===vr(t).length&&(t=[t]),vr(e).length>2||vr(t).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(t.length)+")");const n=[];let i=[];return e.map((function(e){return t.map((function(t){return i=[],n.push(i),e.map((function(e){return t.map((function(t){return i.push(r(e,t))}))}))}))}))&&n}})),Ks="map",eu=he(Ks,["typed"],(e=>{let{typed:t}=e;return t(Ks,{"Array, function":n,"Matrix, function":function(e,t){return e.map(t)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,r,i)=>function(e,r){if("function"!=typeof r)throw new Error("Last argument must be a callback function");const i=e[0].isMatrix,o=Gr(...e.map((e=>e.isMatrix?e.size():vr(e)))),a=i?(e,t)=>e.get(t):Wr,s=i?e.map((t=>t.isMatrix?t.create(Zr(t.toArray(),o),t.datatype()):e[0].create(Zr(t.valueOf(),o)))):e.map((e=>e.isMatrix?Zr(e.toArray(),o):Zr(e,o)));let u;if(t.isTypedFunction(r)){const e=o.map((()=>0)),n=s.map((t=>a(t,e))),i=function(e,n,r,i){return null!==t.resolve(e,[...n,r,...i])?2:null!==t.resolve(e,[...n,r])?1:(t.resolve(e,n),0)}(r,n,e,s);u=l(i)}else{const t=e.length,n=function(e,t){return e.length>t+1?2:e.length===t+1?1:0}(r,t);u=l(n)}const c=(e,t)=>u([e,...s.slice(1).map((e=>a(e,t)))],t);return i?s[0].map(c):n(s[0],c);function l(e){switch(e){case 0:return e=>r(...e);case 1:return(e,t)=>r(...e,t);case 2:return(e,t)=>r(...e,t,...s)}}}([e,r,...i.slice(0,i.length-1)],i[i.length-1])});function n(e,t){return Yr(e,[],e,Jr(t,e,Ks))}})),tu="diff",nu=he(tu,["typed","matrix","subtract","number"],(e=>{let{typed:t,matrix:n,subtract:r,number:i}=e;return t(tu,{"Array | Matrix":function(e){return E(e)?n(a(e.toArray())):a(e)},"Array | Matrix, number":function(e,t){if(!ye(t))throw new RangeError("Dimension must be a whole number");return E(e)?n(o(e.toArray(),t)):o(e,t)},"Array, BigNumber":t.referTo("Array,number",(e=>(t,n)=>e(t,i(n)))),"Matrix, BigNumber":t.referTo("Matrix,number",(e=>(t,n)=>e(t,i(n))))});function o(e,t){if(E(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){const n=[];return e.forEach((e=>{n.push(o(e,t-1))})),n}if(0===t)return a(e);throw RangeError("Cannot have negative dimension")}function a(e){const t=[],n=e.length;for(let r=1;r<n;r++)t.push(s(e[r-1],e[r]));return t}function s(e,t){E(e)&&(e=e.toArray()),E(t)&&(t=t.toArray());const n=Array.isArray(e),i=Array.isArray(t);if(n&&i)return function(e,t){if(e.length!==t.length)throw RangeError("Not all sub-arrays have the same length");const n=[],r=e.length;for(let i=0;i<r;i++)n.push(s(e[i],t[i]));return n}(e,t);if(!n&&!i)return r(t,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}})),ru=he("ones",["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t("ones",{"":function(){return"Array"===n.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===n.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const n=function(e){let t=!1;return e.forEach((function(e,n,r){g(e)&&(t=!0,r[n]=e.toNumber())})),t}(e),o=n?new i(1):1;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}))}(e),t){const n=r(t);return e.length>0?n.resize(e,o):n}{const t=[];return e.length>0?Mr(t,e,o):t}}}));function iu(){throw new Error('No "bignumber" implementation available')}function ou(){throw new Error('No "fraction" implementation available')}function au(){throw new Error('No "matrix" implementation available')}const su="range",uu=he(su,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;return t(su,{string:p,"string, boolean":p,number:function(e){throw new TypeError(`Too few arguments to function range(): ${e}`)},boolean:function(e){throw new TypeError(`Unexpected type of argument 1 to function range(): ${e}, number|bigint|BigNumber|Fraction`)},"number, number":function(e,t){return f(m(e,t,1,!1))},"number, number, number":function(e,t,n){return f(m(e,t,n,!1))},"number, number, boolean":function(e,t,n){return f(m(e,t,1,n))},"number, number, number, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"bigint, bigint|number":function(e,t){return f(m(e,t,1n,!1))},"number, bigint":function(e,t){return f(m(BigInt(e),t,1n,!1))},"bigint, bigint|number, bigint|number":function(e,t,n){return f(m(e,t,BigInt(n),!1))},"number, bigint, bigint|number":function(e,t,n){return f(m(BigInt(e),t,BigInt(n),!1))},"bigint, bigint|number, boolean":function(e,t,n){return f(m(e,t,1n,n))},"number, bigint, boolean":function(e,t,n){return f(m(BigInt(e),t,1n,n))},"bigint, bigint|number, bigint|number, boolean":function(e,t,n,r){return f(m(e,t,BigInt(n),r))},"number, bigint, bigint|number, boolean":function(e,t,n,r){return f(m(BigInt(e),t,BigInt(n),r))},"BigNumber, BigNumber":function(e,t){return f(m(e,t,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,n){return f(m(e,t,n,!1))},"BigNumber, BigNumber, boolean":function(e,t,n){return f(m(e,t,new(0,e.constructor)(1),n))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Fraction, Fraction":function(e,t){return f(m(e,t,1,!1))},"Fraction, Fraction, Fraction":function(e,t,n){return f(m(e,t,n,!1))},"Fraction, Fraction, boolean":function(e,t,n){return f(m(e,t,1,n))},"Fraction, Fraction, Fraction, boolean":function(e,t,n,r){return f(m(e,t,n,r))},"Unit, Unit, Unit":function(e,t,n){return f(m(e,t,n,!1))},"Unit, Unit, Unit, boolean":function(e,t,n,r){return f(m(e,t,n,r))}});function f(e){return"Matrix"===n.matrix?r?r(e):au():e}function p(e,t){const r=function(e){const t=e.split(":").map((function(e){return Number(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}(e);if(!r)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===n.number?(void 0===i&&iu(),f(m(i(r.start),i(r.end),i(r.step)))):f(m(r.start,r.end,r.step,t))}function m(e,t,n,r){const i=[],f=l(n)?r?a:o:r?u:s;let p=e;for(;f(p,t);)i.push(p),p=c(p,n);return i}})),cu="reshape",lu=he(cu,["typed","isInteger","matrix"],(e=>{let{typed:t,isInteger:n}=e;return t(cu,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach((function(e){if(!n(e))throw new TypeError("Invalid size for dimension: "+e)})),Tr(e,t)}})})),fu=he("resize",["config","matrix"],(e=>{let{config:t,matrix:n}=e;return function(e,r,i){if(2!==arguments.length&&3!==arguments.length)throw new ma("resize",arguments.length,2,3);if(E(r)&&(r=r.valueOf()),g(r[0])&&(r=r.map((function(e){return g(e)?e.toNumber():e}))),E(e))return e.resize(r,i,!0);if("string"==typeof e)return function(e,t,n){if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";if(1!==t.length)throw new xr(t.length,1);const r=t[0];if("number"!=typeof r||!ye(r))throw new TypeError("Invalid size, must contain positive integers (size: "+pr(t)+")");if(e.length>r)return e.substring(0,r);if(e.length<r){let t=e;for(let i=0,o=r-e.length;i<o;i++)t+=n;return t}return e}(e,r,i);const o=!Array.isArray(e)&&"Array"!==t.matrix;if(0===r.length){for(;Array.isArray(e);)e=e[0];return ae(e)}{Array.isArray(e)||(e=[e]);const t=Mr(e=ae(e),r,i);return o?n(t):t}}})),pu="rotate",mu=he(pu,["typed","multiply","rotationMatrix"],(e=>{let{typed:t,multiply:n,rotationMatrix:r}=e;return t(pu,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),n(r(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),n(r(t,o),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),n(r(t,o),e)}});function i(e,t){const n=Array.isArray(e)?vr(e):e.size();if(n.length>2)throw new RangeError(`Vector must be of dimensions 1x${t}`);if(2===n.length&&1!==n[1])throw new RangeError(`Vector must be of dimensions 1x${t}`);if(n[0]!==t)throw new RangeError(`Vector must be of dimensions 1x${t}`)}})),hu="rotationMatrix",du=he(hu,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(e=>{let{typed:t,config:n,multiplyScalar:r,addScalar:i,unaryMinus:o,norm:a,BigNumber:s,matrix:u,DenseMatrix:c,SparseMatrix:l,cos:f,sin:p}=e;return t(hu,{"":function(){return"Matrix"===n.matrix?u([]):[]},string:function(e){return u(e)},"number | BigNumber | Complex | Unit":function(e){return m(e,"Matrix"===n.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return m(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){const n=u(t);return h(n),x(e,n,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){h(t);const r=t.storage()||("Matrix"===n.matrix?"dense":void 0);return x(e,t,r)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,n){const r=u(t);return h(r),x(e,r,n)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,n){return h(t),x(e,t,n)}});function m(e,t){const n=g(e)?new s(-1):-1,i=f(e),o=p(e);return y([[i,r(n,o)],[o,i]],t)}function h(e){const t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function d(e){return e.reduce(((e,t)=>r(e,t)))}function y(e,t){if(t){if("sparse"===t)return new l(e);if("dense"===t)return new c(e);throw new TypeError(`Unknown matrix type "${t}"`)}return e}function x(e,t,n){const r=a(t);if(0===r)throw new RangeError("Rotation around zero vector");const u=g(e)?s:null,c=u?new u(1):1,l=u?new u(-1):-1,m=u?new u(t.get([0])/r):t.get([0])/r,h=u?new u(t.get([1])/r):t.get([1])/r,x=u?new u(t.get([2])/r):t.get([2])/r,b=f(e),v=i(c,o(b)),w=p(e);return y([[i(b,d([m,m,v])),i(d([m,h,v]),d([l,x,w])),i(d([m,x,v]),d([h,w]))],[i(d([m,h,v]),d([x,w])),i(b,d([h,h,v])),i(d([h,x,v]),d([l,m,w]))],[i(d([m,x,v]),d([l,h,w])),i(d([h,x,v]),d([m,w])),i(b,d([x,x,v]))]],n)}})),gu=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;return t("row",{"Matrix, number":o,"Array, number":function(e,t){return o(r(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");Ar(t,e.size()[0]);const o=i(0,e.size()[1]),a=new n(t,o),s=e.subset(a);return E(s)?s:r([[s]])}})),yu="size",xu=he(yu,["typed","config","?matrix"],(e=>{let{typed:t,config:n,matrix:r}=e;return t(yu,{Matrix:function(e){return e.create(e.size(),"number")},Array:vr,string:function(e){return"Array"===n.matrix?[e.length]:r([e.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===n.matrix?[]:r?r([],"dense","number"):au()}})})),bu="squeeze",vu=he(bu,["typed"],(e=>{let{typed:t}=e;return t(bu,{Array:function(e){return Fr(ae(e))},Matrix:function(e){const t=Fr(e.toArray());return Array.isArray(t)?e.create(t,e.datatype()):t},any:function(e){return ae(e)}})})),wu="subset",Nu=he(wu,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;return t(wu,{"Matrix, Index":function(e,t){return Sr(t)?n():(Er(e,t),e.subset(t))},"Array, Index":t.referTo("Matrix, Index",(function(e){return function(t,r){const i=e(n(t),r);return r.isScalar()?i:i.valueOf()}})),"Object, Index":Su,"string, Index":Eu,"Matrix, Index, any, any":function(e,t,n,o){return Sr(t)?e:(Er(e,t),e.clone().subset(t,function(e,t){if("string"==typeof e)throw new Error("can't boradcast a string");if(t._isScalar)return e;const n=t.size();if(!n.every((e=>e>0)))return e;try{return i(e,r(n))}catch(t){return e}}(n,t),o))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,i,o){const a=e(n(t),r,i,o);return a.isMatrix?a.valueOf():a}})),"Array, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,i){return e(n(t),r,i,void 0).valueOf()}})),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,n,r){return e(t,n,r,void 0)}})),"string, Index, string":Au,"string, Index, string, string":Au,"Object, Index, any":Mu})}));function Eu(e,t){if(!T(t))throw new TypeError("Index expected");if(Sr(t))return"";if(Er(Array.from(e),t),1!==t.size().length)throw new xr(t.size().length,1);const n=e.length;Ar(t.min()[0],n),Ar(t.max()[0],n);const r=t.dimension(0);let i="";return r.forEach((function(t){i+=e.charAt(t)})),i}function Au(e,t,n,r){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(Sr(t))return e;if(Er(Array.from(e),t),1!==t.size().length)throw new xr(t.size().length,1);if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";const i=t.dimension(0);if(i.size()[0]!==n.length)throw new xr(i.size()[0],n.length);const o=e.length;Ar(t.min()[0]),Ar(t.max()[0]);const a=[];for(let t=0;t<o;t++)a[t]=e.charAt(t);if(i.forEach((function(e,t){a[e]=n.charAt(t[0])})),a.length>o)for(let e=o-1,t=a.length;e<t;e++)a[e]||(a[e]=r);return a.join("")}function Su(e,t){if(Sr(t))return;if(1!==t.size().length)throw new xr(t.size(),1);const n=t.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");return i(e,n)}function Mu(e,t,n){if(Sr(t))return e;if(1!==t.size().length)throw new xr(t.size(),1);const r=t.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");const i=ae(e);return o(i,r,n),i}const Cu="transpose",Tu=he(Cu,["typed","matrix"],(e=>{let{typed:t,matrix:n}=e;return t(Cu,{Array:e=>r(n(e)).valueOf(),Matrix:r,any:ae});function r(e){const t=e.size();let n;switch(t.length){case 1:n=e.clone();break;case 2:{const r=t[0],i=t[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+pr(t)+")");switch(e.storage()){case"dense":n=function(e,t,n){const r=e._data,i=[];let o;for(let e=0;e<n;e++){o=i[e]=[];for(let n=0;n<t;n++)o[n]=ae(r[n][e])}return e.createDenseMatrix({data:i,size:[n,t],datatype:e._datatype})}(e,r,i);break;case"sparse":n=function(e,t,n){const r=e._values,i=e._index,o=e._ptr,a=r?[]:void 0,s=[],u=[],c=[];for(let e=0;e<t;e++)c[e]=0;let l,f,p;for(l=0,f=i.length;l<f;l++)c[i[l]]++;let m=0;for(let e=0;e<t;e++)u.push(m),m+=c[e],c[e]=u[e];for(u.push(m),p=0;p<n;p++)for(let e=o[p],t=o[p+1],n=e;n<t;n++){const e=c[i[n]]++;s[e]=p,r&&(a[e]=ae(r[n]))}return e.createSparseMatrix({values:a,index:s,ptr:u,size:[n,t],datatype:e._datatype})}(e,r,i)}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+pr(t)+")")}return n}})),Bu="ctranspose",Du=he(Bu,["typed","transpose","conj"],(e=>{let{typed:t,transpose:n,conj:r}=e;return t(Bu,{any:function(e){return r(n(e))}})})),Fu="zeros",Ou=he(Fu,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:n,matrix:r,BigNumber:i}=e;return t(Fu,{"":function(){return"Array"===n.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===n.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const n=function(e){let t=!1;return e.forEach((function(e,n,r){g(e)&&(t=!0,r[n]=e.toNumber())})),t}(e),o=n?new i(0):0;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}))}(e),t){const n=r(t);return e.length>0?n.resize(e,o):n}{const t=[];return e.length>0?Mr(t,e,o):t}}})),_u=he("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(e=>{let{typed:t,matrix:n,addScalar:r,multiplyScalar:i,divideScalar:o,exp:a,tau:s,i:u,dotDivide:c,conj:l,pow:f,ceil:p,log2:m}=e;return t("fft",{Array:h,Matrix:function(e){return e.create(h(e.valueOf()),e.datatype())}});function h(e){const t=vr(e);return 1===t.length?g(e,t[0]):d(e.map((e=>h(e,t.slice(1)))),0)}function d(e,t){const n=vr(e);if(0!==t)return new Array(n[0]).fill(0).map(((n,r)=>d(e[r],t-1)));if(1===n.length)return g(e);function r(e){const t=vr(e);return new Array(t[1]).fill(0).map(((n,r)=>new Array(t[0]).fill(0).map(((t,n)=>e[n][r]))))}return r(d(r(e),1))}function g(e){const t=e.length;if(1===t)return[e[0]];if(t%2==0){const n=[...g(e.filter(((e,t)=>t%2==0))),...g(e.filter(((e,t)=>t%2==1)))];for(let e=0;e<t/2;e++){const c=n[e],l=i(n[e+t/2],a(i(i(s,u),o(-e,t))));n[e]=r(c,l),n[e+t/2]=r(c,i(-1,l))}return n}return function(e){const t=e.length,n=a(o(i(-1,i(u,s)),t)),r=[];for(let e=1-t;e<t;e++)r.push(f(n,o(f(e,2),2)));const d=f(2,p(m(t+t-1))),y=[...new Array(t).fill(0).map(((n,o)=>i(e[o],r[t-1+o]))),...new Array(d-t).fill(0)],x=[...new Array(t+t-1).fill(0).map(((e,t)=>o(1,r[t]))),...new Array(d-(t+t-1)).fill(0)],b=g(y),v=g(x),w=new Array(d).fill(0).map(((e,t)=>i(b[t],v[t]))),N=c(l(h(l(w))),d),E=[];for(let e=t-1;e<t+t-1;e++)E.push(i(N[e],r[e]));return E}(e)}})),Iu="ifft",zu=he(Iu,["typed","fft","dotDivide","conj"],(e=>{let{typed:t,fft:n,dotDivide:r,conj:i}=e;return t(Iu,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);return r(i(n(i(e))),t.reduce(((e,t)=>e*t),1))}})})),ku=he("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,max:a,map:s,abs:u,isPositive:c,isNegative:l,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:y}=e;function x(e){return function(t,m,d,x){if(2!==m.length||!m.every(E)&&!m.every(v))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');const b=m[0],w=m[1],N=f(w,b),A=x.firstStep;if(void 0!==A&&!c(A))throw new Error('"firstStep" must be positive');const S=x.maxStep;if(void 0!==S&&!c(S))throw new Error('"maxStep" must be positive');const M=x.minStep;if(M&&l(M))throw new Error('"minStep" must be positive or zero');const C=[b,w,A,M,S].filter((e=>void 0!==e));if(!C.every(E)&&!C.every(v))throw new Error('Inconsistent type of "t" dependant variables');const T=x.tol?x.tol:1e-4,B=x.minDelta?x.minDelta:.2,D=x.maxDelta?x.maxDelta:5,F=x.maxIter?x.maxIter:1e4,O=[b,w,...d,S,M].some(g),[_,I,z,k]=O?[h(e.a),h(e.c),h(e.b),h(e.bp)]:[e.a,e.c,e.b,e.bp];let R=A?N?A:y(A):o(r(w,b),1);const q=[b],P=[d],j=r(z,k);let U=0,L=0;const $=function(e){return e?p:f}(N),H=function(e){const t=e?f:p;return function(e,i,o){const a=n(e,o);return t(a,i)?r(i,e):o}}(N);for(;$(q[U],w);){const e=[];R=H(q[U],w,R),e.push(t(q[U],P[U]));for(let r=1;r<I.length;++r)e.push(t(n(q[U],i(I[r],R)),n(P[U],i(R,_[r],e))));const r=a(u(s(i(j,e),(e=>v(e)?e.value:e))));r<T&&T/r>1/4&&(q.push(n(q[U],R)),P.push(n(P[U],i(R,z,e))),U++);let o=.84*(T/r)**.2;if(p(o,B)?o=B:f(o,D)&&(o=D),o=O?h(o):o,R=i(R,o),S&&f(u(R),S)?R=N?S:y(S):M&&p(u(R),M)&&(R=N?M:y(M)),L++,L>F)throw new Error("Maximum number of iterations reached, try changing options")}return{t:q,y:P}}}function b(e,t,n,r){return x({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,t,n,r)}function w(e,t,n,r){return x({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,t,n,r)}function N(e,t,n,r){const i=r.method?r.method:"RK45",o={RK23:b,RK45:w};if(i.toUpperCase()in o){const a={...r};return delete a.method,o[i.toUpperCase()](e,t,n,a)}{const e=Object.keys(o).map((e=>`"${e}"`)),t=`${e.slice(0,-1).join(", ")} and ${e.slice(-1)}`;throw new Error(`Unavailable method "${i}". Available methods are ${t}`)}}function E(e){return g(e)||d(e)}function A(e,t,n,r){const i=N(e,t.toArray(),n.toArray(),r);return{t:m(i.t),y:m(i.y)}}return t("solveODE",{"function, Array, Array, Object":N,"function, Matrix, Matrix, Object":A,"function, Array, Array":(e,t,n)=>N(e,t,n,{}),"function, Matrix, Matrix":(e,t,n)=>A(e,t,n,{}),"function, Array, number | BigNumber | Unit":(e,t,n)=>{const r=N(e,t,[n],{});return{t:r.t,y:r.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit":(e,t,n)=>{const r=N(e,t.toArray(),[n],{});return{t:m(r.t),y:m(r.y.map((e=>e[0])))}},"function, Array, number | BigNumber | Unit, Object":(e,t,n,r)=>{const i=N(e,t,[n],r);return{t:i.t,y:i.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit, Object":(e,t,n,r)=>{const i=N(e,t.toArray(),[n],r);return{t:m(i.t),y:m(i.y.map((e=>e[0])))}}})})),Ru=he("erf",["typed"],(e=>{let{typed:t}=e;return t("name",{number:function(e){const t=Math.abs(e);return t>=Lu?be(e):t<=qu?be(e)*function(e){const t=e*e;let n,r=ju[0][4]*t,i=t;for(n=0;n<3;n+=1)r=(r+ju[0][n])*t,i=(i+Uu[0][n])*t;return e*(r+ju[0][3])/(i+Uu[0][3])}(t):t<=4?be(e)*(1-function(e){let t,n=ju[1][8]*e,r=e;for(t=0;t<7;t+=1)n=(n+ju[1][t])*e,r=(r+Uu[1][t])*e;const i=(n+ju[1][7])/(r+Uu[1][7]),o=parseInt(16*e)/16,a=(e-o)*(e+o);return Math.exp(-o*o)*Math.exp(-a)*i}(t)):be(e)*(1-function(e){let t,n=1/(e*e),r=ju[2][5]*n,i=n;for(t=0;t<4;t+=1)r=(r+ju[2][t])*n,i=(i+Uu[2][t])*n;let o=n*(r+ju[2][4])/(i+Uu[2][4]);o=(Pu-o)/e,n=parseInt(16*e)/16;const a=(e-n)*(e+n);return Math.exp(-n*n)*Math.exp(-a)*o}(t))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),qu=.46875,Pu=.5641895835477563,ju=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],Uu=[[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]],Lu=Math.pow(2,53),$u="zeta",Hu=he($u,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],(e=>{let{typed:t,config:n,multiply:r,pow:i,divide:o,factorial:a,equal:s,smallerEq:u,isNegative:c,gamma:l,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=e;return t($u,{number:e=>y(e,(e=>e),(()=>20)),BigNumber:e=>y(e,(e=>new d(e)),(()=>Math.abs(Math.log10(n.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):x(e,(e=>e),(e=>Math.round(19.5+.9*Math.abs(e.im))),(e=>e.re))}});function y(e,t,n){return s(e,0)?t(-.5):s(e,1)?t(NaN):isFinite(e)?x(e,t,n,(e=>e)):c(e)?t(NaN):t(1)}function x(e,t,n,a){const s=n(e);if(a(e)>-(s-1)/2)return function(e,t,n){const a=o(1,r(b(n(0),t),p(1,i(2,p(1,e)))));let s=n(0);for(let a=n(1);u(a,t);a=m(a,1))s=m(s,o(r((-1)**(a-1),b(a,t)),i(a,e)));return r(a,s)}(e,t(s),t);{let s=r(i(2,e),i(t(g),p(e,1)));return s=r(s,f(r(o(t(g),2),e))),s=r(s,l(p(1,e))),r(s,x(p(1,e),t,n,a))}}function b(e,t){let n=e;for(let s=e;u(s,t);s=m(s,1)){const e=o(r(a(m(t,p(s,1))),i(4,s)),r(a(p(t,s)),a(r(2,s))));n=m(n,e)}return r(t,n)}})),Gu="mode",Vu=he(Gu,["typed","isNaN","isNumeric"],(e=>{let{typed:t,isNaN:n,isNumeric:r}=e;return t(Gu,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=zr(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");const t={};let i=[],o=0;for(let a=0;a<e.length;a++){const s=e[a];if(r(s)&&n(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in t||(t[s]=0),t[s]++,t[s]===o?i.push(s):t[s]>o&&(o=t[s],i=[s])}return i}}));function Zu(e,t,n){let r;return String(e).includes("Unexpected type")?(r=arguments.length>2?" (type: "+oe(n)+", value: "+JSON.stringify(n)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+r)):String(e).includes("complex numbers")?(r=arguments.length>2?" (type: "+oe(n)+", value: "+JSON.stringify(n)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+r)):e}const Wu="prod",Yu=he(Wu,["typed","config","multiplyScalar","numeric"],(e=>{let{typed:t,config:n,multiplyScalar:r,numeric:i}=e;return t(Wu,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return o(e)}});function o(e){let t;if(ri(e,(function(e){try{t=void 0===t?e:r(t,e)}catch(t){throw Zu(t,"prod",e)}})),"string"==typeof t&&(t=i(t,xe(t,n))),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}})),Ju="format",Xu=he(Ju,["typed"],(e=>{let{typed:t}=e;return t(Ju,{any:pr,"any, Object | function | number | BigNumber":pr})})),Qu=he("bin",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("bin",{"number | BigNumber":function(e){return n(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"bin",wordSize:t})}})})),Ku=he("oct",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("oct",{"number | BigNumber":function(e){return n(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"oct",wordSize:t})}})})),ec=he("hex",["typed","format"],(e=>{let{typed:t,format:n}=e;return t("hex",{"number | BigNumber":function(e){return n(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,t){return n(e,{notation:"hex",wordSize:t})}})})),tc=/\$([\w.]+)/g,nc="print",rc=he(nc,["typed"],(e=>{let{typed:t}=e;return t(nc,{"string, Object | Array":ic,"string, Object | Array, number | Object":ic})}));function ic(e,t,n){return e.replace(tc,(function(e,r){const i=r.split(".");let o=t[i.shift()];for(void 0!==o&&o.isMatrix&&(o=o.toArray());i.length&&void 0!==o;){const e=i.shift();o=e?o[e]:o+"."}return void 0!==o?w(o)?o:pr(o,n):e}))}const oc=he("to",["typed","matrix","concat"],(e=>{let{typed:t,matrix:n,concat:r}=e;return t("to",{"Unit, Unit | string":(e,t)=>e.to(t)},ua({typed:t,matrix:n,concat:r})({Ds:!0}))})),ac="isPrime",sc=he(ac,["typed"],(e=>{let{typed:t}=e;return t(ac,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(let t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;if(e%2n===0n||e%3n===0n)return!1;for(let t=5n;t*t<=e;t+=6n)if(e%t===0n||e%(t+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(Math.pow(2,32))){const t=e.toNumber();for(let e=5;e*e<=t;e+=6)if(t%e==0||t%(e+2)==0)return!1;return!0}function t(e,t,n){let r=1;for(;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(n)):(t=t.sub(1),r=e.mul(r).mod(n));return r}const n=e.constructor.clone({precision:2*e.toFixed(0).length});let r=0,i=(e=new n(e)).sub(1);for(;i.mod(2).eq(0);)i=i.div(2),r+=1;let o=null;if(e.lt("3317044064679887385961981"))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((t=>t<e));else{const t=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));o=[];for(let e=2;e<=t;e+=1)o.push(t)}for(let n=0;n<o.length;n+=1){const a=o[n],s=t(e.sub(e).add(a),i,e);if(!s.eq(1))for(let t=0,n=s;!n.eq(e.sub(1));t+=1,n=n.mul(n).mod(e))if(t===r-1)return!1}return!0},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),uc=he("numeric",["number","?bignumber","?fraction"],(e=>{let{number:t,bignumber:n,fraction:r}=e;const i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:n?e=>n(e):iu,bigint:e=>BigInt(e),Fraction:r?e=>r(e):ou};return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(arguments.length>2?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");const n=oe(e);if(!(n in i))throw new TypeError("Cannot convert "+e+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===n?e:o[t](e)}})),cc="divideScalar",lc=he(cc,["typed","numeric"],(e=>{let{typed:t,numeric:n}=e;return t(cc,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"bigint, bigint":function(e,t){return e/t},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})})),fc=he("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(e=>{let{typed:t,config:n,identity:r,multiply:i,matrix:o,inv:a,number:s,fraction:u,Complex:c}=e;return t("pow",{"number, number":l,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||n.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"bigint, bigint":(e,t)=>e**t,"Fraction, Fraction":function(e,t){const r=e.pow(t);if(null!=r)return r;if(n.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(e.valueOf(),t.valueOf())},"Array, number":f,"Array, BigNumber":function(e,t){return f(e,t.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,t){return p(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function l(e,t){if(n.predictable&&!ye(t)&&e<0)try{const n=u(t),r=s(n);if((t===r||Math.abs((t-r)/t)<1e-14)&&n.d%2n===1n)return(n.n%2n===0n?1:-1)*Math.pow(-e,t)}catch(e){}return n.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:ye(t)||e>=0||n.predictable?bo(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new c(e,0).pow(t,0)}function f(e,t){if(!ye(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");const n=vr(e);if(2!==n.length)throw new Error("For A^b, A must be 2 dimensional (A has "+n.length+" dimensions)");if(n[0]!==n[1])throw new Error("For A^b, A must be square (size is "+n[0]+"x"+n[1]+")");if(t<0)try{return f(a(e),-t)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+t+")");throw e}let o=r(n[0]).valueOf(),s=e;for(;t>=1;)1&~t||(o=i(s,o)),t>>=1,s=i(s,s);return o}function p(e,t){return o(f(e.valueOf(),t))}})),pc="Number of decimals in function round must be an integer",mc="round",hc=he(mc,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(e=>{let{typed:t,config:n,matrix:r,equalScalar:i,zeros:o,BigNumber:a,DenseMatrix:s}=e;const u=zo({typed:t,equalScalar:i}),c=ko({typed:t,DenseMatrix:s}),l=Ro({typed:t});function f(e){return Math.abs(Te(e).exponent)}return t(mc,{number:function(e){const t=vo(e,f(n.relTol));return vo(_e(e,t,n.relTol,n.absTol)?t:e)},"number, number":function(e,t){const r=f(n.relTol);if(t>=r)return vo(e,t);const i=vo(e,r);return vo(_e(e,i,n.relTol,n.absTol)?i:e,t)},"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(pc);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);const n=t.toNumber();return e.round(n)},BigNumber:function(e){const t=new a(e).toDecimalPlaces(f(n.relTol));return(hi(e,t,n.relTol,n.absTol)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);const r=f(n.relTol);if(t>=r)return e.toDecimalPlaces(t.toNumber());const i=e.toDecimalPlaces(r);return(hi(e,i,n.relTol,n.absTol)?i:e).toDecimalPlaces(t.toNumber())},bigint:e=>e,"bigint, number":(e,t)=>e,"bigint, BigNumber":(e,t)=>e,Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(pc);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(pc);return e.round(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,n,r){const i=t.toNumeric(r);return r.multiply(e(i,n))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>e(t,n.toNumber(),r))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,n,r)=>ii(t,(t=>e(t,n,r)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,n)=>e(t,0,n))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>u(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>l(t,n,e,!1))),"Array, number | BigNumber":t.referToSelf((e=>(t,n)=>l(r(t),n,e,!1).valueOf())),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf((e=>(t,n)=>i(t,0)?o(n.size(),n.storage()):c(n,t,e,!0))),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf((e=>(t,n)=>i(t,0)?o(n.size(),n.storage()):l(n,t,e,!0))),"number | Complex | BigNumber | Fraction, Array":t.referToSelf((e=>(t,n)=>l(r(n),t,e,!0).valueOf()))})})),dc=["config","typed","typeOf","divideScalar","Complex"],gc=Math.log(16),yc=he("log",dc,(e=>{let{typed:t,typeOf:n,config:r,divideScalar:i,Complex:o}=e;function a(e){return e.log()}function s(e){return a(new o(e,0))}return t("log",{number:function(e){return e>=0||r.predictable?fo(e):s(e)},bigint:va(gc,fo,r,s),Complex:a,BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():s(e.toNumber())},"any, any":t.referToSelf((e=>(t,r)=>{if("Fraction"===n(t)&&"Fraction"===n(r)){const e=t.log(r);if(null!==e)return e}return i(e(t),e(r))}))})})),xc="log1p",bc=he(xc,["typed","config","divideScalar","log","Complex"],(e=>{let{typed:t,config:n,divideScalar:r,log:i,Complex:o}=e;return t(xc,{number:function(e){return e>=-1||n.predictable?Ne(e):a(new o(e,0))},Complex:a,BigNumber:function(e){const t=e.plus(1);return!t.isNegative()||n.predictable?t.ln():a(new o(e.toNumber(),0))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e))),"any, any":t.referToSelf((e=>(t,n)=>r(e(t),i(n))))});function a(e){const t=e.re+1;return new o(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}})),vc="nthRoots",wc=he(vc,["config","typed","divideScalar","Complex"],(e=>{let{typed:t,config:n,divideScalar:r,Complex:i}=e;const o=[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 a(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];const n="number"==typeof e;let r;(n||0===e.re||0===e.im)&&(r=n?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);const a=e.arg(),s=e.abs(),u=[],c=Math.pow(s,1/t);for(let e=0;e<t;e++){const n=(r+4*e)/t;n!==Math.round(n)?u.push(new i({r:c,phi:(a+2*Math.PI*e)/t})):u.push(o[n%4](c))}return u}return t(vc,{Complex:function(e){return a(e,2)},"Complex, number":a})})),Nc="dotPow",Ec=he(Nc,["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,equalScalar:n,matrix:r,pow:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=zo({typed:t,equalScalar:n}),f=ko({typed:t,DenseMatrix:o}),p=ua({typed:t,matrix:r,concat:a}),m={};for(const e in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,e)&&(e.includes("Matrix")||e.includes("Array")||(m[e]=i.signatures[e]));const h=t(m);return t(Nc,p({elop:h,SS:c,DS:u,Ss:l,sS:f}))})),Ac="dotDivide",Sc=he(Ac,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,equalScalar:r,divideScalar:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ra({typed:t,equalScalar:r}),c=ia({typed:t}),l=hs({typed:t,SparseMatrix:s}),f=zo({typed:t,equalScalar:r}),p=ko({typed:t,DenseMatrix:o}),m=ua({typed:t,matrix:n,concat:a});return t(Ac,m({elop:i,SS:l,DS:c,SD:u,Ss:f,sS:p}))}));function Mc(e){let{DenseMatrix:t}=e;return function(e,n,r){const i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+pr(i)+")");const o=i[0];if(o!==i[1])throw new RangeError("Matrix must be square (size: "+pr(i)+")");let a=[];if(E(n)){const e=n.size(),i=n._data;if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[i[e]];return new t({data:a,size:[o,1],datatype:n._datatype})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(S(n)){if(r){a=[];for(let e=0;e<o;e++)a[e]=[i[e][0]];return new t({data:a,size:[o,1],datatype:n._datatype})}return n}if(M(n)){for(let e=0;e<o;e++)a[e]=[0];const e=n._values,r=n._index,i=n._ptr;for(let t=i[1],n=i[0];n<t;n++)a[r[n]][0]=e[n];return new t({data:a,size:[o,1],datatype:n._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(N(n)){const e=vr(n);if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[n[e]];return new t({data:a,size:[o,1]})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[n[e][0]];return new t({data:a,size:[o,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}const Cc="lsolve",Tc=he(Cc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Cc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=0;e<l;e++){const t=n[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e],d=m[e+1];for(let t=l;t<d;t++){const n=p[t];n===e?s=f[t]:n>e&&(u.push(f[t]),c.push(n))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const g=r(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];n[t]=[o(n[t][0]||0,i(g,u[e]))]}h[e]=[g]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).valueOf()}});function c(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=0;e<l;e++){const t=n[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=r(t,u);for(let t=e+1;t<c;t++)n[t]=[o(n[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),Bc="usolve",Dc=he(Bc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Bc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=l-1;e>=0;e--){const t=n[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e];for(let t=m[e+1]-1;t>=l;t--){const n=p[t];n===e?s=f[t]:n<e&&(u.push(f[t]),c.push(n))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const d=r(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];n[t]=[o(n[t][0],i(d,u[e]))]}h[e]=[d]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).valueOf()}});function c(e,t){const n=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=l-1;e>=0;e--){const t=n[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=r(t,u);for(let t=e-1;t>=0;t--)n[t]=[o(n[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),Fc="lsolveAll",Oc=he(Fc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Fc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=0;e<l;e++){let t=n.length;for(let s=0;s<t;s++){const u=n[s],c=[],l=[],h=m[e],d=m[e+1];let g=0;for(let t=h;t<d;t++){const n=p[t];n===e?g=f[t]:n>e&&(c.push(f[t]),l.push(n))}if(a(g,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,n=l.length;e<n;e++){const n=l[e];t[n]=o(t[n],c[e])}n.push(t)}}else{if(0===s)return[];n.splice(s,1),s-=1,t-=1}else{u[e]=r(u[e],g);for(let t=0,n=l.length;t<n;t++){const n=l[t];u[n]=o(u[n],i(u[e],c[t]))}}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).map((e=>e.valueOf()))}});function c(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0],f=e._size[1];for(let e=0;e<f;e++){let t=n.length;for(let s=0;s<t;s++){const u=n[s];if(a(c[e][e],0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let n=e+1;n<f;n++)t[n]=o(t[n],c[n][e]);n.push(t)}}else{if(0===s)return[];n.splice(s,1),s-=1,t-=1}else{u[e]=r(u[e],c[e][e]);for(let t=e+1;t<f;t++)u[t]=o(u[t],i(u[e],c[t][e]))}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),_c="usolveAll",Ic=he(_c,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:n,divideScalar:r,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(_c,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=l-1;e>=0;e--){let t=n.length;for(let s=0;s<t;s++){const u=n[s],c=[],l=[],h=m[e];let d=0;for(let t=m[e+1]-1;t>=h;t--){const n=p[t];n===e?d=f[t]:n<e&&(c.push(f[t]),l.push(n))}if(a(d,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,n=l.length;e<n;e++){const n=l[e];t[n]=o(t[n],c[e])}n.push(t)}}else{if(0===s)return[];n.splice(s,1),s-=1,t-=1}else{u[e]=r(u[e],d);for(let t=0,n=l.length;t<n;t++){const n=l[t];u[n]=o(u[n],i(u[e],c[t]))}}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(n(e),t).map((e=>e.valueOf()))}});function c(e,t){const n=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0];for(let t=e._size[1]-1;t>=0;t--){let e=n.length;for(let s=0;s<e;s++){const u=n[s];if(a(c[t][t],0))if(a(u[t],0)){if(0===s){const e=[...u];e[t]=1;for(let n=t-1;n>=0;n--)e[n]=o(e[n],c[n][t]);n.push(e)}}else{if(0===s)return[];n.splice(s,1),s-=1,e-=1}else{u[t]=r(u[t],c[t][t]);for(let e=t-1;e>=0;e--)u[e]=o(u[e],i(u[t],c[e][t]))}}}return n.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),zc=he("matAlgo08xS0Sid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return function(e,r,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=r._values,f=r._index,p=r._ptr,m=r._size,h=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(u.length!==m.length)throw new xr(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!o||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");const d=u[0],g=u[1];let y,x=n,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=[],N=[],E=[],A=[],S=[];let M,C,T,B;for(let e=0;e<g;e++){E[e]=N.length;const t=e+1;for(C=s[e],T=s[e+1],M=C;M<T;M++)B=a[M],S[B]=t,A[B]=o[M],N.push(B);for(C=p[e],T=p[e+1],M=C;M<T;M++)B=f[M],S[B]===t&&(A[B]=v(A[B],l[M]));for(M=E[e];M<N.length;){B=N[M];const e=A[B];x(e,b)?N.splice(M,1):(w.push(e),M++)}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===r._datatype?y:void 0})}})),kc=he("useMatrixForArrayScalar",["typed","matrix"],(e=>{let{typed:t,matrix:n}=e;return{"Array, number":t.referTo("DenseMatrix, number",(e=>(t,r)=>e(n(t),r).valueOf())),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",(e=>(t,r)=>e(n(t),r).valueOf())),"number, Array":t.referTo("number, DenseMatrix",(e=>(t,r)=>e(t,n(r)).valueOf())),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",(e=>(t,r)=>e(t,n(r)).valueOf()))}})),Rc="leftShift",qc=he(Rc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=la({typed:t}),u=ra({typed:t,equalScalar:r}),c=zc({typed:t,equalScalar:r}),l=pa({typed:t,DenseMatrix:o}),f=zo({typed:t,equalScalar:r}),p=Ro({typed:t}),m=ua({typed:t,matrix:n,concat:a}),h=kc({typed:t,matrix:n});return t(Rc,{"number, number":os,"BigNumber, BigNumber":Qa,"bigint, bigint":(e,t)=>e<<t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Pc="rightArithShift",jc=he(Pc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=la({typed:t}),u=ra({typed:t,equalScalar:r}),c=zc({typed:t,equalScalar:r}),l=pa({typed:t,DenseMatrix:o}),f=zo({typed:t,equalScalar:r}),p=Ro({typed:t}),m=ua({typed:t,matrix:n,concat:a}),h=kc({typed:t,matrix:n});return t(Pc,{"number, number":as,"BigNumber, BigNumber":Ka,"bigint, bigint":(e,t)=>e>>t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Uc="rightLogShift",Lc=he(Uc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,DenseMatrix:o,concat:a}=e;const s=la({typed:t}),u=ra({typed:t,equalScalar:r}),c=zc({typed:t,equalScalar:r}),l=pa({typed:t,DenseMatrix:o}),f=zo({typed:t,equalScalar:r}),p=Ro({typed:t}),m=ua({typed:t,matrix:n,concat:a}),h=kc({typed:t,matrix:n});return t(Uc,{"number, number":ss,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():f(t,n,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,n)=>r(n,0)?t.clone():p(t,n,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):l(n,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,n)=>r(t,0)?i(n.size(),n.storage()):p(n,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),$c=he("and",["typed","matrix","equalScalar","zeros","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=ra({typed:t,equalScalar:r}),u=xa({typed:t,equalScalar:r}),c=zo({typed:t,equalScalar:r}),l=Ro({typed:t}),f=ua({typed:t,matrix:n,concat:a});return t("and",{"number, number":Ms,"Complex, Complex":function(e,t){return!(0===e.re&&0===e.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(e,t){return!(e.isZero()||t.isZero()||e.isNaN()||t.isNaN())},"bigint, bigint":Ms,"Unit, Unit":t.referToSelf((e=>(t,n)=>e(t.value||0,n.value||0))),"SparseMatrix, any":t.referToSelf((e=>(t,n)=>o(n)?i(t.size(),t.storage()):c(t,n,e,!1))),"DenseMatrix, any":t.referToSelf((e=>(t,n)=>o(n)?i(t.size(),t.storage()):l(t,n,e,!1))),"any, SparseMatrix":t.referToSelf((e=>(t,n)=>o(t)?i(t.size(),t.storage()):c(n,t,e,!0))),"any, DenseMatrix":t.referToSelf((e=>(t,n)=>o(t)?i(t.size(),t.storage()):l(n,t,e,!0))),"Array, any":t.referToSelf((e=>(t,r)=>e(n(t),r).valueOf())),"any, Array":t.referToSelf((e=>(t,r)=>e(t,n(r)).valueOf()))},f({SS:u,DS:s}))})),Hc="compare",Gc=he(Hc,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],(e=>{let{typed:t,config:n,equalScalar:r,matrix:i,BigNumber:o,Fraction:a,DenseMatrix:s,concat:u}=e;const c=ia({typed:t}),l=oa({typed:t,equalScalar:r}),f=ko({typed:t,DenseMatrix:s}),p=ua({typed:t,matrix:i,concat:u}),m=Bi({typed:t});return t(Hc,Vc({typed:t,config:n}),{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return hi(e,t,n.relTol,n.absTol)?new o(0):new o(e.cmp(t))},"bigint, bigint":function(e,t){return e===t?0n:e>t?1n:-1n},"Fraction, Fraction":function(e,t){return new a(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:l,DS:c,Ss:f}))})),Vc=he(Hc,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(Hc,{"number, number":function(e,t){return _e(e,t,n.relTol,n.absTol)?0:e>t?1:-1}})}));var Zc=n(1880);const Wc="compareNatural",Yc=he(Wc,["typed","compare"],(e=>{let{typed:t,compare:n}=e;const r=n.signatures["boolean,boolean"];return t(Wc,{"any, any":function e(t,a){const s=oe(t),u=oe(a);let c;if(!("number"!==s&&"BigNumber"!==s&&"Fraction"!==s||"number"!==u&&"BigNumber"!==u&&"Fraction"!==u))return c=n(t,a),"0"!==c.toString()?c>0?1:-1:Zc(s,u);const l=["Array","DenseMatrix","SparseMatrix"];if(l.includes(s)||l.includes(u))return c=i(e,t,a),0!==c?c:Zc(s,u);if(s!==u)return Zc(s,u);if("Complex"===s)return function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0}(t,a);if("Unit"===s)return t.equalBase(a)?e(t.value,a.value):o(e,t.formatUnits(),a.formatUnits());if("boolean"===s)return r(t,a);if("string"===s)return Zc(t,a);if("Object"===s)return function(e,t,n){const r=Object.keys(t),i=Object.keys(n);r.sort(Zc),i.sort(Zc);const a=o(e,r,i);if(0!==a)return a;for(let o=0;o<r.length;o++){const a=e(t[r[o]],n[i[o]]);if(0!==a)return a}return 0}(e,t,a);if("null"===s)return 0;if("undefined"===s)return 0;throw new TypeError('Unsupported type of value "'+s+'"')}});function i(e,t,n){return M(t)&&M(n)?o(e,t.toJSON().values,n.toJSON().values):M(t)?i(e,t.toArray(),n):M(n)?i(e,t,n.toArray()):S(t)?i(e,t.toJSON().data,n):S(n)?i(e,t,n.toJSON().data):Array.isArray(t)?Array.isArray(n)?o(e,t,n):i(e,t,[n]):i(e,[t],n)}function o(e,t,n){for(let r=0,i=Math.min(t.length,n.length);r<i;r++){const i=e(t[r],n[r]);if(0!==i)return i}return t.length>n.length?1:t.length<n.length?-1:0}})),Jc="compareText",Xc=["typed","matrix","concat"];yr.signature="any, any";const Qc=he(Jc,Xc,(e=>{let{typed:t,matrix:n,concat:r}=e;const i=ua({typed:t,matrix:n,concat:r});return t(Jc,yr,i({elop:yr,Ds:!0}))})),Kc="equal",el=he(Kc,["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ia({typed:t}),u=hs({typed:t,SparseMatrix:a}),c=ko({typed:t,DenseMatrix:i}),l=ua({typed:t,matrix:n,concat:o});return t(Kc,tl({typed:t,equalScalar:r}),l({elop:r,SS:u,DS:s,Ss:c}))})),tl=he(Kc,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(Kc,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:n(e,t)}})})),nl="equalText",rl=he(nl,["typed","compareText","isZero"],(e=>{let{typed:t,compareText:n,isZero:r}=e;return t(nl,{"any, any":function(e,t){return r(n(e,t))}})})),il="smaller",ol=he(il,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=ko({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:i,concat:a}),p=Bi({typed:t});function m(e,t){return e.lt(t)&&!hi(e,t,n.relTol,n.absTol)}return t(il,al({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<t,"BigNumber, BigNumber":m,"bigint, bigint":(e,t)=>e<t,"Fraction, Fraction":(e,t)=>-1===e.compare(t),"Fraction, BigNumber":function(e,t){return m(r(e),t)},"BigNumber, Fraction":function(e,t){return m(e,r(t))},"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:l}))})),al=he(il,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(il,{"number, number":function(e,t){return e<t&&!_e(e,t,n.relTol,n.absTol)}})})),sl="smallerEq",ul=he(sl,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ia({typed:t}),u=hs({typed:t,SparseMatrix:a}),c=ko({typed:t,DenseMatrix:i}),l=ua({typed:t,matrix:r,concat:o}),f=Bi({typed:t});return t(sl,cl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e<=t,"BigNumber, BigNumber":function(e,t){return e.lte(t)||hi(e,t,n.relTol,n.absTol)},"bigint, bigint":(e,t)=>e<=t,"Fraction, Fraction":(e,t)=>1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),cl=he(sl,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(sl,{"number, number":function(e,t){return e<=t||_e(e,t,n.relTol,n.absTol)}})})),ll="larger",fl=he(ll,["typed","config","bignumber","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,bignumber:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=ko({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:i,concat:a}),p=Bi({typed:t});function m(e,t){return e.gt(t)&&!hi(e,t,n.relTol,n.absTol)}return t(ll,pl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>t,"BigNumber, BigNumber":m,"bigint, bigint":(e,t)=>e>t,"Fraction, Fraction":(e,t)=>1===e.compare(t),"Fraction, BigNumber":function(e,t){return m(r(e),t)},"BigNumber, Fraction":function(e,t){return m(e,r(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},p,f({SS:c,DS:u,Ss:l}))})),pl=he(ll,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(ll,{"number, number":function(e,t){return e>t&&!_e(e,t,n.relTol,n.absTol)}})})),ml="largerEq",hl=he(ml,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,matrix:r,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ia({typed:t}),u=hs({typed:t,SparseMatrix:a}),c=ko({typed:t,DenseMatrix:i}),l=ua({typed:t,matrix:r,concat:o}),f=Bi({typed:t});return t(ml,dl({typed:t,config:n}),{"boolean, boolean":(e,t)=>e>=t,"BigNumber, BigNumber":function(e,t){return e.gte(t)||hi(e,t,n.relTol,n.absTol)},"bigint, bigint":function(e,t){return e>=t},"Fraction, Fraction":(e,t)=>-1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),dl=he(ml,["typed","config"],(e=>{let{typed:t,config:n}=e;return t(ml,{"number, number":function(e,t){return e>=t||_e(e,t,n.relTol,n.absTol)}})})),gl="deepEqual",yl=he(gl,["typed","equal"],(e=>{let{typed:t,equal:n}=e;return t(gl,{"any, any":function(e,t){return r(e.valueOf(),t.valueOf())}});function r(e,t){if(Array.isArray(e)){if(Array.isArray(t)){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(!r(e[i],t[i]))return!1;return!0}return!1}return!Array.isArray(t)&&n(e,t)}})),xl="unequal",bl=he(xl,["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:n,equalScalar:r,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ia({typed:t}),c=hs({typed:t,SparseMatrix:s}),l=ko({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:i,concat:a});return t(xl,vl({typed:t,equalScalar:r}),f({elop:function(e,t){return!r(e,t)},SS:c,DS:u,Ss:l}))})),vl=he(xl,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:n}=e;return t(xl,{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:!n(e,t)}})})),wl="partitionSelect",Nl=he(wl,["typed","isNumeric","isNaN","compare"],(e=>{let{typed:t,isNumeric:n,isNaN:r,compare:i}=e;const o=i,a=(e,t)=>-i(e,t);return t(wl,{"Array | Matrix, number":function(e,t){return s(e,t,o)},"Array | Matrix, number, string":function(e,t,n){if("asc"===n)return s(e,t,o);if("desc"===n)return s(e,t,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(e,t,n){if(!ye(t)||t<0)throw new Error("k must be a non-negative integer");if(E(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),t,n)}if(Array.isArray(e))return u(e,t,n)}function u(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(let t=0;t<e.length;t++)if(n(e[t])&&r(e[t]))return e[t];let o=0,a=e.length-1;for(;o<a;){let n=o,r=a;const s=e[Math.floor(Math.random()*(a-o+1))+o];for(;n<r;)if(i(e[n],s)>=0){const t=e[r];e[r]=e[n],e[n]=t,--r}else++n;i(e[n],s)>0&&--n,t<=n?a=n:o=n+1}return e[t]}})),El="sort",Al=he(El,["typed","matrix","compare","compareNatural"],(e=>{let{typed:t,matrix:n,compare:r,compareNatural:i}=e;const o=r,a=(e,t)=>-r(e,t);return t(El,{Array:function(e){return u(e),e.sort(o)},Matrix:function(e){return c(e),n(e.toArray().sort(o),e.storage())},"Array, function":function(e,t){return u(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),n(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return u(e),e.sort(s(t))},"Matrix, string":function(e,t){return c(e),n(e.toArray().sort(s(t)),e.storage())}});function s(e){if("asc"===e)return o;if("desc"===e)return a;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==vr(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),Sl=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:n,numeric:r,larger:i}=e;return t("max",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return oi(e,t.valueOf(),o)},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function max");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Zu(e,"max",t)}}function a(e){let t;if(ri(e,(function(e){try{"number"==typeof e&&isNaN(e)?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Zu(t,"max",e)}})),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=r(t,xe(t,n))),t}})),Ml=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:n,numeric:r,smaller:i}=e;return t("min",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return oi(e,t.valueOf(),o)},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function min");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Zu(e,"min",t)}}function a(e){let t;if(ri(e,(function(e){try{"number"==typeof e&&isNaN(e)?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Zu(t,"min",e)}})),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=r(t,xe(t,n))),t}})),Cl=he("ImmutableDenseMatrix",["smaller","DenseMatrix"],(e=>{let{smaller:t,DenseMatrix:n}=e;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e)||N(e)){const r=new n(e,t);this._data=r._data,this._size=r._size,this._datatype=r._datatype,this._min=null,this._max=null}else if(e&&N(e.data)&&N(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 new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return r.prototype=new n,r.prototype.type="ImmutableDenseMatrix",r.prototype.isImmutableDenseMatrix=!0,r.prototype.subset=function(e){switch(arguments.length){case 1:{const t=n.prototype.subset.call(this,e);return E(t)?new r({data:t._data,size:t._size,datatype:t._datatype}):t}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},r.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},r.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},r.prototype.clone=function(){return new r({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},r.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},r.prototype.min=function(){if(null===this._min){let e=null;this.forEach((function(n){(null===e||t(n,e))&&(e=n)})),this._min=null!==e?e:void 0}return this._min},r.prototype.max=function(){if(null===this._max){let e=null;this.forEach((function(n){(null===e||t(e,n))&&(e=n)})),this._max=null!==e?e:void 0}return this._max},r}),{isClass:!0}),Tl=he("Index",["ImmutableDenseMatrix","getMatrixDataType"],(e=>{let{ImmutableDenseMatrix:t,getMatrixDataType:n}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(let e=0,t=arguments.length;e<t;e++){const t=arguments[e],r=N(t),o=E(t),a=typeof t;let s=null;if(C(t))this._dimensions.push(t),this._isScalar=!1;else if(r||o){let e;"boolean"===n(t)?(r&&(e=i(Bl(t).valueOf())),o&&(e=i(Bl(t._data).valueOf())),s=t.valueOf().length):e=i(t.valueOf()),this._dimensions.push(e);const a=e.size();1===a.length&&1===a[0]&&null===s||(this._isScalar=!1)}else if("number"===a)this._dimensions.push(i([t]));else if("bigint"===a)this._dimensions.push(i([Number(t)]));else{if("string"!==a)throw new TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");this._dimensions.push(t)}this._sourceSize.push(s)}}function i(e){for(let t=0,n=e.length;t<n;t++)if("number"!=typeof e[t]||!ye(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new t(e)}return r.prototype.type="Index",r.prototype.isIndex=!0,r.prototype.clone=function(){const e=new r;return e._dimensions=ae(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},r.create=function(e){const t=new r;return r.apply(t,e),t},r.prototype.size=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e[t]="string"==typeof n?1:n.size()[0]}return e},r.prototype.max=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e[t]="string"==typeof n?n:n.max()}return e},r.prototype.min=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e[t]="string"==typeof n?n:n.min()}return e},r.prototype.forEach=function(e){for(let t=0,n=this._dimensions.length;t<n;t++)e(this._dimensions[t],t,this)},r.prototype.dimension=function(e){return"number"!=typeof e?null:this._dimensions[e]||null},r.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},r.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},r.prototype.isScalar=function(){return this._isScalar},r.prototype.toArray=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];e.push("string"==typeof n?n:n.toArray())}return e},r.prototype.valueOf=r.prototype.toArray,r.prototype.toString=function(){const e=[];for(let t=0,n=this._dimensions.length;t<n;t++){const n=this._dimensions[t];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},r.fromJSON=function(e){return r.create(e.dimensions)},r}),{isClass:!0});function Bl(e){const t=[];return e.forEach(((e,n)=>{e&&t.push(n)})),t}const Dl=he("FibonacciHeap",["smaller","larger"],(e=>{let{smaller:t,larger:n}=e;const r=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function o(e,t,n){t.left.right=t.right,t.right.left=t.left,n.degree--,n.child===t&&(n.child=t.right),0===n.degree&&(n.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function a(e,t){const n=t.parent;n&&(t.mark?(o(e,t,n),a(n)):t.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,n){const r={key:e,value:n,degree:0};if(this._minimum){const n=this._minimum;r.left=n,r.right=n.right,n.right=r,r.right.left=r,t(e,n.key)&&(this._minimum=r)}else r.left=r,r.right=r,this._minimum=r;return this._size++,r},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(){const e=this._minimum;if(null===e)return e;let i=this._minimum,o=e.degree,a=e.child;for(;o>0;){const e=a.right;a.left.right=a.right,a.right.left=a.left,a.left=i,a.right=i.right,i.right=a,a.right.left=a,a.parent=null,a=e,o--}return e.left.right=e.right,e.right.left=e.left,e===e.right?i=null:(i=e.right,i=function(e,i){const o=Math.floor(Math.log(i)*r)+1,a=new Array(o);let u,c=0,l=e;if(l)for(c++,l=l.right;l!==e;)c++,l=l.right;for(;c>0;){let e=l.degree;const t=l.right;for(;u=a[e],u;){if(n(l.key,u.key)){const e=u;u=l,l=e}s(u,l),a[e]=null,e++}a[e]=l,l=t,c--}e=null;for(let n=0;n<o;n++)u=a[n],u&&(e?(u.left.right=u.right,u.right.left=u.left,u.left=e,u.right=e.right,e.right=u,u.right.left=u,t(u.key,e.key)&&(e=u)):e=u);return e}(i,this._size)),this._size--,this._minimum=i,e},i.prototype.remove=function(e){this._minimum=function(e,n){n.key=-1;const r=n.parent;return r&&t(n.key,r.key)&&(o(e,n,r),a(e,r)),t(n.key,e.key)&&(e=n),e}(this._minimum,e),this.extractMinimum()};const s=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1};return i}),{isClass:!0}),Fl=he("Spa",["addScalar","equalScalar","FibonacciHeap"],(e=>{let{addScalar:t,equalScalar:n,FibonacciHeap:r}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new r}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{const n=this._heap.insert(e,t);this._values[e]=n}},i.prototype.get=function(e){const t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,n){let r=this._values[e];r?r.value=t(r.value,n):(r=this._heap.insert(e,n),this._values[e]=r)},i.prototype.forEach=function(e,t,r){const i=this._heap,o=this._values,a=[];let s=i.extractMinimum();for(s&&a.push(s);s&&s.key<=t;)s.key>=e&&(n(s.value,0)||r(s.key,s.value,this)),s=i.extractMinimum(),s&&a.push(s);for(let e=0;e<a.length;e++){const t=a[e];s=i.insert(t.key,t.value),o[s.key]=s}},i.prototype.swap=function(e,t){let n=this._values[e],r=this._values[t];if(!n&&r)n=this._heap.insert(e,r.value),this._heap.remove(r),this._values[e]=n,this._values[t]=void 0;else if(n&&!r)r=this._heap.insert(t,n.value),this._heap.remove(n),this._values[t]=r,this._values[e]=void 0;else if(n&&r){const e=n.value;n.value=r.value,r.value=e}},i}),{isClass:!0});function Ol(e){let t=0,n=1,r=Object.create(null),i=Object.create(null),o=0;const a=function(e){const a=i[e];if(a&&(delete r[a],delete i[e],--t,n===a)){if(!t)return o=0,void(n=1);for(;!Object.prototype.hasOwnProperty.call(r,++n););}};return e=Math.abs(e),{hit:function(s){const u=i[s],c=++o;if(r[c]=s,i[s]=c,!u){if(++t,t<=e)return;return s=r[n],a(s),s}if(delete r[u],n===u)for(;!Object.prototype.hasOwnProperty.call(r,++n););},delete:a,clear:function(){t=o=0,n=1,r=Object.create(null),i=Object.create(null)}}}function _l(e){let{hasher:t,limit:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=null==n?Number.POSITIVE_INFINITY:n,t=null==t?JSON.stringify:t,function r(){"object"!=typeof r.cache&&(r.cache={values:new Map,lru:Ol(n||Number.POSITIVE_INFINITY)});const i=[];for(let e=0;e<arguments.length;e++)i[e]=arguments[e];const o=t(i);if(r.cache.values.has(o))return r.cache.lru.hit(o),r.cache.values.get(o);const a=e.apply(e,i);return r.cache.values.set(o,a),r.cache.values.delete(r.cache.lru.hit(o)),a}}const Il=_l((function(e){return new e(1).exp()}),{hasher:ql}),zl=_l((function(e){return new e(1).plus(new e(5).sqrt()).div(2)}),{hasher:ql}),kl=_l((function(e){return e.acos(-1)}),{hasher:ql}),Rl=_l((function(e){return kl(e).times(2)}),{hasher:ql});function ql(e){return e[0].precision}const Pl=he("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],(e=>{let{on:t,config:n,addScalar:r,subtractScalar:i,multiplyScalar:o,divideScalar:a,pow:s,abs:u,fix:c,round:l,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:y}=e;const b=h;function w(e,t){if(!(this instanceof w))throw new Error("Constructor must be called with the new operator");if(null!=e&&!p(e)&&!x(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===t)this.units=[],this.dimensions=z.map((e=>0));else if("string"==typeof t){const e=w.parse(t);this.units=e.units,this.dimensions=e.dimensions}else{if(!v(t)||null!==t.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map((e=>sr({},e)))}this.value=this._normalize(e)}let N,E,A;function S(){for(;" "===A||"\t"===A;)C()}function M(e){return e>="0"&&e<="9"}function C(){E++,A=N.charAt(E)}function T(e){E=e,A=N.charAt(E)}function B(){let e="";const t=E;if("+"===A?C():"-"===A&&(e+=A,C()),!function(e){return e>="0"&&e<="9"||"."===e}(A))return T(t),null;if("."===A){if(e+=A,C(),!M(A))return T(t),null}else{for(;M(A);)e+=A,C();"."===A&&(e+=A,C())}for(;M(A);)e+=A,C();if("E"===A||"e"===A){let t="";const n=E;if(t+=A,C(),"+"!==A&&"-"!==A||(t+=A,C()),!M(A))return T(n),e;for(e+=t;M(A);)e+=A,C()}return e}function D(){let e="";for(;M(A)||w.isValidAlpha(A);)e+=A,C();const t=e.charAt(0);return w.isValidAlpha(t)?e:null}function F(e){return A===e?(C(),e):null}Object.defineProperty(w,"name",{value:"Unit"}),w.prototype.constructor=w,w.prototype.type="Unit",w.prototype.isUnit=!0,w.parse=function(e,t){if(t=t||{},N=e,E=-1,A="","string"!=typeof N)throw new TypeError("Invalid argument in Unit.parse, string expected");const r=new w;r.units=[];let i=1,o=!1;C(),S();const a=B();let s=null;if(a){if("BigNumber"===n.number)s=new g(a);else if("Fraction"===n.number)try{s=new y(a)}catch(e){s=parseFloat(a)}else s=parseFloat(a);S(),F("*")?(i=1,o=!0):F("/")&&(i=-1,o=!0)}const u=[];let c=1;for(;;){for(S();"("===A;)u.push(i),c*=i,i=1,C(),S();let t;if(!A)break;{const e=A;if(t=D(),null===t)throw new SyntaxError('Unexpected "'+e+'" in "'+N+'" at index '+E.toString())}const n=O(t);if(null===n)throw new SyntaxError('Unit "'+t+'" not found.');let a=i*c;if(S(),F("^")){S();const t=B();if(null===t)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');a*=t}r.units.push({unit:n.unit,prefix:n.prefix,power:a});for(let e=0;e<z.length;e++)r.dimensions[e]+=(n.unit.dimensions[e]||0)*a;for(S();")"===A;){if(0===u.length)throw new SyntaxError('Unmatched ")" in "'+N+'" at index '+E.toString());c/=u.pop(),C(),S()}if(o=!1,F("*")?(i=1,o=!0):F("/")?(i=-1,o=!0):i=1,n.unit.base){const e=n.unit.base.key;U.auto[e]={unit:n.unit,prefix:n.prefix}}}if(S(),A)throw new SyntaxError('Could not parse: "'+e+'"');if(o)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==u.length)throw new SyntaxError('Unmatched "(" in "'+N+'"');if(0===r.units.length&&!t.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return r.value=void 0!==s?r._normalize(s):null,r},w.prototype.clone=function(){const e=new w;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=ae(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(let t=0;t<this.units.length;t++){e.units[t]={};for(const n in this.units[t])me(this.units[t],n)&&(e.units[t][n]=this.units[t][n])}return e},w.prototype.valueType=function(){return oe(this.value)},w.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},w.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;let t=e;const n=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const r=n(this.units[e].unit.value),i=n(this.units[e].prefix.value),a=n(this.units[e].power);t=o(t,s(o(r,i),a))}return t},w.prototype._denormalize=function(e,t){if(null==e||0===this.units.length)return e;let n=e;const r=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const t=r(this.units[e].unit.value),i=r(this.units[e].prefix.value),u=r(this.units[e].power);n=a(n,s(o(t,i),u))}return n};const O=_l((e=>{if(me(q,e)){const t=q[e];return{unit:t,prefix:t.prefixes[""]}}for(const t in q)if(me(q,t)&&fr(e,t)){const n=q[t],r=e.length-t.length,i=e.substring(0,r),o=me(n.prefixes,i)?n.prefixes[i]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null}),{hasher:e=>e[0],limit:100});function _(e){return e.equalBase(k.NONE)&&null!==e.value&&!n.predictable?e.value:e}w.isValuelessUnit=function(e){return null!==O(e)},w.prototype.hasBase=function(e){if("string"==typeof e&&(e=k[e]),!e)return!1;for(let t=0;t<z.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equalBase=function(e){for(let t=0;t<z.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equals=function(e){return this.equalBase(e)&&f(this.value,e.value)},w.prototype.multiply=function(e){const t=this.clone(),n=v(e)?e:new w(e);for(let e=0;e<z.length;e++)t.dimensions[e]=(this.dimensions[e]||0)+(n.dimensions[e]||0);for(let e=0;e<n.units.length;e++){const r={...n.units[e]};t.units.push(r)}if(null!==this.value||null!==n.value){const e=null===this.value?this._normalize(1):this.value,r=null===n.value?n._normalize(1):n.value;t.value=o(e,r)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.divideInto=function(e){return new w(e).divide(this)},w.prototype.divide=function(e){const t=this.clone(),n=v(e)?e:new w(e);for(let e=0;e<z.length;e++)t.dimensions[e]=(this.dimensions[e]||0)-(n.dimensions[e]||0);for(let e=0;e<n.units.length;e++){const r={...n.units[e],power:-n.units[e].power};t.units.push(r)}if(null!==this.value||null!==n.value){const e=null===this.value?this._normalize(1):this.value,r=null===n.value?n._normalize(1):n.value;t.value=a(e,r)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.pow=function(e){const t=this.clone();for(let n=0;n<z.length;n++)t.dimensions[n]=(this.dimensions[n]||0)*e;for(let n=0;n<t.units.length;n++)t.units[n].power*=e;return null!==t.value?t.value=s(t.value,e):t.value=null,t.skipAutomaticSimplification=!1,_(t)},w.prototype.abs=function(){const e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units.length||0===e.units[0].unit.offset)e.value=u(e.value);else{const t=e._numberConverter(),n=t(e.units[0].unit.value),a=t(e.units[0].unit.offset),s=o(n,a);e.value=i(u(r(e.value,s)),s)}for(const t in e.units)"VA"!==e.units[t].unit.name&&"VAR"!==e.units[t].unit.name||(e.units[t].unit=q.W);return e},w.prototype.to=function(e){const t=null===this.value?this._normalize(1):this.value;let n;if("string"==typeof e)n=w.parse(e);else{if(!v(e))throw new Error("String or Unit expected as parameter");n=e.clone()}if(!this.equalBase(n))throw new Error(`Units do not match ('${n.toString()}' != '${this.toString()}')`);if(null!==n.value)throw new Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||0===this.units.length||0===n.units.length||this.units[0].unit.offset===n.units[0].unit.offset)n.value=ae(t);else{const e=w._getNumberConverter(oe(t)),a=this.units[0].unit.value,s=this.units[0].unit.offset,u=o(a,s),c=n.units[0].unit.value,l=n.units[0].unit.offset,f=o(c,l);n.value=r(t,e(i(u,f)))}return n.fixPrefix=!0,n.skipAutomaticSimplification=!0,n},w.prototype.toNumber=function(e){return b(this.toNumeric(e))},w.prototype.toNumeric=function(e){let t;return t=e?this.to(e):this.clone(),t._isDerived()||0===t.units.length?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},w.prototype.toString=function(){return this.format()},w.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},w.fromJSON=function(e){var t;const n=new w(e.value,null!==(t=e.unit)&&void 0!==t?t:void 0);return n.fixPrefix=e.fixPrefix||!1,n},w.prototype.valueOf=w.prototype.toString,w.prototype.simplify=function(){const e=this.clone(),t=[];let n;for(const t in L)if(me(L,t)&&e.hasBase(k[t])){n=t;break}if("NONE"===n)e.units=[];else{let r;if(n&&me(L,n)&&(r=L[n]),r)e.units=[{unit:r.unit,prefix:r.prefix,power:1}];else{let n=!1;for(let r=0;r<z.length;r++){const i=z[r];Math.abs(e.dimensions[r]||0)>1e-12&&(me(L,i)?t.push({unit:L[i].unit,prefix:L[i].prefix,power:e.dimensions[r]||0}):n=!0)}t.length<e.units.length&&!n&&(e.units=t)}}return e},w.prototype.toSI=function(){const e=this.clone(),t=[];for(let n=0;n<z.length;n++){const r=z[n];if(Math.abs(e.dimensions[n]||0)>1e-12){if(!me(U.si,r))throw new Error("Cannot express custom unit "+r+" in SI units");t.push({unit:U.si[r].unit,prefix:U.si[r].prefix,power:e.dimensions[n]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value?(e.value=null,this.to(e)):e},w.prototype.formatUnits=function(){let e="",t="",n=0,r=0;for(let t=0;t<this.units.length;t++)this.units[t].power>0?(n++,e+=" "+this.units[t].prefix.name+this.units[t].unit.name,Math.abs(this.units[t].power-1)>1e-15&&(e+="^"+this.units[t].power)):this.units[t].power<0&&r++;if(r>0)for(let e=0;e<this.units.length;e++)this.units[e].power<0&&(n>0?(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,Math.abs(this.units[e].power+1)>1e-15&&(t+="^"+-this.units[e].power)):(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,t+="^"+this.units[e].power));e=e.substr(1),t=t.substr(1),n>1&&r>0&&(e="("+e+")"),r>1&&n>0&&(t="("+t+")");let i=e;return n>0&&r>0&&(i+=" / "),i+=t,i},w.prototype.format=function(e){const t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify();let n=!1;void 0!==t.value&&null!==t.value&&x(t.value)&&(n=Math.abs(t.value.re)<1e-14);for(const e in t.units)me(t.units,e)&&t.units[e].unit&&("VA"===t.units[e].unit.name&&n?t.units[e].unit=q.VAR:"VAR"!==t.units[e].unit.name||n||(t.units[e].unit=q.VA));1!==t.units.length||t.fixPrefix||Math.abs(t.units[0].power-Math.round(t.units[0].power))<1e-14&&(t.units[0].prefix=t._bestPrefix());const r=t._denormalize(t.value);let i=null!==t.value?m(r,e||{}):"";const o=t.formatUnits();return t.value&&x(t.value)&&(i="("+i+")"),o.length>0&&i.length>0&&(i+=" "),i+=o,i},w.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");const e=null!==this.value?u(this.value):0,t=u(this.units[0].unit.value);let n=this.units[0].prefix;if(0===e)return n;const r=this.units[0].power;let i=Math.log(e/Math.pow(n.value*t,r))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return n;i=Math.abs(i);const o=this.units[0].unit.prefixes;for(const a in o)if(me(o,a)){const s=o[a];if(s.scientific){const o=Math.abs(Math.log(e/Math.pow(s.value*t,r))/Math.LN10-1.2);(o<i||o===i&&s.name.length<n.name.length)&&(n=s,i=o)}}return n},w.prototype.splitUnit=function(e){let t=this.clone();const n=[];for(let r=0;r<e.length&&(t=t.to(e[r]),r!==e.length-1);r++){const o=t.toNumeric(),a=l(o);let s;s=f(a,o)?a:c(t.toNumeric());const u=new w(s,e[r].toString());n.push(u),t=i(t,u)}let o=0;for(let e=0;e<n.length;e++)o=r(o,n[e].value);return f(o,this.value)&&(t.value=0),n.push(t),n};const I={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},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:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),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:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};I.SHORTLONG=sr({},I.SHORT,I.LONG),I.BINARY_SHORT=sr({},I.BINARY_SHORT_SI,I.BINARY_SHORT_IEC),I.BINARY_LONG=sr({},I.BINARY_LONG_SI,I.BINARY_LONG_IEC);const z=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],k={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(const e in k)me(k,e)&&(k[e].key=e);const R={name:"",base:{},value:1,offset:0,dimensions:z.map((e=>0))},q={meter:{name:"meter",base:k.LENGTH,prefixes:I.LONG,value:1,offset:0},inch:{name:"inch",base:k.LENGTH,prefixes:I.NONE,value:.0254,offset:0},foot:{name:"foot",base:k.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yard:{name:"yard",base:k.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mile:{name:"mile",base:k.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},link:{name:"link",base:k.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rod:{name:"rod",base:k.LENGTH,prefixes:I.NONE,value:5.0292,offset:0},chain:{name:"chain",base:k.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:k.LENGTH,prefixes:I.NONE,value:1e-10,offset:0},m:{name:"m",base:k.LENGTH,prefixes:I.SHORT,value:1,offset:0},in:{name:"in",base:k.LENGTH,prefixes:I.NONE,value:.0254,offset:0},ft:{name:"ft",base:k.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yd:{name:"yd",base:k.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mi:{name:"mi",base:k.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},li:{name:"li",base:k.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rd:{name:"rd",base:k.LENGTH,prefixes:I.NONE,value:5.02921,offset:0},ch:{name:"ch",base:k.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},mil:{name:"mil",base:k.LENGTH,prefixes:I.NONE,value:254e-7,offset:0},m2:{name:"m2",base:k.SURFACE,prefixes:I.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:k.SURFACE,prefixes:I.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:k.SURFACE,prefixes:I.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:k.SURFACE,prefixes:I.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:k.SURFACE,prefixes:I.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:k.SURFACE,prefixes:I.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:k.SURFACE,prefixes:I.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:k.SURFACE,prefixes:I.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:k.SURFACE,prefixes:I.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:k.SURFACE,prefixes:I.NONE,value:1e4,offset:0},m3:{name:"m3",base:k.VOLUME,prefixes:I.CUBIC,value:1,offset:0},L:{name:"L",base:k.VOLUME,prefixes:I.SHORT,value:.001,offset:0},l:{name:"l",base:k.VOLUME,prefixes:I.SHORT,value:.001,offset:0},litre:{name:"litre",base:k.VOLUME,prefixes:I.LONG,value:.001,offset:0},cuin:{name:"cuin",base:k.VOLUME,prefixes:I.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:k.VOLUME,prefixes:I.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:k.VOLUME,prefixes:I.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:k.VOLUME,prefixes:I.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:k.VOLUME,prefixes:I.NONE,value:15e-6,offset:0},drop:{name:"drop",base:k.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:k.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},minim:{name:"minim",base:k.VOLUME,prefixes:I.NONE,value:6.1611519921875e-8,offset:0},fluiddram:{name:"fluiddram",base:k.VOLUME,prefixes:I.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:k.VOLUME,prefixes:I.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:k.VOLUME,prefixes:I.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:k.VOLUME,prefixes:I.NONE,value:1e-6,offset:0},cup:{name:"cup",base:k.VOLUME,prefixes:I.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:k.VOLUME,prefixes:I.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:k.VOLUME,prefixes:I.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:k.VOLUME,prefixes:I.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:k.VOLUME,prefixes:I.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:k.VOLUME,prefixes:I.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:k.VOLUME,prefixes:I.NONE,value:.238480942392,offset:0},g:{name:"g",base:k.MASS,prefixes:I.SHORT,value:.001,offset:0},gram:{name:"gram",base:k.MASS,prefixes:I.LONG,value:.001,offset:0},ton:{name:"ton",base:k.MASS,prefixes:I.SHORT,value:907.18474,offset:0},t:{name:"t",base:k.MASS,prefixes:I.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:k.MASS,prefixes:I.LONG,value:1e3,offset:0},grain:{name:"grain",base:k.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:k.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:k.MASS,prefixes:I.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:k.MASS,prefixes:I.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:k.MASS,prefixes:I.NONE,value:45.359237,offset:0},stick:{name:"stick",base:k.MASS,prefixes:I.NONE,value:.115,offset:0},stone:{name:"stone",base:k.MASS,prefixes:I.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:k.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:k.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:k.MASS,prefixes:I.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:k.MASS,prefixes:I.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:k.MASS,prefixes:I.NONE,value:45.359237,offset:0},s:{name:"s",base:k.TIME,prefixes:I.SHORT,value:1,offset:0},min:{name:"min",base:k.TIME,prefixes:I.NONE,value:60,offset:0},h:{name:"h",base:k.TIME,prefixes:I.NONE,value:3600,offset:0},second:{name:"second",base:k.TIME,prefixes:I.LONG,value:1,offset:0},sec:{name:"sec",base:k.TIME,prefixes:I.LONG,value:1,offset:0},minute:{name:"minute",base:k.TIME,prefixes:I.NONE,value:60,offset:0},hour:{name:"hour",base:k.TIME,prefixes:I.NONE,value:3600,offset:0},day:{name:"day",base:k.TIME,prefixes:I.NONE,value:86400,offset:0},week:{name:"week",base:k.TIME,prefixes:I.NONE,value:604800,offset:0},month:{name:"month",base:k.TIME,prefixes:I.NONE,value:2629800,offset:0},year:{name:"year",base:k.TIME,prefixes:I.NONE,value:31557600,offset:0},decade:{name:"decade",base:k.TIME,prefixes:I.NONE,value:315576e3,offset:0},century:{name:"century",base:k.TIME,prefixes:I.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:k.TIME,prefixes:I.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:k.FREQUENCY,prefixes:I.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:k.FREQUENCY,prefixes:I.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:k.ANGLE,prefixes:I.SHORT,value:1,offset:0},radian:{name:"radian",base:k.ANGLE,prefixes:I.LONG,value:1,offset:0},deg:{name:"deg",base:k.ANGLE,prefixes:I.SHORT,value:null,offset:0},degree:{name:"degree",base:k.ANGLE,prefixes:I.LONG,value:null,offset:0},grad:{name:"grad",base:k.ANGLE,prefixes:I.SHORT,value:null,offset:0},gradian:{name:"gradian",base:k.ANGLE,prefixes:I.LONG,value:null,offset:0},cycle:{name:"cycle",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},A:{name:"A",base:k.CURRENT,prefixes:I.SHORT,value:1,offset:0},ampere:{name:"ampere",base:k.CURRENT,prefixes:I.LONG,value:1,offset:0},K:{name:"K",base:k.TEMPERATURE,prefixes:I.SHORT,value:1,offset:0},degC:{name:"degC",base:k.TEMPERATURE,prefixes:I.SHORT,value:1,offset:273.15},degF:{name:"degF",base:k.TEMPERATURE,prefixes:I.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:k.TEMPERATURE,prefixes:I.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:k.TEMPERATURE,prefixes:I.LONG,value:1,offset:0},celsius:{name:"celsius",base:k.TEMPERATURE,prefixes:I.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:k.TEMPERATURE,prefixes:I.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:k.TEMPERATURE,prefixes:I.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:k.AMOUNT_OF_SUBSTANCE,prefixes:I.SHORT,value:1,offset:0},mole:{name:"mole",base:k.AMOUNT_OF_SUBSTANCE,prefixes:I.LONG,value:1,offset:0},cd:{name:"cd",base:k.LUMINOUS_INTENSITY,prefixes:I.SHORT,value:1,offset:0},candela:{name:"candela",base:k.LUMINOUS_INTENSITY,prefixes:I.LONG,value:1,offset:0},N:{name:"N",base:k.FORCE,prefixes:I.SHORT,value:1,offset:0},newton:{name:"newton",base:k.FORCE,prefixes:I.LONG,value:1,offset:0},dyn:{name:"dyn",base:k.FORCE,prefixes:I.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:k.FORCE,prefixes:I.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:k.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:k.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:k.FORCE,prefixes:I.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:k.FORCE,prefixes:I.NONE,value:9.80665,offset:0},J:{name:"J",base:k.ENERGY,prefixes:I.SHORT,value:1,offset:0},joule:{name:"joule",base:k.ENERGY,prefixes:I.LONG,value:1,offset:0},erg:{name:"erg",base:k.ENERGY,prefixes:I.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:k.ENERGY,prefixes:I.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:k.ENERGY,prefixes:I.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:k.ENERGY,prefixes:I.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:k.ENERGY,prefixes:I.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:k.POWER,prefixes:I.SHORT,value:1,offset:0},watt:{name:"watt",base:k.POWER,prefixes:I.LONG,value:1,offset:0},hp:{name:"hp",base:k.POWER,prefixes:I.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:k.POWER,prefixes:I.SHORT,value:d.I,offset:0},VA:{name:"VA",base:k.POWER,prefixes:I.SHORT,value:1,offset:0},Pa:{name:"Pa",base:k.PRESSURE,prefixes:I.SHORT,value:1,offset:0},psi:{name:"psi",base:k.PRESSURE,prefixes:I.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:k.PRESSURE,prefixes:I.NONE,value:101325,offset:0},bar:{name:"bar",base:k.PRESSURE,prefixes:I.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:k.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:k.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:k.PRESSURE,prefixes:I.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:k.PRESSURE,prefixes:I.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:k.ELECTRIC_CHARGE,prefixes:I.LONG,value:1,offset:0},C:{name:"C",base:k.ELECTRIC_CHARGE,prefixes:I.SHORT,value:1,offset:0},farad:{name:"farad",base:k.ELECTRIC_CAPACITANCE,prefixes:I.LONG,value:1,offset:0},F:{name:"F",base:k.ELECTRIC_CAPACITANCE,prefixes:I.SHORT,value:1,offset:0},volt:{name:"volt",base:k.ELECTRIC_POTENTIAL,prefixes:I.LONG,value:1,offset:0},V:{name:"V",base:k.ELECTRIC_POTENTIAL,prefixes:I.SHORT,value:1,offset:0},ohm:{name:"ohm",base:k.ELECTRIC_RESISTANCE,prefixes:I.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:k.ELECTRIC_INDUCTANCE,prefixes:I.LONG,value:1,offset:0},H:{name:"H",base:k.ELECTRIC_INDUCTANCE,prefixes:I.SHORT,value:1,offset:0},siemens:{name:"siemens",base:k.ELECTRIC_CONDUCTANCE,prefixes:I.LONG,value:1,offset:0},S:{name:"S",base:k.ELECTRIC_CONDUCTANCE,prefixes:I.SHORT,value:1,offset:0},weber:{name:"weber",base:k.MAGNETIC_FLUX,prefixes:I.LONG,value:1,offset:0},Wb:{name:"Wb",base:k.MAGNETIC_FLUX,prefixes:I.SHORT,value:1,offset:0},tesla:{name:"tesla",base:k.MAGNETIC_FLUX_DENSITY,prefixes:I.LONG,value:1,offset:0},T:{name:"T",base:k.MAGNETIC_FLUX_DENSITY,prefixes:I.SHORT,value:1,offset:0},b:{name:"b",base:k.BIT,prefixes:I.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:k.BIT,prefixes:I.BINARY_LONG,value:1,offset:0},B:{name:"B",base:k.BIT,prefixes:I.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:k.BIT,prefixes:I.BINARY_LONG,value:8,offset:0}},P={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 j(e){if("BigNumber"===e.number){const e=kl(g);q.rad.value=new g(1),q.deg.value=e.div(180),q.grad.value=e.div(200),q.cycle.value=e.times(2),q.arcsec.value=e.div(648e3),q.arcmin.value=e.div(10800)}else q.rad.value=1,q.deg.value=Math.PI/180,q.grad.value=Math.PI/200,q.cycle.value=2*Math.PI,q.arcsec.value=Math.PI/648e3,q.arcmin.value=Math.PI/10800;q.radian.value=q.rad.value,q.degree.value=q.deg.value,q.gradian.value=q.grad.value}j(n),t&&t("config",(function(e,t){e.number!==t.number&&j(e)}));const U={si:{NONE:{unit:R,prefix:I.NONE[""]},LENGTH:{unit:q.m,prefix:I.SHORT[""]},MASS:{unit:q.g,prefix:I.SHORT.k},TIME:{unit:q.s,prefix:I.SHORT[""]},CURRENT:{unit:q.A,prefix:I.SHORT[""]},TEMPERATURE:{unit:q.K,prefix:I.SHORT[""]},LUMINOUS_INTENSITY:{unit:q.cd,prefix:I.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:q.mol,prefix:I.SHORT[""]},ANGLE:{unit:q.rad,prefix:I.SHORT[""]},BIT:{unit:q.bits,prefix:I.SHORT[""]},FORCE:{unit:q.N,prefix:I.SHORT[""]},ENERGY:{unit:q.J,prefix:I.SHORT[""]},POWER:{unit:q.W,prefix:I.SHORT[""]},PRESSURE:{unit:q.Pa,prefix:I.SHORT[""]},ELECTRIC_CHARGE:{unit:q.C,prefix:I.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:q.F,prefix:I.SHORT[""]},ELECTRIC_POTENTIAL:{unit:q.V,prefix:I.SHORT[""]},ELECTRIC_RESISTANCE:{unit:q.ohm,prefix:I.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:q.H,prefix:I.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:q.S,prefix:I.SHORT[""]},MAGNETIC_FLUX:{unit:q.Wb,prefix:I.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:q.T,prefix:I.SHORT[""]},FREQUENCY:{unit:q.Hz,prefix:I.SHORT[""]}}};U.cgs=JSON.parse(JSON.stringify(U.si)),U.cgs.LENGTH={unit:q.m,prefix:I.SHORT.c},U.cgs.MASS={unit:q.g,prefix:I.SHORT[""]},U.cgs.FORCE={unit:q.dyn,prefix:I.SHORT[""]},U.cgs.ENERGY={unit:q.erg,prefix:I.NONE[""]},U.us=JSON.parse(JSON.stringify(U.si)),U.us.LENGTH={unit:q.ft,prefix:I.NONE[""]},U.us.MASS={unit:q.lbm,prefix:I.NONE[""]},U.us.TEMPERATURE={unit:q.degF,prefix:I.NONE[""]},U.us.FORCE={unit:q.lbf,prefix:I.NONE[""]},U.us.ENERGY={unit:q.BTU,prefix:I.BTU[""]},U.us.POWER={unit:q.hp,prefix:I.NONE[""]},U.us.PRESSURE={unit:q.psi,prefix:I.NONE[""]},U.auto=JSON.parse(JSON.stringify(U.si));let L=U.auto;w.setUnitSystem=function(e){if(!me(U,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(U).join(", "));L=U[e]},w.getUnitSystem=function(){for(const e in U)if(me(U,e)&&U[e]===L)return e},w.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new g(String(e.n)).div(String(e.d)).times(String(e.s)):new g(e+"")},Fraction:function(e){return new y(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?h(e):e}},w.prototype._numberConverter=function(){const e=w.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},w._getNumberConverter=function(e){if(!w.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return w.typeConverters[e]};for(const e in q)if(me(q,e)){const t=q[e];t.dimensions=t.base.dimensions}for(const e in P)if(me(P,e)){const t=q[P[e]],n={};for(const e in t)me(t,e)&&(n[e]=t[e]);n.name=e,q[e]=n}return w.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},w.createUnit=function(e,t){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(const t in e)if(me(e,t)&&w.deleteUnit(t),e[t].aliases)for(let n=0;n<e[t].aliases.length;n++)w.deleteUnit(e[t].aliases[n]);let n;for(const t in e)me(e,t)&&(n=w.createUnitSingle(t,e[t]));return n},w.createUnitSingle=function(e,t){if(null==t&&(t={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(me(q,e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(let t=0;t<e.length;t++){if(A=e.charAt(t),0===t&&!w.isValidAlpha(A))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!w.isValidAlpha(A)&&!M(A))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);let n,r,i,o=null,a=[],s=0;if(t&&"Unit"===t.type)o=t.clone();else if("string"==typeof t)""!==t&&(n=t);else{if("object"!=typeof t)throw new TypeError('Cannot create unit "'+e+'" from "'+t.toString()+'": expecting "string" or "Unit" or "Object"');n=t.definition,r=t.prefixes,s=t.offset,i=t.baseName,t.aliases&&(a=t.aliases.valueOf())}if(a)for(let e=0;e<a.length;e++)if(me(q,a[e]))throw new Error('Cannot create alias "'+a[e]+'": a unit with that name already exists');if(n&&"string"==typeof n&&!o)try{o=w.parse(n,{allowNoUnits:!0})}catch(t){throw t.message='Could not create unit "'+e+'" from "'+n+'": '+t.message,t}else n&&"Unit"===n.type&&(o=n.clone());a=a||[],s=s||0,r=r&&r.toUpperCase&&I[r.toUpperCase()]||I.NONE;let u={};if(o){u={name:e,value:o.value,dimensions:o.dimensions.slice(0),prefixes:r,offset:s};let t=!1;for(const e in k)if(me(k,e)){let n=!0;for(let t=0;t<z.length;t++)if(Math.abs((u.dimensions[t]||0)-(k[e].dimensions[t]||0))>1e-12){n=!1;break}if(n){t=!0,u.base=k[e];break}}if(!t){i=i||e+"_STUFF";const t={dimensions:o.dimensions.slice(0)};t.key=i,k[i]=t,L[i]={unit:u,prefix:I.NONE[""]},u.base=k[i]}}else{if(i=i||e+"_STUFF",z.indexOf(i)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');z.push(i);for(const e in k)me(k,e)&&(k[e].dimensions[z.length-1]=0);const t={dimensions:[]};for(let e=0;e<z.length;e++)t.dimensions[e]=0;t.dimensions[z.length-1]=1,t.key=i,k[i]=t,u={name:e,value:1,dimensions:k[i].dimensions.slice(0),prefixes:r,offset:s,base:k[i]},L[i]={unit:u,prefix:I.NONE[""]}}w.UNITS[e]=u;for(let e=0;e<a.length;e++){const t=a[e],n={};for(const e in u)me(u,e)&&(n[e]=u[e]);n.name=t,w.UNITS[t]=n}return delete O.cache,new w(null,e)},w.deleteUnit=function(e){delete w.UNITS[e],delete O.cache},w.PREFIXES=I,w.BASE_DIMENSIONS=z,w.BASE_UNITS=k,w.UNIT_SYSTEMS=U,w.UNITS=q,w}),{isClass:!0}),jl="unit",Ul=he(jl,["typed","Unit"],(e=>{let{typed:t,Unit:n}=e;return t(jl,{Unit:function(e){return e.clone()},string:function(e){return n.isValuelessUnit(e)?new n(null,e):n.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new n(e,t)},"number | BigNumber | Fraction":function(e){return new n(e)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ll="sparse",$l=he(Ll,["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:n}=e;return t(Ll,{"":function(){return new n([])},string:function(e){return new n([],e)},"Array | Matrix":function(e){return new n(e)},"Array | Matrix, string":function(e,t){return new n(e,t)}})})),Hl="createUnit",Gl=he(Hl,["typed","Unit"],(e=>{let{typed:t,Unit:n}=e;return t(Hl,{"Object, Object":function(e,t){return n.createUnit(e,t)},Object:function(e){return n.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,r){const i={};return i[e]=t,n.createUnit(i,r)},"string, Unit | string | Object":function(e,t){const r={};return r[e]=t,n.createUnit(r,{})},string:function(e){const t={};return t[e]={},n.createUnit(t,{})}})})),Vl="acos",Zl=he(Vl,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Vl,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.acos(e):new r(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),Wl="number";function Yl(e){return Ie(e)}function Jl(e){return Math.atan(1/e)}function Xl(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function Ql(e){return Math.asin(1/e)}function Kl(e){const t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function ef(e){return Math.acos(1/e)}function tf(e){const t=1/e,n=Math.sqrt(t*t-1);return Math.log(n+t)}function nf(e){return ze(e)}function rf(e){return ke(e)}function of(e){return 1/Math.tan(e)}function af(e){const t=Math.exp(2*e);return(t+1)/(t-1)}function sf(e){return 1/Math.sin(e)}function uf(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*be(e)}function cf(e){return 1/Math.cos(e)}function lf(e){return 2/(Math.exp(e)+Math.exp(-e))}function ff(e){return qe(e)}Yl.signature=Wl,Jl.signature=Wl,Xl.signature=Wl,Ql.signature=Wl,Kl.signature=Wl,ef.signature=Wl,tf.signature=Wl,nf.signature=Wl,rf.signature=Wl,of.signature=Wl,af.signature=Wl,sf.signature=Wl,uf.signature=Wl,cf.signature=Wl,lf.signature=Wl,ff.signature=Wl;const pf="acosh",mf=he(pf,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(pf,{number:function(e){return e>=1||n.predictable?Yl(e):e<=-1?new r(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new r(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})})),hf="acot",df=he(hf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(hf,{number:Jl,Complex:function(e){return e.acot()},BigNumber:function(e){return new n(1).div(e).atan()}})})),gf="acoth",yf=he(gf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(gf,{number:function(e){return e>=1||e<=-1||n.predictable?Xl(e):new r(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),xf="acsc",bf=he(xf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(xf,{number:function(e){return e<=-1||e>=1||n.predictable?Ql(e):new r(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),vf="acsch",wf=he(vf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(vf,{number:Kl,Complex:function(e){return e.acsch()},BigNumber:function(e){return new n(1).div(e).asinh()}})})),Nf="asec",Ef=he(Nf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Nf,{number:function(e){return e<=-1||e>=1||n.predictable?ef(e):new r(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),Af="asech",Sf=he(Af,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:n,Complex:r,BigNumber:i}=e;return t(Af,{number:function(e){if(e<=1&&e>=-1||n.predictable){const t=1/e;if(t>0||n.predictable)return tf(e);const i=Math.sqrt(t*t-1);return new r(Math.log(i-t),Math.PI)}return new r(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),Mf="asin",Cf=he(Mf,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Mf,{number:function(e){return e>=-1&&e<=1||n.predictable?Math.asin(e):new r(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),Tf=he("asinh",["typed"],(e=>{let{typed:t}=e;return t("asinh",{number:nf,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),Bf=he("atan",["typed"],(e=>{let{typed:t}=e;return t("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),Df="atan2",Ff=he(Df,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,BigNumber:i,DenseMatrix:o,concat:a}=e;const s=ra({typed:t,equalScalar:r}),u=ia({typed:t}),c=$a({typed:t,equalScalar:r}),l=zo({typed:t,equalScalar:r}),f=ko({typed:t,DenseMatrix:o}),p=ua({typed:t,matrix:n,concat:a});return t(Df,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,t)=>i.atan2(e,t)},p({scalar:"number | BigNumber",SS:c,DS:u,SD:s,Ss:l,sS:f}))})),Of="atanh",_f=he(Of,["typed","config","Complex"],(e=>{let{typed:t,config:n,Complex:r}=e;return t(Of,{number:function(e){return e<=1&&e>=-1||n.predictable?rf(e):new r(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),If=he("trigUnit",["typed"],(e=>{let{typed:t}=e;return{Unit:t.referToSelf((e=>n=>{if(!n.hasBase(n.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(e,n.valueType())(n.value)}))}})),zf=he("cos",["typed"],(e=>{let{typed:t}=e;const n=If({typed:t});return t("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},n)})),kf="cosh",Rf=he(kf,["typed"],(e=>{let{typed:t}=e;return t(kf,{number:Re,"Complex | BigNumber":e=>e.cosh()})})),qf=he("cot",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("cot",{number:of,Complex:e=>e.cot(),BigNumber:e=>new n(1).div(e.tan())},If({typed:t}))})),Pf="coth",jf=he(Pf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Pf,{number:af,Complex:e=>e.coth(),BigNumber:e=>new n(1).div(e.tanh())})})),Uf=he("csc",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("csc",{number:sf,Complex:e=>e.csc(),BigNumber:e=>new n(1).div(e.sin())},If({typed:t}))})),Lf="csch",$f=he(Lf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Lf,{number:uf,Complex:e=>e.csch(),BigNumber:e=>new n(1).div(e.sinh())})})),Hf=he("sec",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t("sec",{number:cf,Complex:e=>e.sec(),BigNumber:e=>new n(1).div(e.cos())},If({typed:t}))})),Gf="sech",Vf=he(Gf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:n}=e;return t(Gf,{number:lf,Complex:e=>e.sech(),BigNumber:e=>new n(1).div(e.cosh())})})),Zf=he("sin",["typed"],(e=>{let{typed:t}=e;const n=If({typed:t});return t("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},n)})),Wf="sinh",Yf=he(Wf,["typed"],(e=>{let{typed:t}=e;return t(Wf,{number:ff,"Complex | BigNumber":e=>e.sinh()})})),Jf=he("tan",["typed"],(e=>{let{typed:t}=e;const n=If({typed:t});return t("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},n)})),Xf=he("tanh",["typed"],(e=>{let{typed:t}=e;return t("tanh",{number:Pe,"Complex | BigNumber":e=>e.tanh()})})),Qf="setCartesian",Kf=he(Qf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Qf,{"Array | Matrix, Array | Matrix":function(e,t){let s=[];if(0!==r(n(e),new o(0))&&0!==r(n(t),new o(0))){const n=zr(Array.isArray(e)?e:e.toArray()).sort(i),r=zr(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)s.push([n[e],r[t]])}return Array.isArray(e)&&Array.isArray(t)?s:new a(s)}})})),ep="setDifference",tp=he(ep,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(ep,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===r(n(e),new o(0)))s=[];else{if(0===r(n(t),new o(0)))return zr(e.toArray());{const n=jr(zr(Array.isArray(e)?e:e.toArray()).sort(i)),r=jr(zr(Array.isArray(t)?t:t.toArray()).sort(i));let o;s=[];for(let e=0;e<n.length;e++){o=!1;for(let t=0;t<r.length;t++)if(0===i(n[e].value,r[t].value)&&n[e].identifier===r[t].identifier){o=!0;break}o||s.push(n[e])}}}return Array.isArray(e)&&Array.isArray(t)?Ur(s):new a(Ur(s))}})})),np="setDistinct",rp=he(np,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(np,{"Array | Matrix":function(e){let t;if(0===r(n(e),new o(0)))t=[];else{const n=zr(Array.isArray(e)?e:e.toArray()).sort(i);t=[],t.push(n[0]);for(let e=1;e<n.length;e++)0!==i(n[e],n[e-1])&&t.push(n[e])}return Array.isArray(e)?t:new a(t)}})})),ip="setIntersect",op=he(ip,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(ip,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===r(n(e),new o(0))||0===r(n(t),new o(0)))s=[];else{const n=jr(zr(Array.isArray(e)?e:e.toArray()).sort(i)),r=jr(zr(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++)if(0===i(n[e].value,r[t].value)&&n[e].identifier===r[t].identifier){s.push(n[e]);break}}return Array.isArray(e)&&Array.isArray(t)?Ur(s):new a(Ur(s))}})})),ap="setIsSubset",sp=he(ap,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(ap,{"Array | Matrix, Array | Matrix":function(e,t){if(0===r(n(e),new o(0)))return!0;if(0===r(n(t),new o(0)))return!1;const a=jr(zr(Array.isArray(e)?e:e.toArray()).sort(i)),s=jr(zr(Array.isArray(t)?t:t.toArray()).sort(i));let u;for(let e=0;e<a.length;e++){u=!1;for(let t=0;t<s.length;t++)if(0===i(a[e].value,s[t].value)&&a[e].identifier===s[t].identifier){u=!0;break}if(!1===u)return!1}return!0}})})),up="setMultiplicity",cp=he(up,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(up,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===r(n(t),new o(0)))return 0;const a=zr(Array.isArray(t)?t:t.toArray());let s=0;for(let t=0;t<a.length;t++)0===i(a[t],e)&&s++;return s}})})),lp="setPowerset",fp=he(lp,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:n,subset:r,compareNatural:i,Index:o}=e;return t(lp,{"Array | Matrix":function(e){if(0===r(n(e),new o(0)))return[];const t=zr(Array.isArray(e)?e:e.toArray()).sort(i),s=[];let u=0;for(;u.toString(2).length<=t.length;)s.push(a(t,u.toString(2).split("").reverse())),u++;return function(e){let t=[];for(let n=e.length-1;n>0;n--)for(let r=0;r<n;r++)e[r].length>e[r+1].length&&(t=e[r],e[r]=e[r+1],e[r+1]=t);return e}(s)}});function a(e,t){const n=[];for(let r=0;r<t.length;r++)"1"===t[r]&&n.push(e[r]);return n}})),pp="setSize",mp=he(pp,["typed","compareNatural"],(e=>{let{typed:t,compareNatural:n}=e;return t(pp,{"Array | Matrix":function(e){return Array.isArray(e)?zr(e).length:zr(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return Array.isArray(e)?zr(e).length:zr(e.toArray()).length;{const t=zr(Array.isArray(e)?e:e.toArray()).sort(n);let r=1;for(let e=1;e<t.length;e++)0!==n(t[e],t[e-1])&&r++;return r}}})})),hp="setSymDifference",dp=he(hp,["typed","size","concat","subset","setDifference","Index"],(e=>{let{typed:t,size:n,concat:r,subset:i,setDifference:o,Index:a}=e;return t(hp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(n(e),new a(0)))return zr(t);if(0===i(n(t),new a(0)))return zr(e);const s=zr(e),u=zr(t);return r(o(s,u),o(u,s))}})})),gp="setUnion",yp=he(gp,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],(e=>{let{typed:t,size:n,concat:r,subset:i,setIntersect:o,setSymDifference:a,Index:s}=e;return t(gp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(n(e),new s(0)))return zr(t);if(0===i(n(t),new s(0)))return zr(e);const u=zr(e),c=zr(t);return r(a(u,c),o(u,c))}})})),xp=he("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],(e=>{let{typed:t,matrix:n,addScalar:r,equalScalar:i,DenseMatrix:o,SparseMatrix:a,concat:s}=e;const u=la({typed:t}),c=fa({typed:t,equalScalar:i}),l=pa({typed:t,DenseMatrix:o}),f=ua({typed:t,matrix:n,concat:s});return t("add",{"any, any":r,"any, any, ...any":t.referToSelf((e=>(t,n,r)=>{let i=e(t,n);for(let t=0;t<r.length;t++)i=e(i,r[t]);return i}))},f({elop:r,DS:u,SS:c,Ss:l}))})),bp="hypot",vp=he(bp,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],(e=>{let{typed:t,abs:n,addScalar:r,divideScalar:i,multiplyScalar:o,sqrt:a,smaller:s,isPositive:u}=e;return t(bp,{"... number | BigNumber":c,Array:c,Matrix:e=>c(zr(e.toArray()))});function c(e){let t=0,c=0;for(let a=0;a<e.length;a++){if(x(e[a]))throw new TypeError("Unexpected type of argument to hypot");const l=n(e[a]);s(c,l)?(t=o(t,o(i(c,l),i(c,l))),t=r(t,1),c=l):t=r(t,u(l)?o(i(l,c),i(l,c)):l)}return o(c,a(t))}})),wp="norm",Np=he(wp,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],(e=>{let{typed:t,abs:n,add:r,pow:i,conj:o,sqrt:a,multiply:s,equalScalar:u,larger:c,smaller:l,matrix:f,ctranspose:p,eigs:m}=e;return t(wp,{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,t){return h(f(e),t)},"Matrix, number | BigNumber | string":function(e,t){return h(e,t)}});function h(e,t){const f=e.size();if(1===f.length)return function(e,t){if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){let t=0;return e.forEach((function(e){const r=n(e);c(r,t)&&(t=r)}),!0),t}(e);if(t===Number.NEGATIVE_INFINITY||"-inf"===t)return function(e){let t;return e.forEach((function(e){const r=n(e);t&&!l(r,t)||(t=r)}),!0),t||0}(e);if("fro"===t)return h(e,2);if("number"==typeof t&&!isNaN(t)){if(!u(t,0)){let o=0;return e.forEach((function(e){o=r(i(n(e),t),o)}),!0),i(o,1/t)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}(e,t);if(2===f.length){if(f[0]&&f[1])return function(e,t){if(1===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[1],s=r(t[a]||0,n(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[0],s=r(t[a]||0,n(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if("fro"===t)return function(e){let t=0;return e.forEach((function(e,n){t=r(t,s(e,o(e)))})),n(a(t))}(e);if(2===t)return function(e){const t=e.size();if(t[0]!==t[1])throw new RangeError("Invalid matrix dimensions");const r=p(e),i=s(r,e),o=m(i).values.toArray(),u=o[o.length-1];return n(a(u))}(e);throw new Error("Unsupported parameter value "+t)}(e,t);throw new RangeError("Invalid matrix dimensions")}}})),Ep=he("dot",["typed","addScalar","multiplyScalar","conj","size"],(e=>{let{typed:t,addScalar:n,multiplyScalar:r,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){const u=a(e,o),c=E(e)?e._data:e,l=E(e)?e._datatype||e.getDataType():void 0,f=E(o)?o._data:o,p=E(o)?o._datatype||o.getDataType():void 0,m=2===s(e).length,h=2===s(o).length;let d=n,g=r;if(l&&p&&l===p&&"string"==typeof l&&"mixed"!==l){const e=l;d=t.find(n,[e,e]),g=t.find(r,[e,e])}if(!m&&!h){let e=g(i(c[0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t]));return e}if(!m&&h){let e=g(i(c[0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t][0]));return e}if(m&&!h){let e=g(i(c[0][0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t]));return e}if(m&&h){let e=g(i(c[0][0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t][0]));return e}},"SparseMatrix, SparseMatrix":function(e,t){a(e,t);const i=e._index,o=e._values,s=t._index,u=t._values;let c=0;const l=n,f=r;let p=0,m=0;for(;p<i.length&&m<s.length;){const e=i[p],t=s[m];e<t?p++:e>t?m++:e===t&&(c=l(c,f(o[p],u[m])),p++,m++)}return c}});function a(e,t){const n=s(e),r=s(t);let i,o;if(1===n.length)i=n[0];else{if(2!==n.length||1!==n[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+n.join(", ")+")");i=n[0]}if(1===r.length)o=r[0];else{if(2!==r.length||1!==r[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+r.join(", ")+")");o=r[0]}if(i!==o)throw new RangeError("Vectors must have equal length ("+i+" != "+o+")");if(0===i)throw new RangeError("Cannot calculate the dot product of empty vectors");return i}function s(e){return E(e)?e.size():o(e)}})),Ap=he("trace",["typed","matrix","add"],(e=>{let{typed:t,matrix:n,add:r}=e;return t("trace",{Array:function(e){return i(n(e))},SparseMatrix:function(e){const t=e._values,n=e._index,i=e._ptr,o=e._size,a=o[0],s=o[1];if(a===s){let e=0;if(t.length>0)for(let o=0;o<s;o++){const a=i[o],s=i[o+1];for(let i=a;i<s;i++){const a=n[i];if(a===o){e=r(e,t[i]);break}if(a>o)break}}return e}throw new RangeError("Matrix must be square (size: "+pr(o)+")")},DenseMatrix:i,any:ae});function i(e){const t=e._size,n=e._data;switch(t.length){case 1:if(1===t[0])return ae(n[0]);throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const e=t[0];if(e===t[1]){let t=0;for(let i=0;i<e;i++)t=r(t,n[i][i]);return t}throw new RangeError("Matrix must be square (size: "+pr(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}}})),Sp="index",Mp=he(Sp,["typed","Index"],(e=>{let{typed:t,Index:n}=e;return t(Sp,{"...number | string | BigNumber | Range | Array | Matrix":function(e){const t=e.map((function(e){return g(e)?e.toNumber():N(e)||E(e)?e.map((function(e){return g(e)?e.toNumber():e})):e})),r=new n;return n.apply(r,t),r}})})),Cp=new Set(["end"]),Tp=he("Node",["mathWithTransform"],(e=>{let{mathWithTransform:t}=e;return class{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){const e=this._compile(t,{}),n={};return{evaluate:function(t){const r=h(t);return function(e){for(const t of[...Cp])if(e.has(t))throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(r),e(r,n,null)}}}_compile(e,t){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw new Error("Cannot run forEach on a Node interface")}map(e){throw new Error("Cannot run map on a Node interface")}_ifNode(e){if(!X(e))throw new TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),function e(t,n){t.forEach((function(t,r,i){n(t,r,i),e(t,n)}))}(this,e)}transform(e){return function t(n,r,i){const o=e(n,r,i);return o!==n?o:n.map(t)}(this,null,null)}filter(e){const t=[];return this.traverse((function(n,r,i){e(n,r,i)&&t.push(n)})),t}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map((function(e){return e.cloneDeep()}))}equals(e){return!!e&&this.type===e.type&&ce(this,e)}toString(e){const t=this._getCustomString(e);return void 0!==t?t:this._toString(e)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){const t=this._getCustomString(e);return void 0!==t?t:this._toHTML(e)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(e){const t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)}_toTex(e){throw new 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 new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}}),{isClass:!0,isNode:!0});function Bp(e){return Bp="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},Bp(e)}function Dp(e,t,n){return(t=function(e){var t=function(e){if("object"!=Bp(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Bp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Bp(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Fp(e){return e&&e.isIndexError?new br(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function Op(e){let{subset:t}=e;return function(e,n){try{if(Array.isArray(e))return t(e,n);if(e&&"function"==typeof e.subset)return e.subset(n);if("string"==typeof e)return t(e,n);if("object"==typeof e){if(!n.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return i(e,n.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Fp(e)}}}const _p="AccessorNode",Ip=he(_p,["subset","Node"],(e=>{let{subset:t,Node:n}=e;const r=Op({subset:t});function o(e){return!(U(e)||L(e)||V(e)||Y(e)||Q(e)||ee(e)||re(e))}class a extends n{constructor(e,t){if(super(),!X(e))throw new TypeError('Node expected for parameter "object"');if(!J(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=t}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return _p}get isAccessorNode(){return!0}_compile(e,t){const n=this.object._compile(e,t),o=this.index._compile(e,t);if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,r,o){return i(n(t,r,o),e)}}return function(e,t,i){const a=n(e,t,i),s=o(e,t,a);return r(a,s)}}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){let t=this.object.toString(e);return o(this.object)&&(t="("+t+")"),t+this.index.toString(e)}_toHTML(e){let t=this.object.toHTML(e);return o(this.object)&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+this.index.toHTML(e)}_toTex(e){let t=this.object.toTex(e);return o(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)}toJSON(){return{mathjs:_p,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return Dp(a,"name",_p),a}),{isClass:!0,isNode:!0}),zp="ArrayNode",kp=he(zp,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(X))throw new TypeError("Array containing Nodes expected")}get type(){return zp}get isArrayNode(){return!0}_compile(e,t){const n=kr(this.items,(function(n){return n._compile(e,t)}));if("Array"!==e.config.matrix){const t=e.matrix;return function(e,r,i){return t(kr(n,(function(t){return t(e,r,i)})))}}return function(e,t,r){return kr(n,(function(n){return n(e,t,r)}))}}forEach(e){for(let t=0;t<this.items.length;t++)e(this.items[t],"items["+t+"]",this)}map(e){const t=[];for(let n=0;n<this.items.length;n++)t[n]=this._ifNode(e(this.items[n],"items["+n+"]",this));return new n(t)}clone(){return new n(this.items.slice(0))}_toString(e){return"["+this.items.map((function(t){return t.toString(e)})).join(", ")+"]"}toJSON(){return{mathjs:zp,items:this.items}}static fromJSON(e){return new n(e.items)}_toHTML(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map((function(t){return t.toHTML(e)})).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){return function t(n,r){const i=n.some(L)&&!n.every(L),o=r||i,a=o?"&":"\\\\",s=n.map((function(n){return n.items?t(n.items,!r):n.toTex(e)})).join(a);return i||!o||o&&!r?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return Dp(n,"name",zp),n}),{isClass:!0,isNode:!0}),Rp=[{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:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function qp(e,t){if(!t||"auto"!==t)return e;let n=e;for(;ee(n);)n=n.content;return n}function Pp(e,t,n,r){let i=e;"keep"!==t&&(i=e.getContent());const o=i.getIdentifier();let a=null;for(let e=0;e<Rp.length;e++)if(o in Rp[e]){a=e;break}if("OperatorNode:multiply"===o&&i.implicit&&"show"!==n){const e=qp(i.args[0],t);V(e)&&r&&"OperatorNode:divide"===r.getIdentifier()&&Z(qp(r.args[0],t))||"OperatorNode:divide"===e.getIdentifier()&&Z(qp(e.args[0],t))&&V(qp(e.args[1]))||(a+=1)}return a}function jp(e,t){let n=e;"keep"!==t&&(n=e.getContent());const r=n.getIdentifier(),i=Pp(n,t);if(null===i)return null;const o=Rp[i][r];if(me(o,"associativity")){if("left"===o.associativity)return"left";if("right"===o.associativity)return"right";throw Error("'"+r+"' has the invalid associativity '"+o.associativity+"'.")}return null}function Up(e,t,n){const r="keep"!==n?e.getContent():e,i="keep"!==n?e.getContent():t,o=r.getIdentifier(),a=i.getIdentifier(),s=Pp(r,n);if(null===s)return null;const u=Rp[s][o];if(me(u,"associativeWith")&&u.associativeWith instanceof Array){for(let e=0;e<u.associativeWith.length;e++)if(u.associativeWith[e]===a)return!0;return!1}return null}const Lp="AssignmentNode",$p=he(Lp,["subset","?matrix","Node"],(e=>{let{subset:t,matrix:n,Node:r}=e;const a=Op({subset:t}),s=function(e){let{subset:t,matrix:n}=e;return function(e,r,i){try{if(Array.isArray(e))return n(e).subset(r,i).valueOf().forEach(((t,n)=>{e[n]=t})),e;if(e&&"function"==typeof e.subset)return e.subset(r,i);if("string"==typeof e)return t(e,r,i);if("object"==typeof e){if(!r.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return o(e,r.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Fp(e)}}}({subset:t,matrix:n});function u(e,t,n){t||(t="keep");const r=Pp(e,t,n),i=Pp(e.value,t,n);return"all"===t||null!==i&&i<=r}class c extends r{constructor(e,t,n){if(super(),this.object=e,this.index=n?t:null,this.value=n||t,!re(e)&&!U(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(re(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!J(this.index))throw new TypeError('IndexNode expected as "index"');if(!X(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Lp}get isAssignmentNode(){return!0}_compile(e,t){const n=this.object._compile(e,t),r=this.index?this.index._compile(e,t):null,u=this.value._compile(e,t),c=this.object.name;if(this.index){if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,r,i){const a=n(t,r,i),s=u(t,r,i);return o(a,e,s),s}}if(re(this.object))return function(e,t,i){const o=n(e,t,i),a=u(e,t,i),l=r(e,t,o);return e.set(c,s(o,l,a)),a};{const n=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){const e=this.object.index.getObjectProperty();return function(t,a,c){const l=n(t,a,c),f=i(l,e),p=r(t,a,f),m=u(t,a,c);return o(l,e,s(f,p,m)),m}}{const i=this.object.index._compile(e,t);return function(e,t,o){const c=n(e,t,o),l=i(e,t,c),f=a(c,l),p=r(e,t,f),m=u(e,t,o);return s(c,l,s(f,p,m)),m}}}}if(!re(this.object))throw new TypeError("SymbolNode expected as object");return function(e,t,n){const r=u(e,t,n);return e.set(c,r),r}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){const t=this._ifNode(e(this.object,"object",this)),n=this.index?this._ifNode(e(this.index,"index",this)):null,r=this._ifNode(e(this.value,"value",this));return new c(t,n,r)}clone(){return new c(this.object,this.index,this.value)}_toString(e){const t=this.object.toString(e),n=this.index?this.index.toString(e):"";let r=this.value.toString(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r="("+r+")"),t+n+" = "+r}toJSON(){return{mathjs:Lp,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new c(e.object,e.index,e.value)}_toHTML(e){const t=this.object.toHTML(e),n=this.index?this.index.toHTML(e):"";let r=this.value.toHTML(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r='<span class="math-paranthesis math-round-parenthesis">(</span>'+r+'<span class="math-paranthesis math-round-parenthesis">)</span>'),t+n+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+r}_toTex(e){const t=this.object.toTex(e),n=this.index?this.index.toTex(e):"";let r=this.value.toTex(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(r=`\\left(${r}\\right)`),t+n+"="+r}}return Dp(c,"name",Lp),c}),{isClass:!0,isNode:!0}),Hp="BlockNode",Gp=he(Hp,["ResultSet","Node"],(e=>{let{ResultSet:t,Node:n}=e;class r extends n{constructor(e){if(super(),!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){const t=e&&e.node,n=!e||void 0===e.visible||e.visible;if(!X(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof n)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:n}}))}get type(){return Hp}get isBlockNode(){return!0}_compile(e,n){const r=kr(this.blocks,(function(t){return{evaluate:t.node._compile(e,n),visible:t.visible}}));return function(e,n,i){const o=[];return Rr(r,(function(t){const r=t.evaluate(e,n,i);t.visible&&o.push(r)})),new t(o)}}forEach(e){for(let t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)}map(e){const t=[];for(let n=0;n<this.blocks.length;n++){const r=this.blocks[n],i=this._ifNode(e(r.node,"blocks["+n+"].node",this));t[n]={node:i,visible:r.visible}}return new r(t)}clone(){const e=this.blocks.map((function(e){return{node:e.node,visible:e.visible}}));return new r(e)}_toString(e){return this.blocks.map((function(t){return t.node.toString(e)+(t.visible?"":";")})).join("\n")}toJSON(){return{mathjs:Hp,blocks:this.blocks}}static fromJSON(e){return new r(e.blocks)}_toHTML(e){return this.blocks.map((function(t){return t.node.toHTML(e)+(t.visible?"":'<span class="math-separator">;</span>')})).join('<span class="math-separator"><br /></span>')}_toTex(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")}}return Dp(r,"name",Hp),r}),{isClass:!0,isNode:!0}),Vp="ConditionalNode",Zp=he(Vp,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e,t,n){if(super(),!X(e))throw new TypeError("Parameter condition must be a Node");if(!X(t))throw new TypeError("Parameter trueExpr must be a Node");if(!X(n))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=n}get type(){return Vp}get isConditionalNode(){return!0}_compile(e,t){const n=this.condition._compile(e,t),r=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,o){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(g(e))return!e.isZero();if(x(e))return!(!e.re&&!e.im);if(v(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+oe(e)+'"')}(n(e,t,o))?r(e,t,o):i(e,t,o)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new n(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new n(this.condition,this.trueExpr,this.falseExpr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Pp(this,t,e&&e.implicit);let r=this.condition.toString(e);const i=Pp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=n)&&(r="("+r+")");let o=this.trueExpr.toString(e);const a=Pp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(o="("+o+")");let s=this.falseExpr.toString(e);const u=Pp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s="("+s+")"),r+" ? "+o+" : "+s}toJSON(){return{mathjs:Vp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new n(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Pp(this,t,e&&e.implicit);let r=this.condition.toHTML(e);const i=Pp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=n)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>');let o=this.trueExpr.toHTML(e);const a=Pp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=n)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>');let s=this.falseExpr.toHTML(e);const u=Pp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=n)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+'<span class="math-operator math-conditional-operator">?</span>'+o+'<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 Dp(n,"name",Vp),n}),{isClass:!0,isNode:!0});var Wp=n(3144);const Yp={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{?}"},Jp={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"},Xp={abs:{1:"\\left|${args[0]}\\right|"},add:{2:`\\left(\${args[0]}${Jp.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]}${Jp.dotDivide}\${args[1]}\\right)`},dotMultiply:{2:`\\left(\${args[0]}${Jp.dotMultiply}\${args[1]}\\right)`},dotPow:{2:`\\left(\${args[0]}${Jp.dotPow}\${args[1]}\\right)`},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:`\\left(e${Jp.pow}{\${args[0]}}-1\\right)`,fix:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},floor:{1:"\\left\\lfloor${args[0]}\\right\\rfloor"},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]}${Jp.mod}\${args[1]}\\right)`},multiply:{2:`\\left(\${args[0]}${Jp.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)${Jp.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]}${Jp.subtract}\${args[1]}\\right)`},unaryMinus:{1:`${Jp.unaryMinus}\\left(\${args[0]}\\right)`},unaryPlus:{1:`${Jp.unaryPlus}\\left(\${args[0]}\\right)`},bitAnd:{2:`\\left(\${args[0]}${Jp.bitAnd}\${args[1]}\\right)`},bitNot:{1:Jp.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:`\\left(\${args[0]}${Jp.bitOr}\${args[1]}\\right)`},bitXor:{2:`\\left(\${args[0]}${Jp.bitXor}\${args[1]}\\right)`},leftShift:{2:`\\left(\${args[0]}${Jp.leftShift}\${args[1]}\\right)`},rightArithShift:{2:`\\left(\${args[0]}${Jp.rightArithShift}\${args[1]}\\right)`},rightLogShift:{2:`\\left(\${args[0]}${Jp.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]}${Jp.and}\${args[1]}\\right)`},not:{1:Jp.not+"\\left(${args[0]}\\right)"},or:{2:`\\left(\${args[0]}${Jp.or}\${args[1]}\\right)`},xor:{2:`\\left(\${args[0]}${Jp.xor}\${args[1]}\\right)`},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:`\\left(\${args[0]}\\right)${Jp.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]}}${Jp.pow}{\\frac{1}{2}}`},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:`\\left(\${args[0]}\\right)${Jp.transpose}`},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:`\\left(\${args[0]}\\right)${Jp.factorial}`},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:`\\left(\${args[0]}${Jp.equal}\${args[1]}\\right)`},larger:{2:`\\left(\${args[0]}${Jp.larger}\${args[1]}\\right)`},largerEq:{2:`\\left(\${args[0]}${Jp.largerEq}\${args[1]}\\right)`},smaller:{2:`\\left(\${args[0]}${Jp.smaller}\${args[1]}\\right)`},smallerEq:{2:`\\left(\${args[0]}${Jp.smallerEq}\${args[1]}\\right)`},unequal:{2:`\\left(\${args[0]}${Jp.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]}${Jp.to}\${args[1]}\\right)`},numeric:function(e,t){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)+${Yp.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)"}},Qp={deg:"^\\circ"};function Kp(e){return Wp(e,{preserveFormatting:!0})}function em(e,t){return(t=void 0!==t&&t)?me(Qp,e)?Qp[e]:"\\mathrm{"+Kp(e)+"}":me(Yp,e)?Yp[e]:Kp(e)}const tm="ConstantNode",nm=he(tm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){super(),this.value=e}get type(){return tm}get isConstantNode(){return!0}_compile(e,t){const n=this.value;return function(){return n}}forEach(e){}map(e){return this.clone()}clone(){return new n(this.value)}_toString(e){return pr(this.value,e)}_toHTML(e){const t=this._toString(e);switch(oe(this.value)){case"number":case"bigint":case"BigNumber":case"Fraction":return'<span class="math-number">'+t+"</span>";case"string":return'<span class="math-string">'+t+"</span>";case"boolean":return'<span class="math-boolean">'+t+"</span>";case"null":return'<span class="math-null-symbol">'+t+"</span>";case"undefined":return'<span class="math-undefined">'+t+"</span>";default:return'<span class="math-symbol">'+t+"</span>"}}toJSON(){return{mathjs:tm,value:this.value}}static fromJSON(e){return new n(e.value)}_toTex(e){const t=this._toString(e),n=oe(this.value);switch(n){case"string":return"\\mathtt{"+Kp(t)+"}";case"number":case"BigNumber":{if(!("BigNumber"===n?this.value.isFinite():isFinite(this.value)))return this.value.valueOf()<0?"-\\infty":"\\infty";const e=t.toLowerCase().indexOf("e");return-1!==e?t.substring(0,e)+"\\cdot10^{"+t.substring(e+1)+"}":t}case"bigint":return t.toString();case"Fraction":return this.value.toLatex();default:return t}}}return Dp(n,"name",tm),n}),{isClass:!0,isNode:!0}),rm="FunctionAssignmentNode",im=he(rm,["typed","Node"],(e=>{let{typed:t,Node:n}=e;function r(e,t,n){const r=Pp(e,t,n),i=Pp(e.expr,t,n);return"all"===t||null!==i&&i<=r}class i extends n{constructor(e,t,n){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!X(n))throw new TypeError('Node expected for parameter "expr"');if(Cp.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');const r=new Set;for(const e of t){const t="string"==typeof e?e:e.name;if(r.has(t))throw new Error(`Duplicate parameter name "${t}"`);r.add(t)}this.name=e,this.params=t.map((function(e){return e&&e.name||e})),this.types=t.map((function(e){return e&&e.type||"any"})),this.expr=n}get type(){return rm}get isFunctionAssignmentNode(){return!0}_compile(e,n){const r=Object.create(n);Rr(this.params,(function(e){r[e]=!0}));const i=this.expr._compile(e,r),o=this.name,a=this.params,s=Pr(this.types,","),u=o+"("+Pr(this.params,", ")+")";return function(e,n,r){const c={};c[s]=function(){const t=Object.create(n);for(let e=0;e<a.length;e++)t[a[e]]=arguments[e];return i(e,t,r)};const l=t(o,c);return l.syntax=u,e.set(o,l),l}}forEach(e){e(this.expr,"expr",this)}map(e){const t=this._ifNode(e(this.expr,"expr",this));return new i(this.name,this.params.slice(0),t)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let n=this.expr.toString(e);return r(this,t,e&&e.implicit)&&(n="("+n+")"),this.name+"("+this.params.join(", ")+") = "+n}toJSON(){const e=this.types;return{mathjs:rm,name:this.name,params:this.params.map((function(t,n){return{name:t,type:e[n]}})),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=[];for(let e=0;e<this.params.length;e++)n.push('<span class="math-symbol math-parameter">'+dr(this.params[e])+"</span>");let i=this.expr.toHTML(e);return r(this,t,e&&e.implicit)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+dr(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+n.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>'+i}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let n=this.expr.toTex(e);return r(this,t,e&&e.implicit)&&(n=`\\left(${n}\\right)`),"\\mathrm{"+this.name+"}\\left("+this.params.map(em).join(",")+"\\right)="+n}}return Dp(i,"name",rm),i}),{isClass:!0,isNode:!0}),om="IndexNode",am=he(om,["Node","size"],(e=>{let{Node:t,size:n}=e;class r extends t{constructor(e,t){if(super(),this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(X))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return om}get isIndexNode(){return!0}_compile(e,t){const r=kr(this.dimensions,(function(r,i){if(r.filter((e=>e.isSymbolNode&&"end"===e.name)).length>0){const o=Object.create(t);o.end=!0;const a=r._compile(e,o);return function(e,t,r){if(!E(r)&&!N(r)&&!w(r))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+oe(r));const o=n(r).valueOf(),s=Object.create(t);return s.end=o[i],a(e,s,r)}}return r._compile(e,t)})),o=i(e,"index");return function(e,t,n){const i=kr(r,(function(r){return r(e,t,n)}));return o(...i)}}forEach(e){for(let t=0;t<this.dimensions.length;t++)e(this.dimensions[t],"dimensions["+t+"]",this)}map(e){const t=[];for(let n=0;n<this.dimensions.length;n++)t[n]=this._ifNode(e(this.dimensions[n],"dimensions["+n+"]",this));return new r(t,this.dotNotation)}clone(){return new r(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&V(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:om,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new r(e.dimensions,e.dotNotation)}_toHTML(e){const t=[];for(let e=0;e<this.dimensions.length;e++)t[e]=this.dimensions[e].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+dr(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){const t=this.dimensions.map((function(t){return t.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"}}return Dp(r,"name",om),r}),{isClass:!0,isNode:!0}),sm="ObjectNode",um=he(sm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every((function(t){return X(e[t])}))))throw new TypeError("Object containing Nodes expected")}get type(){return sm}get isObjectNode(){return!0}_compile(e,t){const n={};for(const r in this.properties)if(me(this.properties,r)){const o=mr(r),a=JSON.parse(o),s=i(this.properties,r);n[a]=s._compile(e,t)}return function(e,t,r){const i={};for(const o in n)me(n,o)&&(i[o]=n[o](e,t,r));return i}}forEach(e){for(const t in this.properties)me(this.properties,t)&&e(this.properties[t],"properties["+mr(t)+"]",this)}map(e){const t={};for(const n in this.properties)me(this.properties,n)&&(t[n]=this._ifNode(e(this.properties[n],"properties["+mr(n)+"]",this)));return new n(t)}clone(){const e={};for(const t in this.properties)me(this.properties,t)&&(e[t]=this.properties[t]);return new n(e)}_toString(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push(mr(n)+": "+this.properties[n].toString(e));return"{"+t.join(", ")+"}"}toJSON(){return{mathjs:sm,properties:this.properties}}static fromJSON(e){return new n(e.properties)}_toHTML(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push('<span class="math-symbol math-property">'+dr(n)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[n].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(e){const t=[];for(const n in this.properties)me(this.properties,n)&&t.push("\\mathbf{"+n+":} & "+this.properties[n].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"}}return Dp(n,"name",sm),n}),{isClass:!0,isNode:!0});function cm(e,t){return new f(e,new l(t),new Set(Object.keys(t)))}const lm="OperatorNode",fm=he(lm,["Node"],(e=>{let{Node:t}=e;function n(e,t){let r=e;if("auto"===t)for(;ee(r);)r=r.content;return!!V(r)||!!K(r)&&n(r.args[0],t)}function r(e,t,r,i,o){const a=Pp(e,t,r),s=jp(e,t);if("all"===t||i.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return i.map((function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}}));let u;switch(i.length){case 0:u=[];break;case 1:{const n=Pp(i[0],t,r,e);if(o&&null!==n){let r,o;if("keep"===t?(r=i[0].getIdentifier(),o=e.getIdentifier()):(r=i[0].getContent().getIdentifier(),o=e.getContent().getIdentifier()),!1===Rp[a][o].latexLeftParens){u=[!1];break}if(!1===Rp[n][r].latexParens){u=[!1];break}}if(null===n){u=[!1];break}if(n<=a){u=[!0];break}u=[!1]}break;case 2:{let n;const c=Pp(i[0],t,r,e),l=Up(e,i[0],t);let f;n=null!==c&&(c===a&&"right"===s&&!l||c<a);const p=Pp(i[1],t,r,e),m=Up(e,i[1],t);if(f=null!==p&&(p===a&&"left"===s&&!m||p<a),o){let r,i,o;"keep"===t?(r=e.getIdentifier(),i=e.args[0].getIdentifier(),o=e.args[1].getIdentifier()):(r=e.getContent().getIdentifier(),i=e.args[0].getContent().getIdentifier(),o=e.args[1].getContent().getIdentifier()),null!==c&&(!1===Rp[a][r].latexLeftParens&&(n=!1),!1===Rp[c][i].latexParens&&(n=!1)),null!==p&&(!1===Rp[a][r].latexRightParens&&(f=!1),!1===Rp[p][o].latexParens&&(f=!1))}u=[n,f]}break;default:"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()||(u=i.map((function(n){const i=Pp(n,t,r,e),o=Up(e,n,t),u=jp(n,t);return null!==i&&(a===i&&s===u&&!o||i<a)})))}if(i.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==t&&"hide"===r)for(let e=1;e<u.length;++e)!n(i[e],t)||u[e-1]||"keep"===t&&ee(i[e-1])||(u[e]=!0);return u}class o extends t{constructor(e,t,n,r,i){if(super(),"string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof t)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(n)||!n.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===r,this.isPercentage=!0===i,this.op=e,this.fn=t,this.args=n||[]}get type(){return lm}get isOperatorNode(){return!0}_compile(e,t){if("string"!=typeof this.fn||!s(e,this.fn))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');const n=i(e,this.fn),r=kr(this.args,(function(n){return n._compile(e,t)}));if("function"==typeof n&&!0===n.rawArgs){const t=this.args;return function(r,i,o){return n(t,e,cm(r,i))}}if(1===r.length){const e=r[0];return function(t,r,i){return n(e(t,r,i))}}if(2===r.length){const e=r[0],t=r[1];return function(r,i,o){return n(e(r,i,o),t(r,i,o))}}return function(e,t,i){return n.apply(null,kr(r,(function(n){return n(e,t,i)})))}}forEach(e){for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=[];for(let n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new o(this.op,this.fn,t,this.implicit,this.isPercentage)}clone(){return new o(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){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!1);if(1===i.length){const n=jp(this,t);let r=i[0].toString(e);o[0]&&(r="("+r+")");const a=/[a-zA-Z]+/.test(this.op);return"right"===n?this.op+(a?" ":"")+r:"left"===n?r+(a?" ":"")+this.op:r+this.op}if(2===i.length){let t=i[0].toString(e),r=i[1].toString(e);return o[0]&&(t="("+t+")"),o[1]&&(r="("+r+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t+" "+r:t+" "+this.op+" "+r}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,n){return t=t.toString(e),o[n]&&(t="("+t+")"),t}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t.join(" "):t.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:lm,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new o(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!1);if(1===i.length){const n=jp(this,t);let r=i[0].toHTML(e);return o[0]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===n?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+dr(this.op)+"</span>"+r:r+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+dr(this.op)+"</span>"}if(2===i.length){let t=i[0].toHTML(e),r=i[1].toHTML(e);return o[0]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+r:t+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dr(this.op)+"</span>"+r}{const t=i.map((function(t,n){return t=t.toHTML(e),o[n]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?t.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):t.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dr(this.op)+"</span>"):'<span class="math-function">'+dr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,o=r(this,t,n,i,!0);let a=Jp[this.fn];if(a=void 0===a?this.op:a,1===i.length){const n=jp(this,t);let r=i[0].toTex(e);return o[0]&&(r=`\\left(${r}\\right)`),"right"===n?a+r:r+a}if(2===i.length){const r=i[0];let s=r.toTex(e);o[0]&&(s=`\\left(${s}\\right)`);let u,c=i[1].toTex(e);switch(o[1]&&(c=`\\left(${c}\\right)`),u="keep"===t?r.getIdentifier():r.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return a+"{"+s+"}{"+c+"}";case"OperatorNode:pow":switch(s="{"+s+"}",c="{"+c+"}",u){case"ConditionalNode":case"OperatorNode:divide":s=`\\left(${s}\\right)`}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return s+"~"+c}return s+a+c}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,n){return t=t.toTex(e),o[n]&&(t=`\\left(${t}\\right)`),t}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?t.join("~"):t.join(a)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(t){return t.toTex(e)})).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return Dp(o,"name",lm),o}),{isClass:!0,isNode:!0}),pm="ParenthesisNode",mm=he(pm,["Node"],(e=>{let{Node:t}=e;class n extends t{constructor(e){if(super(),!X(e))throw new TypeError('Node expected for parameter "content"');this.content=e}get type(){return pm}get isParenthesisNode(){return!0}_compile(e,t){return this.content._compile(e,t)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){const t=e(this.content,"content",this);return new n(t)}clone(){return new n(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:pm,content:this.content}}static fromJSON(e){return new n(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(${this.content.toTex(e)}\\right)`:this.content.toTex(e)}}return Dp(n,"name",pm),n}),{isClass:!0,isNode:!0}),hm="RangeNode",dm=he(hm,["Node"],(e=>{let{Node:t}=e;function n(e,t,n){const r=Pp(e,t,n),i={},o=Pp(e.start,t,n);if(i.start=null!==o&&o<=r||"all"===t,e.step){const o=Pp(e.step,t,n);i.step=null!==o&&o<=r||"all"===t}const a=Pp(e.end,t,n);return i.end=null!==a&&a<=r||"all"===t,i}class r extends t{constructor(e,t,n){if(super(),!X(e))throw new TypeError("Node expected");if(!X(t))throw new TypeError("Node expected");if(n&&!X(n))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=n||null}get type(){return hm}get isRangeNode(){return!0}needsEnd(){return this.filter((function(e){return re(e)&&"end"===e.name})).length>0}_compile(e,t){const n=e.range,r=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){const o=this.step._compile(e,t);return function(e,t,a){return n(r(e,t,a),i(e,t,a),o(e,t,a))}}return function(e,t,o){return n(r(e,t,o),i(e,t,o))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new r(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 r(this.start,this.end,this.step&&this.step)}_toString(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r,i=this.start.toString(e);if(t.start&&(i="("+i+")"),r=i,this.step){let n=this.step.toString(e);t.step&&(n="("+n+")"),r+=":"+n}let o=this.end.toString(e);return t.end&&(o="("+o+")"),r+=":"+o,r}toJSON(){return{mathjs:hm,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new r(e.start,e.end,e.step)}_toHTML(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r,i=this.start.toHTML(e);if(t.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r=i,this.step){let n=this.step.toHTML(e);t.step&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+n}let o=this.end.toHTML(e);return t.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,r}_toTex(e){const t=n(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let r=this.start.toTex(e);if(t.start&&(r=`\\left(${r}\\right)`),this.step){let n=this.step.toTex(e);t.step&&(n=`\\left(${n}\\right)`),r+=":"+n}let i=this.end.toTex(e);return t.end&&(i=`\\left(${i}\\right)`),r+=":"+i,r}}return Dp(r,"name",hm),r}),{isClass:!0,isNode:!0}),gm="RelationalNode",ym=he(gm,["Node"],(e=>{let{Node:t}=e;const n={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class r extends t{constructor(e,t){if(super(),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(t))throw new TypeError("Parameter params must be an array");if(e.length!==t.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=t}get type(){return gm}get isRelationalNode(){return!0}_compile(e,t){const n=this,r=this.params.map((n=>n._compile(e,t)));return function(t,o,a){let s,u=r[0](t,o,a);for(let c=0;c<n.conditionals.length;c++)if(s=u,u=r[c+1](t,o,a),!i(e,n.conditionals[c])(s,u))return!1;return!0}}forEach(e){this.params.forEach(((t,n)=>e(t,"params["+n+"]",this)),this)}map(e){return new r(this.conditionals.slice(),this.params.map(((t,n)=>this._ifNode(e(t,"params["+n+"]",this))),this))}clone(){return new r(this.conditionals,this.params)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Pp(this,t,e&&e.implicit),i=this.params.map((function(n,i){const o=Pp(n,t,e&&e.implicit);return"all"===t||null!==o&&o<=r?"("+n.toString(e)+")":n.toString(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+=" "+n[this.conditionals[e]],o+=" "+i[e+1];return o}toJSON(){return{mathjs:gm,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new r(e.conditionals,e.params)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Pp(this,t,e&&e.implicit),i=this.params.map((function(n,i){const o=Pp(n,t,e&&e.implicit);return"all"===t||null!==o&&o<=r?'<span class="math-parenthesis math-round-parenthesis">(</span>'+n.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':n.toHTML(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dr(n[this.conditionals[e]])+"</span>"+i[e+1];return o}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Pp(this,t,e&&e.implicit),r=this.params.map((function(r,i){const o=Pp(r,t,e&&e.implicit);return"all"===t||null!==o&&o<=n?"\\left("+r.toTex(e)+"\right)":r.toTex(e)}));let i=r[0];for(let e=0;e<this.conditionals.length;e++)i+=Jp[this.conditionals[e]]+r[e+1];return i}}return Dp(r,"name",gm),r}),{isClass:!0,isNode:!0}),xm=he("SymbolNode",["math","?Unit","Node"],(e=>{let{math:t,Unit:n,Node:r}=e;function o(e){return!!n&&n.isValuelessUnit(e)}class a extends r{constructor(e){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(e,t){const r=this.name;if(!0===t[r])return function(e,t,n){return i(t,r)};if(r in e)return function(t,n,o){return t.has(r)?t.get(r):i(e,r)};{const e=o(r);return function(t,i,o){return t.has(r)?t.get(r):e?new n(null,r):a.onUndefinedSymbol(r)}}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw new Error("Undefined symbol "+e)}clone(){return new a(this.name)}_toString(e){return this.name}_toHTML(e){const t=dr(this.name);return"true"===t||"false"===t?'<span class="math-symbol math-boolean">'+t+"</span>":"i"===t?'<span class="math-symbol math-imaginary-symbol">'+t+"</span>":"Infinity"===t?'<span class="math-symbol math-infinity-symbol">'+t+"</span>":"NaN"===t?'<span class="math-symbol math-nan-symbol">'+t+"</span>":"null"===t?'<span class="math-symbol math-null-symbol">'+t+"</span>":"undefined"===t?'<span class="math-symbol math-undefined-symbol">'+t+"</span>":'<span class="math-symbol">'+t+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){let n=!1;void 0===t[this.name]&&o(this.name)&&(n=!0);const r=em(this.name,n);return"\\"===r[0]?r:" "+r}}return a}),{isClass:!0,isNode:!0}),bm="FunctionNode",vm=he(bm,["math","Node","SymbolNode"],(e=>{var t;let{math:n,Node:r,SymbolNode:o}=e;const a=e=>pr(e,{truncate:78});function u(e,t,n){let r="";const i=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi;let o,a=0;for(;null!==(o=i.exec(e));)if(r+=e.substring(a,o.index),a=o.index,"$$"===o[0])r+="$",a++;else{a+=o[0].length;const e=t[o[1]];if(!e)throw new ReferenceError("Template: Property "+o[1]+" does not exist.");if(void 0===o[2])switch(typeof e){case"string":r+=e;break;case"object":if(X(e))r+=e.toTex(n);else{if(!Array.isArray(e))throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes");r+=e.map((function(e,t){if(X(e))return e.toTex(n);throw new TypeError("Template: "+o[1]+"["+t+"] is not a Node.")})).join(",")}break;default:throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes")}else{if(!X(e[o[2]]&&e[o[2]]))throw new TypeError("Template: "+o[1]+"["+o[2]+"] is not a Node.");r+=e[o[2]].toTex(n)}}return r+=e.slice(a),r}class c extends r{constructor(e,t){if(super(),"string"==typeof e&&(e=new o(e)),!X(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[]}get name(){return this.fn.name||""}get type(){return bm}get isFunctionNode(){return!0}_compile(e,t){const n=this.args.map((n=>n._compile(e,t)));if(!re(this.fn)){if(U(this.fn)&&J(this.fn.index)&&this.fn.index.isObjectProperty()){const r=this.fn.object._compile(e,t),i=this.fn.index.getObjectProperty(),o=this.args;return function(t,a,u){const c=r(t,a,u),l=function(e,t){if(!s(e,t))throw new Error('No access to method "'+t+'"');return e[t]}(c,i);if(null!=l&&l.rawArgs)return l(o,e,cm(t,a));{const e=n.map((e=>e(t,a,u)));return l.apply(c,e)}}}{const r=this.fn.toString(),i=this.fn._compile(e,t),o=this.args;return function(t,s,u){const c=i(t,s,u);if("function"!=typeof c)throw new TypeError(`Expression '${r}' did not evaluate to a function; value is:\n ${a(c)}`);if(c.rawArgs)return c(o,e,cm(t,s));{const e=n.map((e=>e(t,s,u)));return c.apply(c,e)}}}}{const r=this.fn.name;if(t[r]){const t=this.args;return function(o,s,u){const c=i(s,r);if("function"!=typeof c)throw new TypeError(`Argument '${r}' was not a function; received: ${a(c)}`);if(c.rawArgs)return c(t,e,cm(o,s));{const e=n.map((e=>e(o,s,u)));return c.apply(c,e)}}}{const t=r in e?i(e,r):void 0,o="function"==typeof t&&!0===t.rawArgs,s=t=>{let n;if(t.has(r))n=t.get(r);else{if(!(r in e))return c.onUndefinedFunction(r);n=i(e,r)}if("function"==typeof n)return n;throw new TypeError(`'${r}' is not a function; its value is:\n ${a(n)}`)};if(o){const t=this.args;return function(r,i,o){const a=s(r);return!0===a.rawArgs?a(t,e,cm(r,i)):a(...n.map((e=>e(r,i,o))))}}switch(n.length){case 0:return function(e,t,n){return s(e)()};case 1:return function(e,t,r){return s(e)((0,n[0])(e,t,r))};case 2:return function(e,t,r){const i=s(e),o=n[0],a=n[1];return i(o(e,t,r),a(e,t,r))};default:return function(e,t,r){return s(e)(...n.map((n=>n(e,t,r))))}}}}}forEach(e){e(this.fn,"fn",this);for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=this._ifNode(e(this.fn,"fn",this)),n=[];for(let t=0;t<this.args.length;t++)n[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new c(t,n)}clone(){return new c(this.fn,this.args.slice(0))}toString(e){let t;const n=this.fn.toString(e);return e&&"object"==typeof e.handler&&me(e.handler,n)&&(t=e.handler[n](this,e)),void 0!==t?t:super.toString(e)}_toString(e){const t=this.args.map((function(t){return t.toString(e)}));return(W(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+t.join(", ")+")"}toJSON(){return{mathjs:bm,fn:this.fn,args:this.args}}_toHTML(e){const t=this.args.map((function(t){return t.toHTML(e)}));return'<span class="math-function">'+dr(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(e){let t;return e&&"object"==typeof e.handler&&me(e.handler,this.name)&&(t=e.handler[this.name](this,e)),void 0!==t?t:super.toTex(e)}_toTex(e){const t=this.args.map((function(t){return t.toTex(e)}));let r,i;switch(Xp[this.name]&&(r=Xp[this.name]),!n[this.name]||"function"!=typeof n[this.name].toTex&&"object"!=typeof n[this.name].toTex&&"string"!=typeof n[this.name].toTex||(r=n[this.name].toTex),typeof r){case"function":i=r(this,e);break;case"string":i=u(r,this,e);break;case"object":switch(typeof r[t.length]){case"function":i=r[t.length](this,e);break;case"string":i=u(r[t.length],this,e)}}return void 0!==i?i:u("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return t=c,Dp(c,"name",bm),Dp(c,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),Dp(c,"fromJSON",(function(e){return new t(e.fn,e.args)})),c}),{isClass:!0,isNode:!0}),wm="parse",Nm=he(wm,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(e=>{let{typed:t,numeric:n,config:r,AccessorNode:i,ArrayNode:o,AssignmentNode:a,BlockNode:s,ConditionalNode:u,ConstantNode:c,FunctionAssignmentNode:l,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:y,SymbolNode:x}=e;const b=t(wm,{string:function(e){return k(e,{})},"Array | Matrix":function(e){return v(e,{})},"string, Object":function(e,t){return k(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":v});function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=void 0!==t.nodes?t.nodes:{};return ii(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return k(e,n)}))}const w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},N={",":!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},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function C(e,t){return e.expression.substr(e.index,t)}function T(e){return C(e,1)}function B(e){e.index++}function D(e){return e.expression.charAt(e.index-1)}function F(e){return e.expression.charAt(e.index+1)}function O(e){for(e.tokenType=w.NULL,e.token="",e.comment="";;){if("#"===T(e))for(;"\n"!==T(e)&&""!==T(e);)e.comment+=T(e),B(e);if(!b.isWhitespace(T(e),e.nestingLevel))break;B(e)}if(""===T(e))return void(e.tokenType=w.DELIMITER);if("\n"===T(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=T(e),void B(e);const t=T(e),n=C(e,2),r=C(e,3);if(3===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,B(e),B(e),void B(e);if(2===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,B(e),void B(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void B(e);if(b.isDigitDot(t)){e.tokenType=w.NUMBER;const t=C(e,2);if("0b"===t||"0o"===t||"0x"===t){for(e.token+=T(e),B(e),e.token+=T(e),B(e);b.isHexDigit(T(e));)e.token+=T(e),B(e);if("."===T(e))for(e.token+=".",B(e);b.isHexDigit(T(e));)e.token+=T(e),B(e);else if("i"===T(e))for(e.token+="i",B(e);b.isDigit(T(e));)e.token+=T(e),B(e);return}if("."===T(e)){if(e.token+=T(e),B(e),!b.isDigit(T(e)))return void(e.tokenType=w.DELIMITER)}else{for(;b.isDigit(T(e));)e.token+=T(e),B(e);b.isDecimalMark(T(e),F(e))&&(e.token+=T(e),B(e))}for(;b.isDigit(T(e));)e.token+=T(e),B(e);if("E"===T(e)||"e"===T(e))if(b.isDigit(F(e))||"-"===F(e)||"+"===F(e)){if(e.token+=T(e),B(e),"+"!==T(e)&&"-"!==T(e)||(e.token+=T(e),B(e)),!b.isDigit(T(e)))throw ue(e,'Digit expected, got "'+T(e)+'"');for(;b.isDigit(T(e));)e.token+=T(e),B(e);if(b.isDecimalMark(T(e),F(e)))throw ue(e,'Digit expected, got "'+T(e)+'"')}else if("."===F(e))throw B(e),ue(e,'Digit expected, got "'+T(e)+'"')}else{if(!b.isAlpha(T(e),D(e),F(e))){for(e.tokenType=w.UNKNOWN;""!==T(e);)e.token+=T(e),B(e);throw ue(e,'Syntax error in part "'+e.token+'"')}for(;b.isAlpha(T(e),D(e),F(e))||b.isDigit(T(e));)e.token+=T(e),B(e);me(E,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}function _(e){do{O(e)}while("\n"===e.token)}function I(e){e.nestingLevel++}function z(e){e.nestingLevel--}function k(e,t){const n={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};sr(n,{expression:e,extraNodes:t}),O(n);const r=function(e){let t;const n=[];let r;for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment));"\n"===e.token||";"===e.token;)0===n.length&&t&&(r=";"!==e.token,n.push({node:t,visible:r})),O(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment),r=";"!==e.token,n.push({node:t,visible:r}));return n.length>0?new s(n):(t||(t=new c(void 0),e.comment&&(t.comment=e.comment)),t)}(n);if(""!==n.token)throw n.tokenType===w.DELIMITER?ce(n,"Unexpected operator "+n.token):ue(n,'Unexpected part "'+n.token+'"');return r}function R(e){let t,n,r,i;const o=function(e){let t=function(e){let t=q(e);for(;"or"===e.token;)_(e),t=new h("or","or",[t,q(e)]);return t}(e);for(;"?"===e.token;){const n=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,_(e);const r=t,i=R(e);if(":"!==e.token)throw ue(e,"False part of conditional expression expected");e.conditionalLevel=null,_(e);const o=R(e);t=new u(r,i,o),e.conditionalLevel=n}return t}(e);if("="===e.token){if(re(o))return t=o.name,_(e),r=R(e),new a(new x(t),r);if(U(o))return _(e),r=R(e),new a(o.object,o.index,r);if(Y(o)&&re(o.fn)&&(i=!0,n=[],t=o.name,o.args.forEach((function(e,t){re(e)?n[t]=e.name:i=!1})),i))return _(e),r=R(e),new l(t,n,r);throw ue(e,"Invalid left hand side of assignment operator =")}return o}function q(e){let t=P(e);for(;"xor"===e.token;)_(e),t=new h("xor","xor",[t,P(e)]);return t}function P(e){let t=j(e);for(;"and"===e.token;)_(e),t=new h("and","and",[t,j(e)]);return t}function j(e){let t=L(e);for(;"|"===e.token;)_(e),t=new h("|","bitOr",[t,L(e)]);return t}function L(e){let t=$(e);for(;"^|"===e.token;)_(e),t=new h("^|","bitXor",[t,$(e)]);return t}function $(e){let t=H(e);for(;"&"===e.token;)_(e),t=new h("&","bitAnd",[t,H(e)]);return t}function H(e){const t=[G(e)],n=[],r={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};for(;me(r,e.token);){const i={name:e.token,fn:r[e.token]};n.push(i),_(e),t.push(G(e))}return 1===t.length?t[0]:2===t.length?new h(n[0].name,n[0].fn,t):new y(n.map((e=>e.fn)),t)}function G(e){let t,n,r,i;t=W(e);const o={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};for(;me(o,e.token);)n=e.token,r=o[n],_(e),i=[t,W(e)],t=new h(n,r,i);return t}function W(e){let t,n,r,i;t=J(e);const o={to:"to",in:"to"};for(;me(o,e.token);)n=e.token,r=o[n],_(e),"in"===n&&""===e.token?t=new h("*","multiply",[t,new x("in")],!0):(i=[t,J(e)],t=new h(n,r,i));return t}function J(e){let t;const n=[];if(t=":"===e.token?new c(1):X(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(n.push(t);":"===e.token&&n.length<3;)_(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?n.push(new x("end")):n.push(X(e));t=3===n.length?new g(n[0],n[2],n[1]):new g(n[0],n[1])}return t}function X(e){let t,n,r,i;t=Q(e);const o={"+":"add","-":"subtract"};for(;me(o,e.token);){n=e.token,r=o[n],_(e);const a=Q(e);i=a.isPercentage?[t,new h("*","multiply",[t,a])]:[t,a],t=new h(n,r,i)}return t}function Q(e){let t,n,r,i;t=ee(e),n=t;const o={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};for(;me(o,e.token);)if(r=e.token,i=o[r],_(e),"%"===r&&e.tokenType===w.DELIMITER&&"("!==e.token)if(""!==e.token&&o[e.token]){const a=new h("/","divide",[t,new c(100)],!1,!0);r=e.token,i=o[r],_(e),n=ee(e),t=new h(r,i,[a,n])}else t=new h("/","divide",[t,new c(100)],!1,!0);else n=ee(e),t=new h(r,i,[t,n]);return t}function ee(e){let t,n;for(t=te(e),n=t;e.tokenType===w.SYMBOL||"in"===e.token&&V(t)||"in"===e.token&&K(t)&&"unaryMinus"===t.fn&&V(t.args[0])||!(e.tokenType!==w.NUMBER||V(n)||K(n)&&"!"!==n.op)||"("===e.token;)n=te(e),t=new h("*","multiply",[t,n],!0);return t}function te(e){let t=ne(e),n=t;const r=[];for(;"/"===e.token&&Z(n);){if(r.push(sr({},e)),_(e),e.tokenType!==w.NUMBER){sr(e,r.pop());break}if(r.push(sr({},e)),_(e),e.tokenType!==w.SYMBOL&&"("!==e.token&&"in"!==e.token){r.pop(),sr(e,r.pop());break}sr(e,r.pop()),r.pop(),n=ne(e),t=new h("/","divide",[t,n])}return t}function ne(e){let t,i,a;const s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return me(s,e.token)?(a=s[e.token],t=e.token,_(e),i=[ne(e)],new h(t,a,i)):function(e){let t,i,a,s;return t=function(e){let t,i,a,s;t=function(e){let t=[];if(e.tokenType===w.SYMBOL&&me(e.extraNodes,e.token)){const n=e.extraNodes[e.token];if(O(e),"("===e.token){if(t=[],I(e),O(e),")"!==e.token)for(t.push(R(e));","===e.token;)O(e),t.push(R(e));if(")"!==e.token)throw ue(e,"Parenthesis ) expected");z(e),O(e)}return new n(t)}return function(e){let t,i;return e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E?(i=e.token,O(e),t=me(A,i)?new c(A[i]):S.includes(i)?new c(n(i,"number")):new x(i),t=ie(e,t),t):function(e){let t,i;return'"'===e.token||"'"===e.token?(i=oe(e,e.token),t=new c(i),t=ie(e,t),t):function(e){let t,i,a,s;if("["===e.token){if(I(e),O(e),"]"!==e.token){const n=ae(e);if(";"===e.token){for(a=1,i=[n];";"===e.token;)O(e),"]"!==e.token&&(i[a]=ae(e),a++);if("]"!==e.token)throw ue(e,"End of matrix ] expected");z(e),O(e),s=i[0].items.length;for(let t=1;t<a;t++)if(i[t].items.length!==s)throw ce(e,"Column dimensions mismatch ("+i[t].items.length+" !== "+s+")");t=new o(i)}else{if("]"!==e.token)throw ue(e,"End of matrix ] expected");z(e),O(e),t=n}}else z(e),O(e),t=new o([]);return ie(e,t)}return function(e){if("{"===e.token){let t;I(e);const n={};do{if(O(e),"}"!==e.token){if('"'===e.token||"'"===e.token)t=oe(e,e.token);else{if(!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ue(e,"Symbol or string expected as object key");t=e.token,O(e)}if(":"!==e.token)throw ue(e,"Colon : expected after object key");O(e),n[t]=R(e)}}while(","===e.token);if("}"!==e.token)throw ue(e,"Comma , or bracket } expected after object value");z(e),O(e);let r=new m(n);return r=ie(e,r),r}return function(e){let t;if(e.tokenType===w.NUMBER){t=e.token,O(e);const i=xe(t,r),o=n(t,i);return new c(o)}return function(e){let t;if("("===e.token){if(I(e),O(e),t=R(e),")"!==e.token)throw ue(e,"Parenthesis ) expected");return z(e),O(e),t=new d(t),t=ie(e,t),t}return function(e){throw""===e.token?ue(e,"Unexpected end of expression"):ue(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e);const u={"!":"factorial","'":"ctranspose"};for(;me(u,e.token);)i=e.token,a=u[i],O(e),s=[t],t=new h(i,a,s),t=ie(e,t);return t}(e),("^"===e.token||".^"===e.token)&&(i=e.token,a="^"===i?"pow":"dotPow",_(e),s=[t,ne(e)],t=new h(i,a,s)),t}(e)}function ie(e,t,n){let r;for(;("("===e.token||"["===e.token||"."===e.token)&&(!n||n.includes(e.token));)if(r=[],"("===e.token){if(!re(t)&&!U(t))return t;if(I(e),O(e),")"!==e.token)for(r.push(R(e));","===e.token;)O(e),r.push(R(e));if(")"!==e.token)throw ue(e,"Parenthesis ) expected");z(e),O(e),t=new f(t,r)}else if("["===e.token){if(I(e),O(e),"]"!==e.token)for(r.push(R(e));","===e.token;)O(e),r.push(R(e));if("]"!==e.token)throw ue(e,"Parenthesis ] expected");z(e),O(e),t=new i(t,new p(r))}else{if(O(e),!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ue(e,"Property name expected after dot");r.push(new c(e.token)),O(e),t=new i(t,new p(r,!0))}return t}function oe(e,t){let n="";for(;""!==T(e)&&T(e)!==t;)if("\\"===T(e)){B(e);const t=T(e),r=M[t];if(void 0!==r)n+=r,e.index+=1;else{if("u"!==t)throw ue(e,`Bad escape character \\${t}`);{const t=e.expression.slice(e.index+1,e.index+5);if(!/^[0-9A-Fa-f]{4}$/.test(t))throw ue(e,`Invalid unicode character \\u${t}`);n+=String.fromCharCode(parseInt(t,16)),e.index+=5}}}else n+=T(e),B(e);if(O(e),e.token!==t)throw ue(e,`End of string ${t} expected`);return O(e),n}function ae(e){const t=[R(e)];let n=1;for(;","===e.token;)O(e),"]"!==e.token&&";"!==e.token&&(t[n]=R(e),n++);return new o(t)}function se(e){return e.index-e.token.length+1}function ue(e,t){const n=se(e),r=new SyntaxError(t+" (char "+n+")");return r.char=n,r}function ce(e,t){const n=se(e),r=new SyntaxError(t+" (char "+n+")");return r.char=n,r}return b.isAlpha=function(e,t,n){return b.isValidLatinOrGreek(e)||b.isValidMathSymbol(e,n)||b.isValidMathSymbol(t,e)},b.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},b.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\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(t)},b.isWhitespace=function(e,t){return" "===e||"\t"===e||"\n"===e&&t>0},b.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},b.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},b.isDigit=function(e){return e>="0"&&e<="9"},b.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},t.addConversion({from:"string",to:"Node",convert:b}),b})),Em="compile",Am=he(Em,["typed","parse"],(e=>{let{typed:t,parse:n}=e;return t(Em,{string:function(e){return n(e).compile()},"Array | Matrix":function(e){return ii(e,(function(e){return n(e).compile()}))}})})),Sm="evaluate",Mm=he(Sm,["typed","parse"],(e=>{let{typed:t,parse:n}=e;return t(Sm,{string:function(e){const t=m();return n(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return n(e).compile().evaluate(t)},"Array | Matrix":function(e){const t=m();return ii(e,(function(e){return n(e).compile().evaluate(t)}))},"Array | Matrix, Map | Object":function(e,t){return ii(e,(function(e){return n(e).compile().evaluate(t)}))}})})),Cm=he("Parser",["evaluate","parse"],(e=>{let{evaluate:t,parse:n}=e;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:m(),writable:!1})}return r.prototype.type="Parser",r.prototype.isParser=!0,r.prototype.evaluate=function(e){return t(e,this.scope)},r.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},r.prototype.getAll=function(){return function(e){if(e instanceof l)return e.wrappedObject;const t={};for(const n of e.keys())o(t,n,e.get(n));return t}(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(e,t){if(!function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){const r=e.charAt(t-1),i=e.charAt(t),o=e.charAt(t+1);if(!(n.isAlpha(i,r,o)||t>0&&n.isDigit(i)))return!1}return!0}(e))throw new Error(`Invalid variable name: '${e}'. Variable names must follow the specified rules.`);return this.scope.set(e,t),t},r.prototype.remove=function(e){this.scope.delete(e)},r.prototype.clear=function(){this.scope.clear()},r}),{isClass:!0}),Tm="parser",Bm=he(Tm,["typed","Parser"],(e=>{let{typed:t,Parser:n}=e;return t(Tm,{"":function(){return new n}})})),Dm=he("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(e=>{let{typed:t,matrix:n,abs:r,addScalar:i,divideScalar:o,multiplyScalar:a,subtractScalar:s,larger:u,equalScalar:c,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return t("lup",{DenseMatrix:function(e){return h(e)},SparseMatrix:function(e){return function(e){const t=e._size[0],n=e._size[1],i=Math.min(t,n),s=e._values,f=e._index,h=e._ptr,d=[],g=[],y=[],x=[t,i],b=[],v=[],w=[],N=[i,n];let E,A,S;const M=[],C=[];for(E=0;E<t;E++)M[E]=E,C[E]=E;const T=function(e,t){const n=C[e],r=C[t];M[n]=t,M[r]=e,C[e]=r,C[t]=n};for(A=0;A<n;A++){const e=new m;A<t&&(y.push(d.length),d.push(1),g.push(A)),w.push(b.length);const n=h[A],i=h[A+1];for(S=n;S<i;S++)E=f[S],e.set(M[E],s[S]);A>0&&e.forEach(0,A-1,(function(t,n){p._forEachRow(t,d,g,y,(function(r,i){r>t&&e.accumulate(r,l(a(i,n)))}))}));let C=A,B=e.get(A),D=r(B);e.forEach(A+1,t-1,(function(e,t){const n=r(t);u(n,D)&&(C=e,D=n,B=t)})),A!==C&&(p._swapRows(A,C,x[1],d,g,y),p._swapRows(A,C,N[1],b,v,w),e.swap(A,C),T(A,C)),e.forEach(0,t-1,(function(e,t){e<=A?(b.push(t),v.push(e)):(t=o(t,B),c(t,0)||(d.push(t),g.push(e)))}))}return w.push(b.length),y.push(d.length),{L:new p({values:d,index:g,ptr:y,size:x}),U:new p({values:b,index:v,ptr:w,size:N}),p:M,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){const t=h(n(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function h(e){const t=e._size[0],n=e._size[1];let l=Math.min(t,n);const p=ae(e._data),m=[],h=[t,l],d=[],g=[l,n];let y,x,b;const v=[];for(y=0;y<t;y++)v[y]=y;for(x=0;x<n;x++){if(x>0)for(y=0;y<t;y++){const e=Math.min(y,x);let t=0;for(b=0;b<e;b++)t=i(t,a(p[y][b],p[b][x]));p[y][x]=s(p[y][x],t)}let e=x,n=0,l=0;for(y=x;y<t;y++){const t=p[y][x],i=r(t);u(i,n)&&(e=y,n=i,l=t)}if(x!==e&&(v[x]=[v[e],v[e]=v[x]][0],f._swapRows(x,e,p)),x<t)for(y=x+1;y<t;y++){const e=p[y][x];c(e,0)||(p[y][x]=o(p[y][x],l))}}for(x=0;x<n;x++)for(y=0;y<t;y++)0===x&&(y<n&&(d[y]=[]),m[y]=[]),y<x?(y<n&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=0)):y!==x?(y<n&&(d[y][x]=0),x<t&&(m[y][x]=p[y][x])):(y<n&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=1));const w=new f({data:m,size:h}),N=new f({data:d,size:g}),E=[];for(y=0,l=v.length;y<l;y++)E[v[y]]=y;return{L:w,U:N,p:E,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}})),Fm=he("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],(e=>{let{typed:t,matrix:n,zeros:r,identity:i,isZero:o,equal:a,sign:s,sqrt:u,conj:c,unaryMinus:l,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=e;return sr(t("qr",{DenseMatrix:function(e){return y(e)},SparseMatrix:function(e){return function(){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){const t=y(n(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:g});function g(e){const t=e._size[0],n=e._size[1],d=i([t],"dense"),g=d._data,y=e.clone(),x=y._data;let b,v,w;const N=r([t],"");for(w=0;w<Math.min(n,t);++w){const e=x[w][w],r=l(a(e,0)?1:s(e)),i=c(r);let d=0;for(b=w;b<t;b++)d=f(d,m(x[b][w],c(x[b][w])));const y=m(r,u(d));if(!o(y)){const r=h(e,y);for(N[w]=1,b=w+1;b<t;b++)N[b]=p(x[b][w],r);const o=l(c(p(r,y)));let a;for(v=w;v<n;v++){for(a=0,b=w;b<t;b++)a=f(a,m(c(N[b]),x[b][v]));for(a=m(a,o),b=w;b<t;b++)x[b][v]=m(h(x[b][v],m(N[b],a)),i)}for(b=0;b<t;b++){for(a=0,v=w;v<t;v++)a=f(a,m(g[b][v],N[v]));for(a=m(a,o),v=w;v<t;++v)g[b][v]=p(h(g[b][v],m(a,c(N[v]))),i)}}}return{Q:d,R:y,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function y(e){const t=g(e),n=t.R._data;if(e._data.length>0){const e="Complex"===n[0][0].type?d(0):0;for(let t=0;t<n.length;++t)for(let r=0;r<t&&r<(n[0]||[]).length;++r)n[t][r]=e}return t}}));function Om(e,t,n,r,i,o,a){let s=0;for(n[a]=e;s>=0;){const e=n[a+s],u=n[r+e];-1===u?(s--,o[t++]=e):(n[r+e]=n[i+u],++s,n[a+s]=u)}return t}function _m(e){return-e-2}const Im=he("csAmd",["add","multiply","transpose"],(e=>{let{add:t,multiply:n,transpose:r}=e;return function(e,a){if(!a||e<=0||e>3)return null;const s=a._size,u=s[0],c=s[1];let l=0,f=Math.max(16,10*Math.sqrt(c));f=Math.min(c-2,f);const p=function(e,i,o,a,s){const u=r(i);if(1===e&&a===o)return t(i,u);if(2===e){const e=u._index,t=u._ptr;let a=0;for(let n=0;n<o;n++){let r=t[n];if(t[n]=a,!(t[n+1]-r>s))for(const i=t[n+1];r<i;r++)e[a++]=e[r]}return t[o]=a,i=r(u),n(u,i)}return n(u,i)}(e,a,u,c,f);!function(e,t){const n=e._values,r=e._index,i=e._ptr,o=e._size[1];let a=0;for(let e=0;e<o;e++){let o=i[e];for(i[e]=a;o<i[e+1];o++)t(r[o],e,n?n[o]:1,null)&&(r[a]=r[o],n&&(n[a]=n[o]),a++)}i[o]=a,r.splice(a,r.length-a),n&&n.splice(a,n.length-a)}(p,o);const m=p._index,h=p._ptr;let d=h[c];const g=[],y=[],x=c+1,b=2*(c+1),v=3*(c+1),w=4*(c+1),N=5*(c+1),E=6*(c+1),A=7*(c+1),S=g;let M,C,T,B,D,F,O,_,I,z,k,R,q,P,j,U,L=function(e,t,n,r,o,a,s,u,c,l,f,p){for(let r=0;r<e;r++)n[0+r]=t[r+1]-t[r];n[0+e]=0;for(let t=0;t<=e;t++)n[o+t]=-1,a[t]=-1,n[s+t]=-1,n[u+t]=-1,n[c+t]=1,n[l+t]=1,n[f+t]=0,n[p+t]=n[0+t];const m=i(0,0,n,l,e);return n[f+e]=-2,t[e]=-1,n[l+e]=0,m}(c,h,y,0,v,S,b,A,x,E,w,N),$=function(e,t,n,r,i,o,a,s,u,c,l){let f=0;for(let p=0;p<e;p++){const m=n[r+p];if(0===m)n[i+p]=-2,f++,t[p]=-1,n[o+p]=0;else if(m>a)n[s+p]=0,n[i+p]=-1,f++,t[p]=_m(e),n[s+e]++;else{const e=n[u+m];-1!==e&&(c[e]=p),n[l+p]=n[u+m],n[u+m]=p}}return f}(c,h,y,N,w,E,f,x,v,S,b),H=0;for(;$<c;){for(T=-1;H<c&&-1===(T=y[v+H]);H++);-1!==y[b+T]&&(S[y[b+T]]=-1),y[v+H]=y[b+T];const e=y[w+T];let t=y[x+T];$+=t;let n=0;y[x+T]=-t;let r=h[T];const o=0===e?r:d;let a=o;for(B=1;B<=e+1;B++){for(B>e?(F=T,O=r,_=y[0+T]-e):(F=m[r++],O=h[F],_=y[0+F]),D=1;D<=_;D++)M=m[O++],(I=y[x+M])<=0||(n+=I,y[x+M]=-I,m[a++]=M,-1!==y[b+M]&&(S[y[b+M]]=S[M]),-1!==S[M]?y[b+S[M]]=y[b+M]:y[v+y[N+M]]=y[b+M]);F!==T&&(h[F]=_m(T),y[E+F]=0)}for(0!==e&&(d=a),y[N+T]=n,h[T]=o,y[0+T]=a-o,y[w+T]=-2,L=i(L,l,y,E,c),z=o;z<a;z++){if(M=m[z],(k=y[w+M])<=0)continue;I=-y[x+M];const e=L-I;for(r=h[M],R=h[M]+k-1;r<=R;r++)F=m[r],y[E+F]>=L?y[E+F]-=I:0!==y[E+F]&&(y[E+F]=y[N+F]+e)}for(z=o;z<a;z++){for(M=m[z],R=h[M],q=R+y[w+M]-1,P=R,j=0,U=0,r=R;r<=q;r++)if(F=m[r],0!==y[E+F]){const e=y[E+F]-L;e>0?(U+=e,m[P++]=F,j+=F):(h[F]=_m(T),y[E+F]=0)}y[w+M]=P-R+1;const e=P,i=R+y[0+M];for(r=q+1;r<i;r++){C=m[r];const e=y[x+C];e<=0||(U+=e,m[P++]=C,j+=C)}0===U?(h[M]=_m(T),I=-y[x+M],n-=I,t+=I,$+=I,y[x+M]=0,y[w+M]=-1):(y[N+M]=Math.min(y[N+M],U),m[P]=m[e],m[e]=m[R],m[R]=T,y[0+M]=P-R+1,j=(j<0?-j:j)%c,y[b+M]=y[A+j],y[A+j]=M,S[M]=j)}for(y[N+T]=n,l=Math.max(l,n),L=i(L+l,l,y,E,c),z=o;z<a;z++)if(M=m[z],!(y[x+M]>=0))for(j=S[M],M=y[A+j],y[A+j]=-1;-1!==M&&-1!==y[b+M];M=y[b+M],L++){for(_=y[0+M],k=y[w+M],r=h[M]+1;r<=h[M]+_-1;r++)y[E+m[r]]=L;let e=M;for(C=y[b+M];-1!==C;){let t=y[0+C]===_&&y[w+C]===k;for(r=h[C]+1;t&&r<=h[C]+_-1;r++)y[E+m[r]]!==L&&(t=0);t?(h[C]=_m(M),y[x+M]+=y[x+C],y[x+C]=0,y[w+C]=-1,C=y[b+C],y[b+e]=C):(e=C,C=y[b+C])}}for(r=o,z=o;z<a;z++)M=m[z],(I=-y[x+M])<=0||(y[x+M]=I,U=y[N+M]+n-I,U=Math.min(U,c-$-I),-1!==y[v+U]&&(S[y[v+U]]=M),y[b+M]=y[v+U],S[M]=-1,y[v+U]=M,H=Math.min(H,U),y[N+M]=U,m[r++]=M);y[x+T]=t,0==(y[0+T]=r-o)&&(h[T]=-1,y[E+T]=0),0!==e&&(d=r)}for(M=0;M<c;M++)h[M]=_m(h[M]);for(C=0;C<=c;C++)y[v+C]=-1;for(C=c;C>=0;C--)y[x+C]>0||(y[b+C]=y[v+h[C]],y[v+h[C]]=C);for(F=c;F>=0;F--)y[x+F]<=0||-1!==h[F]&&(y[b+F]=y[v+h[F]],y[v+h[F]]=F);for(T=0,M=0;M<=c;M++)-1===h[M]&&(T=Om(M,T,y,v,b,g,E));return g.splice(g.length-1,1),g};function i(e,t,n,r,i){if(e<2||e+t<0){for(let e=0;e<i;e++)0!==n[r+e]&&(n[r+e]=1);e=2}return e}function o(e,t){return e!==t}}));function zm(e,t,n,r,i,o,a){let s,u,c,l=0;if(e<=t||n[r+t]<=n[i+e])return-1;n[i+e]=n[r+t];const f=n[o+e];if(n[o+e]=t,-1===f)l=1,c=e;else{for(l=2,c=f;c!==n[a+c];c=n[a+c]);for(s=f;s!==c;s=u)u=n[a+s],n[a+s]=c}return{jleaf:l,q:c}}const km=he("csCounts",["transpose"],(e=>{let{transpose:t}=e;return function(e,n,r,i){if(!e||!n||!r)return null;const o=e._size,a=o[0],s=o[1];let u,c,l,f,p,m,h;const d=4*s+(i?s+a+1:0),g=[],y=s,x=2*s,b=3*s,v=4*s,w=5*s+1;for(l=0;l<d;l++)g[l]=-1;const N=[],E=t(e),A=E._index,S=E._ptr;for(l=0;l<s;l++)for(c=r[l],N[c]=-1===g[b+c]?1:0;-1!==c&&-1===g[b+c];c=n[c])g[b+c]=l;if(i){for(l=0;l<s;l++)g[r[l]]=l;for(u=0;u<a;u++){for(l=s,m=S[u],h=S[u+1],p=m;p<h;p++)l=Math.min(l,g[A[p]]);g[w+u]=g[v+l],g[v+l]=u}}for(u=0;u<s;u++)g[0+u]=u;for(l=0;l<s;l++){for(c=r[l],-1!==n[c]&&N[n[c]]--,f=i?g[v+l]:c;-1!==f;f=i?g[w+f]:-1)for(p=S[f];p<S[f+1];p++){u=A[p];const e=zm(u,c,g,b,y,x,0);e.jleaf>=1&&N[c]++,2===e.jleaf&&N[e.q]--}-1!==n[c]&&(g[0+c]=n[c])}for(c=0;c<s;c++)-1!==n[c]&&(N[n[c]]+=N[c]);return N}})),Rm=he("csSqr",["add","multiply","transpose"],(e=>{let{add:t,multiply:n,transpose:r}=e;const i=Im({add:t,multiply:n,transpose:r}),o=km({transpose:r});return function(e,t,n){const r=t._ptr,a=t._size[1];let s;const u={};if(u.q=i(e,t),e&&!u.q)return null;if(n){const n=e?function(e,t,n){const r=e._values,i=e._index,o=e._ptr,a=e._size,s=e._datatype,u=a[0],c=a[1],l=null,f=[],p=[];let m=0;for(let e=0;e<c;e++){p[e]=m;const t=n?n[e]:e;for(let e=o[t],n=o[t+1],a=e;a<n;a++){const e=i[a];f[m]=e,l&&(l[m]=r[a]),m++}}return p[c]=m,e.createSparseMatrix({values:l,index:f,ptr:p,size:[u,c],datatype:s})}(t,0,u.q):t;u.parent=function(e){if(!e)return null;const t=e._index,n=e._ptr,r=e._size,i=r[0],o=r[1],a=[],s=[],u=o;let c,l;for(c=0;c<i;c++)s[u+c]=-1;for(let e=0;e<o;e++){a[e]=-1,s[0+e]=-1;for(let r=n[e],i=n[e+1],o=r;o<i;o++){const n=t[o];for(c=s[u+n];-1!==c&&c<e;c=l)l=s[0+c],s[0+c]=e,-1===l&&(a[c]=e);s[u+n]=e}}return a}(n);const r=function(e,t){if(!e)return null;let n,r=0;const i=[],o=[],a=t,s=2*t;for(n=0;n<t;n++)o[0+n]=-1;for(n=t-1;n>=0;n--)-1!==e[n]&&(o[a+n]=o[0+e[n]],o[0+e[n]]=n);for(n=0;n<t;n++)-1===e[n]&&(r=Om(n,r,o,0,a,i,s));return i}(u.parent,a);if(u.cp=o(n,u.parent,r,1),n&&u.parent&&u.cp&&function(e,t){const n=e._ptr,r=e._index,i=e._size,o=i[0],a=i[1];t.pinv=[],t.leftmost=[];const s=t.parent,u=t.pinv,c=t.leftmost,l=[],f=o,p=o+a,m=o+2*a;let h,d,g,y,x;for(d=0;d<a;d++)l[f+d]=-1,l[p+d]=-1,l[m+d]=0;for(h=0;h<o;h++)c[h]=-1;for(d=a-1;d>=0;d--)for(y=n[d],x=n[d+1],g=y;g<x;g++)c[r[g]]=d;for(h=o-1;h>=0;h--)u[h]=-1,d=c[h],-1!==d&&(0==l[m+d]++&&(l[p+d]=h),l[0+h]=l[f+d],l[f+d]=h);for(t.lnz=0,t.m2=o,d=0;d<a;d++){if(h=l[f+d],t.lnz++,h<0&&(h=t.m2++),u[h]=d,--m[d]<=0)continue;t.lnz+=l[m+d];const e=s[d];-1!==e&&(0===l[m+e]&&(l[p+e]=l[p+d]),l[0+l[p+d]]=l[f+e],l[f+e]=l[0+h],l[m+e]+=l[m+d])}for(h=0;h<o;h++)u[h]<0&&(u[h]=d++);return!0}(n,u))for(u.unz=0,s=0;s<a;s++)u.unz+=u.cp[s]}else u.unz=4*r[a]+a,u.lnz=u.unz;return u}}));function qm(e,t){return e[t]<0}function Pm(e,t){e[t]=_m(e[t])}function jm(e){return e<0?_m(e):e}function Um(e,t,n,r,i){const o=t._index,a=t._ptr,s=t._size[1];let u,c,l,f=0;for(r[0]=e;f>=0;){e=r[f];const t=i?i[e]:e;qm(a,e)||(Pm(a,e),r[s+f]=t<0?0:jm(a[t]));let p=1;for(c=r[s+f],l=t<0?0:jm(a[t+1]);c<l;c++)if(u=o[c],!qm(a,u)){r[s+f]=c,r[++f]=u,p=0;break}p&&(f--,r[--n]=e)}return n}const Lm=he("csSpsolve",["divideScalar","multiply","subtract"],(e=>{let{divideScalar:t,multiply:n,subtract:r}=e;return function(e,i,o,a,s,u,c){const l=e._values,f=e._index,p=e._ptr,m=e._size[1],h=i._values,d=i._index,g=i._ptr;let y,x,b,v;const w=function(e,t,n,r,i){const o=e._ptr,a=e._size,s=t._index,u=t._ptr,c=a[1];let l,f,p,m=c;for(f=u[n],p=u[n+1],l=f;l<p;l++){const t=s[l];qm(o,t)||(m=Um(t,e,m,r,i))}for(l=m;l<c;l++)Pm(o,r[l]);return m}(e,i,o,a,u);for(y=w;y<m;y++)s[a[y]]=0;for(x=g[o],b=g[o+1],y=x;y<b;y++)s[d[y]]=h[y];for(let e=w;e<m;e++){const i=a[e],o=u?u[i]:i;if(!(o<0))for(x=p[o],b=p[o+1],s[i]=t(s[i],l[c?x:b-1]),y=c?x+1:x,v=c?b:b-1;y<v;y++){const e=f[y];s[e]=r(s[e],n(l[y],s[i]))}}return w}})),$m=he("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],(e=>{let{abs:t,divideScalar:n,multiply:r,subtract:i,larger:o,largerEq:a,SparseMatrix:s}=e;const u=Lm({divideScalar:n,multiply:r,subtract:i});return function(e,i,c){if(!e)return null;const l=e._size[1];let f,p=100,m=100;i&&(f=i.q,p=i.lnz||p,m=i.unz||m);const h=[],d=[],g=[],y=new s({values:h,index:d,ptr:g,size:[l,l]}),x=[],b=[],v=[],w=new s({values:x,index:b,ptr:v,size:[l,l]}),N=[];let E,A;const S=[],M=[];for(E=0;E<l;E++)S[E]=0,N[E]=-1,g[E+1]=0;p=0,m=0;for(let i=0;i<l;i++){g[i]=p,v[i]=m;const s=f?f[i]:i,w=u(y,e,s,M,S,N,1);let C=-1,T=-1;for(A=w;A<l;A++)if(E=M[A],N[E]<0){const e=t(S[E]);o(e,T)&&(T=e,C=E)}else b[m]=N[E],x[m++]=S[E];if(-1===C||T<=0)return null;N[s]<0&&a(t(S[s]),r(T,c))&&(C=s);const B=S[C];for(b[m]=i,x[m++]=B,N[C]=i,d[p]=C,h[p++]=1,A=w;A<l;A++)E=M[A],N[E]<0&&(d[p]=E,h[p++]=n(S[E],B)),S[E]=0}for(g[l]=p,v[l]=m,A=0;A<p;A++)d[A]=N[d[A]];return h.splice(p,h.length-p),d.splice(p,d.length-p),x.splice(m,x.length-m),b.splice(m,b.length-m),{L:y,U:w,pinv:N}}})),Hm=he("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],(e=>{let{typed:t,abs:n,add:r,multiply:i,transpose:o,divideScalar:a,subtract:s,larger:u,largerEq:c,SparseMatrix:l}=e;const f=Rm({add:r,multiply:i,transpose:o}),p=$m({abs:n,divideScalar:a,multiply:i,subtract:s,larger:u,largerEq:c,SparseMatrix:l});return t("slu",{"SparseMatrix, number, number":function(e,t,n){if(!ye(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(n<0||n>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");const r=f(t,e,!1),i=p(e,r,n);return{L:i.L,U:i.U,p:i.pinv,q:r.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function Gm(e,t){let n;const r=t.length,i=[];if(e)for(n=0;n<r;n++)i[e[n]]=t[n];else for(n=0;n<r;n++)i[n]=t[n];return i}const Vm="lusolve",Zm=he(Vm,["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],(e=>{let{typed:t,matrix:n,lup:r,slu:i,usolve:o,lsolve:a,DenseMatrix:s}=e;const u=Mc({DenseMatrix:s});return t(Vm,{"Array, Array | Matrix":function(e,t){e=n(e);const i=r(e);return l(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){const n=r(e);return l(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){const n=r(e);return l(n.L,n.U,n.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,n,r){const o=i(e,n,r);return l(o.L,o.U,o.p,o.q,t)},"Object, Array | Matrix":function(e,t){return l(e.L,e.U,e.p,e.q,t)}});function c(e){if(E(e))return e;if(N(e))return n(e);throw new TypeError("Invalid Matrix LU decomposition")}function l(e,t,n,r,i){e=c(e),t=c(t),n&&((i=u(e,i,!0))._data=Gm(n,i._data));const s=a(e,i),l=o(t,s);return r&&(l._data=Gm(r,l._data)),l}})),Wm="polynomialRoot",Ym=he(Wm,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],(e=>{let{typed:t,isZero:n,equalScalar:r,add:i,subtract:o,multiply:a,divide:s,sqrt:u,unaryMinus:c,cbrt:l,typeOf:f,im:p,re:m}=e;return t(Wm,{"number|Complex, ...number|Complex":(e,t)=>{const h=[e,...t];for(;h.length>0&&n(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError(`Polynomial [${e}, ${t}] must have a non-zero non-constant coefficient`);switch(h.length){case 2:return[c(s(h[0],h[1]))];case 3:{const[e,t,n]=h,i=a(2,n),l=a(t,t),f=a(4,n,e);if(r(l,f))return[s(c(t),i)];const p=u(o(l,f));return[s(o(p,t),i),s(o(c(p),t),i)]}case 4:{const[e,t,n,d]=h,g=c(a(3,d)),y=a(n,n),x=a(3,d,t),b=i(a(2,n,n,n),a(27,d,d,e)),v=a(9,d,n,t);if(r(y,x)&&r(b,v))return[s(n,g)];const w=o(y,x),N=o(b,v),E=i(a(18,d,n,t,e),a(n,n,t,t)),A=i(a(4,n,n,n,e),a(4,d,t,t,t),a(27,d,d,e,e));if(r(E,A))return[s(o(a(4,d,n,t),i(a(9,d,d,e),a(n,n,n))),a(d,w)),s(o(a(9,d,e),a(n,t)),a(2,w))];let S;return S=r(y,x)?N:s(i(N,u(o(a(N,N),a(4,w,w,w)))),2),l(S,!0).toArray().map((e=>s(i(n,e,s(w,e)),g))).map((e=>"Complex"===f(e)&&r(m(e),m(e)+p(e))?m(e):e))}default:throw new RangeError(`only implemented for cubic or lower-order polynomials, not ${h}`)}}})}));n(9463);const Jm=he("Help",["evaluate"],(e=>{let{evaluate:t}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return n.prototype.type="Help",n.prototype.isHelp=!0,n.prototype.toString=function(){const e=this.doc||{};let n="\n";if(e.name&&(n+="Name: "+e.name+"\n\n"),e.category&&(n+="Category: "+e.category+"\n\n"),e.description&&(n+="Description:\n "+e.description+"\n\n"),e.syntax&&(n+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){n+="Examples:\n";let r=!1;const i=t("config()"),o={config:e=>(r=!0,t("config(newConfig)",{newConfig:e}))};for(let r=0;r<e.examples.length;r++){const i=e.examples[r];let a;n+=" "+i+"\n";try{a=t(i,o)}catch(e){a=e}void 0===a||F(a)||(n+=" "+pr(a,{precision:14})+"\n")}n+="\n",r&&t("config(originalConfig)",{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(n+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(n+="See also: "+e.seealso.join(", ")+"\n"),n},n.prototype.toJSON=function(){const e=ae(this.doc);return e.mathjs="Help",e},n.fromJSON=function(e){const t={};return Object.keys(e).filter((e=>"mathjs"!==e)).forEach((n=>{t[n]=e[n]})),new n(t)},n.prototype.valueOf=n.prototype.toString,n}),{isClass:!0}),Xm=he("Chain",["?on","math","typed"],(e=>{let{on:t,math:n,typed:r}=e;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");ie(e)?this.value=e.value:this.value=e}function o(e,t){pe(i.prototype,e,(function(){const e=t();if("function"==typeof e)return a(e)}))}function a(e){return function(){if(0===arguments.length)return new i(e(this.value));const t=[this.value];for(let e=0;e<arguments.length;e++)t[e+1]=arguments[e];if(r.isTypedFunction(e)){const n=r.resolve(e,t);if(1===n.params.length)throw new Error("chain function "+e.name+" cannot match rest parameter between chain value and additional arguments.");return new i(n.implementation.apply(e,t))}return new i(e.apply(e,t))}}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 pr(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,t){if("string"==typeof e)n=e,"function"==typeof(r=t)&&(i.prototype[n]=a(r));else for(const t in e)me(e,t)&&void 0===s[t]&&o(t,(()=>e[t]));var n,r};const s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(n),t&&t("import",(function(e,t,n){n||o(e,t)})),i}),{isClass:!0}),Qm={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"]},Km={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"]},eh={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,den)","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:Qm,E:Qm,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"]},pi:Km,PI:Km,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"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},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, 1], [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 cubic 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:["divide"]},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"]},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"]},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(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:[]},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:[]},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"]},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 callback to each slice of A along dimension dim.",examples:["A = [[1, 2], [3, 4]]","mapSlices(A, 1, sum)","mapSlices(A, 2, product)"],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","ones","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"]},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)"],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","ones","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","ones","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","ones","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.",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"]},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.",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.",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.",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","sum","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"]},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"]},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:[]},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"]},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"]}},th="help",nh=he(th,["typed","mathWithTransform","Help"],(e=>{let{typed:t,mathWithTransform:n,Help:r}=e;return t(th,{any:function(e){let t,o=e;if("string"!=typeof e)for(t in n)if(me(n,t)&&e===n[t]){o=t;break}const a=i(eh,o);if(!a){const e="function"==typeof o?o.name:o;throw new Error('No documentation found on "'+e+'"')}return new r(a)}})})),rh="chain",ih=he(rh,["typed","Chain"],(e=>{let{typed:t,Chain:n}=e;return t(rh,{"":function(){return new n},any:function(e){return new n(e)}})})),oh=he("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],(e=>{let{typed:t,matrix:n,subtractScalar:r,multiply:i,divideScalar:o,isZero:a,unaryMinus:s}=e;return t("det",{any:function(e){return ae(e)},"Array | Matrix":function(e){let t;switch(t=E(e)?e.size():Array.isArray(e)?(e=n(e)).size():[],t.length){case 0:return ae(e);case 1:if(1===t[0])return ae(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const n=t[0],u=t[1];if(n===u)return function(e,t){if(1===t)return ae(e[0][0]);if(2===t)return r(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));{let n=!1;const u=new Array(t).fill(0).map(((e,t)=>t));for(let s=0;s<t;s++){let c=u[s];if(a(e[c][s])){let r;for(r=s+1;r<t;r++)if(!a(e[u[r]][s])){c=u[r],u[r]=u[s],u[s]=c,n=!n;break}if(r===t)return e[c][s]}const l=e[c][s],f=0===s?1:e[u[s-1]][s-1];for(let n=s+1;n<t;n++){const a=u[n];for(let n=s+1;n<t;n++)e[a][n]=o(r(i(e[a][n],l),i(e[a][s],e[c][n])),f)}}const c=e[u[t-1]][t-1];return n?s(c):c}}(e.clone().valueOf(),n);if(0===u)return 1;throw new RangeError("Matrix must be square (size: "+pr(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}}})})),ah=he("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],(e=>{let{typed:t,matrix:n,divideScalar:r,addScalar:i,multiply:o,unaryMinus:a,det:s,identity:u,abs:c}=e;return t("inv",{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:if(1===t[0])return E(e)?n([r(1,e.valueOf()[0])]):[r(1,e[0])];throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:{const r=t[0],i=t[1];if(r===i)return E(e)?n(l(e.valueOf(),r,i),e.storage()):l(e,r,i);throw new RangeError("Matrix must be square (size: "+pr(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}},any:function(e){return r(1,e)}});function l(e,t,n){let l,f,p,m,h;if(1===t){if(m=e[0][0],0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[r(1,m)]]}if(2===t){const t=s(e);if(0===t)throw Error("Cannot calculate inverse, determinant is zero");return[[r(e[1][1],t),r(a(e[0][1]),t)],[r(a(e[1][0]),t),r(e[0][0],t)]]}{const s=e.concat();for(l=0;l<t;l++)s[l]=s[l].concat();const m=u(t).valueOf();for(let e=0;e<n;e++){let u=c(s[e][e]),d=e;for(l=e+1;l<t;)c(s[l][e])>u&&(u=c(s[l][e]),d=l),l++;if(0===u)throw Error("Cannot calculate inverse, determinant is zero");l=d,l!==e&&(h=s[e],s[e]=s[l],s[l]=h,h=m[e],m[e]=m[l],m[l]=h);const g=s[e],y=m[e];for(l=0;l<t;l++){const t=s[l],u=m[l];if(l!==e){if(0!==t[e]){for(p=r(a(t[e]),g[e]),f=e;f<n;f++)t[f]=i(t[f],o(p,g[f]));for(f=0;f<n;f++)u[f]=i(u[f],o(p,y[f]))}}else{for(p=g[e],f=e;f<n;f++)t[f]=r(t[f],p);for(f=0;f<n;f++)u[f]=r(u[f],p)}}}return m}}})),sh="pinv",uh=he(sh,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],(e=>{let{typed:t,matrix:n,inv:r,deepEqual:i,equal:o,dotDivide:a,dot:s,ctranspose:u,divideScalar:c,multiply:l,add:f,Complex:p}=e;return t(sh,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:return d(e)?u(e):1===t[0]?r(e):a(u(e),s(e,e));case 2:{if(d(e))return u(e);const i=t[0],o=t[1];if(i===o)try{return r(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return E(e)?n(m(e.valueOf(),i,o),e.storage()):m(e,i,o)}default:throw new RangeError("Matrix must be two dimensional (size: "+pr(t)+")")}},any:function(e){return o(e,0)?ae(e):c(1,e)}});function m(e,t,n){const{C:i,F:o}=function(e,t,n){const r=function(e,t,n){const r=ae(e);let i=0;for(let e=0;e<t;e++){if(n<=i)return r;let o=e;for(;h(r[o][i]);)if(o++,t===o&&(o=e,i++,n===i))return r;[r[o],r[e]]=[r[e],r[o]];let s=r[e][i];for(let t=0;t<n;t++)r[e][t]=a(r[e][t],s);for(let o=0;o<t;o++)if(o!==e){s=r[o][i];for(let t=0;t<n;t++)r[o][t]=f(r[o][t],l(-1,l(s,r[e][t])))}i++}return r}(e,t,n);return{C:e.map(((e,n)=>e.filter(((e,n)=>n<t&&!h(s(r[n],r[n])))))),F:r.filter(((e,t)=>!h(s(r[t],r[t]))))}}(e,t,n),c=l(r(l(u(i),i)),u(i)),p=l(u(o),r(l(o,u(o))));return l(p,c)}function h(e){return o(f(e,p(1,1)),f(0,p(1,1)))}function d(e){return i(f(e,p(1,1)),f(l(e,0),p(1,1)))}}));const ch=he("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=>{let{config:t,typed:n,matrix:r,addScalar:i,subtract:o,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:y,add:v,larger:w,column:N,flatten:E,number:A,complex:S,sqrt:M,diag:C,size:T,reshape:B,qr:D,usolve:F,usolveAll:O,im:_,re:I,smaller:z,matrixFromColumns:k,dot:R}=e;const q=function(e){let{config:t,addScalar:n,subtract:r,abs:i,atan:o,cos:a,sin:s,multiplyScalar:u,inv:c,bignumber:l,multiply:f,add:p}=e;function m(e,n,r){const i=n-e;return Math.abs(i)<=t.relTol?Math.PI/4:.5*Math.atan(2*r/(n-e))}function h(e,n,a){const s=r(n,e);return i(s)<=t.relTol?l(-1).acos().div(4):u(.5,o(f(2,a,c(s))))}function d(e,t,n,r){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=Array(i).fill(0),u=Array(i).fill(0);for(let t=0;t<i;t++)s[t]=o*e[t][n]-a*e[t][r],u[t]=a*e[t][n]+o*e[t][r];for(let t=0;t<i;t++)e[t][n]=s[t],e[t][r]=u[t];return e}function g(e,t,i,o){const c=e.length,f=a(t),p=s(t),m=Array(c).fill(l(0)),h=Array(c).fill(l(0));for(let t=0;t<c;t++)m[t]=r(u(f,e[t][i]),u(p,e[t][o])),h[t]=n(u(p,e[t][i]),u(f,e[t][o]));for(let t=0;t<c;t++)e[t][i]=m[t],e[t][o]=h[t];return e}function y(e,t,i,o){const c=e.length,m=l(a(t)),h=l(s(t)),d=u(m,m),g=u(h,h),y=Array(c).fill(l(0)),x=Array(c).fill(l(0)),b=f(l(2),m,h,e[i][o]),v=n(r(u(d,e[i][i]),b),u(g,e[o][o])),w=p(u(g,e[i][i]),b,u(d,e[o][o]));for(let t=0;t<c;t++)y[t]=r(u(m,e[i][t]),u(h,e[o][t])),x[t]=n(u(h,e[i][t]),u(m,e[o][t]));e[i][i]=v,e[o][o]=w,e[i][o]=l(0),e[o][i]=l(0);for(let t=0;t<c;t++)t!==i&&t!==o&&(e[i][t]=y[t],e[t][i]=y[t],e[o][t]=x[t],e[t][o]=x[t]);return e}function x(e,t,n,r){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=o*o,u=a*a,c=Array(i).fill(0),l=Array(i).fill(0),f=s*e[n][n]-2*o*a*e[n][r]+u*e[r][r],p=u*e[n][n]+2*o*a*e[n][r]+s*e[r][r];for(let t=0;t<i;t++)c[t]=o*e[n][t]-a*e[r][t],l[t]=a*e[n][t]+o*e[r][t];e[n][n]=f,e[r][r]=p,e[n][r]=0,e[r][n]=0;for(let t=0;t<i;t++)t!==n&&t!==r&&(e[n][t]=c[t],e[t][n]=c[t],e[r][t]=l[t],e[t][r]=l[t]);return e}function b(e){const t=e.length;let n=0,r=[0,1];for(let i=0;i<t;i++)for(let o=i+1;o<t;o++)Math.abs(n)<Math.abs(e[i][o])&&(n=Math.abs(e[i][o]),r=[i,o]);return[r,n]}function v(e){const t=e.length;let n=0,r=[0,1];for(let o=0;o<t;o++)for(let a=o+1;a<t;a++)i(n)<i(e[o][a])&&(n=i(e[o][a]),r=[o,a]);return[r,n]}function w(e,t,n){const r=e.length,o=Array(r);let a;if(n){a=Array(r);for(let e=0;e<r;e++)a[e]=Array(r)}for(let s=0;s<r;s++){let u=0,c=e[0];for(let t=0;t<e.length;t++)i(e[t])<i(c)&&(u=t,c=e[u]);if(o[s]=e.splice(u,1)[0],n)for(let e=0;e<r;e++)a[s][e]=t[e][u],t[e].splice(u,1)}if(!n)return{values:o};const s=a.map(((e,t)=>({value:o[t],vector:e})));return{values:o,eigenvectors:s}}return function(e,n){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.relTol,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if("number"===o)return function(e,t,n){const r=e.length,i=Math.abs(t/r);let o,a;if(n){a=new Array(r);for(let e=0;e<r;e++)a[e]=Array(r).fill(0),a[e][e]=1}let s=b(e);for(;Math.abs(s[1])>=Math.abs(i);){const t=s[0][0],r=s[0][1];o=m(e[t][t],e[r][r],e[t][r]),e=x(e,o,t,r),n&&(a=d(a,o,t,r)),s=b(e)}const u=Array(r).fill(0);for(let t=0;t<r;t++)u[t]=e[t][t];return w(ae(u),a,n)}(e,r,a);if("BigNumber"===o)return function(e,t,n){const r=e.length,o=i(t/r);let a,s;if(n){s=new Array(r);for(let e=0;e<r;e++)s[e]=Array(r).fill(0),s[e][e]=1}let u=v(e);for(;i(u[1])>=i(o);){const t=u[0][0],r=u[0][1];a=h(e[t][t],e[r][r],e[t][r]),e=y(e,a,t,r),n&&(s=g(s,a,t,r)),u=v(e)}const c=Array(r).fill(0);for(let t=0;t<r;t++)c[t]=e[t][t];return w(ae(c),s,n)}(e,r,a);throw TypeError("Unsupported data type: "+o)}}({config:t,addScalar:i,subtract:o,column:N,flatten:E,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,inv:m,bignumber:h,complex:S,multiply:y,add:v}),P=function(e){let{addScalar:t,subtract:n,flatten:r,multiply:i,multiplyScalar:o,divideScalar:a,sqrt:s,abs:u,bignumber:c,diag:l,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:g,equal:y,complex:x,larger:b,smaller:v,matrixFromColumns:w,dot:N}=e;function E(e,r,i,a){const u=t(e,a),c=n(o(e,a),o(r,i)),l=o(u,.5),f=o(s(n(o(u,u),o(4,c))),.5);return[t(l,f),n(l,f)]}function A(e,t,r,i,o,a,s,l){const f="BigNumber"===l,p="Complex"===l,m=f?c(0):p?x(0):0,h=f?c(1):p?x(1):1;if(v(u(r),s))return[[h,m],[m,h]];if(b(u(n(o,a)),s))return[[n(o,i),n(a,i)],[r,r]];const d=n(e,o),g=n(i,o);return v(u(t),s)&&v(u(g),s)?[[d,h],[r,m]]:[[t,m],[g,h]]}function S(e,t){for(let n=0;n<e.length;n++)e[n].push(...Array(t-e[n].length).fill(0));for(let n=e.length;n<t;n++)e.push(Array(t).fill(0)),e[n][n]=1;return e}function M(e,t,n){for(let r=0;r<e.length;r++)if(n(e[r],t))return r;return-1}function C(e,t,n,r,i){const o="BigNumber"===i?c(1e3):1e3;let a,s=0;for(;s<5;++s){a=T(t,n,i);try{a=d(e,a)}catch(e){continue}if(b(D(a),o))break}if(s>=5)return null;for(s=0;;){const t=d(e,a);if(v(D(B(a,[t])),r))break;if(++s>=10)return null;a=F(t)}return a}function T(e,t,n){const r="BigNumber"===n,i="Complex"===n;let o=Array(e).fill(0).map((e=>2*Math.random()-1));return r&&(o=o.map((e=>c(e)))),i&&(o=o.map((e=>x(e)))),o=B(o,t),F(o,n)}function B(e,t){const r=f(e);for(let o of t)o=p(o,r),e=n(e,i(a(N(o,e),N(o,o)),o));return e}function D(e){return u(s(N(e,e)))}function F(e,t){const n="Complex"===t,r="BigNumber"===t?c(1):n?x(1):1;return i(a(r,D(e)),e)}return function(e,s,f,p){let d=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const w=function(e,n,r,i,s){const f="BigNumber"===i,p="Complex"===i,m=f?c(0):0,h=f?c(1):p?x(1):1,d=f?c(1):1,g=f?c(10):2,w=o(g,g);let N;s&&(N=Array(n).fill(h));let E=!1;for(;!E;){E=!0;for(let r=0;r<n;r++){let i=m,c=m;for(let o=0;o<n;o++)r!==o&&(i=t(i,u(e[o][r])),c=t(c,u(e[r][o])));if(!y(i,0)&&!y(c,0)){let u=d,l=i;const f=a(c,g),p=o(c,g);for(;v(l,f);)l=o(l,w),u=o(u,g);for(;b(l,p);)l=a(l,w),u=a(u,g);if(v(a(t(l,c),u),o(t(i,c),.95))){E=!1;const t=a(1,u);for(let i=0;i<n;i++)r!==i&&(e[r][i]=o(e[r][i],t),e[i][r]=o(e[i][r],u));s&&(N[r]=o(N[r],t))}}}}return s?l(N):null}(e,s,0,p,d);!function(e,r,i,s,l,f){const p="BigNumber"===s,m="Complex"===s,h=p?c(0):m?x(0):0;p&&(i=c(i));for(let s=0;s<r-2;s++){let c=0,p=h;for(let t=s+1;t<r;t++){const n=e[t][s];v(u(p),u(n))&&(p=n,c=t)}if(!v(u(p),i)){if(c!==s+1){const t=e[c];e[c]=e[s+1],e[s+1]=t;for(let t=0;t<r;t++){const n=e[t][c];e[t][c]=e[t][s+1],e[t][s+1]=n}if(l){const e=f[c];f[c]=f[s+1],f[s+1]=e}}for(let i=s+2;i<r;i++){const u=a(e[i][s],p);if(0!==u){for(let t=0;t<r;t++)e[i][t]=n(e[i][t],o(u,e[s+1][t]));for(let n=0;n<r;n++)e[n][s+1]=t(e[n][s+1],o(u,e[n][i]));if(l)for(let e=0;e<r;e++)f[i][e]=n(f[i][e],o(u,f[s+1][e]))}}}}}(e,s,f,p,d,w);const{values:N,C:T}=function(e,r,o,a,s){const f="BigNumber"===a,p="Complex"===a,m=f?c(1):p?x(1):1;f&&(o=c(o));let d=ae(e);const g=[];let y=r;const b=[];let w=s?l(Array(r).fill(m)):void 0,N=s?l(Array(y).fill(m)):void 0,M=0;for(;M<=100;){M+=1;const e=d[y-1][y-1];for(let t=0;t<y;t++)d[t][t]=n(d[t][t],e);const{Q:c,R:f}=h(d);d=i(f,c);for(let n=0;n<y;n++)d[n][n]=t(d[n][n],e);if(s&&(N=i(N,c)),1===y||v(u(d[y-1][y-2]),o)){M=0,g.push(d[y-1][y-1]),s&&(b.unshift([[1]]),S(N,r),w=i(w,N),y>1&&(N=l(Array(y-1).fill(m)))),y-=1,d.pop();for(let e=0;e<y;e++)d[e].pop()}else if(2===y||v(u(d[y-2][y-3]),o)){M=0;const e=E(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1]);g.push(...e),s&&(b.unshift(A(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1],e[0],e[1],o,a)),S(N,r),w=i(w,N),y>2&&(N=l(Array(y-2).fill(m)))),y-=2,d.pop(),d.pop();for(let e=0;e<y;e++)d[e].pop(),d[e].pop()}if(0===y)break}if(g.sort(((e,t)=>+n(u(e),u(t)))),M>100){const e=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw e.values=g,e.vectors=[],e}const C=s?i(w,function(e,t){const n=[];for(let e=0;e<t;e++)n[e]=Array(t).fill(0);let r=0;for(const t of e){const e=t.length;for(let i=0;i<e;i++)for(let o=0;o<e;o++)n[r+i][r+o]=t[i][o];r+=e}return n}(b,r)):void 0;return{values:g,C}}(e,s,f,p,d);if(d){const t=function(e,t,o,a,s,u,f){const p=m(o),h=i(p,e,o),d="BigNumber"===f,b="Complex"===f,v=d?c(0):b?x(0):0,w=d?c(1):b?x(1):1,N=[],E=[];for(const e of s){const t=M(N,e,y);-1===t?(N.push(e),E.push(1)):E[t]+=1}const A=[],S=N.length,T=Array(t).fill(v),B=l(Array(t).fill(w));for(let e=0;e<S;e++){const s=N[e],c=n(h,i(s,B));let l=g(c,T);for(l.shift();l.length<E[e];){const e=C(c,t,l,u,f);if(null===e)break;l.push(e)}const p=i(m(a),o);l=l.map((e=>i(p,e))),A.push(...l.map((e=>({value:s,vector:r(e)}))))}return A}(e,s,T,w,N,f,p);return{values:N,eigenvectors:t}}return{values:N}}}({config:t,addScalar:i,subtract:o,multiply:y,multiplyScalar:f,flatten:E,divideScalar:p,sqrt:M,abs:s,bignumber:h,diag:C,size:T,reshape:B,qr:D,inv:m,usolve:F,usolveAll:O,equal:a,complex:S,larger:w,smaller:z,matrixFromColumns:k,dot:R});return n("eigs",{Array:function(e){return j(r(e))},"Array, number|BigNumber":function(e,t){return j(r(e),{precision:t})},"Array, Object":(e,t)=>j(r(e),t),Matrix:function(e){return j(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return j(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){const n={matricize:!0};return sr(n,t),j(e,n)}});function j(e){var n;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=!("eigenvectors"in i)||i.eigenvectors,u=function(e,t,n){const r=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw new RangeError(`Matrix must be square (size: ${pr(i)})`);const a=i[0];if(function(e,t,n){for(let r=0;r<t;r++)for(let i=0;i<t;i++)if(w(h(s(_(e[r][i]))),n))return!1;return!0}(r,a,t)&&(function(e,t){for(let n=0;n<t;n++)for(let r=0;r<t;r++)e[n][r]=I(e[n][r])}(r,a),function(e,t,n){for(let r=0;r<t;r++)for(let i=r;i<t;i++)if(w(h(s(o(e[r][i],e[i][r]))),n))return!1;return!0}(r,a,t))){const i=U(e,r,a);return q(r,a,t,i,n)}const u=U(e,r,a);return P(r,a,t,u,n)}(e,null!==(n=i.precision)&&void 0!==n?n:t.relTol,a);return i.matricize&&(u.values=r(u.values),a&&(u.eigenvectors=u.eigenvectors.map((e=>{let{value:t,vector:n}=e;return{value:t,vector:r(n)}})))),a&&Object.defineProperty(u,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),u}function U(e,t,n){const r=e.datatype();if("number"===r||"BigNumber"===r||"Complex"===r)return r;let i=!1,o=!1,a=!1;for(let e=0;e<n;e++)for(let r=0;r<n;r++){const n=t[e][r];if(d(n)||b(n))i=!0;else if(g(n))o=!0;else{if(!x(n))throw TypeError("Unsupported type in Matrix: "+oe(n));a=!0}}if(o&&a&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),a){for(let e=0;e<n;e++)for(let r=0;r<n;r++)t[e][r]=S(t[e][r]);return"Complex"}if(o){for(let e=0;e<n;e++)for(let r=0;r<n;r++)t[e][r]=h(t[e][r]);return"BigNumber"}if(i){for(let e=0;e<n;e++)for(let r=0;r<n;r++)t[e][r]=A(t[e][r]);return"number"}throw TypeError("Matrix contains unsupported types only.")}})),lh="expm",fh=he(lh,["typed","abs","add","identity","inv","multiply"],(e=>{let{typed:t,abs:n,add:r,identity:i,inv:o,multiply:a}=e;return t(lh,{Matrix:function(e){const t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+pr(t)+")");const u=t[0],c=function(e){const t=e.size()[0];let r=0;for(let i=0;i<t;i++){let o=0;for(let r=0;r<t;r++)o+=n(e.get([i,r]));r=Math.max(o,r)}return r}(e),l=function(e){for(let t=0;t<30;t++)for(let n=0;n<=t;n++){const r=t-n;if(s(e,n,r)<1e-15)return{q:n,j:r}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(c),f=l.q,p=l.j,m=a(e,Math.pow(2,-p));let h=i(u),d=i(u),g=1,y=m,x=-1;for(let e=1;e<=f;e++)e>1&&(y=a(y,m),x=-x),g=g*(f-e+1)/((2*f-e+1)*e),h=r(h,a(g,y)),d=r(d,a(g*x,y));let b=a(o(d),h);for(let e=0;e<p;e++)b=a(b,b);return M(e)?e.createSparseMatrix(b):b}});function s(e,t,n){let r=1;for(let e=2;e<=t;e++)r*=e;let i=r;for(let e=t+1;e<=2*t;e++)i*=e;const o=i*(2*t+1);return 8*Math.pow(e/Math.pow(2,n),2*t)*r*r/(i*o)}})),ph="sqrtm",mh=he(ph,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],(e=>{let{typed:t,abs:n,add:r,multiply:i,map:o,sqrt:a,subtract:s,inv:u,size:c,max:l,identity:f}=e;const p=1e-6;function m(e){let t,o=0,a=e,m=f(c(e));do{const e=a;if(a=i(.5,r(e,u(m))),m=i(.5,r(m,u(e))),t=l(n(s(a,e))),t>p&&++o>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>p);return a}return t(ph,{"Array | Matrix":function(e){const t=E(e)?e.size():vr(e);switch(t.length){case 1:if(1===t[0])return o(e,a);throw new RangeError("Matrix must be square (size: "+pr(t)+")");case 2:if(t[0]===t[1])return m(e);throw new RangeError("Matrix must be square (size: "+pr(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+pr(t)+")")}}})})),hh="sylvester",dh=he(hh,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(e=>{let{typed:t,schur:n,matrixFromColumns:r,matrix:i,multiply:o,range:a,concat:s,transpose:u,index:c,subset:l,add:f,subtract:p,identity:m,lusolve:h,abs:d}=e;return t(hh,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,t,n){return g(i(e),t,n)},"Array, Array, Matrix":function(e,t,n){return g(i(e),i(t),n)},"Array, Matrix, Array":function(e,t,n){return g(i(e),t,i(n))},"Matrix, Array, Matrix":function(e,t,n){return g(e,i(t),n)},"Matrix, Array, Array":function(e,t,n){return g(e,i(t),i(n))},"Matrix, Matrix, Array":function(e,t,n){return g(e,t,i(n))},"Array, Array, Array":function(e,t,n){return g(i(e),i(t),i(n)).toArray()}});function g(e,t,g){const y=t.size()[0],x=e.size()[0],b=n(e),v=b.T,w=b.U,N=n(o(-1,t)),E=N.T,A=N.U,S=o(o(u(w),g),A),M=a(0,x),C=[],T=(e,t)=>s(e,t,1),B=(e,t)=>s(e,t,0);for(let e=0;e<y;e++)if(e<y-1&&d(l(E,c(e+1,e)))>1e-5){let t=B(l(S,c(M,e)),l(S,c(M,e+1)));for(let n=0;n<e;n++)t=f(t,B(o(C[n],l(E,c(n,e))),o(C[n],l(E,c(n,e+1)))));const n=o(m(x),o(-1,l(E,c(e,e)))),r=o(m(x),o(-1,l(E,c(e+1,e)))),i=o(m(x),o(-1,l(E,c(e,e+1)))),s=o(m(x),o(-1,l(E,c(e+1,e+1)))),u=B(T(f(v,n),r),T(i,f(v,s))),p=h(u,t);C[e]=p.subset(c(a(0,x),0)),C[e+1]=p.subset(c(a(x,2*x),0)),e++}else{let t=l(S,c(M,e));for(let n=0;n<e;n++)t=f(t,o(C[n],l(E,c(n,e))));const n=l(E,c(e,e)),r=p(v,o(n,m(x)));C[e]=h(r,t)}const D=i(r(...C));return o(w,o(D,u(A)))}})),gh="schur",yh=he(gh,["typed","matrix","identity","multiply","qr","norm","subtract"],(e=>{let{typed:t,matrix:n,identity:r,multiply:i,qr:o,norm:a,subtract:s}=e;return t(gh,{Array:function(e){const t=u(n(e));return{U:t.U.valueOf(),T:t.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){const t=e.size()[0];let n,u=e,c=r(t),l=0;do{n=u;const e=o(u),t=e.Q,r=e.R;if(u=i(r,t),c=i(c,t),l++>100)break}while(a(s(u,n))>1e-4);return{U:c,T:u}}})),xh="lyap",bh=he(xh,["typed","matrix","sylvester","multiply","transpose"],(e=>{let{typed:t,matrix:n,sylvester:r,multiply:i,transpose:o}=e;return t(xh,{"Matrix, Matrix":function(e,t){return r(e,o(e),i(-1,t))},"Array, Matrix":function(e,t){return r(n(e),o(n(e)),i(-1,t))},"Matrix, Array":function(e,t){return r(e,o(n(e)),n(i(-1,t)))},"Array, Array":function(e,t){return r(n(e),o(n(e)),n(i(-1,t))).toArray()}})})),vh=he("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(e=>{let{typed:t,matrix:n,multiply:r,equalScalar:i,divideScalar:o,inv:a}=e;const s=zo({typed:t,equalScalar:i}),u=Ro({typed:t});return t("divide",se({"Array | Matrix, Array | Matrix":function(e,t){return r(e,a(t))},"DenseMatrix, any":function(e,t){return u(e,t,o,!1)},"SparseMatrix, any":function(e,t){return s(e,t,o,!1)},"Array, any":function(e,t){return u(n(e),t,o,!1).valueOf()},"any, Array | Matrix":function(e,t){return r(e,a(t))}},o.signatures))})),wh="distance",Nh=he(wh,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(e=>{let{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:o,deepEqual:a,sqrt:s,abs:u}=e;return t(wh,{"Array, Array, Array":function(e,t,n){if(2===e.length&&2===t.length&&2===n.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!l(n))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(a(t,n))throw new TypeError("LinePoint1 should not be same with LinePoint2");const o=r(n[1],t[1]),s=r(t[0],n[0]),u=r(i(n[0],t[1]),i(t[0],n[1]));return d(e[0],e[1],o,s,u)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,n){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(n).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!l(n))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(a(h(t),h(n)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in n&&"lineTwoPtY"in n){const o=r(n.lineTwoPtY,t.lineOnePtY),a=r(t.lineOnePtX,n.lineTwoPtX),s=r(i(n.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,n.lineTwoPtY));return d(e.pointX,e.pointY,o,a,s)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return d(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!f(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(e.length===t.length&&e.length>0){if(!p(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return x(e,t)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,t){if(2===Object.keys(e).length&&3===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in t&&"yCoeffLine"in t&&"constant"in t)return d(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return y(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in t&&"pointTwoY"in t)return x([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in t&&"pointTwoY"in t&&"pointTwoZ"in t)return x([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&c(e[0][0])&&c(e[0][1])){if(e.some((e=>2!==e.length||!c(e[0])||!c(e[1]))))return!1}else{if(!(3===e[0].length&&c(e[0][0])&&c(e[0][1])&&c(e[0][2])))return!1;if(e.some((e=>3!==e.length||!c(e[0])||!c(e[1])||!c(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){const t=[];let n=[],r=[];for(let i=0;i<e.length-1;i++)for(let o=i+1;o<e.length;o++)2===e[0].length?(n=[e[i][0],e[i][1]],r=[e[o][0],e[o][1]]):3===e[0].length&&(n=[e[i][0],e[i][1],e[i][2]],r=[e[o][0],e[o][1],e[o][2]]),t.push(x(n,r));return t}(e)}});function c(e){return"number"==typeof e||g(e)}function l(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])}function f(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])}function p(e){return Array.isArray(e)||(e=h(e)),e.every(c)}function m(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])&&c(e[3])&&c(e[4])&&c(e[5])}function h(e){const t=Object.keys(e),n=[];for(let r=0;r<t.length;r++)n.push(e[t[r]]);return n}function d(e,t,r,a,c){const l=u(n(n(i(r,e),i(a,t)),c)),f=s(n(i(r,r),i(a,a)));return o(l,f)}function y(e,t,a,u,c,l,f,p,m){let h=[r(i(r(c,t),m),i(r(l,a),p)),r(i(r(l,a),f),i(r(u,e),m)),r(i(r(u,e),p),i(r(c,t),f))];h=s(n(n(i(h[0],h[0]),i(h[1],h[1])),i(h[2],h[2])));const d=s(n(n(i(f,f),i(p,p)),i(m,m)));return o(h,d)}function x(e,t){const o=e.length;let a=0,u=0;for(let s=0;s<o;s++)u=r(e[s],t[s]),a=n(i(u,u),a);return s(a)}})),Eh=he("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],(e=>{let{typed:t,config:n,abs:r,add:i,addScalar:o,matrix:a,multiply:s,multiplyScalar:u,divideScalar:c,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=e;return t("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(e,t,n){const r=g(e.valueOf(),t.valueOf(),n.valueOf());return null===r?null:a(r)},"Matrix, Matrix, Matrix, Matrix":function(e,t,n,r){const i=y(e.valueOf(),t.valueOf(),n.valueOf(),r.valueOf());return null===i?null:a(i)}});function g(e,t,n){if(e=x(e),t=x(t),n=x(n),!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&d(e[0])&&d(e[1])&&d(e[2])&&d(e[3])}(n))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,n,r,i,a,s,f,p,m){const h=u(e,s),d=u(r,s),g=u(t,f),y=u(i,f),x=u(n,p),b=u(a,p),v=l(l(l(m,h),g),x),w=l(l(l(o(o(d,y),b),h),g),x),N=c(v,w);return[o(e,u(N,l(r,e))),o(t,u(N,l(i,t))),o(n,u(N,l(a,n)))]}(e[0],e[1],e[2],t[0],t[1],t[2],n[0],n[1],n[2],n[3])}function y(e,t,a,m){if(e=x(e),t=x(t),a=x(a),m=x(m),2===e.length){if(!b(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(a))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,a,p){const m=e,d=a,g=l(m,t),y=l(d,p),x=l(u(g[0],y[1]),u(y[0],g[1]));if(h(x))return null;if(f(r(x),n.relTol))return null;const b=u(y[0],m[1]),v=u(y[1],m[0]),w=u(y[0],d[1]),N=u(y[1],d[0]),E=c(o(l(l(b,v),w),N),x);return i(s(g,E),m)}(e,t,a,m)}if(3===e.length){if(!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!v(a))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!v(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,n,r,i,a,s,f,m,d,g,y){const x=w(e,s,d,s,t,f,g,f,n,m,y,m),b=w(d,s,r,e,g,f,i,t,y,m,a,n),v=w(e,s,r,e,t,f,i,t,n,m,a,n),N=w(d,s,d,s,g,f,g,f,y,m,y,m),E=w(r,e,r,e,i,t,i,t,a,n,a,n),A=l(u(x,b),u(v,N)),S=l(u(E,N),u(b,b));if(h(S))return null;const M=c(A,S),C=c(o(x,u(M,b)),N),T=o(e,u(M,l(r,e))),B=o(t,u(M,l(i,t))),D=o(n,u(M,l(a,n))),F=o(s,u(C,l(d,s))),O=o(f,u(C,l(g,f))),_=o(m,u(C,l(y,m)));return p(T,F)&&p(B,O)&&p(D,_)?[T,B,D]:null}(e[0],e[1],e[2],t[0],t[1],t[2],a[0],a[1],a[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function x(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every((e=>Array.isArray(e)&&1===e.length))?m(e):e}function b(e){return 2===e.length&&d(e[0])&&d(e[1])}function v(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,t,n,r,i,a,s,c,f,p,m,h){const d=u(l(e,t),l(n,r)),g=u(l(i,a),l(s,c)),y=u(l(f,p),l(m,h));return o(o(d,g),y)}})),Ah=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:n,add:r,numeric:i}=e;return t("sum",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){try{return oi(e,t,r)}catch(e){throw Zu(e,"sum")}},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function sum");return o(e)}});function o(e){let t;return ri(e,(function(e){try{t=void 0===t?e:r(t,e)}catch(t){throw Zu(t,"sum",e)}})),void 0===t&&(t=i(0,n.number)),"string"==typeof t&&(t=i(t,xe(t,n))),t}})),Sh="cumsum",Mh=he(Sh,["typed","add","unaryPlus"],(e=>{let{typed:t,add:n,unaryPlus:r}=e;return t(Sh,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":a,"Matrix, number | BigNumber":function(e,t){return e.create(a(e.valueOf(),t),e.datatype())},"...":function(e){if(ni(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return o(e)}catch(e){throw Zu(e,Sh)}}function o(e){if(0===e.length)return[];const t=[r(e[0])];for(let r=1;r<e.length;++r)t.push(n(t[r-1],e[r]));return t}function a(e,t){const n=vr(e);if(t<0||t>=n.length)throw new br(t,n.length);try{return s(e,t)}catch(e){throw Zu(e,Sh)}}function s(e,t){let n,r,i;if(t<=0){const a=e[0][0];if(Array.isArray(a)){for(i=ti(e),r=[],n=0;n<i.length;n++)r[n]=s(i[n],t-1);return r}return o(e)}for(r=[],n=0;n<e.length;n++)r[n]=s(e[n],t-1);return r}})),Ch="mean",Th=he(Ch,["typed","add","divide"],(e=>{let{typed:t,add:n,divide:r}=e;return t(Ch,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){try{const i=oi(e,t,n),o=Array.isArray(e)?vr(e):e.size();return r(i,o[t])}catch(e){throw Zu(e,"mean")}},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){let t,i=0;if(ri(e,(function(e){try{t=void 0===t?e:n(t,e),i++}catch(t){throw Zu(t,"mean",e)}})),0===i)throw new Error("Cannot calculate the mean of an empty array");return r(t,i)}})),Bh="median",Dh=he(Bh,["typed","add","divide","compare","partitionSelect"],(e=>{let{typed:t,add:n,divide:r,compare:i,partitionSelect:o}=e;function a(e){try{const t=(e=zr(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){const n=t/2-1,r=o(e,n+1);let a=e[n];for(let t=0;t<n;++t)i(e[t],a)>0&&(a=e[t]);return u(a,r)}{const n=o(e,(t-1)/2);return s(n)}}catch(e){throw Zu(e,"median")}}const s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),u=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return r(n(e,t),2)}});return t(Bh,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(ni(e))throw new TypeError("Scalar values expected in function median");return a(e)}})})),Fh=he("mad",["typed","abs","map","median","subtract"],(e=>{let{typed:t,abs:n,map:r,median:i,subtract:o}=e;return t("mad",{"Array | Matrix":a,"...":function(e){return a(e)}});function a(e){if(0===(e=zr(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{const t=i(e);return i(r(e,(function(e){return n(o(e,t))})))}catch(e){throw e instanceof TypeError&&e.message.includes("median")?new TypeError(e.message.replace("median","mad")):Zu(e,"mad")}}})),Oh="unbiased",_h="variance",Ih=he(_h,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s}=e;return t(_h,{"Array | Matrix":function(e){return u(e,Oh)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(e,t){return c(e,t,Oh)},"Array | Matrix, number | BigNumber, string":c,"...":function(e){return u(e,Oh)}});function u(e,t){let a,u=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(ri(e,(function(e){try{a=void 0===a?e:n(a,e),u++}catch(t){throw Zu(t,"variance",e)}})),0===u)throw new Error("Cannot calculate variance of an empty array");const c=o(a,u);if(a=void 0,ri(e,(function(e){const t=r(e,c);a=void 0===a?i(t,t):n(a,i(t,t))})),s(a))return a;switch(t){case"uncorrected":return o(a,u);case"biased":return o(a,u+1);case"unbiased":{const e=g(a)?a.mul(0):0;return 1===u?e:o(a,u-1)}default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function c(e,t,n){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return a(e,t,(e=>u(e,n)))}catch(e){throw Zu(e,"variance")}}})),zh="quantileSeq",kh=he(zh,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],(e=>{let{typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m}=e;return t(zh,{"Array | Matrix, number | BigNumber":(e,t)=>g(e,t,!1),"Array | Matrix, number | BigNumber, number":(e,t,n)=>h(e,t,!1,n,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>h(e,t,n,r,g),"Array | Matrix, Array | Matrix":(e,t)=>y(e,t,!1),"Array | Matrix, Array | Matrix, number":(e,t,n)=>h(e,t,!1,n,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>h(e,t,n,r,y)});function h(e,t,n,r,i){return m(e,r,(e=>i(e,t,n)))}function g(e,t,i){let a;const s=e.valueOf();if(l(t,0))throw new Error("N/prob must be non-negative");if(f(t,1))return d(t)?x(s,t,i):n(x(s,t,i));if(p(t,1)){if(!c(t))throw new Error("N must be a positive integer");if(p(t,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");const e=r(t,1);a=[];for(let n=0;l(n,t);n++){const t=o(n+1,e);a.push(x(s,t,i))}return d(t)?a:n(a)}}function y(e,t,n){const r=e.valueOf(),i=t.valueOf(),o=[];for(let e=0;e<i.length;++e)o.push(x(r,i[e],n));return o}function x(e,t,n){const o=zr(e),l=o.length;if(0===l)throw new Error("Cannot calculate quantile of an empty sequence");const f=d(t)?t*(l-1):t.times(l-1),p=d(t)?Math.floor(f):f.floor().toNumber(),m=d(t)?f%1:f.minus(p);if(c(f))return n?o[f]:s(o,d(t)?f:f.valueOf());let h,g;if(n)h=o[p],g=o[p+1];else{g=s(o,p+1),h=o[p];for(let e=0;e<p;++e)u(o[e],h)>0&&(h=o[e])}return r(a(h,i(1,m)),a(g,m))}})),Rh=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:n,sqrt:r,variance:i}=e;return t("std",{"Array | Matrix":o,"Array | Matrix, string":o,"Array | Matrix, number | BigNumber":o,"Array | Matrix, number | BigNumber, string":o,"...":function(e){return o(e)}});function o(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{const e=i.apply(null,arguments);return A(e)?n(e,r):r(e)}catch(e){throw e instanceof TypeError&&e.message.includes(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),qh="corr",Ph=he(qh,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],(e=>{let{typed:t,matrix:n,sqrt:r,sum:i,add:o,subtract:a,multiply:s,pow:u,divide:c}=e;return t(qh,{"Array, Array":function(e,t){return l(e,t)},"Matrix, Matrix":function(e,t){const r=l(e.toArray(),t.toArray());return Array.isArray(r)?n(r):r}});function l(e,t){const n=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(let r=0;r<e.length;r++){if(e[r].length!==t[r].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");n.push(f(e[r],t[r]))}return n}if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(e,t)}function f(e,t){const n=e.length,l=i(e),f=i(t),p=e.reduce(((e,n,r)=>o(e,s(n,t[r]))),0),m=i(e.map((e=>u(e,2)))),h=i(t.map((e=>u(e,2)))),d=a(s(n,p),s(l,f)),g=r(s(a(s(n,m),u(l,2)),a(s(n,h),u(f,2))));return c(d,g)}}));function jh(e,t){if(t<e)return 1;if(t===e)return t;const n=t+e>>1;return jh(e,n)*jh(n+1,t)}function Uh(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");const n=e-t;let r=1,i=2;const o=t<n?t:n;for(let a=t<n?n+1:t+1;a<=e;++a)for(r*=a;i<=o&&r%i==0;)r/=i,++i;return i<=o&&(r/=jh(i,o)),r}Uh.signature="number, number";const Lh="combinations",$h=he(Lh,["typed"],(e=>{let{typed:t}=e;return t(Lh,{"number, number":Uh,"BigNumber, BigNumber":function(e,t){const n=e.constructor;let r,i;const o=e.minus(t),a=new n(1);if(!Hh(e)||!Hh(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(e))throw new TypeError("k must be less than n in function combinations");if(r=a,t.lt(o))for(i=a;i.lte(o);i=i.plus(a))r=r.times(t.plus(i)).dividedBy(i);else for(i=a;i.lte(t);i=i.plus(a))r=r.times(o.plus(i)).dividedBy(i);return r}})}));function Hh(e){return e.isInteger()&&e.gte(0)}const Gh="combinationsWithRep",Vh=he(Gh,["typed"],(e=>{let{typed:t}=e;return t(Gh,{"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return t<e-1?jh(e,e+t-1)/jh(1,t):jh(t+1,e+t-1)/jh(1,e-1)},"BigNumber, BigNumber":function(e,t){let n,r;const i=new(0,e.constructor)(1),o=e.minus(i);if(!Zh(e)||!Zh(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(n=i,t.lt(o))for(r=i;r.lte(o);r=r.plus(i))n=n.times(t.plus(r)).dividedBy(r);else for(r=i;r.lte(t);r=r.plus(i))n=n.times(o.plus(r)).dividedBy(r);return n}})}));function Zh(e){return e.isInteger()&&e.gte(0)}function Wh(e){let t;if(ye(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:jh(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Wh(1-e));if(e>=171.35)return 1/0;if(e>85){const t=e*e,n=t*e,r=n*e,i=r*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*r)+163879/(209018880*i)+5246819/(75246796800*i*e))}--e,t=Jh[0];for(let n=1;n<Jh.length;++n)t+=Jh[n]/(e+n);const n=e+Yh+.5;return Math.sqrt(2*Math.PI)*Math.pow(n,e+.5)*Math.exp(-n)*t}Wh.signature="number";const Yh=4.7421875,Jh=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Xh=.9189385332046728,Qh=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Kh(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))-Kh(1-e);const t=5+(e-=1)+.5;let n=Qh[0];for(let t=6;t>=1;t--)n+=Qh[t]/(e+t);return Xh+(e+.5)*Math.log(t)-t+Math.log(n)}Kh.signature="number";const ed="gamma",td=he(ed,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(e=>{let{typed:t,config:n,multiplyScalar:r,pow:i,BigNumber:o,Complex:a}=e;return t(ed,{number:Wh,Complex:function e(t){if(0===t.im)return Wh(t.re);if(t.re<.5){const n=new a(1-t.re,-t.im),r=new a(Math.PI*t.re,Math.PI*t.im);return new a(Math.PI).div(r.sin()).div(e(n))}t=new a(t.re-1,t.im);let n=new a(Jh[0],0);for(let e=1;e<Jh.length;++e){const r=new a(Jh[e],0);n=n.add(r.div(t.add(e)))}const r=new a(t.re+Yh+.5,t.im),i=Math.sqrt(2*Math.PI),o=r.pow(t.add(.5)),s=r.neg().exp();return n.mul(i).mul(o).mul(s)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new o(1/0):s(e.minus(1));if(!e.isFinite())return new o(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(e){if(e<8)return new o([1,1,2,6,24,120,720,5040][e]);const t=n.precision+(0|Math.log(e.toNumber())),r=o.clone({precision:t});if(e%2==1)return e.times(s(new o(e-1)));let i=e,a=new r(e),u=e.toNumber();for(;i>2;)i-=2,u+=i,a=a.times(u);return new o(a.toPrecision(o.precision))}})),nd="lgamma",rd=he(nd,["Complex","typed"],(e=>{let{Complex:t,typed:n}=e;const r=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return n(nd,{number:Kh,Complex:function e(n){if(n.isNaN())return new t(NaN,NaN);if(0===n.im)return new t(Kh(n.re),0);if(n.re>=7||Math.abs(n.im)>=7)return i(n);if(n.re<=.1){const i=(r=6.283185307179586,(!0^((a=n.im)>0||!(a<0)&&1/a==1/0)?-r:r)*Math.floor(.5*n.re+.25)),o=n.mul(Math.PI).sin().log(),s=e(new t(1-n.re,-n.im));return new t(1.1447298858494002,i).sub(o).sub(s)}return n.im>=0?o(n):o(n.conjugate()).conjugate();var r,a},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){const n=e.sub(.5).mul(e.log()).sub(e).add(Xh),i=new t(1,0).div(e),o=i.div(e);let a=r[0],s=r[1];const u=2*o.re,c=o.re*o.re+o.im*o.im;for(let e=2;e<8;e++){const t=s;s=-c*a+r[e],a=u*a+t}const l=i.mul(o.mul(a).add(s));return n.add(l)}function o(e){let n=0,r=0,o=e;for(e=e.add(1);e.re<=7;){o=o.mul(e);const t=o.im<0?1:0;0!==t&&0===r&&n++,r=t,e=e.add(1)}return i(e).sub(o.log()).sub(new t(0,2*n*Math.PI*1))}})),id="factorial",od=he(id,["typed","gamma"],(e=>{let{typed:t,gamma:n}=e;return t(id,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return n(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return n(e.plus(1))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ad="kldivergence",sd=he(ad,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(e=>{let{typed:t,matrix:n,divide:r,sum:i,multiply:o,map:a,dotDivide:s,log:u,isNumeric:c}=e;return t(ad,{"Array, Array":function(e,t){return l(n(e),n(t))},"Matrix, Array":function(e,t){return l(e,n(t))},"Array, Matrix":function(e,t){return l(n(e),t)},"Matrix, Matrix":function(e,t){return l(e,t)}});function l(e,t){const n=t.size().length,l=e.size().length;if(n>1)throw new Error("first object must be one dimensional");if(l>1)throw new Error("second object must be one dimensional");if(n!==l)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(t))throw new Error("Sum of elements in second object must be non zero");const f=r(e,i(e)),p=r(t,i(t)),m=i(o(f,a(s(f,p),(e=>u(e)))));return c(m)?m:Number.NaN}})),ud="multinomial",cd=he(ud,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(e=>{let{typed:t,add:n,divide:r,multiply:i,factorial:o,isInteger:a,isPositive:s}=e;return t(ud,{"Array | Matrix":function(e){let t=0,u=1;return ri(e,(function(e){if(!a(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=n(t,e),u=i(u,o(e))})),r(o(t),u)}})})),ld="permutations",fd=he(ld,["typed","factorial"],(e=>{let{typed:t,factorial:n}=e;return t(ld,{"number | BigNumber":n,"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");return jh(e-t+1,e)},"BigNumber, BigNumber":function(e,t){let n,r;if(!pd(e)||!pd(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(n=e.mul(0).add(1),r=e.minus(t).plus(1);r.lte(e);r=r.plus(1))n=n.times(r);return n}})}));function pd(e){return e.isInteger()&&e.gte(0)}var md=n(7391);const hd=md(Date.now());function dd(e){let t;var n;return t=null===(n=e)?hd:md(String(n)),function(){return t()}}const gd="pickRandom",yd=he(gd,["typed","config","?on"],(e=>{let{typed:t,config:n,on:r}=e,i=dd(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=dd(e.randomSeed))})),t(gd,{"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,t){return o(e,t)},"Array | Matrix, number":function(e,t){return o(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return o(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,n){return o(e,{number:n,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,n){return o(e,{number:t,weights:n})}});function o(e,t){let{number:n,weights:r,elementWise:o=!0}=t;const a=void 0===n;a&&(n=1);const s=E(e)?e.create:E(r)?r.create:null;e=e.valueOf(),r&&(r=r.valueOf()),!0===o&&(e=zr(e),r=zr(r));let u=0;if(void 0!==r){if(r.length!==e.length)throw new Error("Weights must have the same length as possibles");for(let e=0,t=r.length;e<t;e++){if(!d(r[e])||r[e]<0)throw new Error("Weights must be an array of positive numbers");u+=r[e]}}const c=e.length,l=[];let f;for(;l.length<n;){if(void 0===r)f=e[Math.floor(i()*c)];else{let t=i()*u;for(let n=0,i=e.length;n<i;n++)if(t-=r[n],t<0){f=e[n];break}}l.push(f)}return a?l[0]:s?s(l):l}}));function xd(e,t){const n=[];if((e=e.slice(0)).length>1)for(let r=0,i=e.shift();r<i;r++)n.push(xd(e,t));else for(let r=0,i=e.shift();r<i;r++)n.push(t());return n}const bd="random",vd=he(bd,["typed","config","?on"],(e=>{let{typed:t,config:n,on:r}=e,i=dd(n.randomSeed);return r&&r("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=dd(e.randomSeed))})),t(bd,{"":()=>a(0,1),number:e=>a(0,e),"number, number":(e,t)=>a(e,t),"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,n)=>o(e,t,n)});function o(e,t,n){const r=xd(e.valueOf(),(()=>a(t,n)));return E(e)?e.create(r,"number"):r}function a(e,t){return e+i()*(t-e)}})),wd="randomInt",Nd=2n**30n,Ed=he(wd,["typed","config","log2","?on"],(e=>{let{typed:t,config:n,log2:r,on:i}=e,o=dd(n.randomSeed);return i&&i("config",(function(e,t){e.randomSeed!==t.randomSeed&&(o=dd(e.randomSeed))})),t(wd,{"":()=>s(0,2),number:e=>s(0,e),"number, number":(e,t)=>s(e,t),bigint:e=>u(0n,e),"bigint, bigint":u,"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,t)=>a(e,0,t),"Array | Matrix, number, number":(e,t,n)=>a(e,t,n)});function a(e,t,n){const r=xd(e.valueOf(),(()=>s(t,n)));return E(e)?e.create(r,"number"):r}function s(e,t){return Math.floor(e+o()*(t-e))}function u(e,t){const n=t-e;if(n<=Nd)return e+BigInt(s(0,Number(n)));const i=r(n);let a=n;for(;a>=n;){a=0n;for(let e=0;e<i;++e)a=2n*a+(o()<.5?0n:1n)}return e+a}})),Ad="stirlingS2",Sd=he(Ad,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],(e=>{let{typed:t,addScalar:n,subtractScalar:r,multiplyScalar:i,divideScalar:o,pow:a,factorial:s,combinations:u,isNegative:c,isInteger:l,number:f,bignumber:p,larger:m}=e;const h=[],g=[];return t(Ad,{"number | BigNumber, number | BigNumber":function(e,t){if(!l(e)||c(e)||!l(t)||c(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");const r=!(d(e)&&d(t)),o=r?g:h,a=r?p:f,s=f(e),u=f(t);if(o[s]&&o[s].length>u)return o[s][u];for(let e=0;e<=s;++e){if(o[e]||(o[e]=[a(0===e?1:0)]),0===e)continue;const t=o[e],r=o[e-1];for(let o=t.length;o<=e&&o<=u;++o)t[o]=o===e?1:n(i(a(o),r[o]),r[o-1])}return o[s][u]}})})),Md="bellNumbers",Cd=he(Md,["typed","addScalar","isNegative","isInteger","stirlingS2"],(e=>{let{typed:t,addScalar:n,isNegative:r,isInteger:i,stirlingS2:o}=e;return t(Md,{"number | BigNumber":function(e){if(!i(e)||r(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");let t=0;for(let r=0;r<=e;r++)t=n(t,o(e,r));return t}})})),Td="catalan",Bd=he(Td,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(e=>{let{typed:t,addScalar:n,divideScalar:r,multiplyScalar:i,combinations:o,isNegative:a,isInteger:s}=e;return t(Td,{"number | BigNumber":function(e){if(!s(e)||a(e))throw new TypeError("Non-negative integer value expected in function catalan");return r(o(i(e,2),e),n(e,1))}})})),Dd="composition",Fd=he(Dd,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(e=>{let{typed:t,addScalar:n,combinations:r,isPositive:i,isNegative:o,isInteger:a,larger:s}=e;return t(Dd,{"number | BigNumber, number | BigNumber":function(e,t){if(!(a(e)&&i(e)&&a(t)&&i(t)))throw new TypeError("Positive integer value expected in function composition");if(s(t,e))throw new TypeError("k must be less than or equal to n in function composition");return r(n(e,-1),n(t,-1))}})})),Od="leafCount",_d=he(Od,["parse","typed"],(e=>{let{parse:t,typed:n}=e;function r(e){let t=0;return e.forEach((e=>{t+=r(e)})),t||1}return n(Od,{Node:function(e){return r(e)}})}));function Id(e){return V(e)||K(e)&&e.isUnary()&&V(e.args[0])}function zd(e){return!!V(e)||!(!Y(e)&&!K(e)||!e.args.every(zd))||!(!ee(e)||!zd(e.content))}const kd=he("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],(e=>{let{FunctionNode:t,OperatorNode:n,SymbolNode:r}=e;const i=!0,o=!1,a="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:o,total:i,commutative:o,associative:o},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:o,total:i,commutative:o,associative:o},paren:{trivial:i,total:i,commutative:i,associative:o},defaultF:{trivial:o,total:i,commutative:o,associative:o}};function u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,r=a;if("string"==typeof e?r=e:K(e)?r=e.fn.toString():Y(e)?r=e.name:ee(e)&&(r="paren"),me(n,r)){const e=n[r];if(me(e,t))return e[t];if(me(s,r))return s[r][t]}if(me(n,a)){const e=n[a];return me(e,t)?e[t]:s[a][t]}if(me(s,r)){const e=s[r];if(me(e,t))return e[t]}return s[a][t]}function c(e){return u(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)}function l(e,t){let n;const r=[],i=function(e){for(let t=0;t<e.args.length;t++){const o=e.args[t];K(o)&&n===o.op?i(o):r.push(o)}};return c(e,t)?(n=e.op,i(e),r):e.args}function f(e){return K(e)?function(t){try{return new n(e.op,e.fn,t,e.implicit)}catch(e){return console.error(e),[]}}:function(n){return new t(new r(e.name),n)}}return{createMakeNodeFunction:f,hasProperty:u,isCommutative:function(e){return u(e,"commutative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)},isAssociative:c,mergeContext:function(e,t){const n={...e};for(const r in t)me(e,r)?n[r]={...t[r],...e[r]}:n[r]=t[r];return n},flatten:function e(t,n){if(!t.args||0===t.args.length)return t;t.args=l(t,n);for(let r=0;r<t.args.length;r++)e(t.args[r],n)},allChildren:l,unflattenr:function e(t,n){if(!t.args||0===t.args.length)return;const r=f(t),i=t.args.length;for(let r=0;r<i;r++)e(t.args[r],n);if(i>2&&c(t,n)){let e=t.args.pop();for(;t.args.length>0;)e=r([t.args.pop(),e]);t.args=e.args}},unflattenl:function e(t,n){if(!t.args||0===t.args.length)return;const r=f(t),i=t.args.length;for(let r=0;r<i;r++)e(t.args[r],n);if(i>2&&c(t,n)){let e=t.args.shift();for(;t.args.length>0;)e=r([e,t.args.shift()]);t.args=e.args}},defaultContext:s,realContext:{divide:{total:o},log:{total:o}},positiveContext:{subtract:{total:o},abs:{trivial:i},log:{total:i}}}})),Rd=he("simplify",["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],(e=>{let{typed:t,parse:n,equal:r,resolve:i,simplifyConstant:o,simplifyCore:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:d,ParenthesisNode:g,SymbolNode:y,replacer:x}=e;const{hasProperty:b,isCommutative:v,isAssociative:w,mergeContext:N,flatten:E,unflattenr:A,unflattenl:S,createMakeNodeFunction:M,defaultContext:C,realContext:T,positiveContext:B}=kd({FunctionNode:l,OperatorNode:d,SymbolNode:y});t.addConversion({from:"Object",to:"Map",convert:h});const D=t("simplify",{Node:k,"Node, Map":(e,t)=>k(e,!1,t),"Node, Map, Object":(e,t,n)=>k(e,!1,t,n),"Node, Array":k,"Node, Array, Map":k,"Node, Array, Map, Object":k});function F(e){return e.transform((function(e){return ee(e)?F(e.content):e}))}t.removeConversion({from:"Object",to:"Map",convert:h}),D.defaultContext=C,D.realContext=T,D.positiveContext=B;const O={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};function _(e,t){const r={};if(e.s){const t=e.s.split("->");if(2!==t.length)throw SyntaxError("Could not parse rule: "+e.s);r.l=t[0],r.r=t[1]}else r.l=e.l,r.r=e.r;r.l=F(n(r.l)),r.r=F(n(r.r));for(const t of["imposeContext","repeat","assuming"])t in e&&(r[t]=e[t]);if(e.evaluate&&(r.evaluate=n(e.evaluate)),w(r.l,t)){const e=!v(r.l,t);let n;e&&(n=z());const i=M(r.l),o=z();r.expanded={},r.expanded.l=i([r.l,o]),E(r.expanded.l,t),A(r.expanded.l,t),r.expanded.r=i([r.r,o]),e&&(r.expandedNC1={},r.expandedNC1.l=i([n,r.l]),r.expandedNC1.r=i([n,r.r]),r.expandedNC2={},r.expandedNC2.l=i([n,r.expanded.l]),r.expandedNC2.r=i([n,r.expanded.r]))}return r}D.rules=[a,{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}}},o,{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}}},o,{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"}];let I=0;function z(){return new y("_p"+I++)}function k(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m(),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=r.consoleDebug;t=function(e,t){const n=[];for(let r=0;r<e.length;r++){let i,o=e[r];const a=typeof o;switch(a){case"string":o={s:o};case"object":i=_(o,t);break;case"function":i=o;break;default:throw TypeError("Unsupported type of rule: "+a)}n.push(i)}return n}(t||D.rules,r.context);let a=i(e,n);a=F(a);const s={};let u=a.toString({parenthesis:"all"});for(;!s[u];){s[u]=!0,I=0;let e=u;o&&console.log("Working on: ",u);for(let n=0;n<t.length;n++){let i="";if("function"==typeof t[n]?(a=t[n](a,r),o&&(i=t[n].name)):(E(a,r.context),a=q(a,t[n],r.context),o&&(i=`${t[n].l.toString()} -> ${t[n].r.toString()}`)),o){const t=a.toString({parenthesis:"all"});t!==e&&(console.log("Applying",i,"produced",t),e=t)}S(a,r.context)}u=a.toString({parenthesis:"all"})}return a}function R(e,t,n){let r=e;if(e)for(let i=0;i<e.length;++i){const o=q(e[i],t,n);o!==e[i]&&(r===e&&(r=e.slice()),r[i]=o)}return r}function q(e,t,n){if(t.assuming)for(const r in t.assuming)for(const i in t.assuming[r])if(b(r,i,n)!==t.assuming[r][i])return e;const r=N(t.imposeContext,n);let i=e;if(i instanceof d||i instanceof l){const e=R(i.args,t,n);e!==i.args&&(i=i.clone(),i.args=e)}else if(i instanceof g){if(i.content){const e=q(i.content,t,n);e!==i.content&&(i=new g(e))}}else if(i instanceof u){const e=R(i.items,t,n);e!==i.items&&(i=new u(e))}else if(i instanceof s){let e=i.object;i.object&&(e=q(i.object,t,n));let r=i.index;i.index&&(r=q(i.index,t,n)),e===i.object&&r===i.index||(i=new s(e,r))}else if(i instanceof f){const e=R(i.dimensions,t,n);e!==i.dimensions&&(i=new f(e))}else if(i instanceof p){let e=!1;const r={};for(const o in i.properties)r[o]=q(i.properties[o],t,n),r[o]!==i.properties[o]&&(e=!0);e&&(i=new p(r))}let o=t.r,a=U(t.l,i,r)[0];if(!a&&t.expanded&&(o=t.expanded.r,a=U(t.expanded.l,i,r)[0]),!a&&t.expandedNC1&&(o=t.expandedNC1.r,a=U(t.expandedNC1.l,i,r)[0],a||(o=t.expandedNC2.r,a=U(t.expandedNC2.l,i,r)[0])),a){const e=i.implicit;i=o.clone(),e&&"implicit"in o&&(i.implicit=!0),i=i.transform((function(e){return e.isSymbolNode&&me(a.placeholders,e.name)?a.placeholders[e.name].clone():e}))}return t.repeat&&i!==e&&(i=q(i,t,n)),i}function P(e,t){const n={placeholders:{}};if(!e.placeholders&&!t.placeholders)return n;if(!e.placeholders)return t;if(!t.placeholders)return e;for(const r in e.placeholders)if(me(e.placeholders,r)&&(n.placeholders[r]=e.placeholders[r],me(t.placeholders,r)&&!L(e.placeholders[r],t.placeholders[r])))return null;for(const e in t.placeholders)me(t.placeholders,e)&&(n.placeholders[e]=t.placeholders[e]);return n}function j(e,t){const n=[];if(0===e.length||0===t.length)return n;let r;for(let i=0;i<e.length;i++)for(let o=0;o<t.length;o++)r=P(e[i],t[o]),r&&n.push(r);return n}function U(e,t,n,i){let o=[{placeholders:{}}];if(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l){if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof l&&e.name!==t.name)return[];if(!(1===t.args.length&&1===e.args.length||!w(t,n)&&t.args.length===e.args.length||i)){if(t.args.length>=2&&2===e.args.length){const r=function(e,t){const n=[];let r,i;const o=M(e);if(v(e,t))for(let t=0;t<e.args.length;t++)i=e.args.slice(0),i.splice(t,1),r=1===i.length?i[0]:o(i),n.push(o([e.args[t],r]));else for(let t=1;t<e.args.length;t++){let a=e.args[0];t>1&&(a=o(e.args.slice(0,t))),i=e.args.slice(t),r=1===i.length?i[0]:o(i),n.push(o([a,r]))}return n}(t,n);let i=[];for(let t=0;t<r.length;t++){const o=U(e,r[t],n,!0);i=i.concat(o)}return i}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}{let r=[];for(let i=0;i<e.args.length;i++){const o=U(e.args[i],t.args[i],n);if(0===o.length)break;r.push(o)}if(r.length!==e.args.length){if(!v(t,n)||1===e.args.length)return[];if(e.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");const i=U(e.args[0],t.args[1],n);if(0===i.length)return[];const o=U(e.args[1],t.args[0],n);if(0===o.length)return[];r=[i,o]}o=function(e){if(0===e.length)return e;const t=e.reduce(j),n=[],r={};for(let e=0;e<t.length;e++){const i=JSON.stringify(t[e],x);r[i]||(r[i]=!0,n.push(t[e]))}return n}(r)}}else if(e instanceof y){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(O[e.name]){if(e.name!==t.name)return[]}else switch(e.name[1]>="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":o[0].placeholders[e.name]=t;break;case"c":case"cl":if(!V(t))return[];o[0].placeholders[e.name]=t;break;case"v":if(V(t))return[];o[0].placeholders[e.name]=t;break;case"vl":if(!re(t))return[];o[0].placeholders[e.name]=t;break;case"cd":if(!Id(t))return[];o[0].placeholders[e.name]=t;break;case"vd":if(Id(t))return[];o[0].placeholders[e.name]=t;break;case"ce":if(!zd(t))return[];o[0].placeholders[e.name]=t;break;case"ve":if(zd(t))return[];o[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof c))return[];if(!r(e.value,t.value))return[]}return o}function L(e,t){if(e instanceof c&&t instanceof c){if(!r(e.value,t.value))return!1}else if(e instanceof y&&t instanceof y){if(e.name!==t.name)return!1}else{if(!(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l))return!1;if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof l&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(let n=0;n<e.args.length;n++)if(!L(e.args[n],t.args[n]))return!1}return!0}return D})),qd=he("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],(e=>{let{typed:t,config:n,mathWithTransform:r,matrix:i,fraction:o,bignumber:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=e;const{isCommutative:d,isAssociative:g,allChildren:y,createMakeNodeFunction:x}=kd({FunctionNode:l,OperatorNode:m,SymbolNode:h}),v=t("simplifyConstant",{Node:e=>S(D(e,{})),"Node, Object":function(e,t){return S(D(e,t))}});function w(e){return b(e)?e.valueOf():e instanceof Array?e.map(w):E(e)?i(w(e.valueOf())):e}function N(e,t,n){try{return r[e].apply(null,t)}catch(i){return t=t.map(w),C(r[e].apply(null,t),n)}}const A=t({Fraction:function(e){const t=e=>"BigNumber"===n.number&&a?a(e):Number(e),r=e.s*e.n,i=r<0n?new m("-","unaryMinus",[new c(-t(r))]):new c(t(r));return 1n===e.d?i:new m("/","divide",[i,new c(t(e.d))])},number:function(e){return e<0?T(new c(-e)):new c(e)},BigNumber:function(e){return e<0?T(new c(-e)):new c(e)},bigint:function(e){return e<0n?T(new c(-e)):new c(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new c(e)},Matrix:function(e){return new u(e.valueOf().map((e=>A(e))))}});function S(e){return X(e)?e:A(e)}function M(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&o){const n=o(e),r=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(n.valueOf()===e&&n.n<r&&n.d<r)return n}return e}const C=t({"string, Object":function(e,t){const r=xe(e,n);return"BigNumber"===r?(void 0===a&&iu(),a(e)):"bigint"===r?BigInt(e):"Fraction"===r?(void 0===o&&ou(),o(e)):M(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return M(e,t)},"bigint, Object":function(e,t){return e},"Complex, Object":function(e,t){return 0!==e.im?e:M(e.re,t)},"Matrix, Object":function(e,t){return i(M(e.valueOf()))},"Array, Object":function(e,t){return e.map(M)}});function T(e){return new m("-","unaryMinus",[e])}function B(e,t,n,r){const i=t.shift(),o=t.reduce(((t,i)=>{if(!X(i)){const n=t.pop();if(X(n))return[n,i];try{return t.push(N(e,[n,i],r)),t}catch(e){t.push(n)}}t.push(S(t.pop()));const o=1===t.length?t[0]:n(t);return[n([o,S(i)])]}),[i]);return 1===o.length?o[0]:n([o[0],A(o[1])])}function D(e,t){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":case"bigint":return C(e.value,t);case"string":return e.value;default:if(!isNaN(e.value))return C(e.value,t)}return e;case"FunctionNode":if(r[e.name]&&r[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){const n=e.args.map((e=>D(e,t)));if(!n.some(X))try{return N(e.name,n,t)}catch(e){}if("size"===e.name&&1===n.length&&L(n[0])){const e=[];let t=n[0];for(;L(t);)e.push(t.items.length),t=t.items[0];return i(e)}return new l(e.name,n.map(S))}case"OperatorNode":{const n=e.fn.toString();let r,i;const o=x(e);if(K(e)&&e.isUnary())r=[D(e.args[0],t)],i=X(r[0])?o(r):N(n,r,t);else if(g(e,t.context))if(r=y(e,t.context),r=r.map((e=>D(e,t))),d(n,t.context)){const e=[],a=[];for(let t=0;t<r.length;t++)X(r[t])?a.push(r[t]):e.push(r[t]);e.length>1?(i=B(n,e,o,t),a.unshift(i),i=B(n,a,o,t)):i=B(n,r,o,t)}else i=B(n,r,o,t);else r=e.args.map((e=>D(e,t))),i=B(n,r,o,t);return i}case"ParenthesisNode":return D(e.content,t);case"AccessorNode":return function(e,t,n){if(!J(t))return new s(S(e),S(t));if(L(e)||E(e)){const r=Array.from(t.dimensions);for(;r.length>0;)if(V(r[0])&&"string"!=typeof r[0].value){const t=C(r.shift().value,n);L(e)?e=e.items[t-1]:(e=e.valueOf()[t-1])instanceof Array&&(e=i(e))}else{if(!(r.length>1&&V(r[1])&&"string"!=typeof r[1].value))break;{const t=C(r[1].value,n),o=[],a=L(e)?e.items:e.valueOf();for(const n of a)if(L(n))o.push(n.items[t-1]);else{if(!E(e))break;o.push(n[t-1])}if(o.length!==a.length)break;e=L(e)?new u(o):i(o),r.splice(1,1)}}return r.length===t.dimensions.length?new s(S(e),t):r.length>0?(t=new f(r),new s(S(e),t)):e}if(Q(e)&&1===t.dimensions.length&&V(t.dimensions[0])){const n=t.dimensions[0].value;return n in e.properties?e.properties[n]:new c}return new s(S(e),t)}(D(e.object,t),D(e.index,t),t);case"ArrayNode":{const n=e.items.map((e=>D(e,t)));return n.some(X)?new u(n.map(S)):i(n)}case"IndexNode":return new f(e.dimensions.map((e=>v(e,t))));case"ObjectNode":{const n={};for(const r in e.properties)n[r]=v(e.properties[r],t);return new p(n)}default:throw new Error(`Unimplemented node type in simplifyConstant: ${e.type}`)}}return v})),Pd="simplifyCore",jd=he(Pd,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,parse:n,equal:r,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,AccessorNode:l,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:y,SymbolNode:x}=e;const b=new p(0),v=new p(1),w=new p(!0),N=new p(!1);function E(e){return K(e)&&["and","not","or"].includes(e.op)}const{hasProperty:A,isCommutative:S}=kd({FunctionNode:m,OperatorNode:g,SymbolNode:x});function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=t?t.context:void 0;if(A(e,"trivial",n)){if(Y(e)&&1===e.args.length)return M(e.args[0],t);let n=!1,r=0;if(e.forEach((e=>{++r,1===r&&(n=M(e,t))})),1===r)return n}let o=e;if(Y(o)){const e=function(e){const t="OperatorNode:"+e;for(const e of Rp)if(t in e)return e[t].op;return null}(o.name);if(!e)return new m(M(o.fn),o.args.map((e=>M(e,t))));if(o.args.length>2&&A(o,"associative",n))for(;o.args.length>2;){const t=o.args.pop(),n=o.args.pop();o.args.push(new g(e,o.name,[t,n]))}o=new g(e,o.name,o.args)}if(K(o)&&o.isUnary()){const e=M(o.args[0],t);if("~"===o.op&&K(e)&&e.isUnary()&&"~"===e.op)return e.args[0];if("not"===o.op&&K(e)&&e.isUnary()&&"not"===e.op&&E(e.args[0]))return e.args[0];let n=!0;if("-"===o.op&&K(e)&&(e.isBinary()&&"subtract"===e.fn&&(o=new g("-","subtract",[e.args[1],e.args[0]]),n=!1),e.isUnary()&&"-"===e.op))return e.args[0];if(n)return new g(o.op,o.fn,[e])}if(K(o)&&o.isBinary()){const e=M(o.args[0],t);let a=M(o.args[1],t);if("+"===o.op){if(V(e)&&i(e.value))return a;if(V(a)&&i(a.value))return e;K(a)&&a.isUnary()&&"-"===a.op&&(a=a.args[0],o=new g("-","subtract",[e,a]))}if("-"===o.op)return K(a)&&a.isUnary()&&"-"===a.op?M(new g("+","add",[e,a.args[0]]),t):V(e)&&i(e.value)?M(new g("-","unaryMinus",[a])):V(a)&&i(a.value)?e:new g(o.op,o.fn,[e,a]);if("*"===o.op){if(V(e)){if(i(e.value))return b;if(r(e.value,1))return a}if(V(a)){if(i(a.value))return b;if(r(a.value,1))return e;if(S(o,n))return new g(o.op,o.fn,[a,e],o.implicit)}return new g(o.op,o.fn,[e,a],o.implicit)}if("/"===o.op)return V(e)&&i(e.value)?b:V(a)&&r(a.value,1)?e:new g(o.op,o.fn,[e,a]);if("^"===o.op&&V(a)){if(i(a.value))return v;if(r(a.value,1))return e}if("and"===o.op){if(V(e)){if(!e.value)return N;if(E(a))return a;if(V(a))return a.value?w:N}if(V(a)){if(!a.value)return N;if(E(e))return e}}if("or"===o.op){if(V(e)){if(e.value)return w;if(E(a))return a}if(V(a)){if(a.value)return w;if(E(e))return e}}return new g(o.op,o.fn,[e,a])}if(K(o))return new g(o.op,o.fn,o.args.map((e=>M(e,t))));if(L(o))return new f(o.items.map((e=>M(e,t))));if(U(o))return new l(M(o.object,t),M(o.index,t));if(J(o))return new h(o.dimensions.map((e=>M(e,t))));if(Q(o)){const e={};for(const n in o.properties)e[n]=M(o.properties[n],t);return new d(e)}return o}return t(Pd,{Node:M,"Node,Object":M})})),Ud=he("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(e=>{let{typed:t,parse:n,ConstantNode:r,FunctionNode:i,OperatorNode:o,ParenthesisNode:a}=e;function s(e,t){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(re(e)){if(u.has(e.name)){const e=Array.from(u).join(", ");throw new ReferenceError(`recursive loop of variable definitions among {${e}}`)}const i=t.get(e.name);if(X(i)){const n=new Set(u);return n.add(e.name),s(i,t,n)}return"number"==typeof i?n(String(i)):void 0!==i?new r(i):e}if(K(e)){const n=e.args.map((function(e){return s(e,t,u)}));return new o(e.op,e.fn,n,e.implicit)}if(ee(e))return new a(s(e.content,t,u));if(Y(e)){const n=e.args.map((function(e){return s(e,t,u)}));return new i(e.name,n)}return e.map((e=>s(e,t,u)))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,t)=>s(e,h(t)),"Array | Matrix":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array | Matrix, null | undefined":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array, Object":t.referTo("Array,Map",(e=>(t,n)=>e(t,h(n)))),"Matrix, Object":t.referTo("Matrix,Map",(e=>(t,n)=>e(t,h(n)))),"Array | Matrix, Map":t.referToSelf((e=>(t,n)=>t.map((t=>e(t,n)))))})})),Ld="symbolicEqual",$d=he(Ld,["parse","simplify","typed","OperatorNode"],(e=>{let{parse:t,simplify:n,typed:r,OperatorNode:i}=e;function o(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new i("-","subtract",[e,t]),a=n(o,{},r);return V(a)&&!a.value}return r(Ld,{"Node, Node":o,"Node, Node, Object":o})})),Hd="derivative",Gd=he(Hd,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,config:n,parse:r,simplify:i,equal:o,isZero:a,numeric:s,ConstantNode:u,FunctionNode:c,OperatorNode:l,ParenthesisNode:f,SymbolNode:p}=e;function m(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0};const r=new Map,o=t.name,a=x(e,(function e(t){const n=r.get(t);if(void 0!==n)return n;const i=y(e,t,o);return r.set(t,i),i}));return n.simplify?i(a):a}function h(e){const t=r(e);if(!t.isSymbolNode)throw new TypeError(`Invalid variable. Cannot parse ${JSON.stringify(e)} into a variable in function derivative`);return t}const d=t(Hd,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m,"Node, string":(e,t)=>m(e,h(t)),"Node, string, Object":(e,t,n)=>m(e,h(t),n)});d._simplify=!0,d.toTex=function(e){return g.apply(null,e.args)};const g=t("_derivTex",{"Node, SymbolNode":function(e,t){return V(e)&&"string"===oe(e.value)?g(r(e.value).toString(),t.toString(),1):g(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===oe(t.value))return g(e,r(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,n){return g(e.toString(),t.name,n.value)},"string, string, number":function(e,t,n){let r;return r=1===n?"{d\\over d"+t+"}":"{d^{"+n+"}\\over d"+t+"^{"+n+"}}",r+`\\left[${e}\\right]`}}),y=t("_isConst",{"function, ConstantNode, string":function(){return!0},"function, SymbolNode, string":function(e,t,n){return t.name!==n},"function, ParenthesisNode, string":function(e,t,n){return e(t.content,n)},"function, FunctionAssignmentNode, string":function(e,t,n){return!t.params.includes(n)||e(t.expr,n)},"function, FunctionNode | OperatorNode, string":function(e,t,n){return t.args.every((t=>e(t,n)))}}),x=t("_derivative",{"ConstantNode, function":function(){return b(0)},"SymbolNode, function":function(e,t){return t(e)?b(0):b(1)},"ParenthesisNode, function":function(e,t){return new f(x(e.content,t))},"FunctionAssignmentNode, function":function(e,t){return t(e)?b(0):x(e.expr,t)},"FunctionNode, function":function(e,t){if(t(e))return b(0);const n=e.args[0];let r,i,o,a,s=!1,u=!1;switch(e.name){case"cbrt":s=!0,i=new l("*","multiply",[b(3),new l("^","pow",[n,new l("/","divide",[b(2),b(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,i=new l("*","multiply",[b(2),new c("sqrt",[n])]);else if(2===e.args.length)return r=new l("/","divide",[b(1),e.args[1]]),x(new l("^","pow",[n,r]),t);break;case"log10":r=b(10);case"log":if(r||1!==e.args.length){if(1===e.args.length&&r||2===e.args.length&&t(e.args[1]))i=new l("*","multiply",[n.clone(),new c("log",[r||e.args[1]])]),s=!0;else if(2===e.args.length)return x(new l("/","divide",[new c("log",[n]),new c("log",[e.args[1]])]),t)}else i=n.clone(),s=!0;break;case"pow":if(2===e.args.length)return x(new l("^","pow",[n,e.args[1]]),t);break;case"exp":i=new c("exp",[n.clone()]);break;case"sin":i=new c("cos",[n.clone()]);break;case"cos":i=new l("-","unaryMinus",[new c("sin",[n.clone()])]);break;case"tan":i=new l("^","pow",[new c("sec",[n.clone()]),b(2)]);break;case"sec":i=new l("*","multiply",[e,new c("tan",[n.clone()])]);break;case"csc":u=!0,i=new l("*","multiply",[e,new c("cot",[n.clone()])]);break;case"cot":u=!0,i=new l("^","pow",[new c("csc",[n.clone()]),b(2)]);break;case"asin":s=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])]);break;case"acos":s=!0,u=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])]);break;case"atan":s=!0,i=new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)]);break;case"asec":s=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acsc":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acot":s=!0,u=!0,i=new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)]);break;case"sinh":i=new c("cosh",[n.clone()]);break;case"cosh":i=new c("sinh",[n.clone()]);break;case"tanh":i=new l("^","pow",[new c("sech",[n.clone()]),b(2)]);break;case"sech":u=!0,i=new l("*","multiply",[e,new c("tanh",[n.clone()])]);break;case"csch":u=!0,i=new l("*","multiply",[e,new c("coth",[n.clone()])]);break;case"coth":u=!0,i=new l("^","pow",[new c("csch",[n.clone()]),b(2)]);break;case"asinh":s=!0,i=new c("sqrt",[new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)])]);break;case"acosh":s=!0,i=new c("sqrt",[new l("-","subtract",[new l("^","pow",[n.clone(),b(2)]),b(1)])]);break;case"atanh":s=!0,i=new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])]);break;case"asech":s=!0,u=!0,i=new l("*","multiply",[n.clone(),new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])])])]);break;case"acsch":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[n.clone()]),new c("sqrt",[new l("+","add",[new l("^","pow",[n.clone(),b(2)]),b(1)])])]);break;case"acoth":s=!0,u=!0,i=new l("-","subtract",[b(1),new l("^","pow",[n.clone(),b(2)])]);break;case"abs":i=new l("/","divide",[new c(new p("abs"),[n.clone()]),n.clone()]);break;default:throw new 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?(o="/",a="divide"):(o="*",a="multiply");let f=x(n,t);return u&&(f=new l("-","unaryMinus",[f])),new l(o,a,[f,i])},"OperatorNode, function":function(e,t){if(t(e))return b(0);if("+"===e.op)return new l(e.op,e.fn,e.args.map((function(e){return x(e,t)})));if("-"===e.op){if(e.isUnary())return new l(e.op,e.fn,[x(e.args[0],t)]);if(e.isBinary())return new l(e.op,e.fn,[x(e.args[0],t),x(e.args[1],t)])}if("*"===e.op){const n=e.args.filter((function(e){return t(e)}));if(n.length>0){const r=e.args.filter((function(e){return!t(e)})),i=1===r.length?r[0]:new l("*","multiply",r),o=n.concat(x(i,t));return new l("*","multiply",o)}return new l("+","add",e.args.map((function(n){return new l("*","multiply",e.args.map((function(e){return e===n?x(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){const n=e.args[0],r=e.args[1];return t(r)?new l("/","divide",[x(n,t),r]):t(n)?new l("*","multiply",[new l("-","unaryMinus",[n]),new l("/","divide",[x(r,t),new l("^","pow",[r.clone(),b(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[x(n,t),r.clone()]),new l("*","multiply",[n.clone(),x(r,t)])]),new l("^","pow",[r.clone(),b(2)])])}if("^"===e.op&&e.isBinary()){const n=e.args[0],r=e.args[1];if(t(n))return V(n)&&(a(n.value)||o(n.value,1))?b(0):new l("*","multiply",[e,new l("*","multiply",[new c("log",[n.clone()]),x(r.clone(),t)])]);if(t(r)){if(V(r)){if(a(r.value))return b(0);if(o(r.value,1))return x(n,t)}const e=new l("^","pow",[n.clone(),new l("-","subtract",[r,b(1)])]);return new l("*","multiply",[r.clone(),new l("*","multiply",[x(n,t),e])])}return new l("*","multiply",[new l("^","pow",[n.clone(),r.clone()]),new l("+","add",[new l("*","multiply",[x(n,t),new l("/","divide",[r.clone(),n.clone()])]),new l("*","multiply",[x(r,t),new c("log",[n.clone()])])])])}throw new 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 b(e,t){return new u(s(e,t||xe(String(e),n)))}return d})),Vd="rationalize",Zd=he(Vd,["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=>{let{config:t,typed:n,equal:r,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,parse:l,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:x,ArrayNode:b,ConstantNode:v,FunctionNode:w,IndexNode:N,ObjectNode:E,OperatorNode:A,SymbolNode:S,ParenthesisNode:M}=e;function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=function(){const e=[p,{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"}],t=[{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)"}],n=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],r={};return r.firstRules=e.concat(t,n),r.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)"}],r.sucDivRules=n,r.firstRulesAgain=e.concat(t),r.finalRules=[p,{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))"}],r}(),i=function(e,t,n,r){const i=[],o=m(e,r,t,{exactFractions:!1}),a="+-*"+((n=!!n)?"/":"");!function e(t){const n=t.type;if("FunctionNode"===n)throw new Error("There is an unsolved function call");if("OperatorNode"===n)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!ye(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(!a.includes(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(let n=0;n<t.args.length;n++)e(t.args[n])}else if("SymbolNode"===n){const e=t.name;-1===i.indexOf(e)&&i.push(e)}else if("ParenthesisNode"===n)e(t.content);else if("ConstantNode"!==n)throw new Error("type "+n+" is not allowed in polynomial expression")}(o);const s={};return s.expression=o,s.variables=i,s}(e,t,!0,r.firstRules),o=i.variables.length,a={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,o>=1){let t,n;e=T(e);let i,o=!0,u=!1;for(e=m(e,r.firstRules,{},a);n=o?r.distrDivRules:r.sucDivRules,o=!o,i=(e=m(e,n,{},s)).toString(),i!==t;)u=!0,t=i;u&&(e=m(e,r.firstRulesAgain,{},a)),e=m(e,r.finalRules,{},a)}const u=[],c={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===o&&(e.args[0]=B(e.args[0],u),e.args[1]=B(e.args[1])),n&&(c.numerator=e.args[0],c.denominator=e.args[1])):(1===o&&(e=B(e,u)),n&&(c.numerator=e,c.denominator=null)),n?(c.coefficients=u,c.variables=i.variables,c.expression=e,c):e}return n(Vd,{Node:C,"Node, boolean":(e,t)=>C(e,{},t),"Node, Object":C,"Node, Object, boolean":C});function T(e,t,n){const r=e.type,i=arguments.length>1;if("OperatorNode"===r&&e.isBinary()){let r,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(r=parseFloat(e.args[1].value),o=r>=2&&ye(r))),o){if(r>2){const t=e.args[0],n=new A("^","pow",[e.args[0].cloneDeep(),new v(r-1)]);e=new A("*","multiply",[t,n])}else e=new A("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===n?t.content=e:t.args[n]=e)}}if("ParenthesisNode"===r)T(e.content,e,"content");else if("ConstantNode"!==r&&"SymbolNode"!==r)for(let t=0;t<e.args.length;t++)T(e.args[t],e,t);if(!i)return e}function B(e,t){void 0===t&&(t=[]),t[0]=0;let n=0,r="";!function e(i,o,a){const s=i.type;if("FunctionNode"===s)throw new Error("There is an unsolved function call");if("OperatorNode"===s){if(!"+-*^".includes(i.op))throw new Error("Operator "+i.op+" invalid");if(null!==o){if(("unaryMinus"===i.fn||"pow"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn&&"multiply"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"multiply"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"unaryMinus"===i.fn)&&0!==a.noFil)throw new Error("Invalid "+i.op+" placing")}"^"!==i.op&&"*"!==i.op||(a.fire=i.op);for(let t=0;t<i.args.length;t++)"unaryMinus"===i.fn&&(a.oper="-"),"+"!==i.op&&"subtract"!==i.fn||(a.fire="",a.cte=1,a.oper=0===t?"+":i.op),a.noFil=t,e(i.args[t],i,a)}else if("SymbolNode"===s){if(i.name!==r&&""!==r)throw new Error("There is more than one variable");if(r=i.name,null===o)return void(t[1]=1);if("^"===o.op&&0!==a.noFil)throw new Error("In power the variable should be the first parameter");if("*"===o.op&&1!==a.noFil)throw new Error("In multiply the variable should be the second parameter");""!==a.fire&&"*"!==a.fire||(n<1&&(t[1]=0),t[1]+=a.cte*("+"===a.oper?1:-1),n=Math.max(1,n))}else{if("ConstantNode"!==s)throw new Error("Type "+s+" is not allowed");{const e=parseFloat(i.value);if(null===o)return void(t[0]=e);if("^"===o.op){if(1!==a.noFil)throw new Error("Constant cannot be powered");if(!ye(e)||e<=0)throw new Error("Non-integer exponent is not allowed");for(let r=n+1;r<e;r++)t[r]=0;return e>n&&(t[e]=0),t[e]+=a.cte*("+"===a.oper?1:-1),void(n=Math.max(e,n))}a.cte=e,""===a.fire&&(t[0]+=a.cte*("+"===a.oper?1:-1))}}}(e,null,{cte:1,oper:"+",fire:""}),n=t.length-1;let i,o=!0;for(let e=n;e>=0;e--){if(0===t[e])continue;let n=new v(o?t[e]:Math.abs(t[e]));const a=t[e]<0?"-":"+";if(e>0){let i=new S(r);if(e>1){const t=new v(e);i=new A("^","pow",[i,t])}n=-1===t[e]&&o?new A("-","unaryMinus",[i]):1===Math.abs(t[e])?i:new A("*","multiply",[n,i])}i=o?n:"+"===a?new A("+","add",[i,n]):new A("-","subtract",[i,n]),o=!1}return o?new v(0):i}})),Wd="zpk2tf",Yd=he(Wd,["typed","add","multiply","Complex","number"],(e=>{let{typed:t,add:n,multiply:r,Complex:i,number:o}=e;return t(Wd,{"Array,Array,number":function(e,t,n){return a(e,t,n)},"Array,Array":function(e,t){return a(e,t,1)},"Matrix,Matrix,number":function(e,t,n){return a(e.valueOf(),t.valueOf(),n)},"Matrix,Matrix":function(e,t){return a(e.valueOf(),t.valueOf(),1)}});function a(e,t,n){e.some((e=>"BigNumber"===e.type))&&(e=e.map((e=>o(e)))),t.some((e=>"BigNumber"===e.type))&&(t=t.map((e=>o(e))));let a=[i(1,0)],u=[i(1,0)];for(let t=0;t<e.length;t++){let n=e[t];"number"==typeof n&&(n=i(n,0)),a=s(a,[i(1,0),i(-n.re,-n.im)])}for(let e=0;e<t.length;e++){let n=t[e];"number"==typeof n&&(n=i(n,0)),u=s(u,[i(1,0),i(-n.re,-n.im)])}for(let e=0;e<a.length;e++)a[e]=r(a[e],n);return[a,u]}function s(e,t){const o=[];for(let a=0;a<e.length+t.length-1;a++){o[a]=i(0,0);for(let i=0;i<e.length;i++)a-i>=0&&a-i<t.length&&(o[a]=n(o[a],r(e[i],t[a-i])))}return o}})),Jd="freqz",Xd=he(Jd,["typed","add","multiply","Complex","divide","matrix"],(e=>{let{typed:t,add:n,multiply:r,Complex:i,divide:o,matrix:a}=e;return t(Jd,{"Array, Array":function(e,t){return s(e,t,u(512))},"Array, Array, Array":function(e,t,n){return s(e,t,n)},"Array, Array, number":function(e,t,n){if(n<0)throw new Error("w must be a positive number");return s(e,t,u(n))},"Matrix, Matrix":function(e,t){const n=u(512),{w:r,h:i}=s(e.valueOf(),t.valueOf(),n);return{w:a(r),h:a(i)}},"Matrix, Matrix, Matrix":function(e,t,n){const{h:r}=s(e.valueOf(),t.valueOf(),n.valueOf());return{h:a(r),w:a(n)}},"Matrix, Matrix, number":function(e,t,n){if(n<0)throw new Error("w must be a positive number");const r=u(n),{h:i}=s(e.valueOf(),t.valueOf(),r);return{h:a(i),w:a(r)}}});function s(e,t,a){const s=[],u=[];for(let o=0;o<a.length;o++){let c=i(0,0),l=i(0,0);for(let t=0;t<e.length;t++)c=n(c,r(e[t],i(Math.cos(-t*a[o]),Math.sin(-t*a[o]))));for(let e=0;e<t.length;e++)l=n(l,r(t[e],i(Math.cos(-e*a[o]),Math.sin(-e*a[o]))));s.push(c),u.push(l)}const c=[];for(let e=0;e<s.length;e++)c.push(o(s[e],u[e]));return{h:c,w:a}}function u(e){const t=[];for(let n=0;n<e;n++)t.push(n/e*Math.PI);return t}})),Qd=he("reviver",["classes"],(e=>{let{classes:t}=e;return function(e,n){const r=t[n&&n.mathjs];return r&&"function"==typeof r.fromJSON?r.fromJSON(n):n}})),Kd=he("replacer",[],(()=>function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?"bigint"==typeof t?{mathjs:"bigint",value:String(t)}:t:{mathjs:"number",value:String(t)}})),eg=Math.PI,tg=2*Math.PI,ng=Math.E,rg=he("true",[],(()=>!0)),ig=he("false",[],(()=>!1)),og=he("null",[],(()=>null)),ag=Ng("Infinity",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1/0):1/0})),sg=Ng("NaN",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(NaN):NaN})),ug=Ng("pi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?kl(n):eg})),cg=Ng("tau",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?Rl(n):tg})),lg=Ng("e",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?Il(n):ng})),fg=Ng("phi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?zl(n):1.618033988749895})),pg=Ng("LN2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).ln():Math.LN2})),mg=Ng("LN10",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(10).ln():Math.LN10})),hg=Ng("LOG2E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(2).ln()):Math.LOG2E})),dg=Ng("LOG10E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(1).div(new n(10).ln()):Math.LOG10E})),gg=Ng("SQRT1_2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n("0.5").sqrt():Math.SQRT1_2})),yg=Ng("SQRT2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(2).sqrt():Math.SQRT2})),xg=Ng("i",["Complex"],(e=>{let{Complex:t}=e;return t.I})),bg=he("PI",["pi"],(e=>{let{pi:t}=e;return t})),vg=he("E",["e"],(e=>{let{e:t}=e;return t})),wg=he("version",[],(()=>"14.2.1"));function Ng(e,t,n){return he(e,t,n,{recreateOnConfigChange:!0})}const Eg=by("speedOfLight","299792458","m s^-1"),Ag=by("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),Sg=by("planckConstant","6.62607015e-34","J s"),Mg=by("reducedPlanckConstant","1.0545718176461565e-34","J s"),Cg=by("magneticConstant","1.25663706212e-6","N A^-2"),Tg=by("electricConstant","8.8541878128e-12","F m^-1"),Bg=by("vacuumImpedance","376.730313667","ohm"),Dg=by("coulomb","8.987551792261171e9","N m^2 C^-2"),Fg=by("elementaryCharge","1.602176634e-19","C"),Og=by("bohrMagneton","9.2740100783e-24","J T^-1"),_g=by("conductanceQuantum","7.748091729863649e-5","S"),Ig=by("inverseConductanceQuantum","12906.403729652257","ohm"),zg=by("magneticFluxQuantum","2.0678338484619295e-15","Wb"),kg=by("nuclearMagneton","5.0507837461e-27","J T^-1"),Rg=by("klitzing","25812.807459304513","ohm"),qg=by("bohrRadius","5.29177210903e-11","m"),Pg=by("classicalElectronRadius","2.8179403262e-15","m"),jg=by("electronMass","9.1093837015e-31","kg"),Ug=by("fermiCoupling","1.1663787e-5","GeV^-2"),Lg=vy("fineStructure",.0072973525693),$g=by("hartreeEnergy","4.3597447222071e-18","J"),Hg=by("protonMass","1.67262192369e-27","kg"),Gg=by("deuteronMass","3.3435830926e-27","kg"),Vg=by("neutronMass","1.6749271613e-27","kg"),Zg=by("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Wg=by("rydberg","10973731.568160","m^-1"),Yg=by("thomsonCrossSection","6.6524587321e-29","m^2"),Jg=vy("weakMixingAngle",.2229),Xg=vy("efimovFactor",22.7),Qg=by("atomicMass","1.66053906660e-27","kg"),Kg=by("avogadro","6.02214076e23","mol^-1"),ey=by("boltzmann","1.380649e-23","J K^-1"),ty=by("faraday","96485.33212331001","C mol^-1"),ny=by("firstRadiation","3.7417718521927573e-16","W m^2"),ry=by("loschmidt","2.686780111798444e25","m^-3"),iy=by("gasConstant","8.31446261815324","J K^-1 mol^-1"),oy=by("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),ay=by("molarVolume","0.022413969545014137","m^3 mol^-1"),sy=vy("sackurTetrode",-1.16487052358),uy=by("secondRadiation","0.014387768775039337","m K"),cy=by("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),ly=by("wienDisplacement","2.897771955e-3","m K"),fy=by("molarMass","0.99999999965e-3","kg mol^-1"),py=by("molarMassC12","11.9999999958e-3","kg mol^-1"),my=by("gravity","9.80665","m s^-2"),hy=by("planckLength","1.616255e-35","m"),dy=by("planckMass","2.176435e-8","kg"),gy=by("planckTime","5.391245e-44","s"),yy=by("planckCharge","1.87554603778e-18","C"),xy=by("planckTemperature","1.416785e+32","K");function by(e,t,n){return he(e,["config","Unit","BigNumber"],(e=>{let{config:r,Unit:i,BigNumber:o}=e;const a=new i("BigNumber"===r.number?new o(t):parseFloat(t),n);return a.fixPrefix=!0,a}))}function vy(e,t){return he(e,["config","BigNumber"],(e=>{let{config:n,BigNumber:r}=e;return"BigNumber"===n.number?new r(t):t}))}const wy=he("mapSlices",["typed","isInteger"],(e=>{let{typed:t,isInteger:n}=e;const r=Co({typed:t,isInteger:n});return t("mapSlices",{"...any":function(e){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1));try{return r.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0,...Co.meta}),Ny=he("column",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;const o=_s({typed:t,Index:n,matrix:r,range:i});return t("column",{"...any":function(e){const t=e.length-1,n=e[t];d(n)&&(e[t]=n-1);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0});function Ey(e,t,n){const r=e.filter((function(e){return re(e)&&!(e.name in t)&&!n.has(e.name)}))[0];if(!r)throw new Error('No undefined variable found in inline expression "'+e+'"');const i=r.name,o=new Map,a=new f(n,o,new Set([i])),s=e.compile();return function(e){return o.set(i,e),s.evaluate(a)}}n(3921);const Ay=he("transformCallback",["typed"],(e=>{let{typed:t}=e;return function(e,r){return t.isTypedFunction(e)?n(e,r):Sy(e,e.length,r)};function n(e,r){const i=Object.fromEntries(Object.entries(e.signatures).map((e=>{let[i,o]=e;const a=i.split(",").length;return t.isTypedFunction(o)?[i,n(o,r)]:[i,Sy(o,a,r)]})));return"string"==typeof e.name?t(e.name,i):t(i)}}));function Sy(e,t,n){return t===n?e:t===n+1?function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];const o=r.slice(0,n),a=My(r[n]);return e(...o,a)}:t>n+1?function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];const o=r.slice(0,n),a=My(r[n]),s=r.slice(n+1);return e(...o,a,...s)}:e}function My(e){return e.map((e=>e+1))}const Cy=he("filter",["typed"],(e=>{let{typed:t}=e;function n(e,n,i){const o=js({typed:t}),a=Ay({typed:t});if(0===e.length)return o();let s=e[0];if(1===e.length)return o(s);const u=e.length-1;let c=e[u];return s&&(s=r(s,i)),c&&(c=re(c)||W(c)?r(c,i):Ey(c,n,i)),o(s,a(c,u))}function r(e,t){return e.compile().evaluate(t)}return n.rawArgs=!0,n}),{isTransformFunction:!0}),Ty=he("forEach",["typed"],(e=>{let{typed:t}=e;const n=Gs({typed:t}),r=Ay({typed:t});function i(e,t,i){if(0===e.length)return n();let a=e[0];if(1===e.length)return n(a);const s=e.length-1;let u=e[s];return a&&(a=o(a,i)),u&&(u=re(u)||W(u)?o(u,i):Ey(u,t,i)),n(a,r(u,s))}function o(e,t){return e.compile().evaluate(t)}return i.rawArgs=!0,i}),{isTransformFunction:!0}),By=he("index",["Index","getMatrixDataType"],(e=>{let{Index:t,getMatrixDataType:n}=e;return function(){const e=[];for(let t=0,r=arguments.length;t<r;t++){let r=arguments[t];if(C(r))r.start--,r.end-=r.step>0?0:2;else if(r&&!0===r.isSet)r=r.map((function(e){return e-1}));else if(N(r)||E(r))"boolean"!==n(r)&&(r=r.map((function(e){return e-1})));else if(d(r)||y(r))r--;else if(g(r))r=r.toNumber()-1;else if("string"!=typeof r)throw new TypeError("Dimension must be an Array, Matrix, number, bigint, string, or Range");e[t]=r}const r=new t;return t.apply(r,e),r}}),{isTransformFunction:!0}),Dy=he("map",["typed"],(e=>{let{typed:t}=e;const n=eu({typed:t}),r=Ay({typed:t});function i(e,t,i){if(0===e.length)return n();if(1===e.length)return n(e[0]);const o=e.length-1;let a=e.slice(0,o),s=e[o];return a=a.map((e=>u(e,i))),s&&(s=re(s)||W(s)?u(s,i):Ey(s,t,i)),n(...a,r(s,o));function u(e,t){return e.compile().evaluate(t)}}return i.rawArgs=!0,i}),{isTransformFunction:!0});function Fy(e){if(2===e.length&&A(e[0])){const n=(e=e.slice())[1];(d(t=n)||g(t))&&(e[1]=function(e){return d(e)?e-1:g(e)?e.minus(1):e}(n))}var t;return e}const Oy=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:n,numeric:r,larger:i}=e;const o=Sl({typed:t,config:n,numeric:r,larger:i});return t("max",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),_y=he("mean",["typed","add","divide"],(e=>{let{typed:t,add:n,divide:r}=e;const i=Th({typed:t,add:n,divide:r});return t("mean",{"...any":function(e){e=Fy(e);try{return i.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Iy=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:n,numeric:r,smaller:i}=e;const o=Ml({typed:t,config:n,numeric:r,smaller:i});return t("min",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),zy=he("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;const f=uu({typed:t,config:n,matrix:r,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),f.apply(null,e)}})}),{isTransformFunction:!0}),ky=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:n,matrix:r,range:i}=e;const o=gu({typed:t,Index:n,matrix:r,range:i});return t("row",{"...any":function(e){const t=e.length-1,n=e[t];d(n)&&(e[t]=n-1);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Ry=he("subset",["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;const o=Nu({typed:t,matrix:n,zeros:r,add:i});return t("subset",{"...any":function(e){try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),qy=he("concat",["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:n,isInteger:r}=e;const i=Fs({typed:t,matrix:n,isInteger:r});return t("concat",{"...any":function(e){const t=e.length-1,n=e[t];d(n)?e[t]=n-1:g(n)&&(e[t]=n.minus(1));try{return i.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Py="diff",jy=he(Py,["typed","matrix","subtract","number","bignumber"],(e=>{let{typed:t,matrix:n,subtract:r,number:i,bignumber:o}=e;const a=nu({typed:t,matrix:n,subtract:r,number:i,bignumber:o});return t(Py,{"...any":function(e){e=Fy(e);try{return a.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Uy=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:n,sqrt:r,variance:i}=e;const o=Rh({typed:t,map:n,sqrt:r,variance:i});return t("std",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Ly=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:n,add:r,numeric:i}=e;const o=Ah({typed:t,config:n,add:r,numeric:i});return t("sum",{"...any":function(e){e=Fy(e);try{return o.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),$y=he("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger","mapSlices"],(e=>{let{typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m}=e;const h=kh({typed:t,bignumber:n,add:r,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p,mapSlices:m});return t("quantileSeq",{"Array | Matrix, number | BigNumber":h,"Array | Matrix, number | BigNumber, number":(e,t,n)=>h(e,t,d(n)),"Array | Matrix, number | BigNumber, boolean":h,"Array | Matrix, number | BigNumber, boolean, number":(e,t,n,r)=>h(e,t,n,d(r)),"Array | Matrix, Array | Matrix":h,"Array | Matrix, Array | Matrix, number":(e,t,n)=>h(e,t,d(n)),"Array | Matrix, Array | Matrix, boolean":h,"Array | Matrix, Array | Matrix, boolean, number":(e,t,n,r)=>h(e,t,n,d(r))});function d(e){return Fy([[],e])[1]}}),{isTransformFunction:!0}),Hy="cumsum",Gy=he(Hy,["typed","add","unaryPlus"],(e=>{let{typed:t,add:n,unaryPlus:r}=e;const i=Mh({typed:t,add:n,unaryPlus:r});return t(Hy,{"...any":function(e){if(2===e.length&&A(e[0])){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Vy="variance",Zy=he(Vy,["typed","add","subtract","multiply","divide","mapSlices","isNaN"],(e=>{let{typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s}=e;const u=Ih({typed:t,add:n,subtract:r,multiply:i,divide:o,mapSlices:a,isNaN:s});return t(Vy,{"...any":function(e){e=Fy(e);try{return u.apply(null,e)}catch(e){throw Fp(e)}}})}),{isTransformFunction:!0}),Wy="print",Yy=he(Wy,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:n,zeros:r,add:i}=e;const o=rc({typed:t,matrix:n,zeros:r,add:i});return t(Wy,{"string, Object | Array":function(e,t){return o(a(e),t)},"string, Object | Array, number | Object":function(e,t,n){return o(a(e),t,n)}});function a(e){return e.replace(tc,(e=>"$"+e.slice(1).split(".").map((function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e})).join(".")))}}),{isTransformFunction:!0}),Jy=he("and",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=$c({typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a});function u(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)&&!s(r,!0))return!1;const i=e[1].compile().evaluate(n);return s(r,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Xy=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=Ts({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o});function s(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)&&a(r,!1))return!0;const i=e[1].compile().evaluate(n);return a(r,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0}),Qy=he("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a}=e;const s=cs({typed:t,matrix:n,equalScalar:r,zeros:i,not:o,concat:a});function u(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)){if(isNaN(r))return NaN;if(0===r||!1===r)return 0}const i=e[1].compile().evaluate(n);return s(r,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Ky=he("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o}=e;const a=ms({typed:t,matrix:n,equalScalar:r,DenseMatrix:i,concat:o});function s(e,t,n){const r=e[0].compile().evaluate(n);if(!A(r)){if(isNaN(r))return NaN;if(-1===r)return-1;if(!0===r)return 1}const i=e[1].compile().evaluate(n);return a(r,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0});var ex=n(1504);const tx={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null},nx=["Matrix","Array"],rx=["number","BigNumber","Fraction"];function ix(e,t){function n(r){if(r){if(void 0!==r.epsilon){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');const e=ae(r);return e.relTol=r.epsilon,e.absTol=.001*r.epsilon,delete e.epsilon,n(e)}const i=ae(e);ox(r,"matrix",nx),ox(r,"number",rx),ue(e,r);const o=ae(e),a=ae(r);return t("config",o,i,a),o}return ae(e)}return n.MATRIX_OPTIONS=nx,n.NUMBER_OPTIONS=rx,Object.keys(tx).forEach((t=>{Object.defineProperty(n,t,{get:()=>e[t],enumerable:!0,configurable:!0})})),n}function ox(e,t,n){void 0===e[t]||n.includes(e[t])||console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+n.map((e=>JSON.stringify(e))).join(", ")+".")}const ax=function e(n,r){const i=sr({},tx,r);if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");const o=function(e){const t=new ex;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}({isNumber:d,isComplex:x,isBigNumber:g,isBigInt:y,isFraction:b,isUnit:v,isString:w,isArray:N,isMatrix:E,isCollection:A,isDenseMatrix:S,isSparseMatrix:M,isRange:C,isIndex:T,isBoolean:B,isResultSet:D,isHelp:F,isFunction:O,isDate:_,isRegExp:I,isObject:z,isMap:k,isPartitionedMap:R,isObjectWrappingMap:q,isNull:P,isUndefined:j,isAccessorNode:U,isArrayNode:L,isAssignmentNode:$,isBlockNode:H,isConditionalNode:G,isConstantNode:V,isFunctionAssignmentNode:W,isFunctionNode:Y,isIndexNode:J,isNode:X,isObjectNode:Q,isOperatorNode:K,isParenthesisNode:ee,isRangeNode:te,isRelationalNode:ne,isSymbolNode:re,isChain:ie});o.config=ix(i,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};const a={};function s(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return o.typed.apply(o.typed,t)}s.isTypedFunction=t.isTypedFunction;const u=function(e,t,n,r){function i(t,i,a){var s,u;if(a.wrap&&"function"==typeof i&&(i=function(e){const t=function(){const t=[];for(let e=0,n=arguments.length;e<n;e++){const n=arguments[e];t[e]=n&&n.valueOf()}return e.apply(n,t)};return e.transform&&(t.transform=e.transform),t}(i)),"function"==typeof(u=i)&&"string"==typeof u.signature&&(i=e(t,{[i.signature]:i})),e.isTypedFunction(n[t])&&e.isTypedFunction(i))return i=a.override?e(t,i.signatures):e(n[t],i),n[t]=i,delete r[t],o(t,i),void n.emit("import",t,(function(){return i}));const c=void 0!==n[t],l=null===(s=n.Unit)||void 0===s?void 0:s.isValuelessUnit(t);if(!c&&!l||a.override)return n[t]=i,delete r[t],o(t,i),void n.emit("import",t,(function(){return i}));if(!a.silent)throw new Error('Cannot import "'+t+'": already exists')}function o(e,t){t&&"function"==typeof t.transform?(n.expression.transform[e]=t.transform,u(e)&&(n.expression.mathWithTransform[e]=t.transform)):(delete n.expression.transform[e],u(e)&&(n.expression.mathWithTransform[e]=t))}function a(e){delete n.expression.transform[e],u(e)?n.expression.mathWithTransform[e]=n[e]:delete n.expression.mathWithTransform[e]}function s(t,i){var o,s;let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(u.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(u));const f=c(t)?n.expression.transform:n,p=u in n.expression.transform,m=me(f,u)?f[u]:void 0,h=function(){const r={};t.dependencies.map(ge).forEach((e=>{if(e.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?r.math=n:"mathWithTransform"===e?r.mathWithTransform=n.expression.mathWithTransform:"classes"===e?r.classes=n:r[e]=n[e]}));const o=t(r);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"');if(void 0===m||i.override)return o;if(e.isTypedFunction(m)&&e.isTypedFunction(o))return e(m,o);if(i.silent)return m;throw new Error('Cannot import "'+u+'": already exists')},d=null!==(o=null===(s=t.meta)||void 0===s?void 0:s.formerly)&&void 0!==o?o:"",g=c(t)||function(e){return!(e.fn.includes(".")||me(l,e.fn)||e.meta&&e.meta.isClass)}(t),y=n.expression.mathWithTransform;t.meta&&!1===t.meta.lazy?(f[u]=h(),d&&(f[d]=f[u]),m&&p?(a(u),d&&a(d)):g&&(pe(y,u,(()=>f[u])),d&&pe(y,d,(()=>f[u])))):(pe(f,u,h),d&&pe(f,d,h),m&&p?(a(u),d&&a(d)):g&&(pe(y,u,(()=>f[u])),d&&pe(y,d,(()=>f[u])))),r[u]=t,n.emit("import",u,h)}function u(e){return!me(l,e)}function c(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}const l={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){const n=arguments.length;if(1!==n&&2!==n)throw new ma("import",n,1,2);t||(t={});const r={};!function e(n,r,i){if(Array.isArray(r))r.forEach((t=>e(n,t)));else if("object"==typeof r)for(const t in r)me(r,t)&&e(n,r[t],t);else if(de(r)||void 0!==i){const e=de(r)?c(r)?r.fn+".transform":r.fn:i;if(me(n,e)&&n[e]!==r&&!t.silent)throw new Error('Cannot import "'+e+'" twice');n[e]=r}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}(r,e);for(const e in r)if(me(r,e)){const n=r[e];if(de(n))s(n,t);else if("function"==typeof(o=n)||"number"==typeof o||"string"==typeof o||"boolean"==typeof o||null===o||v(o)||x(o)||g(o)||b(o)||E(o)||Array.isArray(o))i(e,n,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}var o}}(s,0,o,a);return o.import=u,o.on("config",(()=>{Object.values(a).forEach((e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&u(e,{override:!0})}))})),o.create=e.bind(null,n),o.factory=he,o.import(Object.values(le(n))),o.ArgumentsError=ma,o.DimensionError=xr,o.IndexError=br,o}(e)})(),r.default})()));
|
3
3
|
//# sourceMappingURL=math.js.map
|