/*! For license information please see math.js.LICENSE.txt */ !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={1977:function(e,t){var r;!function(n){"use strict";var i=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},a=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},o=function(){throw SyntaxError("Invalid Param")};function u(e,t){var r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):(e/=2,t/=2,.5*Math.log(e*e+t*t)+Math.LN2)}function s(e,t){if(!(this instanceof s))return new s(e,t);var r=function(e,t){var r={re:0,im:0};if(null==e)r.re=r.im=0;else if(void 0!==t)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!Number.isFinite(e.abs)&&Number.isFinite(e.arg))return s.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!Number.isFinite(e.r)&&Number.isFinite(e.phi))return s.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else 2===e.length?(r.re=e[0],r.im=e[1]):o();break;case"string":r.im=r.re=0;var n=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===n&&o();for(var u=0;u0&&o();break;case"number":r.im=0,r.re=e;break;default:o()}return isNaN(r.re)||isNaN(r.im),r}(e,t);this.re=r.re,this.im=r.im}s.prototype={re:0,im:0,sign:function(){var e=this.abs();return new s(this.re/e,this.im/e)},add:function(e,t){var r=new s(e,t);return this.isInfinite()&&r.isInfinite()?s.NAN:this.isInfinite()||r.isInfinite()?s.INFINITY:new s(this.re+r.re,this.im+r.im)},sub:function(e,t){var r=new s(e,t);return this.isInfinite()&&r.isInfinite()?s.NAN:this.isInfinite()||r.isInfinite()?s.INFINITY:new s(this.re-r.re,this.im-r.im)},mul:function(e,t){var r=new s(e,t);return this.isInfinite()&&r.isZero()||this.isZero()&&r.isInfinite()?s.NAN:this.isInfinite()||r.isInfinite()?s.INFINITY:0===r.im&&0===this.im?new s(this.re*r.re,0):new s(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){var r=new s(e,t);if(this.isZero()&&r.isZero()||this.isInfinite()&&r.isInfinite())return s.NAN;if(this.isInfinite()||r.isZero())return s.INFINITY;if(this.isZero()||r.isInfinite())return s.ZERO;e=this.re,t=this.im;var n,i,a=r.re,o=r.im;return 0===o?new s(e/a,t/a):Math.abs(a)0)return new s(Math.pow(e,r.re),0);if(0===e)switch((r.re%4+4)%4){case 0:return new s(Math.pow(t,r.re),0);case 1:return new s(0,Math.pow(t,r.re));case 2:return new s(-Math.pow(t,r.re),0);case 3:return new s(0,-Math.pow(t,r.re))}}if(0===e&&0===t&&r.re>0&&r.im>=0)return s.ZERO;var n=Math.atan2(t,e),i=u(e,t);return e=Math.exp(r.re*i-r.im*n),t=r.im*i+r.re*n,new s(e*Math.cos(t),e*Math.sin(t))},sqrt:function(){var e,t,r=this.re,n=this.im,i=this.abs();if(r>=0){if(0===n)return new s(Math.sqrt(r),0);e=.5*Math.sqrt(2*(i+r))}else e=Math.abs(n)/Math.sqrt(2*(i-r));return t=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new s(e,n<0?-t:t)},exp:function(){var e=Math.exp(this.re);return this.im,new s(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){var e=this.re,t=this.im;return new s(Math.expm1(e)*Math.cos(t)+function(e){var t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;var r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){var e=this.re,t=this.im;return new s(u(e,t),Math.atan2(t,e))},abs:function(){return e=this.re,t=this.im,r=Math.abs(e),n=Math.abs(t),r<3e3&&n<3e3?Math.sqrt(r*r+n*n):(r1&&0===t,n=1-e,i=1+e,a=n*n+t*t,o=0!==a?new s((i*n-t*t)/a,(t*n+i*t)/a):new s(-1!==e?e/0:0,0!==t?t/0:0),c=o.re;return o.re=u(o.re,o.im)/2,o.im=Math.atan2(o.im,c)/2,r&&(o.im=-o.im),o},acoth:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new s(0,Math.PI/2);var r=e*e+t*t;return 0!==r?new s(e/r,-t/r).atanh():new s(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){var e=this.re,t=this.im;if(0===t)return new s(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var r=e*e+t*t;return 0!==r?new s(e/r,-t/r).asinh():new s(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){var e=this.re,t=this.im;if(this.isZero())return s.INFINITY;var r=e*e+t*t;return 0!==r?new s(e/r,-t/r).acosh():new s(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return s.INFINITY;if(this.isInfinite())return s.ZERO;var e=this.re,t=this.im,r=e*e+t*t;return new s(e/r,-t/r)},conjugate:function(){return new s(this.re,-this.im)},neg:function(){return new s(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new s(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new s(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new s(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){var r=new s(e,t);return Math.abs(r.re-this.re)<=s.EPSILON&&Math.abs(r.im-this.im)<=s.EPSILON},clone:function(){return new s(this.re,this.im)},toString:function(){var e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e){var n=r(614),i=r(6330),a=TypeError;e.exports=function(e){if(n(e))return e;throw a(i(e)+" is not a function")}},9483:(e,t,r)=>{var n=r(4411),i=r(6330),a=TypeError;e.exports=function(e){if(n(e))return e;throw a(i(e)+" is not a constructor")}},6077:(e,t,r)=>{var n=r(614),i=String,a=TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw a("Can't set "+i(e)+" as a prototype")}},1223:(e,t,r)=>{var n=r(5112),i=r(30),a=r(3070).f,o=n("unscopables"),u=Array.prototype;null==u[o]&&a(u,o,{configurable:!0,value:i(null)}),e.exports=function(e){u[o][e]=!0}},1530:(e,t,r)=>{"use strict";var n=r(8710).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},5787:(e,t,r)=>{var n=r(7976),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw i("Incorrect invocation")}},9670:(e,t,r)=>{var n=r(111),i=String,a=TypeError;e.exports=function(e){if(n(e))return e;throw a(i(e)+" is not an object")}},7556:(e,t,r)=>{var n=r(7293);e.exports=n((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},1285:(e,t,r)=>{"use strict";var n=r(7908),i=r(1400),a=r(6244);e.exports=function(e){for(var t=n(this),r=a(t),o=arguments.length,u=i(o>1?arguments[1]:void 0,r),s=o>2?arguments[2]:void 0,c=void 0===s?r:i(s,r);c>u;)t[u++]=e;return t}},8533:(e,t,r)=>{"use strict";var n=r(2092).forEach,i=r(9341)("forEach");e.exports=i?[].forEach:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}},8457:(e,t,r)=>{"use strict";var n=r(9974),i=r(6916),a=r(7908),o=r(3411),u=r(7659),s=r(4411),c=r(6244),f=r(6135),l=r(4121),p=r(1246),m=Array;e.exports=function(e){var t=a(e),r=s(this),h=arguments.length,d=h>1?arguments[1]:void 0,v=void 0!==d;v&&(d=n(d,h>2?arguments[2]:void 0));var y,g,x,b,w,N,D=p(t),E=0;if(!D||this===m&&u(D))for(y=c(t),g=r?new this(y):m(y);y>E;E++)N=v?d(t[E],E):t[E],f(g,E,N);else for(w=(b=l(t,D)).next,g=r?new this:[];!(x=i(w,b)).done;E++)N=v?o(b,d,[x.value,E],!0):x.value,f(g,E,N);return g.length=E,g}},1318:(e,t,r)=>{var n=r(5656),i=r(1400),a=r(6244),o=function(e){return function(t,r,o){var u,s=n(t),c=a(s),f=i(o,c);if(e&&r!=r){for(;c>f;)if((u=s[f++])!=u)return!0}else for(;c>f;f++)if((e||f in s)&&s[f]===r)return e||f||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},2092:(e,t,r)=>{var n=r(9974),i=r(1702),a=r(8361),o=r(7908),u=r(6244),s=r(5417),c=i([].push),f=function(e){var t=1==e,r=2==e,i=3==e,f=4==e,l=6==e,p=7==e,m=5==e||l;return function(h,d,v,y){for(var g,x,b=o(h),w=a(b),N=n(d,v),D=u(w),E=0,A=y||s,S=t?A(h,D):r||p?A(h,0):void 0;D>E;E++)if((m||E in w)&&(x=N(g=w[E],E,b),e))if(t)S[E]=x;else if(x)switch(e){case 3:return!0;case 5:return g;case 6:return E;case 2:c(S,g)}else switch(e){case 4:return!1;case 7:c(S,g)}return l?-1:i||f?f:S}};e.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterReject:f(7)}},1194:(e,t,r)=>{var n=r(7293),i=r(5112),a=r(7392),o=i("species");e.exports=function(e){return a>=51||!n((function(){var t=[];return(t.constructor={})[o]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},9341:(e,t,r)=>{"use strict";var n=r(7293);e.exports=function(e,t){var r=[][e];return!!r&&n((function(){r.call(null,t||function(){return 1},1)}))}},3671:(e,t,r)=>{var n=r(9662),i=r(7908),a=r(8361),o=r(6244),u=TypeError,s=function(e){return function(t,r,s,c){n(r);var f=i(t),l=a(f),p=o(f),m=e?p-1:0,h=e?-1:1;if(s<2)for(;;){if(m in l){c=l[m],m+=h;break}if(m+=h,e?m<0:p<=m)throw u("Reduce of empty array with no initial value")}for(;e?m>=0:p>m;m+=h)m in l&&(c=r(c,l[m],m,f));return c}};e.exports={left:s(!1),right:s(!0)}},3658:(e,t,r)=>{"use strict";var n=r(9781),i=r(3157),a=TypeError,o=Object.getOwnPropertyDescriptor,u=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=u?function(e,t){if(i(e)&&!o(e,"length").writable)throw a("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},1589:(e,t,r)=>{var n=r(1400),i=r(6244),a=r(6135),o=Array,u=Math.max;e.exports=function(e,t,r){for(var s=i(e),c=n(t,s),f=n(void 0===r?s:r,s),l=o(u(f-c,0)),p=0;c{var n=r(1702);e.exports=n([].slice)},4362:(e,t,r)=>{var n=r(1589),i=Math.floor,a=function(e,t){var r=e.length,s=i(r/2);return r<8?o(e,t):u(e,a(n(e,0,s),t),a(n(e,s),t),t)},o=function(e,t){for(var r,n,i=e.length,a=1;a0;)e[n]=e[--n];n!==a++&&(e[n]=r)}return e},u=function(e,t,r,n){for(var i=t.length,a=r.length,o=0,u=0;o{var n=r(3157),i=r(4411),a=r(111),o=r(5112)("species"),u=Array;e.exports=function(e){var t;return n(e)&&(t=e.constructor,(i(t)&&(t===u||n(t.prototype))||a(t)&&null===(t=t[o]))&&(t=void 0)),void 0===t?u:t}},5417:(e,t,r)=>{var n=r(7475);e.exports=function(e,t){return new(n(e))(0===t?0:t)}},3411:(e,t,r)=>{var n=r(9670),i=r(9212);e.exports=function(e,t,r,a){try{return a?t(n(r)[0],r[1]):t(r)}catch(t){i(e,"throw",t)}}},7072:(e,t,r)=>{var n=r(5112)("iterator"),i=!1;try{var a=0,o={next:function(){return{done:!!a++}},return:function(){i=!0}};o[n]=function(){return this},Array.from(o,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var a={};a[n]=function(){return{next:function(){return{done:r=!0}}}},e(a)}catch(e){}return r}},4326:(e,t,r)=>{var n=r(1702),i=n({}.toString),a=n("".slice);e.exports=function(e){return a(i(e),8,-1)}},648:(e,t,r)=>{var n=r(1694),i=r(614),a=r(4326),o=r(5112)("toStringTag"),u=Object,s="Arguments"==a(function(){return arguments}());e.exports=n?a:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=u(e),o))?r:s?a(t):"Object"==(n=a(t))&&i(t.callee)?"Arguments":n}},5631:(e,t,r)=>{"use strict";var n=r(30),i=r(7045),a=r(9190),o=r(9974),u=r(5787),s=r(8554),c=r(408),f=r(1656),l=r(6178),p=r(6340),m=r(9781),h=r(2423).fastKey,d=r(9909),v=d.set,y=d.getterFor;e.exports={getConstructor:function(e,t,r,f){var l=e((function(e,i){u(e,p),v(e,{type:t,index:n(null),first:void 0,last:void 0,size:0}),m||(e.size=0),s(i)||c(i,e[f],{that:e,AS_ENTRIES:r})})),p=l.prototype,d=y(t),g=function(e,t,r){var n,i,a=d(e),o=x(e,t);return o?o.value=r:(a.last=o={index:i=h(t,!0),key:t,value:r,previous:n=a.last,next:void 0,removed:!1},a.first||(a.first=o),n&&(n.next=o),m?a.size++:e.size++,"F"!==i&&(a.index[i]=o)),e},x=function(e,t){var r,n=d(e),i=h(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return a(p,{clear:function(){for(var e=d(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,m?e.size=0:this.size=0},delete:function(e){var t=this,r=d(t),n=x(t,e);if(n){var i=n.next,a=n.previous;delete r.index[n.index],n.removed=!0,a&&(a.next=i),i&&(i.previous=a),r.first==n&&(r.first=i),r.last==n&&(r.last=a),m?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=d(this),n=o(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!x(this,e)}}),a(p,r?{get:function(e){var t=x(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),m&&i(p,"size",{configurable:!0,get:function(){return d(this).size}}),l},setStrong:function(e,t,r){var n=t+" Iterator",i=y(t),a=y(n);f(e,t,(function(e,t){v(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?l("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,l(void 0,!0))}),r?"entries":"values",!r,!0),p(t)}}},7710:(e,t,r)=>{"use strict";var n=r(2109),i=r(7854),a=r(1702),o=r(4705),u=r(8052),s=r(2423),c=r(408),f=r(5787),l=r(614),p=r(8554),m=r(111),h=r(7293),d=r(7072),v=r(8003),y=r(9587);e.exports=function(e,t,r){var g=-1!==e.indexOf("Map"),x=-1!==e.indexOf("Weak"),b=g?"set":"add",w=i[e],N=w&&w.prototype,D=w,E={},A=function(e){var t=a(N[e]);u(N,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(x&&!m(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return x&&!m(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(x&&!m(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(o(e,!l(w)||!(x||N.forEach&&!h((function(){(new w).entries().next()})))))D=r.getConstructor(t,e,g,b),s.enable();else if(o(e,!0)){var S=new D,C=S[b](x?{}:-0,1)!=S,M=h((function(){S.has(1)})),F=d((function(e){new w(e)})),O=!x&&h((function(){for(var e=new w,t=5;t--;)e[b](t,t);return!e.has(-0)}));F||((D=t((function(e,t){f(e,N);var r=y(new w,e,D);return p(t)||c(t,r[b],{that:r,AS_ENTRIES:g}),r}))).prototype=N,N.constructor=D),(M||O)&&(A("delete"),A("has"),g&&A("get")),(O||C)&&A(b),x&&N.clear&&delete N.clear}return E[e]=D,n({global:!0,constructor:!0,forced:D!=w},E),v(D,e),x||r.setStrong(D,e,g),D}},9920:(e,t,r)=>{var n=r(2597),i=r(3887),a=r(1236),o=r(3070);e.exports=function(e,t,r){for(var u=i(t),s=o.f,c=a.f,f=0;f{var n=r(5112)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,"/./"[e](t)}catch(e){}}return!1}},8544:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},4230:(e,t,r)=>{var n=r(1702),i=r(4488),a=r(1340),o=/"/g,u=n("".replace);e.exports=function(e,t,r,n){var s=a(i(e)),c="<"+t;return""!==r&&(c+=" "+r+'="'+u(a(n),o,""")+'"'),c+">"+s+""}},6178:e=>{e.exports=function(e,t){return{value:e,done:t}}},8880:(e,t,r)=>{var n=r(9781),i=r(3070),a=r(9114);e.exports=n?function(e,t,r){return i.f(e,t,a(1,r))}:function(e,t,r){return e[t]=r,e}},9114:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6135:(e,t,r)=>{"use strict";var n=r(4948),i=r(3070),a=r(9114);e.exports=function(e,t,r){var o=n(t);o in e?i.f(e,o,a(0,r)):e[o]=r}},7045:(e,t,r)=>{var n=r(6339),i=r(3070);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),i.f(e,t,r)}},8052:(e,t,r)=>{var n=r(614),i=r(3070),a=r(6339),o=r(3072);e.exports=function(e,t,r,u){u||(u={});var s=u.enumerable,c=void 0!==u.name?u.name:t;if(n(r)&&a(r,c,u),u.global)s?e[t]=r:o(t,r);else{try{u.unsafe?e[t]&&(s=!0):delete e[t]}catch(e){}s?e[t]=r:i.f(e,t,{value:r,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return e}},9190:(e,t,r)=>{var n=r(8052);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},3072:(e,t,r)=>{var n=r(7854),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},5117:(e,t,r)=>{"use strict";var n=r(6330),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw i("Cannot delete property "+n(t)+" of "+n(e))}},9781:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:e=>{var t="object"==typeof document&&document.all,r=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:r}},317:(e,t,r)=>{var n=r(7854),i=r(111),a=n.document,o=i(a)&&i(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},7207:e=>{var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},8324:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8509:(e,t,r)=>{var n=r(317)("span").classList,i=n&&n.constructor&&n.constructor.prototype;e.exports=i===Object.prototype?void 0:i},8886:(e,t,r)=>{var n=r(8113).match(/firefox\/(\d+)/i);e.exports=!!n&&+n[1]},7871:(e,t,r)=>{var n=r(3823),i=r(5268);e.exports=!n&&!i&&"object"==typeof window&&"object"==typeof document},3823:e=>{e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},256:(e,t,r)=>{var n=r(8113);e.exports=/MSIE|Trident/.test(n)},1528:(e,t,r)=>{var n=r(8113);e.exports=/ipad|iphone|ipod/i.test(n)&&"undefined"!=typeof Pebble},6833:(e,t,r)=>{var n=r(8113);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)},5268:(e,t,r)=>{var n=r(4326);e.exports="undefined"!=typeof process&&"process"==n(process)},1036:(e,t,r)=>{var n=r(8113);e.exports=/web0s(?!.*chrome)/i.test(n)},8113:e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:(e,t,r)=>{var n,i,a=r(7854),o=r(8113),u=a.process,s=a.Deno,c=u&&u.versions||s&&s.version,f=c&&c.v8;f&&(i=(n=f.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&o&&(!(n=o.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=o.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},8008:(e,t,r)=>{var n=r(8113).match(/AppleWebKit\/(\d+)\./);e.exports=!!n&&+n[1]},748:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:(e,t,r)=>{var n=r(7854),i=r(1236).f,a=r(8880),o=r(8052),u=r(3072),s=r(9920),c=r(4705);e.exports=function(e,t){var r,f,l,p,m,h=e.target,d=e.global,v=e.stat;if(r=d?n:v?n[h]||u(h,{}):(n[h]||{}).prototype)for(f in t){if(p=t[f],l=e.dontCallGetSet?(m=i(r,f))&&m.value:r[f],!c(d?f:h+(v?".":"#")+f,e.forced)&&void 0!==l){if(typeof p==typeof l)continue;s(p,l)}(e.sham||l&&l.sham)&&a(p,"sham",!0),o(r,f,p,e)}}},7293:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},7007:(e,t,r)=>{"use strict";r(4916);var n=r(1470),i=r(8052),a=r(2261),o=r(7293),u=r(5112),s=r(8880),c=u("species"),f=RegExp.prototype;e.exports=function(e,t,r,l){var p=u(e),m=!o((function(){var t={};return t[p]=function(){return 7},7!=""[e](t)})),h=m&&!o((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[c]=function(){return r},r.flags="",r[p]=/./[p]),r.exec=function(){return t=!0,null},r[p](""),!t}));if(!m||!h||r){var d=n(/./[p]),v=t(p,""[e],(function(e,t,r,i,o){var u=n(e),s=t.exec;return s===a||s===f.exec?m&&!o?{done:!0,value:d(t,r,i)}:{done:!0,value:u(r,t,i)}:{done:!1}}));i(String.prototype,e,v[0]),i(f,p,v[1])}l&&s(f[p],"sham",!0)}},6677:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},2104:(e,t,r)=>{var n=r(4374),i=Function.prototype,a=i.apply,o=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?o.bind(a):function(){return o.apply(a,arguments)})},9974:(e,t,r)=>{var n=r(1470),i=r(9662),a=r(4374),o=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:a?o(e,t):function(){return e.apply(t,arguments)}}},4374:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},7065:(e,t,r)=>{"use strict";var n=r(1702),i=r(9662),a=r(111),o=r(2597),u=r(206),s=r(4374),c=Function,f=n([].concat),l=n([].join),p={};e.exports=s?c.bind:function(e){var t=i(this),r=t.prototype,n=u(arguments,1),s=function(){var r=f(n,u(arguments));return this instanceof s?function(e,t,r){if(!o(p,t)){for(var n=[],i=0;i{var n=r(4374),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},6530:(e,t,r)=>{var n=r(9781),i=r(2597),a=Function.prototype,o=n&&Object.getOwnPropertyDescriptor,u=i(a,"name"),s=u&&"something"===function(){}.name,c=u&&(!n||n&&o(a,"name").configurable);e.exports={EXISTS:u,PROPER:s,CONFIGURABLE:c}},5668:(e,t,r)=>{var n=r(1702),i=r(9662);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},1470:(e,t,r)=>{var n=r(4326),i=r(1702);e.exports=function(e){if("Function"===n(e))return i(e)}},1702:(e,t,r)=>{var n=r(4374),i=Function.prototype,a=i.call,o=n&&i.bind.bind(a,a);e.exports=n?o:function(e){return function(){return a.apply(e,arguments)}}},5005:(e,t,r)=>{var n=r(7854),i=r(614);e.exports=function(e,t){return arguments.length<2?(r=n[e],i(r)?r:void 0):n[e]&&n[e][t];var r}},1246:(e,t,r)=>{var n=r(648),i=r(8173),a=r(8554),o=r(7497),u=r(5112)("iterator");e.exports=function(e){if(!a(e))return i(e,u)||i(e,"@@iterator")||o[n(e)]}},4121:(e,t,r)=>{var n=r(6916),i=r(9662),a=r(9670),o=r(6330),u=r(1246),s=TypeError;e.exports=function(e,t){var r=arguments.length<2?u(e):t;if(i(r))return a(n(r,e));throw s(o(e)+" is not iterable")}},8044:(e,t,r)=>{var n=r(1702),i=r(3157),a=r(614),o=r(4326),u=r(1340),s=n([].push);e.exports=function(e){if(a(e))return e;if(i(e)){for(var t=e.length,r=[],n=0;n{var n=r(9662),i=r(8554);e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}},647:(e,t,r)=>{var n=r(1702),i=r(7908),a=Math.floor,o=n("".charAt),u=n("".replace),s=n("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,f=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,r,n,l,p){var m=r+e.length,h=n.length,d=f;return void 0!==l&&(l=i(l),d=c),u(p,d,(function(i,u){var c;switch(o(u,0)){case"$":return"$";case"&":return e;case"`":return s(t,0,r);case"'":return s(t,m);case"<":c=l[s(u,1,-1)];break;default:var f=+u;if(0===f)return i;if(f>h){var p=a(f/10);return 0===p?i:p<=h?void 0===n[p-1]?o(u,1):n[p-1]+o(u,1):i}c=n[f-1]}return void 0===c?"":c}))}},7854:function(e){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)||function(){return this}()||this||Function("return this")()},2597:(e,t,r)=>{var n=r(1702),i=r(7908),a=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},3501:e=>{e.exports={}},842:e=>{e.exports=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}}},490:(e,t,r)=>{var n=r(5005);e.exports=n("document","documentElement")},4664:(e,t,r)=>{var n=r(9781),i=r(7293),a=r(317);e.exports=!n&&!i((function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},8361:(e,t,r)=>{var n=r(1702),i=r(7293),a=r(4326),o=Object,u=n("".split);e.exports=i((function(){return!o("z").propertyIsEnumerable(0)}))?function(e){return"String"==a(e)?u(e,""):o(e)}:o},9587:(e,t,r)=>{var n=r(614),i=r(111),a=r(7674);e.exports=function(e,t,r){var o,u;return a&&n(o=t.constructor)&&o!==r&&i(u=o.prototype)&&u!==r.prototype&&a(e,u),e}},2788:(e,t,r)=>{var n=r(1702),i=r(614),a=r(5465),o=n(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return o(e)}),e.exports=a.inspectSource},2423:(e,t,r)=>{var n=r(2109),i=r(1702),a=r(3501),o=r(111),u=r(2597),s=r(3070).f,c=r(8006),f=r(1156),l=r(2050),p=r(9711),m=r(6677),h=!1,d=p("meta"),v=0,y=function(e){s(e,d,{value:{objectID:"O"+v++,weakData:{}}})},g=e.exports={enable:function(){g.enable=function(){},h=!0;var e=c.f,t=i([].splice),r={};r[d]=1,e(r).length&&(c.f=function(r){for(var n=e(r),i=0,a=n.length;i{var n,i,a,o=r(4811),u=r(7854),s=r(111),c=r(8880),f=r(2597),l=r(5465),p=r(6200),m=r(3501),h="Object already initialized",d=u.TypeError,v=u.WeakMap;if(o||l.state){var y=l.state||(l.state=new v);y.get=y.get,y.has=y.has,y.set=y.set,n=function(e,t){if(y.has(e))throw d(h);return t.facade=e,y.set(e,t),t},i=function(e){return y.get(e)||{}},a=function(e){return y.has(e)}}else{var g=p("state");m[g]=!0,n=function(e,t){if(f(e,g))throw d(h);return t.facade=e,c(e,g,t),t},i=function(e){return f(e,g)?e[g]:{}},a=function(e){return f(e,g)}}e.exports={set:n,get:i,has:a,enforce:function(e){return a(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!s(t)||(r=i(t)).type!==e)throw d("Incompatible receiver, "+e+" required");return r}}}},7659:(e,t,r)=>{var n=r(5112),i=r(7497),a=n("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||o[a]===e)}},3157:(e,t,r)=>{var n=r(4326);e.exports=Array.isArray||function(e){return"Array"==n(e)}},614:(e,t,r)=>{var n=r(4154),i=n.all;e.exports=n.IS_HTMLDDA?function(e){return"function"==typeof e||e===i}:function(e){return"function"==typeof e}},4411:(e,t,r)=>{var n=r(1702),i=r(7293),a=r(614),o=r(648),u=r(5005),s=r(2788),c=function(){},f=[],l=u("Reflect","construct"),p=/^\s*(?:class|function)\b/,m=n(p.exec),h=!p.exec(c),d=function(e){if(!a(e))return!1;try{return l(c,f,e),!0}catch(e){return!1}},v=function(e){if(!a(e))return!1;switch(o(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!m(p,s(e))}catch(e){return!0}};v.sham=!0,e.exports=!l||i((function(){var e;return d(d.call)||!d(Object)||!d((function(){e=!0}))||e}))?v:d},4705:(e,t,r)=>{var n=r(7293),i=r(614),a=/#|\.prototype\./,o=function(e,t){var r=s[u(e)];return r==f||r!=c&&(i(t)?n(t):!!t)},u=o.normalize=function(e){return String(e).replace(a,".").toLowerCase()},s=o.data={},c=o.NATIVE="N",f=o.POLYFILL="P";e.exports=o},8554:e=>{e.exports=function(e){return null==e}},111:(e,t,r)=>{var n=r(614),i=r(4154),a=i.all;e.exports=i.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:n(e)||e===a}:function(e){return"object"==typeof e?null!==e:n(e)}},1913:e=>{e.exports=!1},7850:(e,t,r)=>{var n=r(111),i=r(4326),a=r(5112)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[a])?!!t:"RegExp"==i(e))}},2190:(e,t,r)=>{var n=r(5005),i=r(614),a=r(7976),o=r(3307),u=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&a(t.prototype,u(e))}},408:(e,t,r)=>{var n=r(9974),i=r(6916),a=r(9670),o=r(6330),u=r(7659),s=r(6244),c=r(7976),f=r(4121),l=r(1246),p=r(9212),m=TypeError,h=function(e,t){this.stopped=e,this.result=t},d=h.prototype;e.exports=function(e,t,r){var v,y,g,x,b,w,N,D=r&&r.that,E=!(!r||!r.AS_ENTRIES),A=!(!r||!r.IS_RECORD),S=!(!r||!r.IS_ITERATOR),C=!(!r||!r.INTERRUPTED),M=n(t,D),F=function(e){return v&&p(v,"normal",e),new h(!0,e)},O=function(e){return E?(a(e),C?M(e[0],e[1],F):M(e[0],e[1])):C?M(e,F):M(e)};if(A)v=e.iterator;else if(S)v=e;else{if(!(y=l(e)))throw m(o(e)+" is not iterable");if(u(y)){for(g=0,x=s(e);x>g;g++)if((b=O(e[g]))&&c(d,b))return b;return new h(!1)}v=f(e,y)}for(w=A?e.next:v.next;!(N=i(w,v)).done;){try{b=O(N.value)}catch(e){p(v,"throw",e)}if("object"==typeof b&&b&&c(d,b))return b}return new h(!1)}},9212:(e,t,r)=>{var n=r(6916),i=r(9670),a=r(8173);e.exports=function(e,t,r){var o,u;i(e);try{if(!(o=a(e,"return"))){if("throw"===t)throw r;return r}o=n(o,e)}catch(e){u=!0,o=e}if("throw"===t)throw r;if(u)throw o;return i(o),r}},3061:(e,t,r)=>{"use strict";var n=r(3383).IteratorPrototype,i=r(30),a=r(9114),o=r(8003),u=r(7497),s=function(){return this};e.exports=function(e,t,r,c){var f=t+" Iterator";return e.prototype=i(n,{next:a(+!c,r)}),o(e,f,!1,!0),u[f]=s,e}},1656:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(1913),o=r(6530),u=r(614),s=r(3061),c=r(9518),f=r(7674),l=r(8003),p=r(8880),m=r(8052),h=r(5112),d=r(7497),v=r(3383),y=o.PROPER,g=o.CONFIGURABLE,x=v.IteratorPrototype,b=v.BUGGY_SAFARI_ITERATORS,w=h("iterator"),N="keys",D="values",E="entries",A=function(){return this};e.exports=function(e,t,r,o,h,v,S){s(r,t,o);var C,M,F,O=function(e){if(e===h&&I)return I;if(!b&&e in _)return _[e];switch(e){case N:case D:case E:return function(){return new r(this,e)}}return function(){return new r(this)}},T=t+" Iterator",B=!1,_=e.prototype,k=_[w]||_["@@iterator"]||h&&_[h],I=!b&&k||O(h),R="Array"==t&&_.entries||k;if(R&&(C=c(R.call(new e)))!==Object.prototype&&C.next&&(a||c(C)===x||(f?f(C,x):u(C[w])||m(C,w,A)),l(C,T,!0,!0),a&&(d[T]=A)),y&&h==D&&k&&k.name!==D&&(!a&&g?p(_,"name",D):(B=!0,I=function(){return i(k,this)})),h)if(M={values:O(D),keys:v?I:O(N),entries:O(E)},S)for(F in M)(b||B||!(F in _))&&m(_,F,M[F]);else n({target:t,proto:!0,forced:b||B},M);return a&&!S||_[w]===I||m(_,w,I,{name:h}),d[t]=I,M}},3383:(e,t,r)=>{"use strict";var n,i,a,o=r(7293),u=r(614),s=r(111),c=r(30),f=r(9518),l=r(8052),p=r(5112),m=r(1913),h=p("iterator"),d=!1;[].keys&&("next"in(a=[].keys())?(i=f(f(a)))!==Object.prototype&&(n=i):d=!0),!s(n)||o((function(){var e={};return n[h].call(e)!==e}))?n={}:m&&(n=c(n)),u(n[h])||l(n,h,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},7497:e=>{e.exports={}},6244:(e,t,r)=>{var n=r(7466);e.exports=function(e){return n(e.length)}},6339:(e,t,r)=>{var n=r(1702),i=r(7293),a=r(614),o=r(2597),u=r(9781),s=r(6530).CONFIGURABLE,c=r(2788),f=r(9909),l=f.enforce,p=f.get,m=String,h=Object.defineProperty,d=n("".slice),v=n("".replace),y=n([].join),g=u&&!i((function(){return 8!==h((function(){}),"length",{value:8}).length})),x=String(String).split("String"),b=e.exports=function(e,t,r){"Symbol("===d(m(t),0,7)&&(t="["+v(m(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!o(e,"name")||s&&e.name!==t)&&(u?h(e,"name",{value:t,configurable:!0}):e.name=t),g&&r&&o(r,"arity")&&e.length!==r.arity&&h(e,"length",{value:r.arity});try{r&&o(r,"constructor")&&r.constructor?u&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=l(e);return o(n,"source")||(n.source=y(x,"string"==typeof t?t:"")),e};Function.prototype.toString=b((function(){return a(this)&&p(this).source||c(this)}),"toString")},6736:e=>{var t=Math.expm1,r=Math.exp;e.exports=!t||t(10)>22025.465794806718||t(10)<22025.465794806718||-2e-17!=t(-2e-17)?function(e){var t=+e;return 0==t?t:t>-1e-6&&t<1e-6?t+t*t/2:r(t)-1}:t},403:e=>{var t=Math.log,r=Math.LOG10E;e.exports=Math.log10||function(e){return t(e)*r}},6513:e=>{var t=Math.log;e.exports=Math.log1p||function(e){var r=+e;return r>-1e-8&&r<1e-8?r-r*r/2:t(1+r)}},4310:e=>{e.exports=Math.sign||function(e){var t=+e;return 0==t||t!=t?t:t<0?-1:1}},4758:e=>{var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},5948:(e,t,r)=>{var n,i,a,o,u,s=r(7854),c=r(9974),f=r(1236).f,l=r(261).set,p=r(8572),m=r(6833),h=r(1528),d=r(1036),v=r(5268),y=s.MutationObserver||s.WebKitMutationObserver,g=s.document,x=s.process,b=s.Promise,w=f(s,"queueMicrotask"),N=w&&w.value;if(!N){var D=new p,E=function(){var e,t;for(v&&(e=x.domain)&&e.exit();t=D.get();)try{t()}catch(e){throw D.head&&n(),e}e&&e.enter()};m||v||d||!y||!g?!h&&b&&b.resolve?((o=b.resolve(void 0)).constructor=b,u=c(o.then,o),n=function(){u(E)}):v?n=function(){x.nextTick(E)}:(l=c(l,s),n=function(){l(E)}):(i=!0,a=g.createTextNode(""),new y(E).observe(a,{characterData:!0}),n=function(){a.data=i=!i}),N=function(e){D.head||n(),D.add(e)}}e.exports=N},8523:(e,t,r)=>{"use strict";var n=r(9662),i=TypeError,a=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw i("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)};e.exports.f=function(e){return new a(e)}},3929:(e,t,r)=>{var n=r(7850),i=TypeError;e.exports=function(e){if(n(e))throw i("The method doesn't accept regular expressions");return e}},2814:(e,t,r)=>{var n=r(7854),i=r(7293),a=r(1702),o=r(1340),u=r(3111).trim,s=r(1361),c=a("".charAt),f=n.parseFloat,l=n.Symbol,p=l&&l.iterator,m=1/f(s+"-0")!=-1/0||p&&!i((function(){f(Object(p))}));e.exports=m?function(e){var t=u(o(e)),r=f(t);return 0===r&&"-"==c(t,0)?-0:r}:f},3009:(e,t,r)=>{var n=r(7854),i=r(7293),a=r(1702),o=r(1340),u=r(3111).trim,s=r(1361),c=n.parseInt,f=n.Symbol,l=f&&f.iterator,p=/^[+-]?0x/i,m=a(p.exec),h=8!==c(s+"08")||22!==c(s+"0x16")||l&&!i((function(){c(Object(l))}));e.exports=h?function(e,t){var r=u(o(e));return c(r,t>>>0||(m(p,r)?16:10))}:c},30:(e,t,r)=>{var n,i=r(9670),a=r(6048),o=r(748),u=r(3501),s=r(490),c=r(317),f=r(6200),l="prototype",p="script",m=f("IE_PROTO"),h=function(){},d=function(e){return"<"+p+">"+e+""},v=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;y="undefined"!=typeof document?document.domain&&n?v(n):(t=c("iframe"),r="java"+p+":",t.style.display="none",s.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):v(n);for(var i=o.length;i--;)delete y[l][o[i]];return y()};u[m]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(h[l]=i(e),r=new h,h[l]=null,r[m]=e):r=y(),void 0===t?r:a.f(r,t)}},6048:(e,t,r)=>{var n=r(9781),i=r(3353),a=r(3070),o=r(9670),u=r(5656),s=r(1956);t.f=n&&!i?Object.defineProperties:function(e,t){o(e);for(var r,n=u(t),i=s(t),c=i.length,f=0;c>f;)a.f(e,r=i[f++],n[r]);return e}},3070:(e,t,r)=>{var n=r(9781),i=r(4664),a=r(3353),o=r(9670),u=r(4948),s=TypeError,c=Object.defineProperty,f=Object.getOwnPropertyDescriptor,l="enumerable",p="configurable",m="writable";t.f=n?a?function(e,t,r){if(o(e),t=u(t),o(r),"function"==typeof e&&"prototype"===t&&"value"in r&&m in r&&!r[m]){var n=f(e,t);n&&n[m]&&(e[t]=r.value,r={configurable:p in r?r[p]:n[p],enumerable:l in r?r[l]:n[l],writable:!1})}return c(e,t,r)}:c:function(e,t,r){if(o(e),t=u(t),o(r),i)try{return c(e,t,r)}catch(e){}if("get"in r||"set"in r)throw s("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},1236:(e,t,r)=>{var n=r(9781),i=r(6916),a=r(5296),o=r(9114),u=r(5656),s=r(4948),c=r(2597),f=r(4664),l=Object.getOwnPropertyDescriptor;t.f=n?l:function(e,t){if(e=u(e),t=s(t),f)try{return l(e,t)}catch(e){}if(c(e,t))return o(!i(a.f,e,t),e[t])}},1156:(e,t,r)=>{var n=r(4326),i=r(5656),a=r(8006).f,o=r(1589),u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return u&&"Window"==n(e)?function(e){try{return a(e)}catch(e){return o(u)}}(e):a(i(e))}},8006:(e,t,r)=>{var n=r(6324),i=r(748).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},5181:(e,t)=>{t.f=Object.getOwnPropertySymbols},9518:(e,t,r)=>{var n=r(2597),i=r(614),a=r(7908),o=r(6200),u=r(8544),s=o("IE_PROTO"),c=Object,f=c.prototype;e.exports=u?c.getPrototypeOf:function(e){var t=a(e);if(n(t,s))return t[s];var r=t.constructor;return i(r)&&t instanceof r?r.prototype:t instanceof c?f:null}},2050:(e,t,r)=>{var n=r(7293),i=r(111),a=r(4326),o=r(7556),u=Object.isExtensible,s=n((function(){u(1)}));e.exports=s||o?function(e){return!!i(e)&&(!o||"ArrayBuffer"!=a(e))&&(!u||u(e))}:u},7976:(e,t,r)=>{var n=r(1702);e.exports=n({}.isPrototypeOf)},6324:(e,t,r)=>{var n=r(1702),i=r(2597),a=r(5656),o=r(1318).indexOf,u=r(3501),s=n([].push);e.exports=function(e,t){var r,n=a(e),c=0,f=[];for(r in n)!i(u,r)&&i(n,r)&&s(f,r);for(;t.length>c;)i(n,r=t[c++])&&(~o(f,r)||s(f,r));return f}},1956:(e,t,r)=>{var n=r(6324),i=r(748);e.exports=Object.keys||function(e){return n(e,i)}},5296:(e,t)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},7674:(e,t,r)=>{var n=r(5668),i=r(9670),a=r(6077);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return i(r),a(n),t?e(r,n):r.__proto__=n,r}}():void 0)},288:(e,t,r)=>{"use strict";var n=r(1694),i=r(648);e.exports=n?{}.toString:function(){return"[object "+i(this)+"]"}},2140:(e,t,r)=>{var n=r(6916),i=r(614),a=r(111),o=TypeError;e.exports=function(e,t){var r,u;if("string"===t&&i(r=e.toString)&&!a(u=n(r,e)))return u;if(i(r=e.valueOf)&&!a(u=n(r,e)))return u;if("string"!==t&&i(r=e.toString)&&!a(u=n(r,e)))return u;throw o("Can't convert object to primitive value")}},3887:(e,t,r)=>{var n=r(5005),i=r(1702),a=r(8006),o=r(5181),u=r(9670),s=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=a.f(u(e)),r=o.f;return r?s(t,r(e)):t}},857:(e,t,r)=>{var n=r(7854);e.exports=n},2534:e=>{e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},3702:(e,t,r)=>{var n=r(7854),i=r(2492),a=r(614),o=r(4705),u=r(2788),s=r(5112),c=r(7871),f=r(3823),l=r(1913),p=r(7392),m=i&&i.prototype,h=s("species"),d=!1,v=a(n.PromiseRejectionEvent),y=o("Promise",(function(){var e=u(i),t=e!==String(i);if(!t&&66===p)return!0;if(l&&(!m.catch||!m.finally))return!0;if(!p||p<51||!/native code/.test(e)){var r=new i((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[h]=n,!(d=r.then((function(){}))instanceof n))return!0}return!t&&(c||f)&&!v}));e.exports={CONSTRUCTOR:y,REJECTION_EVENT:v,SUBCLASSING:d}},2492:(e,t,r)=>{var n=r(7854);e.exports=n.Promise},9478:(e,t,r)=>{var n=r(9670),i=r(111),a=r(8523);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=a.f(e);return(0,r.resolve)(t),r.promise}},612:(e,t,r)=>{var n=r(2492),i=r(7072),a=r(3702).CONSTRUCTOR;e.exports=a||!i((function(e){n.all(e).then(void 0,(function(){}))}))},2626:(e,t,r)=>{var n=r(3070).f;e.exports=function(e,t,r){r in e||n(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})}},8572:e=>{var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.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},7651:(e,t,r)=>{var n=r(6916),i=r(9670),a=r(614),o=r(4326),u=r(2261),s=TypeError;e.exports=function(e,t){var r=e.exec;if(a(r)){var c=n(r,e,t);return null!==c&&i(c),c}if("RegExp"===o(e))return n(u,e,t);throw s("RegExp#exec called on incompatible receiver")}},2261:(e,t,r)=>{"use strict";var n,i,a=r(6916),o=r(1702),u=r(1340),s=r(7066),c=r(2999),f=r(2309),l=r(30),p=r(9909).get,m=r(9441),h=r(7168),d=f("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,y=v,g=o("".charAt),x=o("".indexOf),b=o("".replace),w=o("".slice),N=(i=/b*/g,a(v,n=/a/,"a"),a(v,i,"a"),0!==n.lastIndex||0!==i.lastIndex),D=c.BROKEN_CARET,E=void 0!==/()??/.exec("")[1];(N||E||D||m||h)&&(y=function(e){var t,r,n,i,o,c,f,m=this,h=p(m),A=u(e),S=h.raw;if(S)return S.lastIndex=m.lastIndex,t=a(y,S,A),m.lastIndex=S.lastIndex,t;var C=h.groups,M=D&&m.sticky,F=a(s,m),O=m.source,T=0,B=A;if(M&&(F=b(F,"y",""),-1===x(F,"g")&&(F+="g"),B=w(A,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==g(A,m.lastIndex-1))&&(O="(?: "+O+")",B=" "+B,T++),r=new RegExp("^(?:"+O+")",F)),E&&(r=new RegExp("^"+O+"$(?!\\s)",F)),N&&(n=m.lastIndex),i=a(v,M?r:m,B),M?i?(i.input=w(i.input,T),i[0]=w(i[0],T),i.index=m.lastIndex,m.lastIndex+=i[0].length):m.lastIndex=0:N&&i&&(m.lastIndex=m.global?i.index+i[0].length:n),E&&i&&i.length>1&&a(d,i[0],r,(function(){for(o=1;o{"use strict";var n=r(9670);e.exports=function(){var e=n(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}},4706:(e,t,r)=>{var n=r(6916),i=r(2597),a=r(7976),o=r(7066),u=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in u||i(e,"flags")||!a(u,e)?t:n(o,e)}},2999:(e,t,r)=>{var n=r(7293),i=r(7854).RegExp,a=n((function(){var e=i("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),o=a||n((function(){return!i("a","y").sticky})),u=a||n((function(){var e=i("^r","gy");return e.lastIndex=2,null!=e.exec("str")}));e.exports={BROKEN_CARET:u,MISSED_STICKY:o,UNSUPPORTED_Y:a}},9441:(e,t,r)=>{var n=r(7293),i=r(7854).RegExp;e.exports=n((function(){var e=i(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)}))},7168:(e,t,r)=>{var n=r(7293),i=r(7854).RegExp;e.exports=n((function(){var e=i("(?b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$c")}))},4488:(e,t,r)=>{var n=r(8554),i=TypeError;e.exports=function(e){if(n(e))throw i("Can't call method on "+e);return e}},6340:(e,t,r)=>{"use strict";var n=r(5005),i=r(7045),a=r(5112),o=r(9781),u=a("species");e.exports=function(e){var t=n(e);o&&t&&!t[u]&&i(t,u,{configurable:!0,get:function(){return this}})}},8003:(e,t,r)=>{var n=r(3070).f,i=r(2597),a=r(5112)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!i(e,a)&&n(e,a,{configurable:!0,value:t})}},6200:(e,t,r)=>{var n=r(2309),i=r(9711),a=n("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},5465:(e,t,r)=>{var n=r(7854),i=r(3072),a="__core-js_shared__",o=n[a]||i(a,{});e.exports=o},2309:(e,t,r)=>{var n=r(1913),i=r(5465);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"})},6707:(e,t,r)=>{var n=r(9670),i=r(9483),a=r(8554),o=r(5112)("species");e.exports=function(e,t){var r,u=n(e).constructor;return void 0===u||a(r=n(u)[o])?t:i(r)}},3429:(e,t,r)=>{var n=r(7293);e.exports=function(e){return n((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}},8710:(e,t,r)=>{var n=r(1702),i=r(9303),a=r(1340),o=r(4488),u=n("".charAt),s=n("".charCodeAt),c=n("".slice),f=function(e){return function(t,r){var n,f,l=a(o(t)),p=i(r),m=l.length;return p<0||p>=m?e?"":void 0:(n=s(l,p))<55296||n>56319||p+1===m||(f=s(l,p+1))<56320||f>57343?e?u(l,p):n:e?c(l,p,p+2):f-56320+(n-55296<<10)+65536}};e.exports={codeAt:f(!1),charAt:f(!0)}},8415:(e,t,r)=>{"use strict";var n=r(9303),i=r(1340),a=r(4488),o=RangeError;e.exports=function(e){var t=i(a(this)),r="",u=n(e);if(u<0||u==1/0)throw o("Wrong number of repetitions");for(;u>0;(u>>>=1)&&(t+=t))1&u&&(r+=t);return r}},6091:(e,t,r)=>{var n=r(6530).PROPER,i=r(7293),a=r(1361);e.exports=function(e){return i((function(){return!!a[e]()||"​…᠎"!=="​…᠎"[e]()||n&&a[e].name!==e}))}},3111:(e,t,r)=>{var n=r(1702),i=r(4488),a=r(1340),o=r(1361),u=n("".replace),s=RegExp("^["+o+"]+"),c=RegExp("(^|[^"+o+"])["+o+"]+$"),f=function(e){return function(t){var r=a(i(t));return 1&e&&(r=u(r,s,"")),2&e&&(r=u(r,c,"$1")),r}};e.exports={start:f(1),end:f(2),trim:f(3)}},6293:(e,t,r)=>{var n=r(7392),i=r(7293),a=r(7854).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol();return!a(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},6532:(e,t,r)=>{var n=r(6916),i=r(5005),a=r(5112),o=r(8052);e.exports=function(){var e=i("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,u=a("toPrimitive");t&&!t[u]&&o(t,u,(function(e){return n(r,this)}),{arity:1})}},2015:(e,t,r)=>{var n=r(6293);e.exports=n&&!!Symbol.for&&!!Symbol.keyFor},261:(e,t,r)=>{var n,i,a,o,u=r(7854),s=r(2104),c=r(9974),f=r(614),l=r(2597),p=r(7293),m=r(490),h=r(206),d=r(317),v=r(8053),y=r(6833),g=r(5268),x=u.setImmediate,b=u.clearImmediate,w=u.process,N=u.Dispatch,D=u.Function,E=u.MessageChannel,A=u.String,S=0,C={},M="onreadystatechange";p((function(){n=u.location}));var F=function(e){if(l(C,e)){var t=C[e];delete C[e],t()}},O=function(e){return function(){F(e)}},T=function(e){F(e.data)},B=function(e){u.postMessage(A(e),n.protocol+"//"+n.host)};x&&b||(x=function(e){v(arguments.length,1);var t=f(e)?e:D(e),r=h(arguments,1);return C[++S]=function(){s(t,void 0,r)},i(S),S},b=function(e){delete C[e]},g?i=function(e){w.nextTick(O(e))}:N&&N.now?i=function(e){N.now(O(e))}:E&&!y?(o=(a=new E).port2,a.port1.onmessage=T,i=c(o.postMessage,o)):u.addEventListener&&f(u.postMessage)&&!u.importScripts&&n&&"file:"!==n.protocol&&!p(B)?(i=B,u.addEventListener("message",T,!1)):i=M in d("script")?function(e){m.appendChild(d("script"))[M]=function(){m.removeChild(this),F(e)}}:function(e){setTimeout(O(e),0)}),e.exports={set:x,clear:b}},863:(e,t,r)=>{var n=r(1702);e.exports=n(1..valueOf)},1400:(e,t,r)=>{var n=r(9303),i=Math.max,a=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):a(r,t)}},5656:(e,t,r)=>{var n=r(8361),i=r(4488);e.exports=function(e){return n(i(e))}},9303:(e,t,r)=>{var n=r(4758);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},7466:(e,t,r)=>{var n=r(9303),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},7908:(e,t,r)=>{var n=r(4488),i=Object;e.exports=function(e){return i(n(e))}},7593:(e,t,r)=>{var n=r(6916),i=r(111),a=r(2190),o=r(8173),u=r(2140),s=r(5112),c=TypeError,f=s("toPrimitive");e.exports=function(e,t){if(!i(e)||a(e))return e;var r,s=o(e,f);if(s){if(void 0===t&&(t="default"),r=n(s,e,t),!i(r)||a(r))return r;throw c("Can't convert object to primitive value")}return void 0===t&&(t="number"),u(e,t)}},4948:(e,t,r)=>{var n=r(7593),i=r(2190);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},1694:(e,t,r)=>{var n={};n[r(5112)("toStringTag")]="z",e.exports="[object z]"===String(n)},1340:(e,t,r)=>{var n=r(648),i=String;e.exports=function(e){if("Symbol"===n(e))throw TypeError("Cannot convert a Symbol value to a string");return i(e)}},6330:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},9711:(e,t,r)=>{var n=r(1702),i=0,a=Math.random(),o=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++i+a,36)}},3307:(e,t,r)=>{var n=r(6293);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:(e,t,r)=>{var n=r(9781),i=r(7293);e.exports=n&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8053:e=>{var t=TypeError;e.exports=function(e,r){if(e{var n=r(7854),i=r(614),a=n.WeakMap;e.exports=i(a)&&/native code/.test(String(a))},6800:(e,t,r)=>{var n=r(857),i=r(2597),a=r(6061),o=r(3070).f;e.exports=function(e){var t=n.Symbol||(n.Symbol={});i(t,e)||o(t,e,{value:a.f(e)})}},6061:(e,t,r)=>{var n=r(5112);t.f=n},5112:(e,t,r)=>{var n=r(7854),i=r(2309),a=r(2597),o=r(9711),u=r(6293),s=r(3307),c=n.Symbol,f=i("wks"),l=s?c.for||c:c&&c.withoutSetter||o;e.exports=function(e){return a(f,e)||(f[e]=u&&a(c,e)?c[e]:l("Symbol."+e)),f[e]}},1361:e=>{e.exports="\t\n\v\f\r                \u2028\u2029\ufeff"},2222:(e,t,r)=>{"use strict";var n=r(2109),i=r(7293),a=r(3157),o=r(111),u=r(7908),s=r(6244),c=r(7207),f=r(6135),l=r(5417),p=r(1194),m=r(5112),h=r(7392),d=m("isConcatSpreadable"),v=h>=51||!i((function(){var e=[];return e[d]=!1,e.concat()[0]!==e})),y=function(e){if(!o(e))return!1;var t=e[d];return void 0!==t?!!t:a(e)};n({target:"Array",proto:!0,arity:1,forced:!v||!p("concat")},{concat:function(e){var t,r,n,i,a,o=u(this),p=l(o,0),m=0;for(t=-1,n=arguments.length;t{"use strict";var n=r(2109),i=r(2092).every;n({target:"Array",proto:!0,forced:!r(9341)("every")},{every:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},3290:(e,t,r)=>{var n=r(2109),i=r(1285),a=r(1223);n({target:"Array",proto:!0},{fill:i}),a("fill")},7327:(e,t,r)=>{"use strict";var n=r(2109),i=r(2092).filter;n({target:"Array",proto:!0,forced:!r(1194)("filter")},{filter:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},9826:(e,t,r)=>{"use strict";var n=r(2109),i=r(2092).find,a=r(1223),o="find",u=!0;o in[]&&Array(1)[o]((function(){u=!1})),n({target:"Array",proto:!0,forced:u},{find:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a(o)},9554:(e,t,r)=>{"use strict";var n=r(2109),i=r(8533);n({target:"Array",proto:!0,forced:[].forEach!=i},{forEach:i})},1038:(e,t,r)=>{var n=r(2109),i=r(8457);n({target:"Array",stat:!0,forced:!r(7072)((function(e){Array.from(e)}))},{from:i})},6699:(e,t,r)=>{"use strict";var n=r(2109),i=r(1318).includes,a=r(7293),o=r(1223);n({target:"Array",proto:!0,forced:a((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),o("includes")},2772:(e,t,r)=>{"use strict";var n=r(2109),i=r(1470),a=r(1318).indexOf,o=r(9341),u=i([].indexOf),s=!!u&&1/u([1],1,-0)<0;n({target:"Array",proto:!0,forced:s||!o("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return s?u(this,e,t)||0:a(this,e,t)}})},9753:(e,t,r)=>{r(2109)({target:"Array",stat:!0},{isArray:r(3157)})},6992:(e,t,r)=>{"use strict";var n=r(5656),i=r(1223),a=r(7497),o=r(9909),u=r(3070).f,s=r(1656),c=r(6178),f=r(1913),l=r(9781),p="Array Iterator",m=o.set,h=o.getterFor(p);e.exports=s(Array,"Array",(function(e,t){m(this,{type:p,target:n(e),index:0,kind:t})}),(function(){var e=h(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,c(void 0,!0)):c("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values");var d=a.Arguments=a.Array;if(i("keys"),i("values"),i("entries"),!f&&l&&"values"!==d.name)try{u(d,"name",{value:"values"})}catch(e){}},9600:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(8361),o=r(5656),u=r(9341),s=i([].join);n({target:"Array",proto:!0,forced:a!=Object||!u("join",",")},{join:function(e){return s(o(this),void 0===e?",":e)}})},1249:(e,t,r)=>{"use strict";var n=r(2109),i=r(2092).map;n({target:"Array",proto:!0,forced:!r(1194)("map")},{map:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},5827:(e,t,r)=>{"use strict";var n=r(2109),i=r(3671).left,a=r(9341),o=r(7392);n({target:"Array",proto:!0,forced:!r(5268)&&o>79&&o<83||!a("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},5069:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(3157),o=i([].reverse),u=[1,2];n({target:"Array",proto:!0,forced:String(u)===String(u.reverse())},{reverse:function(){return a(this)&&(this.length=this.length),o(this)}})},7042:(e,t,r)=>{"use strict";var n=r(2109),i=r(3157),a=r(4411),o=r(111),u=r(1400),s=r(6244),c=r(5656),f=r(6135),l=r(5112),p=r(1194),m=r(206),h=p("slice"),d=l("species"),v=Array,y=Math.max;n({target:"Array",proto:!0,forced:!h},{slice:function(e,t){var r,n,l,p=c(this),h=s(p),g=u(e,h),x=u(void 0===t?h:t,h);if(i(p)&&(r=p.constructor,(a(r)&&(r===v||i(r.prototype))||o(r)&&null===(r=r[d]))&&(r=void 0),r===v||void 0===r))return m(p,g,x);for(n=new(void 0===r?v:r)(y(x-g,0)),l=0;g{"use strict";var n=r(2109),i=r(2092).some;n({target:"Array",proto:!0,forced:!r(9341)("some")},{some:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},2707:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(9662),o=r(7908),u=r(6244),s=r(5117),c=r(1340),f=r(7293),l=r(4362),p=r(9341),m=r(8886),h=r(256),d=r(7392),v=r(8008),y=[],g=i(y.sort),x=i(y.push),b=f((function(){y.sort(void 0)})),w=f((function(){y.sort(null)})),N=p("sort"),D=!f((function(){if(d)return d<70;if(!(m&&m>3)){if(h)return!0;if(v)return v<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)y.push({k:t+n,v:r})}for(y.sort((function(e,t){return t.v-e.v})),n=0;nc(r)?1:-1}}(e)),r=u(i),n=0;n{"use strict";var n=r(2109),i=r(7908),a=r(1400),o=r(9303),u=r(6244),s=r(3658),c=r(7207),f=r(5417),l=r(6135),p=r(5117),m=r(1194)("splice"),h=Math.max,d=Math.min;n({target:"Array",proto:!0,forced:!m},{splice:function(e,t){var r,n,m,v,y,g,x=i(this),b=u(x),w=a(e,b),N=arguments.length;for(0===N?r=n=0:1===N?(r=0,n=b-w):(r=N-2,n=d(h(o(t),0),b-w)),c(b+r-n),m=f(x,n),v=0;vb-n+r;v--)p(x,v-1)}else if(r>n)for(v=b-n;v>w;v--)g=v+r-1,(y=v+n-1)in x?x[g]=x[y]:p(x,g);for(v=0;v{var n=r(2109),i=r(1702),a=Date,o=i(a.prototype.getTime);n({target:"Date",stat:!0},{now:function(){return o(new a)}})},5735:(e,t,r)=>{"use strict";var n=r(2109),i=r(7293),a=r(7908),o=r(7593);n({target:"Date",proto:!0,arity:1,forced:i((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=a(this),r=o(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}})},3710:(e,t,r)=>{var n=r(1702),i=r(8052),a=Date.prototype,o="Invalid Date",u="toString",s=n(a[u]),c=n(a.getTime);String(new Date(NaN))!=o&&i(a,u,(function(){var e=c(this);return e==e?s(this):o}))},4812:(e,t,r)=>{var n=r(2109),i=r(7065);n({target:"Function",proto:!0,forced:Function.bind!==i},{bind:i})},8309:(e,t,r)=>{var n=r(9781),i=r(6530).EXISTS,a=r(1702),o=r(7045),u=Function.prototype,s=a(u.toString),c=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,f=a(c.exec);n&&!i&&o(u,"name",{configurable:!0,get:function(){try{return f(c,s(this))[1]}catch(e){return""}}})},8862:(e,t,r)=>{var n=r(2109),i=r(5005),a=r(2104),o=r(6916),u=r(1702),s=r(7293),c=r(614),f=r(2190),l=r(206),p=r(8044),m=r(6293),h=String,d=i("JSON","stringify"),v=u(/./.exec),y=u("".charAt),g=u("".charCodeAt),x=u("".replace),b=u(1..toString),w=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,D=/^[\uDC00-\uDFFF]$/,E=!m||s((function(){var e=i("Symbol")();return"[null]"!=d([e])||"{}"!=d({a:e})||"{}"!=d(Object(e))})),A=s((function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")})),S=function(e,t){var r=l(arguments),n=p(t);if(c(n)||void 0!==e&&!f(e))return r[1]=function(e,t){if(c(n)&&(t=o(n,this,h(e),t)),!f(t))return t},a(d,null,r)},C=function(e,t,r){var n=y(r,t-1),i=y(r,t+1);return v(N,e)&&!v(D,i)||v(D,e)&&!v(N,n)?"\\u"+b(g(e,0),16):e};d&&n({target:"JSON",stat:!0,arity:3,forced:E||A},{stringify:function(e,t,r){var n=l(arguments),i=a(E?S:d,null,n);return A&&"string"==typeof i?x(i,w,C):i}})},9098:(e,t,r)=>{"use strict";r(7710)("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),r(5631))},1532:(e,t,r)=>{r(9098)},9752:(e,t,r)=>{var n=r(2109),i=r(6513),a=Math.acosh,o=Math.log,u=Math.sqrt,s=Math.LN2;n({target:"Math",stat:!0,forced:!a||710!=Math.floor(a(Number.MAX_VALUE))||a(1/0)!=1/0},{acosh:function(e){var t=+e;return t<1?NaN:t>94906265.62425156?o(t)+s:i(t-1+u(t-1)*u(t+1))}})},2376:(e,t,r)=>{var n=r(2109),i=Math.asinh,a=Math.log,o=Math.sqrt;n({target:"Math",stat:!0,forced:!(i&&1/i(0)>0)},{asinh:function e(t){var r=+t;return isFinite(r)&&0!=r?r<0?-e(-r):a(r+o(r*r+1)):r}})},3181:(e,t,r)=>{var n=r(2109),i=Math.atanh,a=Math.log;n({target:"Math",stat:!0,forced:!(i&&1/i(-0)<0)},{atanh:function(e){var t=+e;return 0==t?t:a((1+t)/(1-t))/2}})},3484:(e,t,r)=>{var n=r(2109),i=r(4310),a=Math.abs,o=Math.pow;n({target:"Math",stat:!0},{cbrt:function(e){var t=+e;return i(t)*o(a(t),1/3)}})},8621:(e,t,r)=>{var n=r(2109),i=r(6736),a=Math.cosh,o=Math.abs,u=Math.E;n({target:"Math",stat:!0,forced:!a||a(710)===1/0},{cosh:function(e){var t=i(o(e)-1)+1;return(t+1/(t*u*u))*(u/2)}})},5890:(e,t,r)=>{var n=r(2109),i=r(6736);n({target:"Math",stat:!0,forced:i!=Math.expm1},{expm1:i})},658:(e,t,r)=>{r(2109)({target:"Math",stat:!0},{log10:r(403)})},197:(e,t,r)=>{r(2109)({target:"Math",stat:!0},{log1p:r(6513)})},4914:(e,t,r)=>{var n=r(2109),i=Math.log,a=Math.LN2;n({target:"Math",stat:!0},{log2:function(e){return i(e)/a}})},2420:(e,t,r)=>{r(2109)({target:"Math",stat:!0},{sign:r(4310)})},160:(e,t,r)=>{var n=r(2109),i=r(7293),a=r(6736),o=Math.abs,u=Math.exp,s=Math.E;n({target:"Math",stat:!0,forced:i((function(){return-2e-17!=Math.sinh(-2e-17)}))},{sinh:function(e){var t=+e;return o(t)<1?(a(t)-a(-t))/2:(u(t-1)-u(-t-1))*(s/2)}})},970:(e,t,r)=>{var n=r(2109),i=r(6736),a=Math.exp;n({target:"Math",stat:!0},{tanh:function(e){var t=+e,r=i(t),n=i(-t);return r==1/0?1:n==1/0?-1:(r-n)/(a(t)+a(-t))}})},9653:(e,t,r)=>{"use strict";var n=r(2109),i=r(1913),a=r(9781),o=r(7854),u=r(857),s=r(1702),c=r(4705),f=r(2597),l=r(9587),p=r(7976),m=r(2190),h=r(7593),d=r(7293),v=r(8006).f,y=r(1236).f,g=r(3070).f,x=r(863),b=r(3111).trim,w="Number",N=o[w],D=u[w],E=N.prototype,A=o.TypeError,S=s("".slice),C=s("".charCodeAt),M=c(w,!N(" 0o1")||!N("0b1")||N("+0x1")),F=function(e){var t,r=arguments.length<1?0:N(function(e){var t=h(e,"number");return"bigint"==typeof t?t:function(e){var t,r,n,i,a,o,u,s,c=h(e,"number");if(m(c))throw A("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=b(c),43===(t=C(c,0))||45===t){if(88===(r=C(c,2))||120===r)return NaN}else if(48===t){switch(C(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(o=(a=S(c,2)).length,u=0;ui)return NaN;return parseInt(a,n)}return+c}(t)}(e));return p(E,t=this)&&d((function(){x(t)}))?l(Object(r),this,F):r};F.prototype=E,M&&!i&&(E.constructor=F),n({global:!0,constructor:!0,wrap:!0,forced:M},{Number:F});var O=function(e,t){for(var r,n=a?v(t):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),i=0;n.length>i;i++)f(t,r=n[i])&&!f(e,r)&&g(e,r,y(t,r))};i&&D&&O(u[w],D),(M||i)&&O(u[w],N)},3299:(e,t,r)=>{r(2109)({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)})},4048:(e,t,r)=>{r(2109)({target:"Number",stat:!0},{isNaN:function(e){return e!=e}})},6977:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(9303),o=r(863),u=r(8415),s=r(7293),c=RangeError,f=String,l=Math.floor,p=i(u),m=i("".slice),h=i(1..toFixed),d=function(e,t,r){return 0===t?r:t%2==1?d(e,t-1,r*e):d(e*e,t/2,r)},v=function(e,t,r){for(var n=-1,i=r;++n<6;)i+=t*e[n],e[n]=i%1e7,i=l(i/1e7)},y=function(e,t){for(var r=6,n=0;--r>=0;)n+=e[r],e[r]=l(n/t),n=n%t*1e7},g=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var n=f(e[t]);r=""===r?n:r+p("0",7-n.length)+n}return r};n({target:"Number",proto:!0,forced:s((function(){return"0.000"!==h(8e-5,3)||"1"!==h(.9,0)||"1.25"!==h(1.255,2)||"1000000000000000128"!==h(0xde0b6b3a7640080,0)}))||!s((function(){h({})}))},{toFixed:function(e){var t,r,n,i,u=o(this),s=a(e),l=[0,0,0,0,0,0],h="",x="0";if(s<0||s>20)throw c("Incorrect fraction digits");if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return f(u);if(u<0&&(h="-",u=-u),u>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(u*d(2,69,1))-69)<0?u*d(2,-t,1):u/d(2,t,1),r*=4503599627370496,(t=52-t)>0){for(v(l,0,r),n=s;n>=7;)v(l,1e7,0),n-=7;for(v(l,d(10,n,1),0),n=t-1;n>=23;)y(l,1<<23),n-=23;y(l,1<0?h+((i=x.length)<=s?"0."+p("0",s-i)+x:m(x,0,i-s)+"."+m(x,i-s)):h+x}})},5147:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(7293),o=r(863),u=i(1..toPrecision);n({target:"Number",proto:!0,forced:a((function(){return"1"!==u(1,void 0)}))||!a((function(){u({})}))},{toPrecision:function(e){return void 0===e?u(o(this)):u(o(this),e)}})},8011:(e,t,r)=>{r(2109)({target:"Object",stat:!0,sham:!r(9781)},{create:r(30)})},3321:(e,t,r)=>{var n=r(2109),i=r(9781),a=r(6048).f;n({target:"Object",stat:!0,forced:Object.defineProperties!==a,sham:!i},{defineProperties:a})},9070:(e,t,r)=>{var n=r(2109),i=r(9781),a=r(3070).f;n({target:"Object",stat:!0,forced:Object.defineProperty!==a,sham:!i},{defineProperty:a})},5003:(e,t,r)=>{var n=r(2109),i=r(7293),a=r(5656),o=r(1236).f,u=r(9781);n({target:"Object",stat:!0,forced:!u||i((function(){o(1)})),sham:!u},{getOwnPropertyDescriptor:function(e,t){return o(a(e),t)}})},9337:(e,t,r)=>{var n=r(2109),i=r(9781),a=r(3887),o=r(5656),u=r(1236),s=r(6135);n({target:"Object",stat:!0,sham:!i},{getOwnPropertyDescriptors:function(e){for(var t,r,n=o(e),i=u.f,c=a(n),f={},l=0;c.length>l;)void 0!==(r=i(n,t=c[l++]))&&s(f,t,r);return f}})},9660:(e,t,r)=>{var n=r(2109),i=r(6293),a=r(7293),o=r(5181),u=r(7908);n({target:"Object",stat:!0,forced:!i||a((function(){o.f(1)}))},{getOwnPropertySymbols:function(e){var t=o.f;return t?t(u(e)):[]}})},489:(e,t,r)=>{var n=r(2109),i=r(7293),a=r(7908),o=r(9518),u=r(8544);n({target:"Object",stat:!0,forced:i((function(){o(1)})),sham:!u},{getPrototypeOf:function(e){return o(a(e))}})},7941:(e,t,r)=>{var n=r(2109),i=r(7908),a=r(1956);n({target:"Object",stat:!0,forced:r(7293)((function(){a(1)}))},{keys:function(e){return a(i(e))}})},1539:(e,t,r)=>{var n=r(1694),i=r(8052),a=r(288);n||i(Object.prototype,"toString",a,{unsafe:!0})},4678:(e,t,r)=>{var n=r(2109),i=r(2814);n({global:!0,forced:parseFloat!=i},{parseFloat:i})},1058:(e,t,r)=>{var n=r(2109),i=r(3009);n({global:!0,forced:parseInt!=i},{parseInt:i})},821:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(9662),o=r(8523),u=r(2534),s=r(408);n({target:"Promise",stat:!0,forced:r(612)},{all:function(e){var t=this,r=o.f(t),n=r.resolve,c=r.reject,f=u((function(){var r=a(t.resolve),o=[],u=0,f=1;s(e,(function(e){var a=u++,s=!1;f++,i(r,t,e).then((function(e){s||(s=!0,o[a]=e,--f||n(o))}),c)})),--f||n(o)}));return f.error&&c(f.value),r.promise}})},4164:(e,t,r)=>{"use strict";var n=r(2109),i=r(1913),a=r(3702).CONSTRUCTOR,o=r(2492),u=r(5005),s=r(614),c=r(8052),f=o&&o.prototype;if(n({target:"Promise",proto:!0,forced:a,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&s(o)){var l=u("Promise").prototype.catch;f.catch!==l&&c(f,"catch",l,{unsafe:!0})}},3401:(e,t,r)=>{"use strict";var n,i,a,o=r(2109),u=r(1913),s=r(5268),c=r(7854),f=r(6916),l=r(8052),p=r(7674),m=r(8003),h=r(6340),d=r(9662),v=r(614),y=r(111),g=r(5787),x=r(6707),b=r(261).set,w=r(5948),N=r(842),D=r(2534),E=r(8572),A=r(9909),S=r(2492),C=r(3702),M=r(8523),F="Promise",O=C.CONSTRUCTOR,T=C.REJECTION_EVENT,B=C.SUBCLASSING,_=A.getterFor(F),k=A.set,I=S&&S.prototype,R=S,z=I,q=c.TypeError,j=c.document,P=c.process,L=M.f,U=L,$=!!(j&&j.createEvent&&c.dispatchEvent),H="unhandledrejection",G=function(e){var t;return!(!y(e)||!v(t=e.then))&&t},V=function(e,t){var r,n,i,a=t.value,o=1==t.state,u=o?e.ok:e.fail,s=e.resolve,c=e.reject,l=e.domain;try{u?(o||(2===t.rejection&&X(t),t.rejection=1),!0===u?r=a:(l&&l.enter(),r=u(a),l&&(l.exit(),i=!0)),r===e.promise?c(q("Promise-chain cycle")):(n=G(r))?f(n,r,s,c):s(r)):c(a)}catch(e){l&&!i&&l.exit(),c(e)}},Z=function(e,t){e.notified||(e.notified=!0,w((function(){for(var r,n=e.reactions;r=n.get();)V(r,e);e.notified=!1,t&&!e.rejection&&Y(e)})))},W=function(e,t,r){var n,i;$?((n=j.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),c.dispatchEvent(n)):n={promise:t,reason:r},!T&&(i=c["on"+e])?i(n):e===H&&N("Unhandled promise rejection",r)},Y=function(e){f(b,c,(function(){var t,r=e.facade,n=e.value;if(J(e)&&(t=D((function(){s?P.emit("unhandledRejection",n,r):W(H,r,n)})),e.rejection=s||J(e)?2:1,t.error))throw t.value}))},J=function(e){return 1!==e.rejection&&!e.parent},X=function(e){f(b,c,(function(){var t=e.facade;s?P.emit("rejectionHandled",t):W("rejectionhandled",t,e.value)}))},Q=function(e,t,r){return function(n){e(t,n,r)}},K=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Z(e,!0))},ee=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw q("Promise can't be resolved itself");var n=G(t);n?w((function(){var r={done:!1};try{f(n,t,Q(ee,r,e),Q(K,r,e))}catch(t){K(r,t,e)}})):(e.value=t,e.state=1,Z(e,!1))}catch(t){K({done:!1},t,e)}}};if(O&&(z=(R=function(e){g(this,z),d(e),f(n,this);var t=_(this);try{e(Q(ee,t),Q(K,t))}catch(e){K(t,e)}}).prototype,(n=function(e){k(this,{type:F,done:!1,notified:!1,parent:!1,reactions:new E,rejection:!1,state:0,value:void 0})}).prototype=l(z,"then",(function(e,t){var r=_(this),n=L(x(this,R));return r.parent=!0,n.ok=!v(e)||e,n.fail=v(t)&&t,n.domain=s?P.domain:void 0,0==r.state?r.reactions.add(n):w((function(){V(n,r)})),n.promise})),i=function(){var e=new n,t=_(e);this.promise=e,this.resolve=Q(ee,t),this.reject=Q(K,t)},M.f=L=function(e){return e===R||void 0===e?new i(e):U(e)},!u&&v(S)&&I!==Object.prototype)){a=I.then,B||l(I,"then",(function(e,t){var r=this;return new R((function(e,t){f(a,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete I.constructor}catch(e){}p&&p(I,z)}o({global:!0,constructor:!0,wrap:!0,forced:O},{Promise:R}),m(R,F,!1,!0),h(F)},8674:(e,t,r)=>{r(3401),r(821),r(4164),r(6027),r(683),r(6294)},6027:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(9662),o=r(8523),u=r(2534),s=r(408);n({target:"Promise",stat:!0,forced:r(612)},{race:function(e){var t=this,r=o.f(t),n=r.reject,c=u((function(){var o=a(t.resolve);s(e,(function(e){i(o,t,e).then(r.resolve,n)}))}));return c.error&&n(c.value),r.promise}})},683:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(8523);n({target:"Promise",stat:!0,forced:r(3702).CONSTRUCTOR},{reject:function(e){var t=a.f(this);return i(t.reject,void 0,e),t.promise}})},6294:(e,t,r)=>{"use strict";var n=r(2109),i=r(5005),a=r(1913),o=r(2492),u=r(3702).CONSTRUCTOR,s=r(9478),c=i("Promise"),f=a&&!u;n({target:"Promise",stat:!0,forced:a||u},{resolve:function(e){return s(f&&this===c?o:this,e)}})},2419:(e,t,r)=>{var n=r(2109),i=r(5005),a=r(2104),o=r(7065),u=r(9483),s=r(9670),c=r(111),f=r(30),l=r(7293),p=i("Reflect","construct"),m=Object.prototype,h=[].push,d=l((function(){function e(){}return!(p((function(){}),[],e)instanceof e)})),v=!l((function(){p((function(){}))})),y=d||v;n({target:"Reflect",stat:!0,forced:y,sham:y},{construct:function(e,t){u(e),s(t);var r=arguments.length<3?e:u(arguments[2]);if(v&&!d)return p(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return a(h,n,t),new(a(o,e,n))}var i=r.prototype,l=f(c(i)?i:m),y=a(e,l,t);return c(y)?y:l}})},1299:(e,t,r)=>{var n=r(2109),i=r(7854),a=r(8003);n({global:!0},{Reflect:{}}),a(i.Reflect,"Reflect",!0)},4603:(e,t,r)=>{var n=r(9781),i=r(7854),a=r(1702),o=r(4705),u=r(9587),s=r(8880),c=r(8006).f,f=r(7976),l=r(7850),p=r(1340),m=r(4706),h=r(2999),d=r(2626),v=r(8052),y=r(7293),g=r(2597),x=r(9909).enforce,b=r(6340),w=r(5112),N=r(9441),D=r(7168),E=w("match"),A=i.RegExp,S=A.prototype,C=i.SyntaxError,M=a(S.exec),F=a("".charAt),O=a("".replace),T=a("".indexOf),B=a("".slice),_=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,k=/a/g,I=/a/g,R=new A(k)!==k,z=h.MISSED_STICKY,q=h.UNSUPPORTED_Y;if(o("RegExp",n&&(!R||z||N||D||y((function(){return I[E]=!1,A(k)!=k||A(I)==I||"/a/i"!=A(k,"i")}))))){for(var j=function(e,t){var r,n,i,a,o,c,h=f(S,this),d=l(e),v=void 0===t,y=[],b=e;if(!h&&d&&v&&e.constructor===j)return e;if((d||f(S,e))&&(e=e.source,v&&(t=m(b))),e=void 0===e?"":p(e),t=void 0===t?"":p(t),b=e,N&&"dotAll"in k&&(n=!!t&&T(t,"s")>-1)&&(t=O(t,/s/g,"")),r=t,z&&"sticky"in k&&(i=!!t&&T(t,"y")>-1)&&q&&(t=O(t,/y/g,"")),D&&(a=function(e){for(var t,r=e.length,n=0,i="",a=[],o={},u=!1,s=!1,c=0,f="";n<=r;n++){if("\\"===(t=F(e,n)))t+=F(e,++n);else if("]"===t)u=!1;else if(!u)switch(!0){case"["===t:u=!0;break;case"("===t:M(_,B(e,n+1))&&(n+=2,s=!0),i+=t,c++;continue;case">"===t&&s:if(""===f||g(o,f))throw new C("Invalid capture group name");o[f]=!0,a[a.length]=[f,c],s=!1,f="";continue}s?f+=t:i+=t}return[i,a]}(e),e=a[0],y=a[1]),o=u(A(e,t),h?this:S,j),(n||i||y.length)&&(c=x(o),n&&(c.dotAll=!0,c.raw=j(function(e){for(var t,r=e.length,n=0,i="",a=!1;n<=r;n++)"\\"!==(t=F(e,n))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+F(e,++n);return i}(e),r)),i&&(c.sticky=!0),y.length&&(c.groups=y)),e!==b)try{s(o,"source",""===b?"(?:)":b)}catch(e){}return o},P=c(A),L=0;P.length>L;)d(j,A,P[L++]);S.constructor=j,j.prototype=S,v(i,"RegExp",j,{constructor:!0})}b("RegExp")},8450:(e,t,r)=>{var n=r(9781),i=r(9441),a=r(4326),o=r(7045),u=r(9909).get,s=RegExp.prototype,c=TypeError;n&&i&&o(s,"dotAll",{configurable:!0,get:function(){if(this!==s){if("RegExp"===a(this))return!!u(this).dotAll;throw c("Incompatible receiver, RegExp required")}}})},4916:(e,t,r)=>{"use strict";var n=r(2109),i=r(2261);n({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},8386:(e,t,r)=>{var n=r(9781),i=r(2999).MISSED_STICKY,a=r(4326),o=r(7045),u=r(9909).get,s=RegExp.prototype,c=TypeError;n&&i&&o(s,"sticky",{configurable:!0,get:function(){if(this!==s){if("RegExp"===a(this))return!!u(this).sticky;throw c("Incompatible receiver, RegExp required")}}})},7601:(e,t,r)=>{"use strict";r(4916);var n,i,a=r(2109),o=r(6916),u=r(614),s=r(9670),c=r(1340),f=(n=!1,(i=/[ac]/).exec=function(){return n=!0,/./.exec.apply(this,arguments)},!0===i.test("abc")&&n),l=/./.test;a({target:"RegExp",proto:!0,forced:!f},{test:function(e){var t=s(this),r=c(e),n=t.exec;if(!u(n))return o(l,t,r);var i=o(n,t,r);return null!==i&&(s(i),!0)}})},9714:(e,t,r)=>{"use strict";var n=r(6530).PROPER,i=r(8052),a=r(9670),o=r(1340),u=r(7293),s=r(4706),c="toString",f=RegExp.prototype[c],l=u((function(){return"/a/b"!=f.call({source:"a",flags:"b"})})),p=n&&f.name!=c;(l||p)&&i(RegExp.prototype,c,(function(){var e=a(this);return"/"+o(e.source)+"/"+o(s(e))}),{unsafe:!0})},7227:(e,t,r)=>{"use strict";r(7710)("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),r(5631))},189:(e,t,r)=>{r(7227)},2023:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(3929),o=r(4488),u=r(1340),s=r(4964),c=i("".indexOf);n({target:"String",proto:!0,forced:!s("includes")},{includes:function(e){return!!~c(u(o(this)),u(a(e)),arguments.length>1?arguments[1]:void 0)}})},8783:(e,t,r)=>{"use strict";var n=r(8710).charAt,i=r(1340),a=r(9909),o=r(1656),u=r(6178),s="String Iterator",c=a.set,f=a.getterFor(s);o(String,"String",(function(e){c(this,{type:s,string:i(e),index:0})}),(function(){var e,t=f(this),r=t.string,i=t.index;return i>=r.length?u(void 0,!0):(e=n(r,i),t.index+=e.length,u(e,!1))}))},4723:(e,t,r)=>{"use strict";var n=r(6916),i=r(7007),a=r(9670),o=r(8554),u=r(7466),s=r(1340),c=r(4488),f=r(8173),l=r(1530),p=r(7651);i("match",(function(e,t,r){return[function(t){var r=c(this),i=o(t)?void 0:f(t,e);return i?n(i,t,r):new RegExp(t)[e](s(r))},function(e){var n=a(this),i=s(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return p(n,i);var c=n.unicode;n.lastIndex=0;for(var f,m=[],h=0;null!==(f=p(n,i));){var d=s(f[0]);m[h]=d,""===d&&(n.lastIndex=l(i,u(n.lastIndex),c)),h++}return 0===h?null:m}]}))},2481:(e,t,r)=>{r(2109)({target:"String",proto:!0},{repeat:r(8415)})},5306:(e,t,r)=>{"use strict";var n=r(2104),i=r(6916),a=r(1702),o=r(7007),u=r(7293),s=r(9670),c=r(614),f=r(8554),l=r(9303),p=r(7466),m=r(1340),h=r(4488),d=r(1530),v=r(8173),y=r(647),g=r(7651),x=r(5112)("replace"),b=Math.max,w=Math.min,N=a([].concat),D=a([].push),E=a("".indexOf),A=a("".slice),S="$0"==="a".replace(/./,"$0"),C=!!/./[x]&&""===/./[x]("a","$0");o("replace",(function(e,t,r){var a=C?"$":"$0";return[function(e,r){var n=h(this),a=f(e)?void 0:v(e,x);return a?i(a,e,n,r):i(t,m(n),e,r)},function(e,i){var o=s(this),u=m(e);if("string"==typeof i&&-1===E(i,a)&&-1===E(i,"$<")){var f=r(t,o,u,i);if(f.done)return f.value}var h=c(i);h||(i=m(i));var v=o.global;if(v){var x=o.unicode;o.lastIndex=0}for(var S=[];;){var C=g(o,u);if(null===C)break;if(D(S,C),!v)break;""===m(C[0])&&(o.lastIndex=d(u,p(o.lastIndex),x))}for(var M,F="",O=0,T=0;T=O&&(F+=A(u,O,_)+q,O=_+B.length)}return F+A(u,O)}]}),!!u((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}))||!S||C)},86:(e,t,r)=>{"use strict";var n=r(2109),i=r(4230);n({target:"String",proto:!0,forced:r(3429)("sub")},{sub:function(){return i(this,"sub","","")}})},3650:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(4488),o=r(9303),u=r(1340),s=i("".slice),c=Math.max,f=Math.min;n({target:"String",proto:!0,forced:!"".substr||"b"!=="ab".substr(-1)},{substr:function(e,t){var r,n,i=u(a(this)),l=i.length,p=o(e);return p===1/0&&(p=0),p<0&&(p=c(l+p,0)),(r=void 0===t?l:o(t))<=0||r===1/0||p>=(n=f(p+r,l))?"":s(i,p,n)}})},3210:(e,t,r)=>{"use strict";var n=r(2109),i=r(3111).trim;n({target:"String",proto:!0,forced:r(6091)("trim")},{trim:function(){return i(this)}})},4032:(e,t,r)=>{"use strict";var n=r(2109),i=r(7854),a=r(6916),o=r(1702),u=r(1913),s=r(9781),c=r(6293),f=r(7293),l=r(2597),p=r(7976),m=r(9670),h=r(5656),d=r(4948),v=r(1340),y=r(9114),g=r(30),x=r(1956),b=r(8006),w=r(1156),N=r(5181),D=r(1236),E=r(3070),A=r(6048),S=r(5296),C=r(8052),M=r(7045),F=r(2309),O=r(6200),T=r(3501),B=r(9711),_=r(5112),k=r(6061),I=r(6800),R=r(6532),z=r(8003),q=r(9909),j=r(2092).forEach,P=O("hidden"),L="Symbol",U="prototype",$=q.set,H=q.getterFor(L),G=Object[U],V=i.Symbol,Z=V&&V[U],W=i.TypeError,Y=i.QObject,J=D.f,X=E.f,Q=w.f,K=S.f,ee=o([].push),te=F("symbols"),re=F("op-symbols"),ne=F("wks"),ie=!Y||!Y[U]||!Y[U].findChild,ae=s&&f((function(){return 7!=g(X({},"a",{get:function(){return X(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=J(G,t);n&&delete G[t],X(e,t,r),n&&e!==G&&X(G,t,n)}:X,oe=function(e,t){var r=te[e]=g(Z);return $(r,{type:L,tag:e,description:t}),s||(r.description=t),r},ue=function(e,t,r){e===G&&ue(re,t,r),m(e);var n=d(t);return m(r),l(te,n)?(r.enumerable?(l(e,P)&&e[P][n]&&(e[P][n]=!1),r=g(r,{enumerable:y(0,!1)})):(l(e,P)||X(e,P,y(1,{})),e[P][n]=!0),ae(e,n,r)):X(e,n,r)},se=function(e,t){m(e);var r=h(t),n=x(r).concat(pe(r));return j(n,(function(t){s&&!a(ce,r,t)||ue(e,t,r[t])})),e},ce=function(e){var t=d(e),r=a(K,this,t);return!(this===G&&l(te,t)&&!l(re,t))&&(!(r||!l(this,t)||!l(te,t)||l(this,P)&&this[P][t])||r)},fe=function(e,t){var r=h(e),n=d(t);if(r!==G||!l(te,n)||l(re,n)){var i=J(r,n);return!i||!l(te,n)||l(r,P)&&r[P][n]||(i.enumerable=!0),i}},le=function(e){var t=Q(h(e)),r=[];return j(t,(function(e){l(te,e)||l(T,e)||ee(r,e)})),r},pe=function(e){var t=e===G,r=Q(t?re:h(e)),n=[];return j(r,(function(e){!l(te,e)||t&&!l(G,e)||ee(n,te[e])})),n};c||(C(Z=(V=function(){if(p(Z,this))throw W("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?v(arguments[0]):void 0,t=B(e),r=function(e){this===G&&a(r,re,e),l(this,P)&&l(this[P],t)&&(this[P][t]=!1),ae(this,t,y(1,e))};return s&&ie&&ae(G,t,{configurable:!0,set:r}),oe(t,e)})[U],"toString",(function(){return H(this).tag})),C(V,"withoutSetter",(function(e){return oe(B(e),e)})),S.f=ce,E.f=ue,A.f=se,D.f=fe,b.f=w.f=le,N.f=pe,k.f=function(e){return oe(_(e),e)},s&&(M(Z,"description",{configurable:!0,get:function(){return H(this).description}}),u||C(G,"propertyIsEnumerable",ce,{unsafe:!0}))),n({global:!0,constructor:!0,wrap:!0,forced:!c,sham:!c},{Symbol:V}),j(x(ne),(function(e){I(e)})),n({target:L,stat:!0,forced:!c},{useSetter:function(){ie=!0},useSimple:function(){ie=!1}}),n({target:"Object",stat:!0,forced:!c,sham:!s},{create:function(e,t){return void 0===t?g(e):se(g(e),t)},defineProperty:ue,defineProperties:se,getOwnPropertyDescriptor:fe}),n({target:"Object",stat:!0,forced:!c},{getOwnPropertyNames:le}),R(),z(V,L),T[P]=!0},1817:(e,t,r)=>{"use strict";var n=r(2109),i=r(9781),a=r(7854),o=r(1702),u=r(2597),s=r(614),c=r(7976),f=r(1340),l=r(7045),p=r(9920),m=a.Symbol,h=m&&m.prototype;if(i&&s(m)&&(!("description"in h)||void 0!==m().description)){var d={},v=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:f(arguments[0]),t=c(h,this)?new m(e):void 0===e?m():m(e);return""===e&&(d[t]=!0),t};p(v,m),v.prototype=h,h.constructor=v;var y="Symbol(test)"==String(m("test")),g=o(h.valueOf),x=o(h.toString),b=/^Symbol\((.*)\)[^)]+$/,w=o("".replace),N=o("".slice);l(h,"description",{configurable:!0,get:function(){var e=g(this);if(u(d,e))return"";var t=x(e),r=y?N(t,7,-1):w(t,b,"$1");return""===r?void 0:r}}),n({global:!0,constructor:!0,forced:!0},{Symbol:v})}},763:(e,t,r)=>{var n=r(2109),i=r(5005),a=r(2597),o=r(1340),u=r(2309),s=r(2015),c=u("string-to-symbol-registry"),f=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!s},{for:function(e){var t=o(e);if(a(c,t))return c[t];var r=i("Symbol")(t);return c[t]=r,f[r]=t,r}})},2165:(e,t,r)=>{r(6800)("iterator")},2526:(e,t,r)=>{r(4032),r(763),r(6620),r(8862),r(9660)},6620:(e,t,r)=>{var n=r(2109),i=r(2597),a=r(2190),o=r(6330),u=r(2309),s=r(2015),c=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!s},{keyFor:function(e){if(!a(e))throw TypeError(o(e)+" is not a symbol");if(i(c,e))return c[e]}})},4747:(e,t,r)=>{var n=r(7854),i=r(8324),a=r(8509),o=r(8533),u=r(8880),s=function(e){if(e&&e.forEach!==o)try{u(e,"forEach",o)}catch(t){e.forEach=o}};for(var c in i)i[c]&&s(n[c]&&n[c].prototype);s(a)},3948:(e,t,r)=>{var n=r(7854),i=r(8324),a=r(8509),o=r(6992),u=r(8880),s=r(5112),c=s("iterator"),f=s("toStringTag"),l=o.values,p=function(e,t){if(e){if(e[c]!==l)try{u(e,c,l)}catch(t){e[c]=l}if(e[f]||u(e,f,t),i[t])for(var r in o)if(e[r]!==o[r])try{u(e,r,o[r])}catch(t){e[r]=o[r]}}};for(var m in i)p(n[m]&&n[m].prototype,m);p(a,"DOMTokenList")},3753:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916);n({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return i(URL.prototype.toString,this)}})},7928:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},o=a.preserveFormatting,u=void 0!==o&&o,s=a.escapeMapFn,c=void 0===s?i:s,f=String(e),l="",p=c(t({},r),u?t({},n):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,r){e||f.length>=t.length&&f.slice(0,t.length)===t&&(l+=p[m[r]],f=f.slice(t.length,f.length),e=!0)})),e||(l+=f.slice(0,1),f=f.slice(1,f.length))};f;)h();return l}},5628:function(e,t){var r;!function(n){"use strict";var i={s:1,n:0,d:1};function a(e,t){if(isNaN(e=parseInt(e,10)))throw f.InvalidParameter;return e*t}function o(e,t){if(0===t)throw f.DivisionByZero;var r=Object.create(f.prototype);r.s=e<0?-1:1;var n=c(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function u(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var s=function(e,t){var r,n=0,o=1,u=1,s=0,c=0,l=0,p=1,m=1,h=0,d=1,v=1,y=1,g=1e7;if(null==e);else if(void 0!==t){if(u=(n=e)*(o=t),n%1!=0||o%1!=0)throw f.NonIntegerParameter}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,o=e.d,"s"in e&&(n*=e.s);else{if(!(0 in e))throw f.InvalidParameter;n=e[0],1 in e&&(o=e[1])}u=n*o;break;case"number":if(e<0&&(u=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(e/=m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));d<=g&&y<=g;){if(e===(r=(h+v)/(d+y))){d+y<=g?(n=h+v,o=d+y):y>d?(n=v,o=y):(n=h,o=d);break}e>r?(h+=v,d+=y):(v+=h,y+=d),d>g?(n=v,o=y):(n=h,o=d)}n*=m}else(isNaN(e)||isNaN(t))&&(o=n=NaN);break;case"string":if(null===(d=e.match(/\d+|./g)))throw f.InvalidParameter;if("-"===d[h]?(u=-1,h++):"+"===d[h]&&h++,d.length===h+1?c=a(d[h++],u):"."===d[h+1]||"."===d[h]?("."!==d[h]&&(s=a(d[h++],u)),(1+ ++h===d.length||"("===d[h+1]&&")"===d[h+3]||"'"===d[h+1]&&"'"===d[h+3])&&(c=a(d[h],u),p=Math.pow(10,d[h].length),h++),("("===d[h]&&")"===d[h+2]||"'"===d[h]&&"'"===d[h+2])&&(l=a(d[h+1],u),m=Math.pow(10,d[h+1].length)-1,h+=3)):"/"===d[h+1]||":"===d[h+1]?(c=a(d[h],u),p=a(d[h+2],1),h+=3):"/"===d[h+3]&&" "===d[h+1]&&(s=a(d[h],u),c=a(d[h+2],u),p=a(d[h+4],1),h+=5),d.length<=h){u=n=l+(o=p*m)*s+m*c;break}default:throw f.InvalidParameter}if(0===o)throw f.DivisionByZero;i.s=u<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(o)};function c(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function f(e,t){if(s(e,t),!(this instanceof f))return o(i.s*i.n,i.d);e=c(i.d,i.n),this.s=i.s,this.n=i.n/e,this.d=i.d/e}f.DivisionByZero=new Error("Division by Zero"),f.InvalidParameter=new Error("Invalid argument"),f.NonIntegerParameter=new Error("Parameters must be integer"),f.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(e,t){return s(e,t),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,t){return s(e,t),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,t){return s(e,t),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,t){return s(e,t),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(void 0===e)return o(this.s*this.n%this.d,1);if(s(e,t),0===i.n&&0===this.d)throw f.DivisionByZero;return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(e,t){return s(e,t),o(c(i.n,this.n)*c(i.d,this.d),i.d*this.d)},lcm:function(e,t){return s(e,t),0===i.n&&0===this.n?o(0,1):o(i.n*this.n,c(i.n,this.n)*c(i.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):o(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):o(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):o(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(e,t){if(s(e,t),1===i.d)return i.s<0?o(Math.pow(this.s*this.d,i.n),Math.pow(this.n,i.n)):o(Math.pow(this.s*this.n,i.n),Math.pow(this.d,i.n));if(this.s<0)return null;var r=u(this.n),n=u(this.d),a=1,c=1;for(var f in r)if("1"!==f){if("0"===f){a=0;break}if(r[f]*=i.n,r[f]%i.d!=0)return null;r[f]/=i.d,a*=Math.pow(f,r[f])}for(var f in n)if("1"!==f){if(n[f]*=i.n,n[f]%i.d!=0)return null;n[f]/=i.d,c*=Math.pow(f,n[f])}return i.s<0?o(c,a):o(a,c)},equals:function(e,t){return s(e,t),this.s*this.n*i.d==i.s*i.n*this.d},compare:function(e,t){s(e,t);var r=this.s*this.n*i.d-i.s*i.n*this.d;return(0=0;a--)i=i.inverse().add(r[a]);if(i.sub(t).abs().valueOf()0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do{n.push(Math.floor(t/r)),e=t%r,t=r,r=e}while(1!==t);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>2e3)return 0;return n}(0,r),i=function(e,t,r){for(var n=1,i=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0}(0,r,n),a=this.s<0?"-":"";if(a+=t/r|0,t%=r,(t*=10)&&(a+="."),n){for(var o=i;o--;)a+=t/r|0,t%=r,t*=10;for(a+="(",o=n;o--;)a+=t/r|0,t%=r,t*=10;a+=")"}else for(o=e;t&&o--;)a+=t/r|0,t%=r,t*=10;return a}},void 0===(r=function(){return f}.apply(t,[]))||(e.exports=r)}()},3228:e=>{e.exports=function e(t,r){"use strict";var n,i,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,u=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,s=/^0x[0-9a-f]+$/i,c=/^0/,f=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},l=f(t).replace(o,"")||"",p=f(r).replace(o,"")||"",m=l.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(l.match(s),16)||1!==m.length&&l.match(u)&&Date.parse(l),v=parseInt(p.match(s),16)||d&&p.match(u)&&Date.parse(p)||null;if(v){if(dv)return 1}for(var y=0,g=Math.max(m.length,h.length);yi)return 1}return 0}},6377:(e,t,r)=>{var n=r(4832),i=r(8652),a=r(801),o=r(2030),u=r(3618),s=r(9049),c=r(1971);c.alea=n,c.xor128=i,c.xorwow=a,c.xorshift7=o,c.xor4096=u,c.tychei=s,e.exports=c},4832:function(e,t,r){var n;!function(e,i,a){function o(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function u(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 r=new o(e),n=t&&t.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.alea=s}(0,e=r.nmd(e),r.amdD)},9049:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,i=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>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):r+=e;for(var n=0;n>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.tychei=s}(0,e=r.nmd(e),r.amdD)},8652:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";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:r+=e;for(var n=0;n>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor128=s}(0,e=r.nmd(e),r.amdD)},3618:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.w,i=t.X,a=t.i;return t.w=n=n+1640531527|0,r=i[a+34&127],e=i[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=i[a]=r^e,t.i=a,r+(n^n>>>16)|0},function(e,t){var r,n,i,a,o,u=[],s=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,s=Math.max(s,t.length)),i=0,a=-32;a>>15,n^=n<<4,n^=n>>>13,a>=0&&(o=o+1640531527|0,i=0==(r=u[127&a]^=n+o)?i+1:0);for(i>=128&&(u[127&(t&&t.length||0)]=-1),i=127,a=512;a>0;--a)n=u[i+34&127],r=u[i=i+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,u[i]=n^r;e.w=o,e.X=u,e.i=i}(t,e)}function u(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 r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.X&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor4096=s}(0,e=r.nmd(e),r.amdD)},2030:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.x,i=t.i;return e=n[i],r=(e^=e>>>7)^e<<24,r^=(e=n[i+1&7])^e>>>10,r^=(e=n[i+3&7])^e>>>3,r^=(e=n[i+4&7])^e<<7,e=n[i+7&7],r^=(e^=e<<13)^e<<9,n[i]=r,t.i=i+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function u(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.x&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorshift7=s}(0,e=r.nmd(e),r.amdD)},801:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";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:r+=e;for(var n=0;n>>4),t.next()}function u(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 r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorwow=s}(0,e=r.nmd(e),r.amdD)},1971:function(e,t,r){var n;!function(i,a,o){var u,s=256,c=o.pow(s,6),f=o.pow(2,52),l=2*f,p=s-1;function m(e,t,r){var n=[],p=y(v((t=1==t?{entropy:!0}:t||{}).entropy?[e,g(a)]:null==e?function(){try{var e;return u&&(e=u.randomBytes)?e=e(s):(e=new Uint8Array(s),(i.crypto||i.msCrypto).getRandomValues(e)),g(e)}catch(e){var t=i.navigator,r=t&&t.plugins;return[+new Date,i,r,i.screen,g(a)]}}():e,3),n),m=new h(n),x=function(){for(var e=m.g(6),t=c,r=0;e=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return x.int32=function(){return 0|m.g(4)},x.quick=function(){return m.g(4)/4294967296},x.double=x,y(g(m.S),a),(t.pass||r||function(e,t,r,n){return n&&(n.S&&d(n,m),e.state=function(){return d(m,{})}),r?(o.random=e,t):e})(x,p,"global"in t?t.global:this==o,t.state)}function h(e){var t,r=e.length,n=this,i=0,a=n.i=n.j=0,o=n.S=[];for(r||(e=[r++]);i{function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n{},7061:(e,t,r)=>{var n=r(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,a=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),u=new M(n||[]);return o(a,"_invoke",{value:E(e,r,u)}),a}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var h={};function d(){}function v(){}function y(){}var g={};l(g,s,(function(){return this}));var x=Object.getPrototypeOf,b=x&&x(x(F([])));b&&b!==r&&a.call(b,s)&&(g=b);var w=y.prototype=d.prototype=Object.create(g);function N(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function D(e,t){function r(i,o,u,s){var c=m(e[i],e,o);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==n(l)&&a.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,u,s)}),(function(e){r("throw",e,u,s)})):t.resolve(l).then((function(e){f.value=e,u(f)}),(function(e){return r("throw",e,u,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(a,a):a()}})}function E(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var u=A(o,r);if(u){if(u===h)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=m(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function A(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,A(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=m(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function F(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(u&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:F(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:(e,t,r)=>{var n=r(7061)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},4814:function(e){e.exports=function(){"use strict";function e(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,o=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw o}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:"any",r=t?h(t).index:c.length,n=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:",";return e.map((function(e){return e.name})).join(t)}function w(e){var t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map((function(e){return h(e.trim())})),n=!1,i=t?"...":"";return{types:r.map((function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}function N(t){var r=function(t){if(0===t.length)return[];var r=t.map(h);t.length>1&&r.sort((function(e,t){return e.index-t.index}));var n=r[0].conversionsTo;if(1===t.length)return n;n=n.concat([]);for(var i=new Set(t),a=1;a0,restParam:t.restParam}}function D(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((function(t){return e.typeSet.add(t.name)}))),e.typeSet}function E(e){var t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");var r=e.trim();if(""===r)return t;for(var n=r.split(","),i=0;i=i+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=S(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=S(e[0]),n=S(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(S),function(e){for(var r=0;r0){var r=y(t[o]);return(i=new TypeError("Unexpected type of argument in function "+u+" (expected: "+a.join(" or ")+", actual: "+r.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:u,index:o,actual:r,expected:a},{v:i}}}else s=e};for(o=0;op)return(i=new TypeError("Too many arguments in function "+u+" (expected: "+p+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:u,index:t.length,expectedLength:p},i;for(var m=[],h=0;h0)return 1;var n=k(e)-k(t);return n<0?-1:n>0?1:0}function R(t,r){var n=t.params,i=r.params,a=G(n),o=G(i),u=A(n),s=A(i);if(u&&a.hasAny){if(!s||!o.hasAny)return 1}else if(s&&o.hasAny)return-1;var c,f,l=0,p=0,m=e(n);try{for(m.s();!(f=m.n()).done;)(c=f.value).hasAny&&++l,c.hasConversion&&++p}catch(e){m.e(e)}finally{m.f()}var h,d=0,v=0,y=e(i);try{for(y.s();!(h=y.n()).done;)(c=h.value).hasAny&&++d,c.hasConversion&&++v}catch(e){y.e(e)}finally{y.f()}if(l!==d)return l-d;if(u&&a.hasConversion){if(!s||!o.hasConversion)return 1}else if(s&&o.hasConversion)return-1;if(p!==v)return p-v;if(u){if(!s)return 1}else if(s)return-1;var g=(n.length-i.length)*(u?-1:1);if(0!==g)return g;for(var x,b=[],w=0,N=0;N=f:m?f>=l:f===l}(r,t))throw new TypeError('Conflicting signatures "'+b(r)+'" and "'+b(t)+'".')})),o.push(t);var i=u.length;u.push(r[n]);var a,f=void 0,l=e(j(t.map(N)));try{for(l.s();!(a=l.n()).done;){var p=b(f=a.value);c.push({params:f,name:p,fn:i}),f.every((function(e){return!e.hasConversion}))&&(s[p]=i)}}catch(e){l.e(e)}finally{l.f()}};for(n in r)f();c.sort(R);var l,p=L(u,s,me);for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&(s[l]=p[s[l]]);for(var h=[],d=new Map,v=0,y=c;v{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};return(()=>{"use strict";r.d(n,{default:()=>_y});var e={};function t(e){return t="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},t(e)}function i(e){return"number"==typeof e}function a(e){return!(!e||"object"!==t(e)||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"===t(e.constructor.prototype)&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function o(e){return e&&"object"===t(e)&&!0===Object.getPrototypeOf(e).isComplex||!1}function u(e){return e&&"object"===t(e)&&!0===Object.getPrototypeOf(e).isFraction||!1}function s(e){return e&&!0===e.constructor.prototype.isUnit||!1}function c(e){return"string"==typeof e}r.r(e),r.d(e,{createAbs:()=>ta,createAccessorNode:()=>fp,createAcos:()=>Nf,createAcosh:()=>Lf,createAcot:()=>$f,createAcoth:()=>Gf,createAcsc:()=>Zf,createAcsch:()=>Yf,createAdd:()=>Vl,createAddScalar:()=>oa,createAnd:()=>yc,createApply:()=>na,createApplyTransform:()=>ry,createArg:()=>Zo,createArrayNode:()=>pp,createAsec:()=>Xf,createAsech:()=>Kf,createAsin:()=>tl,createAsinh:()=>rl,createAssignmentNode:()=>bp,createAtan:()=>nl,createAtan2:()=>al,createAtanh:()=>ul,createAtomicMass:()=>_v,createAvogadro:()=>kv,createBellNumbers:()=>id,createBigNumberClass:()=>Ir,createBignumber:()=>hi,createBin:()=>Fs,createBitAnd:()=>jo,createBitNot:()=>Lo,createBitOr:()=>$o,createBitXor:()=>Vo,createBlockNode:()=>Np,createBohrMagneton:()=>mv,createBohrRadius:()=>xv,createBoltzmann:()=>Iv,createBoolean:()=>mi,createCatalan:()=>od,createCbrt:()=>sa,createCeil:()=>ga,createChain:()=>zm,createChainClass:()=>Om,createClassicalElectronRadius:()=>bv,createClone:()=>Fn,createColumn:()=>fu,createColumnTransform:()=>ny,createCombinations:()=>wh,createCombinationsWithRep:()=>Eh,createCompare:()=>xc,createCompareNatural:()=>Dc,createCompareText:()=>Sc,createCompile:()=>nm,createComplex:()=>di,createComplexClass:()=>zr,createComposition:()=>sd,createConcat:()=>uu,createConcatTransform:()=>gy,createConditionalNode:()=>Ep,createConductanceQuantum:()=>hv,createConj:()=>Yo,createConstantNode:()=>_p,createCos:()=>cl,createCosh:()=>ll,createCot:()=>pl,createCoth:()=>hl,createCoulomb:()=>lv,createCount:()=>pu,createCreateUnit:()=>bf,createCross:()=>hu,createCsc:()=>dl,createCsch:()=>yl,createCtranspose:()=>ss,createCube:()=>ba,createCumSum:()=>uh,createCumSumTransform:()=>Ey,createDeepEqual:()=>Gc,createDenseMatrixClass:()=>Cn,createDerivative:()=>Sd,createDet:()=>qm,createDeuteronMass:()=>Sv,createDiag:()=>vu,createDiff:()=>ku,createDiffTransform:()=>by,createDistance:()=>nh,createDivide:()=>th,createDivideScalar:()=>Ps,createDot:()=>Xl,createDotDivide:()=>Ks,createDotMultiply:()=>wo,createDotPow:()=>Xs,createE:()=>Gd,createEfimovFactor:()=>Bv,createEigs:()=>Hm,createElectricConstant:()=>cv,createElectronMass:()=>wv,createElementaryCharge:()=>pv,createEqual:()=>Mc,createEqualScalar:()=>ui,createEqualText:()=>Tc,createErf:()=>vs,createEvaluate:()=>am,createExp:()=>wa,createExpm:()=>Vm,createExpm1:()=>Da,createFactorial:()=>zh,createFalse:()=>jd,createFaraday:()=>Rv,createFermiCoupling:()=>Nv,createFft:()=>ls,createFibonacciHeapClass:()=>nf,createFilter:()=>gu,createFilterTransform:()=>ay,createFineStructure:()=>Dv,createFirstRadiation:()=>zv,createFix:()=>Ca,createFlatten:()=>wu,createFloor:()=>Ta,createForEach:()=>Du,createForEachTransform:()=>uy,createFormat:()=>Ms,createFraction:()=>vi,createFractionClass:()=>jr,createFreqz:()=>Bd,createFunctionAssignmentNode:()=>Rp,createFunctionNode:()=>Kp,createGamma:()=>_h,createGasConstant:()=>jv,createGcd:()=>Ga,createGetMatrixDataType:()=>Su,createGravitationConstant:()=>av,createGravity:()=>Wv,createHartreeEnergy:()=>Ev,createHasNumericValue:()=>Yn,createHelp:()=>Im,createHelpClass:()=>Fm,createHex:()=>Ts,createHypot:()=>Wl,createI:()=>Kd,createIdentity:()=>Mu,createIfft:()=>ms,createIm:()=>Jo,createImmutableDenseMatrixClass:()=>tf,createIndex:()=>ep,createIndexClass:()=>rf,createIndexNode:()=>qp,createIndexTransform:()=>sy,createInfinity:()=>Ld,createIntersect:()=>ih,createInv:()=>jm,createInverseConductanceQuantum:()=>dv,createInvmod:()=>go,createIsInteger:()=>qn,createIsNaN:()=>ti,createIsNegative:()=>Gn,createIsNumeric:()=>Zn,createIsPositive:()=>Xn,createIsPrime:()=>zs,createIsZero:()=>Kn,createKldivergence:()=>jh,createKlitzing:()=>gv,createKron:()=>Ou,createLN10:()=>Wd,createLN2:()=>Zd,createLOG10E:()=>Jd,createLOG2E:()=>Yd,createLarger:()=>jc,createLargerEq:()=>Uc,createLcm:()=>Wa,createLeafCount:()=>fd,createLeftShift:()=>pc,createLgamma:()=>Ih,createLog:()=>Gs,createLog10:()=>Ja,createLog1p:()=>Zs,createLog2:()=>Qa,createLoschmidt:()=>qv,createLsolve:()=>rc,createLsolveAll:()=>oc,createLup:()=>cm,createLusolve:()=>Sm,createLyap:()=>eh,createMad:()=>ph,createMagneticConstant:()=>sv,createMagneticFluxQuantum:()=>vv,createMap:()=>Tu,createMapTransform:()=>cy,createMatrix:()=>gi,createMatrixClass:()=>Lr,createMatrixFromColumns:()=>Si,createMatrixFromFunction:()=>bi,createMatrixFromRows:()=>Di,createMax:()=>Kc,createMaxTransform:()=>py,createMean:()=>ch,createMeanTransform:()=>my,createMedian:()=>lh,createMin:()=>ef,createMinTransform:()=>hy,createMod:()=>to,createMode:()=>Ds,createMolarMass:()=>Vv,createMolarMassC12:()=>Zv,createMolarPlanckConstant:()=>Pv,createMolarVolume:()=>Lv,createMultinomial:()=>Lh,createMultiply:()=>io,createMultiplyScalar:()=>ro,createNaN:()=>Ud,createNeutronMass:()=>Cv,createNode:()=>rp,createNorm:()=>Jl,createNot:()=>nu,createNthRoot:()=>oo,createNthRoots:()=>Ys,createNuclearMagneton:()=>yv,createNull:()=>Pd,createNumber:()=>ci,createNumeric:()=>qs,createObjectNode:()=>Pp,createOct:()=>Os,createOnes:()=>Iu,createOperatorNode:()=>Up,createOr:()=>iu,createParenthesisNode:()=>Hp,createParse:()=>tm,createParser:()=>sm,createParserClass:()=>om,createPartitionSelect:()=>Jc,createPermutations:()=>$h,createPhi:()=>Vd,createPi:()=>$d,createPickRandom:()=>Yh,createPinv:()=>Lm,createPlanckCharge:()=>Qv,createPlanckConstant:()=>ov,createPlanckLength:()=>Yv,createPlanckMass:()=>Jv,createPlanckTemperature:()=>Kv,createPlanckTime:()=>Xv,createPolynomialRoot:()=>Mm,createPow:()=>Ls,createPrint:()=>_s,createProd:()=>Ss,createProtonMass:()=>Av,createQr:()=>fm,createQuantileSeq:()=>vh,createQuantumOfCirculation:()=>Mv,createRandom:()=>Qh,createRandomInt:()=>ed,createRange:()=>Pu,createRangeClass:()=>Pr,createRangeNode:()=>Vp,createRangeTransform:()=>dy,createRationalize:()=>Md,createRe:()=>Xo,createReducedPlanckConstant:()=>uv,createRelationalNode:()=>Wp,createReplacer:()=>kd,createReshape:()=>Uu,createResize:()=>$u,createResolve:()=>Nd,createResultSet:()=>Qe,createReviver:()=>_d,createRightArithShift:()=>hc,createRightLogShift:()=>vc,createRotate:()=>Gu,createRotationMatrix:()=>Zu,createRound:()=>Hs,createRow:()=>Wu,createRowTransform:()=>vy,createRydberg:()=>Fv,createSQRT1_2:()=>Xd,createSQRT2:()=>Qd,createSackurTetrode:()=>Uv,createSchur:()=>Qm,createSec:()=>gl,createSech:()=>bl,createSecondRadiation:()=>$v,createSetCartesian:()=>Cl,createSetDifference:()=>Fl,createSetDistinct:()=>Tl,createSetIntersect:()=>_l,createSetIsSubset:()=>Il,createSetMultiplicity:()=>zl,createSetPowerset:()=>jl,createSetSize:()=>Ll,createSetSymDifference:()=>$l,createSetUnion:()=>Gl,createSign:()=>so,createSimplify:()=>vd,createSimplifyConstant:()=>xd,createSimplifyCore:()=>wd,createSin:()=>wl,createSinh:()=>Dl,createSize:()=>Ju,createSlu:()=>Dm,createSmaller:()=>_c,createSmallerEq:()=>Rc,createSolveODE:()=>ds,createSort:()=>Qc,createSpaClass:()=>af,createSparse:()=>gf,createSparseMatrixClass:()=>si,createSpeedOfLight:()=>iv,createSplitUnit:()=>Mi,createSqrt:()=>co,createSqrtm:()=>Wm,createSquare:()=>lo,createSqueeze:()=>Qu,createStd:()=>yh,createStdTransform:()=>wy,createStefanBoltzmann:()=>Hv,createStirlingS2:()=>rd,createString:()=>li,createSubset:()=>es,createSubsetTransform:()=>yy,createSubtract:()=>mo,createSum:()=>ah,createSumTransform:()=>Ny,createSylvester:()=>Jm,createSymbolNode:()=>Yp,createSymbolicEqual:()=>Ed,createTan:()=>El,createTanh:()=>Al,createTau:()=>Hd,createThomsonCrossSection:()=>Ov,createTo:()=>Is,createTrace:()=>Ql,createTranspose:()=>os,createTrue:()=>qd,createTypeOf:()=>ni,createTyped:()=>Ve,createUnaryMinus:()=>Qi,createUnaryPlus:()=>ea,createUnequal:()=>Zc,createUnitClass:()=>hf,createUnitFunction:()=>vf,createUppercaseE:()=>tv,createUppercasePi:()=>ev,createUsolve:()=>ic,createUsolveAll:()=>sc,createVacuumImpedance:()=>fv,createVariance:()=>dh,createVarianceTransform:()=>Sy,createVersion:()=>rv,createWeakMixingAngle:()=>Tv,createWienDisplacement:()=>Gv,createXgcd:()=>vo,createXor:()=>au,createZeros:()=>fs,createZpk2tf:()=>Od}),r(4916),r(7601),r(9653),r(6699),r(5212),r(1539),r(2023),r(489),r(9753),r(3710),r(4603),r(8450),r(8386),r(9714),r(8309);var f=Array.isArray;function l(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function p(e){return Array.isArray(e)||l(e)}function m(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function h(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function d(e){return e&&!0===e.constructor.prototype.isRange||!1}function v(e){return e&&!0===e.constructor.prototype.isIndex||!1}function y(e){return"boolean"==typeof e}function g(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function x(e){return e&&!0===e.constructor.prototype.isHelp||!1}function b(e){return"function"==typeof e}function w(e){return e instanceof Date}function N(e){return e instanceof RegExp}function D(e){return!(!e||"object"!==t(e)||e.constructor!==Object||o(e)||u(e))}function E(e){return null===e}function A(e){return void 0===e}function S(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function C(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function M(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function O(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function B(e){return T(e)||q(e)&&1===e.args.length&&T(e.args[0])&&"-+~".includes(e.op)}function _(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function k(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function I(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function R(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function z(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function q(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function j(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function U(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.constructor.prototype.isChain||!1}function H(e){var r=t(e);return"object"===r?null===e?"null":a(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}var G=r(4814);function V(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}r(2420),r(4914),r(658),r(197),r(3484),r(5890),r(2222),r(5306),r(4723),r(4678),r(2772),r(1249),r(1058),r(9600),r(7042),r(561),r(3299),r(9752),r(2376),r(3181),r(8621),r(160),r(970);var Z=Math.sign||function(e){return e>0?1:e<0?-1:0},W=Math.log2||function(e){return Math.log(e)/Math.LN2},Y=Math.log10||function(e){return Math.log(e)/Math.LN10},J=Math.log1p||function(e){return Math.log(e+1)},X=Math.cbrt||function(e){if(0===e)return e;var t,r=e<0;return r&&(e=-e),t=isFinite(e)?(e/((t=Math.exp(Math.log(e)/3))*t)+2*t)/3:e,r?-t:t},Q=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function K(e,t,r){var n={2:"0b",8:"0o",16:"0x"}[t],i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!V(r))throw new Error("size must be an integer");if(e>Math.pow(2,r-1)-1||e<-Math.pow(2,r-1))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!V(e))throw new Error("Value must be an integer");e<0&&(e+=Math.pow(2,r)),i="i".concat(r)}var a="";return e<0&&(e=-e,a="-"),"".concat(a).concat(n).concat(e.toString(t)).concat(i)}function ee(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";var r,n,a="auto";if(t&&(t.notation&&(a=t.notation),i(t)?r=t:i(t.precision)&&(r=t.precision),t.wordSize&&"number"!=typeof(n=t.wordSize)))throw new Error('Option "wordSize" must be a number');switch(a){case"fixed":return re(e,r);case"exponential":return ne(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=ie(te(e),t),n=r.exponent,a=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(i(t))for(;t>a.length||n-o+1>a.length;)a.push(0);else for(var u=Math.abs(n-o)-(a.length-1),s=0;s0;)f++,c--;var l=a.slice(f).join(""),p=i(t)&&l.length||l.match(/[1-9]/)?"."+l:"",m=a.slice(0,f).join("")+p+"e"+(n>=0?"+":"")+o.toString();return r.sign+m}(e,r);case"bin":return K(e,2,n);case"oct":return K(e,8,n);case"hex":return K(e,16,n);case"auto":return function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,a=te(e),o=t?ie(a,t):a;if(o.exponent=i)return ne(e,t);var u=o.coefficients,s=o.exponent;u.length0?s:0;return c<(u=ae(-s).concat(u)).length-1&&u.splice(c+1,0,"."),o.sign+u.join("")}(e,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,(function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t}));default:throw new Error('Unknown notation "'+a+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function te(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===o.length&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function re(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=te(e),n="number"==typeof t?ie(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,o=a+(t||0);return i.length0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ie(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),n[--i]++}return r}function ae(e){for(var t=[],r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function je(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?t-1:0),n=1;n15)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 r||We(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||We(e),new r(e.toNumber(),0)}},{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 r||We(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){B||Ye(e);var t=new B(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){var 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||Ze(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){B||Ye(e);try{return new B(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||We(e);try{return new r(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||Ze(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return B||Ye(e),new B(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),H.onMismatch=function(e,t,r){var n=H.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&p(t[0])&&r.some((function(e){return!e.params.includes(",")}))){var i=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},H.onMismatch=function(e,t,r){var n=H.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&p(t[0])&&r.some((function(e){return!e.params.includes(",")}))){var i=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},H}));function Ze(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function We(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function Ye(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}r(5735),r(3753);var Je,Xe,Qe=Ee("ResultSet",[],(function(){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.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e}),{isClass:!0}),Ke=(r(8011),9e15),et=1e9,tt="0123456789abcdef",rt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",nt="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",it={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ke,maxE:Ke,crypto:!1},at=!0,ot="[DecimalError] ",ut=ot+"Invalid argument: ",st=ot+"Precision limit exceeded",ct=ot+"crypto unavailable",ft="[object Decimal]",lt=Math.floor,pt=Math.pow,mt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ht=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,dt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,vt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,yt=1e7,gt=7,xt=rt.length-1,bt=nt.length-1,wt={toStringTag:ft};function Nt(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;tr)throw Error(ut+e)}function Et(e,t,r,n){var i,a,o,u;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=gt,i=0):(i=Math.ceil((t+1)/gt),t%=gt),a=pt(10,gt-t),u=e[i]%a|0,null==n?t<3?(0==t?u=u/100|0:1==t&&(u=u/10|0),o=r<4&&99999==u||r>3&&49999==u||5e4==u||0==u):o=(r<4&&u+1==a||r>3&&u+1==a/2)&&(e[i+1]/a/100|0)==pt(10,t-2)-1||(u==a/2||0==u)&&0==(e[i+1]/a/100|0):t<4?(0==t?u=u/1e3|0:1==t?u=u/100|0:2==t&&(u=u/10|0),o=(n||r<4)&&9999==u||!n&&r>3&&4999==u):o=((n||r<4)&&u+1==a||!n&&r>3&&u+1==a/2)&&(e[i+1]/a/1e3|0)==pt(10,t-3)-1,o}function At(e,t,r){for(var n,i,a=[0],o=0,u=e.length;or-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}wt.absoluteValue=wt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ct(e)},wt.ceil=function(){return Ct(new this.constructor(this),this.e+1,2)},wt.clampedTo=wt.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(ut+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},wt.comparedTo=wt.cmp=function(e){var t,r,n,i,a=this,o=a.d,u=(e=new a.constructor(e)).d,s=a.s,c=e.s;if(!o||!u)return s&&c?s!==c?s:o===u?0:!o^s<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?s:u[0]?-c:0;if(s!==c)return s;if(a.e!==e.e)return a.e>e.e^s<0?1:-1;for(t=0,r=(n=o.length)<(i=u.length)?n:i;tu[t]^s<0?1:-1;return n===i?0:n>i^s<0?1:-1},wt.cosine=wt.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+gt,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/$t(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Ut(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}(n,Ht(n,r)),n.precision=e,n.rounding=t,Ct(2==Xe||3==Xe?r.neg():r,e,t,!0)):new n(1):new n(NaN)},wt.cubeRoot=wt.cbrt=function(){var e,t,r,n,i,a,o,u,s,c,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(at=!1,(a=f.s*pt(f.s*f,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=Nt(f.d),(a=((e=f.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=pt(r,1/3),e=lt((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=f.s),o=(e=l.precision)+3;;)if(c=(s=(u=n).times(u).times(u)).plus(f),n=St(c.plus(f).times(u),c.plus(s),o+2,1),Nt(u.d).slice(0,o)===(r=Nt(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(Ct(n,e+1,1),t=!n.times(n).times(n).eq(f));break}if(!i&&(Ct(u,e+1,0),u.times(u).times(u).eq(f))){n=u;break}o+=4,i=1}return at=!0,Ct(n,e,l.rounding,t)},wt.decimalPlaces=wt.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-lt(this.e/gt))*gt,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},wt.dividedBy=wt.div=function(e){return St(this,new this.constructor(e))},wt.dividedToIntegerBy=wt.divToInt=function(e){var t=this.constructor;return Ct(St(this,new t(e),0,1,1),t.precision,t.rounding)},wt.equals=wt.eq=function(e){return 0===this.cmp(e)},wt.floor=function(){return Ct(new this.constructor(this),this.e+1,3)},wt.greaterThan=wt.gt=function(e){return this.cmp(e)>0},wt.greaterThanOrEqualTo=wt.gte=function(e){var t=this.cmp(e);return 1==t||0===t},wt.hyperbolicCosine=wt.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,u=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return u;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?t=(1/$t(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=Ut(o,1,a.times(t),new o(1),!0);for(var s,c=e,f=new o(8);c--;)s=a.times(a),a=u.minus(s.times(f.minus(s.times(f))));return Ct(a,o.precision=r,o.rounding=n,!0)},wt.hyperbolicSine=wt.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=Ut(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=Ut(a,2,i=i.times(1/$t(5,e)),i,!0);for(var o,u=new a(5),s=new a(16),c=new a(20);e--;)o=i.times(i),i=i.times(u.plus(o.times(s.times(o).plus(c))))}return a.precision=t,a.rounding=r,Ct(i,t,r,!0)},wt.hyperbolicTangent=wt.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,St(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},wt.inverseCosine=wt.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,a=r.rounding;return-1!==n?0===n?t.isNeg()?Tt(r,i,a):new r(0):new r(NaN):t.isZero()?Tt(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Tt(r,i+4,a).times(.5),r.precision=i,r.rounding=a,e.minus(t))},wt.inverseHyperbolicCosine=wt.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},wt.inverseHyperbolicSine=wt.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln())},wt.inverseHyperbolicTangent=wt.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Ct(new a(i),e,t,!0):(a.precision=r=n-i.e,i=St(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},wt.inverseSine=wt.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=Tt(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},wt.inverseTangent=wt.atan=function(){var e,t,r,n,i,a,o,u,s,c=this,f=c.constructor,l=f.precision,p=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&l+4<=bt)return(o=Tt(f,l+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new f(NaN);if(l+4<=bt)return(o=Tt(f,l+4,p).times(.5)).s=c.s,o}for(f.precision=u=l+10,f.rounding=1,e=r=Math.min(28,u/gt+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(at=!1,t=Math.ceil(u/gt),n=1,s=c.times(c),o=new f(c),i=c;-1!==e;)if(i=i.times(s),a=o.minus(i.div(n+=2)),i=i.times(s),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<this.d.length-2},wt.isNaN=function(){return!this.s},wt.isNegative=wt.isNeg=function(){return this.s<0},wt.isPositive=wt.isPos=function(){return this.s>0},wt.isZero=function(){return!!this.d&&0===this.d[0]},wt.lessThan=wt.lt=function(e){return this.cmp(e)<0},wt.lessThanOrEqualTo=wt.lte=function(e){return this.cmp(e)<1},wt.logarithm=wt.log=function(e){var t,r,n,i,a,o,u,s,c=this,f=c.constructor,l=f.precision,p=f.rounding;if(null==e)e=new f(10),t=!0;else{if(r=(e=new f(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new f(NaN);t=e.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new f(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(at=!1,o=qt(c,u=l+5),n=t?Ot(f,u+10):qt(e,u),Et((s=St(o,n,u,1)).d,i=l,p))do{if(o=qt(c,u+=10),n=t?Ot(f,u+10):qt(e,u),s=St(o,n,u,1),!a){+Nt(s.d).slice(i+1,i+15)+1==1e14&&(s=Ct(s,l+1,0));break}}while(Et(s.d,i+=10,p));return at=!0,Ct(s,l,p)},wt.minus=wt.sub=function(e){var t,r,n,i,a,o,u,s,c,f,l,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,u=h.precision,s=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===s?-0:0);e=new h(m)}return at?Ct(e,u,s):e}if(r=lt(e.e/gt),f=lt(m.e/gt),c=c.slice(),a=f-r){for((l=a<0)?(t=c,a=-a,o=p.length):(t=p,r=f,o=c.length),a>(n=Math.max(Math.ceil(u/gt),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=c.length)<(o=p.length))&&(o=n),n=0;n0;--n)c[o++]=0;for(n=p.length;n>a;){if(c[--n](o=(a=Math.ceil(u/gt))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=c.length)-(i=f.length)<0&&(i=o,r=f,f=c,c=r),t=0;i;)t=(c[--i]=c[i]+f[i]+t)/yt|0,c[i]%=yt;for(t&&(c.unshift(t),++n),o=c.length;0==c[--o];)c.pop();return e.d=c,e.e=Ft(c,n),at?Ct(e,u,s):e},wt.precision=wt.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(ut+e);return r.d?(t=Bt(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},wt.round=function(){var e=this,t=e.constructor;return Ct(new t(e),e.e+1,t.rounding)},wt.sine=wt.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+gt,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Ut(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=Ut(e,2,t=t.times(1/$t(5,r)),t);for(var i,a=new e(5),o=new e(16),u=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(u))));return t}(n,Ht(n,r)),n.precision=e,n.rounding=t,Ct(Xe>2?r.neg():r,e,t,!0)):new n(NaN)},wt.squareRoot=wt.sqrt=function(){var e,t,r,n,i,a,o=this,u=o.d,s=o.e,c=o.s,f=o.constructor;if(1!==c||!u||!u[0])return new f(!c||c<0&&(!u||u[0])?NaN:u?o:1/0);for(at=!1,0==(c=Math.sqrt(+o))||c==1/0?(((t=Nt(u)).length+s)%2==0&&(t+="0"),c=Math.sqrt(t),s=lt((s+1)/2)-(s<0||s%2),n=new f(t=c==1/0?"5e"+s:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+s)):n=new f(c.toString()),r=(s=f.precision)+3;;)if(n=(a=n).plus(St(o,a,r+2,1)).times(.5),Nt(a.d).slice(0,r)===(t=Nt(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Ct(n,s+1,1),e=!n.times(n).eq(o));break}if(!i&&(Ct(a,s+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return at=!0,Ct(n,s,f.rounding,e)},wt.tangent=wt.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=St(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Ct(2==Xe||4==Xe?r.neg():r,e,t,!0)):new n(NaN)},wt.times=wt.mul=function(e){var t,r,n,i,a,o,u,s,c,f=this,l=f.constructor,p=f.d,m=(e=new l(e)).d;if(e.s*=f.s,!(p&&p[0]&&m&&m[0]))return new l(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(r=lt(f.e/gt)+lt(e.e/gt),(s=p.length)<(c=m.length)&&(a=p,p=m,m=a,o=s,s=c,c=o),a=[],n=o=s+c;n--;)a.push(0);for(n=c;--n>=0;){for(t=0,i=s+n;i>n;)u=a[i]+m[n]*p[i-n-1]+t,a[i--]=u%yt|0,t=u/yt|0;a[i]=(a[i]+t)%yt|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=Ft(a,r),at?Ct(e,l.precision,l.rounding):e},wt.toBinary=function(e,t){return Gt(this,2,e,t)},wt.toDecimalPlaces=wt.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(Dt(e,0,et),void 0===t?t=n.rounding:Dt(t,0,8),Ct(r,e+r.e+1,t))},wt.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=Mt(n,!0):(Dt(e,0,et),void 0===t?t=i.rounding:Dt(t,0,8),r=Mt(n=Ct(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},wt.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=Mt(i):(Dt(e,0,et),void 0===t?t=a.rounding:Dt(t,0,8),r=Mt(n=Ct(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},wt.toFraction=function(e){var t,r,n,i,a,o,u,s,c,f,l,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=r=new d(1),n=s=new d(0),o=(a=(t=new d(n)).e=Bt(h)-m.e-1)%gt,t.d[0]=pt(10,o<0?gt+o:o),null==e)e=a>0?t:c;else{if(!(u=new d(e)).isInt()||u.lt(c))throw Error(ut+u);e=u.gt(t)?a>0?t:c:u}for(at=!1,u=new d(Nt(h)),f=d.precision,d.precision=a=h.length*gt*2;l=St(u,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=c,c=s.plus(l.times(i)),s=i,i=t,t=u.minus(l.times(i)),u=i;return i=St(e.minus(r),n,0,1,1),s=s.plus(i.times(c)),r=r.plus(i.times(n)),s.s=c.s=m.s,p=St(c,n,a,1).minus(m).abs().cmp(St(s,r,a,1).minus(m).abs())<1?[c,n]:[s,r],d.precision=f,at=!0,p},wt.toHexadecimal=wt.toHex=function(e,t){return Gt(this,16,e,t)},wt.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:Dt(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(at=!1,r=St(r,e,0,t,1).times(e),at=!0,Ct(r)):(e.s=r.s,r=e),r},wt.toNumber=function(){return+this},wt.toOctal=function(e,t){return Gt(this,8,e,t)},wt.toPower=wt.pow=function(e){var t,r,n,i,a,o,u=this,s=u.constructor,c=+(e=new s(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new s(pt(+u,c));if((u=new s(u)).eq(1))return u;if(n=s.precision,a=s.rounding,e.eq(1))return Ct(u,n,a);if((t=lt(e.e/gt))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=kt(s,u,r,n),e.s<0?new s(1).div(i):Ct(i,n,a);if((o=u.s)<0){if(ts.maxE+1||t0?o/0:0):(at=!1,s.rounding=u.s=1,r=Math.min(12,(t+"").length),(i=zt(e.times(qt(u,n+r)),n)).d&&Et((i=Ct(i,n+5,1)).d,n,a)&&(t=n+10,+Nt((i=Ct(zt(e.times(qt(u,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=Ct(i,n+1,0))),i.s=o,at=!0,s.rounding=a,Ct(i,n,a))},wt.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=Mt(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Dt(e,1,et),void 0===t?t=i.rounding:Dt(t,0,8),r=Mt(n=Ct(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},wt.toSignificantDigits=wt.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(Dt(e,1,et),void 0===t?t=r.rounding:Dt(t,0,8)),Ct(new r(this),e,t)},wt.toString=function(){var e=this,t=e.constructor,r=Mt(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},wt.truncated=wt.trunc=function(){return Ct(new this.constructor(this),this.e+1,1)},wt.valueOf=wt.toJSON=function(){var e=this,t=e.constructor,r=Mt(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var St=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;)e.shift()}return function(n,i,a,o,u,s){var c,f,l,p,m,h,d,v,y,g,x,b,w,N,D,E,A,S,C,M,F=n.constructor,O=n.s==i.s?1:-1,T=n.d,B=i.d;if(!(T&&T[0]&&B&&B[0]))return new F(n.s&&i.s&&(T?!B||T[0]!=B[0]:B)?T&&0==T[0]||!B?0*O:O/0:NaN);for(s?(m=1,f=n.e-i.e):(s=yt,m=gt,f=lt(n.e/m)-lt(i.e/m)),C=B.length,A=T.length,g=(y=new F(O)).d=[],l=0;B[l]==(T[l]||0);l++);if(B[l]>(T[l]||0)&&f--,null==a?(N=a=F.precision,o=F.rounding):N=u?a+(n.e-i.e)+1:a,N<0)g.push(1),h=!0;else{if(N=N/m+2|0,l=0,1==C){for(p=0,B=B[0],N++;(l1&&(B=e(B,p,s),T=e(T,p,s),C=B.length,A=T.length),E=C,b=(x=T.slice(0,C)).length;b=s/2&&++S;do{p=0,(c=t(B,x,C,b))<0?(w=x[0],C!=b&&(w=w*s+(x[1]||0)),(p=w/S|0)>1?(p>=s&&(p=s-1),1==(c=t(d=e(B,p,s),x,v=d.length,b=x.length))&&(p--,r(d,C=10;p/=10)l++;y.e=l+f*m-1,Ct(y,u?a+y.e+1:a,o,h)}return y}}();function Ct(e,t,r,n){var i,a,o,u,s,c,f,l,p,m=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,u=l[0];u>=10;u/=10)i++;if((a=t-i)<0)a+=gt,o=t,s=(f=l[p=0])/pt(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/gt))>=(u=l.length)){if(!n)break e;for(;u++<=p;)l.push(0);f=s=0,i=1,o=(a%=gt)-gt+1}else{for(f=u=l[p],i=1;u>=10;u/=10)i++;s=(o=(a%=gt)-gt+i)<0?0:f/pt(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?f:f%pt(10,i-o-1)),c=r<4?(s||n)&&(0==r||r==(e.s<0?3:2)):s>5||5==s&&(4==r||n||6==r&&(a>0?o>0?f/pt(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,c?(t-=e.e+1,l[0]=pt(10,(gt-t%gt)%gt),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,u=1,p--):(l.length=p+1,u=pt(10,gt-a),l[p]=o>0?(f/pt(10,i-o)%pt(10,o)|0)*u:0),c)for(;;){if(0==p){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=u,u=1;o>=10;o/=10)u++;a!=u&&(e.e++,l[0]==yt&&(l[0]=1));break}if(l[p]+=u,l[p]!=yt)break;l[p--]=0,u=1}for(a=l.length;0===l[--a];)l.pop()}return at&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e0?a=a.charAt(0)+"."+a.slice(1)+_t(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+_t(-i-1)+a,r&&(n=r-o)>0&&(a+=_t(n))):i>=o?(a+=_t(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+_t(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=_t(n))),a}function Ft(e,t){var r=e[0];for(t*=gt;r>=10;r/=10)t++;return t}function Ot(e,t,r){if(t>xt)throw at=!0,r&&(e.precision=r),Error(st);return Ct(new e(rt),t,1,!0)}function Tt(e,t,r){if(t>bt)throw Error(st);return Ct(new e(nt),t,r,!0)}function Bt(e){var t=e.length-1,r=t*gt+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function _t(e){for(var t="";e--;)t+="0";return t}function kt(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/gt+4);for(at=!1;;){if(r%2&&Vt((a=a.times(t)).d,o)&&(i=!0),0===(r=lt(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}Vt((t=t.times(t)).d,o)}return at=!0,a}function It(e){return 1&e.d[e.d.length-1]}function Rt(e,t,r){for(var n,i=new e(t[0]),a=0;++a17)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?(at=!1,s=h):s=t,u=new p(.03125);e.e>-2;)e=e.times(u),l+=5;for(s+=n=Math.log(pt(2,l))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=s;;){if(a=Ct(a.times(e),s,1),r=r.times(++f),Nt((u=o.plus(St(a,r,s,1))).d).slice(0,s)===Nt(o.d).slice(0,s)){for(i=l;i--;)o=Ct(o.times(o),s,1);if(null!=t)return p.precision=h,o;if(!(c<3&&Et(o.d,s-n,m,c)))return Ct(o,p.precision=h,m,at=!0);p.precision=s+=10,r=a=u=new p(1),f=0,c++}o=u}}function qt(e,t){var r,n,i,a,o,u,s,c,f,l,p,m=1,h=e,d=h.d,v=h.constructor,y=v.rounding,g=v.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new v(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(null==t?(at=!1,f=g):f=t,v.precision=f+=10,n=(r=Nt(d)).charAt(0),!(Math.abs(a=h.e)<15e14))return c=Ot(v,f+2,g).times(a+""),h=qt(new v(n+"."+r.slice(1)),f-10).plus(c),v.precision=g,null==t?Ct(h,g,y,at=!0):h;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=Nt((h=h.times(e)).d)).charAt(0),m++;for(a=h.e,n>1?(h=new v("0."+r),a++):h=new v(n+"."+r.slice(1)),l=h,s=o=h=St(h.minus(1),h.plus(1),f,1),p=Ct(h.times(h),f,1),i=3;;){if(o=Ct(o.times(p),f,1),Nt((c=s.plus(St(o,new v(i),f,1))).d).slice(0,f)===Nt(s.d).slice(0,f)){if(s=s.times(2),0!==a&&(s=s.plus(Ot(v,f+2,g).times(a+""))),s=St(s,new v(m),f,1),null!=t)return v.precision=g,s;if(!Et(s.d,f-10,y,u))return Ct(s,v.precision=g,y,at=!0);v.precision=f+=10,c=o=h=St(l.minus(1),l.plus(1),f,1),p=Ct(h.times(h),f,1),i=u=1}s=c,i+=2}}function jt(e){return String(e.s*e.s/0)}function Pt(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%gt,r<0&&(n+=gt),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),vt.test(t))return Pt(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ht.test(t))r=16,t=t.toLowerCase();else if(mt.test(t))r=2;else{if(!dt.test(t))throw Error(ut+t);r=8}for((a=t.search(/p/i))>0?(s=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),o=(a=t.indexOf("."))>=0,n=e.constructor,o&&(a=(u=(t=t.replace(".","")).length)-a,i=kt(n,new n(r),a,2*a)),a=f=(c=At(t,r,yt)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=Ft(c,f),e.d=c,at=!1,o&&(e=St(e,i,4*u)),s&&(e=e.times(Math.abs(s)<54?pt(2,s):_r.pow(2,s))),at=!0,e)}function Ut(e,t,r,n,i){var a,o,u,s,c=e.precision,f=Math.ceil(c/gt);for(at=!1,s=r.times(r),u=new e(n);;){if(o=St(u.times(s),new e(t++*t++),c,1),u=i?n.plus(o):n.minus(o),n=St(o.times(s),new e(t++*t++),c,1),void 0!==(o=u.plus(n)).d[f]){for(a=f;o.d[a]===u.d[a]&&a--;);if(-1==a)break}a=u,u=n,n=o,o=a}return at=!0,o.d.length=f+1,o}function $t(e,t){for(var r=e;--t;)r*=e;return r}function Ht(e,t){var r,n=t.s<0,i=Tt(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return Xe=n?4:1,t;if((r=t.divToInt(i)).isZero())Xe=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return Xe=It(r)?n?2:3:n?4:1,t;Xe=It(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Gt(e,t,r,n){var i,a,o,u,s,c,f,l,p,m=e.constructor,h=void 0!==r;if(h?(Dt(r,1,et),void 0===n?n=m.rounding:Dt(n,0,8)):(r=m.precision,n=m.rounding),e.isFinite()){for(h?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(o=(f=Mt(e)).indexOf("."))>=0&&(f=f.replace(".",""),(p=new m(1)).e=f.length-o,p.d=At(Mt(p),10,i),p.e=p.d.length),a=s=(l=At(f,10,i)).length;0==l[--s];)l.pop();if(l[0]){if(o<0?a--:((e=new m(e)).d=l,e.e=a,l=(e=St(e,p,r,n,0,i)).d,a=e.e,c=Je),o=l[r],u=i/2,c=c||void 0!==l[r+1],c=n<4?(void 0!==o||c)&&(0===n||n===(e.s<0?3:2)):o>u||o===u&&(4===n||c||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,c)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(s=l.length;!l[s-1];--s);for(o=0,f="";o1)if(16==t||8==t){for(o=16==t?4:3,--s;s%o;s++)f+="0";for(s=(l=At(f,i,t)).length;!l[s-1];--s);for(o=1,f="1.";os)for(a-=s;a--;)f+="0";else at)return e.length=t,!0}function Zt(e){return new this(e).abs()}function Wt(e){return new this(e).acos()}function Yt(e){return new this(e).acosh()}function Jt(e,t){return new this(e).plus(t)}function Xt(e){return new this(e).asin()}function Qt(e){return new this(e).asinh()}function Kt(e){return new this(e).atan()}function er(e){return new this(e).atanh()}function tr(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?Tt(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=Tt(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(St(e,t,a,1)),t=Tt(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(St(e,t,a,1)):(r=Tt(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function rr(e){return new this(e).cbrt()}function nr(e){return Ct(e=new this(e),e.e+1,2)}function ir(e,t,r){return new this(e).clamp(t,r)}function ar(e){if(!e||"object"!=typeof e)throw Error(ot+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,et,"rounding",0,8,"toExpNeg",-Ke,0,"toExpPos",0,Ke,"maxE",0,Ke,"minE",-Ke,0,"modulo",0,9];for(t=0;t=a[t+1]&&n<=a[t+2]))throw Error(ut+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=it[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(ut+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(ct);this[r]=!0}else this[r]=!1}return this}function or(e){return new this(e).cos()}function ur(e){return new this(e).cosh()}function sr(e,t){return new this(e).div(t)}function cr(e){return new this(e).exp()}function fr(e){return Ct(e=new this(e),e.e+1,3)}function lr(){var e,t,r=new this(0);for(at=!1,e=0;e=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:u[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(ct);for(t=crypto.randomBytes(n*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(u.push(i%1e7),a+=4);a=n/4}else for(;a=10;i/=10)n++;na.maxE?(i.e=NaN,i.d=null):e.e=10;r/=10)t++;return void(at?t>a.maxE?(i.e=NaN,i.d=null):tt.re?1:e.ret.im?1:e.im0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){var t=this.start,r=this.step,n=this.end,i=0;if(r>0)for(;tn;)e(t,[i],this),t+=r,i++},e.prototype.map=function(e){var t=[];return this.forEach((function(r,n,i){t[n[0]]=e(r,n,i)})),t},e.prototype.toArray=function(){var e=[];return this.forEach((function(t,r){e[r[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var t=ee(this.start,e);return 1!==this.step&&(t+=":"+ee(this.step,e)),t+":"+ee(this.end,e)},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0})),Lr=Ee("Matrix",[],(function(){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,r){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,r){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}),Ur=r(4687);function $r(e,t,r){var n=new(0,e.constructor)(2),i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!V(r))throw new Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(t," not supported "))}}function Hr(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function Gr(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function Vr(e,r){var n=function(e,r){return"number"==typeof e?ee(e,r):a(e)?function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n,i="auto";if(void 0!==t&&(t.notation&&(i=t.notation),"number"==typeof t?r=t:void 0!==t.precision&&(r=t.precision),t.wordSize&&"number"!=typeof(n=t.wordSize)))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return function(e,t){return e.toFixed(t)}(e,r);case"exponential":return Hr(e,r);case"engineering":return function(e,t){var r=e.e,n=r%3==0?r:r<0?r-3-r%3:r-r%3,i=e.mul(Math.pow(10,-n)).toPrecision(t);return-1!==i.indexOf("e")&&(i=new(0,e.constructor)(i).toFixed()),i+"e"+(r>=0?"+":"")+n.toString()}(e,r);case"bin":return $r(e,2,n);case"oct":return $r(e,8,n);case"hex":return $r(e,16,n);case"auto":var a=t&&void 0!==t.lowerExp?t.lowerExp:-3,o=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var u=e.toSignificantDigits(r),s=u.e;return(s>=a&&sr.truncate?n.substring(0,r.truncate-3)+"...":n}function Zr(e){for(var t=String(e),r="",n=0;n/g,">")}function Yr(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,i=0;it?1:-1}function Xr(e,t,r){if(!(this instanceof Xr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function Qr(e,t,r){if(!(this instanceof Qr))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=r),void 0!==this.min&&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 Kr(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function en(e,t,r){var n,i=e.length;if(i!==t[r])throw new Xr(i,t[r]);if(r")}function tn(e,t){if(0===t.length){if(Array.isArray(e))throw new Xr(e.length,0)}else en(e,t,0)}function rn(e,t){if(!i(e)||!V(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new Qr(e,t)}function nn(e,t,r){if(!Array.isArray(e)||!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(!i(e)||!V(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Vr(t)+")")})),an(e,t,0,void 0!==r?r:0),e}function an(e,t,r,n){var i,a,o=e.length,u=t[r],s=Math.min(o,u);if(e.length=u,r=0){if(t%r!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);n[i]=-t/r}return n}function sn(e){return e.reduce((function(e,t){return e*t}),1)}function cn(e,t){for(var r=t||Kr(e);Array.isArray(e)&&1===e.length;)e=e[0],r.shift();for(var n=r.length;1===r[n-1];)n--;return n1&&void 0!==arguments[1]?arguments[1]:{},n=r.hasher,i=r.limit;return i=null==i?Number.POSITIVE_INFINITY:i,n=null==n?JSON.stringify:n,function r(){"object"!==t(r.cache)&&(r.cache={values:new Map,lru:Dn(i||Number.POSITIVE_INFINITY)});for(var a=[],o=0;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);rn[a]&&(n[a]=t[a],i=!0);i&&u(e,n,r)}function m(e){for(var t=0,r=e.length;t");var p=t.max().map((function(e){return e+1}));s(e,p,n);var m=a.length;o(e._data,t,r,m,0)}return e}(this,e,t,i);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new Xr(e.length,this._size.length);for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(this._data);try{for(n.s();!(t=n.n()).done;){var i=t.value;e.push(new r([i],this._datatype))}}catch(e){n.e(e)}finally{n.f()}return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,a=function(n){var a=i.map((function(e){return[e[n]]}));t.push(new r(a,e._datatype))},o=0;o0?e:0,n=e<0?-e:0,o=this._size[0],u=this._size[1],s=Math.min(o-n,u-t),c=[],f=0;f0?n:0,c=n<0?-n:0,p=e[0],m=e[1],h=Math.min(p-c,m-s);if(f(t)){if(t.length!==h)throw new Error("Invalid value array length");u=function(e){return t[e]}}else if(l(t)){var d=t.size();if(1!==d.length||d[0]!==h)throw new Error("Invalid matrix length");u=function(e){return t.get([e])}}else u=function(){return t};o||(o=a(u(0))?u(0).mul(0):0);var v=[];if(e.length>0){v=nn(v,e,o);for(var y=0;y=n.length)throw new Qr(t,n.length);return l(e)?e.create(In(e.valueOf(),t,r)):In(e,t,r)}function In(e,t,r){var n,i,a,o;if(t<=0){if(Array.isArray(e[0])){for(o=On(e),i=[],n=0;n0}function Un(e){return 0===e}function $n(e){return Number.isNaN(e)}Pn.signature=jn,Ln.signature=jn,Un.signature=jn,$n.signature=jn;var Hn="isNegative",Gn=Ee(Hn,["typed"],(function(e){var t=e.typed;return t(Hn,{number:Pn,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:t.referToSelf((function(e){return function(r){return t.find(e,r.valueType())(r.value)}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Vn="isNumeric",Zn=Ee(Vn,["typed"],(function(e){var t=e.typed;return t(Vn,{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Wn=(r(3210),"hasNumericValue"),Yn=Ee(Wn,["typed","isNumeric"],(function(e){var t=e.typed,r=e.isNumeric;return t(Wn,{boolean:function(){return!0},string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return r(e)}})})),Jn="isPositive",Xn=Ee(Jn,["typed"],(function(e){var t=e.typed;return t(Jn,{number:Ln,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:t.referToSelf((function(e){return function(r){return t.find(e,r.valueType())(r.value)}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Qn="isZero",Kn=Ee(Qn,["typed"],(function(e){var t=e.typed;return t(Qn,{number:Un,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:t.referToSelf((function(e){return function(r){return t.find(e,r.valueType())(r.value)}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),ei="isNaN",ti=Ee(ei,["typed"],(function(e){return(0,e.typed)(ei,{number:$n,BigNumber:function(e){return e.isNaN()},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":function(e){return _n(e,Number.isNaN)}})})),ri="typeOf",ni=Ee(ri,["typed"],(function(e){return(0,e.typed)(ri,{any:H})}));function ii(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}var ai=Ee("compareUnits",["typed"],(function(e){var t=e.typed;return{"Unit, Unit":t.referToSelf((function(e){return function(r,n){if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)}}))}})),oi="equalScalar",ui=Ee(oi,["typed","config"],(function(e){var t=e.typed,r=e.config,n=ai({typed:t});return t(oi,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return ue(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||ii(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,r){return ue(e.re,t.re,r)&&ue(e.im,t.im,r)}(e,t,r.epsilon)}},n)})),si=(Ee(oi,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(oi,{"number, number":function(e,t){return ue(e,t,r.epsilon)}})})),Ee("SparseMatrix",["typed","equalScalar","Matrix"],(function(e){var t=e.typed,r=e.equalScalar,n=e.Matrix;function o(e,t){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!c(t))throw new Error("Invalid datatype: "+t);if(l(e))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?he(t._values):void 0,e._index=he(t._index),e._ptr=he(t._ptr),e._size=he(t._size),e._datatype=r||t._datatype):u(e,t.valueOf(),r||t._datatype)}(this,e,t);else if(e&&f(e.index)&&f(e.ptr)&&f(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(f(e))u(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+H(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function u(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,o=0,u=r,s=0;if(c(i)&&(u=t.find(r,[i,i])||r,s=t.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var p=0;pd){for(l=d;lh){if(m){var v=0;for(l=0;ln-1&&(e._values.splice(p,1),e._index.splice(p,1),g++)}e._ptr[l]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function d(e,t,r,n,i){var a,o,u=n[0],s=n[1],c=[];for(a=0;a");if(1===a.length)t.dimension(0).forEach((function(t,i){rn(t),e.set([t,0],r[i[0]],n)}));else{var c=t.dimension(0),f=t.dimension(1);c.forEach((function(t,i){rn(t),f.forEach((function(a,o){rn(a),e.set([t,a],r[i[0]][o[0]],n)}))}))}}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},o.prototype.get=function(e){if(!f(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");var t=e[0],r=e[1];rn(t,this._size[0]),rn(r,this._size[1]);var n=s(t,this._ptr[r],this._ptr[r+1],this._index);return nu-1||o>l-1)&&(h(this,Math.max(a+1,u),Math.max(o+1,l),i),u=this._size[0],l=this._size[1]),rn(a,u),rn(o,l);var v=s(a,this._ptr[o],this._ptr[o+1],this._index);return v=0&&w<=i&&v(e._values[b],w-0,y-0)}else{for(var N={},D=g;D "+(this._values?Vr(this._values[s],e):"X");return i},o.prototype.toString=function(){return Vr(this.toArray())},o.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},o.prototype.diagonal=function(e){if(e){if(a(e)&&(e=e.toNumber()),!i(e)||!V(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],u=this._size[1],s=Math.min(n-r,u-t),c=[],f=[],l=[];l[0]=0;for(var p=t;p0?u:0,y=u<0?-u:0,g=e[0],x=e[1],b=Math.min(g-y,x-v);if(f(n)){if(n.length!==b)throw new Error("Invalid value array length");d=function(e){return n[e]}}else if(l(n)){var w=n.size();if(1!==w.length||w[0]!==b)throw new Error("Invalid matrix length");d=function(e){return n.get([e])}}else d=function(){return n};for(var N=[],D=[],E=[],A=0;A=0&&S=c||i[l]!==t)){var m=n?n[f]:void 0;i.splice(l,0,t),n&&n.splice(l,0,m),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}else if(l=c||i[f]!==e)){var h=n?n[l]:void 0;i.splice(f,0,e),n&&n.splice(f,0,h),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1)}}},o}),{isClass:!0})),ci=Ee("number",["typed"],(function(e){var t=e.typed,r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t,r,n=(r=(t=e).match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/))?{input:t,radix:{"0b":2,"0o":8,"0x":16}[r[1]],integerPart:r[2],fractionalPart:r[3]}:null;if(n)return function(e){for(var t=parseInt(e.integerPart,e.radix),r=0,n=0;nMath.pow(2,i)-1)throw new SyntaxError('String "'.concat(e,'" is out of range'));o>=Math.pow(2,i-1)&&(o-=Math.pow(2,i))}return o},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf((function(e){return function(t){var r=t.clone();return r.value=e(t.value),r}})),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))});return r.fromJSON=function(e){return parseFloat(e.value)},r})),fi="string",li=Ee(fi,["typed"],(function(e){var t=e.typed;return t(fi,{"":function(){return""},number:ee,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}})),any:function(e){return String(e)}})})),pi="boolean",mi=Ee(pi,["typed"],(function(e){var t=e.typed;return t(pi,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;var r=Number(e);if(""!==e&&!isNaN(r))return!!r;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),hi=Ee("bignumber",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var n=t[2],i=r(t[1]),a=new r(2).pow(Number(n));if(i.gt(a.sub(1)))throw new SyntaxError('String "'.concat(e,'" is out of range'));var o=new r(2).pow(Number(n)-1);return i.gte(o)?i.sub(a):i}return new r(e)},BigNumber:function(e){return e},Unit:t.referToSelf((function(e){return function(t){var r=t.clone();return r.value=e(t.value),r}})),Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),di=Ee("complex",["typed","Complex"],(function(e){var t=e.typed,r=e.Complex;return t("complex",{"":function(){return r.ZERO},number:function(e){return new r(e,0)},"number, number":function(e,t){return new r(e,t)},"BigNumber, BigNumber":function(e,t){return new r(e.toNumber(),t.toNumber())},Fraction:function(e){return new r(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return r(e)},null:function(e){return r(0)},Object:function(e){if("re"in e&&"im"in e)return new r(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new r(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),vi=Ee("fraction",["typed","Fraction"],(function(e){var t=e.typed,r=e.Fraction;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf((function(e){return function(t){var r=t.clone();return r.value=e(t.value),r}})),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),yi="matrix",gi=Ee(yi,["typed","Matrix","DenseMatrix","SparseMatrix"],(function(e){var t=e.typed,r=(e.Matrix,e.DenseMatrix),n=e.SparseMatrix;return t(yi,{"":function(){return i([])},string:function(e){return i([],e)},"string, string":function(e,t){return i([],e,t)},Array:function(e){return i(e)},Matrix:function(e){return i(e,e.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(e,t,i){if("dense"===t||"default"===t||void 0===t)return new r(e,i);if("sparse"===t)return new n(e,i);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})),xi="matrixFromFunction",bi=Ee(xi,["typed","matrix","isZero"],(function(e){var t=e.typed,r=e.matrix,n=e.isZero;return t(xi,{"Array | Matrix, function, string, string":function(e,t,r,n){return i(e,t,r,n)},"Array | Matrix, function, string":function(e,t,r){return i(e,t,r)},"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,r){return i(e,r,t)},"Array | Matrix, string, string, function":function(e,t,r,n){return i(e,n,t,r)}});function i(e,t,i,a){var o;return(o=void 0!==a?r(i,a):r(i)).resize(e),o.forEach((function(e,r){var i=t(r);n(i)||o.set(r,i)})),o}}));function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(e);try{for(a.s();!(t=a.n()).done;){var u=t.value,s=o(u);if(s!==r)throw new TypeError("The vectors had different length: "+(0|r)+" ≠ "+(0|s));i.push(n(u))}}catch(e){a.e(e)}finally{a.f()}return i}function o(e){var 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.")}}));function Ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(e);try{for(u.s();!(a=u.n()).done;){var s=a.value,c=o(s);if(c!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|c));for(var f=n(s),l=0;l0)return e-t*Math.floor(e/t);if(0===t)return e;throw new Error("Cannot calculate mod for a negative divisor")}function Gi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=t<0;if(r&&(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 r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function Vi(e){return Z(e)}function Zi(e){return e*e}function Wi(e,t){var r,n,i,a=0,o=1,u=1,s=0;if(!V(e)||!V(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)i=e-(n=Math.floor(e/t))*t,r=a,a=o-n*a,o=r,r=u,u=s-n*u,s=r,e=t,t=i;return e<0?[-e,-o,-s]:[e,e?o:0,s]}function Yi(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function Ji(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!V(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(re(e,t))}Ti.signature=Fi,Bi.signature=Oi,_i.signature=Oi,ki.signature=Fi,Ii.signature=Fi,Ri.signature=Fi,zi.signature=Fi,qi.signature=Fi,ji.signature=Fi,Pi.signature=Oi,Li.signature=Oi,Ui.signature=Fi,$i.signature=Fi,Hi.signature=Oi,Vi.signature=Fi,Zi.signature=Fi,Wi.signature=Oi,Yi.signature=Oi;var Xi="unaryMinus",Qi=Ee(Xi,["typed"],(function(e){var t=e.typed;return t(Xi,{number:ki,"Complex | BigNumber | Fraction":function(e){return e.neg()},Unit:t.referToSelf((function(e){return function(r){var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}}))})})),Ki="unaryPlus",ea=Ee(Ki,["typed","config","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.BigNumber;return t(Ki,{number:Ii,Complex:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"boolean | string":function(e){return"BigNumber"===r.number?new n(+e):+e}})})),ta=Ee("abs",["typed"],(function(e){var t=e.typed;return t("abs",{number:Ti,"Complex | BigNumber | Fraction | Unit":function(e){return e.abs()},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}}))})})),ra="apply",na=Ee(ra,["typed","isInteger"],(function(e){var t=e.typed,r=e.isInteger;return t(ra,{"Array | Matrix, number | BigNumber, function":function(e,t,n){if(!r(t))throw new TypeError("Integer number expected for dimension");var i=Array.isArray(e)?Kr(e):e.size();if(t<0||t>=i.length)throw new Qr(t,i.length);return l(e)?e.create(ia(e.valueOf(),t,n)):ia(e,t,n)}})}));function ia(e,t,r){var n,i,a;if(t<=0){if(Array.isArray(e[0])){for(a=function(e){var t,r,n=e.length,i=e[0].length,a=[];for(r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?r(f,0,s,s[0],u,n,a):[];return e.createDenseMatrix({data:l,size:he(s),datatype:o})};function r(e,t,n,i,a,o,u){var s=[];if(t===n.length-1)for(var c=0;c0?n(e):r(e)},"number, number":function(e,t){return e>0?n(e,t):r(e,t)}})})),Ca=Ee(Ea,Aa,(function(e){var t=e.typed,r=e.Complex,n=e.matrix,i=e.ceil,a=e.floor,o=e.equalScalar,u=e.zeros,s=e.DenseMatrix,c=ma({typed:t,DenseMatrix:s}),f=ha({typed:t}),l=Sa({typed:t,ceil:i,floor:a});return t("fix",{number:l.signatures.number,"number, number | BigNumber":l.signatures["number,number"],Complex:function(e){return new r(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 r(e.re>0?a(e.re,t):i(e.re,t),e.im>0?a(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){var n=t.toNumber();return new r(e.re>0?a(e.re,n):i(e.re,n),e.im>0?a(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):a(e,t)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0?i(e,t):a(e,t)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"Array | Matrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return _n(t,(function(t){return e(t,r)}),!0)}})),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((function(e){return function(t,r){return f(n(r),t,e,!0).valueOf()}})),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((function(e){return function(t,r){return o(t,0)?u(r.size(),r.storage()):"dense"===r.storage()?f(r,t,e,!0):c(r,t,e,!0)}}))})})),Ma="floor",Fa=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Oa=Ee(Ma,["typed","config","round"],(function(e){var t=e.typed,r=e.config,n=e.round;return t(Ma,{number:function(e){return ue(e,n(e),r.epsilon)?n(e):Math.floor(e)},"number, number":function(e,t){if(ue(e,n(e,t),r.epsilon))return n(e,t);var i=la("".concat(e,"e").split("e"),2),a=i[0],o=i[1],u=Math.floor(Number("".concat(a,"e").concat(Number(o)+t))),s=la("".concat(u,"e").split("e"),2);return a=s[0],o=s[1],Number("".concat(a,"e").concat(Number(o)-t))}})})),Ta=Ee(Ma,Fa,(function(e){var t=e.typed,r=e.config,n=e.round,i=e.matrix,a=e.equalScalar,o=e.zeros,u=e.DenseMatrix,s=pa({typed:t,equalScalar:a}),c=ma({typed:t,DenseMatrix:u}),f=ha({typed:t}),l=Oa({typed:t,config:r,round:n});return t("floor",{number:l.signatures.number,"number,number":l.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:function(e){return ii(e,n(e),r.epsilon)?n(e):e.floor()},"BigNumber, BigNumber":function(e,t){return ii(e,n(e,t),r.epsilon)?n(e,t):e.toDecimalPlaces(t.toNumber(),kr.ROUND_FLOOR)},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())},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"Array, number | BigNumber":t.referToSelf((function(e){return function(t,r){return _n(t,(function(t){return e(t,r)}),!0)}})),"SparseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return s(t,r,e,!1)}})),"DenseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return f(t,r,e,!1)}})),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((function(e){return function(t,r){return f(i(r),t,e,!0).valueOf()}})),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((function(e){return function(t,r){return a(t,0)?o(r.size(),r.storage()):"dense"===r.storage()?f(r,t,e,!0):c(r,t,e,!0)}}))})}));function Ba(e,t,r){return(t=Me(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _a(e){return function(e){if(Array.isArray(e))return ca(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fa(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ka=Ee("matAlgo01xDSid",["typed"],(function(e){var t=e.typed;return function(e,r,n,i){var a=e._data,o=e._size,u=e._datatype,s=r._values,c=r._index,f=r._ptr,l=r._size,p=r._datatype;if(o.length!==l.length)throw new Xr(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,h,d=o[0],v=o[1],y="string"==typeof u&&u===p?u:void 0,g=y?t.find(n,[y,y]):n,x=[];for(m=0;m0?r(h,0,p,p[0],o,c):[];return e.createDenseMatrix({data:d,size:p,datatype:a})};function r(e,t,n,i,a,o){var u=[];if(t===n.length-1)for(var s=0;s1)throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(r," with size ").concat(e[r]," to size ").concat(t[r]))}}))),ja=Ee("matrixAlgorithmSuite",["typed","matrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.concat,i=za({typed:t}),a=ha({typed:t}),o=qa({concat:n});return function(e){var n,u=e.elop,s=e.SD||e.DS;u?(n={"DenseMatrix, DenseMatrix":function(e,t){return i.apply(void 0,_a(o(e,t)).concat([u]))},"Array, Array":function(e,t){return i.apply(void 0,_a(o(r(e),r(t))).concat([u])).valueOf()},"Array, DenseMatrix":function(e,t){return i.apply(void 0,_a(o(r(e),t)).concat([u]))},"DenseMatrix, Array":function(e,t){return i.apply(void 0,_a(o(e,r(t))).concat([u]))}},e.SS&&(n["SparseMatrix, SparseMatrix"]=function(t,r){return e.SS.apply(e,_a(o(t,r)).concat([u,!1]))}),e.DS&&(n["DenseMatrix, SparseMatrix"]=function(t,r){return e.DS.apply(e,_a(o(t,r)).concat([u,!1]))},n["Array, SparseMatrix"]=function(t,n){return e.DS.apply(e,_a(o(r(t),n)).concat([u,!1]))}),s&&(n["SparseMatrix, DenseMatrix"]=function(e,t){return s.apply(void 0,_a(o(t,e)).concat([u,!0]))},n["SparseMatrix, Array"]=function(e,t){return s.apply(void 0,_a(o(r(t),e)).concat([u,!0]))})):(n={"DenseMatrix, DenseMatrix":t.referToSelf((function(e){return function(t,r){return i.apply(void 0,_a(o(t,r)).concat([e]))}})),"Array, Array":t.referToSelf((function(e){return function(t,n){return i.apply(void 0,_a(o(r(t),r(n))).concat([e])).valueOf()}})),"Array, DenseMatrix":t.referToSelf((function(e){return function(t,n){return i.apply(void 0,_a(o(r(t),n)).concat([e]))}})),"DenseMatrix, Array":t.referToSelf((function(e){return function(t,n){return i.apply(void 0,_a(o(t,r(n))).concat([e]))}}))},e.SS&&(n["SparseMatrix, SparseMatrix"]=t.referToSelf((function(t){return function(r,n){return e.SS.apply(e,_a(o(r,n)).concat([t,!1]))}}))),e.DS&&(n["DenseMatrix, SparseMatrix"]=t.referToSelf((function(t){return function(r,n){return e.DS.apply(e,_a(o(r,n)).concat([t,!1]))}})),n["Array, SparseMatrix"]=t.referToSelf((function(t){return function(n,i){return e.DS.apply(e,_a(o(r(n),i)).concat([t,!1]))}}))),s&&(n["SparseMatrix, DenseMatrix"]=t.referToSelf((function(e){return function(t,r){return s.apply(void 0,_a(o(r,t)).concat([e,!0]))}})),n["SparseMatrix, Array"]=t.referToSelf((function(e){return function(t,n){return s.apply(void 0,_a(o(r(n),t)).concat([e,!0]))}}))));var c=e.scalar||"any";(e.Ds||e.Ss)&&(u?(n["DenseMatrix,"+c]=function(e,t){return a(e,t,u,!1)},n[c+", DenseMatrix"]=function(e,t){return a(t,e,u,!0)},n["Array,"+c]=function(e,t){return a(r(e),t,u,!1).valueOf()},n[c+", Array"]=function(e,t){return a(r(t),e,u,!0).valueOf()}):(n["DenseMatrix,"+c]=t.referToSelf((function(e){return function(t,r){return a(t,r,e,!1)}})),n[c+", DenseMatrix"]=t.referToSelf((function(e){return function(t,r){return a(r,t,e,!0)}})),n["Array,"+c]=t.referToSelf((function(e){return function(t,n){return a(r(t),n,e,!1).valueOf()}})),n[c+", Array"]=t.referToSelf((function(e){return function(t,n){return a(r(n),t,e,!0).valueOf()}}))));var f=void 0!==e.sS?e.sS:e.Ss;return u?(e.Ss&&(n["SparseMatrix,"+c]=function(t,r){return e.Ss(t,r,u,!1)}),f&&(n[c+", SparseMatrix"]=function(e,t){return f(t,e,u,!0)})):(e.Ss&&(n["SparseMatrix,"+c]=t.referToSelf((function(t){return function(r,n){return e.Ss(r,n,t,!1)}}))),f&&(n[c+", SparseMatrix"]=t.referToSelf((function(e){return function(t,r){return f(r,t,e,!0)}})))),u&&u.signatures&&ve(n,u.signatures),n}}));function Pa(e,t,r,n){if(!(this instanceof Pa))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}Pa.prototype=new Error,Pa.prototype.constructor=Error,Pa.prototype.name="ArgumentsError",Pa.prototype.isArgumentsError=!0;var La=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Ua="number | BigNumber | Fraction | Matrix | Array",$a="".concat(Ua,", ").concat(Ua,", ...").concat(Ua);function Ha(e){return!e.some((function(e){return Array.isArray(e)}))}var Ga=Ee("gcd",La,(function(e){var t,r=e.typed,n=e.matrix,i=e.equalScalar,a=e.BigNumber,o=e.DenseMatrix,u=e.concat,s=ka({typed:r}),c=Ia({typed:r,equalScalar:i}),f=Ra({typed:r,DenseMatrix:o});return r("gcd",{"number, number":Pi,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var r=new a(0);!t.isZero();){var n=e.mod(t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)}},ja({typed:r,matrix:n,concat:u})({SS:c,DS:s,Ss:f}),(Ba(t={},$a,r.referToSelf((function(e){return function(t,r,n){for(var i=e(t,r),a=0;a=0||r.predictable?Ui(e):new n(e,0).log().div(Math.LN10)},Complex:function(e){return new n(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||r.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Xa="log2",Qa=Ee(Xa,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(Xa,{number:function(e){return e>=0||r.predictable?$i(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||r.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))});function i(e){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),Ka=Ee("matAlgo03xDSf",["typed"],(function(e){var t=e.typed;return function(e,r,n,i){var a=e._data,o=e._size,u=e._datatype,s=r._values,c=r._index,f=r._ptr,l=r._size,p=r._datatype;if(o.length!==l.length)throw new Xr(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,h=o[0],d=o[1],v=0,y=n;"string"==typeof u&&u===p&&(m=u,v=t.convert(0,m),y=t.find(n,[m,m]));for(var g=[],x=0;x=0?e.mod(t):e.mod(t).add(t).mod(t)}},ja({typed:t,matrix:r,concat:a})({SS:s,DS:u,SD:o,Ss:c,sS:f}))})),ro=Ee("multiplyScalar",["typed"],(function(e){return(0,e.typed)("multiplyScalar",{"number, number":_i,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":function(e,t){return t.multiply(e)},"Unit, number | Fraction | BigNumber | Complex | Unit":function(e,t){return e.multiply(t)}})})),no="multiply",io=Ee(no,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(function(e){var t=e.typed,r=e.matrix,n=e.addScalar,i=e.multiplyScalar,a=e.equalScalar,o=e.dot,u=pa({typed:t,equalScalar:a}),s=ha({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)")}}var f=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){var a,o=e._data,u=e._size,s=e._datatype,c=r._data,f=r._datatype,l=u[0],p=u[1],m=n,h=i;s&&f&&s===f&&"string"==typeof s&&(a=s,m=t.find(n,[a,a]),h=t.find(i,[a,a]));for(var d=[],v=0;vS)for(var M=0,F=0;F=0||t.predictable?Math.sqrt(e):new n(e,0).sqrt()}})),fo="square",lo=Ee(fo,["typed"],(function(e){return(0,e.typed)(fo,{number:Zi,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})})),po="subtract",mo=Ee(po,["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=(e.addScalar,e.unaryMinus,e.DenseMatrix),a=e.concat,o=ka({typed:t}),u=Ka({typed:t}),s=eo({typed:t,equalScalar:n}),c=Ra({typed:t,DenseMatrix:i}),f=ma({typed:t,DenseMatrix:i}),l=ja({typed:t,matrix:r,concat:a});return t(po,{"number, number":function(e,t){return e-t},"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf((function(e){return function(r,n){if(null===r.value)throw new Error("Parameter x contains a unit with undefined value");if(null===n.value)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}}))},l({SS:s,DS:o,SD:u,Ss:f,sS:c}))})),ho="xgcd",vo=Ee(ho,["typed","config","matrix","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.BigNumber;return t(ho,{"number, number":function(e,t){var i=Wi(e,t);return"Array"===r.matrix?i:n(i)},"BigNumber, BigNumber":function(e,t){var a,o,u,s,c=new i(0),f=new i(1),l=c,p=f,m=f,h=c;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)o=e.div(t).floor(),u=e.mod(t),a=l,l=p.minus(o.times(l)),p=a,a=m,m=h.minus(o.times(m)),h=a,e=t,t=u;return s=e.lt(c)?[e.neg(),p.neg(),h.neg()]:[e,e.isZero()?0:p,h],"Array"===r.matrix?s:n(s)}})})),yo="invmod",go=Ee(yo,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(function(e){var t=e.typed,r=(e.config,e.BigNumber),n=e.xgcd,i=e.equal,a=e.smaller,o=e.mod,u=e.add,s=e.isInteger;return t(yo,{"number, number":c,"BigNumber, BigNumber":c});function c(e,t){if(!s(e)||!s(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=o(e,t),i(t,0))throw new Error("Divisor must be non zero");var c=n(e,t),f=la(c=c.valueOf(),2),l=f[0],p=f[1];return i(l,r(1))?(p=o(p,t),a(p,r(0))&&(p=u(p,t)),p):NaN}})),xo=Ee("matAlgo09xS0Sf",["typed","equalScalar"],(function(e){var t=e.typed,r=e.equalScalar;return function(e,n,i){var a=e._values,o=e._index,u=e._ptr,s=e._size,c=e._datatype,f=n._values,l=n._index,p=n._ptr,m=n._size,h=n._datatype;if(s.length!==m.length)throw new Xr(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");var d,v=s[0],y=s[1],g=r,x=0,b=i;"string"==typeof c&&c===h&&(d=c,g=t.find(r,[d,d]),x=t.convert(0,d),b=t.find(i,[d,d]));var w,N,D,E,A,S=a&&f?[]:void 0,C=[],M=[],F=S?[]:void 0,O=[];for(N=0;N0;)r(a[--m],o[--h])===d&&(v=v.plus(y)),y=y.times(g);for(;h>0;)r(u,o[--h])===d&&(v=v.plus(y)),y=y.times(g);return s.config({precision:x}),0===d&&(v.s=-v.s),v}function So(e){for(var t=e.d,r=t[0]+"",n=1;n0)if(++u>c)for(u-=c;u--;)s+="0";else u1&&(null!==f[m+1]&&void 0!==f[m+1]||(f[m+1]=0),f[m+1]+=f[m]>>1,f[m]&=1)}return f.reverse()}function Co(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?Do(t):t.eq(n)?Do(e):e.isFinite()&&t.isFinite()?Ao(e,t,(function(e,t){return e^t})):e.isFinite()||t.isFinite()?new r(e.isNegative()===t.isNegative()?1/0:-1/0):n}function Mo(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t)):new r(NaN)}function Fo(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}r(5069);var Oo="number, number";function To(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function bitAnd");return e&t}function Bo(e){if(!V(e))throw new Error("Integer expected in function bitNot");return~e}function _o(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function bitOr");return e|t}function ko(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function bitXor");return e^t}function Io(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function leftShift");return e<>t}function zo(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}To.signature=Oo,Bo.signature="number",_o.signature=Oo,ko.signature=Oo,Io.signature=Oo,Ro.signature=Oo,zo.signature=Oo;var qo="bitAnd",jo=Ee(qo,["typed","matrix","equalScalar","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.concat,a=Va({typed:t,equalScalar:n}),o=Za({typed:t,equalScalar:n}),u=pa({typed:t,equalScalar:n}),s=ja({typed:t,matrix:r,concat:i});return t(qo,{"number, number":To,"BigNumber, BigNumber":No},s({SS:o,DS:a,Ss:u}))})),Po="bitNot",Lo=Ee(Po,["typed"],(function(e){var t=e.typed;return t(Po,{number:Bo,BigNumber:Do,"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Uo="bitOr",$o=Ee(Uo,["typed","matrix","equalScalar","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,a=e.concat,o=ka({typed:t}),u=Ia({typed:t,equalScalar:n}),s=Ra({typed:t,DenseMatrix:i}),c=ja({typed:t,matrix:r,concat:a});return t(Uo,{"number, number":_o,"BigNumber, BigNumber":Eo},c({SS:u,DS:o,Ss:s}))})),Ho=Ee("matAlgo07xSSf",["typed","DenseMatrix"],(function(e){var t=e.typed,r=e.DenseMatrix;return function(e,i,a){var o=e._size,u=e._datatype,s=i._size,c=i._datatype;if(o.length!==s.length)throw new Xr(o.length,s.length);if(o[0]!==s[0]||o[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+s+")");var f,l,p,m=o[0],h=o[1],d=0,v=a;"string"==typeof u&&u===c&&(f=u,d=t.convert(0,f),v=t.find(a,[f,f]));var y=[];for(l=0;l0&&s>o)throw new Qr(s,o+1)}else{var m=he(p).valueOf(),h=Kr(m);if(f[t]=m,o=s,s=h.length-1,t>0&&s!==o)throw new Xr(o+1,s+1)}}if(0===f.length)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=su(d,f.shift(),s,0);return c?r(d):d},"...string":function(e){return e.join("")}})}));function su(e,t,r,n){if(n1?[u]:u}})),du="diag",vu=Ee(du,["typed","matrix","DenseMatrix","SparseMatrix"],(function(e){var t=e.typed,r=e.matrix,n=e.DenseMatrix,i=e.SparseMatrix;return t(du,{Array:function(e){return a(e,0,Kr(e),null)},"Array, number":function(e,t){return a(e,t,Kr(e),null)},"Array, BigNumber":function(e,t){return a(e,t.toNumber(),Kr(e),null)},"Array, string":function(e,t){return a(e,0,Kr(e),t)},"Array, number, string":function(e,t,r){return a(e,t,Kr(e),r)},"Array, BigNumber, string":function(e,t,r){return a(e,t.toNumber(),Kr(e),r)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return a(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return a(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return a(e,0,e.size(),t)},"Matrix, number, string":function(e,t,r){return a(e,t,e.size(),r)},"Matrix, BigNumber, string":function(e,t,r){return a(e,t.toNumber(),e.size(),r)}});function a(e,t,a,o){if(!V(t))throw new TypeError("Second parameter in function diag must be an integer");var u=t>0?t:0,s=t<0?-t:0;switch(a.length){case 1:return function(e,t,r,a,o,u){var s=[a+o,a+u];if(r&&"sparse"!==r&&"dense"!==r)throw new TypeError("Unknown matrix type ".concat(r,'"'));var c="sparse"===r?i.diagonal(s,e,t):n.diagonal(s,e,t);return null!==r?c:c.valueOf()}(e,t,o,a[0],s,u);case 2:return function(e,t,n,i,a,o){if(l(e)){var u=e.diagonal(t);return null!==n?n!==u.storage()?r(u,n):u:u.valueOf()}for(var s=Math.min(i[0]-a,i[1]-o),c=[],f=0;f=2&&s.push("index: ".concat(H(r))),o.length>=3&&s.push("array: ".concat(H(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(e.name,"(").concat(s.join(", "),") at index ").concat(JSON.stringify(r)))}throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(a.message))}}}var gu=Ee("filter",["typed"],(function(e){return(0,e.typed)("filter",{"Array, function":xu,"Matrix, function":function(e,t){return e.create(xu(e.toArray(),t))},"Array, RegExp":yn,"Matrix, RegExp":function(e,t){return e.create(yn(e.toArray(),t))}})}));function xu(e,t){return vn(e,(function(e,r,n){return yu(t,e,[r],n,"filter")}))}var bu="flatten",wu=Ee(bu,["typed","matrix"],(function(e){var t=e.typed,r=e.matrix;return t(bu,{Array:function(e){return mn(e)},Matrix:function(e){var t=mn(e.toArray());return r(t)}})})),Nu="forEach",Du=Ee(Nu,["typed"],(function(e){return(0,e.typed)(Nu,{"Array, function":Eu,"Matrix, function":function(e,t){e.forEach(t)}})}));function Eu(e,t){!function r(n,i){if(!Array.isArray(n))return yu(t,n,i,e,"forEach");dn(n,(function(e,t){r(e,i.concat(t))}))}(e,[])}var Au="getMatrixDataType",Su=Ee(Au,["typed"],(function(e){return(0,e.typed)(Au,{Array:function(e){return wn(e,H)},Matrix:function(e){return e.getDataType()}})})),Cu="identity",Mu=Ee(Cu,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.BigNumber,o=e.DenseMatrix,u=e.SparseMatrix;return t(Cu,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return c(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return c(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return c(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return c(e,t,r)},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?n(t):[];case 1:return c(e[0],e[0],t);case 2:return c(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function c(e,t,r){var n=a(e)||a(t)?i:null;if(a(e)&&(e=e.toNumber()),a(t)&&(t=t.toNumber()),!V(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!V(t)||t<1)throw new Error("Parameters in function identity must be positive integers");var s=n?new i(1):1,c=n?new n(0):0,f=[e,t];if(r){if("sparse"===r)return u.diagonal(f,s,0,c);if("dense"===r)return o.diagonal(f,s,0,c);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}for(var l=nn([],f,c),p=e2||Kr(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)+")");var r=[],i=[];return e.map((function(e){return t.map((function(t){return i=[],r.push(i),e.map((function(e){return t.map((function(t){return i.push(n(e,t))}))}))}))}))&&r}})),Tu=Ee("map",["typed"],(function(e){return(0,e.typed)("map",{"Array, function":Bu,"Matrix, function":function(e,t){return e.map(t)}})}));function Bu(e,t){return function r(n,i){return Array.isArray(n)?n.map((function(e,t){return r(e,i.concat(t))})):yu(t,n,i,e,"map")}(e,[])}var _u="diff",ku=Ee(_u,["typed","matrix","subtract","number"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.number;return t(_u,{"Array | Matrix":function(e){return l(e)?r(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,t){if(!V(t))throw new RangeError("Dimension must be a whole number");return l(e)?r(a(e.toArray(),t)):a(e,t)},"Array, BigNumber":t.referTo("Array,number",(function(e){return function(t,r){return e(t,i(r))}})),"Matrix, BigNumber":t.referTo("Matrix,number",(function(e){return function(t,r){return e(t,i(r))}}))});function a(e,t){if(l(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){var r=[];return e.forEach((function(e){r.push(a(e,t-1))})),r}if(0===t)return o(e);throw RangeError("Cannot have negative dimension")}function o(e){for(var t=[],r=e.length,n=1;n0?u.resize(e,o):u}var s=[];return e.length>0?nn(s,e,o):s}}));function Ru(){throw new Error('No "bignumber" implementation available')}function zu(){throw new Error('No "fraction" implementation available')}function qu(){throw new Error('No "matrix" implementation available')}var ju="range",Pu=Ee(ju,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,u=e.larger,s=e.largerEq,c=e.add,f=e.isPositive;return t(ju,{string:p,"string, boolean":p,"number, number":function(e,t){return l(m(e,t,1,!1))},"number, number, number":function(e,t,r){return l(m(e,t,r,!1))},"number, number, boolean":function(e,t,r){return l(m(e,t,1,r))},"number, number, number, boolean":function(e,t,r,n){return l(m(e,t,r,n))},"BigNumber, BigNumber":function(e,t){return l(m(e,t,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return l(m(e,t,r,!1))},"BigNumber, BigNumber, boolean":function(e,t,r){return l(m(e,t,new(0,e.constructor)(1),r))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return l(m(e,t,r,n))},"Unit, Unit, Unit":function(e,t,r){return l(m(e,t,r,!1))},"Unit, Unit, Unit, boolean":function(e,t,r,n){return l(m(e,t,r,n))}});function l(e){return"Matrix"===r.matrix?n?n(e):qu():e}function p(e,t){var n=function(e){var 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(!n)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===r.number?(void 0===i&&Ru(),l(m(i(n.start),i(n.end),i(n.step)))):l(m(n.start,n.end,n.step,t))}function m(e,t,r,n){for(var i=[],l=f(r)?n?o:a:n?s:u,p=e;l(p,t);)i.push(p),p=c(p,r);return i}})),Lu="reshape",Uu=Ee(Lu,["typed","isInteger","matrix"],(function(e){var t=e.typed,r=e.isInteger;return t(Lu,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach((function(e){if(!r(e))throw new TypeError("Invalid size for dimension: "+e)})),on(e,t)}})})),$u=Ee("resize",["config","matrix"],(function(e){var t=e.config,r=e.matrix;return function(e,n,i){if(2!==arguments.length&&3!==arguments.length)throw new Pa("resize",arguments.length,2,3);if(l(n)&&(n=n.valueOf()),a(n[0])&&(n=n.map((function(e){return a(e)?e.toNumber():e}))),l(e))return e.resize(n,i,!0);if("string"==typeof e)return function(e,t,r){if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(1!==t.length)throw new Xr(t.length,1);var n=t[0];if("number"!=typeof n||!V(n))throw new TypeError("Invalid size, must contain positive integers (size: "+Vr(t)+")");if(e.length>n)return e.substring(0,n);if(e.length2)throw new RangeError("Vector must be of dimensions 1x".concat(t));if(2===r.length&&1!==r[1])throw new RangeError("Vector must be of dimensions 1x".concat(t));if(r[0]!==t)throw new RangeError("Vector must be of dimensions 1x".concat(t))}})),Vu="rotationMatrix",Zu=Ee(Vu,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(function(e){var t=e.typed,r=e.config,n=e.multiplyScalar,i=e.addScalar,o=e.unaryMinus,u=e.norm,s=e.BigNumber,c=e.matrix,f=e.DenseMatrix,l=e.SparseMatrix,p=e.cos,m=e.sin;return t(Vu,{"":function(){return"Matrix"===r.matrix?c([]):[]},string:function(e){return c(e)},"number | BigNumber | Complex | Unit":function(e){return h(e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return h(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){var r=c(t);return d(r),g(e,r,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){d(t);var n=t.storage()||("Matrix"===r.matrix?"dense":void 0);return g(e,t,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,r){var n=c(t);return d(n),g(e,n,r)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,r){return d(t),g(e,t,r)}});function h(e,t){var r=a(e)?new s(-1):-1,i=p(e),o=m(e);return y([[i,n(r,o)],[o,i]],t)}function d(e){var t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function v(e){return e.reduce((function(e,t){return n(e,t)}))}function y(e,t){if(t){if("sparse"===t)return new l(e);if("dense"===t)return new f(e);throw new TypeError('Unknown matrix type "'.concat(t,'"'))}return e}function g(e,t,r){var n=u(t);if(0===n)throw new RangeError("Rotation around zero vector");var c=a(e)?s:null,f=c?new c(1):1,l=c?new c(-1):-1,h=c?new c(t.get([0])/n):t.get([0])/n,d=c?new c(t.get([1])/n):t.get([1])/n,g=c?new c(t.get([2])/n):t.get([2])/n,x=p(e),b=i(f,o(x)),w=m(e);return y([[i(x,v([h,h,b])),i(v([h,d,b]),v([l,g,w])),i(v([h,g,b]),v([d,w]))],[i(v([h,d,b]),v([g,w])),i(x,v([d,d,b])),i(v([d,g,b]),v([l,h,w]))],[i(v([h,g,b]),v([l,d,w])),i(v([d,g,b]),v([h,w])),i(x,v([g,g,b]))]],r)}})),Wu=Ee("row",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range;return t("row",{"Matrix, number":a,"Array, number":function(e,t){return a(n(he(e)),t).valueOf()}});function a(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");rn(t,e.size()[0]);var a=i(0,e.size()[1]),o=new r(t,a),u=e.subset(o);return l(u)?u:n([[u]])}})),Yu="size",Ju=Ee(Yu,["typed","config","?matrix"],(function(e){var t=e.typed,r=e.config,n=e.matrix;return t(Yu,{Matrix:function(e){return e.create(e.size())},Array:Kr,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):qu()}})})),Xu="squeeze",Qu=Ee(Xu,["typed","matrix"],(function(e){var t=e.typed,r=e.matrix;return t(Xu,{Array:function(e){return cn(he(e))},Matrix:function(e){var t=cn(e.toArray());return Array.isArray(t)?r(t):t},any:function(e){return he(e)}})})),Ku="subset",es=Ee(Ku,["typed","matrix"],(function(e){var t=e.typed,r=e.matrix;return t(Ku,{"Array, Index":function(e,t){var n=r(e).subset(t);return t.isScalar()?n:n.valueOf()},"Matrix, Index":function(e,t){return e.subset(t)},"Object, Index":ns,"string, Index":ts,"Array, Index, any":function(e,t,n){return r(he(e)).subset(t,n,void 0).valueOf()},"Array, Index, any, any":function(e,t,n,i){return r(he(e)).subset(t,n,i).valueOf()},"Matrix, Index, any":function(e,t,r){return e.clone().subset(t,r)},"Matrix, Index, any, any":function(e,t,r,n){return e.clone().subset(t,r,n)},"string, Index, string":rs,"string, Index, string, string":rs,"Object, Index, any":is})}));function ts(e,t){if(!v(t))throw new TypeError("Index expected");if(1!==t.size().length)throw new Xr(t.size().length,1);var r=e.length;rn(t.min()[0],r),rn(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach((function(t){i+=e.charAt(t)})),i}function rs(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(1!==t.size().length)throw new Xr(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0);if(i.size()[0]!==r.length)throw new Xr(i.size()[0],r.length);var a=e.length;rn(t.min()[0]),rn(t.max()[0]);for(var o=[],u=0;ua)for(var s=a-1,c=o.length;s0?u.resize(e,o):u}var s=[];return e.length>0?nn(s,e,o):s}})),ls=Ee("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(function(e){var t=e.typed,r=(e.matrix,e.addScalar),n=e.multiplyScalar,i=e.divideScalar,a=e.exp,o=e.tau,u=e.i,s=e.dotDivide,c=e.conj,f=e.pow,l=e.ceil,p=e.log2;return t("fft",{Array:m,Matrix:function(e){return e.create(m(e.toArray()))}});function m(e){var t=Kr(e);return 1===t.length?d(e,t[0]):h(e.map((function(e){return m(e,t.slice(1))})),0)}function h(e,t){var r=Kr(e);if(0!==t)return new Array(r[0]).fill(0).map((function(r,n){return h(e[n],t-1)}));if(1===r.length)return d(e);function n(e){var t=Kr(e);return new Array(t[1]).fill(0).map((function(r,n){return new Array(t[0]).fill(0).map((function(t,r){return e[r][n]}))}))}return n(h(n(e),1))}function d(e){var t=e.length;if(1===t)return[e[0]];if(t%2==0){for(var h=[].concat(_a(d(e.filter((function(e,t){return t%2==0})))),_a(d(e.filter((function(e,t){return t%2==1}))))),v=0;v1/4&&(j.push(r(j[U],q)),P.push(r(P[U],o(q,R,V))),U++);var Y=.84*Math.pow(M/W,.2);if(d(Y,F)?Y=F:h(Y,O)&&(Y=O),Y=B?y(Y):Y,q=o(q,Y),A&&h(l(q),A)?q=N?A:g(A):S&&d(l(q),S)&&(q=N?S:g(S)),++$>T)throw new Error("Maximum number of iterations reached, try changing options")}return{t:j,y:P}}}function b(e,t,r,n){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,r,n)}function w(e,t,r,n){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,r,n)}function N(e,t,r,n){var i=n.method?n.method:"RK45",a={RK23:b,RK45:w};if(i.toUpperCase()in a){var o=function(e){for(var t=1;t=ws?Z(e):t<=ys?Z(e)*function(e){var t,r=e*e,n=xs[0][4]*r,i=r;for(t=0;t<3;t+=1)n=(n+xs[0][t])*r,i=(i+bs[0][t])*r;return e*(n+xs[0][3])/(i+bs[0][3])}(t):t<=4?Z(e)*(1-function(e){var t,r=xs[1][8]*e,n=e;for(t=0;t<7;t+=1)r=(r+xs[1][t])*e,n=(n+bs[1][t])*e;var i=(r+xs[1][7])/(n+bs[1][7]),a=parseInt(16*e)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}(t)):Z(e)*(1-function(e){var t,r=1/(e*e),n=xs[2][5]*r,i=r;for(t=0;t<4;t+=1)n=(n+xs[2][t])*r,i=(i+bs[2][t])*r;var a=r*(n+xs[2][4])/(i+bs[2][4]);a=(gs-a)/e;var o=(e-(r=parseInt(16*e)/16))*(e+r);return Math.exp(-r*r)*Math.exp(-o)*a}(t))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),ys=.46875,gs=.5641895835477563,xs=[[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]],bs=[[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]],ws=Math.pow(2,53),Ns="mode",Ds=Ee(Ns,["typed","isNaN","isNumeric"],(function(e){var t=e.typed,r=e.isNaN,n=e.isNumeric;return t(Ns,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=mn(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var t={},i=[],a=0,o=0;oa&&(a=t[u],i=[u])}return i}}));function Es(e,t,r){var n;return-1!==String(e).indexOf("Unexpected type")?(n=arguments.length>2?" (type: "+H(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):-1!==String(e).indexOf("complex numbers")?(n=arguments.length>2?" (type: "+H(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var As="prod",Ss=Ee(As,["typed","config","multiplyScalar","numeric"],(function(e){var t=e.typed,r=e.config,n=e.multiplyScalar,i=e.numeric;return t(As,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return a(e)}});function a(e){var t;if(Bn(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Es(t,"prod",e)}})),"string"==typeof t&&(t=i(t,r.number)),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}})),Cs="format",Ms=Ee(Cs,["typed"],(function(e){return(0,e.typed)(Cs,{any:Vr,"any, Object | function | number":Vr})})),Fs=Ee("bin",["typed","format"],(function(e){var t=e.typed,r=e.format;return t("bin",{"number | BigNumber":function(e){return r(e,{notation:"bin"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"bin",wordSize:t})}})})),Os=Ee("oct",["typed","format"],(function(e){var t=e.typed,r=e.format;return t("oct",{"number | BigNumber":function(e){return r(e,{notation:"oct"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"oct",wordSize:t})}})})),Ts=Ee("hex",["typed","format"],(function(e){var t=e.typed,r=e.format;return t("hex",{"number | BigNumber":function(e){return r(e,{notation:"hex"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"hex",wordSize:t})}})})),Bs="print",_s=Ee(Bs,["typed"],(function(e){return(0,e.typed)(Bs,{"string, Object | Array":ks,"string, Object | Array, number | Object":ks})}));function ks(e,t,r){return e.replace(/\$([\w.]+)/g,(function(e,n){for(var i=n.split("."),a=t[i.shift()];i.length&&void 0!==a;){var o=i.shift();a=o?a[o]:a+"."}return void 0!==a?c(a)?a:Vr(a,r):e}))}var Is=Ee("to",["typed","matrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.concat;return t("to",{"Unit, Unit | string":function(e,t){return e.to(t)}},ja({typed:t,matrix:r,concat:n})({Ds:!0}))})),Rs="isPrime",zs=Ee(Rs,["typed"],(function(e){var t=e.typed;return t(Rs,{number:function(e){if(0*e!=0)return!1;if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(var t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},BigNumber:function(e){if(0*e.toNumber()!=0)return!1;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))){for(var t=e.toNumber(),r=5;r*r<=t;r+=6)if(t%r==0||t%(r+2)==0)return!1;return!0}function n(e,t,r){for(var n=1;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(r)):(t=t.sub(1),n=e.mul(n).mod(r));return n}for(var i=e.constructor.clone({precision:2*e.toFixed(0).length}),a=0,o=(e=new i(e)).sub(1);o.mod(2).eq(0);)o=o.div(2),a+=1;var u=null;if(e.lt("3317044064679887385961981"))u=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((function(t){return t1&&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");var r=H(e);if(!(r in i))throw new TypeError("Cannot convert "+e+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in a))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(a).join(", "));return t===r?e:a[t](e)}})),js="divideScalar",Ps=Ee(js,["typed","numeric"],(function(e){var t=e.typed;return e.numeric,t(js,{"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)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":function(e,t){return e.divide(t)},"number | Fraction | Complex | BigNumber, Unit":function(e,t){return t.divideInto(e)}})})),Ls=Ee("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(function(e){var t=e.typed,r=e.config,n=e.identity,i=e.multiply,a=e.matrix,o=e.inv,u=e.number,s=e.fraction,c=e.Complex;return t("pow",{"number, number":f,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||r.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"Fraction, Fraction":function(e,t){var n=e.pow(t);if(null!=n)return n;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return f(e.valueOf(),t.valueOf())},"Array, number":l,"Array, BigNumber":function(e,t){return l(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 f(e,t){if(r.predictable&&!V(t)&&e<0)try{var n=s(t),i=u(n);if((t===i||Math.abs((t-i)/t)<1e-14)&&n.d%2==1)return(n.n%2==0?1:-1)*Math.pow(-e,t)}catch(e){}return r.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:V(t)||e>=0||r.predictable?Yi(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new c(e,0).pow(t,0)}function l(e,t){if(!V(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");var r=Kr(e);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");if(t<0)try{return l(o(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}for(var a=n(r[0]).valueOf(),u=e;t>=1;)1==(1&t)&&(a=i(u,a)),t>>=1,u=i(u,u);return a}function p(e,t){return a(l(e.valueOf(),t))}})),Us="Number of decimals in function round must be an integer",$s="round",Hs=Ee($s,["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.BigNumber,o=e.DenseMatrix,u=pa({typed:t,equalScalar:n}),s=ma({typed:t,DenseMatrix:o}),c=ha({typed:t});return t($s,{number:Ji,"number, number":Ji,"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(Us);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);var r=t.toNumber();return e.round(r)},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);return e.toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(Us);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);return e.round(t.toNumber())},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"SparseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return u(t,r,e,!1)}})),"DenseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return c(t,r,e,!1)}})),"Array, number | BigNumber":t.referToSelf((function(e){return function(t,n){return c(r(t),n,e,!1).valueOf()}})),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf((function(e){return function(t,r){return n(t,0)?i(r.size(),r.storage()):s(r,t,e,!0)}})),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf((function(e){return function(t,r){return n(t,0)?i(r.size(),r.storage()):c(r,t,e,!0)}})),"number | Complex | BigNumber | Fraction, Array":t.referToSelf((function(e){return function(t,n){return c(r(n),t,e,!0).valueOf()}}))})})),Gs=Ee("log",["config","typed","divideScalar","Complex"],(function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.Complex;return t("log",{number:function(e){return e>=0||r.predictable?function(e,t){return Math.log(e)}(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():new i(e.toNumber(),0).log()},"any, any":t.referToSelf((function(e){return function(t,r){return n(e(t),e(r))}}))})})),Vs="log1p",Zs=Ee(Vs,["typed","config","divideScalar","log","Complex"],(function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.log,a=e.Complex;return t(Vs,{number:function(e){return e>=-1||r.predictable?J(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var t=e.plus(1);return!t.isNegative()||r.predictable?t.ln():o(new a(e.toNumber(),0))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}})),"any, any":t.referToSelf((function(e){return function(t,r){return n(e(t),i(r))}}))});function o(e){var t=e.re+1;return new a(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}})),Ws="nthRoots",Ys=Ee(Ws,["config","typed","divideScalar","Complex"],(function(e){var t=e.typed,r=(e.config,e.divideScalar,e.Complex),n=[function(e){return new r(e,0)},function(e){return new r(0,e)},function(e){return new r(-e,0)},function(e){return new r(0,-e)}];function i(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 r(0,0)];var i,a="number"==typeof e;(a||0===e.re||0===e.im)&&(i=a?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);for(var o=e.arg(),u=e.abs(),s=[],c=Math.pow(u,1/t),f=0;fd&&(g.push(l[N]),x.push(D))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var E=n(v,y),A=0,S=x.length;A=0;d--){var v=r[d][0]||0;if(o(v,0))h[d]=[0];else{for(var y=0,g=[],x=[],b=m[d],w=m[d+1]-1;w>=b;w--){var N=p[w];N===d?y=l[w]:N=0;m--){var h=r[m][0]||0,d=void 0;if(o(h,0))d=0;else{var v=p[m][m];if(o(v,0))throw new Error("Linear system cannot be solved since matrix is singular");d=n(h,v);for(var y=m-1;y>=0;y--)r[y]=[a(r[y][0]||0,i(d,p[y][m]))]}l[m]=[d]}return new u({data:l,size:[c,1]})}})),ac="lsolveAll",oc=Ee(ac,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],(function(e){var t=e.typed,r=e.matrix,n=e.divideScalar,i=e.multiplyScalar,a=e.subtract,o=e.equalScalar,u=e.DenseMatrix,s=ec({DenseMatrix:u});return t(ac,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r=[s(e,t,!0)._data.map((function(e){return e[0]}))],c=e._size[0],f=e._size[1],l=e._values,p=e._index,m=e._ptr,h=0;hh&&(g.push(l[D]),x.push(E))}if(o(N,0))if(o(y[h],0)){if(0===v){var A=_a(y);A[h]=1;for(var S=0,C=x.length;S=0;h--)for(var d=r.length,v=0;v=b;N--){var D=p[N];D===h?w=l[N]:D=0;l--)for(var p=r.length,m=0;m=0;v--)d[v]=a(d[v],c[v][l]);r.push(d)}}else{if(0===m)return[];r.splice(m,1),m-=1,p-=1}else{h[l]=n(h[l],c[l][l]);for(var y=l-1;y>=0;y--)h[y]=a(h[y],i(h[l],c[y][l]))}}return r.map((function(e){return new u({data:e.map((function(e){return[e]})),size:[f,1]})}))}})),cc=Ee("matAlgo08xS0Sid",["typed","equalScalar"],(function(e){var t=e.typed,r=e.equalScalar;return function(e,n,i){var a=e._values,o=e._index,u=e._ptr,s=e._size,c=e._datatype,f=n._values,l=n._index,p=n._ptr,m=n._size,h=n._datatype;if(s.length!==m.length)throw new Xr(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");if(!a||!f)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var d,v=s[0],y=s[1],g=r,x=0,b=i;"string"==typeof c&&c===h&&(d=c,g=t.find(r,[d,d]),x=t.convert(0,d),b=t.find(i,[d,d]));for(var w,N,D,E,A=[],S=[],C=[],M=[],F=[],O=0;Ot?1:-1},"BigNumber, BigNumber":function(e,t){return ii(e,t,r.epsilon)?new a(0):new a(e.cmp(t))},"Fraction, Fraction":function(e,t){return new o(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:f,DS:c,Ss:l}))})),bc=Ee(gc,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(gc,{"number, number":function(e,t){return ue(e,t,r.epsilon)?0:e>t?1:-1}})})),wc=r(3228),Nc="compareNatural",Dc=Ee(Nc,["typed","compare"],(function(e){var t=e.typed,r=e.compare,n=r.signatures["boolean,boolean"];return t(Nc,{"any, any":function e(t,o){var u,s=H(t),c=H(o);if(!("number"!==s&&"BigNumber"!==s&&"Fraction"!==s||"number"!==c&&"BigNumber"!==c&&"Fraction"!==c))return"0"!==(u=r(t,o)).toString()?u>0?1:-1:wc(s,c);var f=["Array","DenseMatrix","SparseMatrix"];if(f.includes(s)||f.includes(c))return 0!==(u=i(e,t,o))?u:wc(s,c);if(s!==c)return wc(s,c);if("Complex"===s)return function(e,t){return e.re>t.re?1:e.ret.im?1:e.imr.length?1:t.lengtht},"BigNumber, BigNumber":function(e,t){return e.gt(t)&&!ii(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1===e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:u,DS:o,Ss:s}))})),Pc=Ee(qc,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(qc,{"number, number":function(e,t){return e>t&&!ue(e,t,r.epsilon)}})})),Lc="largerEq",Uc=Ee(Lc,["typed","config","matrix","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,a=e.concat,o=Ka({typed:t}),u=Ho({typed:t,DenseMatrix:i}),s=ma({typed:t,DenseMatrix:i}),c=ja({typed:t,matrix:n,concat:a}),f=ai({typed:t});return t(Lc,$c({typed:t,config:r}),{"boolean, boolean":function(e,t){return e>=t},"BigNumber, BigNumber":function(e,t){return e.gte(t)||ii(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:u,DS:o,Ss:s}))})),$c=Ee(Lc,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(Lc,{"number, number":function(e,t){return e>=t||ue(e,t,r.epsilon)}})})),Hc="deepEqual",Gc=Ee(Hc,["typed","equal"],(function(e){var t=e.typed,r=e.equal;return t(Hc,{"any, any":function(e,t){return n(e.valueOf(),t.valueOf())}});function n(e,t){if(Array.isArray(e)){if(Array.isArray(t)){var i=e.length;if(i!==t.length)return!1;for(var a=0;a1)throw new Error("Only one dimensional matrices supported");return s(e.valueOf(),t,r)}if(Array.isArray(e))return s(e,t,r)}function s(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(var a=0;a=0){var l=e[c];e[c]=e[s],e[s]=l,--c}else++s;i(e[s],f)>0&&--s,t<=s?u=s:o=s+1}return e[t]}})),Xc="sort",Qc=Ee(Xc,["typed","matrix","compare","compareNatural"],(function(e){var t=e.typed,r=e.matrix,n=e.compare,i=e.compareNatural,a=n,o=function(e,t){return-n(e,t)};return t(Xc,{Array:function(e){return s(e),e.sort(a)},Matrix:function(e){return c(e),r(e.toArray().sort(a),e.storage())},"Array, function":function(e,t){return s(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),r(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return s(e),e.sort(u(t))},"Matrix, string":function(e,t){return c(e),r(e.toArray().sort(u(t)),e.storage())}});function u(e){if("asc"===e)return a;if("desc"===e)return o;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function s(e){if(1!==Kr(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),Kc=Ee("max",["typed","config","numeric","larger"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.larger;return t("max",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return kn(e,t.valueOf(),a)},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function max");return o(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Es(e,"max",t)}}function o(e){var t;if(Bn(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Es(t,"max",e)}})),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=n(t,r.number)),t}})),ef=Ee("min",["typed","config","numeric","smaller"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.smaller;return t("min",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return kn(e,t.valueOf(),a)},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function min");return o(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Es(e,"min",t)}}function o(e){var t;if(Bn(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Es(t,"min",e)}})),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=n(t,r.number)),t}})),tf=Ee("ImmutableDenseMatrix",["smaller","DenseMatrix"],(function(e){var t=e.smaller,r=e.DenseMatrix;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!c(t))throw new Error("Invalid datatype: "+t);if(l(e)||f(e)){var i=new r(e,t);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&f(e.data)&&f(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 ("+H(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:var t=r.prototype.subset.call(this,e);return l(t)?new n({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")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:he(this._data),size:he(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(null===this._min){var e=null;this.forEach((function(r){(null===e||t(r,e))&&(e=r)})),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var e=null;this.forEach((function(r){(null===e||t(e,r))&&(e=r)})),this._max=null!==e?e:void 0}return this._max},n}),{isClass:!0}),rf=Ee("Index",["ImmutableDenseMatrix"],(function(e){var t=e.ImmutableDenseMatrix;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var t=0,i=arguments.length;t0;){var s=o.right;o.left.right=o.right,o.right.left=o.left,o.left=i,o.right=i.right,i.right=o,o.right.left=o,o.parent=null,o=s,a--}return e.left.right=e.right,e.right.left=e.left,i=e===e.right?null:function(e,i){var a,o=Math.floor(Math.log(i)*n)+1,s=new Array(o),c=0,f=e;if(f)for(c++,f=f.right;f!==e;)c++,f=f.right;for(;c>0;){for(var l=f.degree,p=f.right;a=s[l];){if(r(f.key,a.key)){var m=a;a=f,f=m}u(a,f),s[l]=null,l++}s[l]=f,f=p,c--}e=null;for(var h=0;h=e&&(r(u.value,0)||n(u.key,u.value,this)),(u=i.extractMinimum())&&o.push(u);for(var s=0;s="0"&&e<="9"}function M(){n++,i=r.charAt(n)}function F(e){n=e,i=r.charAt(n)}function O(){var e="",t=n;if("+"===i?M():"-"===i&&(e+=i,M()),!function(e){return e>="0"&&e<="9"||"."===e}(i))return F(t),null;if("."===i){if(e+=i,M(),!C(i))return F(t),null}else{for(;C(i);)e+=i,M();"."===i&&(e+=i,M())}for(;C(i);)e+=i,M();if("E"===i||"e"===i){var r="",a=n;if(r+=i,M(),"+"!==i&&"-"!==i||(r+=i,M()),!C(i))return F(a),e;for(e+=r;C(i);)e+=i,M()}return e}function T(){for(var e="";C(i)||A.isValidAlpha(i);)e+=i,M();var t=e.charAt(0);return A.isValidAlpha(t)?e:null}function B(e){return i===e?(M(),e):null}Object.defineProperty(A,"name",{value:"Unit"}),A.prototype.constructor=A,A.prototype.type="Unit",A.prototype.isUnit=!0,A.parse=function(e,t){if(t=t||{},n=-1,i="","string"!=typeof(r=e))throw new TypeError("Invalid argument in Unit.parse, string expected");var a=new A;a.units=[];var o=1,s=!1;M(),S();var c=O(),f=null;if(c){if("BigNumber"===u.number)f=new N(c);else if("Fraction"===u.number)try{f=new D(c)}catch(e){f=parseFloat(c)}else f=parseFloat(c);S(),B("*")?(o=1,s=!0):B("/")&&(o=-1,s=!0)}for(var l=[],p=1;;){for(S();"("===i;)l.push(o),p*=o,o=1,M(),S();var m;if(!i)break;var h=i;if(null===(m=T()))throw new SyntaxError('Unexpected "'+h+'" in "'+r+'" at index '+n.toString());var d=_(m);if(null===d)throw new SyntaxError('Unit "'+m+'" not found.');var v=o*p;if(S(),B("^")){S();var y=O();if(null===y)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');v*=y}a.units.push({unit:d.unit,prefix:d.prefix,power:v});for(var g=0;g1||Math.abs(this.units[0].power-1)>1e-15)},A.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;for(var t=e,r=A._getNumberConverter(H(e)),n=0;n1e-12)return!1;return!0},A.prototype.equalBase=function(e){for(var t=0;t1e-12)return!1;return!0},A.prototype.equals=function(e){return this.equalBase(e)&&y(this.value,e.value)},A.prototype.multiply=function(e){for(var t=this.clone(),r=s(e)?e:new A(e),n=0;n1e-12&&(Ne(G,u)?n.push({unit:G[u].unit,prefix:G[u].prefix,power:r.dimensions[o]||0}):a=!0)}n.length1e-12){if(!Ne($.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:$.si[n].unit,prefix:$.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,e},A.prototype.formatUnits=function(){for(var e="",t="",r=0,n=0,i=0;i0?(r++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var a=0;a0?(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(t+="^"+-this.units[a].power)):(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,t+="^"+this.units[a].power));e=e.substr(1),t=t.substr(1),r>1&&n>0&&(e="("+e+")"),n>1&&r>0&&(t="("+t+")");var o=e;return r>0&&n>0&&(o+=" / "),o+t},A.prototype.format=function(e){var t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),r=!1;for(var n in void 0!==t.value&&null!==t.value&&o(t.value)&&(r=Math.abs(t.value.re)<1e-14),t.units)Ne(t.units,n)&&t.units[n].unit&&("VA"===t.units[n].unit.name&&r?t.units[n].unit=P.VAR:"VAR"!==t.units[n].unit.name||r||(t.units[n].unit=P.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());var i=t._denormalize(t.value),a=null!==t.value?x(i,e||{}):"",u=t.formatUnits();return t.value&&o(t.value)&&(a="("+a+")"),u.length>0&&a.length>0&&(a+=" "),a+u},A.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!");var e=null!==this.value?h(this.value):0,t=h(this.units[0].unit.value),r=this.units[0].prefix;if(0===e)return r;var n=this.units[0].power,i=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return r;i=Math.abs(i);var a=this.units[0].unit.prefixes;for(var o in a)if(Ne(a,o)){var u=a[o];if(u.scientific){var s=Math.abs(Math.log(e/Math.pow(u.value*t,n))/Math.LN10-1.2);(s0&&!A.isValidAlpha(i)&&!C(i))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);var n,a,o,u=null,s=[],c=0;if(r&&"Unit"===r.type)u=r.clone();else if("string"==typeof r)""!==r&&(n=r);else{if("object"!==t(r))throw new TypeError('Cannot create unit "'+e+'" from "'+r.toString()+'": expecting "string" or "Unit" or "Object"');n=r.definition,a=r.prefixes,c=r.offset,o=r.baseName,r.aliases&&(s=r.aliases.valueOf())}if(s)for(var f=0;f1e-12){h=!1;break}if(h){p=!0,l.base=z[m];break}}if(!p){o=o||e+"_STUFF";var v={dimensions:u.dimensions.slice(0)};v.key=o,z[o]=v,G[o]={unit:l,prefix:I.NONE[""]},l.base=z[o]}}else{if(o=o||e+"_STUFF",R.indexOf(o)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');for(var y in R.push(o),z)Ne(z,y)&&(z[y].dimensions[R.length-1]=0);for(var g={dimensions:[]},x=0;x=-1&&e<=1||r.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),Df="number";function Ef(e){return se(e)}function Af(e){return Math.atan(1/e)}function Sf(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function Cf(e){return Math.asin(1/e)}function Mf(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function Ff(e){return Math.acos(1/e)}function Of(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}function Tf(e){return ce(e)}function Bf(e){return fe(e)}function _f(e){return 1/Math.tan(e)}function kf(e){var t=Math.exp(2*e);return(t+1)/(t-1)}function If(e){return 1/Math.sin(e)}function Rf(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Z(e)}function zf(e){return 1/Math.cos(e)}function qf(e){return 2/(Math.exp(e)+Math.exp(-e))}function jf(e){return pe(e)}Ef.signature=Df,Af.signature=Df,Sf.signature=Df,Cf.signature=Df,Mf.signature=Df,Ff.signature=Df,Of.signature=Df,Tf.signature=Df,Bf.signature=Df,_f.signature=Df,kf.signature=Df,If.signature=Df,Rf.signature=Df,zf.signature=Df,qf.signature=Df,jf.signature=Df;var Pf="acosh",Lf=Ee(Pf,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(Pf,{number:function(e){return e>=1||r.predictable?Ef(e):e<=-1?new n(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new n(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})})),Uf="acot",$f=Ee(Uf,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(Uf,{number:Af,Complex:function(e){return e.acot()},BigNumber:function(e){return new r(1).div(e).atan()}})})),Hf="acoth",Gf=Ee(Hf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Hf,{number:function(e){return e>=1||e<=-1||r.predictable?Sf(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),Vf="acsc",Zf=Ee(Vf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Vf,{number:function(e){return e<=-1||e>=1||r.predictable?Cf(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),Wf="acsch",Yf=Ee(Wf,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(Wf,{number:Mf,Complex:function(e){return e.acsch()},BigNumber:function(e){return new r(1).div(e).asinh()}})})),Jf="asec",Xf=Ee(Jf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Jf,{number:function(e){return e<=-1||e>=1||r.predictable?Ff(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),Qf="asech",Kf=Ee(Qf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Qf,{number:function(e){if(e<=1&&e>=-1||r.predictable){var t=1/e;if(t>0||r.predictable)return Of(e);var i=Math.sqrt(t*t-1);return new n(Math.log(i-t),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),el="asin",tl=Ee(el,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(el,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),rl=Ee("asinh",["typed"],(function(e){return(0,e.typed)("asinh",{number:Tf,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),nl=Ee("atan",["typed"],(function(e){return(0,e.typed)("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),il="atan2",al=Ee(il,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.BigNumber,a=e.DenseMatrix,o=e.concat,u=Va({typed:t,equalScalar:n}),s=Ka({typed:t}),c=xo({typed:t,equalScalar:n}),f=pa({typed:t,equalScalar:n}),l=ma({typed:t,DenseMatrix:a}),p=ja({typed:t,matrix:r,concat:o});return t(il,{"number, number":Math.atan2,"BigNumber, BigNumber":function(e,t){return i.atan2(e,t)}},p({scalar:"number | BigNumber",SS:c,DS:s,SD:u,Ss:f,sS:l}))})),ol="atanh",ul=Ee(ol,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(ol,{number:function(e){return e<=1&&e>=-1||r.predictable?Bf(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),sl=Ee("trigUnit",["typed"],(function(e){var t=e.typed;return{Unit:t.referToSelf((function(e){return function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(e,r.valueType())(r.value)}}))}})),cl=Ee("cos",["typed"],(function(e){var t=e.typed,r=sl({typed:t});return t("cos",{number:Math.cos,"Complex | BigNumber":function(e){return e.cos()}},r)})),fl="cosh",ll=Ee(fl,["typed"],(function(e){return(0,e.typed)(fl,{number:le,"Complex | BigNumber":function(e){return e.cosh()}})})),pl=Ee("cot",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("cot",{number:_f,Complex:function(e){return e.cot()},BigNumber:function(e){return new r(1).div(e.tan())}},sl({typed:t}))})),ml="coth",hl=Ee(ml,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(ml,{number:kf,Complex:function(e){return e.coth()},BigNumber:function(e){return new r(1).div(e.tanh())}})})),dl=Ee("csc",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("csc",{number:If,Complex:function(e){return e.csc()},BigNumber:function(e){return new r(1).div(e.sin())}},sl({typed:t}))})),vl="csch",yl=Ee(vl,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(vl,{number:Rf,Complex:function(e){return e.csch()},BigNumber:function(e){return new r(1).div(e.sinh())}})})),gl=Ee("sec",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("sec",{number:zf,Complex:function(e){return e.sec()},BigNumber:function(e){return new r(1).div(e.cos())}},sl({typed:t}))})),xl="sech",bl=Ee(xl,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(xl,{number:qf,Complex:function(e){return e.sech()},BigNumber:function(e){return new r(1).div(e.cosh())}})})),wl=Ee("sin",["typed"],(function(e){var t=e.typed,r=sl({typed:t});return t("sin",{number:Math.sin,"Complex | BigNumber":function(e){return e.sin()}},r)})),Nl="sinh",Dl=Ee(Nl,["typed"],(function(e){return(0,e.typed)(Nl,{number:jf,"Complex | BigNumber":function(e){return e.sinh()}})})),El=Ee("tan",["typed"],(function(e){var t=e.typed,r=sl({typed:t});return t("tan",{number:Math.tan,"Complex | BigNumber":function(e){return e.tan()}},r)})),Al=Ee("tanh",["typed"],(function(e){return(0,e.typed)("tanh",{number:me,"Complex | BigNumber":function(e){return e.tanh()}})})),Sl="setCartesian",Cl=Ee(Sl,["typed","size","subset","compareNatural","Index","DenseMatrix"],(function(e){var t=e.typed,r=e.size,n=e.subset,i=e.compareNatural,a=e.Index,o=e.DenseMatrix;return t(Sl,{"Array | Matrix, Array | Matrix":function(e,t){var u=[];if(0!==n(r(e),new a(0))&&0!==n(r(t),new a(0))){var s=mn(Array.isArray(e)?e:e.toArray()).sort(i),c=mn(Array.isArray(t)?t:t.toArray()).sort(i);u=[];for(var f=0;f0;r--)for(var n=0;ne[n+1].length&&(t=e[n],e[n]=e[n+1],e[n+1]=t);return e}(u)}});function o(e,t){for(var r=[],n=0;nd?m++:h===d&&(c=f(c,l(a[p],s[m])),p++,m++)}return c}});function o(e,t){var r,n,i=u(e),a=u(t);if(1===i.length)r=i[0];else{if(2!==i.length||1!==i[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");r=i[0]}if(1===a.length)n=a[0];else{if(2!==a.length||1!==a[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+a.join(", ")+")");n=a[0]}if(r!==n)throw new RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw new RangeError("Cannot calculate the dot product of empty vectors");return r}function u(e){return l(e)?e.size():a(e)}})),Ql=Ee("trace",["typed","matrix","add"],(function(e){var t=e.typed,r=e.matrix,n=e.add;return t("trace",{Array:function(e){return i(r(e))},SparseMatrix:function(e){var t=e._values,r=e._index,i=e._ptr,a=e._size,o=a[0],u=a[1];if(o===u){var s=0;if(t.length>0)for(var c=0;cc)break}return s}throw new RangeError("Matrix must be square (size: "+Vr(a)+")")},DenseMatrix:i,any:he});function i(e){var t=e._size,r=e._data;switch(t.length){case 1:if(1===t[0])return he(r[0]);throw new RangeError("Matrix must be square (size: "+Vr(t)+")");case 2:var i=t[0];if(i===t[1]){for(var a=0,o=0;o)'),t+this.index.toHTML(e)}},{key:"_toTex",value:function(e){var t=this.object.toTex(e);return i(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)}},{key:"toJSON",value:function(){return{mathjs:cp,object:this.object,index:this.index}}}],[{key:"fromJSON",value:function(e){return new o(e.object,e.index)}}]),o}(r);return Ba(a,"name",cp),a}),{isClass:!0,isNode:!0});var lp="ArrayNode",pp=Ee(lp,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e){var t;if(Ce(this,i),(t=n.call(this)).items=e||[],!Array.isArray(t.items)||!t.items.every(R))throw new TypeError("Array containing Nodes expected");return t}return Oe(i,[{key:"type",get:function(){return lp}},{key:"isArrayNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=hn(this.items,(function(r){return r._compile(e,t)}));if("Array"!==e.config.matrix){var n=e.matrix;return function(e,t,i){return n(hn(r,(function(r){return r(e,t,i)})))}}return function(e,t,n){return hn(r,(function(r){return r(e,t,n)}))}}},{key:"forEach",value:function(e){for(var t=0;t['+this.items.map((function(t){return t.toHTML(e)})).join(',')+']'}},{key:"_toTex",value:function(e){return function t(r,n){var i=r.some(C)&&!r.every(C),a=n||i,o=a?"&":"\\\\",u=r.map((function(r){return r.items?t(r.items,!n):r.toTex(e)})).join(o);return i||!a||a&&!n?"\\begin{bmatrix}"+u+"\\end{bmatrix}":u}(this.items,!1)}}],[{key:"fromJSON",value:function(e){return new i(e.items)}}]),i}(e.Node);return Ba(t,"name",lp),t}),{isClass:!0,isNode:!0});function mp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r",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 dp(e,t){if(!t||"auto"!==t)return e;for(var r=e;j(r);)r=r.content;return r}function vp(e,t,r,n){var i=e;"keep"!==t&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,u=0;u)'),t+r+'='+n}},{key:"_toTex",value:function(e){var t=this.object.toTex(e),r=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(n="\\left(".concat(n,"\\right)")),t+r+":="+n}}],[{key:"fromJSON",value:function(e){return new i(e.object,e.index,e.value)}}]),i}(i);return Ba(s,"name",xp),s}),{isClass:!0,isNode:!0});var wp="BlockNode",Np=Ee(wp,["ResultSet","Node"],(function(e){var t=e.ResultSet,r=function(e){ip(a,e);var r,n,i=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=op(r);if(n){var i=op(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ap(this,e)});function a(e){var t;if(Ce(this,a),t=i.call(this),!Array.isArray(e))throw new Error("Array expected");return t.blocks=e.map((function(e){var t=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!R(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:r}})),t}return Oe(a,[{key:"type",get:function(){return wp}},{key:"isBlockNode",get:function(){return!0}},{key:"_compile",value:function(e,r){var n=hn(this.blocks,(function(t){return{evaluate:t.node._compile(e,r),visible:t.visible}}));return function(e,r,i){var a=[];return dn(n,(function(t){var n=t.evaluate(e,r,i);t.visible&&a.push(n)})),new t(a)}}},{key:"forEach",value:function(e){for(var t=0;t;')})).join('
')}},{key:"_toTex",value:function(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")}}],[{key:"fromJSON",value:function(e){return new a(e.blocks)}}]),a}(e.Node);return Ba(r,"name",wp),r}),{isClass:!0,isNode:!0});var Dp="ConditionalNode",Ep=Ee(Dp,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e,t,r){var a;if(Ce(this,i),a=n.call(this),!R(e))throw new TypeError("Parameter condition must be a Node");if(!R(t))throw new TypeError("Parameter trueExpr must be a Node");if(!R(r))throw new TypeError("Parameter falseExpr must be a Node");return a.condition=e,a.trueExpr=t,a.falseExpr=r,a}return Oe(i,[{key:"type",get:function(){return Dp}},{key:"isConditionalNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=this.condition._compile(e,t),n=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,u){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(a(e))return!e.isZero();if(o(e))return!(!e.re&&!e.im);if(s(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+H(e)+'"')}(r(e,t,u))?n(e,t,u):i(e,t,u)}}},{key:"forEach",value:function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}},{key:"map",value:function(e){return new i(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}},{key:"clone",value:function(){return new i(this.condition,this.trueExpr,this.falseExpr)}},{key:"_toString",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=vp(this,t,e&&e.implicit),n=this.condition.toString(e),i=vp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n="("+n+")");var a=this.trueExpr.toString(e),o=vp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a="("+a+")");var u=this.falseExpr.toString(e),s=vp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==s&&s<=r)&&(u="("+u+")"),n+" ? "+a+" : "+u}},{key:"toJSON",value:function(){return{mathjs:Dp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}},{key:"toHTML",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=vp(this,t,e&&e.implicit),n=this.condition.toHTML(e),i=vp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n='('+n+')');var a=this.trueExpr.toHTML(e),o=vp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a='('+a+')');var u=this.falseExpr.toHTML(e),s=vp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==s&&s<=r)&&(u='('+u+')'),n+'?'+a+':'+u}},{key:"_toTex",value:function(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}],[{key:"fromJSON",value:function(e){return new i(e.condition,e.trueExpr,e.falseExpr)}}]),i}(e.Node);return Ba(t,"name",Dp),t}),{isClass:!0,isNode:!0}),Ap=r(7928),Sp={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{?}"},Cp={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"},Mp={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Cp.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Cp.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Cp.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Cp.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Cp.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]}".concat(Cp.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Cp.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Cp.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Cp.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Cp.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Cp.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Cp.bitAnd,"${args[1]}\\right)")},bitNot:{1:Cp.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Cp.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Cp.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Cp.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Cp.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Cp.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Cp.and,"${args[1]}\\right)")},not:{1:Cp.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Cp.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Cp.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Cp.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Cp.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Cp.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Cp.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Cp.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Cp.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Cp.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Cp.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Cp.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Cp.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Cp.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)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(Sp.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)"}},Fp={deg:"^\\circ"};function Op(e){return Ap(e,{preserveFormatting:!0})}function Tp(e,t){return(t=void 0!==t&&t)?Ne(Fp,e)?Fp[e]:"\\mathrm{"+Op(e)+"}":Ne(Sp,e)?Sp[e]:Op(e)}var Bp="ConstantNode",_p=Ee(Bp,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e){var t;return Ce(this,i),(t=n.call(this)).value=e,t}return Oe(i,[{key:"type",get:function(){return Bp}},{key:"isConstantNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=this.value;return function(){return r}}},{key:"forEach",value:function(e){}},{key:"map",value:function(e){return this.clone()}},{key:"clone",value:function(){return new i(this.value)}},{key:"_toString",value:function(e){return Vr(this.value,e)}},{key:"toHTML",value:function(e){var t=this._toString(e);switch(H(this.value)){case"number":case"BigNumber":case"Fraction":return''+t+"";case"string":return''+t+"";case"boolean":return''+t+"";case"null":return''+t+"";case"undefined":return''+t+"";default:return''+t+""}}},{key:"toJSON",value:function(){return{mathjs:Bp,value:this.value}}},{key:"_toTex",value:function(e){var t=this._toString(e);switch(H(this.value)){case"string":return"\\mathtt{"+Op(t)+"}";case"number":case"BigNumber":if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var r=t.toLowerCase().indexOf("e");return-1!==r?t.substring(0,r)+"\\cdot10^{"+t.substring(r+1)+"}":t;case"Fraction":return this.value.toLatex();default:return t}}}],[{key:"fromJSON",value:function(e){return new i(e.value)}}]),i}(e.Node);return Ba(t,"name",Bp),t}),{isClass:!0,isNode:!0});function kp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(t);try{for(s.s();!(i=s.n()).done;){var c=i.value,f="string"==typeof c?c:c.name;if(u.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));u.add(f)}}catch(e){s.e(e)}finally{s.f()}return n.name=e,n.params=t.map((function(e){return e&&e.name||e})),n.types=t.map((function(e){return e&&e.type||"any"})),n.expr=r,n}return Oe(o,[{key:"type",get:function(){return Ip}},{key:"isFunctionAssignmentNode",get:function(){return!0}},{key:"_compile",value:function(e,r){var n=Object.create(r);dn(this.params,(function(e){n[e]=!0}));var i=this.expr._compile(e,n),a=this.name,o=this.params,u=gn(this.types,","),s=a+"("+gn(this.params,", ")+")";return function(e,r,n){var c={};c[u]=function(){for(var t=Object.create(r),a=0;a'+Wr(this.params[i])+"");var a=this.expr.toHTML(e);return r(this,t,e&&e.implicit)&&(a='('+a+')'),''+Wr(this.name)+'('+n.join(',')+')='+a}},{key:"_toTex",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=this.expr.toTex(e);return r(this,t,e&&e.implicit)&&(n="\\left(".concat(n,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Tp).join(",")+"\\right):="+n}}],[{key:"fromJSON",value:function(e){return new o(e.name,e.params,e.expr)}}]),o}(e.Node);return Ba(n,"name",Ip),n}),{isClass:!0,isNode:!0});var zp="IndexNode",qp=Ee(zp,["Node","size"],(function(e){var t=e.Node,r=e.size,n=function(e){ip(a,e);var t,n,i=(t=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=op(t);if(n){var i=op(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return ap(this,e)});function a(e,t){var r;if(Ce(this,a),(r=i.call(this)).dimensions=e,r.dotNotation=t||!1,!Array.isArray(e)||!e.every(R))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(r.dotNotation&&!r.isObjectProperty())throw new Error("dotNotation only applicable for object properties");return r}return Oe(a,[{key:"type",get:function(){return zp}},{key:"isIndexNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var n=hn(this.dimensions,(function(n,i){if(n.filter((function(e){return e.isSymbolNode&&"end"===e.name})).length>0){var a=Object.create(t);a.end=!0;var o=n._compile(e,a);return function(e,t,n){if(!l(n)&&!f(n)&&!c(n))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+H(n));var a=r(n).valueOf(),u=Object.create(t);return u.end=a[i],o(e,u,n)}}return n._compile(e,t)})),i=Te(e,"index");return function(e,t,r){var a=hn(n,(function(n){return n(e,t,r)}));return i.apply(void 0,_a(a))}}},{key:"forEach",value:function(e){for(var t=0;t.'+Wr(this.getObjectProperty())+"":'['+t.join(',')+']'}},{key:"_toTex",value:function(e){var t=this.dimensions.map((function(t){return t.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"}}],[{key:"fromJSON",value:function(e){return new a(e.dimensions,e.dotNotation)}}]),a}(t);return Ba(n,"name",zp),n}),{isClass:!0,isNode:!0});var jp="ObjectNode",Pp=Ee(jp,["Node"],(function(e){var r=function(e){ip(a,e);var r,n,i=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=op(r);if(n){var i=op(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ap(this,e)});function a(e){var r;if(Ce(this,a),(r=i.call(this)).properties=e||{},e&&("object"!==t(e)||!Object.keys(e).every((function(t){return R(e[t])}))))throw new TypeError("Object containing Nodes expected");return r}return Oe(a,[{key:"type",get:function(){return jp}},{key:"isObjectNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r={};for(var n in this.properties)if(Ne(this.properties,n)){var i=Zr(n),a=JSON.parse(i),o=Te(this.properties,n);r[a]=o._compile(e,t)}return function(e,t,n){var i={};for(var a in r)Ne(r,a)&&(i[a]=r[a](e,t,n));return i}}},{key:"forEach",value:function(e){for(var t in this.properties)Ne(this.properties,t)&&e(this.properties[t],"properties["+Zr(t)+"]",this)}},{key:"map",value:function(e){var t={};for(var r in this.properties)Ne(this.properties,r)&&(t[r]=this._ifNode(e(this.properties[r],"properties["+Zr(r)+"]",this)));return new a(t)}},{key:"clone",value:function(){var e={};for(var t in this.properties)Ne(this.properties,t)&&(e[t]=this.properties[t]);return new a(e)}},{key:"_toString",value:function(e){var t=[];for(var r in this.properties)Ne(this.properties,r)&&t.push(Zr(r)+": "+this.properties[r].toString(e));return"{"+t.join(", ")+"}"}},{key:"toJSON",value:function(){return{mathjs:jp,properties:this.properties}}},{key:"toHTML",value:function(e){var t=[];for(var r in this.properties)Ne(this.properties,r)&&t.push(''+Wr(r)+':'+this.properties[r].toHTML(e));return'{'+t.join(',')+'}'}},{key:"_toTex",value:function(e){var t=[];for(var r in this.properties)Ne(this.properties,r)&&t.push("\\mathbf{"+r+":} & "+this.properties[r].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"}}],[{key:"fromJSON",value:function(e){return new a(e.properties)}}]),a}(e.Node);return Ba(r,"name",jp),r}),{isClass:!0,isNode:!0});var Lp="OperatorNode",Up=Ee(Lp,["Node"],(function(e){function t(e,r){var n=e;if("auto"===r)for(;j(n);)n=n.content;return!!T(n)||!!q(n)&&t(n.args[0],r)}function r(e,r,n,i,a){var o,u=vp(e,r,n),s=yp(e,r);if("all"===r||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}}));switch(i.length){case 0:o=[];break;case 1:var c=vp(i[0],r,n,e);if(a&&null!==c){var f,l;if("keep"===r?(f=i[0].getIdentifier(),l=e.getIdentifier()):(f=i[0].getContent().getIdentifier(),l=e.getContent().getIdentifier()),!1===hp[u][l].latexLeftParens){o=[!1];break}if(!1===hp[c][f].latexParens){o=[!1];break}}if(null===c){o=[!1];break}if(c<=u){o=[!0];break}o=[!1];break;case 2:var p,m,h=vp(i[0],r,n,e),d=gp(e,i[0],r);p=null!==h&&(h===u&&"right"===s&&!d||h=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==r&&"hide"===n)for(var w=1;w2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var l=i.map((function(t,r){return t=t.toString(e),a[r]&&(t="("+t+")"),t}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?l.join(" "):l.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}},{key:"toJSON",value:function(){return{mathjs:Lp,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}},{key:"toHTML",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,a=r(this,t,n,i,!1);if(1===i.length){var o=yp(this,t),u=i[0].toHTML(e);return a[0]&&(u='('+u+')'),"right"===o?''+Wr(this.op)+""+u:u+''+Wr(this.op)+""}if(2===i.length){var s=i[0].toHTML(e),c=i[1].toHTML(e);return a[0]&&(s='('+s+')'),a[1]&&(c='('+c+')'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?s+''+c:s+''+Wr(this.op)+""+c}var f=i.map((function(t,r){return t=t.toHTML(e),a[r]&&(t='('+t+')'),t}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?f.join(''):f.join(''+Wr(this.op)+""):''+Wr(this.fn)+'('+f.join(',')+')'}},{key:"_toTex",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,a=r(this,t,n,i,!0),o=Cp[this.fn];if(o=void 0===o?this.op:o,1===i.length){var u=yp(this,t),s=i[0].toTex(e);return a[0]&&(s="\\left(".concat(s,"\\right)")),"right"===u?o+s:s+o}if(2===i.length){var c=i[0],f=c.toTex(e);a[0]&&(f="\\left(".concat(f,"\\right)"));var l,p=i[1].toTex(e);switch(a[1]&&(p="\\left(".concat(p,"\\right)")),l="keep"===t?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+f+"}{"+p+"}";case"OperatorNode:pow":switch(f="{"+f+"}",p="{"+p+"}",l){case"ConditionalNode":case"OperatorNode:divide":f="\\left(".concat(f,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return f+"~"+p}return f+o+p}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var m=i.map((function(t,r){return t=t.toTex(e),a[r]&&(t="\\left(".concat(t,"\\right)")),t}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?m.join("~"):m.join(o)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(t){return t.toTex(e)})).join(",")+"\\right)"}},{key:"getIdentifier",value:function(){return this.type+":"+this.fn}}],[{key:"fromJSON",value:function(e){return new a(e.op,e.fn,e.args,e.implicit,e.isPercentage)}}]),a}(e.Node);return Ba(n,"name",Lp),n}),{isClass:!0,isNode:!0});var $p="ParenthesisNode",Hp=Ee($p,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e){var t;if(Ce(this,i),t=n.call(this),!R(e))throw new TypeError('Node expected for parameter "content"');return t.content=e,t}return Oe(i,[{key:"type",get:function(){return $p}},{key:"isParenthesisNode",get:function(){return!0}},{key:"_compile",value:function(e,t){return this.content._compile(e,t)}},{key:"getContent",value:function(){return this.content.getContent()}},{key:"forEach",value:function(e){e(this.content,"content",this)}},{key:"map",value:function(e){return new i(e(this.content,"content",this))}},{key:"clone",value:function(){return new i(this.content)}},{key:"_toString",value:function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}},{key:"toJSON",value:function(){return{mathjs:$p,content:this.content}}},{key:"toHTML",value:function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'('+this.content.toHTML(e)+')':this.content.toHTML(e)}},{key:"_toTex",value:function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)}}],[{key:"fromJSON",value:function(e){return new i(e.content)}}]),i}(e.Node);return Ba(t,"name",$p),t}),{isClass:!0,isNode:!0});var Gp="RangeNode",Vp=Ee(Gp,["Node"],(function(e){function t(e,t,r){var n=vp(e,t,r),i={},a=vp(e.start,t,r);if(i.start=null!==a&&a<=n||"all"===t,e.step){var o=vp(e.step,t,r);i.step=null!==o&&o<=n||"all"===t}var u=vp(e.end,t,r);return i.end=null!==u&&u<=n||"all"===t,i}var r=function(e){ip(a,e);var r,n,i=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=op(r);if(n){var i=op(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ap(this,e)});function a(e,t,r){var n;if(Ce(this,a),n=i.call(this),!R(e))throw new TypeError("Node expected");if(!R(t))throw new TypeError("Node expected");if(r&&!R(r))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");return n.start=e,n.end=t,n.step=r||null,n}return Oe(a,[{key:"type",get:function(){return Gp}},{key:"isRangeNode",get:function(){return!0}},{key:"needsEnd",value:function(){return this.filter((function(e){return U(e)&&"end"===e.name})).length>0}},{key:"_compile",value:function(e,t){var r=e.range,n=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){var a=this.step._compile(e,t);return function(e,t,o){return r(n(e,t,o),i(e,t,o),a(e,t,o))}}return function(e,t,a){return r(n(e,t,a),i(e,t,a))}}},{key:"forEach",value:function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}},{key:"map",value:function(e){return new a(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))}},{key:"clone",value:function(){return new a(this.start,this.end,this.step&&this.step)}},{key:"_toString",value:function(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toString(e);if(n.start&&(i="("+i+")"),r=i,this.step){var a=this.step.toString(e);n.step&&(a="("+a+")"),r+=":"+a}var o=this.end.toString(e);return n.end&&(o="("+o+")"),r+":"+o}},{key:"toJSON",value:function(){return{mathjs:Gp,start:this.start,end:this.end,step:this.step}}},{key:"toHTML",value:function(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toHTML(e);if(n.start&&(i='('+i+')'),r=i,this.step){var a=this.step.toHTML(e);n.step&&(a='('+a+')'),r+=':'+a}var o=this.end.toHTML(e);return n.end&&(o='('+o+')'),r+':'+o}},{key:"_toTex",value:function(e){var r=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),n=this.start.toTex(e);if(r.start&&(n="\\left(".concat(n,"\\right)")),this.step){var i=this.step.toTex(e);r.step&&(i="\\left(".concat(i,"\\right)")),n+=":"+i}var a=this.end.toTex(e);return r.end&&(a="\\left(".concat(a,"\\right)")),n+":"+a}}],[{key:"fromJSON",value:function(e){return new a(e.start,e.end,e.step)}}]),a}(e.Node);return Ba(r,"name",Gp),r}),{isClass:!0,isNode:!0});var Zp="RelationalNode",Wp=Ee(Zp,["Node"],(function(e){var t=e.Node,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},n=function(e){ip(a,e);var t,n,i=(t=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=op(t);if(n){var i=op(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return ap(this,e)});function a(e,t){var r;if(Ce(this,a),r=i.call(this),!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");return r.conditionals=e,r.params=t,r}return Oe(a,[{key:"type",get:function(){return Zp}},{key:"isRelationalNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=this,n=this.params.map((function(r){return r._compile(e,t)}));return function(t,i,a){for(var o,u=n[0](t,i,a),s=0;s('+r.toHTML(e)+')':r.toHTML(e)})),a=i[0],o=0;o'+Wr(r[this.conditionals[o]])+""+i[o+1];return a}},{key:"_toTex",value:function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=vp(this,t,e&&e.implicit),n=this.params.map((function(n,i){var a=vp(n,t,e&&e.implicit);return"all"===t||null!==a&&a<=r?"\\left("+n.toTex(e)+"\right)":n.toTex(e)})),i=n[0],a=0;a'+t+"":"i"===t?''+t+"":"Infinity"===t?''+t+"":"NaN"===t?''+t+"":"null"===t?''+t+"":"undefined"===t?''+t+"":''+t+""}},{key:"toJSON",value:function(){return{mathjs:"SymbolNode",name:this.name}}},{key:"_toTex",value:function(e){var r=!1;void 0===t[this.name]&&n(this.name)&&(r=!0);var i=Tp(this.name,r);return"\\"===i[0]?i:" "+i}}],[{key:"onUndefinedSymbol",value:function(e){throw new Error("Undefined symbol "+e)}},{key:"fromJSON",value:function(e){return new u(e.name)}}]),u}(e.Node);return i}),{isClass:!0,isNode:!0});function Jp(){return Jp="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=op(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Jp.apply(this,arguments)}function Xp(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n'+Wr(this.fn)+'('+t.join(',')+')'}},{key:"toTex",value:function(e){var r;return e&&"object"===t(e.handler)&&Ne(e.handler,this.name)&&(r=e.handler[this.name](this,e)),void 0!==r?r:Jp(op(c.prototype),"toTex",this).call(this,e)}},{key:"_toTex",value:function(e){var n,i,a=this.args.map((function(t){return t.toTex(e)}));switch(Mp[this.name]&&(n=Mp[this.name]),!r[this.name]||"function"!=typeof r[this.name].toTex&&"object"!==t(r[this.name].toTex)&&"string"!=typeof r[this.name].toTex||(n=r[this.name].toTex),t(n)){case"function":i=n(this,e);break;case"string":i=o(n,this,e);break;case"object":switch(t(n[a.length])){case"function":i=n[a.length](this,e);break;case"string":i=o(n[a.length],this,e)}}return void 0!==i?i:o("\\mathrm{${name}}\\left(${args}\\right)",this,e)}},{key:"getIdentifier",value:function(){return this.type+":"+this.name}}]),c}(n);return Ba(u,"name",Qp),Ba(u,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),Ba(u,"fromJSON",(function(e){return new u(e.fn,e.args)})),u}),{isClass:!0,isNode:!0}),em="parse",tm=Ee(em,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(function(e){var t=e.typed,r=e.numeric,n=e.config,i=e.AccessorNode,a=e.ArrayNode,o=e.AssignmentNode,u=e.BlockNode,s=e.ConditionalNode,c=e.ConstantNode,f=e.FunctionAssignmentNode,l=e.FunctionNode,p=e.IndexNode,m=e.ObjectNode,h=e.OperatorNode,d=e.ParenthesisNode,v=e.RangeNode,y=e.RelationalNode,g=e.SymbolNode,x=t(em,{string:function(e){return P(e,{})},"Array | Matrix":function(e){return b(e,{})},"string, Object":function(e,t){return P(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":b});function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0!==t.nodes?t.nodes:{};return _n(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return P(e,r)}))}var 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},D={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},E={true:!0,false:!1,null:null,undefined:void 0},A=["NaN","Infinity"];function C(e,t){return e.expression.substr(e.index,t)}function M(e){return C(e,1)}function F(e){e.index++}function O(e){return e.expression.charAt(e.index-1)}function _(e){return e.expression.charAt(e.index+1)}function I(e){for(e.tokenType=w.NULL,e.token="",e.comment="";;){if("#"===M(e))for(;"\n"!==M(e)&&""!==M(e);)e.comment+=M(e),F(e);if(!x.isWhitespace(M(e),e.nestingLevel))break;F(e)}if(""!==M(e)){if("\n"===M(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=M(e),void F(e);var t=M(e),r=C(e,2),n=C(e,3);if(3===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,F(e),F(e),void F(e);if(2===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,F(e),void F(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void F(e);if(x.isDigitDot(t)){e.tokenType=w.NUMBER;var i=C(e,2);if("0b"===i||"0o"===i||"0x"===i){for(e.token+=M(e),F(e),e.token+=M(e),F(e);x.isHexDigit(M(e));)e.token+=M(e),F(e);if("."===M(e))for(e.token+=".",F(e);x.isHexDigit(M(e));)e.token+=M(e),F(e);else if("i"===M(e))for(e.token+="i",F(e);x.isDigit(M(e));)e.token+=M(e),F(e);return}if("."===M(e)){if(e.token+=M(e),F(e),!x.isDigit(M(e)))return void(e.tokenType=w.DELIMITER)}else{for(;x.isDigit(M(e));)e.token+=M(e),F(e);x.isDecimalMark(M(e),_(e))&&(e.token+=M(e),F(e))}for(;x.isDigit(M(e));)e.token+=M(e),F(e);if("E"===M(e)||"e"===M(e))if(x.isDigit(_(e))||"-"===_(e)||"+"===_(e)){if(e.token+=M(e),F(e),"+"!==M(e)&&"-"!==M(e)||(e.token+=M(e),F(e)),!x.isDigit(M(e)))throw ce(e,'Digit expected, got "'+M(e)+'"');for(;x.isDigit(M(e));)e.token+=M(e),F(e);if(x.isDecimalMark(M(e),_(e)))throw ce(e,'Digit expected, got "'+M(e)+'"')}else if("."===_(e))throw F(e),ce(e,'Digit expected, got "'+M(e)+'"')}else{if(!x.isAlpha(M(e),O(e),_(e))){for(e.tokenType=w.UNKNOWN;""!==M(e);)e.token+=M(e),F(e);throw ce(e,'Syntax error in part "'+e.token+'"')}for(;x.isAlpha(M(e),O(e),_(e))||x.isDigit(M(e));)e.token+=M(e),F(e);Ne(D,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}else e.tokenType=w.DELIMITER}function R(e){do{I(e)}while("\n"===e.token)}function z(e){e.nestingLevel++}function j(e){e.nestingLevel--}function P(e,t){var r={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};of(r,{expression:e,extraNodes:t}),I(r);var n=function(e){var t,r,n=[];for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=L(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})),I(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=L(e),e.comment&&(t.comment=e.comment),r=";"!==e.token,n.push({node:t,visible:r}));return n.length>0?new u(n):(t||(t=new c(void 0),e.comment&&(t.comment=e.comment)),t)}(r);if(""!==r.token)throw r.tokenType===w.DELIMITER?fe(r,"Unexpected operator "+r.token):ce(r,'Unexpected part "'+r.token+'"');return n}function L(e){var t,r,n,i,a=function(e){for(var t=function(e){for(var t=$(e);"or"===e.token;)R(e),t=new h("or","or",[t,$(e)]);return t}(e);"?"===e.token;){var r=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,R(e);var n=t,i=L(e);if(":"!==e.token)throw ce(e,"False part of conditional expression expected");e.conditionalLevel=null,R(e);var a=L(e);t=new s(n,i,a),e.conditionalLevel=r}return t}(e);if("="===e.token){if(U(a))return t=a.name,R(e),n=L(e),new o(new g(t),n);if(S(a))return R(e),n=L(e),new o(a.object,a.index,n);if(k(a)&&U(a.fn)&&(i=!0,r=[],t=a.name,a.args.forEach((function(e,t){U(e)?r[t]=e.name:i=!1})),i))return R(e),n=L(e),new f(t,r,n);throw ce(e,"Invalid left hand side of assignment operator =")}return a}function $(e){for(var t=H(e);"xor"===e.token;)R(e),t=new h("xor","xor",[t,H(e)]);return t}function H(e){for(var t=G(e);"and"===e.token;)R(e),t=new h("and","and",[t,G(e)]);return t}function G(e){for(var t=V(e);"|"===e.token;)R(e),t=new h("|","bitOr",[t,V(e)]);return t}function V(e){for(var t=Z(e);"^|"===e.token;)R(e),t=new h("^|","bitXor",[t,Z(e)]);return t}function Z(e){for(var t=W(e);"&"===e.token;)R(e),t=new h("&","bitAnd",[t,W(e)]);return t}function W(e){for(var t=[Y(e)],r=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Ne(n,e.token);){var i={name:e.token,fn:n[e.token]};r.push(i),R(e),t.push(Y(e))}return 1===t.length?t[0]:2===t.length?new h(r[0].name,r[0].fn,t):new y(r.map((function(e){return e.fn})),t)}function Y(e){var t,r,n,i;t=J(e);for(var a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Ne(a,e.token);)n=a[r=e.token],R(e),i=[t,J(e)],t=new h(r,n,i);return t}function J(e){var t,r,n,i;t=X(e);for(var a={to:"to",in:"to"};Ne(a,e.token);)n=a[r=e.token],R(e),"in"===r&&""===e.token?t=new h("*","multiply",[t,new g("in")],!0):(i=[t,X(e)],t=new h(r,n,i));return t}function X(e){var t,r=[];if(t=":"===e.token?new c(1):Q(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(r.push(t);":"===e.token&&r.length<3;)R(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?r.push(new g("end")):r.push(Q(e));t=3===r.length?new v(r[0],r[2],r[1]):new v(r[0],r[1])}return t}function Q(e){var t,r,n,i;t=K(e);for(var a={"+":"add","-":"subtract"};Ne(a,e.token);){n=a[r=e.token],R(e);var o=K(e);i=o.isPercentage?[t,new h("*","multiply",[t,o])]:[t,o],t=new h(r,n,i)}return t}function K(e){var t,r,n,i;r=t=ee(e);for(var a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Ne(a,e.token);)i=a[n=e.token],R(e),r=ee(e),t=new h(n,i,[t,r]);return t}function ee(e){var t,r;for(r=t=te(e);e.tokenType===w.SYMBOL||"in"===e.token&&T(t)||!(e.tokenType!==w.NUMBER||T(r)||q(r)&&"!"!==r.op)||"("===e.token;)r=te(e),t=new h("*","multiply",[t,r],!0);return t}function te(e){for(var t=re(e),r=t,n=[];"/"===e.token&&B(r);){if(n.push(of({},e)),R(e),e.tokenType!==w.NUMBER){of(e,n.pop());break}if(n.push(of({},e)),R(e),e.tokenType!==w.SYMBOL&&"("!==e.token){n.pop(),of(e,n.pop());break}of(e,n.pop()),n.pop(),r=re(e),t=new h("/","divide",[t,r])}return t}function re(e){var t,r,n,i;t=ne(e);for(var a={"%":"mod",mod:"mod"};Ne(a,e.token);)n=a[r=e.token],R(e),"%"===r&&e.tokenType===w.DELIMITER&&"("!==e.token?t=new h("/","divide",[t,new c(100)],!1,!0):(i=[t,ne(e)],t=new h(r,n,i));return t}function ne(e){var t,i,o,u={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Ne(u,e.token)?(o=u[e.token],t=e.token,R(e),i=[ne(e)],new h(t,o,i)):function(e){var t,i,o,u;return t=function(e){var t,i,o;t=function(e){var t=[];if(e.tokenType===w.SYMBOL&&Ne(e.extraNodes,e.token)){var i=e.extraNodes[e.token];if(I(e),"("===e.token){if(t=[],z(e),I(e),")"!==e.token)for(t.push(L(e));","===e.token;)I(e),t.push(L(e));if(")"!==e.token)throw ce(e,"Parenthesis ) expected");j(e),I(e)}return new i(t)}return function(e){var t;return e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in D?(t=e.token,I(e),ie(e,Ne(E,t)?new c(E[t]):-1!==A.indexOf(t)?new c(r(t,"number")):new g(t))):function(e){var t;return'"'===e.token?(t=ae(e),ie(e,new c(t))):function(e){var t;return"'"===e.token?(t=oe(e),ie(e,new c(t))):function(e){var t,i,o,u;if("["===e.token){if(z(e),I(e),"]"!==e.token){var s=ue(e);if(";"===e.token){for(o=1,i=[s];";"===e.token;)I(e),i[o]=ue(e),o++;if("]"!==e.token)throw ce(e,"End of matrix ] expected");j(e),I(e),u=i[0].items.length;for(var f=1;f0},x.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},x.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},x.isDigit=function(e){return e>="0"&&e<="9"},x.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},t.addConversion({from:"string",to:"Node",convert:x}),x})),rm="compile",nm=Ee(rm,["typed","parse"],(function(e){var t=e.typed,r=e.parse;return t(rm,{string:function(e){return r(e).compile()},"Array | Matrix":function(e){return _n(e,(function(e){return r(e).compile()}))}})})),im="evaluate",am=Ee(im,["typed","parse"],(function(e){var t=e.typed,r=e.parse;return t(im,{string:function(e){var t=Le();return r(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return r(e).compile().evaluate(t)},"Array | Matrix":function(e){var t=Le();return _n(e,(function(e){return r(e).compile().evaluate(t)}))},"Array | Matrix, Map | Object":function(e,t){return _n(e,(function(e){return r(e).compile().evaluate(t)}))}})})),om=Ee("Parser",["evaluate"],(function(e){var t=e.evaluate;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Le(),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 Pe)return e.wrappedObject;var t,r={},n=qe(e.keys());try{for(n.s();!(t=n.n()).done;){var i=t.value;Be(r,i,e.get(i))}}catch(e){n.e(e)}finally{n.f()}return r}(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(e,t){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}),um="parser",sm=Ee(um,["typed","Parser"],(function(e){var t=e.typed,r=e.Parser;return t(um,{"":function(){return new r}})})),cm=Ee("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(function(e){var t=e.typed,r=e.matrix,n=e.abs,i=e.addScalar,a=e.divideScalar,o=e.multiplyScalar,u=e.subtract,s=e.larger,c=e.equalScalar,f=e.unaryMinus,l=e.DenseMatrix,p=e.SparseMatrix,m=e.Spa;return t("lup",{DenseMatrix:function(e){return h(e)},SparseMatrix:function(e){return function(e){var t,r,i,u=e._size[0],l=e._size[1],h=Math.min(u,l),d=e._values,v=e._index,y=e._ptr,g=[],x=[],b=[],w=[u,h],N=[],D=[],E=[],A=[h,l],S=[],C=[];for(t=0;t0&&e.forEach(0,r-1,(function(t,r){p._forEachRow(t,g,x,b,(function(n,i){n>t&&e.accumulate(n,f(o(i,r)))}))}));var M,F,O,T,B=r,_=e.get(r),k=n(_);e.forEach(r+1,u-1,(function(e,t){var r=n(t);s(r,k)&&(B=e,k=r,_=t)})),r!==B&&(p._swapRows(r,B,w[1],g,x,b),p._swapRows(r,B,A[1],N,D,E),e.swap(r,B),F=B,O=C[M=r],T=C[F],S[O]=F,S[T]=M,C[M]=T,C[F]=O),e.forEach(0,u-1,(function(e,t){e<=r?(N.push(t),D.push(e)):(t=a(t,_),c(t,0)||(g.push(t),x.push(e)))}))};for(r=0;r0)for(t=0;t0)for(var n="Complex"===r[0][0].type?d(0):0,i=0;i=0;){var s=r[o+u],c=r[n+s];-1===c?(u--,a[t++]=s):(r[n+s]=r[i+c],r[o+ ++u]=c)}return t}function pm(e){return-e-2}var mm=Ee("csAmd",["add","multiply","transpose"],(function(e){var t=e.add,r=e.multiply,n=e.transpose;return function(e,o){if(!o||e<=0||e>3)return null;var u=o._size,s=u[0],c=u[1],f=0,l=Math.max(16,10*Math.sqrt(c)),p=function(e,i,a,o,u){var s=n(i);if(1===e&&o===a)return t(i,s);if(2===e){for(var c=s._index,f=s._ptr,l=0,p=0;pu))for(var h=f[p+1];mo)r[u+p]=0,r[i+p]=-1,l++,t[p]=pm(e),r[u+e]++;else{var h=r[s+m];-1!==h&&(c[h]=p),r[f+p]=r[s+m],r[s+m]=p}}return l}(c,O,_,q,z,j,l,k,R,L,I),H=0;$G?(g=d,x=W,b=_[0+d]-G):(x=O[g=F[W++]],b=_[0+g]),y=1;y<=b;y++)(w=_[k+(m=F[x++])])<=0||(Z+=w,_[k+m]=-w,F[J++]=m,-1!==_[I+m]&&(L[_[I+m]]=L[m]),-1!==L[m]?_[I+L[m]]=_[I+m]:_[R+_[q+m]]=_[I+m]);g!==d&&(O[g]=pm(d),_[j+g]=0)}for(0!==G&&(T=J),_[q+d]=Z,O[d]=Y,_[0+d]=J-Y,_[z+d]=-2,U=i(U,f,_,j,c),N=Y;N=U?_[j+g]-=w:0!==_[j+g]&&(_[j+g]=_[q+g]+X)}for(N=Y;N0?(M+=Q,F[S++]=g,C+=g):(O[g]=pm(d),_[j+g]=0)}_[z+m]=S-E+1;var K=S,ee=E+_[0+m];for(W=A+1;W=0))for(m=_[P+(C=L[m])],_[P+C]=-1;-1!==m&&-1!==_[I+m];m=_[I+m],U++){for(b=_[0+m],D=_[z+m],W=O[m]+1;W<=O[m]+b-1;W++)_[j+F[W]]=U;var re=m;for(h=_[I+m];-1!==h;){var ne=_[0+h]===b&&_[z+h]===D;for(W=O[h]+1;ne&&W<=O[h]+b-1;W++)_[j+F[W]]!==U&&(ne=0);ne?(O[h]=pm(m),_[k+m]+=_[k+h],_[k+h]=0,_[z+h]=-1,h=_[I+h],_[I+re]=h):(re=h,h=_[I+h])}}for(W=Y,N=Y;N=0;h--)_[k+h]>0||(_[I+h]=_[R+O[h]],_[R+O[h]]=h);for(g=c;g>=0;g--)_[k+g]<=0||-1!==O[g]&&(_[I+g]=_[R+O[g]],_[R+O[g]]=g);for(d=0,m=0;m<=c;m++)-1===O[m]&&(d=lm(m,d,_,R,I,B,j));return B.splice(B.length-1,1),B};function i(e,t,r,n,i){if(e<2||e+t<0){for(var a=0;a=1&&N[o]++,2===S.jleaf&&N[S.q]--}-1!==r[o]&&(v[0+o]=r[o])}for(o=0;o=0;r--)-1!==e[r]&&(a[o+r]=a[0+e[r]],a[0+e[r]]=r);for(r=0;r=0;s--)for(f=r[s],l=r[s+1],c=f;c=0;u--)m[u]=-1,-1!==(s=h[u])&&(0==d[g+s]++&&(d[y+s]=u),d[0+u]=d[v+s],d[v+s]=u);for(t.lnz=0,t.m2=a,s=0;s=0;){e=n[l];var p=i?i[e]:e;ym(c,e)||(gm(c,e),n[f+l]=p<0?0:xm(c[p]));var m=1;for(o=n[f+l],u=p<0?0:xm(c[p+1]);o3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||r>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=l(t,e,!1),i=p(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function Em(e,t){var r,n=t.length,i=[];if(e)for(r=0;r0&&r(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError("Polynomial [".concat(e,", ").concat(t,"] must have a non-zero non-constant coefficient"));switch(h.length){case 2:return[c(u(h[0],h[1]))];case 3:var d=la(h,3),v=d[0],y=d[1],g=d[2],x=o(2,g),b=o(y,y),w=o(4,g,v);if(n(b,w))return[u(c(y),x)];var N=s(a(b,w));return[u(a(N,y),x),u(a(c(N),y),x)];case 4:var D=la(h,4),E=D[0],A=D[1],S=D[2],C=D[3],M=c(o(3,C)),F=o(S,S),O=o(3,C,A),T=i(o(2,S,S,S),o(27,C,C,E)),B=o(9,C,S,A);if(n(F,O)&&n(T,B))return[u(S,M)];var _,k=a(F,O),I=a(T,B),R=i(o(18,C,S,A,E),o(S,S,A,A)),z=i(o(4,S,S,S,E),o(4,C,A,A,A),o(27,C,C,E,E));return n(R,z)?[u(a(o(4,C,S,A),i(o(9,C,C,E),o(S,S,S))),o(C,k)),u(a(o(9,C,E),o(S,A)),o(2,k))]:(_=n(F,O)?I:u(i(I,s(a(o(I,I),o(4,k,k,k)))),2),f(_,!0).toArray().map((function(e){return u(i(S,e,u(k,e)),M)})).map((function(e){return"Complex"===l(e)&&n(m(e),m(e)+p(e))?m(e):e})));default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(h))}}})})),Fm=Ee("Help",["parse"],(function(e){var t=e.parse;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var e=this.doc||{},r="\n";if(e.name&&(r+="Name: "+e.name+"\n\n"),e.category&&(r+="Category: "+e.category+"\n\n"),e.description&&(r+="Description:\n "+e.description+"\n\n"),e.syntax&&(r+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){r+="Examples:\n";for(var n={},i=0;i1, -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"]},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 indicant 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 eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],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)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],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:[]},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 probablity 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"]},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 hyperbolic arccotangent 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 hyperbolic arccosecant 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: $0, $1, $2", [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, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]}},km="help",Im=Ee(km,["typed","mathWithTransform","Help"],(function(e){var t=e.typed,r=e.mathWithTransform,n=e.Help;return t(km,{any:function(e){var t,i=e;if("string"!=typeof e)for(t in r)if(Ne(r,t)&&e===r[t]){i=t;break}var a=Te(_m,i);if(!a){var o="function"==typeof i?i.name:i;throw new Error('No documentation found on "'+o+'"')}return new n(a)}})})),Rm="chain",zm=Ee(Rm,["typed","Chain"],(function(e){var t=e.typed,r=e.Chain;return t(Rm,{"":function(){return new r},any:function(e){return new r(e)}})})),qm=Ee("det",["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.multiply,a=e.divideScalar,o=e.isZero,u=e.unaryMinus;return t("det",{any:function(e){return he(e)},"Array | Matrix":function(e){var t;switch((t=l(e)?e.size():Array.isArray(e)?(e=r(e)).size():[]).length){case 0:return he(e);case 1:if(1===t[0])return he(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+Vr(t)+")");case 2:var s=t[0],c=t[1];if(s===c)return function(e,t,r){if(1===t)return he(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var s=!1,c=new Array(t).fill(0).map((function(e,t){return t})),f=0;fx&&(x=c(v[f][g]),b=f),f++;if(0===x)throw Error("Cannot calculate inverse, determinant is zero");(f=b)!==g&&(h=v[g],v[g]=v[f],v[f]=h,h=y[g],y[g]=y[f],y[f]=h);var w=v[g],N=y[g];for(f=0;f=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function $m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:t.epsilon,u=arguments.length>3?arguments[3]:void 0;if("number"===u)return function(e,r){for(var n,i=e.length,a=Math.abs(r/i),o=new Array(i),u=0;u=Math.abs(a);){var h=p[0][0],d=p[0][1];e=v(e,(s=e[h][h],c=e[d][d],f=e[h][d],l=void 0,l=c-s,n=Math.abs(l)<=t.epsilon?Math.PI/4:.5*Math.atan(2*f/(c-s))),h,d),o=m(o,n,h,d),p=y(e)}for(var g=b(i,0),w=0;w=i(p);){var A=E[0][0],S=E[0][1];e=d(e,(y=e[A][A],w=e[S][S],N=e[A][S],D=void 0,D=n(w,y),o=i(D)<=t.epsilon?f(-1).acos().div(4):s(.5,a(l(2,N,c(D))))),A,S),m=h(m,o,A,S),E=g(e)}for(var C=b(u,0),M=0;M=5)return null;for(u=0;;){var s=m(e,a);if(g(C(S(a,[s])),n))break;if(++u>=10)return null;a=M(s)}return a}function A(e,t,r){var n="BigNumber"===r,i="Complex"===r,a=Array(e).fill(0).map((function(e){return 2*Math.random()-1}));return n&&(a=a.map((function(e){return c(e)}))),i&&(a=a.map((function(e){return v(e)}))),M(a=S(a,t),r)}function S(e,t){var n,a=Um(t);try{for(a.s();!(n=a.n()).done;){var u=n.value;e=r(e,i(o(b(u,e),b(u,u)),u))}}catch(e){a.e(e)}finally{a.f()}return e}function C(e){return s(u(b(e,e)))}function M(e,t){var r="Complex"===t,n="BigNumber"===t?c(1):r?v(1):1;return i(o(n,C(e)),e)}return function(e,m,b,A,S){void 0===S&&(S=!0);var C=function(e,r,n,i,u){var l,p="BigNumber"===i,m="Complex"===i,h=p?c(0):0,x=p?c(1):m?v(1):1,b=p?c(1):1,w=p?c(10):2,N=a(w,w);u&&(l=Array(r).fill(x));for(var D=!1;!D;){D=!0;for(var E=0;E1&&(k=f(Array(T-1).fill(y)))),T-=1,F.pop();for(var L=0;L2&&(k=f(Array(T-2).fill(y)))),T-=2,F.pop(),F.pop();for(var $=0;$100){var H=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+O.join(", "));throw H.values=O,H.vectors=[],H}var G=m?i(_,function(e,t){for(var r=[],n=0;n1&&(g=o(g,m),x=-x),d=n(d,o(y=y*(l-b+1)/((2*l-b+1)*b),g)),v=n(v,o(y*x,g));for(var w=o(a(v),d),N=0;Nm&&++a>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>m);return o}return t(Zm,{"Array | Matrix":function(e){var t=l(e)?e.size():Kr(e);switch(t.length){case 1:if(1===t[0])return a(e,o);throw new RangeError("Matrix must be square (size: "+Vr(t)+")");case 2:if(t[0]===t[1])return h(e);throw new RangeError("Matrix must be square (size: "+Vr(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+Vr(t)+")")}}})})),Ym="sylvester",Jm=Ee(Ym,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(function(e){var t=e.typed,r=e.schur,n=e.matrixFromColumns,i=e.matrix,a=e.multiply,o=e.range,u=e.concat,s=e.transpose,c=e.index,f=e.subset,l=e.add,p=e.subtract,m=e.identity,h=e.lusolve,d=e.abs;return t(Ym,{"Matrix, Matrix, Matrix":v,"Array, Matrix, Matrix":function(e,t,r){return v(i(e),t,r)},"Array, Array, Matrix":function(e,t,r){return v(i(e),i(t),r)},"Array, Matrix, Array":function(e,t,r){return v(i(e),t,i(r))},"Matrix, Array, Matrix":function(e,t,r){return v(e,i(t),r)},"Matrix, Array, Array":function(e,t,r){return v(e,i(t),i(r))},"Matrix, Matrix, Array":function(e,t,r){return v(e,t,i(r))},"Array, Array, Array":function(e,t,r){return v(i(e),i(t),i(r)).toArray()}});function v(e,t,v){for(var y=t.size()[0],g=e.size()[0],x=r(e),b=x.T,w=x.U,N=r(a(-1,t)),D=N.T,E=N.U,A=a(a(s(w),v),E),S=o(0,g),C=[],M=function(e,t){return u(e,t,1)},F=function(e,t){return u(e,t,0)},O=0;O1e-5){for(var T=F(f(A,c(S,O)),f(A,c(S,O+1))),B=0;B100)break}while(o(u(s,t))>1e-4);return{U:c,T:s}}})),Km="lyap",eh=Ee(Km,["typed","matrix","sylvester","multiply","transpose"],(function(e){var t=e.typed,r=e.matrix,n=e.sylvester,i=e.multiply,a=e.transpose;return t(Km,{"Matrix, Matrix":function(e,t){return n(e,a(e),i(-1,t))},"Array, Matrix":function(e,t){return n(r(e),a(r(e)),i(-1,t))},"Matrix, Array":function(e,t){return n(e,a(r(e)),r(i(-1,t)))},"Array, Array":function(e,t){return n(r(e),a(r(e)),r(i(-1,t))).toArray()}})})),th=Ee("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(function(e){var t=e.typed,r=e.matrix,n=e.multiply,i=e.equalScalar,a=e.divideScalar,o=e.inv,u=pa({typed:t,equalScalar:i}),s=ha({typed:t});return t("divide",ve({"Array | Matrix, Array | Matrix":function(e,t){return n(e,o(t))},"DenseMatrix, any":function(e,t){return s(e,t,a,!1)},"SparseMatrix, any":function(e,t){return u(e,t,a,!1)},"Array, any":function(e,t){return s(r(e),t,a,!1).valueOf()},"any, Array | Matrix":function(e,t){return n(e,o(t))}},a.signatures))})),rh="distance",nh=Ee(rh,["typed","addScalar","subtract","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(function(e){var t=e.typed,r=e.addScalar,n=e.subtract,i=e.multiplyScalar,o=e.divideScalar,u=e.deepEqual,s=e.sqrt,c=e.abs;return t(rh,{"Array, Array, Array":function(e,t,r){if(2===e.length&&2===t.length&&2===r.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(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(u(t,r))throw new TypeError("LinePoint1 should not be same with LinePoint2");var a=n(r[1],t[1]),o=n(t[0],r[0]),s=n(i(r[0],t[1]),i(t[0],r[1]));return v(e[0],e[1],a,o,s)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,r){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(r).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(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(u(d(t),d(r)))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 r&&"lineTwoPtY"in r){var a=n(r.lineTwoPtY,t.lineOnePtY),o=n(t.lineOnePtX,r.lineTwoPtX),s=n(i(r.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,r.lineTwoPtY));return v(e.pointX,e.pointY,a,o,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(!p(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return v(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!p(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(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(!m(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return g(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(!p(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 v(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(!p(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(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 g([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(!p(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!p(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 g([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&&f(e[0][0])&&f(e[0][1])){if(e.some((function(e){return 2!==e.length||!f(e[0])||!f(e[1])})))return!1}else{if(!(3===e[0].length&&f(e[0][0])&&f(e[0][1])&&f(e[0][2])))return!1;if(e.some((function(e){return 3!==e.length||!f(e[0])||!f(e[1])||!f(e[2])})))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var t=[],r=[],n=[],i=0;i1&&Array.isArray(e[0])&&e.every((function(e){return Array.isArray(e)&&1===e.length}))?m(e):e}function x(e){return 2===e.length&&d(e[0])&&d(e[1])}function b(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,t,r,n,i,o,u,c,l,p,m,h){var d=s(f(e,t),f(r,n)),v=s(f(i,o),f(u,c)),y=s(f(l,p),f(m,h));return a(a(d,v),y)}})),ah=Ee("sum",["typed","config","add","numeric"],(function(e){var t=e.typed,r=e.config,n=e.add,i=e.numeric;return t("sum",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){try{return kn(e,t,n)}catch(e){throw Es(e,"sum")}},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function sum");return a(e)}});function a(e){var t;return Bn(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Es(t,"sum",e)}})),void 0===t&&(t=i(0,r.number)),"string"==typeof t&&(t=i(t,r.number)),t}})),oh="cumsum",uh=Ee(oh,["typed","add","unaryPlus"],(function(e){var t=e.typed,r=e.add,n=e.unaryPlus;return t(oh,{Array:i,Matrix:function(e){return e.create(i(e.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,t){return e.create(o(e.valueOf(),t))},"...":function(e){if(Tn(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return a(e)}catch(e){throw Es(e,oh)}}function a(e){if(0===e.length)return[];for(var t=[n(e[0])],i=1;i=r.length)throw new Qr(t,r.length);try{return u(e,t)}catch(e){throw Es(e,oh)}}function u(e,t){var r,n,i;if(t<=0){var o=e[0][0];if(Array.isArray(o)){for(i=On(e),n=[],r=0;r0&&(o=e[c]);return s(o,n)}var f=a(e,(t-1)/2);return u(f)}catch(e){throw Es(e,"median")}}var u=t({"number | BigNumber | Complex | Unit":function(e){return e}}),s=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return n(r(e,t),2)}});return t(fh,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function median");return o(e)}})})),ph=Ee("mad",["typed","abs","map","median","subtract"],(function(e){var t=e.typed,r=e.abs,n=e.map,i=e.median,a=e.subtract;return t("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(0===(e=mn(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var t=i(e);return i(n(e,(function(e){return r(a(e,t))})))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf("median")?new TypeError(e.message.replace("median","mad")):Es(e,"mad")}}})),mh="unbiased",hh="variance",dh=Ee(hh,["typed","add","subtract","multiply","divide","apply","isNaN"],(function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,o=e.divide,u=e.apply,s=e.isNaN;return t(hh,{"Array | Matrix":function(e){return c(e,mh)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(e,t){return f(e,t,mh)},"Array | Matrix, number | BigNumber, string":f,"...":function(e){return c(e,mh)}});function c(e,t){var u,c=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Bn(e,(function(e){try{u=void 0===u?e:r(u,e),c++}catch(t){throw Es(t,"variance",e)}})),0===c)throw new Error("Cannot calculate variance of an empty array");var f=o(u,c);if(u=void 0,Bn(e,(function(e){var t=n(e,f);u=void 0===u?i(t,t):r(u,i(t,t))})),s(u))return u;switch(t){case"uncorrected":return o(u,c);case"biased":return o(u,c+1);case"unbiased":var l=a(u)?u.mul(0):0;return 1===c?l:o(u,c-1);default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function f(e,t,r){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return u(e,t,(function(e){return c(e,r)}))}catch(e){throw Es(e,"variance")}}})),vh=Ee("quantileSeq",["typed","add","multiply","partitionSelect","compare"],(function(e){var t=e.typed,r=e.add,n=e.multiply,o=e.partitionSelect,u=e.compare;function s(e,t,a){var s=mn(e),f=s.length;if(0===f)throw new Error("Cannot calculate quantile of an empty sequence");if(i(t)){var l=t*(f-1),p=l%1;if(0===p){var m=a?s[l]:o(s,l);return c(m),m}var h,d,v=Math.floor(l);if(a)h=s[v],d=s[v+1];else{d=o(s,v+1),h=s[v];for(var y=0;y0&&(h=s[y])}return c(h),c(d),r(n(h,1-p),n(d,p))}var g=t.times(f-1);if(g.isInteger()){g=g.toNumber();var x=a?s[g]:o(s,g);return c(x),x}var b,w,N=g.floor(),D=g.minus(N),E=N.toNumber();if(a)b=s[E],w=s[E+1];else{w=o(s,E+1),b=s[E];for(var A=0;A0&&(b=s[A])}c(b),c(w);var S=new D.constructor(1);return r(n(b,S.minus(D)),n(w,D))}var c=t({"number | BigNumber | Unit":function(e){return e}});return function(e,t,r){var n,o,u;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(p(e)){if("boolean"==typeof(r=r||!1)){if(o=e.valueOf(),i(t)){if(t<0)throw new Error("N/prob must be non-negative");if(t<=1)return s(o,t,r);if(t>1){if(!V(t))throw new Error("N must be a positive integer");var c=t+1;n=new Array(t);for(var f=0;f4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var h=new l(m+1);n=new Array(m);for(var d=0;d1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!a(g))throw new TypeError("Unexpected type of argument in function quantileSeq");if(u=new g.constructor(1),g.isNegative()||g.gt(u))throw new Error("Probability must be between 0 and 1, inclusive")}n[y]=s(o,g,r)}return n}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}})),yh=Ee("std",["typed","map","sqrt","variance"],(function(e){var t=e.typed,r=e.map,n=e.sqrt,i=e.variance;return t("std",{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var a=i.apply(null,arguments);return p(a)?r(a,n):n(a)}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}}));function gh(e,t){if(t>1;return gh(e,r)*gh(r+1,t)}function xh(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!V(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");for(var r=e-t,n=1,i=2,a=t171?1/0:gh(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Sh(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=Mh[0];for(var o=1;o=1;n--)r+=Oh[n]/(e+n);return Fh+(e+.5)*Math.log(t)-t+Math.log(r)}Th.signature="number";var Bh="gamma",_h=Ee(Bh,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(function(e){var t=e.typed,r=e.config,n=(e.multiplyScalar,e.pow,e.BigNumber),i=e.Complex;return t(Bh,{number:Sh,Complex:function e(t){if(0===t.im)return Sh(t.re);if(t.re<.5){var r=new i(1-t.re,-t.im),n=new i(Math.PI*t.re,Math.PI*t.im);return new i(Math.PI).div(n.sin()).div(e(r))}t=new i(t.re-1,t.im);for(var a=new i(Mh[0],0),o=1;o2;)s+=o-=2,u=u.times(s);return new n(u.toPrecision(n.precision))}})),kh="lgamma",Ih=Ee(kh,["Complex","typed"],(function(e){var t=e.Complex,r=e.typed,n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(kh,{number:Th,Complex:function e(r){if(r.isNaN())return new t(NaN,NaN);if(0===r.im)return new t(Th(r.re),0);if(r.re>=7||Math.abs(r.im)>=7)return i(r);if(r.re<=.1){var n=(s=6.283185307179586,(!0^((c=r.im)>0||!(c<0)&&1/c==1/0)?-s:s)*Math.floor(.5*r.re+.25)),o=r.mul(Math.PI).sin().log(),u=e(new t(1-r.re,-r.im));return new t(1.1447298858494002,n).sub(o).sub(u)}return r.im>=0?a(r):a(r.conjugate()).conjugate();var s,c},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){for(var r=e.sub(.5).mul(e.log()).sub(e).add(Fh),i=new t(1,0).div(e),a=i.div(e),o=n[0],u=n[1],s=2*a.re,c=a.re*a.re+a.im*a.im,f=2;f<8;f++){var l=u;u=-c*o+n[f],o=s*o+l}var p=i.mul(a.mul(o).add(u));return r.add(p)}function a(e){var r=0,n=0,a=e;for(e=e.add(1);e.re<=7;){var o=(a=a.mul(e)).im<0?1:0;0!==o&&0===n&&r++,n=o,e=e.add(1)}return i(e).sub(a.log()).sub(new t(0,2*r*Math.PI*1))}})),Rh="factorial",zh=Ee(Rh,["typed","gamma"],(function(e){var t=e.typed,r=e.gamma;return t(Rh,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),qh="kldivergence",jh=Ee(qh,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(function(e){var t=e.typed,r=e.matrix,n=e.divide,i=e.sum,a=e.multiply,o=e.map,u=e.dotDivide,s=e.log,c=e.isNumeric;return t(qh,{"Array, Array":function(e,t){return f(r(e),r(t))},"Matrix, Array":function(e,t){return f(e,r(t))},"Array, Matrix":function(e,t){return f(r(e),t)},"Matrix, Matrix":function(e,t){return f(e,t)}});function f(e,t){var r=t.size().length,f=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(f>1)throw new Error("second object must be one dimensional");if(r!==f)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");var l=n(e,i(e)),p=n(t,i(t)),m=i(a(l,o(u(l,p),(function(e){return s(e)}))));return c(m)?m:Number.NaN}})),Ph="multinomial",Lh=Ee(Ph,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=e.multiply,a=e.factorial,o=e.isInteger,u=e.isPositive;return t(Ph,{"Array | Matrix":function(e){var t=0,s=1;return Bn(e,(function(e){if(!o(e)||!u(e))throw new TypeError("Positive integer value expected in function multinomial");t=r(t,e),s=i(s,a(e))})),n(a(t),s)}})})),Uh="permutations",$h=Ee(Uh,["typed","factorial"],(function(e){var t=e.typed,r=e.factorial;return t(Uh,{"number | BigNumber":r,"number, number":function(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!V(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 gh(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var r,n;if(!Hh(e)||!Hh(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(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})}));function Hh(e){return e.isInteger()&&e.gte(0)}r(3843);var Gh=r(6377),Vh=Gh(Date.now());function Zh(e){var t,r;return t=null===(r=e)?Vh:Gh(String(r)),function(){return t()}}var Wh="pickRandom",Yh=Ee(Wh,["typed","config","?on"],(function(e){var t=e.typed,r=e.config,n=e.on,a=Zh(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(a=Zh(e.randomSeed))})),t(Wh,{"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,r){return o(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return o(e,{number:t,weights:r})}});function o(e,t){var r=t.number,n=t.weights,o=t.elementWise,u=void 0===o||o,s=void 0===r;s&&(r=1);var c=l(e)?e.create:l(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===u&&(e=mn(e),n=mn(n));var f=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var p=0,m=n.length;p1)for(var n=0,i=e.shift();nv)return m[d][v];for(var y=0;y<=d;++y)if(m[y]||(m[y]=[h(0===y?1:0)]),0!==y)for(var g=m[y],x=m[y-1],b=g.length;b<=y&&b<=v;++b)g[b]=b===y?1:r(n(h(b),x[b]),x[b-1]);return m[d][v]}})})),nd="bellNumbers",id=Ee(nd,["typed","addScalar","isNegative","isInteger","stirlingS2"],(function(e){var t=e.typed,r=e.addScalar,n=e.isNegative,i=e.isInteger,a=e.stirlingS2;return t(nd,{"number | BigNumber":function(e){if(!i(e)||n(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,o=0;o<=e;o++)t=r(t,a(e,o));return t}})})),ad="catalan",od=Ee(ad,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(function(e){var t=e.typed,r=e.addScalar,n=e.divideScalar,i=e.multiplyScalar,a=e.combinations,o=e.isNegative,u=e.isInteger;return t(ad,{"number | BigNumber":function(e){if(!u(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),r(e,1))}})})),ud="composition",sd=Ee(ud,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(function(e){var t=e.typed,r=e.addScalar,n=e.combinations,i=e.isPositive,a=(e.isNegative,e.isInteger),o=e.larger;return t(ud,{"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(o(t,e))throw new TypeError("k must be less than or equal to n in function composition");return n(r(e,-1),r(t,-1))}})})),cd="leafCount",fd=Ee(cd,["parse","typed"],(function(e){function t(e){var r=0;return e.forEach((function(e){r+=t(e)})),r||1}return e.parse,(0,e.typed)(cd,{Node:function(e){return t(e)}})}));function ld(e){return T(e)||q(e)&&e.isUnary()&&T(e.args[0])}function pd(e){return!!T(e)||!(!k(e)&&!q(e)||!e.args.every(pd))||!(!j(e)||!pd(e.content))}function md(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function hd(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:u,n=o;if("string"==typeof e?n=e:q(e)?n=e.fn.toString():k(e)?n=e.name:j(e)&&(n="paren"),Ne(r,n)){var i=r[n];if(Ne(i,t))return i[t];if(Ne(u,n))return u[n][t]}if(Ne(r,o)){var a=r[o];return Ne(a,t)?a[t]:u[o][t]}if(Ne(u,n)){var s=u[n];if(Ne(s,t))return s[t]}return u[o][t]}function c(e){return s(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:u)}function f(e,t){var r,n=[];return c(e,t)?(r=e.op,function e(t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:u)},isAssociative:c,mergeContext:function(e,t){var r=hd({},e);for(var n in t)Ne(e,n)?r[n]=hd(hd({},t[n]),e[n]):r[n]=t[n];return r},flatten:function e(t,r){if(!t.args||0===t.args.length)return t;t.args=f(t,r);for(var n=0;n2&&c(t,r)){for(var o=t.args.pop();t.args.length>0;)o=n([t.args.pop(),o]);t.args=o.args}}},unflattenl:function e(t,r){if(t.args&&0!==t.args.length){for(var n=l(t),i=t.args.length,a=0;a2&&c(t,r)){for(var o=t.args.shift();t.args.length>0;)o=n([o,t.args.shift()]);t.args=o.args}}},defaultContext:u,realContext:{divide:{total:a},log:{total:a}},positiveContext:{subtract:{total:a},abs:{trivial:i},log:{total:i}}}})),vd=Ee("simplify",["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){e.config;var r=e.typed,n=e.parse,i=(e.add,e.subtract,e.multiply,e.divide,e.pow,e.isZero,e.equal),a=e.resolve,o=e.simplifyConstant,u=e.simplifyCore,s=(e.fraction,e.bignumber,e.mathWithTransform,e.matrix,e.AccessorNode),c=e.ArrayNode,f=e.ConstantNode,l=e.FunctionNode,p=e.IndexNode,m=e.ObjectNode,h=e.OperatorNode,d=e.ParenthesisNode,v=e.SymbolNode,y=dd({FunctionNode:l,OperatorNode:h,SymbolNode:v}),g=y.hasProperty,x=y.isCommutative,b=y.isAssociative,w=y.mergeContext,N=y.flatten,D=y.unflattenr,E=y.unflattenl,A=y.createMakeNodeFunction,S=y.defaultContext,C=y.realContext,M=y.positiveContext;r.addConversion({from:"Object",to:"Map",convert:Ue});var F=r("simplify",{Node:R,"Node, Map":function(e,t){return R(e,!1,t)},"Node, Map, Object":function(e,t,r){return R(e,!1,t,r)},"Node, Array":R,"Node, Array, Map":R,"Node, Array, Map, Object":R});function O(e){return e.transform((function(e,t,r){return j(e)?O(e.content):e}))}r.removeConversion({from:"Object",to:"Map",convert:Ue}),F.defaultContext=S,F.realContext=C,F.positiveContext=M;var B={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){var r={};if(e.s){var i=e.s.split("->");if(2!==i.length)throw SyntaxError("Could not parse rule: "+e.s);r.l=i[0],r.r=i[1]}else r.l=e.l,r.r=e.r;r.l=O(n(r.l)),r.r=O(n(r.r));for(var a=0,o=["imposeContext","repeat","assuming"];a 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"}];var k=0;function I(){return new v("_p"+k++)}function R(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Le(),i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i.consoleDebug;r=function(e,r){for(var n=[],i=0;i ").concat(r[l].r.toString()))),o){var m=u.toString({parenthesis:"all"});m!==f&&(console.log("Applying",p,"produced",m),f=m)}E(u,i.context)}c=u.toString({parenthesis:"all"})}return u}function z(e,t,r){var n=e;if(e)for(var i=0;i=2&&2===e.args.length){for(var o=function(e,t){var r,n,i=[],a=A(e);if(x(e,t))for(var o=0;o1&&(s=a(e.args.slice(0,u))),r=1===(n=e.args.slice(u)).length?n[0]:a(n),i.push(a([s,r]))}return i}(t,r),u=[],s=0;s2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var p=[],m=0;m2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var y=$(e.args[0],t.args[1],r);if(0===y.length)return[];var g=$(e.args[1],t.args[0],r);if(0===g.length)return[];p=[y,g]}a=function(e){if(0===e.length)return e;for(var t=e.reduce(L),r=[],n={},i=0;i="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":a[0].placeholders[e.name]=t;break;case"c":case"cl":if(!T(t))return[];a[0].placeholders[e.name]=t;break;case"v":if(T(t))return[];a[0].placeholders[e.name]=t;break;case"vl":if(!U(t))return[];a[0].placeholders[e.name]=t;break;case"cd":if(!ld(t))return[];a[0].placeholders[e.name]=t;break;case"vd":if(ld(t))return[];a[0].placeholders[e.name]=t;break;case"ce":if(!pd(t))return[];a[0].placeholders[e.name]=t;break;case"ve":if(pd(t))return[];a[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof f))return[];if(!i(e.value,t.value))return[]}return a}function H(e,t){if(e instanceof f&&t instanceof f){if(!i(e.value,t.value))return!1}else if(e instanceof v&&t instanceof v){if(e.name!==t.name)return!1}else{if(!(e instanceof h&&t instanceof h||e instanceof l&&t instanceof l))return!1;if(e instanceof h){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(var r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function gd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?(v=_(y,E,g,r),S.unshift(v),v=_(y,S,g,r)):v=_(y,s,g,r)}else v=_(y,s,g,r);else v=_(y,s=e.args.map((function(e){return k(e,r)})),g,r);return v;case"ParenthesisNode":return k(e.content,r);case"AccessorNode":return function(e,t,r){if(!I(t))return new c(M(e),M(t));if(C(e)||l(e)){for(var n=Array.from(t.dimensions);n.length>0;)if(T(n[0])&&"string"!=typeof n[0].value){var i=O(n.shift().value,r);C(e)?e=e.items[i-1]:(e=e.valueOf()[i-1])instanceof Array&&(e=a(e))}else{if(!(n.length>1&&T(n[1])&&"string"!=typeof n[1].value))break;var o,u=O(n[1].value,r),s=[],m=C(e)?e.items:e.valueOf(),d=yd(m);try{for(d.s();!(o=d.n()).done;){var v=o.value;if(C(v))s.push(v.items[u-1]);else{if(!l(e))break;s.push(v[u-1])}}}catch(e){d.e(e)}finally{d.f()}if(s.length!==m.length)break;e=C(e)?new f(s):a(s),n.splice(1,1)}return n.length===t.dimensions.length?new c(M(e),t):n.length>0?(t=new h(n),new c(M(e),t)):e}if(z(e)&&1===t.dimensions.length&&T(t.dimensions[0])){var y=t.dimensions[0].value;return y in e.properties?e.properties[y]:new p}return new c(M(e),t)}(k(e.object,r),k(e.index,r),r);case"ArrayNode":var B=e.items.map((function(e){return k(e,r)}));return B.some(R)?new f(B.map(M)):a(B);case"IndexNode":return new h(e.dimensions.map((function(e){return D(e,r)})));case"ObjectNode":var j={};for(var P in e.properties)j[P]=D(e.properties[P],r);return new d(j);default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return D})),bd="simplifyCore",wd=Ee(bd,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){var t=e.typed,r=(e.parse,e.equal),n=e.isZero,i=(e.add,e.subtract,e.multiply,e.divide,e.pow,e.AccessorNode),a=e.ArrayNode,o=e.ConstantNode,u=e.FunctionNode,s=e.IndexNode,c=e.ObjectNode,f=e.OperatorNode,l=(e.ParenthesisNode,e.SymbolNode),p=new o(0),m=new o(1),h=new o(!0),d=new o(!1);function v(e){return q(e)&&["and","not","or"].includes(e.op)}var y=dd({FunctionNode:u,OperatorNode:f,SymbolNode:l}),g=y.hasProperty,x=y.isCommutative;function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=t?t.context:void 0;if(g(e,"trivial",o)){if(k(e)&&1===e.args.length)return b(e.args[0],t);var l=!1,y=0;if(e.forEach((function(e){1==++y&&(l=b(e,t))})),1===y)return l}var w=e;if(k(w)){var N=function(e){var t,r="OperatorNode:"+e,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return mp(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mp(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(hp);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(r in i)return i[r].op}}catch(e){n.e(e)}finally{n.f()}return null}(w.name);if(!N)return new u(b(w.fn),w.args.map((function(e){return b(e,t)})));if(w.args.length>2&&g(w,"associative",o))for(;w.args.length>2;){var D=w.args.pop(),E=w.args.pop();w.args.push(new f(N,w.name,[D,E]))}w=new f(N,w.name,w.args)}if(q(w)&&w.isUnary()){var A=b(w.args[0],t);if("~"===w.op&&q(A)&&A.isUnary()&&"~"===A.op)return A.args[0];if("not"===w.op&&q(A)&&A.isUnary()&&"not"===A.op&&v(A.args[0]))return A.args[0];var M=!0;if("-"===w.op&&q(A)&&(A.isBinary()&&"subtract"===A.fn&&(w=new f("-","subtract",[A.args[1],A.args[0]]),M=!1),A.isUnary()&&"-"===A.op))return A.args[0];if(M)return new f(w.op,w.fn,[A])}if(q(w)&&w.isBinary()){var F=b(w.args[0],t),O=b(w.args[1],t);if("+"===w.op){if(T(F)&&n(F.value))return O;if(T(O)&&n(O.value))return F;q(O)&&O.isUnary()&&"-"===O.op&&(O=O.args[0],w=new f("-","subtract",[F,O]))}if("-"===w.op)return q(O)&&O.isUnary()&&"-"===O.op?b(new f("+","add",[F,O.args[0]]),t):T(F)&&n(F.value)?b(new f("-","unaryMinus",[O])):T(O)&&n(O.value)?F:new f(w.op,w.fn,[F,O]);if("*"===w.op){if(T(F)){if(n(F.value))return p;if(r(F.value,1))return O}if(T(O)){if(n(O.value))return p;if(r(O.value,1))return F;if(x(w,o))return new f(w.op,w.fn,[O,F],w.implicit)}return new f(w.op,w.fn,[F,O],w.implicit)}if("/"===w.op)return T(F)&&n(F.value)?p:T(O)&&r(O.value,1)?F:new f(w.op,w.fn,[F,O]);if("^"===w.op&&T(O)){if(n(O.value))return m;if(r(O.value,1))return F}if("and"===w.op){if(T(F)){if(!F.value)return d;if(v(O))return O}if(T(O)){if(!O.value)return d;if(v(F))return F}}if("or"===w.op){if(T(F)){if(F.value)return h;if(v(O))return O}if(T(O)){if(O.value)return h;if(v(F))return F}}return new f(w.op,w.fn,[F,O])}if(q(w))return new f(w.op,w.fn,w.args.map((function(e){return b(e,t)})));if(C(w))return new a(w.items.map((function(e){return b(e,t)})));if(S(w))return new i(b(w.object,t),b(w.index,t));if(I(w))return new s(w.dimensions.map((function(e){return b(e,t)})));if(z(w)){var B={};for(var _ in w.properties)B[_]=b(w.properties[_],t);return new c(B)}return w}return t(bd,{Node:b,"Node,Object":b})})),Nd=Ee("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(function(e){var t=e.typed,r=e.parse,n=e.ConstantNode,i=e.FunctionNode,a=e.OperatorNode,o=e.ParenthesisNode;function u(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(U(e)){if(s.has(e.name)){var c=Array.from(s).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(c,"}"))}var f=t.get(e.name);if(R(f)){var l=new Set(s);return l.add(e.name),u(f,t,l)}return"number"==typeof f?r(String(f)):void 0!==f?new n(f):e}if(q(e)){var p=e.args.map((function(e){return u(e,t,s)}));return new a(e.op,e.fn,p,e.implicit)}if(j(e))return new o(u(e.content,t,s));if(k(e)){var m=e.args.map((function(e){return u(e,t,s)}));return new i(e.name,m)}return e.map((function(e){return u(e,t,s)}))}return t("resolve",{Node:u,"Node, Map | null | undefined":u,"Node, Object":function(e,t){return u(e,Ue(t))},"Array | Matrix":t.referToSelf((function(e){return function(t){return t.map((function(t){return e(t)}))}})),"Array | Matrix, null | undefined":t.referToSelf((function(e){return function(t){return t.map((function(t){return e(t)}))}})),"Array, Object":t.referTo("Array,Map",(function(e){return function(t,r){return e(t,Ue(r))}})),"Matrix, Object":t.referTo("Matrix,Map",(function(e){return function(t,r){return e(t,Ue(r))}})),"Array | Matrix, Map":t.referToSelf((function(e){return function(t,r){return t.map((function(t){return e(t,r)}))}}))})})),Dd="symbolicEqual",Ed=Ee(Dd,["parse","simplify","typed","OperatorNode"],(function(e){e.parse;var t=e.simplify,r=e.typed,n=e.OperatorNode;function i(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new n("-","subtract",[e,r]),o=t(a,{},i);return T(o)&&!o.value}return r(Dd,{"Node, Node":i,"Node, Node, Object":i})})),Ad="derivative",Sd=Ee(Ad,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){var t=e.typed,r=e.config,n=e.parse,i=e.simplify,a=e.equal,o=e.isZero,u=e.numeric,s=e.ConstantNode,c=e.FunctionNode,f=e.OperatorNode,l=e.ParenthesisNode,p=e.SymbolNode;function m(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0},n={};v(n,e,t.name);var a=y(e,n);return r.simplify?i(a):a}t.addConversion({from:"identifier",to:"SymbolNode",convert:n});var h=t(Ad,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});t.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),h._simplify=!0,h.toTex=function(e){return d.apply(null,e.args)};var d=t("_derivTex",{"Node, SymbolNode":function(e,t){return T(e)&&"string"===H(e.value)?d(n(e.value).toString(),t.toString(),1):d(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===H(t.value))return d(e,n(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,r){return d(e.toString(),t.name,r.value)},"string, string, number":function(e,t,r){return(1===r?"{d\\over d"+t+"}":"{d^{"+r+"}\\over d"+t+"^{"+r+"}}")+"\\left[".concat(e,"\\right]")}}),v=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0,!0},"Object, SymbolNode, string":function(e,t,r){return t.name!==r&&(e[t]=!0,!0)},"Object, ParenthesisNode, string":function(e,t,r){return v(e,t.content,r)},"Object, FunctionAssignmentNode, string":function(e,t,r){return-1===t.params.indexOf(r)?(e[t]=!0,!0):v(e,t.expr,r)},"Object, FunctionNode | OperatorNode, string":function(e,t,r){if(t.args.length>0){for(var n=v(e,t.args[0],r),i=1;i0){var n=e.args.filter((function(e){return void 0===t[e]})),i=1===n.length?n[0]:new f("*","multiply",n),u=r.concat(y(i,t));return new f("*","multiply",u)}return new f("+","add",e.args.map((function(r){return new f("*","multiply",e.args.map((function(e){return e===r?y(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){var s=e.args[0],l=e.args[1];return void 0!==t[l]?new f("/","divide",[y(s,t),l]):void 0!==t[s]?new f("*","multiply",[new f("-","unaryMinus",[s]),new f("/","divide",[y(l,t),new f("^","pow",[l.clone(),g(2)])])]):new f("/","divide",[new f("-","subtract",[new f("*","multiply",[y(s,t),l.clone()]),new f("*","multiply",[s.clone(),y(l,t)])]),new f("^","pow",[l.clone(),g(2)])])}if("^"===e.op&&e.isBinary()){var p=e.args[0],m=e.args[1];if(void 0!==t[p])return T(p)&&(o(p.value)||a(p.value,1))?g(0):new f("*","multiply",[e,new f("*","multiply",[new c("log",[p.clone()]),y(m.clone(),t)])]);if(void 0!==t[m]){if(T(m)){if(o(m.value))return g(0);if(a(m.value,1))return y(p,t)}var h=new f("^","pow",[p.clone(),new f("-","subtract",[m,g(1)])]);return new f("*","multiply",[m.clone(),new f("*","multiply",[y(p,t),h])])}return new f("*","multiply",[new f("^","pow",[p.clone(),m.clone()]),new f("+","add",[new f("*","multiply",[y(p,t),new f("/","divide",[m.clone(),p.clone()])]),new f("*","multiply",[y(m,t),new c("log",[p.clone()])])])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function g(e,t){return new s(u(e,t||r.number))}return h})),Cd="rationalize",Md=Ee(Cd,["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"],(function(e){e.config;var t=e.typed,r=(e.equal,e.isZero,e.add,e.subtract,e.multiply,e.divide,e.pow,e.parse,e.simplifyConstant),n=e.simplifyCore,i=e.simplify,a=(e.fraction,e.bignumber,e.mathWithTransform,e.matrix,e.AccessorNode,e.ArrayNode,e.ConstantNode),o=(e.FunctionNode,e.IndexNode,e.ObjectNode,e.OperatorNode),u=e.SymbolNode;function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=function(){var e=[n,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},r,{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)"}],i=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],a={};return a.firstRules=e.concat(t,i),a.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)"}],a.sucDivRules=i,a.firstRulesAgain=e.concat(t),a.finalRules=[n,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},r,{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))"}],a}(),u=function(e,t,r,n){var a=[],o=i(e,n,t,{exactFractions:!1}),u="+-*"+((r=!!r)?"/":"");!function e(t){var r=t.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!V(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(-1===u.indexOf(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var n=0;n=1){var m,h;e=c(e);var d,v=!0,y=!1;for(e=i(e,o.firstRules,{},l);h=v?o.distrDivRules:o.sucDivRules,v=!v,(d=(e=i(e,h,{},p)).toString())!==m;)y=!0,m=d;y&&(e=i(e,o.firstRulesAgain,{},l)),e=i(e,o.finalRules,{},l)}var g=[],x={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===s&&(e.args[0]=f(e.args[0],g),e.args[1]=f(e.args[1])),a&&(x.numerator=e.args[0],x.denominator=e.args[1])):(1===s&&(e=f(e,g)),a&&(x.numerator=e,x.denominator=null)),a?(x.coefficients=g,x.variables=u.variables,x.expression=e,x):e}return e.ParenthesisNode,t(Cd,{Node:s,"Node, boolean":function(e,t){return s(e,{},t)},"Node, Object":s,"Node, Object, boolean":s});function c(e,t,r){var n=e.type,i=arguments.length>1;if("OperatorNode"===n&&e.isBinary()){var u,s=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(s=(u=parseFloat(e.args[1].value))>=2&&V(u))),s){if(u>2){var f=e.args[0],l=new o("^","pow",[e.args[0].cloneDeep(),new a(u-1)]);e=new o("*","multiply",[f,l])}else e=new o("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===r?t.content=e:t.args[r]=e)}}if("ParenthesisNode"===n)c(e.content,e,"content");else if("ConstantNode"!==n&&"SymbolNode"!==n)for(var p=0;pr&&(t[c]=0),t[c]+=o.cte*("+"===o.oper?1:-1),void(r=Math.max(c,r))}o.cte=c,""===o.fire&&(t[0]+=o.cte*("+"===o.oper?1:-1))}}(e,null,{cte:1,oper:"+",fire:""});for(var i,s=!0,c=r=t.length-1;c>=0;c--)if(0!==t[c]){var f=new a(s?t[c]:Math.abs(t[c])),l=t[c]<0?"-":"+";if(c>0){var p=new u(n);if(c>1){var m=new a(c);p=new o("^","pow",[p,m])}f=-1===t[c]&&s?new o("-","unaryMinus",[p]):1===Math.abs(t[c])?p:new o("*","multiply",[f,p])}i=s?f:"+"===l?new o("+","add",[i,f]):new o("-","subtract",[i,f]),s=!1}return s?new a(0):i}})),Fd="zpk2tf",Od=Ee(Fd,["typed","add","multiply","Complex","number"],(function(e){var t=e.typed,r=e.add,n=e.multiply,i=e.Complex,a=e.number;return t(Fd,{"Array,Array,number":function(e,t,r){return o(e,t,r)},"Array,Array":function(e,t){return o(e,t,1)},"Matrix,Matrix,number":function(e,t,r){return o(e.valueOf(),t.valueOf(),r)},"Matrix,Matrix":function(e,t){return o(e.valueOf(),t.valueOf(),1)}});function o(e,t,r){e.some((function(e){return"BigNumber"===e.type}))&&(e=e.map((function(e){return a(e)}))),t.some((function(e){return"BigNumber"===e.type}))&&(t=t.map((function(e){return a(e)})));for(var o=[i(1,0)],s=[i(1,0)],c=0;c=0&&o-u0?0:2;else if(o&&!0===o.isSet)o=o.map((function(e){return e-1}));else if(f(o)||l(o))o=o.map((function(e){return e-1}));else if(i(o))o--;else if(a(o))o=o.toNumber()-1;else if("string"!=typeof o)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[r]=o}var u=new t;return t.apply(u,e),u}}),{isTransformFunction:!0}),cy=Ee("map",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=U(e[1])||_(e[1])?e[1].compile().evaluate(r):iy(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("map",{"Array, function":function(e,t){return fy(e,t,e)},"Matrix, function":function(e,t){return e.create(fy(e.valueOf(),t,e))}});return r}),{isTransformFunction:!0});function fy(e,t,r){return function e(n,i){return Array.isArray(n)?hn(n,(function(t,r){return e(t,i.concat(r+1))})):yu(t,n,i,r,"map")}(e,[])}function ly(e){if(2===e.length&&p(e[0])){var t=(e=e.slice())[1];i(t)?e[1]=t-1:a(t)&&(e[1]=t.minus(1))}return e}var py=Ee("max",["typed","config","numeric","larger"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.larger,a=Kc({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),my=Ee("mean",["typed","add","divide"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=ch({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){e=ly(e);try{return i.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),hy=Ee("min",["typed","config","numeric","smaller"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.smaller,a=ef({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),dy=Ee("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,u=e.larger,s=e.largerEq,c=e.add,f=e.isPositive,l=Pu({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:c,isPositive:f});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),l.apply(null,e)}})}),{isTransformFunction:!0}),vy=Ee("row",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,a=e.range,o=Wu({typed:t,Index:r,matrix:n,range:a});return t("row",{"...any":function(e){var t=e.length-1,r=e[t];i(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),yy=Ee("subset",["typed","matrix"],(function(e){var t=e.typed,r=e.matrix,n=es({typed:t,matrix:r});return t("subset",{"...any":function(e){try{return n.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),gy=Ee("concat",["typed","matrix","isInteger"],(function(e){var t=e.typed,r=e.matrix,n=e.isInteger,o=uu({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){var t=e.length-1,r=e[t];i(r)?e[t]=r-1:a(r)&&(e[t]=r.minus(1));try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),xy="diff",by=Ee(xy,["typed","matrix","subtract","number","bignumber"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.number,a=e.bignumber,o=ku({typed:t,matrix:r,subtract:n,number:i,bignumber:a});return t(xy,{"...any":function(e){e=ly(e);try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),wy=Ee("std",["typed","map","sqrt","variance"],(function(e){var t=e.typed,r=e.map,n=e.sqrt,i=e.variance,a=yh({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Ny=Ee("sum",["typed","config","add","numeric"],(function(e){var t=e.typed,r=e.config,n=e.add,i=e.numeric,a=ah({typed:t,config:r,add:n,numeric:i});return t("sum",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Dy="cumsum",Ey=Ee(Dy,["typed","add","unaryPlus"],(function(e){var t=e.typed,r=e.add,n=e.unaryPlus,o=uh({typed:t,add:r,unaryPlus:n});return t(Dy,{"...any":function(e){if(2===e.length&&p(e[0])){var t=e[1];i(t)?e[1]=t-1:a(t)&&(e[1]=t.minus(1))}try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Ay="variance",Sy=Ee(Ay,["typed","add","subtract","multiply","divide","apply","isNaN"],(function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,a=e.divide,o=e.apply,u=e.isNaN,s=dh({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:u});return t(Ay,{"...any":function(e){e=ly(e);try{return s.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Cy=(r(4812),r(4279));var My={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},Fy=["Matrix","Array"],Oy=["number","BigNumber","Fraction"];function Ty(e,t){function r(r){if(r){var n=de(e,he);By(r,"matrix",Fy),By(r,"number",Oy),ye(e,r);var i=de(e,he),a=de(r,he);return t("config",i,n,a),i}return de(e,he)}return r.MATRIX_OPTIONS=Fy,r.NUMBER_OPTIONS=Oy,Object.keys(My).forEach((function(t){Object.defineProperty(r,t,{get:function(){return e[t]},enumerable:!0,configurable:!0})})),r}function By(e,t,r){var n,i;void 0!==e[t]&&(n=r,i=e[t],-1===n.indexOf(i))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map((function(e){return JSON.stringify(e)})).join(", ")+".")}const _y=function e(r,n){var B=of({},My,n);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.");var H,V,Z=(H={isNumber:i,isComplex:o,isBigNumber:a,isFraction:u,isUnit:s,isString:c,isArray:f,isMatrix:l,isCollection:p,isDenseMatrix:m,isSparseMatrix:h,isRange:d,isIndex:v,isBoolean:y,isResultSet:g,isHelp:x,isFunction:b,isDate:w,isRegExp:N,isObject:D,isNull:E,isUndefined:A,isAccessorNode:S,isArrayNode:C,isAssignmentNode:M,isBlockNode:F,isConditionalNode:O,isConstantNode:T,isFunctionAssignmentNode:_,isFunctionNode:k,isIndexNode:I,isNode:R,isObjectNode:z,isOperatorNode:q,isParenthesisNode:j,isRangeNode:P,isRelationalNode:L,isSymbolNode:U,isChain:$},V=new Cy,H.on=V.on.bind(V),H.off=V.off.bind(V),H.once=V.once.bind(V),H.emit=V.emit.bind(V),H);Z.config=Ty(B,Z.emit),Z.expression={transform:{},mathWithTransform:{config:Z.config}};var W={};function Y(){for(var e=arguments.length,t=new Array(e),r=0;r2&&void 0!==arguments[2]?arguments[2]:t.fn;if(Nn(a,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(a));var o=v(t)?n.expression.transform:n,u=a in n.expression.transform,s=Ne(o,a)?o[a]:void 0,c=function(){var i={};t.dependencies.map(Se).forEach((function(e){if(Nn(e,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?i.math=n:"mathWithTransform"===e?i.mathWithTransform=n.expression.mathWithTransform:"classes"===e?i.classes=n:i[e]=n[e]}));var o=t(i);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===s||r.override)return o;if(e.isTypedFunction(s)&&e.isTypedFunction(o))return e(s,o);if(r.silent)return s;throw new Error('Cannot import "'+a+'": already exists')};t.meta&&!1===t.meta.lazy?(o[a]=c(),s&&u?p(a):(v(t)||d(t))&&we(n.expression.mathWithTransform,a,(function(){return o[a]}))):(we(o,a,c),s&&u?p(a):(v(t)||d(t))&&we(n.expression.mathWithTransform,a,(function(){return o[a]}))),i[a]=t,n.emit("import",a,c)}function h(e){return!Ne(y,e)}function d(e){return!(-1!==e.fn.indexOf(".")||Ne(y,e.fn)||e.meta&&e.meta.isClass)}function v(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}var y={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,r){var n=arguments.length;if(1!==n&&2!==n)throw new Pa("import",n,1,2);r||(r={});var i,f={};for(var p in function e(n,i,a){if(Array.isArray(i))i.forEach((function(t){return e(n,t)}));else if("object"===t(i))for(var o in i)Ne(i,o)&&e(n,i[o],o);else if(Ae(i)||void 0!==a){var u=Ae(i)?v(i)?i.fn+".transform":i.fn:a;if(Ne(n,u)&&n[u]!==i&&!r.silent)throw new Error('Cannot import "'+u+'" twice');n[u]=i}else if(!r.silent)throw new TypeError("Factory, Object, or Array expected")}(f,e),f)if(Ne(f,p)){var h=f[p];if(Ae(h))m(h,r);else if("function"==typeof(i=h)||"number"==typeof i||"string"==typeof i||"boolean"==typeof i||null===i||s(i)||o(i)||a(i)||u(i)||l(i)||Array.isArray(i))c(p,h,r);else if(!r.silent)throw new TypeError("Factory, Object, or Array expected")}}}(Y,0,Z,W);return Z.import=J,Z.on("config",(function(){De(W).forEach((function(e){e&&e.meta&&e.meta.recreateOnConfigChange&&J(e,{override:!0})}))})),Z.create=e.bind(null,r),Z.factory=Ee,Z.import(De(xe(r))),Z.ArgumentsError=Pa,Z.DimensionError=Xr,Z.IndexError=Qr,Z}(e)})(),n.default})())); //# sourceMappingURL=math.js.map /*! For license information please see math.js.LICENSE.txt */ !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={1977:function(e,t){var r;!function(n){"use strict";var i=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},a=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},o=function(){throw SyntaxError("Invalid Param")};function u(e,t){var r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):(e/=2,t/=2,.5*Math.log(e*e+t*t)+Math.LN2)}function s(e,t){if(!(this instanceof s))return new s(e,t);var r=function(e,t){var r={re:0,im:0};if(null==e)r.re=r.im=0;else if(void 0!==t)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!Number.isFinite(e.abs)&&Number.isFinite(e.arg))return s.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!Number.isFinite(e.r)&&Number.isFinite(e.phi))return s.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else 2===e.length?(r.re=e[0],r.im=e[1]):o();break;case"string":r.im=r.re=0;var n=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===n&&o();for(var u=0;u0&&o();break;case"number":r.im=0,r.re=e;break;default:o()}return isNaN(r.re)||isNaN(r.im),r}(e,t);this.re=r.re,this.im=r.im}s.prototype={re:0,im:0,sign:function(){var e=this.abs();return new s(this.re/e,this.im/e)},add:function(e,t){var r=new s(e,t);return this.isInfinite()&&r.isInfinite()?s.NAN:this.isInfinite()||r.isInfinite()?s.INFINITY:new s(this.re+r.re,this.im+r.im)},sub:function(e,t){var r=new s(e,t);return this.isInfinite()&&r.isInfinite()?s.NAN:this.isInfinite()||r.isInfinite()?s.INFINITY:new s(this.re-r.re,this.im-r.im)},mul:function(e,t){var r=new s(e,t);return this.isInfinite()&&r.isZero()||this.isZero()&&r.isInfinite()?s.NAN:this.isInfinite()||r.isInfinite()?s.INFINITY:0===r.im&&0===this.im?new s(this.re*r.re,0):new s(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){var r=new s(e,t);if(this.isZero()&&r.isZero()||this.isInfinite()&&r.isInfinite())return s.NAN;if(this.isInfinite()||r.isZero())return s.INFINITY;if(this.isZero()||r.isInfinite())return s.ZERO;e=this.re,t=this.im;var n,i,a=r.re,o=r.im;return 0===o?new s(e/a,t/a):Math.abs(a)0)return new s(Math.pow(e,r.re),0);if(0===e)switch((r.re%4+4)%4){case 0:return new s(Math.pow(t,r.re),0);case 1:return new s(0,Math.pow(t,r.re));case 2:return new s(-Math.pow(t,r.re),0);case 3:return new s(0,-Math.pow(t,r.re))}}if(0===e&&0===t&&r.re>0&&r.im>=0)return s.ZERO;var n=Math.atan2(t,e),i=u(e,t);return e=Math.exp(r.re*i-r.im*n),t=r.im*i+r.re*n,new s(e*Math.cos(t),e*Math.sin(t))},sqrt:function(){var e,t,r=this.re,n=this.im,i=this.abs();if(r>=0){if(0===n)return new s(Math.sqrt(r),0);e=.5*Math.sqrt(2*(i+r))}else e=Math.abs(n)/Math.sqrt(2*(i-r));return t=r<=0?.5*Math.sqrt(2*(i-r)):Math.abs(n)/Math.sqrt(2*(i+r)),new s(e,n<0?-t:t)},exp:function(){var e=Math.exp(this.re);return this.im,new s(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){var e=this.re,t=this.im;return new s(Math.expm1(e)*Math.cos(t)+function(e){var t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;var r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){var e=this.re,t=this.im;return new s(u(e,t),Math.atan2(t,e))},abs:function(){return e=this.re,t=this.im,r=Math.abs(e),n=Math.abs(t),r<3e3&&n<3e3?Math.sqrt(r*r+n*n):(r1&&0===t,n=1-e,i=1+e,a=n*n+t*t,o=0!==a?new s((i*n-t*t)/a,(t*n+i*t)/a):new s(-1!==e?e/0:0,0!==t?t/0:0),c=o.re;return o.re=u(o.re,o.im)/2,o.im=Math.atan2(o.im,c)/2,r&&(o.im=-o.im),o},acoth:function(){var e=this.re,t=this.im;if(0===e&&0===t)return new s(0,Math.PI/2);var r=e*e+t*t;return 0!==r?new s(e/r,-t/r).atanh():new s(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){var e=this.re,t=this.im;if(0===t)return new s(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var r=e*e+t*t;return 0!==r?new s(e/r,-t/r).asinh():new s(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){var e=this.re,t=this.im;if(this.isZero())return s.INFINITY;var r=e*e+t*t;return 0!==r?new s(e/r,-t/r).acosh():new s(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return s.INFINITY;if(this.isInfinite())return s.ZERO;var e=this.re,t=this.im,r=e*e+t*t;return new s(e/r,-t/r)},conjugate:function(){return new s(this.re,-this.im)},neg:function(){return new s(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new s(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new s(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new s(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){var r=new s(e,t);return Math.abs(r.re-this.re)<=s.EPSILON&&Math.abs(r.im-this.im)<=s.EPSILON},clone:function(){return new s(this.re,this.im)},toString:function(){var e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e){var n=r(614),i=r(6330),a=TypeError;e.exports=function(e){if(n(e))return e;throw a(i(e)+" is not a function")}},9483:(e,t,r)=>{var n=r(4411),i=r(6330),a=TypeError;e.exports=function(e){if(n(e))return e;throw a(i(e)+" is not a constructor")}},6077:(e,t,r)=>{var n=r(614),i=String,a=TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw a("Can't set "+i(e)+" as a prototype")}},1223:(e,t,r)=>{var n=r(5112),i=r(30),a=r(3070).f,o=n("unscopables"),u=Array.prototype;null==u[o]&&a(u,o,{configurable:!0,value:i(null)}),e.exports=function(e){u[o][e]=!0}},1530:(e,t,r)=>{"use strict";var n=r(8710).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},5787:(e,t,r)=>{var n=r(7976),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw i("Incorrect invocation")}},9670:(e,t,r)=>{var n=r(111),i=String,a=TypeError;e.exports=function(e){if(n(e))return e;throw a(i(e)+" is not an object")}},7556:(e,t,r)=>{var n=r(7293);e.exports=n((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},1285:(e,t,r)=>{"use strict";var n=r(7908),i=r(1400),a=r(6244);e.exports=function(e){for(var t=n(this),r=a(t),o=arguments.length,u=i(o>1?arguments[1]:void 0,r),s=o>2?arguments[2]:void 0,c=void 0===s?r:i(s,r);c>u;)t[u++]=e;return t}},8533:(e,t,r)=>{"use strict";var n=r(2092).forEach,i=r(9341)("forEach");e.exports=i?[].forEach:function(e){return n(this,e,arguments.length>1?arguments[1]:void 0)}},8457:(e,t,r)=>{"use strict";var n=r(9974),i=r(6916),a=r(7908),o=r(3411),u=r(7659),s=r(4411),c=r(6244),f=r(6135),l=r(4121),p=r(1246),m=Array;e.exports=function(e){var t=a(e),r=s(this),h=arguments.length,d=h>1?arguments[1]:void 0,v=void 0!==d;v&&(d=n(d,h>2?arguments[2]:void 0));var y,g,x,b,w,N,D=p(t),E=0;if(!D||this===m&&u(D))for(y=c(t),g=r?new this(y):m(y);y>E;E++)N=v?d(t[E],E):t[E],f(g,E,N);else for(w=(b=l(t,D)).next,g=r?new this:[];!(x=i(w,b)).done;E++)N=v?o(b,d,[x.value,E],!0):x.value,f(g,E,N);return g.length=E,g}},1318:(e,t,r)=>{var n=r(5656),i=r(1400),a=r(6244),o=function(e){return function(t,r,o){var u,s=n(t),c=a(s),f=i(o,c);if(e&&r!=r){for(;c>f;)if((u=s[f++])!=u)return!0}else for(;c>f;f++)if((e||f in s)&&s[f]===r)return e||f||0;return!e&&-1}};e.exports={includes:o(!0),indexOf:o(!1)}},2092:(e,t,r)=>{var n=r(9974),i=r(1702),a=r(8361),o=r(7908),u=r(6244),s=r(5417),c=i([].push),f=function(e){var t=1==e,r=2==e,i=3==e,f=4==e,l=6==e,p=7==e,m=5==e||l;return function(h,d,v,y){for(var g,x,b=o(h),w=a(b),N=n(d,v),D=u(w),E=0,A=y||s,S=t?A(h,D):r||p?A(h,0):void 0;D>E;E++)if((m||E in w)&&(x=N(g=w[E],E,b),e))if(t)S[E]=x;else if(x)switch(e){case 3:return!0;case 5:return g;case 6:return E;case 2:c(S,g)}else switch(e){case 4:return!1;case 7:c(S,g)}return l?-1:i||f?f:S}};e.exports={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterReject:f(7)}},1194:(e,t,r)=>{var n=r(7293),i=r(5112),a=r(7392),o=i("species");e.exports=function(e){return a>=51||!n((function(){var t=[];return(t.constructor={})[o]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},9341:(e,t,r)=>{"use strict";var n=r(7293);e.exports=function(e,t){var r=[][e];return!!r&&n((function(){r.call(null,t||function(){return 1},1)}))}},3671:(e,t,r)=>{var n=r(9662),i=r(7908),a=r(8361),o=r(6244),u=TypeError,s=function(e){return function(t,r,s,c){n(r);var f=i(t),l=a(f),p=o(f),m=e?p-1:0,h=e?-1:1;if(s<2)for(;;){if(m in l){c=l[m],m+=h;break}if(m+=h,e?m<0:p<=m)throw u("Reduce of empty array with no initial value")}for(;e?m>=0:p>m;m+=h)m in l&&(c=r(c,l[m],m,f));return c}};e.exports={left:s(!1),right:s(!0)}},3658:(e,t,r)=>{"use strict";var n=r(9781),i=r(3157),a=TypeError,o=Object.getOwnPropertyDescriptor,u=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=u?function(e,t){if(i(e)&&!o(e,"length").writable)throw a("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t}},1589:(e,t,r)=>{var n=r(1400),i=r(6244),a=r(6135),o=Array,u=Math.max;e.exports=function(e,t,r){for(var s=i(e),c=n(t,s),f=n(void 0===r?s:r,s),l=o(u(f-c,0)),p=0;c{var n=r(1702);e.exports=n([].slice)},4362:(e,t,r)=>{var n=r(1589),i=Math.floor,a=function(e,t){var r=e.length,s=i(r/2);return r<8?o(e,t):u(e,a(n(e,0,s),t),a(n(e,s),t),t)},o=function(e,t){for(var r,n,i=e.length,a=1;a0;)e[n]=e[--n];n!==a++&&(e[n]=r)}return e},u=function(e,t,r,n){for(var i=t.length,a=r.length,o=0,u=0;o{var n=r(3157),i=r(4411),a=r(111),o=r(5112)("species"),u=Array;e.exports=function(e){var t;return n(e)&&(t=e.constructor,(i(t)&&(t===u||n(t.prototype))||a(t)&&null===(t=t[o]))&&(t=void 0)),void 0===t?u:t}},5417:(e,t,r)=>{var n=r(7475);e.exports=function(e,t){return new(n(e))(0===t?0:t)}},3411:(e,t,r)=>{var n=r(9670),i=r(9212);e.exports=function(e,t,r,a){try{return a?t(n(r)[0],r[1]):t(r)}catch(t){i(e,"throw",t)}}},7072:(e,t,r)=>{var n=r(5112)("iterator"),i=!1;try{var a=0,o={next:function(){return{done:!!a++}},return:function(){i=!0}};o[n]=function(){return this},Array.from(o,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var a={};a[n]=function(){return{next:function(){return{done:r=!0}}}},e(a)}catch(e){}return r}},4326:(e,t,r)=>{var n=r(1702),i=n({}.toString),a=n("".slice);e.exports=function(e){return a(i(e),8,-1)}},648:(e,t,r)=>{var n=r(1694),i=r(614),a=r(4326),o=r(5112)("toStringTag"),u=Object,s="Arguments"==a(function(){return arguments}());e.exports=n?a:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=u(e),o))?r:s?a(t):"Object"==(n=a(t))&&i(t.callee)?"Arguments":n}},5631:(e,t,r)=>{"use strict";var n=r(30),i=r(7045),a=r(9190),o=r(9974),u=r(5787),s=r(8554),c=r(408),f=r(1656),l=r(6178),p=r(6340),m=r(9781),h=r(2423).fastKey,d=r(9909),v=d.set,y=d.getterFor;e.exports={getConstructor:function(e,t,r,f){var l=e((function(e,i){u(e,p),v(e,{type:t,index:n(null),first:void 0,last:void 0,size:0}),m||(e.size=0),s(i)||c(i,e[f],{that:e,AS_ENTRIES:r})})),p=l.prototype,d=y(t),g=function(e,t,r){var n,i,a=d(e),o=x(e,t);return o?o.value=r:(a.last=o={index:i=h(t,!0),key:t,value:r,previous:n=a.last,next:void 0,removed:!1},a.first||(a.first=o),n&&(n.next=o),m?a.size++:e.size++,"F"!==i&&(a.index[i]=o)),e},x=function(e,t){var r,n=d(e),i=h(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return a(p,{clear:function(){for(var e=d(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,m?e.size=0:this.size=0},delete:function(e){var t=this,r=d(t),n=x(t,e);if(n){var i=n.next,a=n.previous;delete r.index[n.index],n.removed=!0,a&&(a.next=i),i&&(i.previous=a),r.first==n&&(r.first=i),r.last==n&&(r.last=a),m?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=d(this),n=o(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!x(this,e)}}),a(p,r?{get:function(e){var t=x(this,e);return t&&t.value},set:function(e,t){return g(this,0===e?0:e,t)}}:{add:function(e){return g(this,e=0===e?0:e,e)}}),m&&i(p,"size",{configurable:!0,get:function(){return d(this).size}}),l},setStrong:function(e,t,r){var n=t+" Iterator",i=y(t),a=y(n);f(e,t,(function(e,t){v(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?l("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,l(void 0,!0))}),r?"entries":"values",!r,!0),p(t)}}},7710:(e,t,r)=>{"use strict";var n=r(2109),i=r(7854),a=r(1702),o=r(4705),u=r(8052),s=r(2423),c=r(408),f=r(5787),l=r(614),p=r(8554),m=r(111),h=r(7293),d=r(7072),v=r(8003),y=r(9587);e.exports=function(e,t,r){var g=-1!==e.indexOf("Map"),x=-1!==e.indexOf("Weak"),b=g?"set":"add",w=i[e],N=w&&w.prototype,D=w,E={},A=function(e){var t=a(N[e]);u(N,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(x&&!m(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return x&&!m(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(x&&!m(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(o(e,!l(w)||!(x||N.forEach&&!h((function(){(new w).entries().next()})))))D=r.getConstructor(t,e,g,b),s.enable();else if(o(e,!0)){var S=new D,C=S[b](x?{}:-0,1)!=S,M=h((function(){S.has(1)})),F=d((function(e){new w(e)})),O=!x&&h((function(){for(var e=new w,t=5;t--;)e[b](t,t);return!e.has(-0)}));F||((D=t((function(e,t){f(e,N);var r=y(new w,e,D);return p(t)||c(t,r[b],{that:r,AS_ENTRIES:g}),r}))).prototype=N,N.constructor=D),(M||O)&&(A("delete"),A("has"),g&&A("get")),(O||C)&&A(b),x&&N.clear&&delete N.clear}return E[e]=D,n({global:!0,constructor:!0,forced:D!=w},E),v(D,e),x||r.setStrong(D,e,g),D}},9920:(e,t,r)=>{var n=r(2597),i=r(3887),a=r(1236),o=r(3070);e.exports=function(e,t,r){for(var u=i(t),s=o.f,c=a.f,f=0;f{var n=r(5112)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[n]=!1,"/./"[e](t)}catch(e){}}return!1}},8544:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},4230:(e,t,r)=>{var n=r(1702),i=r(4488),a=r(1340),o=/"/g,u=n("".replace);e.exports=function(e,t,r,n){var s=a(i(e)),c="<"+t;return""!==r&&(c+=" "+r+'="'+u(a(n),o,""")+'"'),c+">"+s+""}},6178:e=>{e.exports=function(e,t){return{value:e,done:t}}},8880:(e,t,r)=>{var n=r(9781),i=r(3070),a=r(9114);e.exports=n?function(e,t,r){return i.f(e,t,a(1,r))}:function(e,t,r){return e[t]=r,e}},9114:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},6135:(e,t,r)=>{"use strict";var n=r(4948),i=r(3070),a=r(9114);e.exports=function(e,t,r){var o=n(t);o in e?i.f(e,o,a(0,r)):e[o]=r}},7045:(e,t,r)=>{var n=r(6339),i=r(3070);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),i.f(e,t,r)}},8052:(e,t,r)=>{var n=r(614),i=r(3070),a=r(6339),o=r(3072);e.exports=function(e,t,r,u){u||(u={});var s=u.enumerable,c=void 0!==u.name?u.name:t;if(n(r)&&a(r,c,u),u.global)s?e[t]=r:o(t,r);else{try{u.unsafe?e[t]&&(s=!0):delete e[t]}catch(e){}s?e[t]=r:i.f(e,t,{value:r,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return e}},9190:(e,t,r)=>{var n=r(8052);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},3072:(e,t,r)=>{var n=r(7854),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},5117:(e,t,r)=>{"use strict";var n=r(6330),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw i("Cannot delete property "+n(t)+" of "+n(e))}},9781:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4154:e=>{var t="object"==typeof document&&document.all,r=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:r}},317:(e,t,r)=>{var n=r(7854),i=r(111),a=n.document,o=i(a)&&i(a.createElement);e.exports=function(e){return o?a.createElement(e):{}}},7207:e=>{var t=TypeError;e.exports=function(e){if(e>9007199254740991)throw t("Maximum allowed index exceeded");return e}},8324:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8509:(e,t,r)=>{var n=r(317)("span").classList,i=n&&n.constructor&&n.constructor.prototype;e.exports=i===Object.prototype?void 0:i},8886:(e,t,r)=>{var n=r(8113).match(/firefox\/(\d+)/i);e.exports=!!n&&+n[1]},7871:(e,t,r)=>{var n=r(3823),i=r(5268);e.exports=!n&&!i&&"object"==typeof window&&"object"==typeof document},3823:e=>{e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},256:(e,t,r)=>{var n=r(8113);e.exports=/MSIE|Trident/.test(n)},1528:(e,t,r)=>{var n=r(8113);e.exports=/ipad|iphone|ipod/i.test(n)&&"undefined"!=typeof Pebble},6833:(e,t,r)=>{var n=r(8113);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)},5268:(e,t,r)=>{var n=r(4326);e.exports="undefined"!=typeof process&&"process"==n(process)},1036:(e,t,r)=>{var n=r(8113);e.exports=/web0s(?!.*chrome)/i.test(n)},8113:e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:(e,t,r)=>{var n,i,a=r(7854),o=r(8113),u=a.process,s=a.Deno,c=u&&u.versions||s&&s.version,f=c&&c.v8;f&&(i=(n=f.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&o&&(!(n=o.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=o.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},8008:(e,t,r)=>{var n=r(8113).match(/AppleWebKit\/(\d+)\./);e.exports=!!n&&+n[1]},748:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:(e,t,r)=>{var n=r(7854),i=r(1236).f,a=r(8880),o=r(8052),u=r(3072),s=r(9920),c=r(4705);e.exports=function(e,t){var r,f,l,p,m,h=e.target,d=e.global,v=e.stat;if(r=d?n:v?n[h]||u(h,{}):(n[h]||{}).prototype)for(f in t){if(p=t[f],l=e.dontCallGetSet?(m=i(r,f))&&m.value:r[f],!c(d?f:h+(v?".":"#")+f,e.forced)&&void 0!==l){if(typeof p==typeof l)continue;s(p,l)}(e.sham||l&&l.sham)&&a(p,"sham",!0),o(r,f,p,e)}}},7293:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},7007:(e,t,r)=>{"use strict";r(4916);var n=r(1470),i=r(8052),a=r(2261),o=r(7293),u=r(5112),s=r(8880),c=u("species"),f=RegExp.prototype;e.exports=function(e,t,r,l){var p=u(e),m=!o((function(){var t={};return t[p]=function(){return 7},7!=""[e](t)})),h=m&&!o((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[c]=function(){return r},r.flags="",r[p]=/./[p]),r.exec=function(){return t=!0,null},r[p](""),!t}));if(!m||!h||r){var d=n(/./[p]),v=t(p,""[e],(function(e,t,r,i,o){var u=n(e),s=t.exec;return s===a||s===f.exec?m&&!o?{done:!0,value:d(t,r,i)}:{done:!0,value:u(r,t,i)}:{done:!1}}));i(String.prototype,e,v[0]),i(f,p,v[1])}l&&s(f[p],"sham",!0)}},6677:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},2104:(e,t,r)=>{var n=r(4374),i=Function.prototype,a=i.apply,o=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?o.bind(a):function(){return o.apply(a,arguments)})},9974:(e,t,r)=>{var n=r(1470),i=r(9662),a=r(4374),o=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:a?o(e,t):function(){return e.apply(t,arguments)}}},4374:(e,t,r)=>{var n=r(7293);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},7065:(e,t,r)=>{"use strict";var n=r(1702),i=r(9662),a=r(111),o=r(2597),u=r(206),s=r(4374),c=Function,f=n([].concat),l=n([].join),p={};e.exports=s?c.bind:function(e){var t=i(this),r=t.prototype,n=u(arguments,1),s=function(){var r=f(n,u(arguments));return this instanceof s?function(e,t,r){if(!o(p,t)){for(var n=[],i=0;i{var n=r(4374),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},6530:(e,t,r)=>{var n=r(9781),i=r(2597),a=Function.prototype,o=n&&Object.getOwnPropertyDescriptor,u=i(a,"name"),s=u&&"something"===function(){}.name,c=u&&(!n||n&&o(a,"name").configurable);e.exports={EXISTS:u,PROPER:s,CONFIGURABLE:c}},5668:(e,t,r)=>{var n=r(1702),i=r(9662);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},1470:(e,t,r)=>{var n=r(4326),i=r(1702);e.exports=function(e){if("Function"===n(e))return i(e)}},1702:(e,t,r)=>{var n=r(4374),i=Function.prototype,a=i.call,o=n&&i.bind.bind(a,a);e.exports=n?o:function(e){return function(){return a.apply(e,arguments)}}},5005:(e,t,r)=>{var n=r(7854),i=r(614);e.exports=function(e,t){return arguments.length<2?(r=n[e],i(r)?r:void 0):n[e]&&n[e][t];var r}},1246:(e,t,r)=>{var n=r(648),i=r(8173),a=r(8554),o=r(7497),u=r(5112)("iterator");e.exports=function(e){if(!a(e))return i(e,u)||i(e,"@@iterator")||o[n(e)]}},4121:(e,t,r)=>{var n=r(6916),i=r(9662),a=r(9670),o=r(6330),u=r(1246),s=TypeError;e.exports=function(e,t){var r=arguments.length<2?u(e):t;if(i(r))return a(n(r,e));throw s(o(e)+" is not iterable")}},8044:(e,t,r)=>{var n=r(1702),i=r(3157),a=r(614),o=r(4326),u=r(1340),s=n([].push);e.exports=function(e){if(a(e))return e;if(i(e)){for(var t=e.length,r=[],n=0;n{var n=r(9662),i=r(8554);e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}},647:(e,t,r)=>{var n=r(1702),i=r(7908),a=Math.floor,o=n("".charAt),u=n("".replace),s=n("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,f=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,r,n,l,p){var m=r+e.length,h=n.length,d=f;return void 0!==l&&(l=i(l),d=c),u(p,d,(function(i,u){var c;switch(o(u,0)){case"$":return"$";case"&":return e;case"`":return s(t,0,r);case"'":return s(t,m);case"<":c=l[s(u,1,-1)];break;default:var f=+u;if(0===f)return i;if(f>h){var p=a(f/10);return 0===p?i:p<=h?void 0===n[p-1]?o(u,1):n[p-1]+o(u,1):i}c=n[f-1]}return void 0===c?"":c}))}},7854:function(e){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)||function(){return this}()||this||Function("return this")()},2597:(e,t,r)=>{var n=r(1702),i=r(7908),a=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return a(i(e),t)}},3501:e=>{e.exports={}},842:e=>{e.exports=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}}},490:(e,t,r)=>{var n=r(5005);e.exports=n("document","documentElement")},4664:(e,t,r)=>{var n=r(9781),i=r(7293),a=r(317);e.exports=!n&&!i((function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},8361:(e,t,r)=>{var n=r(1702),i=r(7293),a=r(4326),o=Object,u=n("".split);e.exports=i((function(){return!o("z").propertyIsEnumerable(0)}))?function(e){return"String"==a(e)?u(e,""):o(e)}:o},9587:(e,t,r)=>{var n=r(614),i=r(111),a=r(7674);e.exports=function(e,t,r){var o,u;return a&&n(o=t.constructor)&&o!==r&&i(u=o.prototype)&&u!==r.prototype&&a(e,u),e}},2788:(e,t,r)=>{var n=r(1702),i=r(614),a=r(5465),o=n(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return o(e)}),e.exports=a.inspectSource},2423:(e,t,r)=>{var n=r(2109),i=r(1702),a=r(3501),o=r(111),u=r(2597),s=r(3070).f,c=r(8006),f=r(1156),l=r(2050),p=r(9711),m=r(6677),h=!1,d=p("meta"),v=0,y=function(e){s(e,d,{value:{objectID:"O"+v++,weakData:{}}})},g=e.exports={enable:function(){g.enable=function(){},h=!0;var e=c.f,t=i([].splice),r={};r[d]=1,e(r).length&&(c.f=function(r){for(var n=e(r),i=0,a=n.length;i{var n,i,a,o=r(4811),u=r(7854),s=r(111),c=r(8880),f=r(2597),l=r(5465),p=r(6200),m=r(3501),h="Object already initialized",d=u.TypeError,v=u.WeakMap;if(o||l.state){var y=l.state||(l.state=new v);y.get=y.get,y.has=y.has,y.set=y.set,n=function(e,t){if(y.has(e))throw d(h);return t.facade=e,y.set(e,t),t},i=function(e){return y.get(e)||{}},a=function(e){return y.has(e)}}else{var g=p("state");m[g]=!0,n=function(e,t){if(f(e,g))throw d(h);return t.facade=e,c(e,g,t),t},i=function(e){return f(e,g)?e[g]:{}},a=function(e){return f(e,g)}}e.exports={set:n,get:i,has:a,enforce:function(e){return a(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!s(t)||(r=i(t)).type!==e)throw d("Incompatible receiver, "+e+" required");return r}}}},7659:(e,t,r)=>{var n=r(5112),i=r(7497),a=n("iterator"),o=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||o[a]===e)}},3157:(e,t,r)=>{var n=r(4326);e.exports=Array.isArray||function(e){return"Array"==n(e)}},614:(e,t,r)=>{var n=r(4154),i=n.all;e.exports=n.IS_HTMLDDA?function(e){return"function"==typeof e||e===i}:function(e){return"function"==typeof e}},4411:(e,t,r)=>{var n=r(1702),i=r(7293),a=r(614),o=r(648),u=r(5005),s=r(2788),c=function(){},f=[],l=u("Reflect","construct"),p=/^\s*(?:class|function)\b/,m=n(p.exec),h=!p.exec(c),d=function(e){if(!a(e))return!1;try{return l(c,f,e),!0}catch(e){return!1}},v=function(e){if(!a(e))return!1;switch(o(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!m(p,s(e))}catch(e){return!0}};v.sham=!0,e.exports=!l||i((function(){var e;return d(d.call)||!d(Object)||!d((function(){e=!0}))||e}))?v:d},4705:(e,t,r)=>{var n=r(7293),i=r(614),a=/#|\.prototype\./,o=function(e,t){var r=s[u(e)];return r==f||r!=c&&(i(t)?n(t):!!t)},u=o.normalize=function(e){return String(e).replace(a,".").toLowerCase()},s=o.data={},c=o.NATIVE="N",f=o.POLYFILL="P";e.exports=o},8554:e=>{e.exports=function(e){return null==e}},111:(e,t,r)=>{var n=r(614),i=r(4154),a=i.all;e.exports=i.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:n(e)||e===a}:function(e){return"object"==typeof e?null!==e:n(e)}},1913:e=>{e.exports=!1},7850:(e,t,r)=>{var n=r(111),i=r(4326),a=r(5112)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[a])?!!t:"RegExp"==i(e))}},2190:(e,t,r)=>{var n=r(5005),i=r(614),a=r(7976),o=r(3307),u=Object;e.exports=o?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&a(t.prototype,u(e))}},408:(e,t,r)=>{var n=r(9974),i=r(6916),a=r(9670),o=r(6330),u=r(7659),s=r(6244),c=r(7976),f=r(4121),l=r(1246),p=r(9212),m=TypeError,h=function(e,t){this.stopped=e,this.result=t},d=h.prototype;e.exports=function(e,t,r){var v,y,g,x,b,w,N,D=r&&r.that,E=!(!r||!r.AS_ENTRIES),A=!(!r||!r.IS_RECORD),S=!(!r||!r.IS_ITERATOR),C=!(!r||!r.INTERRUPTED),M=n(t,D),F=function(e){return v&&p(v,"normal",e),new h(!0,e)},O=function(e){return E?(a(e),C?M(e[0],e[1],F):M(e[0],e[1])):C?M(e,F):M(e)};if(A)v=e.iterator;else if(S)v=e;else{if(!(y=l(e)))throw m(o(e)+" is not iterable");if(u(y)){for(g=0,x=s(e);x>g;g++)if((b=O(e[g]))&&c(d,b))return b;return new h(!1)}v=f(e,y)}for(w=A?e.next:v.next;!(N=i(w,v)).done;){try{b=O(N.value)}catch(e){p(v,"throw",e)}if("object"==typeof b&&b&&c(d,b))return b}return new h(!1)}},9212:(e,t,r)=>{var n=r(6916),i=r(9670),a=r(8173);e.exports=function(e,t,r){var o,u;i(e);try{if(!(o=a(e,"return"))){if("throw"===t)throw r;return r}o=n(o,e)}catch(e){u=!0,o=e}if("throw"===t)throw r;if(u)throw o;return i(o),r}},3061:(e,t,r)=>{"use strict";var n=r(3383).IteratorPrototype,i=r(30),a=r(9114),o=r(8003),u=r(7497),s=function(){return this};e.exports=function(e,t,r,c){var f=t+" Iterator";return e.prototype=i(n,{next:a(+!c,r)}),o(e,f,!1,!0),u[f]=s,e}},1656:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(1913),o=r(6530),u=r(614),s=r(3061),c=r(9518),f=r(7674),l=r(8003),p=r(8880),m=r(8052),h=r(5112),d=r(7497),v=r(3383),y=o.PROPER,g=o.CONFIGURABLE,x=v.IteratorPrototype,b=v.BUGGY_SAFARI_ITERATORS,w=h("iterator"),N="keys",D="values",E="entries",A=function(){return this};e.exports=function(e,t,r,o,h,v,S){s(r,t,o);var C,M,F,O=function(e){if(e===h&&I)return I;if(!b&&e in _)return _[e];switch(e){case N:case D:case E:return function(){return new r(this,e)}}return function(){return new r(this)}},T=t+" Iterator",B=!1,_=e.prototype,k=_[w]||_["@@iterator"]||h&&_[h],I=!b&&k||O(h),R="Array"==t&&_.entries||k;if(R&&(C=c(R.call(new e)))!==Object.prototype&&C.next&&(a||c(C)===x||(f?f(C,x):u(C[w])||m(C,w,A)),l(C,T,!0,!0),a&&(d[T]=A)),y&&h==D&&k&&k.name!==D&&(!a&&g?p(_,"name",D):(B=!0,I=function(){return i(k,this)})),h)if(M={values:O(D),keys:v?I:O(N),entries:O(E)},S)for(F in M)(b||B||!(F in _))&&m(_,F,M[F]);else n({target:t,proto:!0,forced:b||B},M);return a&&!S||_[w]===I||m(_,w,I,{name:h}),d[t]=I,M}},3383:(e,t,r)=>{"use strict";var n,i,a,o=r(7293),u=r(614),s=r(111),c=r(30),f=r(9518),l=r(8052),p=r(5112),m=r(1913),h=p("iterator"),d=!1;[].keys&&("next"in(a=[].keys())?(i=f(f(a)))!==Object.prototype&&(n=i):d=!0),!s(n)||o((function(){var e={};return n[h].call(e)!==e}))?n={}:m&&(n=c(n)),u(n[h])||l(n,h,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},7497:e=>{e.exports={}},6244:(e,t,r)=>{var n=r(7466);e.exports=function(e){return n(e.length)}},6339:(e,t,r)=>{var n=r(1702),i=r(7293),a=r(614),o=r(2597),u=r(9781),s=r(6530).CONFIGURABLE,c=r(2788),f=r(9909),l=f.enforce,p=f.get,m=String,h=Object.defineProperty,d=n("".slice),v=n("".replace),y=n([].join),g=u&&!i((function(){return 8!==h((function(){}),"length",{value:8}).length})),x=String(String).split("String"),b=e.exports=function(e,t,r){"Symbol("===d(m(t),0,7)&&(t="["+v(m(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!o(e,"name")||s&&e.name!==t)&&(u?h(e,"name",{value:t,configurable:!0}):e.name=t),g&&r&&o(r,"arity")&&e.length!==r.arity&&h(e,"length",{value:r.arity});try{r&&o(r,"constructor")&&r.constructor?u&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=l(e);return o(n,"source")||(n.source=y(x,"string"==typeof t?t:"")),e};Function.prototype.toString=b((function(){return a(this)&&p(this).source||c(this)}),"toString")},6736:e=>{var t=Math.expm1,r=Math.exp;e.exports=!t||t(10)>22025.465794806718||t(10)<22025.465794806718||-2e-17!=t(-2e-17)?function(e){var t=+e;return 0==t?t:t>-1e-6&&t<1e-6?t+t*t/2:r(t)-1}:t},403:e=>{var t=Math.log,r=Math.LOG10E;e.exports=Math.log10||function(e){return t(e)*r}},6513:e=>{var t=Math.log;e.exports=Math.log1p||function(e){var r=+e;return r>-1e-8&&r<1e-8?r-r*r/2:t(1+r)}},4310:e=>{e.exports=Math.sign||function(e){var t=+e;return 0==t||t!=t?t:t<0?-1:1}},4758:e=>{var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},5948:(e,t,r)=>{var n,i,a,o,u,s=r(7854),c=r(9974),f=r(1236).f,l=r(261).set,p=r(8572),m=r(6833),h=r(1528),d=r(1036),v=r(5268),y=s.MutationObserver||s.WebKitMutationObserver,g=s.document,x=s.process,b=s.Promise,w=f(s,"queueMicrotask"),N=w&&w.value;if(!N){var D=new p,E=function(){var e,t;for(v&&(e=x.domain)&&e.exit();t=D.get();)try{t()}catch(e){throw D.head&&n(),e}e&&e.enter()};m||v||d||!y||!g?!h&&b&&b.resolve?((o=b.resolve(void 0)).constructor=b,u=c(o.then,o),n=function(){u(E)}):v?n=function(){x.nextTick(E)}:(l=c(l,s),n=function(){l(E)}):(i=!0,a=g.createTextNode(""),new y(E).observe(a,{characterData:!0}),n=function(){a.data=i=!i}),N=function(e){D.head||n(),D.add(e)}}e.exports=N},8523:(e,t,r)=>{"use strict";var n=r(9662),i=TypeError,a=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw i("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)};e.exports.f=function(e){return new a(e)}},3929:(e,t,r)=>{var n=r(7850),i=TypeError;e.exports=function(e){if(n(e))throw i("The method doesn't accept regular expressions");return e}},2814:(e,t,r)=>{var n=r(7854),i=r(7293),a=r(1702),o=r(1340),u=r(3111).trim,s=r(1361),c=a("".charAt),f=n.parseFloat,l=n.Symbol,p=l&&l.iterator,m=1/f(s+"-0")!=-1/0||p&&!i((function(){f(Object(p))}));e.exports=m?function(e){var t=u(o(e)),r=f(t);return 0===r&&"-"==c(t,0)?-0:r}:f},3009:(e,t,r)=>{var n=r(7854),i=r(7293),a=r(1702),o=r(1340),u=r(3111).trim,s=r(1361),c=n.parseInt,f=n.Symbol,l=f&&f.iterator,p=/^[+-]?0x/i,m=a(p.exec),h=8!==c(s+"08")||22!==c(s+"0x16")||l&&!i((function(){c(Object(l))}));e.exports=h?function(e,t){var r=u(o(e));return c(r,t>>>0||(m(p,r)?16:10))}:c},30:(e,t,r)=>{var n,i=r(9670),a=r(6048),o=r(748),u=r(3501),s=r(490),c=r(317),f=r(6200),l="prototype",p="script",m=f("IE_PROTO"),h=function(){},d=function(e){return"<"+p+">"+e+""},v=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;y="undefined"!=typeof document?document.domain&&n?v(n):(t=c("iframe"),r="java"+p+":",t.style.display="none",s.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):v(n);for(var i=o.length;i--;)delete y[l][o[i]];return y()};u[m]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(h[l]=i(e),r=new h,h[l]=null,r[m]=e):r=y(),void 0===t?r:a.f(r,t)}},6048:(e,t,r)=>{var n=r(9781),i=r(3353),a=r(3070),o=r(9670),u=r(5656),s=r(1956);t.f=n&&!i?Object.defineProperties:function(e,t){o(e);for(var r,n=u(t),i=s(t),c=i.length,f=0;c>f;)a.f(e,r=i[f++],n[r]);return e}},3070:(e,t,r)=>{var n=r(9781),i=r(4664),a=r(3353),o=r(9670),u=r(4948),s=TypeError,c=Object.defineProperty,f=Object.getOwnPropertyDescriptor,l="enumerable",p="configurable",m="writable";t.f=n?a?function(e,t,r){if(o(e),t=u(t),o(r),"function"==typeof e&&"prototype"===t&&"value"in r&&m in r&&!r[m]){var n=f(e,t);n&&n[m]&&(e[t]=r.value,r={configurable:p in r?r[p]:n[p],enumerable:l in r?r[l]:n[l],writable:!1})}return c(e,t,r)}:c:function(e,t,r){if(o(e),t=u(t),o(r),i)try{return c(e,t,r)}catch(e){}if("get"in r||"set"in r)throw s("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},1236:(e,t,r)=>{var n=r(9781),i=r(6916),a=r(5296),o=r(9114),u=r(5656),s=r(4948),c=r(2597),f=r(4664),l=Object.getOwnPropertyDescriptor;t.f=n?l:function(e,t){if(e=u(e),t=s(t),f)try{return l(e,t)}catch(e){}if(c(e,t))return o(!i(a.f,e,t),e[t])}},1156:(e,t,r)=>{var n=r(4326),i=r(5656),a=r(8006).f,o=r(1589),u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(e){return u&&"Window"==n(e)?function(e){try{return a(e)}catch(e){return o(u)}}(e):a(i(e))}},8006:(e,t,r)=>{var n=r(6324),i=r(748).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},5181:(e,t)=>{t.f=Object.getOwnPropertySymbols},9518:(e,t,r)=>{var n=r(2597),i=r(614),a=r(7908),o=r(6200),u=r(8544),s=o("IE_PROTO"),c=Object,f=c.prototype;e.exports=u?c.getPrototypeOf:function(e){var t=a(e);if(n(t,s))return t[s];var r=t.constructor;return i(r)&&t instanceof r?r.prototype:t instanceof c?f:null}},2050:(e,t,r)=>{var n=r(7293),i=r(111),a=r(4326),o=r(7556),u=Object.isExtensible,s=n((function(){u(1)}));e.exports=s||o?function(e){return!!i(e)&&(!o||"ArrayBuffer"!=a(e))&&(!u||u(e))}:u},7976:(e,t,r)=>{var n=r(1702);e.exports=n({}.isPrototypeOf)},6324:(e,t,r)=>{var n=r(1702),i=r(2597),a=r(5656),o=r(1318).indexOf,u=r(3501),s=n([].push);e.exports=function(e,t){var r,n=a(e),c=0,f=[];for(r in n)!i(u,r)&&i(n,r)&&s(f,r);for(;t.length>c;)i(n,r=t[c++])&&(~o(f,r)||s(f,r));return f}},1956:(e,t,r)=>{var n=r(6324),i=r(748);e.exports=Object.keys||function(e){return n(e,i)}},5296:(e,t)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},7674:(e,t,r)=>{var n=r(5668),i=r(9670),a=r(6077);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return i(r),a(n),t?e(r,n):r.__proto__=n,r}}():void 0)},288:(e,t,r)=>{"use strict";var n=r(1694),i=r(648);e.exports=n?{}.toString:function(){return"[object "+i(this)+"]"}},2140:(e,t,r)=>{var n=r(6916),i=r(614),a=r(111),o=TypeError;e.exports=function(e,t){var r,u;if("string"===t&&i(r=e.toString)&&!a(u=n(r,e)))return u;if(i(r=e.valueOf)&&!a(u=n(r,e)))return u;if("string"!==t&&i(r=e.toString)&&!a(u=n(r,e)))return u;throw o("Can't convert object to primitive value")}},3887:(e,t,r)=>{var n=r(5005),i=r(1702),a=r(8006),o=r(5181),u=r(9670),s=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=a.f(u(e)),r=o.f;return r?s(t,r(e)):t}},857:(e,t,r)=>{var n=r(7854);e.exports=n},2534:e=>{e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},3702:(e,t,r)=>{var n=r(7854),i=r(2492),a=r(614),o=r(4705),u=r(2788),s=r(5112),c=r(7871),f=r(3823),l=r(1913),p=r(7392),m=i&&i.prototype,h=s("species"),d=!1,v=a(n.PromiseRejectionEvent),y=o("Promise",(function(){var e=u(i),t=e!==String(i);if(!t&&66===p)return!0;if(l&&(!m.catch||!m.finally))return!0;if(!p||p<51||!/native code/.test(e)){var r=new i((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[h]=n,!(d=r.then((function(){}))instanceof n))return!0}return!t&&(c||f)&&!v}));e.exports={CONSTRUCTOR:y,REJECTION_EVENT:v,SUBCLASSING:d}},2492:(e,t,r)=>{var n=r(7854);e.exports=n.Promise},9478:(e,t,r)=>{var n=r(9670),i=r(111),a=r(8523);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=a.f(e);return(0,r.resolve)(t),r.promise}},612:(e,t,r)=>{var n=r(2492),i=r(7072),a=r(3702).CONSTRUCTOR;e.exports=a||!i((function(e){n.all(e).then(void 0,(function(){}))}))},2626:(e,t,r)=>{var n=r(3070).f;e.exports=function(e,t,r){r in e||n(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})}},8572:e=>{var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.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},7651:(e,t,r)=>{var n=r(6916),i=r(9670),a=r(614),o=r(4326),u=r(2261),s=TypeError;e.exports=function(e,t){var r=e.exec;if(a(r)){var c=n(r,e,t);return null!==c&&i(c),c}if("RegExp"===o(e))return n(u,e,t);throw s("RegExp#exec called on incompatible receiver")}},2261:(e,t,r)=>{"use strict";var n,i,a=r(6916),o=r(1702),u=r(1340),s=r(7066),c=r(2999),f=r(2309),l=r(30),p=r(9909).get,m=r(9441),h=r(7168),d=f("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,y=v,g=o("".charAt),x=o("".indexOf),b=o("".replace),w=o("".slice),N=(i=/b*/g,a(v,n=/a/,"a"),a(v,i,"a"),0!==n.lastIndex||0!==i.lastIndex),D=c.BROKEN_CARET,E=void 0!==/()??/.exec("")[1];(N||E||D||m||h)&&(y=function(e){var t,r,n,i,o,c,f,m=this,h=p(m),A=u(e),S=h.raw;if(S)return S.lastIndex=m.lastIndex,t=a(y,S,A),m.lastIndex=S.lastIndex,t;var C=h.groups,M=D&&m.sticky,F=a(s,m),O=m.source,T=0,B=A;if(M&&(F=b(F,"y",""),-1===x(F,"g")&&(F+="g"),B=w(A,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==g(A,m.lastIndex-1))&&(O="(?: "+O+")",B=" "+B,T++),r=new RegExp("^(?:"+O+")",F)),E&&(r=new RegExp("^"+O+"$(?!\\s)",F)),N&&(n=m.lastIndex),i=a(v,M?r:m,B),M?i?(i.input=w(i.input,T),i[0]=w(i[0],T),i.index=m.lastIndex,m.lastIndex+=i[0].length):m.lastIndex=0:N&&i&&(m.lastIndex=m.global?i.index+i[0].length:n),E&&i&&i.length>1&&a(d,i[0],r,(function(){for(o=1;o{"use strict";var n=r(9670);e.exports=function(){var e=n(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}},4706:(e,t,r)=>{var n=r(6916),i=r(2597),a=r(7976),o=r(7066),u=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in u||i(e,"flags")||!a(u,e)?t:n(o,e)}},2999:(e,t,r)=>{var n=r(7293),i=r(7854).RegExp,a=n((function(){var e=i("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),o=a||n((function(){return!i("a","y").sticky})),u=a||n((function(){var e=i("^r","gy");return e.lastIndex=2,null!=e.exec("str")}));e.exports={BROKEN_CARET:u,MISSED_STICKY:o,UNSUPPORTED_Y:a}},9441:(e,t,r)=>{var n=r(7293),i=r(7854).RegExp;e.exports=n((function(){var e=i(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)}))},7168:(e,t,r)=>{var n=r(7293),i=r(7854).RegExp;e.exports=n((function(){var e=i("(?
b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$c")}))},4488:(e,t,r)=>{var n=r(8554),i=TypeError;e.exports=function(e){if(n(e))throw i("Can't call method on "+e);return e}},6340:(e,t,r)=>{"use strict";var n=r(5005),i=r(7045),a=r(5112),o=r(9781),u=a("species");e.exports=function(e){var t=n(e);o&&t&&!t[u]&&i(t,u,{configurable:!0,get:function(){return this}})}},8003:(e,t,r)=>{var n=r(3070).f,i=r(2597),a=r(5112)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!i(e,a)&&n(e,a,{configurable:!0,value:t})}},6200:(e,t,r)=>{var n=r(2309),i=r(9711),a=n("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},5465:(e,t,r)=>{var n=r(7854),i=r(3072),a="__core-js_shared__",o=n[a]||i(a,{});e.exports=o},2309:(e,t,r)=>{var n=r(1913),i=r(5465);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"})},6707:(e,t,r)=>{var n=r(9670),i=r(9483),a=r(8554),o=r(5112)("species");e.exports=function(e,t){var r,u=n(e).constructor;return void 0===u||a(r=n(u)[o])?t:i(r)}},3429:(e,t,r)=>{var n=r(7293);e.exports=function(e){return n((function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}))}},8710:(e,t,r)=>{var n=r(1702),i=r(9303),a=r(1340),o=r(4488),u=n("".charAt),s=n("".charCodeAt),c=n("".slice),f=function(e){return function(t,r){var n,f,l=a(o(t)),p=i(r),m=l.length;return p<0||p>=m?e?"":void 0:(n=s(l,p))<55296||n>56319||p+1===m||(f=s(l,p+1))<56320||f>57343?e?u(l,p):n:e?c(l,p,p+2):f-56320+(n-55296<<10)+65536}};e.exports={codeAt:f(!1),charAt:f(!0)}},8415:(e,t,r)=>{"use strict";var n=r(9303),i=r(1340),a=r(4488),o=RangeError;e.exports=function(e){var t=i(a(this)),r="",u=n(e);if(u<0||u==1/0)throw o("Wrong number of repetitions");for(;u>0;(u>>>=1)&&(t+=t))1&u&&(r+=t);return r}},6091:(e,t,r)=>{var n=r(6530).PROPER,i=r(7293),a=r(1361);e.exports=function(e){return i((function(){return!!a[e]()||"​…᠎"!=="​…᠎"[e]()||n&&a[e].name!==e}))}},3111:(e,t,r)=>{var n=r(1702),i=r(4488),a=r(1340),o=r(1361),u=n("".replace),s=RegExp("^["+o+"]+"),c=RegExp("(^|[^"+o+"])["+o+"]+$"),f=function(e){return function(t){var r=a(i(t));return 1&e&&(r=u(r,s,"")),2&e&&(r=u(r,c,"$1")),r}};e.exports={start:f(1),end:f(2),trim:f(3)}},6293:(e,t,r)=>{var n=r(7392),i=r(7293),a=r(7854).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol();return!a(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},6532:(e,t,r)=>{var n=r(6916),i=r(5005),a=r(5112),o=r(8052);e.exports=function(){var e=i("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,u=a("toPrimitive");t&&!t[u]&&o(t,u,(function(e){return n(r,this)}),{arity:1})}},2015:(e,t,r)=>{var n=r(6293);e.exports=n&&!!Symbol.for&&!!Symbol.keyFor},261:(e,t,r)=>{var n,i,a,o,u=r(7854),s=r(2104),c=r(9974),f=r(614),l=r(2597),p=r(7293),m=r(490),h=r(206),d=r(317),v=r(8053),y=r(6833),g=r(5268),x=u.setImmediate,b=u.clearImmediate,w=u.process,N=u.Dispatch,D=u.Function,E=u.MessageChannel,A=u.String,S=0,C={},M="onreadystatechange";p((function(){n=u.location}));var F=function(e){if(l(C,e)){var t=C[e];delete C[e],t()}},O=function(e){return function(){F(e)}},T=function(e){F(e.data)},B=function(e){u.postMessage(A(e),n.protocol+"//"+n.host)};x&&b||(x=function(e){v(arguments.length,1);var t=f(e)?e:D(e),r=h(arguments,1);return C[++S]=function(){s(t,void 0,r)},i(S),S},b=function(e){delete C[e]},g?i=function(e){w.nextTick(O(e))}:N&&N.now?i=function(e){N.now(O(e))}:E&&!y?(o=(a=new E).port2,a.port1.onmessage=T,i=c(o.postMessage,o)):u.addEventListener&&f(u.postMessage)&&!u.importScripts&&n&&"file:"!==n.protocol&&!p(B)?(i=B,u.addEventListener("message",T,!1)):i=M in d("script")?function(e){m.appendChild(d("script"))[M]=function(){m.removeChild(this),F(e)}}:function(e){setTimeout(O(e),0)}),e.exports={set:x,clear:b}},863:(e,t,r)=>{var n=r(1702);e.exports=n(1..valueOf)},1400:(e,t,r)=>{var n=r(9303),i=Math.max,a=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):a(r,t)}},5656:(e,t,r)=>{var n=r(8361),i=r(4488);e.exports=function(e){return n(i(e))}},9303:(e,t,r)=>{var n=r(4758);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},7466:(e,t,r)=>{var n=r(9303),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},7908:(e,t,r)=>{var n=r(4488),i=Object;e.exports=function(e){return i(n(e))}},7593:(e,t,r)=>{var n=r(6916),i=r(111),a=r(2190),o=r(8173),u=r(2140),s=r(5112),c=TypeError,f=s("toPrimitive");e.exports=function(e,t){if(!i(e)||a(e))return e;var r,s=o(e,f);if(s){if(void 0===t&&(t="default"),r=n(s,e,t),!i(r)||a(r))return r;throw c("Can't convert object to primitive value")}return void 0===t&&(t="number"),u(e,t)}},4948:(e,t,r)=>{var n=r(7593),i=r(2190);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},1694:(e,t,r)=>{var n={};n[r(5112)("toStringTag")]="z",e.exports="[object z]"===String(n)},1340:(e,t,r)=>{var n=r(648),i=String;e.exports=function(e){if("Symbol"===n(e))throw TypeError("Cannot convert a Symbol value to a string");return i(e)}},6330:e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},9711:(e,t,r)=>{var n=r(1702),i=0,a=Math.random(),o=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+o(++i+a,36)}},3307:(e,t,r)=>{var n=r(6293);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:(e,t,r)=>{var n=r(9781),i=r(7293);e.exports=n&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},8053:e=>{var t=TypeError;e.exports=function(e,r){if(e{var n=r(7854),i=r(614),a=n.WeakMap;e.exports=i(a)&&/native code/.test(String(a))},6800:(e,t,r)=>{var n=r(857),i=r(2597),a=r(6061),o=r(3070).f;e.exports=function(e){var t=n.Symbol||(n.Symbol={});i(t,e)||o(t,e,{value:a.f(e)})}},6061:(e,t,r)=>{var n=r(5112);t.f=n},5112:(e,t,r)=>{var n=r(7854),i=r(2309),a=r(2597),o=r(9711),u=r(6293),s=r(3307),c=n.Symbol,f=i("wks"),l=s?c.for||c:c&&c.withoutSetter||o;e.exports=function(e){return a(f,e)||(f[e]=u&&a(c,e)?c[e]:l("Symbol."+e)),f[e]}},1361:e=>{e.exports="\t\n\v\f\r                \u2028\u2029\ufeff"},2222:(e,t,r)=>{"use strict";var n=r(2109),i=r(7293),a=r(3157),o=r(111),u=r(7908),s=r(6244),c=r(7207),f=r(6135),l=r(5417),p=r(1194),m=r(5112),h=r(7392),d=m("isConcatSpreadable"),v=h>=51||!i((function(){var e=[];return e[d]=!1,e.concat()[0]!==e})),y=function(e){if(!o(e))return!1;var t=e[d];return void 0!==t?!!t:a(e)};n({target:"Array",proto:!0,arity:1,forced:!v||!p("concat")},{concat:function(e){var t,r,n,i,a,o=u(this),p=l(o,0),m=0;for(t=-1,n=arguments.length;t{"use strict";var n=r(2109),i=r(2092).every;n({target:"Array",proto:!0,forced:!r(9341)("every")},{every:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},3290:(e,t,r)=>{var n=r(2109),i=r(1285),a=r(1223);n({target:"Array",proto:!0},{fill:i}),a("fill")},7327:(e,t,r)=>{"use strict";var n=r(2109),i=r(2092).filter;n({target:"Array",proto:!0,forced:!r(1194)("filter")},{filter:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},9826:(e,t,r)=>{"use strict";var n=r(2109),i=r(2092).find,a=r(1223),o="find",u=!0;o in[]&&Array(1)[o]((function(){u=!1})),n({target:"Array",proto:!0,forced:u},{find:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a(o)},9554:(e,t,r)=>{"use strict";var n=r(2109),i=r(8533);n({target:"Array",proto:!0,forced:[].forEach!=i},{forEach:i})},1038:(e,t,r)=>{var n=r(2109),i=r(8457);n({target:"Array",stat:!0,forced:!r(7072)((function(e){Array.from(e)}))},{from:i})},6699:(e,t,r)=>{"use strict";var n=r(2109),i=r(1318).includes,a=r(7293),o=r(1223);n({target:"Array",proto:!0,forced:a((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),o("includes")},2772:(e,t,r)=>{"use strict";var n=r(2109),i=r(1470),a=r(1318).indexOf,o=r(9341),u=i([].indexOf),s=!!u&&1/u([1],1,-0)<0;n({target:"Array",proto:!0,forced:s||!o("indexOf")},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return s?u(this,e,t)||0:a(this,e,t)}})},9753:(e,t,r)=>{r(2109)({target:"Array",stat:!0},{isArray:r(3157)})},6992:(e,t,r)=>{"use strict";var n=r(5656),i=r(1223),a=r(7497),o=r(9909),u=r(3070).f,s=r(1656),c=r(6178),f=r(1913),l=r(9781),p="Array Iterator",m=o.set,h=o.getterFor(p);e.exports=s(Array,"Array",(function(e,t){m(this,{type:p,target:n(e),index:0,kind:t})}),(function(){var e=h(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,c(void 0,!0)):c("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values");var d=a.Arguments=a.Array;if(i("keys"),i("values"),i("entries"),!f&&l&&"values"!==d.name)try{u(d,"name",{value:"values"})}catch(e){}},9600:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(8361),o=r(5656),u=r(9341),s=i([].join);n({target:"Array",proto:!0,forced:a!=Object||!u("join",",")},{join:function(e){return s(o(this),void 0===e?",":e)}})},1249:(e,t,r)=>{"use strict";var n=r(2109),i=r(2092).map;n({target:"Array",proto:!0,forced:!r(1194)("map")},{map:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},5827:(e,t,r)=>{"use strict";var n=r(2109),i=r(3671).left,a=r(9341),o=r(7392);n({target:"Array",proto:!0,forced:!r(5268)&&o>79&&o<83||!a("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},5069:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(3157),o=i([].reverse),u=[1,2];n({target:"Array",proto:!0,forced:String(u)===String(u.reverse())},{reverse:function(){return a(this)&&(this.length=this.length),o(this)}})},7042:(e,t,r)=>{"use strict";var n=r(2109),i=r(3157),a=r(4411),o=r(111),u=r(1400),s=r(6244),c=r(5656),f=r(6135),l=r(5112),p=r(1194),m=r(206),h=p("slice"),d=l("species"),v=Array,y=Math.max;n({target:"Array",proto:!0,forced:!h},{slice:function(e,t){var r,n,l,p=c(this),h=s(p),g=u(e,h),x=u(void 0===t?h:t,h);if(i(p)&&(r=p.constructor,(a(r)&&(r===v||i(r.prototype))||o(r)&&null===(r=r[d]))&&(r=void 0),r===v||void 0===r))return m(p,g,x);for(n=new(void 0===r?v:r)(y(x-g,0)),l=0;g{"use strict";var n=r(2109),i=r(2092).some;n({target:"Array",proto:!0,forced:!r(9341)("some")},{some:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}})},2707:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(9662),o=r(7908),u=r(6244),s=r(5117),c=r(1340),f=r(7293),l=r(4362),p=r(9341),m=r(8886),h=r(256),d=r(7392),v=r(8008),y=[],g=i(y.sort),x=i(y.push),b=f((function(){y.sort(void 0)})),w=f((function(){y.sort(null)})),N=p("sort"),D=!f((function(){if(d)return d<70;if(!(m&&m>3)){if(h)return!0;if(v)return v<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)y.push({k:t+n,v:r})}for(y.sort((function(e,t){return t.v-e.v})),n=0;nc(r)?1:-1}}(e)),r=u(i),n=0;n{"use strict";var n=r(2109),i=r(7908),a=r(1400),o=r(9303),u=r(6244),s=r(3658),c=r(7207),f=r(5417),l=r(6135),p=r(5117),m=r(1194)("splice"),h=Math.max,d=Math.min;n({target:"Array",proto:!0,forced:!m},{splice:function(e,t){var r,n,m,v,y,g,x=i(this),b=u(x),w=a(e,b),N=arguments.length;for(0===N?r=n=0:1===N?(r=0,n=b-w):(r=N-2,n=d(h(o(t),0),b-w)),c(b+r-n),m=f(x,n),v=0;vb-n+r;v--)p(x,v-1)}else if(r>n)for(v=b-n;v>w;v--)g=v+r-1,(y=v+n-1)in x?x[g]=x[y]:p(x,g);for(v=0;v{var n=r(2109),i=r(1702),a=Date,o=i(a.prototype.getTime);n({target:"Date",stat:!0},{now:function(){return o(new a)}})},5735:(e,t,r)=>{"use strict";var n=r(2109),i=r(7293),a=r(7908),o=r(7593);n({target:"Date",proto:!0,arity:1,forced:i((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=a(this),r=o(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}})},3710:(e,t,r)=>{var n=r(1702),i=r(8052),a=Date.prototype,o="Invalid Date",u="toString",s=n(a[u]),c=n(a.getTime);String(new Date(NaN))!=o&&i(a,u,(function(){var e=c(this);return e==e?s(this):o}))},4812:(e,t,r)=>{var n=r(2109),i=r(7065);n({target:"Function",proto:!0,forced:Function.bind!==i},{bind:i})},8309:(e,t,r)=>{var n=r(9781),i=r(6530).EXISTS,a=r(1702),o=r(7045),u=Function.prototype,s=a(u.toString),c=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,f=a(c.exec);n&&!i&&o(u,"name",{configurable:!0,get:function(){try{return f(c,s(this))[1]}catch(e){return""}}})},8862:(e,t,r)=>{var n=r(2109),i=r(5005),a=r(2104),o=r(6916),u=r(1702),s=r(7293),c=r(614),f=r(2190),l=r(206),p=r(8044),m=r(6293),h=String,d=i("JSON","stringify"),v=u(/./.exec),y=u("".charAt),g=u("".charCodeAt),x=u("".replace),b=u(1..toString),w=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,D=/^[\uDC00-\uDFFF]$/,E=!m||s((function(){var e=i("Symbol")();return"[null]"!=d([e])||"{}"!=d({a:e})||"{}"!=d(Object(e))})),A=s((function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")})),S=function(e,t){var r=l(arguments),n=p(t);if(c(n)||void 0!==e&&!f(e))return r[1]=function(e,t){if(c(n)&&(t=o(n,this,h(e),t)),!f(t))return t},a(d,null,r)},C=function(e,t,r){var n=y(r,t-1),i=y(r,t+1);return v(N,e)&&!v(D,i)||v(D,e)&&!v(N,n)?"\\u"+b(g(e,0),16):e};d&&n({target:"JSON",stat:!0,arity:3,forced:E||A},{stringify:function(e,t,r){var n=l(arguments),i=a(E?S:d,null,n);return A&&"string"==typeof i?x(i,w,C):i}})},9098:(e,t,r)=>{"use strict";r(7710)("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),r(5631))},1532:(e,t,r)=>{r(9098)},9752:(e,t,r)=>{var n=r(2109),i=r(6513),a=Math.acosh,o=Math.log,u=Math.sqrt,s=Math.LN2;n({target:"Math",stat:!0,forced:!a||710!=Math.floor(a(Number.MAX_VALUE))||a(1/0)!=1/0},{acosh:function(e){var t=+e;return t<1?NaN:t>94906265.62425156?o(t)+s:i(t-1+u(t-1)*u(t+1))}})},2376:(e,t,r)=>{var n=r(2109),i=Math.asinh,a=Math.log,o=Math.sqrt;n({target:"Math",stat:!0,forced:!(i&&1/i(0)>0)},{asinh:function e(t){var r=+t;return isFinite(r)&&0!=r?r<0?-e(-r):a(r+o(r*r+1)):r}})},3181:(e,t,r)=>{var n=r(2109),i=Math.atanh,a=Math.log;n({target:"Math",stat:!0,forced:!(i&&1/i(-0)<0)},{atanh:function(e){var t=+e;return 0==t?t:a((1+t)/(1-t))/2}})},3484:(e,t,r)=>{var n=r(2109),i=r(4310),a=Math.abs,o=Math.pow;n({target:"Math",stat:!0},{cbrt:function(e){var t=+e;return i(t)*o(a(t),1/3)}})},8621:(e,t,r)=>{var n=r(2109),i=r(6736),a=Math.cosh,o=Math.abs,u=Math.E;n({target:"Math",stat:!0,forced:!a||a(710)===1/0},{cosh:function(e){var t=i(o(e)-1)+1;return(t+1/(t*u*u))*(u/2)}})},5890:(e,t,r)=>{var n=r(2109),i=r(6736);n({target:"Math",stat:!0,forced:i!=Math.expm1},{expm1:i})},658:(e,t,r)=>{r(2109)({target:"Math",stat:!0},{log10:r(403)})},197:(e,t,r)=>{r(2109)({target:"Math",stat:!0},{log1p:r(6513)})},4914:(e,t,r)=>{var n=r(2109),i=Math.log,a=Math.LN2;n({target:"Math",stat:!0},{log2:function(e){return i(e)/a}})},2420:(e,t,r)=>{r(2109)({target:"Math",stat:!0},{sign:r(4310)})},160:(e,t,r)=>{var n=r(2109),i=r(7293),a=r(6736),o=Math.abs,u=Math.exp,s=Math.E;n({target:"Math",stat:!0,forced:i((function(){return-2e-17!=Math.sinh(-2e-17)}))},{sinh:function(e){var t=+e;return o(t)<1?(a(t)-a(-t))/2:(u(t-1)-u(-t-1))*(s/2)}})},970:(e,t,r)=>{var n=r(2109),i=r(6736),a=Math.exp;n({target:"Math",stat:!0},{tanh:function(e){var t=+e,r=i(t),n=i(-t);return r==1/0?1:n==1/0?-1:(r-n)/(a(t)+a(-t))}})},9653:(e,t,r)=>{"use strict";var n=r(2109),i=r(1913),a=r(9781),o=r(7854),u=r(857),s=r(1702),c=r(4705),f=r(2597),l=r(9587),p=r(7976),m=r(2190),h=r(7593),d=r(7293),v=r(8006).f,y=r(1236).f,g=r(3070).f,x=r(863),b=r(3111).trim,w="Number",N=o[w],D=u[w],E=N.prototype,A=o.TypeError,S=s("".slice),C=s("".charCodeAt),M=c(w,!N(" 0o1")||!N("0b1")||N("+0x1")),F=function(e){var t,r=arguments.length<1?0:N(function(e){var t=h(e,"number");return"bigint"==typeof t?t:function(e){var t,r,n,i,a,o,u,s,c=h(e,"number");if(m(c))throw A("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=b(c),43===(t=C(c,0))||45===t){if(88===(r=C(c,2))||120===r)return NaN}else if(48===t){switch(C(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(o=(a=S(c,2)).length,u=0;ui)return NaN;return parseInt(a,n)}return+c}(t)}(e));return p(E,t=this)&&d((function(){x(t)}))?l(Object(r),this,F):r};F.prototype=E,M&&!i&&(E.constructor=F),n({global:!0,constructor:!0,wrap:!0,forced:M},{Number:F});var O=function(e,t){for(var r,n=a?v(t):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),i=0;n.length>i;i++)f(t,r=n[i])&&!f(e,r)&&g(e,r,y(t,r))};i&&D&&O(u[w],D),(M||i)&&O(u[w],N)},3299:(e,t,r)=>{r(2109)({target:"Number",stat:!0,nonConfigurable:!0,nonWritable:!0},{EPSILON:Math.pow(2,-52)})},4048:(e,t,r)=>{r(2109)({target:"Number",stat:!0},{isNaN:function(e){return e!=e}})},6977:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(9303),o=r(863),u=r(8415),s=r(7293),c=RangeError,f=String,l=Math.floor,p=i(u),m=i("".slice),h=i(1..toFixed),d=function(e,t,r){return 0===t?r:t%2==1?d(e,t-1,r*e):d(e*e,t/2,r)},v=function(e,t,r){for(var n=-1,i=r;++n<6;)i+=t*e[n],e[n]=i%1e7,i=l(i/1e7)},y=function(e,t){for(var r=6,n=0;--r>=0;)n+=e[r],e[r]=l(n/t),n=n%t*1e7},g=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var n=f(e[t]);r=""===r?n:r+p("0",7-n.length)+n}return r};n({target:"Number",proto:!0,forced:s((function(){return"0.000"!==h(8e-5,3)||"1"!==h(.9,0)||"1.25"!==h(1.255,2)||"1000000000000000128"!==h(0xde0b6b3a7640080,0)}))||!s((function(){h({})}))},{toFixed:function(e){var t,r,n,i,u=o(this),s=a(e),l=[0,0,0,0,0,0],h="",x="0";if(s<0||s>20)throw c("Incorrect fraction digits");if(u!=u)return"NaN";if(u<=-1e21||u>=1e21)return f(u);if(u<0&&(h="-",u=-u),u>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(u*d(2,69,1))-69)<0?u*d(2,-t,1):u/d(2,t,1),r*=4503599627370496,(t=52-t)>0){for(v(l,0,r),n=s;n>=7;)v(l,1e7,0),n-=7;for(v(l,d(10,n,1),0),n=t-1;n>=23;)y(l,1<<23),n-=23;y(l,1<0?h+((i=x.length)<=s?"0."+p("0",s-i)+x:m(x,0,i-s)+"."+m(x,i-s)):h+x}})},5147:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(7293),o=r(863),u=i(1..toPrecision);n({target:"Number",proto:!0,forced:a((function(){return"1"!==u(1,void 0)}))||!a((function(){u({})}))},{toPrecision:function(e){return void 0===e?u(o(this)):u(o(this),e)}})},8011:(e,t,r)=>{r(2109)({target:"Object",stat:!0,sham:!r(9781)},{create:r(30)})},3321:(e,t,r)=>{var n=r(2109),i=r(9781),a=r(6048).f;n({target:"Object",stat:!0,forced:Object.defineProperties!==a,sham:!i},{defineProperties:a})},9070:(e,t,r)=>{var n=r(2109),i=r(9781),a=r(3070).f;n({target:"Object",stat:!0,forced:Object.defineProperty!==a,sham:!i},{defineProperty:a})},5003:(e,t,r)=>{var n=r(2109),i=r(7293),a=r(5656),o=r(1236).f,u=r(9781);n({target:"Object",stat:!0,forced:!u||i((function(){o(1)})),sham:!u},{getOwnPropertyDescriptor:function(e,t){return o(a(e),t)}})},9337:(e,t,r)=>{var n=r(2109),i=r(9781),a=r(3887),o=r(5656),u=r(1236),s=r(6135);n({target:"Object",stat:!0,sham:!i},{getOwnPropertyDescriptors:function(e){for(var t,r,n=o(e),i=u.f,c=a(n),f={},l=0;c.length>l;)void 0!==(r=i(n,t=c[l++]))&&s(f,t,r);return f}})},9660:(e,t,r)=>{var n=r(2109),i=r(6293),a=r(7293),o=r(5181),u=r(7908);n({target:"Object",stat:!0,forced:!i||a((function(){o.f(1)}))},{getOwnPropertySymbols:function(e){var t=o.f;return t?t(u(e)):[]}})},489:(e,t,r)=>{var n=r(2109),i=r(7293),a=r(7908),o=r(9518),u=r(8544);n({target:"Object",stat:!0,forced:i((function(){o(1)})),sham:!u},{getPrototypeOf:function(e){return o(a(e))}})},7941:(e,t,r)=>{var n=r(2109),i=r(7908),a=r(1956);n({target:"Object",stat:!0,forced:r(7293)((function(){a(1)}))},{keys:function(e){return a(i(e))}})},1539:(e,t,r)=>{var n=r(1694),i=r(8052),a=r(288);n||i(Object.prototype,"toString",a,{unsafe:!0})},4678:(e,t,r)=>{var n=r(2109),i=r(2814);n({global:!0,forced:parseFloat!=i},{parseFloat:i})},1058:(e,t,r)=>{var n=r(2109),i=r(3009);n({global:!0,forced:parseInt!=i},{parseInt:i})},821:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(9662),o=r(8523),u=r(2534),s=r(408);n({target:"Promise",stat:!0,forced:r(612)},{all:function(e){var t=this,r=o.f(t),n=r.resolve,c=r.reject,f=u((function(){var r=a(t.resolve),o=[],u=0,f=1;s(e,(function(e){var a=u++,s=!1;f++,i(r,t,e).then((function(e){s||(s=!0,o[a]=e,--f||n(o))}),c)})),--f||n(o)}));return f.error&&c(f.value),r.promise}})},4164:(e,t,r)=>{"use strict";var n=r(2109),i=r(1913),a=r(3702).CONSTRUCTOR,o=r(2492),u=r(5005),s=r(614),c=r(8052),f=o&&o.prototype;if(n({target:"Promise",proto:!0,forced:a,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&s(o)){var l=u("Promise").prototype.catch;f.catch!==l&&c(f,"catch",l,{unsafe:!0})}},3401:(e,t,r)=>{"use strict";var n,i,a,o=r(2109),u=r(1913),s=r(5268),c=r(7854),f=r(6916),l=r(8052),p=r(7674),m=r(8003),h=r(6340),d=r(9662),v=r(614),y=r(111),g=r(5787),x=r(6707),b=r(261).set,w=r(5948),N=r(842),D=r(2534),E=r(8572),A=r(9909),S=r(2492),C=r(3702),M=r(8523),F="Promise",O=C.CONSTRUCTOR,T=C.REJECTION_EVENT,B=C.SUBCLASSING,_=A.getterFor(F),k=A.set,I=S&&S.prototype,R=S,z=I,q=c.TypeError,j=c.document,P=c.process,L=M.f,U=L,$=!!(j&&j.createEvent&&c.dispatchEvent),H="unhandledrejection",G=function(e){var t;return!(!y(e)||!v(t=e.then))&&t},V=function(e,t){var r,n,i,a=t.value,o=1==t.state,u=o?e.ok:e.fail,s=e.resolve,c=e.reject,l=e.domain;try{u?(o||(2===t.rejection&&X(t),t.rejection=1),!0===u?r=a:(l&&l.enter(),r=u(a),l&&(l.exit(),i=!0)),r===e.promise?c(q("Promise-chain cycle")):(n=G(r))?f(n,r,s,c):s(r)):c(a)}catch(e){l&&!i&&l.exit(),c(e)}},Z=function(e,t){e.notified||(e.notified=!0,w((function(){for(var r,n=e.reactions;r=n.get();)V(r,e);e.notified=!1,t&&!e.rejection&&Y(e)})))},W=function(e,t,r){var n,i;$?((n=j.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),c.dispatchEvent(n)):n={promise:t,reason:r},!T&&(i=c["on"+e])?i(n):e===H&&N("Unhandled promise rejection",r)},Y=function(e){f(b,c,(function(){var t,r=e.facade,n=e.value;if(J(e)&&(t=D((function(){s?P.emit("unhandledRejection",n,r):W(H,r,n)})),e.rejection=s||J(e)?2:1,t.error))throw t.value}))},J=function(e){return 1!==e.rejection&&!e.parent},X=function(e){f(b,c,(function(){var t=e.facade;s?P.emit("rejectionHandled",t):W("rejectionhandled",t,e.value)}))},Q=function(e,t,r){return function(n){e(t,n,r)}},K=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Z(e,!0))},ee=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw q("Promise can't be resolved itself");var n=G(t);n?w((function(){var r={done:!1};try{f(n,t,Q(ee,r,e),Q(K,r,e))}catch(t){K(r,t,e)}})):(e.value=t,e.state=1,Z(e,!1))}catch(t){K({done:!1},t,e)}}};if(O&&(z=(R=function(e){g(this,z),d(e),f(n,this);var t=_(this);try{e(Q(ee,t),Q(K,t))}catch(e){K(t,e)}}).prototype,(n=function(e){k(this,{type:F,done:!1,notified:!1,parent:!1,reactions:new E,rejection:!1,state:0,value:void 0})}).prototype=l(z,"then",(function(e,t){var r=_(this),n=L(x(this,R));return r.parent=!0,n.ok=!v(e)||e,n.fail=v(t)&&t,n.domain=s?P.domain:void 0,0==r.state?r.reactions.add(n):w((function(){V(n,r)})),n.promise})),i=function(){var e=new n,t=_(e);this.promise=e,this.resolve=Q(ee,t),this.reject=Q(K,t)},M.f=L=function(e){return e===R||void 0===e?new i(e):U(e)},!u&&v(S)&&I!==Object.prototype)){a=I.then,B||l(I,"then",(function(e,t){var r=this;return new R((function(e,t){f(a,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete I.constructor}catch(e){}p&&p(I,z)}o({global:!0,constructor:!0,wrap:!0,forced:O},{Promise:R}),m(R,F,!1,!0),h(F)},8674:(e,t,r)=>{r(3401),r(821),r(4164),r(6027),r(683),r(6294)},6027:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(9662),o=r(8523),u=r(2534),s=r(408);n({target:"Promise",stat:!0,forced:r(612)},{race:function(e){var t=this,r=o.f(t),n=r.reject,c=u((function(){var o=a(t.resolve);s(e,(function(e){i(o,t,e).then(r.resolve,n)}))}));return c.error&&n(c.value),r.promise}})},683:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916),a=r(8523);n({target:"Promise",stat:!0,forced:r(3702).CONSTRUCTOR},{reject:function(e){var t=a.f(this);return i(t.reject,void 0,e),t.promise}})},6294:(e,t,r)=>{"use strict";var n=r(2109),i=r(5005),a=r(1913),o=r(2492),u=r(3702).CONSTRUCTOR,s=r(9478),c=i("Promise"),f=a&&!u;n({target:"Promise",stat:!0,forced:a||u},{resolve:function(e){return s(f&&this===c?o:this,e)}})},2419:(e,t,r)=>{var n=r(2109),i=r(5005),a=r(2104),o=r(7065),u=r(9483),s=r(9670),c=r(111),f=r(30),l=r(7293),p=i("Reflect","construct"),m=Object.prototype,h=[].push,d=l((function(){function e(){}return!(p((function(){}),[],e)instanceof e)})),v=!l((function(){p((function(){}))})),y=d||v;n({target:"Reflect",stat:!0,forced:y,sham:y},{construct:function(e,t){u(e),s(t);var r=arguments.length<3?e:u(arguments[2]);if(v&&!d)return p(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return a(h,n,t),new(a(o,e,n))}var i=r.prototype,l=f(c(i)?i:m),y=a(e,l,t);return c(y)?y:l}})},1299:(e,t,r)=>{var n=r(2109),i=r(7854),a=r(8003);n({global:!0},{Reflect:{}}),a(i.Reflect,"Reflect",!0)},4603:(e,t,r)=>{var n=r(9781),i=r(7854),a=r(1702),o=r(4705),u=r(9587),s=r(8880),c=r(8006).f,f=r(7976),l=r(7850),p=r(1340),m=r(4706),h=r(2999),d=r(2626),v=r(8052),y=r(7293),g=r(2597),x=r(9909).enforce,b=r(6340),w=r(5112),N=r(9441),D=r(7168),E=w("match"),A=i.RegExp,S=A.prototype,C=i.SyntaxError,M=a(S.exec),F=a("".charAt),O=a("".replace),T=a("".indexOf),B=a("".slice),_=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,k=/a/g,I=/a/g,R=new A(k)!==k,z=h.MISSED_STICKY,q=h.UNSUPPORTED_Y;if(o("RegExp",n&&(!R||z||N||D||y((function(){return I[E]=!1,A(k)!=k||A(I)==I||"/a/i"!=A(k,"i")}))))){for(var j=function(e,t){var r,n,i,a,o,c,h=f(S,this),d=l(e),v=void 0===t,y=[],b=e;if(!h&&d&&v&&e.constructor===j)return e;if((d||f(S,e))&&(e=e.source,v&&(t=m(b))),e=void 0===e?"":p(e),t=void 0===t?"":p(t),b=e,N&&"dotAll"in k&&(n=!!t&&T(t,"s")>-1)&&(t=O(t,/s/g,"")),r=t,z&&"sticky"in k&&(i=!!t&&T(t,"y")>-1)&&q&&(t=O(t,/y/g,"")),D&&(a=function(e){for(var t,r=e.length,n=0,i="",a=[],o={},u=!1,s=!1,c=0,f="";n<=r;n++){if("\\"===(t=F(e,n)))t+=F(e,++n);else if("]"===t)u=!1;else if(!u)switch(!0){case"["===t:u=!0;break;case"("===t:M(_,B(e,n+1))&&(n+=2,s=!0),i+=t,c++;continue;case">"===t&&s:if(""===f||g(o,f))throw new C("Invalid capture group name");o[f]=!0,a[a.length]=[f,c],s=!1,f="";continue}s?f+=t:i+=t}return[i,a]}(e),e=a[0],y=a[1]),o=u(A(e,t),h?this:S,j),(n||i||y.length)&&(c=x(o),n&&(c.dotAll=!0,c.raw=j(function(e){for(var t,r=e.length,n=0,i="",a=!1;n<=r;n++)"\\"!==(t=F(e,n))?a||"."!==t?("["===t?a=!0:"]"===t&&(a=!1),i+=t):i+="[\\s\\S]":i+=t+F(e,++n);return i}(e),r)),i&&(c.sticky=!0),y.length&&(c.groups=y)),e!==b)try{s(o,"source",""===b?"(?:)":b)}catch(e){}return o},P=c(A),L=0;P.length>L;)d(j,A,P[L++]);S.constructor=j,j.prototype=S,v(i,"RegExp",j,{constructor:!0})}b("RegExp")},8450:(e,t,r)=>{var n=r(9781),i=r(9441),a=r(4326),o=r(7045),u=r(9909).get,s=RegExp.prototype,c=TypeError;n&&i&&o(s,"dotAll",{configurable:!0,get:function(){if(this!==s){if("RegExp"===a(this))return!!u(this).dotAll;throw c("Incompatible receiver, RegExp required")}}})},4916:(e,t,r)=>{"use strict";var n=r(2109),i=r(2261);n({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},8386:(e,t,r)=>{var n=r(9781),i=r(2999).MISSED_STICKY,a=r(4326),o=r(7045),u=r(9909).get,s=RegExp.prototype,c=TypeError;n&&i&&o(s,"sticky",{configurable:!0,get:function(){if(this!==s){if("RegExp"===a(this))return!!u(this).sticky;throw c("Incompatible receiver, RegExp required")}}})},7601:(e,t,r)=>{"use strict";r(4916);var n,i,a=r(2109),o=r(6916),u=r(614),s=r(9670),c=r(1340),f=(n=!1,(i=/[ac]/).exec=function(){return n=!0,/./.exec.apply(this,arguments)},!0===i.test("abc")&&n),l=/./.test;a({target:"RegExp",proto:!0,forced:!f},{test:function(e){var t=s(this),r=c(e),n=t.exec;if(!u(n))return o(l,t,r);var i=o(n,t,r);return null!==i&&(s(i),!0)}})},9714:(e,t,r)=>{"use strict";var n=r(6530).PROPER,i=r(8052),a=r(9670),o=r(1340),u=r(7293),s=r(4706),c="toString",f=RegExp.prototype[c],l=u((function(){return"/a/b"!=f.call({source:"a",flags:"b"})})),p=n&&f.name!=c;(l||p)&&i(RegExp.prototype,c,(function(){var e=a(this);return"/"+o(e.source)+"/"+o(s(e))}),{unsafe:!0})},7227:(e,t,r)=>{"use strict";r(7710)("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),r(5631))},189:(e,t,r)=>{r(7227)},2023:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(3929),o=r(4488),u=r(1340),s=r(4964),c=i("".indexOf);n({target:"String",proto:!0,forced:!s("includes")},{includes:function(e){return!!~c(u(o(this)),u(a(e)),arguments.length>1?arguments[1]:void 0)}})},8783:(e,t,r)=>{"use strict";var n=r(8710).charAt,i=r(1340),a=r(9909),o=r(1656),u=r(6178),s="String Iterator",c=a.set,f=a.getterFor(s);o(String,"String",(function(e){c(this,{type:s,string:i(e),index:0})}),(function(){var e,t=f(this),r=t.string,i=t.index;return i>=r.length?u(void 0,!0):(e=n(r,i),t.index+=e.length,u(e,!1))}))},4723:(e,t,r)=>{"use strict";var n=r(6916),i=r(7007),a=r(9670),o=r(8554),u=r(7466),s=r(1340),c=r(4488),f=r(8173),l=r(1530),p=r(7651);i("match",(function(e,t,r){return[function(t){var r=c(this),i=o(t)?void 0:f(t,e);return i?n(i,t,r):new RegExp(t)[e](s(r))},function(e){var n=a(this),i=s(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return p(n,i);var c=n.unicode;n.lastIndex=0;for(var f,m=[],h=0;null!==(f=p(n,i));){var d=s(f[0]);m[h]=d,""===d&&(n.lastIndex=l(i,u(n.lastIndex),c)),h++}return 0===h?null:m}]}))},2481:(e,t,r)=>{r(2109)({target:"String",proto:!0},{repeat:r(8415)})},5306:(e,t,r)=>{"use strict";var n=r(2104),i=r(6916),a=r(1702),o=r(7007),u=r(7293),s=r(9670),c=r(614),f=r(8554),l=r(9303),p=r(7466),m=r(1340),h=r(4488),d=r(1530),v=r(8173),y=r(647),g=r(7651),x=r(5112)("replace"),b=Math.max,w=Math.min,N=a([].concat),D=a([].push),E=a("".indexOf),A=a("".slice),S="$0"==="a".replace(/./,"$0"),C=!!/./[x]&&""===/./[x]("a","$0");o("replace",(function(e,t,r){var a=C?"$":"$0";return[function(e,r){var n=h(this),a=f(e)?void 0:v(e,x);return a?i(a,e,n,r):i(t,m(n),e,r)},function(e,i){var o=s(this),u=m(e);if("string"==typeof i&&-1===E(i,a)&&-1===E(i,"$<")){var f=r(t,o,u,i);if(f.done)return f.value}var h=c(i);h||(i=m(i));var v=o.global;if(v){var x=o.unicode;o.lastIndex=0}for(var S=[];;){var C=g(o,u);if(null===C)break;if(D(S,C),!v)break;""===m(C[0])&&(o.lastIndex=d(u,p(o.lastIndex),x))}for(var M,F="",O=0,T=0;T=O&&(F+=A(u,O,_)+q,O=_+B.length)}return F+A(u,O)}]}),!!u((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}))||!S||C)},86:(e,t,r)=>{"use strict";var n=r(2109),i=r(4230);n({target:"String",proto:!0,forced:r(3429)("sub")},{sub:function(){return i(this,"sub","","")}})},3650:(e,t,r)=>{"use strict";var n=r(2109),i=r(1702),a=r(4488),o=r(9303),u=r(1340),s=i("".slice),c=Math.max,f=Math.min;n({target:"String",proto:!0,forced:!"".substr||"b"!=="ab".substr(-1)},{substr:function(e,t){var r,n,i=u(a(this)),l=i.length,p=o(e);return p===1/0&&(p=0),p<0&&(p=c(l+p,0)),(r=void 0===t?l:o(t))<=0||r===1/0||p>=(n=f(p+r,l))?"":s(i,p,n)}})},3210:(e,t,r)=>{"use strict";var n=r(2109),i=r(3111).trim;n({target:"String",proto:!0,forced:r(6091)("trim")},{trim:function(){return i(this)}})},4032:(e,t,r)=>{"use strict";var n=r(2109),i=r(7854),a=r(6916),o=r(1702),u=r(1913),s=r(9781),c=r(6293),f=r(7293),l=r(2597),p=r(7976),m=r(9670),h=r(5656),d=r(4948),v=r(1340),y=r(9114),g=r(30),x=r(1956),b=r(8006),w=r(1156),N=r(5181),D=r(1236),E=r(3070),A=r(6048),S=r(5296),C=r(8052),M=r(7045),F=r(2309),O=r(6200),T=r(3501),B=r(9711),_=r(5112),k=r(6061),I=r(6800),R=r(6532),z=r(8003),q=r(9909),j=r(2092).forEach,P=O("hidden"),L="Symbol",U="prototype",$=q.set,H=q.getterFor(L),G=Object[U],V=i.Symbol,Z=V&&V[U],W=i.TypeError,Y=i.QObject,J=D.f,X=E.f,Q=w.f,K=S.f,ee=o([].push),te=F("symbols"),re=F("op-symbols"),ne=F("wks"),ie=!Y||!Y[U]||!Y[U].findChild,ae=s&&f((function(){return 7!=g(X({},"a",{get:function(){return X(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=J(G,t);n&&delete G[t],X(e,t,r),n&&e!==G&&X(G,t,n)}:X,oe=function(e,t){var r=te[e]=g(Z);return $(r,{type:L,tag:e,description:t}),s||(r.description=t),r},ue=function(e,t,r){e===G&&ue(re,t,r),m(e);var n=d(t);return m(r),l(te,n)?(r.enumerable?(l(e,P)&&e[P][n]&&(e[P][n]=!1),r=g(r,{enumerable:y(0,!1)})):(l(e,P)||X(e,P,y(1,{})),e[P][n]=!0),ae(e,n,r)):X(e,n,r)},se=function(e,t){m(e);var r=h(t),n=x(r).concat(pe(r));return j(n,(function(t){s&&!a(ce,r,t)||ue(e,t,r[t])})),e},ce=function(e){var t=d(e),r=a(K,this,t);return!(this===G&&l(te,t)&&!l(re,t))&&(!(r||!l(this,t)||!l(te,t)||l(this,P)&&this[P][t])||r)},fe=function(e,t){var r=h(e),n=d(t);if(r!==G||!l(te,n)||l(re,n)){var i=J(r,n);return!i||!l(te,n)||l(r,P)&&r[P][n]||(i.enumerable=!0),i}},le=function(e){var t=Q(h(e)),r=[];return j(t,(function(e){l(te,e)||l(T,e)||ee(r,e)})),r},pe=function(e){var t=e===G,r=Q(t?re:h(e)),n=[];return j(r,(function(e){!l(te,e)||t&&!l(G,e)||ee(n,te[e])})),n};c||(C(Z=(V=function(){if(p(Z,this))throw W("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?v(arguments[0]):void 0,t=B(e),r=function(e){this===G&&a(r,re,e),l(this,P)&&l(this[P],t)&&(this[P][t]=!1),ae(this,t,y(1,e))};return s&&ie&&ae(G,t,{configurable:!0,set:r}),oe(t,e)})[U],"toString",(function(){return H(this).tag})),C(V,"withoutSetter",(function(e){return oe(B(e),e)})),S.f=ce,E.f=ue,A.f=se,D.f=fe,b.f=w.f=le,N.f=pe,k.f=function(e){return oe(_(e),e)},s&&(M(Z,"description",{configurable:!0,get:function(){return H(this).description}}),u||C(G,"propertyIsEnumerable",ce,{unsafe:!0}))),n({global:!0,constructor:!0,wrap:!0,forced:!c,sham:!c},{Symbol:V}),j(x(ne),(function(e){I(e)})),n({target:L,stat:!0,forced:!c},{useSetter:function(){ie=!0},useSimple:function(){ie=!1}}),n({target:"Object",stat:!0,forced:!c,sham:!s},{create:function(e,t){return void 0===t?g(e):se(g(e),t)},defineProperty:ue,defineProperties:se,getOwnPropertyDescriptor:fe}),n({target:"Object",stat:!0,forced:!c},{getOwnPropertyNames:le}),R(),z(V,L),T[P]=!0},1817:(e,t,r)=>{"use strict";var n=r(2109),i=r(9781),a=r(7854),o=r(1702),u=r(2597),s=r(614),c=r(7976),f=r(1340),l=r(7045),p=r(9920),m=a.Symbol,h=m&&m.prototype;if(i&&s(m)&&(!("description"in h)||void 0!==m().description)){var d={},v=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:f(arguments[0]),t=c(h,this)?new m(e):void 0===e?m():m(e);return""===e&&(d[t]=!0),t};p(v,m),v.prototype=h,h.constructor=v;var y="Symbol(test)"==String(m("test")),g=o(h.valueOf),x=o(h.toString),b=/^Symbol\((.*)\)[^)]+$/,w=o("".replace),N=o("".slice);l(h,"description",{configurable:!0,get:function(){var e=g(this);if(u(d,e))return"";var t=x(e),r=y?N(t,7,-1):w(t,b,"$1");return""===r?void 0:r}}),n({global:!0,constructor:!0,forced:!0},{Symbol:v})}},763:(e,t,r)=>{var n=r(2109),i=r(5005),a=r(2597),o=r(1340),u=r(2309),s=r(2015),c=u("string-to-symbol-registry"),f=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!s},{for:function(e){var t=o(e);if(a(c,t))return c[t];var r=i("Symbol")(t);return c[t]=r,f[r]=t,r}})},2165:(e,t,r)=>{r(6800)("iterator")},2526:(e,t,r)=>{r(4032),r(763),r(6620),r(8862),r(9660)},6620:(e,t,r)=>{var n=r(2109),i=r(2597),a=r(2190),o=r(6330),u=r(2309),s=r(2015),c=u("symbol-to-string-registry");n({target:"Symbol",stat:!0,forced:!s},{keyFor:function(e){if(!a(e))throw TypeError(o(e)+" is not a symbol");if(i(c,e))return c[e]}})},4747:(e,t,r)=>{var n=r(7854),i=r(8324),a=r(8509),o=r(8533),u=r(8880),s=function(e){if(e&&e.forEach!==o)try{u(e,"forEach",o)}catch(t){e.forEach=o}};for(var c in i)i[c]&&s(n[c]&&n[c].prototype);s(a)},3948:(e,t,r)=>{var n=r(7854),i=r(8324),a=r(8509),o=r(6992),u=r(8880),s=r(5112),c=s("iterator"),f=s("toStringTag"),l=o.values,p=function(e,t){if(e){if(e[c]!==l)try{u(e,c,l)}catch(t){e[c]=l}if(e[f]||u(e,f,t),i[t])for(var r in o)if(e[r]!==o[r])try{u(e,r,o[r])}catch(t){e[r]=o[r]}}};for(var m in i)p(n[m]&&n[m].prototype,m);p(a,"DOMTokenList")},3753:(e,t,r)=>{"use strict";var n=r(2109),i=r(6916);n({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return i(URL.prototype.toString,this)}})},7928:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},o=a.preserveFormatting,u=void 0!==o&&o,s=a.escapeMapFn,c=void 0===s?i:s,f=String(e),l="",p=c(t({},r),u?t({},n):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,r){e||f.length>=t.length&&f.slice(0,t.length)===t&&(l+=p[m[r]],f=f.slice(t.length,f.length),e=!0)})),e||(l+=f.slice(0,1),f=f.slice(1,f.length))};f;)h();return l}},5628:function(e,t){var r;!function(n){"use strict";var i={s:1,n:0,d:1};function a(e,t){if(isNaN(e=parseInt(e,10)))throw f.InvalidParameter;return e*t}function o(e,t){if(0===t)throw f.DivisionByZero;var r=Object.create(f.prototype);r.s=e<0?-1:1;var n=c(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function u(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var s=function(e,t){var r,n=0,o=1,u=1,s=0,c=0,l=0,p=1,m=1,h=0,d=1,v=1,y=1,g=1e7;if(null==e);else if(void 0!==t){if(u=(n=e)*(o=t),n%1!=0||o%1!=0)throw f.NonIntegerParameter}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,o=e.d,"s"in e&&(n*=e.s);else{if(!(0 in e))throw f.InvalidParameter;n=e[0],1 in e&&(o=e[1])}u=n*o;break;case"number":if(e<0&&(u=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(e/=m=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));d<=g&&y<=g;){if(e===(r=(h+v)/(d+y))){d+y<=g?(n=h+v,o=d+y):y>d?(n=v,o=y):(n=h,o=d);break}e>r?(h+=v,d+=y):(v+=h,y+=d),d>g?(n=v,o=y):(n=h,o=d)}n*=m}else(isNaN(e)||isNaN(t))&&(o=n=NaN);break;case"string":if(null===(d=e.match(/\d+|./g)))throw f.InvalidParameter;if("-"===d[h]?(u=-1,h++):"+"===d[h]&&h++,d.length===h+1?c=a(d[h++],u):"."===d[h+1]||"."===d[h]?("."!==d[h]&&(s=a(d[h++],u)),(1+ ++h===d.length||"("===d[h+1]&&")"===d[h+3]||"'"===d[h+1]&&"'"===d[h+3])&&(c=a(d[h],u),p=Math.pow(10,d[h].length),h++),("("===d[h]&&")"===d[h+2]||"'"===d[h]&&"'"===d[h+2])&&(l=a(d[h+1],u),m=Math.pow(10,d[h+1].length)-1,h+=3)):"/"===d[h+1]||":"===d[h+1]?(c=a(d[h],u),p=a(d[h+2],1),h+=3):"/"===d[h+3]&&" "===d[h+1]&&(s=a(d[h],u),c=a(d[h+2],u),p=a(d[h+4],1),h+=5),d.length<=h){u=n=l+(o=p*m)*s+m*c;break}default:throw f.InvalidParameter}if(0===o)throw f.DivisionByZero;i.s=u<0?-1:1,i.n=Math.abs(n),i.d=Math.abs(o)};function c(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function f(e,t){if(s(e,t),!(this instanceof f))return o(i.s*i.n,i.d);e=c(i.d,i.n),this.s=i.s,this.n=i.n/e,this.d=i.d/e}f.DivisionByZero=new Error("Division by Zero"),f.InvalidParameter=new Error("Invalid argument"),f.NonIntegerParameter=new Error("Parameters must be integer"),f.prototype={s:1,n:0,d:1,abs:function(){return o(this.n,this.d)},neg:function(){return o(-this.s*this.n,this.d)},add:function(e,t){return s(e,t),o(this.s*this.n*i.d+i.s*this.d*i.n,this.d*i.d)},sub:function(e,t){return s(e,t),o(this.s*this.n*i.d-i.s*this.d*i.n,this.d*i.d)},mul:function(e,t){return s(e,t),o(this.s*i.s*this.n*i.n,this.d*i.d)},div:function(e,t){return s(e,t),o(this.s*i.s*this.n*i.d,this.d*i.n)},clone:function(){return o(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new f(NaN);if(void 0===e)return o(this.s*this.n%this.d,1);if(s(e,t),0===i.n&&0===this.d)throw f.DivisionByZero;return o(this.s*(i.d*this.n)%(i.n*this.d),i.d*this.d)},gcd:function(e,t){return s(e,t),o(c(i.n,this.n)*c(i.d,this.d),i.d*this.d)},lcm:function(e,t){return s(e,t),0===i.n&&0===this.n?o(0,1):o(i.n*this.n,c(i.n,this.n)*c(i.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):o(Math.ceil(e*this.s*this.n/this.d),e)},floor:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):o(Math.floor(e*this.s*this.n/this.d),e)},round:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new f(NaN):o(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return o(this.s*this.d,this.n)},pow:function(e,t){if(s(e,t),1===i.d)return i.s<0?o(Math.pow(this.s*this.d,i.n),Math.pow(this.n,i.n)):o(Math.pow(this.s*this.n,i.n),Math.pow(this.d,i.n));if(this.s<0)return null;var r=u(this.n),n=u(this.d),a=1,c=1;for(var f in r)if("1"!==f){if("0"===f){a=0;break}if(r[f]*=i.n,r[f]%i.d!=0)return null;r[f]/=i.d,a*=Math.pow(f,r[f])}for(var f in n)if("1"!==f){if(n[f]*=i.n,n[f]%i.d!=0)return null;n[f]/=i.d,c*=Math.pow(f,n[f])}return i.s<0?o(c,a):o(a,c)},equals:function(e,t){return s(e,t),this.s*this.n*i.d==i.s*i.n*this.d},compare:function(e,t){s(e,t);var r=this.s*this.n*i.d-i.s*i.n*this.d;return(0=0;a--)i=i.inverse().add(r[a]);if(i.sub(t).abs().valueOf()0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do{n.push(Math.floor(t/r)),e=t%r,t=r,r=e}while(1!==t);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>2e3)return 0;return n}(0,r),i=function(e,t,r){for(var n=1,i=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,r,t),a=0;a<300;a++){if(n===i)return a;n=10*n%t,i=10*i%t}return 0}(0,r,n),a=this.s<0?"-":"";if(a+=t/r|0,t%=r,(t*=10)&&(a+="."),n){for(var o=i;o--;)a+=t/r|0,t%=r,t*=10;for(a+="(",o=n;o--;)a+=t/r|0,t%=r,t*=10;a+=")"}else for(o=e;t&&o--;)a+=t/r|0,t%=r,t*=10;return a}},void 0===(r=function(){return f}.apply(t,[]))||(e.exports=r)}()},3228:e=>{e.exports=function e(t,r){"use strict";var n,i,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,u=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,s=/^0x[0-9a-f]+$/i,c=/^0/,f=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},l=f(t).replace(o,"")||"",p=f(r).replace(o,"")||"",m=l.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(l.match(s),16)||1!==m.length&&l.match(u)&&Date.parse(l),v=parseInt(p.match(s),16)||d&&p.match(u)&&Date.parse(p)||null;if(v){if(dv)return 1}for(var y=0,g=Math.max(m.length,h.length);yi)return 1}return 0}},6377:(e,t,r)=>{var n=r(4832),i=r(8652),a=r(801),o=r(2030),u=r(3618),s=r(9049),c=r(1971);c.alea=n,c.xor128=i,c.xorwow=a,c.xorshift7=o,c.xor4096=u,c.tychei=s,e.exports=c},4832:function(e,t,r){var n;!function(e,i,a){function o(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function u(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 r=new o(e),n=t&&t.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.alea=s}(0,e=r.nmd(e),r.amdD)},9049:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,i=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>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):r+=e;for(var n=0;n>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.tychei=s}(0,e=r.nmd(e),r.amdD)},8652:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";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:r+=e;for(var n=0;n>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor128=s}(0,e=r.nmd(e),r.amdD)},3618:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.w,i=t.X,a=t.i;return t.w=n=n+1640531527|0,r=i[a+34&127],e=i[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=i[a]=r^e,t.i=a,r+(n^n>>>16)|0},function(e,t){var r,n,i,a,o,u=[],s=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,s=Math.max(s,t.length)),i=0,a=-32;a>>15,n^=n<<4,n^=n>>>13,a>=0&&(o=o+1640531527|0,i=0==(r=u[127&a]^=n+o)?i+1:0);for(i>=128&&(u[127&(t&&t.length||0)]=-1),i=127,a=512;a>0;--a)n=u[i+34&127],r=u[i=i+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,u[i]=n^r;e.w=o,e.X=u,e.i=i}(t,e)}function u(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 r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.X&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor4096=s}(0,e=r.nmd(e),r.amdD)},2030:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this;t.next=function(){var e,r,n=t.x,i=t.i;return e=n[i],r=(e^=e>>>7)^e<<24,r^=(e=n[i+1&7])^e>>>10,r^=(e=n[i+3&7])^e>>>3,r^=(e=n[i+4&7])^e<<7,e=n[i+7&7],r^=(e^=e<<13)^e<<9,n[i]=r,t.i=i+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r0;--r)e.next()}(t,e)}function u(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.x&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorshift7=s}(0,e=r.nmd(e),r.amdD)},801:function(e,t,r){var n;!function(e,i,a){function o(e){var t=this,r="";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:r+=e;for(var n=0;n>>4),t.next()}function u(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 r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&u(n,r),i.state=function(){return u(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorwow=s}(0,e=r.nmd(e),r.amdD)},1971:function(e,t,r){var n;!function(i,a,o){var u,s=256,c=o.pow(s,6),f=o.pow(2,52),l=2*f,p=s-1;function m(e,t,r){var n=[],p=y(v((t=1==t?{entropy:!0}:t||{}).entropy?[e,g(a)]:null==e?function(){try{var e;return u&&(e=u.randomBytes)?e=e(s):(e=new Uint8Array(s),(i.crypto||i.msCrypto).getRandomValues(e)),g(e)}catch(e){var t=i.navigator,r=t&&t.plugins;return[+new Date,i,r,i.screen,g(a)]}}():e,3),n),m=new h(n),x=function(){for(var e=m.g(6),t=c,r=0;e=l;)e/=2,t/=2,r>>>=1;return(e+r)/t};return x.int32=function(){return 0|m.g(4)},x.quick=function(){return m.g(4)/4294967296},x.double=x,y(g(m.S),a),(t.pass||r||function(e,t,r,n){return n&&(n.S&&d(n,m),e.state=function(){return d(m,{})}),r?(o.random=e,t):e})(x,p,"global"in t?t.global:this==o,t.state)}function h(e){var t,r=e.length,n=this,i=0,a=n.i=n.j=0,o=n.S=[];for(r||(e=[r++]);i{function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n{},7061:(e,t,r)=>{var n=r(8698).default;function i(){"use strict";e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,a=r.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},s=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var i=t&&t.prototype instanceof d?t:d,a=Object.create(i.prototype),u=new M(n||[]);return o(a,"_invoke",{value:E(e,r,u)}),a}function m(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var h={};function d(){}function v(){}function y(){}var g={};l(g,s,(function(){return this}));var x=Object.getPrototypeOf,b=x&&x(x(F([])));b&&b!==r&&a.call(b,s)&&(g=b);var w=y.prototype=d.prototype=Object.create(g);function N(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function D(e,t){function r(i,o,u,s){var c=m(e[i],e,o);if("throw"!==c.type){var f=c.arg,l=f.value;return l&&"object"==n(l)&&a.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,u,s)}),(function(e){r("throw",e,u,s)})):t.resolve(l).then((function(e){f.value=e,u(f)}),(function(e){return r("throw",e,u,s)}))}s(c.arg)}var i;o(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(a,a):a()}})}function E(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var u=A(o,r);if(u){if(u===h)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=m(e,t,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function A(e,t){var r=t.method,n=e.iterator[r];if(void 0===n)return t.delegate=null,"throw"===r&&e.iterator.return&&(t.method="return",t.arg=void 0,A(e,t),"throw"===t.method)||"return"!==r&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=m(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,h;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function F(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),s=a.call(i,"finallyLoc");if(u&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;C(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:F(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},8698:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},4687:(e,t,r)=>{var n=r(7061)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},4814:function(e){e.exports=function(){"use strict";function e(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var i=0,a=function(){};return{s:a,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,o=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw o}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:"any",r=t?h(t).index:c.length,n=[],i=0;i1&&void 0!==arguments[1]?arguments[1]:",";return e.map((function(e){return e.name})).join(t)}function w(e){var t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map((function(e){return h(e.trim())})),n=!1,i=t?"...":"";return{types:r.map((function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}function N(t){var r=function(t){if(0===t.length)return[];var r=t.map(h);t.length>1&&r.sort((function(e,t){return e.index-t.index}));var n=r[0].conversionsTo;if(1===t.length)return n;n=n.concat([]);for(var i=new Set(t),a=1;a0,restParam:t.restParam}}function D(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((function(t){return e.typeSet.add(t.name)}))),e.typeSet}function E(e){var t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");var r=e.trim();if(""===r)return t;for(var n=r.split(","),i=0;i=i+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=S(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=S(e[0]),n=S(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(S),function(e){for(var r=0;r0){var r=y(t[o]);return(i=new TypeError("Unexpected type of argument in function "+u+" (expected: "+a.join(" or ")+", actual: "+r.join(" | ")+", index: "+o+")")).data={category:"wrongType",fn:u,index:o,actual:r,expected:a},{v:i}}}else s=e};for(o=0;op)return(i=new TypeError("Too many arguments in function "+u+" (expected: "+p+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:u,index:t.length,expectedLength:p},i;for(var m=[],h=0;h0)return 1;var n=k(e)-k(t);return n<0?-1:n>0?1:0}function R(t,r){var n=t.params,i=r.params,a=G(n),o=G(i),u=A(n),s=A(i);if(u&&a.hasAny){if(!s||!o.hasAny)return 1}else if(s&&o.hasAny)return-1;var c,f,l=0,p=0,m=e(n);try{for(m.s();!(f=m.n()).done;)(c=f.value).hasAny&&++l,c.hasConversion&&++p}catch(e){m.e(e)}finally{m.f()}var h,d=0,v=0,y=e(i);try{for(y.s();!(h=y.n()).done;)(c=h.value).hasAny&&++d,c.hasConversion&&++v}catch(e){y.e(e)}finally{y.f()}if(l!==d)return l-d;if(u&&a.hasConversion){if(!s||!o.hasConversion)return 1}else if(s&&o.hasConversion)return-1;if(p!==v)return p-v;if(u){if(!s)return 1}else if(s)return-1;var g=(n.length-i.length)*(u?-1:1);if(0!==g)return g;for(var x,b=[],w=0,N=0;N=f:m?f>=l:f===l}(r,t))throw new TypeError('Conflicting signatures "'+b(r)+'" and "'+b(t)+'".')})),o.push(t);var i=u.length;u.push(r[n]);var a,f=void 0,l=e(j(t.map(N)));try{for(l.s();!(a=l.n()).done;){var p=b(f=a.value);c.push({params:f,name:p,fn:i}),f.every((function(e){return!e.hasConversion}))&&(s[p]=i)}}catch(e){l.e(e)}finally{l.f()}};for(n in r)f();c.sort(R);var l,p=L(u,s,me);for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&(s[l]=p[s[l]]);for(var h=[],d=new Map,v=0,y=c;v{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};return(()=>{"use strict";r.d(n,{default:()=>_y});var e={};function t(e){return t="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},t(e)}function i(e){return"number"==typeof e}function a(e){return!(!e||"object"!==t(e)||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"===t(e.constructor.prototype)&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function o(e){return e&&"object"===t(e)&&!0===Object.getPrototypeOf(e).isComplex||!1}function u(e){return e&&"object"===t(e)&&!0===Object.getPrototypeOf(e).isFraction||!1}function s(e){return e&&!0===e.constructor.prototype.isUnit||!1}function c(e){return"string"==typeof e}r.r(e),r.d(e,{createAbs:()=>ta,createAccessorNode:()=>fp,createAcos:()=>Nf,createAcosh:()=>Lf,createAcot:()=>$f,createAcoth:()=>Gf,createAcsc:()=>Zf,createAcsch:()=>Yf,createAdd:()=>Vl,createAddScalar:()=>oa,createAnd:()=>yc,createApply:()=>na,createApplyTransform:()=>ry,createArg:()=>Zo,createArrayNode:()=>pp,createAsec:()=>Xf,createAsech:()=>Kf,createAsin:()=>tl,createAsinh:()=>rl,createAssignmentNode:()=>bp,createAtan:()=>nl,createAtan2:()=>al,createAtanh:()=>ul,createAtomicMass:()=>_v,createAvogadro:()=>kv,createBellNumbers:()=>id,createBigNumberClass:()=>Ir,createBignumber:()=>hi,createBin:()=>Fs,createBitAnd:()=>jo,createBitNot:()=>Lo,createBitOr:()=>$o,createBitXor:()=>Vo,createBlockNode:()=>Np,createBohrMagneton:()=>mv,createBohrRadius:()=>xv,createBoltzmann:()=>Iv,createBoolean:()=>mi,createCatalan:()=>od,createCbrt:()=>sa,createCeil:()=>ga,createChain:()=>zm,createChainClass:()=>Om,createClassicalElectronRadius:()=>bv,createClone:()=>Fn,createColumn:()=>fu,createColumnTransform:()=>ny,createCombinations:()=>wh,createCombinationsWithRep:()=>Eh,createCompare:()=>xc,createCompareNatural:()=>Dc,createCompareText:()=>Sc,createCompile:()=>nm,createComplex:()=>di,createComplexClass:()=>zr,createComposition:()=>sd,createConcat:()=>uu,createConcatTransform:()=>gy,createConditionalNode:()=>Ep,createConductanceQuantum:()=>hv,createConj:()=>Yo,createConstantNode:()=>_p,createCos:()=>cl,createCosh:()=>ll,createCot:()=>pl,createCoth:()=>hl,createCoulomb:()=>lv,createCount:()=>pu,createCreateUnit:()=>bf,createCross:()=>hu,createCsc:()=>dl,createCsch:()=>yl,createCtranspose:()=>ss,createCube:()=>ba,createCumSum:()=>uh,createCumSumTransform:()=>Ey,createDeepEqual:()=>Gc,createDenseMatrixClass:()=>Cn,createDerivative:()=>Sd,createDet:()=>qm,createDeuteronMass:()=>Sv,createDiag:()=>vu,createDiff:()=>ku,createDiffTransform:()=>by,createDistance:()=>nh,createDivide:()=>th,createDivideScalar:()=>Ps,createDot:()=>Xl,createDotDivide:()=>Ks,createDotMultiply:()=>wo,createDotPow:()=>Xs,createE:()=>Gd,createEfimovFactor:()=>Bv,createEigs:()=>Hm,createElectricConstant:()=>cv,createElectronMass:()=>wv,createElementaryCharge:()=>pv,createEqual:()=>Mc,createEqualScalar:()=>ui,createEqualText:()=>Tc,createErf:()=>vs,createEvaluate:()=>am,createExp:()=>wa,createExpm:()=>Vm,createExpm1:()=>Da,createFactorial:()=>zh,createFalse:()=>jd,createFaraday:()=>Rv,createFermiCoupling:()=>Nv,createFft:()=>ls,createFibonacciHeapClass:()=>nf,createFilter:()=>gu,createFilterTransform:()=>ay,createFineStructure:()=>Dv,createFirstRadiation:()=>zv,createFix:()=>Ca,createFlatten:()=>wu,createFloor:()=>Ta,createForEach:()=>Du,createForEachTransform:()=>uy,createFormat:()=>Ms,createFraction:()=>vi,createFractionClass:()=>jr,createFreqz:()=>Bd,createFunctionAssignmentNode:()=>Rp,createFunctionNode:()=>Kp,createGamma:()=>_h,createGasConstant:()=>jv,createGcd:()=>Ga,createGetMatrixDataType:()=>Su,createGravitationConstant:()=>av,createGravity:()=>Wv,createHartreeEnergy:()=>Ev,createHasNumericValue:()=>Yn,createHelp:()=>Im,createHelpClass:()=>Fm,createHex:()=>Ts,createHypot:()=>Wl,createI:()=>Kd,createIdentity:()=>Mu,createIfft:()=>ms,createIm:()=>Jo,createImmutableDenseMatrixClass:()=>tf,createIndex:()=>ep,createIndexClass:()=>rf,createIndexNode:()=>qp,createIndexTransform:()=>sy,createInfinity:()=>Ld,createIntersect:()=>ih,createInv:()=>jm,createInverseConductanceQuantum:()=>dv,createInvmod:()=>go,createIsInteger:()=>qn,createIsNaN:()=>ti,createIsNegative:()=>Gn,createIsNumeric:()=>Zn,createIsPositive:()=>Xn,createIsPrime:()=>zs,createIsZero:()=>Kn,createKldivergence:()=>jh,createKlitzing:()=>gv,createKron:()=>Ou,createLN10:()=>Wd,createLN2:()=>Zd,createLOG10E:()=>Jd,createLOG2E:()=>Yd,createLarger:()=>jc,createLargerEq:()=>Uc,createLcm:()=>Wa,createLeafCount:()=>fd,createLeftShift:()=>pc,createLgamma:()=>Ih,createLog:()=>Gs,createLog10:()=>Ja,createLog1p:()=>Zs,createLog2:()=>Qa,createLoschmidt:()=>qv,createLsolve:()=>rc,createLsolveAll:()=>oc,createLup:()=>cm,createLusolve:()=>Sm,createLyap:()=>eh,createMad:()=>ph,createMagneticConstant:()=>sv,createMagneticFluxQuantum:()=>vv,createMap:()=>Tu,createMapTransform:()=>cy,createMatrix:()=>gi,createMatrixClass:()=>Lr,createMatrixFromColumns:()=>Si,createMatrixFromFunction:()=>bi,createMatrixFromRows:()=>Di,createMax:()=>Kc,createMaxTransform:()=>py,createMean:()=>ch,createMeanTransform:()=>my,createMedian:()=>lh,createMin:()=>ef,createMinTransform:()=>hy,createMod:()=>to,createMode:()=>Ds,createMolarMass:()=>Vv,createMolarMassC12:()=>Zv,createMolarPlanckConstant:()=>Pv,createMolarVolume:()=>Lv,createMultinomial:()=>Lh,createMultiply:()=>io,createMultiplyScalar:()=>ro,createNaN:()=>Ud,createNeutronMass:()=>Cv,createNode:()=>rp,createNorm:()=>Jl,createNot:()=>nu,createNthRoot:()=>oo,createNthRoots:()=>Ys,createNuclearMagneton:()=>yv,createNull:()=>Pd,createNumber:()=>ci,createNumeric:()=>qs,createObjectNode:()=>Pp,createOct:()=>Os,createOnes:()=>Iu,createOperatorNode:()=>Up,createOr:()=>iu,createParenthesisNode:()=>Hp,createParse:()=>tm,createParser:()=>sm,createParserClass:()=>om,createPartitionSelect:()=>Jc,createPermutations:()=>$h,createPhi:()=>Vd,createPi:()=>$d,createPickRandom:()=>Yh,createPinv:()=>Lm,createPlanckCharge:()=>Qv,createPlanckConstant:()=>ov,createPlanckLength:()=>Yv,createPlanckMass:()=>Jv,createPlanckTemperature:()=>Kv,createPlanckTime:()=>Xv,createPolynomialRoot:()=>Mm,createPow:()=>Ls,createPrint:()=>_s,createProd:()=>Ss,createProtonMass:()=>Av,createQr:()=>fm,createQuantileSeq:()=>vh,createQuantumOfCirculation:()=>Mv,createRandom:()=>Qh,createRandomInt:()=>ed,createRange:()=>Pu,createRangeClass:()=>Pr,createRangeNode:()=>Vp,createRangeTransform:()=>dy,createRationalize:()=>Md,createRe:()=>Xo,createReducedPlanckConstant:()=>uv,createRelationalNode:()=>Wp,createReplacer:()=>kd,createReshape:()=>Uu,createResize:()=>$u,createResolve:()=>Nd,createResultSet:()=>Qe,createReviver:()=>_d,createRightArithShift:()=>hc,createRightLogShift:()=>vc,createRotate:()=>Gu,createRotationMatrix:()=>Zu,createRound:()=>Hs,createRow:()=>Wu,createRowTransform:()=>vy,createRydberg:()=>Fv,createSQRT1_2:()=>Xd,createSQRT2:()=>Qd,createSackurTetrode:()=>Uv,createSchur:()=>Qm,createSec:()=>gl,createSech:()=>bl,createSecondRadiation:()=>$v,createSetCartesian:()=>Cl,createSetDifference:()=>Fl,createSetDistinct:()=>Tl,createSetIntersect:()=>_l,createSetIsSubset:()=>Il,createSetMultiplicity:()=>zl,createSetPowerset:()=>jl,createSetSize:()=>Ll,createSetSymDifference:()=>$l,createSetUnion:()=>Gl,createSign:()=>so,createSimplify:()=>vd,createSimplifyConstant:()=>xd,createSimplifyCore:()=>wd,createSin:()=>wl,createSinh:()=>Dl,createSize:()=>Ju,createSlu:()=>Dm,createSmaller:()=>_c,createSmallerEq:()=>Rc,createSolveODE:()=>ds,createSort:()=>Qc,createSpaClass:()=>af,createSparse:()=>gf,createSparseMatrixClass:()=>si,createSpeedOfLight:()=>iv,createSplitUnit:()=>Mi,createSqrt:()=>co,createSqrtm:()=>Wm,createSquare:()=>lo,createSqueeze:()=>Qu,createStd:()=>yh,createStdTransform:()=>wy,createStefanBoltzmann:()=>Hv,createStirlingS2:()=>rd,createString:()=>li,createSubset:()=>es,createSubsetTransform:()=>yy,createSubtract:()=>mo,createSum:()=>ah,createSumTransform:()=>Ny,createSylvester:()=>Jm,createSymbolNode:()=>Yp,createSymbolicEqual:()=>Ed,createTan:()=>El,createTanh:()=>Al,createTau:()=>Hd,createThomsonCrossSection:()=>Ov,createTo:()=>Is,createTrace:()=>Ql,createTranspose:()=>os,createTrue:()=>qd,createTypeOf:()=>ni,createTyped:()=>Ve,createUnaryMinus:()=>Qi,createUnaryPlus:()=>ea,createUnequal:()=>Zc,createUnitClass:()=>hf,createUnitFunction:()=>vf,createUppercaseE:()=>tv,createUppercasePi:()=>ev,createUsolve:()=>ic,createUsolveAll:()=>sc,createVacuumImpedance:()=>fv,createVariance:()=>dh,createVarianceTransform:()=>Sy,createVersion:()=>rv,createWeakMixingAngle:()=>Tv,createWienDisplacement:()=>Gv,createXgcd:()=>vo,createXor:()=>au,createZeros:()=>fs,createZpk2tf:()=>Od}),r(4916),r(7601),r(9653),r(6699),r(5212),r(1539),r(2023),r(489),r(9753),r(3710),r(4603),r(8450),r(8386),r(9714),r(8309);var f=Array.isArray;function l(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function p(e){return Array.isArray(e)||l(e)}function m(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function h(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function d(e){return e&&!0===e.constructor.prototype.isRange||!1}function v(e){return e&&!0===e.constructor.prototype.isIndex||!1}function y(e){return"boolean"==typeof e}function g(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function x(e){return e&&!0===e.constructor.prototype.isHelp||!1}function b(e){return"function"==typeof e}function w(e){return e instanceof Date}function N(e){return e instanceof RegExp}function D(e){return!(!e||"object"!==t(e)||e.constructor!==Object||o(e)||u(e))}function E(e){return null===e}function A(e){return void 0===e}function S(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function C(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function M(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function O(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function B(e){return T(e)||q(e)&&1===e.args.length&&T(e.args[0])&&"-+~".includes(e.op)}function _(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function k(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function I(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function R(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function z(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function q(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function j(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function U(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.constructor.prototype.isChain||!1}function H(e){var r=t(e);return"object"===r?null===e?"null":a(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}var G=r(4814);function V(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}r(2420),r(4914),r(658),r(197),r(3484),r(5890),r(2222),r(5306),r(4723),r(4678),r(2772),r(1249),r(1058),r(9600),r(7042),r(561),r(3299),r(9752),r(2376),r(3181),r(8621),r(160),r(970);var Z=Math.sign||function(e){return e>0?1:e<0?-1:0},W=Math.log2||function(e){return Math.log(e)/Math.LN2},Y=Math.log10||function(e){return Math.log(e)/Math.LN10},J=Math.log1p||function(e){return Math.log(e+1)},X=Math.cbrt||function(e){if(0===e)return e;var t,r=e<0;return r&&(e=-e),t=isFinite(e)?(e/((t=Math.exp(Math.log(e)/3))*t)+2*t)/3:e,r?-t:t},Q=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function K(e,t,r){var n={2:"0b",8:"0o",16:"0x"}[t],i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!V(r))throw new Error("size must be an integer");if(e>Math.pow(2,r-1)-1||e<-Math.pow(2,r-1))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!V(e))throw new Error("Value must be an integer");e<0&&(e+=Math.pow(2,r)),i="i".concat(r)}var a="";return e<0&&(e=-e,a="-"),"".concat(a).concat(n).concat(e.toString(t)).concat(i)}function ee(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";var r,n,a="auto";if(t&&(t.notation&&(a=t.notation),i(t)?r=t:i(t.precision)&&(r=t.precision),t.wordSize&&"number"!=typeof(n=t.wordSize)))throw new Error('Option "wordSize" must be a number');switch(a){case"fixed":return re(e,r);case"exponential":return ne(e,r);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=ie(te(e),t),n=r.exponent,a=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(i(t))for(;t>a.length||n-o+1>a.length;)a.push(0);else for(var u=Math.abs(n-o)-(a.length-1),s=0;s0;)f++,c--;var l=a.slice(f).join(""),p=i(t)&&l.length||l.match(/[1-9]/)?"."+l:"",m=a.slice(0,f).join("")+p+"e"+(n>=0?"+":"")+o.toString();return r.sign+m}(e,r);case"bin":return K(e,2,n);case"oct":return K(e,8,n);case"hex":return K(e,16,n);case"auto":return function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var n=r&&void 0!==r.lowerExp?r.lowerExp:-3,i=r&&void 0!==r.upperExp?r.upperExp:5,a=te(e),o=t?ie(a,t):a;if(o.exponent=i)return ne(e,t);var u=o.coefficients,s=o.exponent;u.length0?s:0;return c<(u=ae(-s).concat(u)).length-1&&u.splice(c+1,0,"."),o.sign+u.join("")}(e,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,(function(){var e=arguments[2],t=arguments[4];return"."!==e?e+t:t}));default:throw new Error('Unknown notation "'+a+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function te(e){var t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);var r=t[1],n=t[2],i=parseFloat(t[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===o.length&&(o.push(0),i++),{sign:r,coefficients:o,exponent:i}}function re(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=te(e),n="number"==typeof t?ie(r,r.exponent+1+t):r,i=n.coefficients,a=n.exponent+1,o=a+(t||0);return i.length0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ie(e,t){for(var r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){var i=t-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),r.exponent++,i++),n[--i]++}return r}function ae(e){for(var t=[],r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function je(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?t-1:0),n=1;n15)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 r||We(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||We(e),new r(e.toNumber(),0)}},{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 r||We(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){B||Ye(e);var t=new B(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){var 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||Ze(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){B||Ye(e);try{return new B(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||We(e);try{return new r(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||Ze(e),new t(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return B||Ye(e),new B(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw new Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(e)}},{from:"Matrix",to:"Array",convert:function(e){return e.valueOf()}}]),H.onMismatch=function(e,t,r){var n=H.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&p(t[0])&&r.some((function(e){return!e.params.includes(",")}))){var i=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},H.onMismatch=function(e,t,r){var n=H.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&p(t[0])&&r.some((function(e){return!e.params.includes(",")}))){var i=new TypeError("Function '".concat(e,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(e,")'."));throw i.data=n.data,i}throw n},H}));function Ze(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function We(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function Ye(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}r(5735),r(3753);var Je,Xe,Qe=Ee("ResultSet",[],(function(){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.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e}),{isClass:!0}),Ke=(r(8011),9e15),et=1e9,tt="0123456789abcdef",rt="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",nt="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",it={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Ke,maxE:Ke,crypto:!1},at=!0,ot="[DecimalError] ",ut=ot+"Invalid argument: ",st=ot+"Precision limit exceeded",ct=ot+"crypto unavailable",ft="[object Decimal]",lt=Math.floor,pt=Math.pow,mt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ht=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,dt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,vt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,yt=1e7,gt=7,xt=rt.length-1,bt=nt.length-1,wt={toStringTag:ft};function Nt(e){var t,r,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,t=1;tr)throw Error(ut+e)}function Et(e,t,r,n){var i,a,o,u;for(a=e[0];a>=10;a/=10)--t;return--t<0?(t+=gt,i=0):(i=Math.ceil((t+1)/gt),t%=gt),a=pt(10,gt-t),u=e[i]%a|0,null==n?t<3?(0==t?u=u/100|0:1==t&&(u=u/10|0),o=r<4&&99999==u||r>3&&49999==u||5e4==u||0==u):o=(r<4&&u+1==a||r>3&&u+1==a/2)&&(e[i+1]/a/100|0)==pt(10,t-2)-1||(u==a/2||0==u)&&0==(e[i+1]/a/100|0):t<4?(0==t?u=u/1e3|0:1==t?u=u/100|0:2==t&&(u=u/10|0),o=(n||r<4)&&9999==u||!n&&r>3&&4999==u):o=((n||r<4)&&u+1==a||!n&&r>3&&u+1==a/2)&&(e[i+1]/a/1e3|0)==pt(10,t-3)-1,o}function At(e,t,r){for(var n,i,a=[0],o=0,u=e.length;or-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/r|0,a[n]%=r)}return a.reverse()}wt.absoluteValue=wt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Ct(e)},wt.ceil=function(){return Ct(new this.constructor(this),this.e+1,2)},wt.clampedTo=wt.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(ut+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},wt.comparedTo=wt.cmp=function(e){var t,r,n,i,a=this,o=a.d,u=(e=new a.constructor(e)).d,s=a.s,c=e.s;if(!o||!u)return s&&c?s!==c?s:o===u?0:!o^s<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?s:u[0]?-c:0;if(s!==c)return s;if(a.e!==e.e)return a.e>e.e^s<0?1:-1;for(t=0,r=(n=o.length)<(i=u.length)?n:i;tu[t]^s<0?1:-1;return n===i?0:n>i^s<0?1:-1},wt.cosine=wt.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+gt,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/$t(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=Ut(e,1,t.times(i),new e(1));for(var a=r;a--;){var o=t.times(t);t=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,t}(n,Ht(n,r)),n.precision=e,n.rounding=t,Ct(2==Xe||3==Xe?r.neg():r,e,t,!0)):new n(1):new n(NaN)},wt.cubeRoot=wt.cbrt=function(){var e,t,r,n,i,a,o,u,s,c,f=this,l=f.constructor;if(!f.isFinite()||f.isZero())return new l(f);for(at=!1,(a=f.s*pt(f.s*f,1/3))&&Math.abs(a)!=1/0?n=new l(a.toString()):(r=Nt(f.d),(a=((e=f.e)-r.length+1)%3)&&(r+=1==a||-2==a?"0":"00"),a=pt(r,1/3),e=lt((e+1)/3)-(e%3==(e<0?-1:2)),(n=new l(r=a==1/0?"5e"+e:(r=a.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=f.s),o=(e=l.precision)+3;;)if(c=(s=(u=n).times(u).times(u)).plus(f),n=St(c.plus(f).times(u),c.plus(s),o+2,1),Nt(u.d).slice(0,o)===(r=Nt(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(Ct(n,e+1,1),t=!n.times(n).times(n).eq(f));break}if(!i&&(Ct(u,e+1,0),u.times(u).times(u).eq(f))){n=u;break}o+=4,i=1}return at=!0,Ct(n,e,l.rounding,t)},wt.decimalPlaces=wt.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=((e=t.length-1)-lt(this.e/gt))*gt,e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},wt.dividedBy=wt.div=function(e){return St(this,new this.constructor(e))},wt.dividedToIntegerBy=wt.divToInt=function(e){var t=this.constructor;return Ct(St(this,new t(e),0,1,1),t.precision,t.rounding)},wt.equals=wt.eq=function(e){return 0===this.cmp(e)},wt.floor=function(){return Ct(new this.constructor(this),this.e+1,3)},wt.greaterThan=wt.gt=function(e){return this.cmp(e)>0},wt.greaterThanOrEqualTo=wt.gte=function(e){var t=this.cmp(e);return 1==t||0===t},wt.hyperbolicCosine=wt.cosh=function(){var e,t,r,n,i,a=this,o=a.constructor,u=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return u;r=o.precision,n=o.rounding,o.precision=r+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?t=(1/$t(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),a=Ut(o,1,a.times(t),new o(1),!0);for(var s,c=e,f=new o(8);c--;)s=a.times(a),a=u.minus(s.times(f.minus(s.times(f))));return Ct(a,o.precision=r,o.rounding=n,!0)},wt.hyperbolicSine=wt.sinh=function(){var e,t,r,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(t=a.precision,r=a.rounding,a.precision=t+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=Ut(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=Ut(a,2,i=i.times(1/$t(5,e)),i,!0);for(var o,u=new a(5),s=new a(16),c=new a(20);e--;)o=i.times(i),i=i.times(u.plus(o.times(s.times(o).plus(c))))}return a.precision=t,a.rounding=r,Ct(i,t,r,!0)},wt.hyperbolicTangent=wt.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,St(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},wt.inverseCosine=wt.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,a=r.rounding;return-1!==n?0===n?t.isNeg()?Tt(r,i,a):new r(0):new r(NaN):t.isZero()?Tt(r,i+4,a).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Tt(r,i+4,a).times(.5),r.precision=i,r.rounding=a,e.minus(t))},wt.inverseHyperbolicCosine=wt.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,at=!1,r=r.times(r).minus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},wt.inverseHyperbolicSine=wt.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,at=!1,r=r.times(r).plus(1).sqrt().plus(r),at=!0,n.precision=e,n.rounding=t,r.ln())},wt.inverseHyperbolicTangent=wt.atanh=function(){var e,t,r,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,t=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Ct(new a(i),e,t,!0):(a.precision=r=n-i.e,i=St(i.plus(1),new a(1).minus(i),r+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=t,i.times(.5))):new a(NaN)},wt.inverseSine=wt.asin=function(){var e,t,r,n,i=this,a=i.constructor;return i.isZero()?new a(i):(t=i.abs().cmp(1),r=a.precision,n=a.rounding,-1!==t?0===t?((e=Tt(a,r+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=r+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=r,a.rounding=n,i.times(2)))},wt.inverseTangent=wt.atan=function(){var e,t,r,n,i,a,o,u,s,c=this,f=c.constructor,l=f.precision,p=f.rounding;if(c.isFinite()){if(c.isZero())return new f(c);if(c.abs().eq(1)&&l+4<=bt)return(o=Tt(f,l+4,p).times(.25)).s=c.s,o}else{if(!c.s)return new f(NaN);if(l+4<=bt)return(o=Tt(f,l+4,p).times(.5)).s=c.s,o}for(f.precision=u=l+10,f.rounding=1,e=r=Math.min(28,u/gt+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(at=!1,t=Math.ceil(u/gt),n=1,s=c.times(c),o=new f(c),i=c;-1!==e;)if(i=i.times(s),a=o.minus(i.div(n+=2)),i=i.times(s),void 0!==(o=a.plus(i.div(n+=2))).d[t])for(e=t;o.d[e]===a.d[e]&&e--;);return r&&(o=o.times(2<this.d.length-2},wt.isNaN=function(){return!this.s},wt.isNegative=wt.isNeg=function(){return this.s<0},wt.isPositive=wt.isPos=function(){return this.s>0},wt.isZero=function(){return!!this.d&&0===this.d[0]},wt.lessThan=wt.lt=function(e){return this.cmp(e)<0},wt.lessThanOrEqualTo=wt.lte=function(e){return this.cmp(e)<1},wt.logarithm=wt.log=function(e){var t,r,n,i,a,o,u,s,c=this,f=c.constructor,l=f.precision,p=f.rounding;if(null==e)e=new f(10),t=!0;else{if(r=(e=new f(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new f(NaN);t=e.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new f(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(t)if(r.length>1)a=!0;else{for(i=r[0];i%10==0;)i/=10;a=1!==i}if(at=!1,o=qt(c,u=l+5),n=t?Ot(f,u+10):qt(e,u),Et((s=St(o,n,u,1)).d,i=l,p))do{if(o=qt(c,u+=10),n=t?Ot(f,u+10):qt(e,u),s=St(o,n,u,1),!a){+Nt(s.d).slice(i+1,i+15)+1==1e14&&(s=Ct(s,l+1,0));break}}while(Et(s.d,i+=10,p));return at=!0,Ct(s,l,p)},wt.minus=wt.sub=function(e){var t,r,n,i,a,o,u,s,c,f,l,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,u=h.precision,s=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===s?-0:0);e=new h(m)}return at?Ct(e,u,s):e}if(r=lt(e.e/gt),f=lt(m.e/gt),c=c.slice(),a=f-r){for((l=a<0)?(t=c,a=-a,o=p.length):(t=p,r=f,o=c.length),a>(n=Math.max(Math.ceil(u/gt),o)+2)&&(a=n,t.length=1),t.reverse(),n=a;n--;)t.push(0);t.reverse()}else{for((l=(n=c.length)<(o=p.length))&&(o=n),n=0;n0;--n)c[o++]=0;for(n=p.length;n>a;){if(c[--n](o=(a=Math.ceil(u/gt))>o?a+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=c.length)-(i=f.length)<0&&(i=o,r=f,f=c,c=r),t=0;i;)t=(c[--i]=c[i]+f[i]+t)/yt|0,c[i]%=yt;for(t&&(c.unshift(t),++n),o=c.length;0==c[--o];)c.pop();return e.d=c,e.e=Ft(c,n),at?Ct(e,u,s):e},wt.precision=wt.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(ut+e);return r.d?(t=Bt(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},wt.round=function(){var e=this,t=e.constructor;return Ct(new t(e),e.e+1,t.rounding)},wt.sine=wt.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+gt,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:Ut(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=Ut(e,2,t=t.times(1/$t(5,r)),t);for(var i,a=new e(5),o=new e(16),u=new e(20);r--;)i=t.times(t),t=t.times(a.plus(i.times(o.times(i).minus(u))));return t}(n,Ht(n,r)),n.precision=e,n.rounding=t,Ct(Xe>2?r.neg():r,e,t,!0)):new n(NaN)},wt.squareRoot=wt.sqrt=function(){var e,t,r,n,i,a,o=this,u=o.d,s=o.e,c=o.s,f=o.constructor;if(1!==c||!u||!u[0])return new f(!c||c<0&&(!u||u[0])?NaN:u?o:1/0);for(at=!1,0==(c=Math.sqrt(+o))||c==1/0?(((t=Nt(u)).length+s)%2==0&&(t+="0"),c=Math.sqrt(t),s=lt((s+1)/2)-(s<0||s%2),n=new f(t=c==1/0?"5e"+s:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+s)):n=new f(c.toString()),r=(s=f.precision)+3;;)if(n=(a=n).plus(St(o,a,r+2,1)).times(.5),Nt(a.d).slice(0,r)===(t=Nt(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Ct(n,s+1,1),e=!n.times(n).eq(o));break}if(!i&&(Ct(a,s+1,0),a.times(a).eq(o))){n=a;break}r+=4,i=1}return at=!0,Ct(n,s,f.rounding,e)},wt.tangent=wt.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=St(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Ct(2==Xe||4==Xe?r.neg():r,e,t,!0)):new n(NaN)},wt.times=wt.mul=function(e){var t,r,n,i,a,o,u,s,c,f=this,l=f.constructor,p=f.d,m=(e=new l(e)).d;if(e.s*=f.s,!(p&&p[0]&&m&&m[0]))return new l(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(r=lt(f.e/gt)+lt(e.e/gt),(s=p.length)<(c=m.length)&&(a=p,p=m,m=a,o=s,s=c,c=o),a=[],n=o=s+c;n--;)a.push(0);for(n=c;--n>=0;){for(t=0,i=s+n;i>n;)u=a[i]+m[n]*p[i-n-1]+t,a[i--]=u%yt|0,t=u/yt|0;a[i]=(a[i]+t)%yt|0}for(;!a[--o];)a.pop();return t?++r:a.shift(),e.d=a,e.e=Ft(a,r),at?Ct(e,l.precision,l.rounding):e},wt.toBinary=function(e,t){return Gt(this,2,e,t)},wt.toDecimalPlaces=wt.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(Dt(e,0,et),void 0===t?t=n.rounding:Dt(t,0,8),Ct(r,e+r.e+1,t))},wt.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=Mt(n,!0):(Dt(e,0,et),void 0===t?t=i.rounding:Dt(t,0,8),r=Mt(n=Ct(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},wt.toFixed=function(e,t){var r,n,i=this,a=i.constructor;return void 0===e?r=Mt(i):(Dt(e,0,et),void 0===t?t=a.rounding:Dt(t,0,8),r=Mt(n=Ct(new a(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},wt.toFraction=function(e){var t,r,n,i,a,o,u,s,c,f,l,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=r=new d(1),n=s=new d(0),o=(a=(t=new d(n)).e=Bt(h)-m.e-1)%gt,t.d[0]=pt(10,o<0?gt+o:o),null==e)e=a>0?t:c;else{if(!(u=new d(e)).isInt()||u.lt(c))throw Error(ut+u);e=u.gt(t)?a>0?t:c:u}for(at=!1,u=new d(Nt(h)),f=d.precision,d.precision=a=h.length*gt*2;l=St(u,t,0,1,1),1!=(i=r.plus(l.times(n))).cmp(e);)r=n,n=i,i=c,c=s.plus(l.times(i)),s=i,i=t,t=u.minus(l.times(i)),u=i;return i=St(e.minus(r),n,0,1,1),s=s.plus(i.times(c)),r=r.plus(i.times(n)),s.s=c.s=m.s,p=St(c,n,a,1).minus(m).abs().cmp(St(s,r,a,1).minus(m).abs())<1?[c,n]:[s,r],d.precision=f,at=!0,p},wt.toHexadecimal=wt.toHex=function(e,t){return Gt(this,16,e,t)},wt.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:Dt(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(at=!1,r=St(r,e,0,t,1).times(e),at=!0,Ct(r)):(e.s=r.s,r=e),r},wt.toNumber=function(){return+this},wt.toOctal=function(e,t){return Gt(this,8,e,t)},wt.toPower=wt.pow=function(e){var t,r,n,i,a,o,u=this,s=u.constructor,c=+(e=new s(e));if(!(u.d&&e.d&&u.d[0]&&e.d[0]))return new s(pt(+u,c));if((u=new s(u)).eq(1))return u;if(n=s.precision,a=s.rounding,e.eq(1))return Ct(u,n,a);if((t=lt(e.e/gt))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=kt(s,u,r,n),e.s<0?new s(1).div(i):Ct(i,n,a);if((o=u.s)<0){if(ts.maxE+1||t0?o/0:0):(at=!1,s.rounding=u.s=1,r=Math.min(12,(t+"").length),(i=zt(e.times(qt(u,n+r)),n)).d&&Et((i=Ct(i,n+5,1)).d,n,a)&&(t=n+10,+Nt((i=Ct(zt(e.times(qt(u,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=Ct(i,n+1,0))),i.s=o,at=!0,s.rounding=a,Ct(i,n,a))},wt.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=Mt(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Dt(e,1,et),void 0===t?t=i.rounding:Dt(t,0,8),r=Mt(n=Ct(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},wt.toSignificantDigits=wt.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(Dt(e,1,et),void 0===t?t=r.rounding:Dt(t,0,8)),Ct(new r(this),e,t)},wt.toString=function(){var e=this,t=e.constructor,r=Mt(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},wt.truncated=wt.trunc=function(){return Ct(new this.constructor(this),this.e+1,1)},wt.valueOf=wt.toJSON=function(){var e=this,t=e.constructor,r=Mt(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var St=function(){function e(e,t,r){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*t+i,e[a]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;)e.shift()}return function(n,i,a,o,u,s){var c,f,l,p,m,h,d,v,y,g,x,b,w,N,D,E,A,S,C,M,F=n.constructor,O=n.s==i.s?1:-1,T=n.d,B=i.d;if(!(T&&T[0]&&B&&B[0]))return new F(n.s&&i.s&&(T?!B||T[0]!=B[0]:B)?T&&0==T[0]||!B?0*O:O/0:NaN);for(s?(m=1,f=n.e-i.e):(s=yt,m=gt,f=lt(n.e/m)-lt(i.e/m)),C=B.length,A=T.length,g=(y=new F(O)).d=[],l=0;B[l]==(T[l]||0);l++);if(B[l]>(T[l]||0)&&f--,null==a?(N=a=F.precision,o=F.rounding):N=u?a+(n.e-i.e)+1:a,N<0)g.push(1),h=!0;else{if(N=N/m+2|0,l=0,1==C){for(p=0,B=B[0],N++;(l1&&(B=e(B,p,s),T=e(T,p,s),C=B.length,A=T.length),E=C,b=(x=T.slice(0,C)).length;b=s/2&&++S;do{p=0,(c=t(B,x,C,b))<0?(w=x[0],C!=b&&(w=w*s+(x[1]||0)),(p=w/S|0)>1?(p>=s&&(p=s-1),1==(c=t(d=e(B,p,s),x,v=d.length,b=x.length))&&(p--,r(d,C=10;p/=10)l++;y.e=l+f*m-1,Ct(y,u?a+y.e+1:a,o,h)}return y}}();function Ct(e,t,r,n){var i,a,o,u,s,c,f,l,p,m=e.constructor;e:if(null!=t){if(!(l=e.d))return e;for(i=1,u=l[0];u>=10;u/=10)i++;if((a=t-i)<0)a+=gt,o=t,s=(f=l[p=0])/pt(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/gt))>=(u=l.length)){if(!n)break e;for(;u++<=p;)l.push(0);f=s=0,i=1,o=(a%=gt)-gt+1}else{for(f=u=l[p],i=1;u>=10;u/=10)i++;s=(o=(a%=gt)-gt+i)<0?0:f/pt(10,i-o-1)%10|0}if(n=n||t<0||void 0!==l[p+1]||(o<0?f:f%pt(10,i-o-1)),c=r<4?(s||n)&&(0==r||r==(e.s<0?3:2)):s>5||5==s&&(4==r||n||6==r&&(a>0?o>0?f/pt(10,i-o):0:l[p-1])%10&1||r==(e.s<0?8:7)),t<1||!l[0])return l.length=0,c?(t-=e.e+1,l[0]=pt(10,(gt-t%gt)%gt),e.e=-t||0):l[0]=e.e=0,e;if(0==a?(l.length=p,u=1,p--):(l.length=p+1,u=pt(10,gt-a),l[p]=o>0?(f/pt(10,i-o)%pt(10,o)|0)*u:0),c)for(;;){if(0==p){for(a=1,o=l[0];o>=10;o/=10)a++;for(o=l[0]+=u,u=1;o>=10;o/=10)u++;a!=u&&(e.e++,l[0]==yt&&(l[0]=1));break}if(l[p]+=u,l[p]!=yt)break;l[p--]=0,u=1}for(a=l.length;0===l[--a];)l.pop()}return at&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e0?a=a.charAt(0)+"."+a.slice(1)+_t(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+_t(-i-1)+a,r&&(n=r-o)>0&&(a+=_t(n))):i>=o?(a+=_t(i+1-o),r&&(n=r-i-1)>0&&(a=a+"."+_t(n))):((n=i+1)0&&(i+1===o&&(a+="."),a+=_t(n))),a}function Ft(e,t){var r=e[0];for(t*=gt;r>=10;r/=10)t++;return t}function Ot(e,t,r){if(t>xt)throw at=!0,r&&(e.precision=r),Error(st);return Ct(new e(rt),t,1,!0)}function Tt(e,t,r){if(t>bt)throw Error(st);return Ct(new e(nt),t,r,!0)}function Bt(e){var t=e.length-1,r=t*gt+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function _t(e){for(var t="";e--;)t+="0";return t}function kt(e,t,r,n){var i,a=new e(1),o=Math.ceil(n/gt+4);for(at=!1;;){if(r%2&&Vt((a=a.times(t)).d,o)&&(i=!0),0===(r=lt(r/2))){r=a.d.length-1,i&&0===a.d[r]&&++a.d[r];break}Vt((t=t.times(t)).d,o)}return at=!0,a}function It(e){return 1&e.d[e.d.length-1]}function Rt(e,t,r){for(var n,i=new e(t[0]),a=0;++a17)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?(at=!1,s=h):s=t,u=new p(.03125);e.e>-2;)e=e.times(u),l+=5;for(s+=n=Math.log(pt(2,l))/Math.LN10*2+5|0,r=a=o=new p(1),p.precision=s;;){if(a=Ct(a.times(e),s,1),r=r.times(++f),Nt((u=o.plus(St(a,r,s,1))).d).slice(0,s)===Nt(o.d).slice(0,s)){for(i=l;i--;)o=Ct(o.times(o),s,1);if(null!=t)return p.precision=h,o;if(!(c<3&&Et(o.d,s-n,m,c)))return Ct(o,p.precision=h,m,at=!0);p.precision=s+=10,r=a=u=new p(1),f=0,c++}o=u}}function qt(e,t){var r,n,i,a,o,u,s,c,f,l,p,m=1,h=e,d=h.d,v=h.constructor,y=v.rounding,g=v.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new v(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(null==t?(at=!1,f=g):f=t,v.precision=f+=10,n=(r=Nt(d)).charAt(0),!(Math.abs(a=h.e)<15e14))return c=Ot(v,f+2,g).times(a+""),h=qt(new v(n+"."+r.slice(1)),f-10).plus(c),v.precision=g,null==t?Ct(h,g,y,at=!0):h;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=Nt((h=h.times(e)).d)).charAt(0),m++;for(a=h.e,n>1?(h=new v("0."+r),a++):h=new v(n+"."+r.slice(1)),l=h,s=o=h=St(h.minus(1),h.plus(1),f,1),p=Ct(h.times(h),f,1),i=3;;){if(o=Ct(o.times(p),f,1),Nt((c=s.plus(St(o,new v(i),f,1))).d).slice(0,f)===Nt(s.d).slice(0,f)){if(s=s.times(2),0!==a&&(s=s.plus(Ot(v,f+2,g).times(a+""))),s=St(s,new v(m),f,1),null!=t)return v.precision=g,s;if(!Et(s.d,f-10,y,u))return Ct(s,v.precision=g,y,at=!0);v.precision=f+=10,c=o=h=St(l.minus(1),l.plus(1),f,1),p=Ct(h.times(h),f,1),i=u=1}s=c,i+=2}}function jt(e){return String(e.s*e.s/0)}function Pt(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%gt,r<0&&(n+=gt),ne.constructor.maxE?(e.d=null,e.e=NaN):e.e-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),vt.test(t))return Pt(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ht.test(t))r=16,t=t.toLowerCase();else if(mt.test(t))r=2;else{if(!dt.test(t))throw Error(ut+t);r=8}for((a=t.search(/p/i))>0?(s=+t.slice(a+1),t=t.substring(2,a)):t=t.slice(2),o=(a=t.indexOf("."))>=0,n=e.constructor,o&&(a=(u=(t=t.replace(".","")).length)-a,i=kt(n,new n(r),a,2*a)),a=f=(c=At(t,r,yt)).length-1;0===c[a];--a)c.pop();return a<0?new n(0*e.s):(e.e=Ft(c,f),e.d=c,at=!1,o&&(e=St(e,i,4*u)),s&&(e=e.times(Math.abs(s)<54?pt(2,s):_r.pow(2,s))),at=!0,e)}function Ut(e,t,r,n,i){var a,o,u,s,c=e.precision,f=Math.ceil(c/gt);for(at=!1,s=r.times(r),u=new e(n);;){if(o=St(u.times(s),new e(t++*t++),c,1),u=i?n.plus(o):n.minus(o),n=St(o.times(s),new e(t++*t++),c,1),void 0!==(o=u.plus(n)).d[f]){for(a=f;o.d[a]===u.d[a]&&a--;);if(-1==a)break}a=u,u=n,n=o,o=a}return at=!0,o.d.length=f+1,o}function $t(e,t){for(var r=e;--t;)r*=e;return r}function Ht(e,t){var r,n=t.s<0,i=Tt(e,e.precision,1),a=i.times(.5);if((t=t.abs()).lte(a))return Xe=n?4:1,t;if((r=t.divToInt(i)).isZero())Xe=n?3:2;else{if((t=t.minus(r.times(i))).lte(a))return Xe=It(r)?n?2:3:n?4:1,t;Xe=It(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Gt(e,t,r,n){var i,a,o,u,s,c,f,l,p,m=e.constructor,h=void 0!==r;if(h?(Dt(r,1,et),void 0===n?n=m.rounding:Dt(n,0,8)):(r=m.precision,n=m.rounding),e.isFinite()){for(h?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(o=(f=Mt(e)).indexOf("."))>=0&&(f=f.replace(".",""),(p=new m(1)).e=f.length-o,p.d=At(Mt(p),10,i),p.e=p.d.length),a=s=(l=At(f,10,i)).length;0==l[--s];)l.pop();if(l[0]){if(o<0?a--:((e=new m(e)).d=l,e.e=a,l=(e=St(e,p,r,n,0,i)).d,a=e.e,c=Je),o=l[r],u=i/2,c=c||void 0!==l[r+1],c=n<4?(void 0!==o||c)&&(0===n||n===(e.s<0?3:2)):o>u||o===u&&(4===n||c||6===n&&1&l[r-1]||n===(e.s<0?8:7)),l.length=r,c)for(;++l[--r]>i-1;)l[r]=0,r||(++a,l.unshift(1));for(s=l.length;!l[s-1];--s);for(o=0,f="";o1)if(16==t||8==t){for(o=16==t?4:3,--s;s%o;s++)f+="0";for(s=(l=At(f,i,t)).length;!l[s-1];--s);for(o=1,f="1.";os)for(a-=s;a--;)f+="0";else at)return e.length=t,!0}function Zt(e){return new this(e).abs()}function Wt(e){return new this(e).acos()}function Yt(e){return new this(e).acosh()}function Jt(e,t){return new this(e).plus(t)}function Xt(e){return new this(e).asin()}function Qt(e){return new this(e).asinh()}function Kt(e){return new this(e).atan()}function er(e){return new this(e).atanh()}function tr(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,a=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?Tt(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=Tt(this,a,1).times(.5)).s=e.s:t.s<0?(this.precision=a,this.rounding=1,r=this.atan(St(e,t,a,1)),t=Tt(this,a,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(St(e,t,a,1)):(r=Tt(this,a,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function rr(e){return new this(e).cbrt()}function nr(e){return Ct(e=new this(e),e.e+1,2)}function ir(e,t,r){return new this(e).clamp(t,r)}function ar(e){if(!e||"object"!=typeof e)throw Error(ot+"Object expected");var t,r,n,i=!0===e.defaults,a=["precision",1,et,"rounding",0,8,"toExpNeg",-Ke,0,"toExpPos",0,Ke,"maxE",0,Ke,"minE",-Ke,0,"modulo",0,9];for(t=0;t=a[t+1]&&n<=a[t+2]))throw Error(ut+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=it[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(ut+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(ct);this[r]=!0}else this[r]=!1}return this}function or(e){return new this(e).cos()}function ur(e){return new this(e).cosh()}function sr(e,t){return new this(e).div(t)}function cr(e){return new this(e).exp()}function fr(e){return Ct(e=new this(e),e.e+1,3)}function lr(){var e,t,r=new this(0);for(at=!1,e=0;e=429e7?t[a]=crypto.getRandomValues(new Uint32Array(1))[0]:u[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(ct);for(t=crypto.randomBytes(n*=4);a=214e7?crypto.randomBytes(4).copy(t,a):(u.push(i%1e7),a+=4);a=n/4}else for(;a=10;i/=10)n++;na.maxE?(i.e=NaN,i.d=null):e.e=10;r/=10)t++;return void(at?t>a.maxE?(i.e=NaN,i.d=null):tt.re?1:e.ret.im?1:e.im0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){var t=this.start,r=this.step,n=this.end,i=0;if(r>0)for(;tn;)e(t,[i],this),t+=r,i++},e.prototype.map=function(e){var t=[];return this.forEach((function(r,n,i){t[n[0]]=e(r,n,i)})),t},e.prototype.toArray=function(){var e=[];return this.forEach((function(t,r){e[r[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var t=ee(this.start,e);return 1!==this.step&&(t+=":"+ee(this.step,e)),t+":"+ee(this.end,e)},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0})),Lr=Ee("Matrix",[],(function(){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,r){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,r){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}),Ur=r(4687);function $r(e,t,r){var n=new(0,e.constructor)(2),i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!V(r))throw new Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(r-1,", 2^").concat(r-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i="i".concat(r)}switch(t){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(t," not supported "))}}function Hr(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function Gr(e,t){var r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function Vr(e,r){var n=function(e,r){return"number"==typeof e?ee(e,r):a(e)?function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var r,n,i="auto";if(void 0!==t&&(t.notation&&(i=t.notation),"number"==typeof t?r=t:void 0!==t.precision&&(r=t.precision),t.wordSize&&"number"!=typeof(n=t.wordSize)))throw new Error('Option "wordSize" must be a number');switch(i){case"fixed":return function(e,t){return e.toFixed(t)}(e,r);case"exponential":return Hr(e,r);case"engineering":return function(e,t){var r=e.e,n=r%3==0?r:r<0?r-3-r%3:r-r%3,i=e.mul(Math.pow(10,-n)).toPrecision(t);return-1!==i.indexOf("e")&&(i=new(0,e.constructor)(i).toFixed()),i+"e"+(r>=0?"+":"")+n.toString()}(e,r);case"bin":return $r(e,2,n);case"oct":return $r(e,8,n);case"hex":return $r(e,16,n);case"auto":var a=t&&void 0!==t.lowerExp?t.lowerExp:-3,o=t&&void 0!==t.upperExp?t.upperExp:5;if(e.isZero())return"0";var u=e.toSignificantDigits(r),s=u.e;return(s>=a&&sr.truncate?n.substring(0,r.truncate-3)+"...":n}function Zr(e){for(var t=String(e),r="",n=0;n/g,">")}function Yr(e,t){if(Array.isArray(e)){for(var r="[",n=e.length,i=0;it?1:-1}function Xr(e,t,r){if(!(this instanceof Xr))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function Qr(e,t,r){if(!(this instanceof Qr))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=r),void 0!==this.min&&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 Kr(e){for(var t=[];Array.isArray(e);)t.push(e.length),e=e[0];return t}function en(e,t,r){var n,i=e.length;if(i!==t[r])throw new Xr(i,t[r]);if(r")}function tn(e,t){if(0===t.length){if(Array.isArray(e))throw new Xr(e.length,0)}else en(e,t,0)}function rn(e,t){if(!i(e)||!V(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new Qr(e,t)}function nn(e,t,r){if(!Array.isArray(e)||!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(!i(e)||!V(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Vr(t)+")")})),an(e,t,0,void 0!==r?r:0),e}function an(e,t,r,n){var i,a,o=e.length,u=t[r],s=Math.min(o,u);if(e.length=u,r=0){if(t%r!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);n[i]=-t/r}return n}function sn(e){return e.reduce((function(e,t){return e*t}),1)}function cn(e,t){for(var r=t||Kr(e);Array.isArray(e)&&1===e.length;)e=e[0],r.shift();for(var n=r.length;1===r[n-1];)n--;return n1&&void 0!==arguments[1]?arguments[1]:{},n=r.hasher,i=r.limit;return i=null==i?Number.POSITIVE_INFINITY:i,n=null==n?JSON.stringify:n,function r(){"object"!==t(r.cache)&&(r.cache={values:new Map,lru:Dn(i||Number.POSITIVE_INFINITY)});for(var a=[],o=0;oe.length)&&(t=e.length);for(var r=0,n=new Array(t);rn[a]&&(n[a]=t[a],i=!0);i&&u(e,n,r)}function m(e){for(var t=0,r=e.length;t");var p=t.max().map((function(e){return e+1}));s(e,p,n);var m=a.length;o(e._data,t,r,m,0)}return e}(this,e,t,i);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new Xr(e.length,this._size.length);for(var t=0;t=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(this._data);try{for(n.s();!(t=n.n()).done;){var i=t.value;e.push(new r([i],this._datatype))}}catch(e){n.e(e)}finally{n.f()}return e},r.prototype.columns=function(){var e=this,t=[],n=this.size();if(2!==n.length)throw new TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,a=function(n){var a=i.map((function(e){return[e[n]]}));t.push(new r(a,e._datatype))},o=0;o0?e:0,n=e<0?-e:0,o=this._size[0],u=this._size[1],s=Math.min(o-n,u-t),c=[],f=0;f0?n:0,c=n<0?-n:0,p=e[0],m=e[1],h=Math.min(p-c,m-s);if(f(t)){if(t.length!==h)throw new Error("Invalid value array length");u=function(e){return t[e]}}else if(l(t)){var d=t.size();if(1!==d.length||d[0]!==h)throw new Error("Invalid matrix length");u=function(e){return t.get([e])}}else u=function(){return t};o||(o=a(u(0))?u(0).mul(0):0);var v=[];if(e.length>0){v=nn(v,e,o);for(var y=0;y=n.length)throw new Qr(t,n.length);return l(e)?e.create(In(e.valueOf(),t,r)):In(e,t,r)}function In(e,t,r){var n,i,a,o;if(t<=0){if(Array.isArray(e[0])){for(o=On(e),i=[],n=0;n0}function Un(e){return 0===e}function $n(e){return Number.isNaN(e)}Pn.signature=jn,Ln.signature=jn,Un.signature=jn,$n.signature=jn;var Hn="isNegative",Gn=Ee(Hn,["typed"],(function(e){var t=e.typed;return t(Hn,{number:Pn,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:t.referToSelf((function(e){return function(r){return t.find(e,r.valueType())(r.value)}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Vn="isNumeric",Zn=Ee(Vn,["typed"],(function(e){var t=e.typed;return t(Vn,{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Wn=(r(3210),"hasNumericValue"),Yn=Ee(Wn,["typed","isNumeric"],(function(e){var t=e.typed,r=e.isNumeric;return t(Wn,{boolean:function(){return!0},string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return r(e)}})})),Jn="isPositive",Xn=Ee(Jn,["typed"],(function(e){var t=e.typed;return t(Jn,{number:Ln,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:t.referToSelf((function(e){return function(r){return t.find(e,r.valueType())(r.value)}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Qn="isZero",Kn=Ee(Qn,["typed"],(function(e){var t=e.typed;return t(Qn,{number:Un,BigNumber:function(e){return e.isZero()},Complex:function(e){return 0===e.re&&0===e.im},Fraction:function(e){return 1===e.d&&0===e.n},Unit:t.referToSelf((function(e){return function(r){return t.find(e,r.valueType())(r.value)}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),ei="isNaN",ti=Ee(ei,["typed"],(function(e){return(0,e.typed)(ei,{number:$n,BigNumber:function(e){return e.isNaN()},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":function(e){return _n(e,Number.isNaN)}})})),ri="typeOf",ni=Ee(ri,["typed"],(function(e){return(0,e.typed)(ri,{any:H})}));function ii(e,t,r){if(null==r)return e.eq(t);if(e.eq(t))return!0;if(e.isNaN()||t.isNaN())return!1;if(e.isFinite()&&t.isFinite()){var n=e.minus(t).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),t.abs());return n.lte(i.times(r))}return!1}var ai=Ee("compareUnits",["typed"],(function(e){var t=e.typed;return{"Unit, Unit":t.referToSelf((function(e){return function(r,n){if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)}}))}})),oi="equalScalar",ui=Ee(oi,["typed","config"],(function(e){var t=e.typed,r=e.config,n=ai({typed:t});return t(oi,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return ue(e,t,r.epsilon)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||ii(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,r){return ue(e.re,t.re,r)&&ue(e.im,t.im,r)}(e,t,r.epsilon)}},n)})),si=(Ee(oi,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(oi,{"number, number":function(e,t){return ue(e,t,r.epsilon)}})})),Ee("SparseMatrix",["typed","equalScalar","Matrix"],(function(e){var t=e.typed,r=e.equalScalar,n=e.Matrix;function o(e,t){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!c(t))throw new Error("Invalid datatype: "+t);if(l(e))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?he(t._values):void 0,e._index=he(t._index),e._ptr=he(t._ptr),e._size=he(t._size),e._datatype=r||t._datatype):u(e,t.valueOf(),r||t._datatype)}(this,e,t);else if(e&&f(e.index)&&f(e.ptr)&&f(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(f(e))u(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+H(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function u(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,o=0,u=r,s=0;if(c(i)&&(u=t.find(r,[i,i])||r,s=t.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var p=0;pd){for(l=d;lh){if(m){var v=0;for(l=0;ln-1&&(e._values.splice(p,1),e._index.splice(p,1),g++)}e._ptr[l]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function d(e,t,r,n,i){var a,o,u=n[0],s=n[1],c=[];for(a=0;a");if(1===a.length)t.dimension(0).forEach((function(t,i){rn(t),e.set([t,0],r[i[0]],n)}));else{var c=t.dimension(0),f=t.dimension(1);c.forEach((function(t,i){rn(t),f.forEach((function(a,o){rn(a),e.set([t,a],r[i[0]][o[0]],n)}))}))}}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},o.prototype.get=function(e){if(!f(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");var t=e[0],r=e[1];rn(t,this._size[0]),rn(r,this._size[1]);var n=s(t,this._ptr[r],this._ptr[r+1],this._index);return nu-1||o>l-1)&&(h(this,Math.max(a+1,u),Math.max(o+1,l),i),u=this._size[0],l=this._size[1]),rn(a,u),rn(o,l);var v=s(a,this._ptr[o],this._ptr[o+1],this._index);return v=0&&w<=i&&v(e._values[b],w-0,y-0)}else{for(var N={},D=g;D "+(this._values?Vr(this._values[s],e):"X");return i},o.prototype.toString=function(){return Vr(this.toArray())},o.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},o.prototype.diagonal=function(e){if(e){if(a(e)&&(e=e.toNumber()),!i(e)||!V(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,n=this._size[0],u=this._size[1],s=Math.min(n-r,u-t),c=[],f=[],l=[];l[0]=0;for(var p=t;p0?u:0,y=u<0?-u:0,g=e[0],x=e[1],b=Math.min(g-y,x-v);if(f(n)){if(n.length!==b)throw new Error("Invalid value array length");d=function(e){return n[e]}}else if(l(n)){var w=n.size();if(1!==w.length||w[0]!==b)throw new Error("Invalid matrix length");d=function(e){return n.get([e])}}else d=function(){return n};for(var N=[],D=[],E=[],A=0;A=0&&S=c||i[l]!==t)){var m=n?n[f]:void 0;i.splice(l,0,t),n&&n.splice(l,0,m),i.splice(l<=f?f+1:f,1),n&&n.splice(l<=f?f+1:f,1)}else if(l=c||i[f]!==e)){var h=n?n[l]:void 0;i.splice(f,0,e),n&&n.splice(f,0,h),i.splice(f<=l?l+1:l,1),n&&n.splice(f<=l?l+1:l,1)}}},o}),{isClass:!0})),ci=Ee("number",["typed"],(function(e){var t=e.typed,r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var t,r,n=(r=(t=e).match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/))?{input:t,radix:{"0b":2,"0o":8,"0x":16}[r[1]],integerPart:r[2],fractionalPart:r[3]}:null;if(n)return function(e){for(var t=parseInt(e.integerPart,e.radix),r=0,n=0;nMath.pow(2,i)-1)throw new SyntaxError('String "'.concat(e,'" is out of range'));o>=Math.pow(2,i-1)&&(o-=Math.pow(2,i))}return o},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf((function(e){return function(t){var r=t.clone();return r.value=e(t.value),r}})),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))});return r.fromJSON=function(e){return parseFloat(e.value)},r})),fi="string",li=Ee(fi,["typed"],(function(e){var t=e.typed;return t(fi,{"":function(){return""},number:ee,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}})),any:function(e){return String(e)}})})),pi="boolean",mi=Ee(pi,["typed"],(function(e){var t=e.typed;return t(pi,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;var r=Number(e);if(""!==e&&!isNaN(r))return!!r;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),hi=Ee("bignumber",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){var t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){var n=t[2],i=r(t[1]),a=new r(2).pow(Number(n));if(i.gt(a.sub(1)))throw new SyntaxError('String "'.concat(e,'" is out of range'));var o=new r(2).pow(Number(n)-1);return i.gte(o)?i.sub(a):i}return new r(e)},BigNumber:function(e){return e},Unit:t.referToSelf((function(e){return function(t){var r=t.clone();return r.value=e(t.value),r}})),Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),di=Ee("complex",["typed","Complex"],(function(e){var t=e.typed,r=e.Complex;return t("complex",{"":function(){return r.ZERO},number:function(e){return new r(e,0)},"number, number":function(e,t){return new r(e,t)},"BigNumber, BigNumber":function(e,t){return new r(e.toNumber(),t.toNumber())},Fraction:function(e){return new r(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return r(e)},null:function(e){return r(0)},Object:function(e){if("re"in e&&"im"in e)return new r(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new r(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),vi=Ee("fraction",["typed","Fraction"],(function(e){var t=e.typed,r=e.Fraction;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf((function(e){return function(t){var r=t.clone();return r.value=e(t.value),r}})),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),yi="matrix",gi=Ee(yi,["typed","Matrix","DenseMatrix","SparseMatrix"],(function(e){var t=e.typed,r=(e.Matrix,e.DenseMatrix),n=e.SparseMatrix;return t(yi,{"":function(){return i([])},string:function(e){return i([],e)},"string, string":function(e,t){return i([],e,t)},Array:function(e){return i(e)},Matrix:function(e){return i(e,e.storage())},"Array | Matrix, string":i,"Array | Matrix, string, string":i});function i(e,t,i){if("dense"===t||"default"===t||void 0===t)return new r(e,i);if("sparse"===t)return new n(e,i);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})),xi="matrixFromFunction",bi=Ee(xi,["typed","matrix","isZero"],(function(e){var t=e.typed,r=e.matrix,n=e.isZero;return t(xi,{"Array | Matrix, function, string, string":function(e,t,r,n){return i(e,t,r,n)},"Array | Matrix, function, string":function(e,t,r){return i(e,t,r)},"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,r){return i(e,r,t)},"Array | Matrix, string, string, function":function(e,t,r,n){return i(e,n,t,r)}});function i(e,t,i,a){var o;return(o=void 0!==a?r(i,a):r(i)).resize(e),o.forEach((function(e,r){var i=t(r);n(i)||o.set(r,i)})),o}}));function wi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(e);try{for(a.s();!(t=a.n()).done;){var u=t.value,s=o(u);if(s!==r)throw new TypeError("The vectors had different length: "+(0|r)+" ≠ "+(0|s));i.push(n(u))}}catch(e){a.e(e)}finally{a.f()}return i}function o(e){var 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.")}}));function Ei(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(e);try{for(u.s();!(a=u.n()).done;){var s=a.value,c=o(s);if(c!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|c));for(var f=n(s),l=0;l0)return e-t*Math.floor(e/t);if(0===t)return e;throw new Error("Cannot calculate mod for a negative divisor")}function Gi(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,r=t<0;if(r&&(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 r?1/0:0;if(!isFinite(e))return r?0:e;var n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function Vi(e){return Z(e)}function Zi(e){return e*e}function Wi(e,t){var r,n,i,a=0,o=1,u=1,s=0;if(!V(e)||!V(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)i=e-(n=Math.floor(e/t))*t,r=a,a=o-n*a,o=r,r=u,u=s-n*u,s=r,e=t,t=i;return e<0?[-e,-o,-s]:[e,e?o:0,s]}function Yi(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function Ji(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!V(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(re(e,t))}Ti.signature=Fi,Bi.signature=Oi,_i.signature=Oi,ki.signature=Fi,Ii.signature=Fi,Ri.signature=Fi,zi.signature=Fi,qi.signature=Fi,ji.signature=Fi,Pi.signature=Oi,Li.signature=Oi,Ui.signature=Fi,$i.signature=Fi,Hi.signature=Oi,Vi.signature=Fi,Zi.signature=Fi,Wi.signature=Oi,Yi.signature=Oi;var Xi="unaryMinus",Qi=Ee(Xi,["typed"],(function(e){var t=e.typed;return t(Xi,{number:ki,"Complex | BigNumber | Fraction":function(e){return e.neg()},Unit:t.referToSelf((function(e){return function(r){var n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n}})),"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}}))})})),Ki="unaryPlus",ea=Ee(Ki,["typed","config","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.BigNumber;return t(Ki,{number:Ii,Complex:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"boolean | string":function(e){return"BigNumber"===r.number?new n(+e):+e}})})),ta=Ee("abs",["typed"],(function(e){var t=e.typed;return t("abs",{number:Ti,"Complex | BigNumber | Fraction | Unit":function(e){return e.abs()},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}}))})})),ra="apply",na=Ee(ra,["typed","isInteger"],(function(e){var t=e.typed,r=e.isInteger;return t(ra,{"Array | Matrix, number | BigNumber, function":function(e,t,n){if(!r(t))throw new TypeError("Integer number expected for dimension");var i=Array.isArray(e)?Kr(e):e.size();if(t<0||t>=i.length)throw new Qr(t,i.length);return l(e)?e.create(ia(e.valueOf(),t,n)):ia(e,t,n)}})}));function ia(e,t,r){var n,i,a;if(t<=0){if(Array.isArray(e[0])){for(a=function(e){var t,r,n=e.length,i=e[0].length,a=[];for(r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r0?r(f,0,s,s[0],u,n,a):[];return e.createDenseMatrix({data:l,size:he(s),datatype:o})};function r(e,t,n,i,a,o,u){var s=[];if(t===n.length-1)for(var c=0;c0?n(e):r(e)},"number, number":function(e,t){return e>0?n(e,t):r(e,t)}})})),Ca=Ee(Ea,Aa,(function(e){var t=e.typed,r=e.Complex,n=e.matrix,i=e.ceil,a=e.floor,o=e.equalScalar,u=e.zeros,s=e.DenseMatrix,c=ma({typed:t,DenseMatrix:s}),f=ha({typed:t}),l=Sa({typed:t,ceil:i,floor:a});return t("fix",{number:l.signatures.number,"number, number | BigNumber":l.signatures["number,number"],Complex:function(e){return new r(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 r(e.re>0?a(e.re,t):i(e.re,t),e.im>0?a(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){var n=t.toNumber();return new r(e.re>0?a(e.re,n):i(e.re,n),e.im>0?a(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):a(e,t)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0?i(e,t):a(e,t)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"Array | Matrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return _n(t,(function(t){return e(t,r)}),!0)}})),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((function(e){return function(t,r){return f(n(r),t,e,!0).valueOf()}})),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((function(e){return function(t,r){return o(t,0)?u(r.size(),r.storage()):"dense"===r.storage()?f(r,t,e,!0):c(r,t,e,!0)}}))})})),Ma="floor",Fa=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Oa=Ee(Ma,["typed","config","round"],(function(e){var t=e.typed,r=e.config,n=e.round;return t(Ma,{number:function(e){return ue(e,n(e),r.epsilon)?n(e):Math.floor(e)},"number, number":function(e,t){if(ue(e,n(e,t),r.epsilon))return n(e,t);var i=la("".concat(e,"e").split("e"),2),a=i[0],o=i[1],u=Math.floor(Number("".concat(a,"e").concat(Number(o)+t))),s=la("".concat(u,"e").split("e"),2);return a=s[0],o=s[1],Number("".concat(a,"e").concat(Number(o)-t))}})})),Ta=Ee(Ma,Fa,(function(e){var t=e.typed,r=e.config,n=e.round,i=e.matrix,a=e.equalScalar,o=e.zeros,u=e.DenseMatrix,s=pa({typed:t,equalScalar:a}),c=ma({typed:t,DenseMatrix:u}),f=ha({typed:t}),l=Oa({typed:t,config:r,round:n});return t("floor",{number:l.signatures.number,"number,number":l.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:function(e){return ii(e,n(e),r.epsilon)?n(e):e.floor()},"BigNumber, BigNumber":function(e,t){return ii(e,n(e,t),r.epsilon)?n(e,t):e.toDecimalPlaces(t.toNumber(),kr.ROUND_FLOOR)},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())},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"Array, number | BigNumber":t.referToSelf((function(e){return function(t,r){return _n(t,(function(t){return e(t,r)}),!0)}})),"SparseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return s(t,r,e,!1)}})),"DenseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return f(t,r,e,!1)}})),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((function(e){return function(t,r){return f(i(r),t,e,!0).valueOf()}})),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((function(e){return function(t,r){return a(t,0)?o(r.size(),r.storage()):"dense"===r.storage()?f(r,t,e,!0):c(r,t,e,!0)}}))})}));function Ba(e,t,r){return(t=Me(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _a(e){return function(e){if(Array.isArray(e))return ca(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fa(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ka=Ee("matAlgo01xDSid",["typed"],(function(e){var t=e.typed;return function(e,r,n,i){var a=e._data,o=e._size,u=e._datatype,s=r._values,c=r._index,f=r._ptr,l=r._size,p=r._datatype;if(o.length!==l.length)throw new Xr(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,h,d=o[0],v=o[1],y="string"==typeof u&&u===p?u:void 0,g=y?t.find(n,[y,y]):n,x=[];for(m=0;m0?r(h,0,p,p[0],o,c):[];return e.createDenseMatrix({data:d,size:p,datatype:a})};function r(e,t,n,i,a,o){var u=[];if(t===n.length-1)for(var s=0;s1)throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(r," with size ").concat(e[r]," to size ").concat(t[r]))}}))),ja=Ee("matrixAlgorithmSuite",["typed","matrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.concat,i=za({typed:t}),a=ha({typed:t}),o=qa({concat:n});return function(e){var n,u=e.elop,s=e.SD||e.DS;u?(n={"DenseMatrix, DenseMatrix":function(e,t){return i.apply(void 0,_a(o(e,t)).concat([u]))},"Array, Array":function(e,t){return i.apply(void 0,_a(o(r(e),r(t))).concat([u])).valueOf()},"Array, DenseMatrix":function(e,t){return i.apply(void 0,_a(o(r(e),t)).concat([u]))},"DenseMatrix, Array":function(e,t){return i.apply(void 0,_a(o(e,r(t))).concat([u]))}},e.SS&&(n["SparseMatrix, SparseMatrix"]=function(t,r){return e.SS.apply(e,_a(o(t,r)).concat([u,!1]))}),e.DS&&(n["DenseMatrix, SparseMatrix"]=function(t,r){return e.DS.apply(e,_a(o(t,r)).concat([u,!1]))},n["Array, SparseMatrix"]=function(t,n){return e.DS.apply(e,_a(o(r(t),n)).concat([u,!1]))}),s&&(n["SparseMatrix, DenseMatrix"]=function(e,t){return s.apply(void 0,_a(o(t,e)).concat([u,!0]))},n["SparseMatrix, Array"]=function(e,t){return s.apply(void 0,_a(o(r(t),e)).concat([u,!0]))})):(n={"DenseMatrix, DenseMatrix":t.referToSelf((function(e){return function(t,r){return i.apply(void 0,_a(o(t,r)).concat([e]))}})),"Array, Array":t.referToSelf((function(e){return function(t,n){return i.apply(void 0,_a(o(r(t),r(n))).concat([e])).valueOf()}})),"Array, DenseMatrix":t.referToSelf((function(e){return function(t,n){return i.apply(void 0,_a(o(r(t),n)).concat([e]))}})),"DenseMatrix, Array":t.referToSelf((function(e){return function(t,n){return i.apply(void 0,_a(o(t,r(n))).concat([e]))}}))},e.SS&&(n["SparseMatrix, SparseMatrix"]=t.referToSelf((function(t){return function(r,n){return e.SS.apply(e,_a(o(r,n)).concat([t,!1]))}}))),e.DS&&(n["DenseMatrix, SparseMatrix"]=t.referToSelf((function(t){return function(r,n){return e.DS.apply(e,_a(o(r,n)).concat([t,!1]))}})),n["Array, SparseMatrix"]=t.referToSelf((function(t){return function(n,i){return e.DS.apply(e,_a(o(r(n),i)).concat([t,!1]))}}))),s&&(n["SparseMatrix, DenseMatrix"]=t.referToSelf((function(e){return function(t,r){return s.apply(void 0,_a(o(r,t)).concat([e,!0]))}})),n["SparseMatrix, Array"]=t.referToSelf((function(e){return function(t,n){return s.apply(void 0,_a(o(r(n),t)).concat([e,!0]))}}))));var c=e.scalar||"any";(e.Ds||e.Ss)&&(u?(n["DenseMatrix,"+c]=function(e,t){return a(e,t,u,!1)},n[c+", DenseMatrix"]=function(e,t){return a(t,e,u,!0)},n["Array,"+c]=function(e,t){return a(r(e),t,u,!1).valueOf()},n[c+", Array"]=function(e,t){return a(r(t),e,u,!0).valueOf()}):(n["DenseMatrix,"+c]=t.referToSelf((function(e){return function(t,r){return a(t,r,e,!1)}})),n[c+", DenseMatrix"]=t.referToSelf((function(e){return function(t,r){return a(r,t,e,!0)}})),n["Array,"+c]=t.referToSelf((function(e){return function(t,n){return a(r(t),n,e,!1).valueOf()}})),n[c+", Array"]=t.referToSelf((function(e){return function(t,n){return a(r(n),t,e,!0).valueOf()}}))));var f=void 0!==e.sS?e.sS:e.Ss;return u?(e.Ss&&(n["SparseMatrix,"+c]=function(t,r){return e.Ss(t,r,u,!1)}),f&&(n[c+", SparseMatrix"]=function(e,t){return f(t,e,u,!0)})):(e.Ss&&(n["SparseMatrix,"+c]=t.referToSelf((function(t){return function(r,n){return e.Ss(r,n,t,!1)}}))),f&&(n[c+", SparseMatrix"]=t.referToSelf((function(e){return function(t,r){return f(r,t,e,!0)}})))),u&&u.signatures&&ve(n,u.signatures),n}}));function Pa(e,t,r,n){if(!(this instanceof Pa))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}Pa.prototype=new Error,Pa.prototype.constructor=Error,Pa.prototype.name="ArgumentsError",Pa.prototype.isArgumentsError=!0;var La=["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],Ua="number | BigNumber | Fraction | Matrix | Array",$a="".concat(Ua,", ").concat(Ua,", ...").concat(Ua);function Ha(e){return!e.some((function(e){return Array.isArray(e)}))}var Ga=Ee("gcd",La,(function(e){var t,r=e.typed,n=e.matrix,i=e.equalScalar,a=e.BigNumber,o=e.DenseMatrix,u=e.concat,s=ka({typed:r}),c=Ia({typed:r,equalScalar:i}),f=Ra({typed:r,DenseMatrix:o});return r("gcd",{"number, number":Pi,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");for(var r=new a(0);!t.isZero();){var n=e.mod(t);e=t,t=n}return e.lt(r)?e.neg():e},"Fraction, Fraction":function(e,t){return e.gcd(t)}},ja({typed:r,matrix:n,concat:u})({SS:c,DS:s,Ss:f}),(Ba(t={},$a,r.referToSelf((function(e){return function(t,r,n){for(var i=e(t,r),a=0;a=0||r.predictable?Ui(e):new n(e,0).log().div(Math.LN10)},Complex:function(e){return new n(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||r.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Xa="log2",Qa=Ee(Xa,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(Xa,{number:function(e){return e>=0||r.predictable?$i(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||r.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))});function i(e){var t=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),Ka=Ee("matAlgo03xDSf",["typed"],(function(e){var t=e.typed;return function(e,r,n,i){var a=e._data,o=e._size,u=e._datatype,s=r._values,c=r._index,f=r._ptr,l=r._size,p=r._datatype;if(o.length!==l.length)throw new Xr(o.length,l.length);if(o[0]!==l[0]||o[1]!==l[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+l+")");if(!s)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,h=o[0],d=o[1],v=0,y=n;"string"==typeof u&&u===p&&(m=u,v=t.convert(0,m),y=t.find(n,[m,m]));for(var g=[],x=0;x=0?e.mod(t):e.mod(t).add(t).mod(t)}},ja({typed:t,matrix:r,concat:a})({SS:s,DS:u,SD:o,Ss:c,sS:f}))})),ro=Ee("multiplyScalar",["typed"],(function(e){return(0,e.typed)("multiplyScalar",{"number, number":_i,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":function(e,t){return t.multiply(e)},"Unit, number | Fraction | BigNumber | Complex | Unit":function(e,t){return e.multiply(t)}})})),no="multiply",io=Ee(no,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(function(e){var t=e.typed,r=e.matrix,n=e.addScalar,i=e.multiplyScalar,a=e.equalScalar,o=e.dot,u=pa({typed:t,equalScalar:a}),s=ha({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)")}}var f=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){var a,o=e._data,u=e._size,s=e._datatype,c=r._data,f=r._datatype,l=u[0],p=u[1],m=n,h=i;s&&f&&s===f&&"string"==typeof s&&(a=s,m=t.find(n,[a,a]),h=t.find(i,[a,a]));for(var d=[],v=0;vS)for(var M=0,F=0;F=0||t.predictable?Math.sqrt(e):new n(e,0).sqrt()}})),fo="square",lo=Ee(fo,["typed"],(function(e){return(0,e.typed)(fo,{number:Zi,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})})),po="subtract",mo=Ee(po,["typed","matrix","equalScalar","addScalar","unaryMinus","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=(e.addScalar,e.unaryMinus,e.DenseMatrix),a=e.concat,o=ka({typed:t}),u=Ka({typed:t}),s=eo({typed:t,equalScalar:n}),c=Ra({typed:t,DenseMatrix:i}),f=ma({typed:t,DenseMatrix:i}),l=ja({typed:t,matrix:r,concat:a});return t(po,{"number, number":function(e,t){return e-t},"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf((function(e){return function(r,n){if(null===r.value)throw new Error("Parameter x contains a unit with undefined value");if(null===n.value)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(n))throw new Error("Units do not match");var i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}}))},l({SS:s,DS:o,SD:u,Ss:f,sS:c}))})),ho="xgcd",vo=Ee(ho,["typed","config","matrix","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.BigNumber;return t(ho,{"number, number":function(e,t){var i=Wi(e,t);return"Array"===r.matrix?i:n(i)},"BigNumber, BigNumber":function(e,t){var a,o,u,s,c=new i(0),f=new i(1),l=c,p=f,m=f,h=c;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)o=e.div(t).floor(),u=e.mod(t),a=l,l=p.minus(o.times(l)),p=a,a=m,m=h.minus(o.times(m)),h=a,e=t,t=u;return s=e.lt(c)?[e.neg(),p.neg(),h.neg()]:[e,e.isZero()?0:p,h],"Array"===r.matrix?s:n(s)}})})),yo="invmod",go=Ee(yo,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(function(e){var t=e.typed,r=(e.config,e.BigNumber),n=e.xgcd,i=e.equal,a=e.smaller,o=e.mod,u=e.add,s=e.isInteger;return t(yo,{"number, number":c,"BigNumber, BigNumber":c});function c(e,t){if(!s(e)||!s(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=o(e,t),i(t,0))throw new Error("Divisor must be non zero");var c=n(e,t),f=la(c=c.valueOf(),2),l=f[0],p=f[1];return i(l,r(1))?(p=o(p,t),a(p,r(0))&&(p=u(p,t)),p):NaN}})),xo=Ee("matAlgo09xS0Sf",["typed","equalScalar"],(function(e){var t=e.typed,r=e.equalScalar;return function(e,n,i){var a=e._values,o=e._index,u=e._ptr,s=e._size,c=e._datatype,f=n._values,l=n._index,p=n._ptr,m=n._size,h=n._datatype;if(s.length!==m.length)throw new Xr(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");var d,v=s[0],y=s[1],g=r,x=0,b=i;"string"==typeof c&&c===h&&(d=c,g=t.find(r,[d,d]),x=t.convert(0,d),b=t.find(i,[d,d]));var w,N,D,E,A,S=a&&f?[]:void 0,C=[],M=[],F=S?[]:void 0,O=[];for(N=0;N0;)r(a[--m],o[--h])===d&&(v=v.plus(y)),y=y.times(g);for(;h>0;)r(u,o[--h])===d&&(v=v.plus(y)),y=y.times(g);return s.config({precision:x}),0===d&&(v.s=-v.s),v}function So(e){for(var t=e.d,r=t[0]+"",n=1;n0)if(++u>c)for(u-=c;u--;)s+="0";else u1&&(null!==f[m+1]&&void 0!==f[m+1]||(f[m+1]=0),f[m+1]+=f[m]>>1,f[m]&=1)}return f.reverse()}function Co(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);var n=new r(-1);return e.eq(n)?Do(t):t.eq(n)?Do(e):e.isFinite()&&t.isFinite()?Ao(e,t,(function(e,t){return e^t})):e.isFinite()||t.isFinite()?new r(e.isNegative()===t.isNegative()?1/0:-1/0):n}function Mo(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t)):new r(NaN)}function Fo(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");var r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}r(5069);var Oo="number, number";function To(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function bitAnd");return e&t}function Bo(e){if(!V(e))throw new Error("Integer expected in function bitNot");return~e}function _o(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function bitOr");return e|t}function ko(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function bitXor");return e^t}function Io(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function leftShift");return e<>t}function zo(e,t){if(!V(e)||!V(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}To.signature=Oo,Bo.signature="number",_o.signature=Oo,ko.signature=Oo,Io.signature=Oo,Ro.signature=Oo,zo.signature=Oo;var qo="bitAnd",jo=Ee(qo,["typed","matrix","equalScalar","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.concat,a=Va({typed:t,equalScalar:n}),o=Za({typed:t,equalScalar:n}),u=pa({typed:t,equalScalar:n}),s=ja({typed:t,matrix:r,concat:i});return t(qo,{"number, number":To,"BigNumber, BigNumber":No},s({SS:o,DS:a,Ss:u}))})),Po="bitNot",Lo=Ee(Po,["typed"],(function(e){var t=e.typed;return t(Po,{number:Bo,BigNumber:Do,"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),Uo="bitOr",$o=Ee(Uo,["typed","matrix","equalScalar","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.DenseMatrix,a=e.concat,o=ka({typed:t}),u=Ia({typed:t,equalScalar:n}),s=Ra({typed:t,DenseMatrix:i}),c=ja({typed:t,matrix:r,concat:a});return t(Uo,{"number, number":_o,"BigNumber, BigNumber":Eo},c({SS:u,DS:o,Ss:s}))})),Ho=Ee("matAlgo07xSSf",["typed","DenseMatrix"],(function(e){var t=e.typed,r=e.DenseMatrix;return function(e,i,a){var o=e._size,u=e._datatype,s=i._size,c=i._datatype;if(o.length!==s.length)throw new Xr(o.length,s.length);if(o[0]!==s[0]||o[1]!==s[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+s+")");var f,l,p,m=o[0],h=o[1],d=0,v=a;"string"==typeof u&&u===c&&(f=u,d=t.convert(0,f),v=t.find(a,[f,f]));var y=[];for(l=0;l0&&s>o)throw new Qr(s,o+1)}else{var m=he(p).valueOf(),h=Kr(m);if(f[t]=m,o=s,s=h.length-1,t>0&&s!==o)throw new Xr(o+1,s+1)}}if(0===f.length)throw new SyntaxError("At least one matrix expected");for(var d=f.shift();f.length;)d=su(d,f.shift(),s,0);return c?r(d):d},"...string":function(e){return e.join("")}})}));function su(e,t,r,n){if(n1?[u]:u}})),du="diag",vu=Ee(du,["typed","matrix","DenseMatrix","SparseMatrix"],(function(e){var t=e.typed,r=e.matrix,n=e.DenseMatrix,i=e.SparseMatrix;return t(du,{Array:function(e){return a(e,0,Kr(e),null)},"Array, number":function(e,t){return a(e,t,Kr(e),null)},"Array, BigNumber":function(e,t){return a(e,t.toNumber(),Kr(e),null)},"Array, string":function(e,t){return a(e,0,Kr(e),t)},"Array, number, string":function(e,t,r){return a(e,t,Kr(e),r)},"Array, BigNumber, string":function(e,t,r){return a(e,t.toNumber(),Kr(e),r)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return a(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return a(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return a(e,0,e.size(),t)},"Matrix, number, string":function(e,t,r){return a(e,t,e.size(),r)},"Matrix, BigNumber, string":function(e,t,r){return a(e,t.toNumber(),e.size(),r)}});function a(e,t,a,o){if(!V(t))throw new TypeError("Second parameter in function diag must be an integer");var u=t>0?t:0,s=t<0?-t:0;switch(a.length){case 1:return function(e,t,r,a,o,u){var s=[a+o,a+u];if(r&&"sparse"!==r&&"dense"!==r)throw new TypeError("Unknown matrix type ".concat(r,'"'));var c="sparse"===r?i.diagonal(s,e,t):n.diagonal(s,e,t);return null!==r?c:c.valueOf()}(e,t,o,a[0],s,u);case 2:return function(e,t,n,i,a,o){if(l(e)){var u=e.diagonal(t);return null!==n?n!==u.storage()?r(u,n):u:u.valueOf()}for(var s=Math.min(i[0]-a,i[1]-o),c=[],f=0;f=2&&s.push("index: ".concat(H(r))),o.length>=3&&s.push("array: ".concat(H(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(e.name,"(").concat(s.join(", "),") at index ").concat(JSON.stringify(r)))}throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(a.message))}}}var gu=Ee("filter",["typed"],(function(e){return(0,e.typed)("filter",{"Array, function":xu,"Matrix, function":function(e,t){return e.create(xu(e.toArray(),t))},"Array, RegExp":yn,"Matrix, RegExp":function(e,t){return e.create(yn(e.toArray(),t))}})}));function xu(e,t){return vn(e,(function(e,r,n){return yu(t,e,[r],n,"filter")}))}var bu="flatten",wu=Ee(bu,["typed","matrix"],(function(e){var t=e.typed,r=e.matrix;return t(bu,{Array:function(e){return mn(e)},Matrix:function(e){var t=mn(e.toArray());return r(t)}})})),Nu="forEach",Du=Ee(Nu,["typed"],(function(e){return(0,e.typed)(Nu,{"Array, function":Eu,"Matrix, function":function(e,t){e.forEach(t)}})}));function Eu(e,t){!function r(n,i){if(!Array.isArray(n))return yu(t,n,i,e,"forEach");dn(n,(function(e,t){r(e,i.concat(t))}))}(e,[])}var Au="getMatrixDataType",Su=Ee(Au,["typed"],(function(e){return(0,e.typed)(Au,{Array:function(e){return wn(e,H)},Matrix:function(e){return e.getDataType()}})})),Cu="identity",Mu=Ee(Cu,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.BigNumber,o=e.DenseMatrix,u=e.SparseMatrix;return t(Cu,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return c(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return c(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return c(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return c(e,t,r)},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?n(t):[];case 1:return c(e[0],e[0],t);case 2:return c(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function c(e,t,r){var n=a(e)||a(t)?i:null;if(a(e)&&(e=e.toNumber()),a(t)&&(t=t.toNumber()),!V(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!V(t)||t<1)throw new Error("Parameters in function identity must be positive integers");var s=n?new i(1):1,c=n?new n(0):0,f=[e,t];if(r){if("sparse"===r)return u.diagonal(f,s,0,c);if("dense"===r)return o.diagonal(f,s,0,c);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}for(var l=nn([],f,c),p=e2||Kr(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)+")");var r=[],i=[];return e.map((function(e){return t.map((function(t){return i=[],r.push(i),e.map((function(e){return t.map((function(t){return i.push(n(e,t))}))}))}))}))&&r}})),Tu=Ee("map",["typed"],(function(e){return(0,e.typed)("map",{"Array, function":Bu,"Matrix, function":function(e,t){return e.map(t)}})}));function Bu(e,t){return function r(n,i){return Array.isArray(n)?n.map((function(e,t){return r(e,i.concat(t))})):yu(t,n,i,e,"map")}(e,[])}var _u="diff",ku=Ee(_u,["typed","matrix","subtract","number"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.number;return t(_u,{"Array | Matrix":function(e){return l(e)?r(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,t){if(!V(t))throw new RangeError("Dimension must be a whole number");return l(e)?r(a(e.toArray(),t)):a(e,t)},"Array, BigNumber":t.referTo("Array,number",(function(e){return function(t,r){return e(t,i(r))}})),"Matrix, BigNumber":t.referTo("Matrix,number",(function(e){return function(t,r){return e(t,i(r))}}))});function a(e,t){if(l(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){var r=[];return e.forEach((function(e){r.push(a(e,t-1))})),r}if(0===t)return o(e);throw RangeError("Cannot have negative dimension")}function o(e){for(var t=[],r=e.length,n=1;n0?u.resize(e,o):u}var s=[];return e.length>0?nn(s,e,o):s}}));function Ru(){throw new Error('No "bignumber" implementation available')}function zu(){throw new Error('No "fraction" implementation available')}function qu(){throw new Error('No "matrix" implementation available')}var ju="range",Pu=Ee(ju,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,u=e.larger,s=e.largerEq,c=e.add,f=e.isPositive;return t(ju,{string:p,"string, boolean":p,"number, number":function(e,t){return l(m(e,t,1,!1))},"number, number, number":function(e,t,r){return l(m(e,t,r,!1))},"number, number, boolean":function(e,t,r){return l(m(e,t,1,r))},"number, number, number, boolean":function(e,t,r,n){return l(m(e,t,r,n))},"BigNumber, BigNumber":function(e,t){return l(m(e,t,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return l(m(e,t,r,!1))},"BigNumber, BigNumber, boolean":function(e,t,r){return l(m(e,t,new(0,e.constructor)(1),r))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return l(m(e,t,r,n))},"Unit, Unit, Unit":function(e,t,r){return l(m(e,t,r,!1))},"Unit, Unit, Unit, boolean":function(e,t,r,n){return l(m(e,t,r,n))}});function l(e){return"Matrix"===r.matrix?n?n(e):qu():e}function p(e,t){var n=function(e){var 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(!n)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===r.number?(void 0===i&&Ru(),l(m(i(n.start),i(n.end),i(n.step)))):l(m(n.start,n.end,n.step,t))}function m(e,t,r,n){for(var i=[],l=f(r)?n?o:a:n?s:u,p=e;l(p,t);)i.push(p),p=c(p,r);return i}})),Lu="reshape",Uu=Ee(Lu,["typed","isInteger","matrix"],(function(e){var t=e.typed,r=e.isInteger;return t(Lu,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach((function(e){if(!r(e))throw new TypeError("Invalid size for dimension: "+e)})),on(e,t)}})})),$u=Ee("resize",["config","matrix"],(function(e){var t=e.config,r=e.matrix;return function(e,n,i){if(2!==arguments.length&&3!==arguments.length)throw new Pa("resize",arguments.length,2,3);if(l(n)&&(n=n.valueOf()),a(n[0])&&(n=n.map((function(e){return a(e)?e.toNumber():e}))),l(e))return e.resize(n,i,!0);if("string"==typeof e)return function(e,t,r){if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(1!==t.length)throw new Xr(t.length,1);var n=t[0];if("number"!=typeof n||!V(n))throw new TypeError("Invalid size, must contain positive integers (size: "+Vr(t)+")");if(e.length>n)return e.substring(0,n);if(e.length2)throw new RangeError("Vector must be of dimensions 1x".concat(t));if(2===r.length&&1!==r[1])throw new RangeError("Vector must be of dimensions 1x".concat(t));if(r[0]!==t)throw new RangeError("Vector must be of dimensions 1x".concat(t))}})),Vu="rotationMatrix",Zu=Ee(Vu,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(function(e){var t=e.typed,r=e.config,n=e.multiplyScalar,i=e.addScalar,o=e.unaryMinus,u=e.norm,s=e.BigNumber,c=e.matrix,f=e.DenseMatrix,l=e.SparseMatrix,p=e.cos,m=e.sin;return t(Vu,{"":function(){return"Matrix"===r.matrix?c([]):[]},string:function(e){return c(e)},"number | BigNumber | Complex | Unit":function(e){return h(e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return h(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){var r=c(t);return d(r),g(e,r,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){d(t);var n=t.storage()||("Matrix"===r.matrix?"dense":void 0);return g(e,t,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,r){var n=c(t);return d(n),g(e,n,r)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,r){return d(t),g(e,t,r)}});function h(e,t){var r=a(e)?new s(-1):-1,i=p(e),o=m(e);return y([[i,n(r,o)],[o,i]],t)}function d(e){var t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function v(e){return e.reduce((function(e,t){return n(e,t)}))}function y(e,t){if(t){if("sparse"===t)return new l(e);if("dense"===t)return new f(e);throw new TypeError('Unknown matrix type "'.concat(t,'"'))}return e}function g(e,t,r){var n=u(t);if(0===n)throw new RangeError("Rotation around zero vector");var c=a(e)?s:null,f=c?new c(1):1,l=c?new c(-1):-1,h=c?new c(t.get([0])/n):t.get([0])/n,d=c?new c(t.get([1])/n):t.get([1])/n,g=c?new c(t.get([2])/n):t.get([2])/n,x=p(e),b=i(f,o(x)),w=m(e);return y([[i(x,v([h,h,b])),i(v([h,d,b]),v([l,g,w])),i(v([h,g,b]),v([d,w]))],[i(v([h,d,b]),v([g,w])),i(x,v([d,d,b])),i(v([d,g,b]),v([l,h,w]))],[i(v([h,g,b]),v([l,d,w])),i(v([d,g,b]),v([h,w])),i(x,v([g,g,b]))]],r)}})),Wu=Ee("row",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,i=e.range;return t("row",{"Matrix, number":a,"Array, number":function(e,t){return a(n(he(e)),t).valueOf()}});function a(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");rn(t,e.size()[0]);var a=i(0,e.size()[1]),o=new r(t,a),u=e.subset(o);return l(u)?u:n([[u]])}})),Yu="size",Ju=Ee(Yu,["typed","config","?matrix"],(function(e){var t=e.typed,r=e.config,n=e.matrix;return t(Yu,{Matrix:function(e){return e.create(e.size())},Array:Kr,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([]):qu()}})})),Xu="squeeze",Qu=Ee(Xu,["typed","matrix"],(function(e){var t=e.typed,r=e.matrix;return t(Xu,{Array:function(e){return cn(he(e))},Matrix:function(e){var t=cn(e.toArray());return Array.isArray(t)?r(t):t},any:function(e){return he(e)}})})),Ku="subset",es=Ee(Ku,["typed","matrix"],(function(e){var t=e.typed,r=e.matrix;return t(Ku,{"Array, Index":function(e,t){var n=r(e).subset(t);return t.isScalar()?n:n.valueOf()},"Matrix, Index":function(e,t){return e.subset(t)},"Object, Index":ns,"string, Index":ts,"Array, Index, any":function(e,t,n){return r(he(e)).subset(t,n,void 0).valueOf()},"Array, Index, any, any":function(e,t,n,i){return r(he(e)).subset(t,n,i).valueOf()},"Matrix, Index, any":function(e,t,r){return e.clone().subset(t,r)},"Matrix, Index, any, any":function(e,t,r,n){return e.clone().subset(t,r,n)},"string, Index, string":rs,"string, Index, string, string":rs,"Object, Index, any":is})}));function ts(e,t){if(!v(t))throw new TypeError("Index expected");if(1!==t.size().length)throw new Xr(t.size().length,1);var r=e.length;rn(t.min()[0],r),rn(t.max()[0],r);var n=t.dimension(0),i="";return n.forEach((function(t){i+=e.charAt(t)})),i}function rs(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(1!==t.size().length)throw new Xr(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";var i=t.dimension(0);if(i.size()[0]!==r.length)throw new Xr(i.size()[0],r.length);var a=e.length;rn(t.min()[0]),rn(t.max()[0]);for(var o=[],u=0;ua)for(var s=a-1,c=o.length;s0?u.resize(e,o):u}var s=[];return e.length>0?nn(s,e,o):s}})),ls=Ee("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(function(e){var t=e.typed,r=(e.matrix,e.addScalar),n=e.multiplyScalar,i=e.divideScalar,a=e.exp,o=e.tau,u=e.i,s=e.dotDivide,c=e.conj,f=e.pow,l=e.ceil,p=e.log2;return t("fft",{Array:m,Matrix:function(e){return e.create(m(e.toArray()))}});function m(e){var t=Kr(e);return 1===t.length?d(e,t[0]):h(e.map((function(e){return m(e,t.slice(1))})),0)}function h(e,t){var r=Kr(e);if(0!==t)return new Array(r[0]).fill(0).map((function(r,n){return h(e[n],t-1)}));if(1===r.length)return d(e);function n(e){var t=Kr(e);return new Array(t[1]).fill(0).map((function(r,n){return new Array(t[0]).fill(0).map((function(t,r){return e[r][n]}))}))}return n(h(n(e),1))}function d(e){var t=e.length;if(1===t)return[e[0]];if(t%2==0){for(var h=[].concat(_a(d(e.filter((function(e,t){return t%2==0})))),_a(d(e.filter((function(e,t){return t%2==1}))))),v=0;v1/4&&(j.push(r(j[U],q)),P.push(r(P[U],o(q,R,V))),U++);var Y=.84*Math.pow(M/W,.2);if(d(Y,F)?Y=F:h(Y,O)&&(Y=O),Y=B?y(Y):Y,q=o(q,Y),A&&h(l(q),A)?q=N?A:g(A):S&&d(l(q),S)&&(q=N?S:g(S)),++$>T)throw new Error("Maximum number of iterations reached, try changing options")}return{t:j,y:P}}}function b(e,t,r,n){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,r,n)}function w(e,t,r,n){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,r,n)}function N(e,t,r,n){var i=n.method?n.method:"RK45",a={RK23:b,RK45:w};if(i.toUpperCase()in a){var o=function(e){for(var t=1;t=ws?Z(e):t<=ys?Z(e)*function(e){var t,r=e*e,n=xs[0][4]*r,i=r;for(t=0;t<3;t+=1)n=(n+xs[0][t])*r,i=(i+bs[0][t])*r;return e*(n+xs[0][3])/(i+bs[0][3])}(t):t<=4?Z(e)*(1-function(e){var t,r=xs[1][8]*e,n=e;for(t=0;t<7;t+=1)r=(r+xs[1][t])*e,n=(n+bs[1][t])*e;var i=(r+xs[1][7])/(n+bs[1][7]),a=parseInt(16*e)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}(t)):Z(e)*(1-function(e){var t,r=1/(e*e),n=xs[2][5]*r,i=r;for(t=0;t<4;t+=1)n=(n+xs[2][t])*r,i=(i+bs[2][t])*r;var a=r*(n+xs[2][4])/(i+bs[2][4]);a=(gs-a)/e;var o=(e-(r=parseInt(16*e)/16))*(e+r);return Math.exp(-r*r)*Math.exp(-o)*a}(t))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),ys=.46875,gs=.5641895835477563,xs=[[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]],bs=[[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]],ws=Math.pow(2,53),Ns="mode",Ds=Ee(Ns,["typed","isNaN","isNumeric"],(function(e){var t=e.typed,r=e.isNaN,n=e.isNumeric;return t(Ns,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=mn(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var t={},i=[],a=0,o=0;oa&&(a=t[u],i=[u])}return i}}));function Es(e,t,r){var n;return-1!==String(e).indexOf("Unexpected type")?(n=arguments.length>2?" (type: "+H(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):-1!==String(e).indexOf("complex numbers")?(n=arguments.length>2?" (type: "+H(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}var As="prod",Ss=Ee(As,["typed","config","multiplyScalar","numeric"],(function(e){var t=e.typed,r=e.config,n=e.multiplyScalar,i=e.numeric;return t(As,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return a(e)}});function a(e){var t;if(Bn(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Es(t,"prod",e)}})),"string"==typeof t&&(t=i(t,r.number)),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}})),Cs="format",Ms=Ee(Cs,["typed"],(function(e){return(0,e.typed)(Cs,{any:Vr,"any, Object | function | number":Vr})})),Fs=Ee("bin",["typed","format"],(function(e){var t=e.typed,r=e.format;return t("bin",{"number | BigNumber":function(e){return r(e,{notation:"bin"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"bin",wordSize:t})}})})),Os=Ee("oct",["typed","format"],(function(e){var t=e.typed,r=e.format;return t("oct",{"number | BigNumber":function(e){return r(e,{notation:"oct"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"oct",wordSize:t})}})})),Ts=Ee("hex",["typed","format"],(function(e){var t=e.typed,r=e.format;return t("hex",{"number | BigNumber":function(e){return r(e,{notation:"hex"})},"number | BigNumber, number":function(e,t){return r(e,{notation:"hex",wordSize:t})}})})),Bs="print",_s=Ee(Bs,["typed"],(function(e){return(0,e.typed)(Bs,{"string, Object | Array":ks,"string, Object | Array, number | Object":ks})}));function ks(e,t,r){return e.replace(/\$([\w.]+)/g,(function(e,n){for(var i=n.split("."),a=t[i.shift()];i.length&&void 0!==a;){var o=i.shift();a=o?a[o]:a+"."}return void 0!==a?c(a)?a:Vr(a,r):e}))}var Is=Ee("to",["typed","matrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.concat;return t("to",{"Unit, Unit | string":function(e,t){return e.to(t)}},ja({typed:t,matrix:r,concat:n})({Ds:!0}))})),Rs="isPrime",zs=Ee(Rs,["typed"],(function(e){var t=e.typed;return t(Rs,{number:function(e){if(0*e!=0)return!1;if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(var t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},BigNumber:function(e){if(0*e.toNumber()!=0)return!1;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))){for(var t=e.toNumber(),r=5;r*r<=t;r+=6)if(t%r==0||t%(r+2)==0)return!1;return!0}function n(e,t,r){for(var n=1;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(r)):(t=t.sub(1),n=e.mul(n).mod(r));return n}for(var i=e.constructor.clone({precision:2*e.toFixed(0).length}),a=0,o=(e=new i(e)).sub(1);o.mod(2).eq(0);)o=o.div(2),a+=1;var u=null;if(e.lt("3317044064679887385961981"))u=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((function(t){return t1&&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");var r=H(e);if(!(r in i))throw new TypeError("Cannot convert "+e+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in a))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(a).join(", "));return t===r?e:a[t](e)}})),js="divideScalar",Ps=Ee(js,["typed","numeric"],(function(e){var t=e.typed;return e.numeric,t(js,{"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)},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":function(e,t){return e.divide(t)},"number | Fraction | Complex | BigNumber, Unit":function(e,t){return t.divideInto(e)}})})),Ls=Ee("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(function(e){var t=e.typed,r=e.config,n=e.identity,i=e.multiply,a=e.matrix,o=e.inv,u=e.number,s=e.fraction,c=e.Complex;return t("pow",{"number, number":f,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||r.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"Fraction, Fraction":function(e,t){var n=e.pow(t);if(null!=n)return n;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return f(e.valueOf(),t.valueOf())},"Array, number":l,"Array, BigNumber":function(e,t){return l(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 f(e,t){if(r.predictable&&!V(t)&&e<0)try{var n=s(t),i=u(n);if((t===i||Math.abs((t-i)/t)<1e-14)&&n.d%2==1)return(n.n%2==0?1:-1)*Math.pow(-e,t)}catch(e){}return r.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:V(t)||e>=0||r.predictable?Yi(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new c(e,0).pow(t,0)}function l(e,t){if(!V(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");var r=Kr(e);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");if(t<0)try{return l(o(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}for(var a=n(r[0]).valueOf(),u=e;t>=1;)1==(1&t)&&(a=i(u,a)),t>>=1,u=i(u,u);return a}function p(e,t){return a(l(e.valueOf(),t))}})),Us="Number of decimals in function round must be an integer",$s="round",Hs=Ee($s,["typed","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.zeros,a=e.BigNumber,o=e.DenseMatrix,u=pa({typed:t,equalScalar:n}),s=ma({typed:t,DenseMatrix:o}),c=ha({typed:t});return t($s,{number:Ji,"number, number":Ji,"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(Us);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);var r=t.toNumber();return e.round(r)},BigNumber:function(e){return e.toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);return e.toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(Us);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(Us);return e.round(t.toNumber())},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e,!0)}})),"SparseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return u(t,r,e,!1)}})),"DenseMatrix, number | BigNumber":t.referToSelf((function(e){return function(t,r){return c(t,r,e,!1)}})),"Array, number | BigNumber":t.referToSelf((function(e){return function(t,n){return c(r(t),n,e,!1).valueOf()}})),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf((function(e){return function(t,r){return n(t,0)?i(r.size(),r.storage()):s(r,t,e,!0)}})),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf((function(e){return function(t,r){return n(t,0)?i(r.size(),r.storage()):c(r,t,e,!0)}})),"number | Complex | BigNumber | Fraction, Array":t.referToSelf((function(e){return function(t,n){return c(r(n),t,e,!0).valueOf()}}))})})),Gs=Ee("log",["config","typed","divideScalar","Complex"],(function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.Complex;return t("log",{number:function(e){return e>=0||r.predictable?function(e,t){return Math.log(e)}(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():new i(e.toNumber(),0).log()},"any, any":t.referToSelf((function(e){return function(t,r){return n(e(t),e(r))}}))})})),Vs="log1p",Zs=Ee(Vs,["typed","config","divideScalar","log","Complex"],(function(e){var t=e.typed,r=e.config,n=e.divideScalar,i=e.log,a=e.Complex;return t(Vs,{number:function(e){return e>=-1||r.predictable?J(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var t=e.plus(1);return!t.isNegative()||r.predictable?t.ln():o(new a(e.toNumber(),0))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}})),"any, any":t.referToSelf((function(e){return function(t,r){return n(e(t),i(r))}}))});function o(e){var t=e.re+1;return new a(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}})),Ws="nthRoots",Ys=Ee(Ws,["config","typed","divideScalar","Complex"],(function(e){var t=e.typed,r=(e.config,e.divideScalar,e.Complex),n=[function(e){return new r(e,0)},function(e){return new r(0,e)},function(e){return new r(-e,0)},function(e){return new r(0,-e)}];function i(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 r(0,0)];var i,a="number"==typeof e;(a||0===e.re||0===e.im)&&(i=a?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);for(var o=e.arg(),u=e.abs(),s=[],c=Math.pow(u,1/t),f=0;fd&&(g.push(l[N]),x.push(D))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var E=n(v,y),A=0,S=x.length;A=0;d--){var v=r[d][0]||0;if(o(v,0))h[d]=[0];else{for(var y=0,g=[],x=[],b=m[d],w=m[d+1]-1;w>=b;w--){var N=p[w];N===d?y=l[w]:N=0;m--){var h=r[m][0]||0,d=void 0;if(o(h,0))d=0;else{var v=p[m][m];if(o(v,0))throw new Error("Linear system cannot be solved since matrix is singular");d=n(h,v);for(var y=m-1;y>=0;y--)r[y]=[a(r[y][0]||0,i(d,p[y][m]))]}l[m]=[d]}return new u({data:l,size:[c,1]})}})),ac="lsolveAll",oc=Ee(ac,["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],(function(e){var t=e.typed,r=e.matrix,n=e.divideScalar,i=e.multiplyScalar,a=e.subtract,o=e.equalScalar,u=e.DenseMatrix,s=ec({DenseMatrix:u});return t(ac,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var r=[s(e,t,!0)._data.map((function(e){return e[0]}))],c=e._size[0],f=e._size[1],l=e._values,p=e._index,m=e._ptr,h=0;hh&&(g.push(l[D]),x.push(E))}if(o(N,0))if(o(y[h],0)){if(0===v){var A=_a(y);A[h]=1;for(var S=0,C=x.length;S=0;h--)for(var d=r.length,v=0;v=b;N--){var D=p[N];D===h?w=l[N]:D=0;l--)for(var p=r.length,m=0;m=0;v--)d[v]=a(d[v],c[v][l]);r.push(d)}}else{if(0===m)return[];r.splice(m,1),m-=1,p-=1}else{h[l]=n(h[l],c[l][l]);for(var y=l-1;y>=0;y--)h[y]=a(h[y],i(h[l],c[y][l]))}}return r.map((function(e){return new u({data:e.map((function(e){return[e]})),size:[f,1]})}))}})),cc=Ee("matAlgo08xS0Sid",["typed","equalScalar"],(function(e){var t=e.typed,r=e.equalScalar;return function(e,n,i){var a=e._values,o=e._index,u=e._ptr,s=e._size,c=e._datatype,f=n._values,l=n._index,p=n._ptr,m=n._size,h=n._datatype;if(s.length!==m.length)throw new Xr(s.length,m.length);if(s[0]!==m[0]||s[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+m+")");if(!a||!f)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var d,v=s[0],y=s[1],g=r,x=0,b=i;"string"==typeof c&&c===h&&(d=c,g=t.find(r,[d,d]),x=t.convert(0,d),b=t.find(i,[d,d]));for(var w,N,D,E,A=[],S=[],C=[],M=[],F=[],O=0;Ot?1:-1},"BigNumber, BigNumber":function(e,t){return ii(e,t,r.epsilon)?new a(0):new a(e.cmp(t))},"Fraction, Fraction":function(e,t){return new o(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:f,DS:c,Ss:l}))})),bc=Ee(gc,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(gc,{"number, number":function(e,t){return ue(e,t,r.epsilon)?0:e>t?1:-1}})})),wc=r(3228),Nc="compareNatural",Dc=Ee(Nc,["typed","compare"],(function(e){var t=e.typed,r=e.compare,n=r.signatures["boolean,boolean"];return t(Nc,{"any, any":function e(t,o){var u,s=H(t),c=H(o);if(!("number"!==s&&"BigNumber"!==s&&"Fraction"!==s||"number"!==c&&"BigNumber"!==c&&"Fraction"!==c))return"0"!==(u=r(t,o)).toString()?u>0?1:-1:wc(s,c);var f=["Array","DenseMatrix","SparseMatrix"];if(f.includes(s)||f.includes(c))return 0!==(u=i(e,t,o))?u:wc(s,c);if(s!==c)return wc(s,c);if("Complex"===s)return function(e,t){return e.re>t.re?1:e.ret.im?1:e.imr.length?1:t.lengtht},"BigNumber, BigNumber":function(e,t){return e.gt(t)&&!ii(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return 1===e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:u,DS:o,Ss:s}))})),Pc=Ee(qc,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(qc,{"number, number":function(e,t){return e>t&&!ue(e,t,r.epsilon)}})})),Lc="largerEq",Uc=Ee(Lc,["typed","config","matrix","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.DenseMatrix,a=e.concat,o=Ka({typed:t}),u=Ho({typed:t,DenseMatrix:i}),s=ma({typed:t,DenseMatrix:i}),c=ja({typed:t,matrix:n,concat:a}),f=ai({typed:t});return t(Lc,$c({typed:t,config:r}),{"boolean, boolean":function(e,t){return e>=t},"BigNumber, BigNumber":function(e,t){return e.gte(t)||ii(e,t,r.epsilon)},"Fraction, Fraction":function(e,t){return-1!==e.compare(t)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,c({SS:u,DS:o,Ss:s}))})),$c=Ee(Lc,["typed","config"],(function(e){var t=e.typed,r=e.config;return t(Lc,{"number, number":function(e,t){return e>=t||ue(e,t,r.epsilon)}})})),Hc="deepEqual",Gc=Ee(Hc,["typed","equal"],(function(e){var t=e.typed,r=e.equal;return t(Hc,{"any, any":function(e,t){return n(e.valueOf(),t.valueOf())}});function n(e,t){if(Array.isArray(e)){if(Array.isArray(t)){var i=e.length;if(i!==t.length)return!1;for(var a=0;a1)throw new Error("Only one dimensional matrices supported");return s(e.valueOf(),t,r)}if(Array.isArray(e))return s(e,t,r)}function s(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(var a=0;a=0){var l=e[c];e[c]=e[s],e[s]=l,--c}else++s;i(e[s],f)>0&&--s,t<=s?u=s:o=s+1}return e[t]}})),Xc="sort",Qc=Ee(Xc,["typed","matrix","compare","compareNatural"],(function(e){var t=e.typed,r=e.matrix,n=e.compare,i=e.compareNatural,a=n,o=function(e,t){return-n(e,t)};return t(Xc,{Array:function(e){return s(e),e.sort(a)},Matrix:function(e){return c(e),r(e.toArray().sort(a),e.storage())},"Array, function":function(e,t){return s(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),r(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return s(e),e.sort(u(t))},"Matrix, string":function(e,t){return c(e),r(e.toArray().sort(u(t)),e.storage())}});function u(e){if("asc"===e)return a;if("desc"===e)return o;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function s(e){if(1!==Kr(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),Kc=Ee("max",["typed","config","numeric","larger"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.larger;return t("max",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return kn(e,t.valueOf(),a)},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function max");return o(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Es(e,"max",t)}}function o(e){var t;if(Bn(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Es(t,"max",e)}})),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=n(t,r.number)),t}})),ef=Ee("min",["typed","config","numeric","smaller"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.smaller;return t("min",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){return kn(e,t.valueOf(),a)},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function min");return o(e)}});function a(e,t){try{return i(e,t)?e:t}catch(e){throw Es(e,"min",t)}}function o(e){var t;if(Bn(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Es(t,"min",e)}})),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=n(t,r.number)),t}})),tf=Ee("ImmutableDenseMatrix",["smaller","DenseMatrix"],(function(e){var t=e.smaller,r=e.DenseMatrix;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!c(t))throw new Error("Invalid datatype: "+t);if(l(e)||f(e)){var i=new r(e,t);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&f(e.data)&&f(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 ("+H(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:var t=r.prototype.subset.call(this,e);return l(t)?new n({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")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:he(this._data),size:he(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(e){return new n(e)},n.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(null===this._min){var e=null;this.forEach((function(r){(null===e||t(r,e))&&(e=r)})),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var e=null;this.forEach((function(r){(null===e||t(e,r))&&(e=r)})),this._max=null!==e?e:void 0}return this._max},n}),{isClass:!0}),rf=Ee("Index",["ImmutableDenseMatrix"],(function(e){var t=e.ImmutableDenseMatrix;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var t=0,i=arguments.length;t0;){var s=o.right;o.left.right=o.right,o.right.left=o.left,o.left=i,o.right=i.right,i.right=o,o.right.left=o,o.parent=null,o=s,a--}return e.left.right=e.right,e.right.left=e.left,i=e===e.right?null:function(e,i){var a,o=Math.floor(Math.log(i)*n)+1,s=new Array(o),c=0,f=e;if(f)for(c++,f=f.right;f!==e;)c++,f=f.right;for(;c>0;){for(var l=f.degree,p=f.right;a=s[l];){if(r(f.key,a.key)){var m=a;a=f,f=m}u(a,f),s[l]=null,l++}s[l]=f,f=p,c--}e=null;for(var h=0;h=e&&(r(u.value,0)||n(u.key,u.value,this)),(u=i.extractMinimum())&&o.push(u);for(var s=0;s="0"&&e<="9"}function M(){n++,i=r.charAt(n)}function F(e){n=e,i=r.charAt(n)}function O(){var e="",t=n;if("+"===i?M():"-"===i&&(e+=i,M()),!function(e){return e>="0"&&e<="9"||"."===e}(i))return F(t),null;if("."===i){if(e+=i,M(),!C(i))return F(t),null}else{for(;C(i);)e+=i,M();"."===i&&(e+=i,M())}for(;C(i);)e+=i,M();if("E"===i||"e"===i){var r="",a=n;if(r+=i,M(),"+"!==i&&"-"!==i||(r+=i,M()),!C(i))return F(a),e;for(e+=r;C(i);)e+=i,M()}return e}function T(){for(var e="";C(i)||A.isValidAlpha(i);)e+=i,M();var t=e.charAt(0);return A.isValidAlpha(t)?e:null}function B(e){return i===e?(M(),e):null}Object.defineProperty(A,"name",{value:"Unit"}),A.prototype.constructor=A,A.prototype.type="Unit",A.prototype.isUnit=!0,A.parse=function(e,t){if(t=t||{},n=-1,i="","string"!=typeof(r=e))throw new TypeError("Invalid argument in Unit.parse, string expected");var a=new A;a.units=[];var o=1,s=!1;M(),S();var c=O(),f=null;if(c){if("BigNumber"===u.number)f=new N(c);else if("Fraction"===u.number)try{f=new D(c)}catch(e){f=parseFloat(c)}else f=parseFloat(c);S(),B("*")?(o=1,s=!0):B("/")&&(o=-1,s=!0)}for(var l=[],p=1;;){for(S();"("===i;)l.push(o),p*=o,o=1,M(),S();var m;if(!i)break;var h=i;if(null===(m=T()))throw new SyntaxError('Unexpected "'+h+'" in "'+r+'" at index '+n.toString());var d=_(m);if(null===d)throw new SyntaxError('Unit "'+m+'" not found.');var v=o*p;if(S(),B("^")){S();var y=O();if(null===y)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');v*=y}a.units.push({unit:d.unit,prefix:d.prefix,power:v});for(var g=0;g1||Math.abs(this.units[0].power-1)>1e-15)},A.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;for(var t=e,r=A._getNumberConverter(H(e)),n=0;n1e-12)return!1;return!0},A.prototype.equalBase=function(e){for(var t=0;t1e-12)return!1;return!0},A.prototype.equals=function(e){return this.equalBase(e)&&y(this.value,e.value)},A.prototype.multiply=function(e){for(var t=this.clone(),r=s(e)?e:new A(e),n=0;n1e-12&&(Ne(G,u)?n.push({unit:G[u].unit,prefix:G[u].prefix,power:r.dimensions[o]||0}):a=!0)}n.length1e-12){if(!Ne($.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:$.si[n].unit,prefix:$.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,e},A.prototype.formatUnits=function(){for(var e="",t="",r=0,n=0,i=0;i0?(r++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var a=0;a0?(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(t+="^"+-this.units[a].power)):(t+=" "+this.units[a].prefix.name+this.units[a].unit.name,t+="^"+this.units[a].power));e=e.substr(1),t=t.substr(1),r>1&&n>0&&(e="("+e+")"),n>1&&r>0&&(t="("+t+")");var o=e;return r>0&&n>0&&(o+=" / "),o+t},A.prototype.format=function(e){var t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),r=!1;for(var n in void 0!==t.value&&null!==t.value&&o(t.value)&&(r=Math.abs(t.value.re)<1e-14),t.units)Ne(t.units,n)&&t.units[n].unit&&("VA"===t.units[n].unit.name&&r?t.units[n].unit=P.VAR:"VAR"!==t.units[n].unit.name||r||(t.units[n].unit=P.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());var i=t._denormalize(t.value),a=null!==t.value?x(i,e||{}):"",u=t.formatUnits();return t.value&&o(t.value)&&(a="("+a+")"),u.length>0&&a.length>0&&(a+=" "),a+u},A.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!");var e=null!==this.value?h(this.value):0,t=h(this.units[0].unit.value),r=this.units[0].prefix;if(0===e)return r;var n=this.units[0].power,i=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return r;i=Math.abs(i);var a=this.units[0].unit.prefixes;for(var o in a)if(Ne(a,o)){var u=a[o];if(u.scientific){var s=Math.abs(Math.log(e/Math.pow(u.value*t,n))/Math.LN10-1.2);(s0&&!A.isValidAlpha(i)&&!C(i))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);var n,a,o,u=null,s=[],c=0;if(r&&"Unit"===r.type)u=r.clone();else if("string"==typeof r)""!==r&&(n=r);else{if("object"!==t(r))throw new TypeError('Cannot create unit "'+e+'" from "'+r.toString()+'": expecting "string" or "Unit" or "Object"');n=r.definition,a=r.prefixes,c=r.offset,o=r.baseName,r.aliases&&(s=r.aliases.valueOf())}if(s)for(var f=0;f1e-12){h=!1;break}if(h){p=!0,l.base=z[m];break}}if(!p){o=o||e+"_STUFF";var v={dimensions:u.dimensions.slice(0)};v.key=o,z[o]=v,G[o]={unit:l,prefix:I.NONE[""]},l.base=z[o]}}else{if(o=o||e+"_STUFF",R.indexOf(o)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');for(var y in R.push(o),z)Ne(z,y)&&(z[y].dimensions[R.length-1]=0);for(var g={dimensions:[]},x=0;x=-1&&e<=1||r.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),Df="number";function Ef(e){return se(e)}function Af(e){return Math.atan(1/e)}function Sf(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function Cf(e){return Math.asin(1/e)}function Mf(e){var t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function Ff(e){return Math.acos(1/e)}function Of(e){var t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}function Tf(e){return ce(e)}function Bf(e){return fe(e)}function _f(e){return 1/Math.tan(e)}function kf(e){var t=Math.exp(2*e);return(t+1)/(t-1)}function If(e){return 1/Math.sin(e)}function Rf(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*Z(e)}function zf(e){return 1/Math.cos(e)}function qf(e){return 2/(Math.exp(e)+Math.exp(-e))}function jf(e){return pe(e)}Ef.signature=Df,Af.signature=Df,Sf.signature=Df,Cf.signature=Df,Mf.signature=Df,Ff.signature=Df,Of.signature=Df,Tf.signature=Df,Bf.signature=Df,_f.signature=Df,kf.signature=Df,If.signature=Df,Rf.signature=Df,zf.signature=Df,qf.signature=Df,jf.signature=Df;var Pf="acosh",Lf=Ee(Pf,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(Pf,{number:function(e){return e>=1||r.predictable?Ef(e):e<=-1?new n(Math.log(Math.sqrt(e*e-1)-e),Math.PI):new n(e,0).acosh()},Complex:function(e){return e.acosh()},BigNumber:function(e){return e.acosh()}})})),Uf="acot",$f=Ee(Uf,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(Uf,{number:Af,Complex:function(e){return e.acot()},BigNumber:function(e){return new r(1).div(e).atan()}})})),Hf="acoth",Gf=Ee(Hf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Hf,{number:function(e){return e>=1||e<=-1||r.predictable?Sf(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),Vf="acsc",Zf=Ee(Vf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Vf,{number:function(e){return e<=-1||e>=1||r.predictable?Cf(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),Wf="acsch",Yf=Ee(Wf,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(Wf,{number:Mf,Complex:function(e){return e.acsch()},BigNumber:function(e){return new r(1).div(e).asinh()}})})),Jf="asec",Xf=Ee(Jf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Jf,{number:function(e){return e<=-1||e>=1||r.predictable?Ff(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),Qf="asech",Kf=Ee(Qf,["typed","config","Complex","BigNumber"],(function(e){var t=e.typed,r=e.config,n=e.Complex,i=e.BigNumber;return t(Qf,{number:function(e){if(e<=1&&e>=-1||r.predictable){var t=1/e;if(t>0||r.predictable)return Of(e);var i=Math.sqrt(t*t-1);return new n(Math.log(i-t),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),el="asin",tl=Ee(el,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(el,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),rl=Ee("asinh",["typed"],(function(e){return(0,e.typed)("asinh",{number:Tf,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),nl=Ee("atan",["typed"],(function(e){return(0,e.typed)("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),il="atan2",al=Ee(il,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(function(e){var t=e.typed,r=e.matrix,n=e.equalScalar,i=e.BigNumber,a=e.DenseMatrix,o=e.concat,u=Va({typed:t,equalScalar:n}),s=Ka({typed:t}),c=xo({typed:t,equalScalar:n}),f=pa({typed:t,equalScalar:n}),l=ma({typed:t,DenseMatrix:a}),p=ja({typed:t,matrix:r,concat:o});return t(il,{"number, number":Math.atan2,"BigNumber, BigNumber":function(e,t){return i.atan2(e,t)}},p({scalar:"number | BigNumber",SS:c,DS:s,SD:u,Ss:f,sS:l}))})),ol="atanh",ul=Ee(ol,["typed","config","Complex"],(function(e){var t=e.typed,r=e.config,n=e.Complex;return t(ol,{number:function(e){return e<=1&&e>=-1||r.predictable?Bf(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),sl=Ee("trigUnit",["typed"],(function(e){var t=e.typed;return{Unit:t.referToSelf((function(e){return function(r){if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(e,r.valueType())(r.value)}}))}})),cl=Ee("cos",["typed"],(function(e){var t=e.typed,r=sl({typed:t});return t("cos",{number:Math.cos,"Complex | BigNumber":function(e){return e.cos()}},r)})),fl="cosh",ll=Ee(fl,["typed"],(function(e){return(0,e.typed)(fl,{number:le,"Complex | BigNumber":function(e){return e.cosh()}})})),pl=Ee("cot",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("cot",{number:_f,Complex:function(e){return e.cot()},BigNumber:function(e){return new r(1).div(e.tan())}},sl({typed:t}))})),ml="coth",hl=Ee(ml,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(ml,{number:kf,Complex:function(e){return e.coth()},BigNumber:function(e){return new r(1).div(e.tanh())}})})),dl=Ee("csc",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("csc",{number:If,Complex:function(e){return e.csc()},BigNumber:function(e){return new r(1).div(e.sin())}},sl({typed:t}))})),vl="csch",yl=Ee(vl,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(vl,{number:Rf,Complex:function(e){return e.csch()},BigNumber:function(e){return new r(1).div(e.sinh())}})})),gl=Ee("sec",["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t("sec",{number:zf,Complex:function(e){return e.sec()},BigNumber:function(e){return new r(1).div(e.cos())}},sl({typed:t}))})),xl="sech",bl=Ee(xl,["typed","BigNumber"],(function(e){var t=e.typed,r=e.BigNumber;return t(xl,{number:qf,Complex:function(e){return e.sech()},BigNumber:function(e){return new r(1).div(e.cosh())}})})),wl=Ee("sin",["typed"],(function(e){var t=e.typed,r=sl({typed:t});return t("sin",{number:Math.sin,"Complex | BigNumber":function(e){return e.sin()}},r)})),Nl="sinh",Dl=Ee(Nl,["typed"],(function(e){return(0,e.typed)(Nl,{number:jf,"Complex | BigNumber":function(e){return e.sinh()}})})),El=Ee("tan",["typed"],(function(e){var t=e.typed,r=sl({typed:t});return t("tan",{number:Math.tan,"Complex | BigNumber":function(e){return e.tan()}},r)})),Al=Ee("tanh",["typed"],(function(e){return(0,e.typed)("tanh",{number:me,"Complex | BigNumber":function(e){return e.tanh()}})})),Sl="setCartesian",Cl=Ee(Sl,["typed","size","subset","compareNatural","Index","DenseMatrix"],(function(e){var t=e.typed,r=e.size,n=e.subset,i=e.compareNatural,a=e.Index,o=e.DenseMatrix;return t(Sl,{"Array | Matrix, Array | Matrix":function(e,t){var u=[];if(0!==n(r(e),new a(0))&&0!==n(r(t),new a(0))){var s=mn(Array.isArray(e)?e:e.toArray()).sort(i),c=mn(Array.isArray(t)?t:t.toArray()).sort(i);u=[];for(var f=0;f0;r--)for(var n=0;ne[n+1].length&&(t=e[n],e[n]=e[n+1],e[n+1]=t);return e}(u)}});function o(e,t){for(var r=[],n=0;nd?m++:h===d&&(c=f(c,l(a[p],s[m])),p++,m++)}return c}});function o(e,t){var r,n,i=u(e),a=u(t);if(1===i.length)r=i[0];else{if(2!==i.length||1!==i[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");r=i[0]}if(1===a.length)n=a[0];else{if(2!==a.length||1!==a[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+a.join(", ")+")");n=a[0]}if(r!==n)throw new RangeError("Vectors must have equal length ("+r+" != "+n+")");if(0===r)throw new RangeError("Cannot calculate the dot product of empty vectors");return r}function u(e){return l(e)?e.size():a(e)}})),Ql=Ee("trace",["typed","matrix","add"],(function(e){var t=e.typed,r=e.matrix,n=e.add;return t("trace",{Array:function(e){return i(r(e))},SparseMatrix:function(e){var t=e._values,r=e._index,i=e._ptr,a=e._size,o=a[0],u=a[1];if(o===u){var s=0;if(t.length>0)for(var c=0;cc)break}return s}throw new RangeError("Matrix must be square (size: "+Vr(a)+")")},DenseMatrix:i,any:he});function i(e){var t=e._size,r=e._data;switch(t.length){case 1:if(1===t[0])return he(r[0]);throw new RangeError("Matrix must be square (size: "+Vr(t)+")");case 2:var i=t[0];if(i===t[1]){for(var a=0,o=0;o)'),t+this.index.toHTML(e)}},{key:"_toTex",value:function(e){var t=this.object.toTex(e);return i(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)}},{key:"toJSON",value:function(){return{mathjs:cp,object:this.object,index:this.index}}}],[{key:"fromJSON",value:function(e){return new o(e.object,e.index)}}]),o}(r);return Ba(a,"name",cp),a}),{isClass:!0,isNode:!0});var lp="ArrayNode",pp=Ee(lp,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e){var t;if(Ce(this,i),(t=n.call(this)).items=e||[],!Array.isArray(t.items)||!t.items.every(R))throw new TypeError("Array containing Nodes expected");return t}return Oe(i,[{key:"type",get:function(){return lp}},{key:"isArrayNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=hn(this.items,(function(r){return r._compile(e,t)}));if("Array"!==e.config.matrix){var n=e.matrix;return function(e,t,i){return n(hn(r,(function(r){return r(e,t,i)})))}}return function(e,t,n){return hn(r,(function(r){return r(e,t,n)}))}}},{key:"forEach",value:function(e){for(var t=0;t['+this.items.map((function(t){return t.toHTML(e)})).join(',')+']'}},{key:"_toTex",value:function(e){return function t(r,n){var i=r.some(C)&&!r.every(C),a=n||i,o=a?"&":"\\\\",u=r.map((function(r){return r.items?t(r.items,!n):r.toTex(e)})).join(o);return i||!a||a&&!n?"\\begin{bmatrix}"+u+"\\end{bmatrix}":u}(this.items,!1)}}],[{key:"fromJSON",value:function(e){return new i(e.items)}}]),i}(e.Node);return Ba(t,"name",lp),t}),{isClass:!0,isNode:!0});function mp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r",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 dp(e,t){if(!t||"auto"!==t)return e;for(var r=e;j(r);)r=r.content;return r}function vp(e,t,r,n){var i=e;"keep"!==t&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,u=0;u)'),t+r+'='+n}},{key:"_toTex",value:function(e){var t=this.object.toTex(e),r=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(n="\\left(".concat(n,"\\right)")),t+r+":="+n}}],[{key:"fromJSON",value:function(e){return new i(e.object,e.index,e.value)}}]),i}(i);return Ba(s,"name",xp),s}),{isClass:!0,isNode:!0});var wp="BlockNode",Np=Ee(wp,["ResultSet","Node"],(function(e){var t=e.ResultSet,r=function(e){ip(a,e);var r,n,i=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=op(r);if(n){var i=op(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ap(this,e)});function a(e){var t;if(Ce(this,a),t=i.call(this),!Array.isArray(e))throw new Error("Array expected");return t.blocks=e.map((function(e){var t=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!R(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:r}})),t}return Oe(a,[{key:"type",get:function(){return wp}},{key:"isBlockNode",get:function(){return!0}},{key:"_compile",value:function(e,r){var n=hn(this.blocks,(function(t){return{evaluate:t.node._compile(e,r),visible:t.visible}}));return function(e,r,i){var a=[];return dn(n,(function(t){var n=t.evaluate(e,r,i);t.visible&&a.push(n)})),new t(a)}}},{key:"forEach",value:function(e){for(var t=0;t;')})).join('
')}},{key:"_toTex",value:function(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")}}],[{key:"fromJSON",value:function(e){return new a(e.blocks)}}]),a}(e.Node);return Ba(r,"name",wp),r}),{isClass:!0,isNode:!0});var Dp="ConditionalNode",Ep=Ee(Dp,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e,t,r){var a;if(Ce(this,i),a=n.call(this),!R(e))throw new TypeError("Parameter condition must be a Node");if(!R(t))throw new TypeError("Parameter trueExpr must be a Node");if(!R(r))throw new TypeError("Parameter falseExpr must be a Node");return a.condition=e,a.trueExpr=t,a.falseExpr=r,a}return Oe(i,[{key:"type",get:function(){return Dp}},{key:"isConditionalNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=this.condition._compile(e,t),n=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,u){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(a(e))return!e.isZero();if(o(e))return!(!e.re&&!e.im);if(s(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+H(e)+'"')}(r(e,t,u))?n(e,t,u):i(e,t,u)}}},{key:"forEach",value:function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}},{key:"map",value:function(e){return new i(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}},{key:"clone",value:function(){return new i(this.condition,this.trueExpr,this.falseExpr)}},{key:"_toString",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=vp(this,t,e&&e.implicit),n=this.condition.toString(e),i=vp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n="("+n+")");var a=this.trueExpr.toString(e),o=vp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a="("+a+")");var u=this.falseExpr.toString(e),s=vp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==s&&s<=r)&&(u="("+u+")"),n+" ? "+a+" : "+u}},{key:"toJSON",value:function(){return{mathjs:Dp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}},{key:"toHTML",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=vp(this,t,e&&e.implicit),n=this.condition.toHTML(e),i=vp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n='('+n+')');var a=this.trueExpr.toHTML(e),o=vp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=r)&&(a='('+a+')');var u=this.falseExpr.toHTML(e),s=vp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==s&&s<=r)&&(u='('+u+')'),n+'?'+a+':'+u}},{key:"_toTex",value:function(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}],[{key:"fromJSON",value:function(e){return new i(e.condition,e.trueExpr,e.falseExpr)}}]),i}(e.Node);return Ba(t,"name",Dp),t}),{isClass:!0,isNode:!0}),Ap=r(7928),Sp={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{?}"},Cp={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"},Mp={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Cp.add,"${args[1]}\\right)")},cbrt:{1:"\\sqrt[3]{${args[0]}}"},ceil:{1:"\\left\\lceil${args[0]}\\right\\rceil"},cube:{1:"\\left(${args[0]}\\right)^3"},divide:{2:"\\frac{${args[0]}}{${args[1]}}"},dotDivide:{2:"\\left(${args[0]}".concat(Cp.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Cp.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Cp.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Cp.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]}".concat(Cp.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Cp.multiply,"${args[1]}\\right)")},norm:{1:"\\left\\|${args[0]}\\right\\|",2:void 0},nthRoot:{2:"\\sqrt[${args[1]}]{${args[0]}}"},nthRoots:{2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},pow:{2:"\\left(${args[0]}\\right)".concat(Cp.pow,"{${args[1]}}")},round:{1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},sign:{1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},sqrt:{1:"\\sqrt{${args[0]}}"},square:{1:"\\left(${args[0]}\\right)^2"},subtract:{2:"\\left(${args[0]}".concat(Cp.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Cp.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Cp.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Cp.bitAnd,"${args[1]}\\right)")},bitNot:{1:Cp.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Cp.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Cp.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Cp.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Cp.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Cp.rightLogShift,"${args[1]}\\right)")},bellNumbers:{1:"\\mathrm{B}_{${args[0]}}"},catalan:{1:"\\mathrm{C}_{${args[0]}}"},stirlingS2:{2:"\\mathrm{S}\\left(${args}\\right)"},arg:{1:"\\arg\\left(${args[0]}\\right)"},conj:{1:"\\left(${args[0]}\\right)^*"},im:{1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},re:{1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},and:{2:"\\left(${args[0]}".concat(Cp.and,"${args[1]}\\right)")},not:{1:Cp.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Cp.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Cp.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Cp.ctranspose)},det:{1:"\\det\\left(${args[0]}\\right)"},dot:{2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},expm:{1:"\\exp\\left(${args[0]}\\right)"},inv:{1:"\\left(${args[0]}\\right)^{-1}"},pinv:{1:"\\left(${args[0]}\\right)^{+}"},sqrtm:{1:"{${args[0]}}".concat(Cp.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Cp.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Cp.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Cp.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Cp.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Cp.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Cp.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Cp.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Cp.unequal,"${args[1]}\\right)")},erf:{1:"erf\\left(${args[0]}\\right)"},max:"\\max\\left(${args}\\right)",min:"\\min\\left(${args}\\right)",variance:"\\mathrm{Var}\\left(${args}\\right)",acos:{1:"\\cos^{-1}\\left(${args[0]}\\right)"},acosh:{1:"\\cosh^{-1}\\left(${args[0]}\\right)"},acot:{1:"\\cot^{-1}\\left(${args[0]}\\right)"},acoth:{1:"\\coth^{-1}\\left(${args[0]}\\right)"},acsc:{1:"\\csc^{-1}\\left(${args[0]}\\right)"},acsch:{1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},asec:{1:"\\sec^{-1}\\left(${args[0]}\\right)"},asech:{1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},asin:{1:"\\sin^{-1}\\left(${args[0]}\\right)"},asinh:{1:"\\sinh^{-1}\\left(${args[0]}\\right)"},atan:{1:"\\tan^{-1}\\left(${args[0]}\\right)"},atan2:{2:"\\mathrm{atan2}\\left(${args}\\right)"},atanh:{1:"\\tanh^{-1}\\left(${args[0]}\\right)"},cos:{1:"\\cos\\left(${args[0]}\\right)"},cosh:{1:"\\cosh\\left(${args[0]}\\right)"},cot:{1:"\\cot\\left(${args[0]}\\right)"},coth:{1:"\\coth\\left(${args[0]}\\right)"},csc:{1:"\\csc\\left(${args[0]}\\right)"},csch:{1:"\\mathrm{csch}\\left(${args[0]}\\right)"},sec:{1:"\\sec\\left(${args[0]}\\right)"},sech:{1:"\\mathrm{sech}\\left(${args[0]}\\right)"},sin:{1:"\\sin\\left(${args[0]}\\right)"},sinh:{1:"\\sinh\\left(${args[0]}\\right)"},tan:{1:"\\tan\\left(${args[0]}\\right)"},tanh:{1:"\\tanh\\left(${args[0]}\\right)"},to:{2:"\\left(${args[0]}".concat(Cp.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)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(Sp.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)"}},Fp={deg:"^\\circ"};function Op(e){return Ap(e,{preserveFormatting:!0})}function Tp(e,t){return(t=void 0!==t&&t)?Ne(Fp,e)?Fp[e]:"\\mathrm{"+Op(e)+"}":Ne(Sp,e)?Sp[e]:Op(e)}var Bp="ConstantNode",_p=Ee(Bp,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e){var t;return Ce(this,i),(t=n.call(this)).value=e,t}return Oe(i,[{key:"type",get:function(){return Bp}},{key:"isConstantNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=this.value;return function(){return r}}},{key:"forEach",value:function(e){}},{key:"map",value:function(e){return this.clone()}},{key:"clone",value:function(){return new i(this.value)}},{key:"_toString",value:function(e){return Vr(this.value,e)}},{key:"toHTML",value:function(e){var t=this._toString(e);switch(H(this.value)){case"number":case"BigNumber":case"Fraction":return''+t+"";case"string":return''+t+"";case"boolean":return''+t+"";case"null":return''+t+"";case"undefined":return''+t+"";default:return''+t+""}}},{key:"toJSON",value:function(){return{mathjs:Bp,value:this.value}}},{key:"_toTex",value:function(e){var t=this._toString(e);switch(H(this.value)){case"string":return"\\mathtt{"+Op(t)+"}";case"number":case"BigNumber":if(!isFinite(this.value))return this.value.valueOf()<0?"-\\infty":"\\infty";var r=t.toLowerCase().indexOf("e");return-1!==r?t.substring(0,r)+"\\cdot10^{"+t.substring(r+1)+"}":t;case"Fraction":return this.value.toLatex();default:return t}}}],[{key:"fromJSON",value:function(e){return new i(e.value)}}]),i}(e.Node);return Ba(t,"name",Bp),t}),{isClass:!0,isNode:!0});function kp(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(t);try{for(s.s();!(i=s.n()).done;){var c=i.value,f="string"==typeof c?c:c.name;if(u.has(f))throw new Error('Duplicate parameter name "'.concat(f,'"'));u.add(f)}}catch(e){s.e(e)}finally{s.f()}return n.name=e,n.params=t.map((function(e){return e&&e.name||e})),n.types=t.map((function(e){return e&&e.type||"any"})),n.expr=r,n}return Oe(o,[{key:"type",get:function(){return Ip}},{key:"isFunctionAssignmentNode",get:function(){return!0}},{key:"_compile",value:function(e,r){var n=Object.create(r);dn(this.params,(function(e){n[e]=!0}));var i=this.expr._compile(e,n),a=this.name,o=this.params,u=gn(this.types,","),s=a+"("+gn(this.params,", ")+")";return function(e,r,n){var c={};c[u]=function(){for(var t=Object.create(r),a=0;a'+Wr(this.params[i])+"");var a=this.expr.toHTML(e);return r(this,t,e&&e.implicit)&&(a='('+a+')'),''+Wr(this.name)+'('+n.join(',')+')='+a}},{key:"_toTex",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=this.expr.toTex(e);return r(this,t,e&&e.implicit)&&(n="\\left(".concat(n,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(Tp).join(",")+"\\right):="+n}}],[{key:"fromJSON",value:function(e){return new o(e.name,e.params,e.expr)}}]),o}(e.Node);return Ba(n,"name",Ip),n}),{isClass:!0,isNode:!0});var zp="IndexNode",qp=Ee(zp,["Node","size"],(function(e){var t=e.Node,r=e.size,n=function(e){ip(a,e);var t,n,i=(t=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=op(t);if(n){var i=op(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return ap(this,e)});function a(e,t){var r;if(Ce(this,a),(r=i.call(this)).dimensions=e,r.dotNotation=t||!1,!Array.isArray(e)||!e.every(R))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(r.dotNotation&&!r.isObjectProperty())throw new Error("dotNotation only applicable for object properties");return r}return Oe(a,[{key:"type",get:function(){return zp}},{key:"isIndexNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var n=hn(this.dimensions,(function(n,i){if(n.filter((function(e){return e.isSymbolNode&&"end"===e.name})).length>0){var a=Object.create(t);a.end=!0;var o=n._compile(e,a);return function(e,t,n){if(!l(n)&&!f(n)&&!c(n))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+H(n));var a=r(n).valueOf(),u=Object.create(t);return u.end=a[i],o(e,u,n)}}return n._compile(e,t)})),i=Te(e,"index");return function(e,t,r){var a=hn(n,(function(n){return n(e,t,r)}));return i.apply(void 0,_a(a))}}},{key:"forEach",value:function(e){for(var t=0;t.'+Wr(this.getObjectProperty())+"":'['+t.join(',')+']'}},{key:"_toTex",value:function(e){var t=this.dimensions.map((function(t){return t.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"}}],[{key:"fromJSON",value:function(e){return new a(e.dimensions,e.dotNotation)}}]),a}(t);return Ba(n,"name",zp),n}),{isClass:!0,isNode:!0});var jp="ObjectNode",Pp=Ee(jp,["Node"],(function(e){var r=function(e){ip(a,e);var r,n,i=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=op(r);if(n){var i=op(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ap(this,e)});function a(e){var r;if(Ce(this,a),(r=i.call(this)).properties=e||{},e&&("object"!==t(e)||!Object.keys(e).every((function(t){return R(e[t])}))))throw new TypeError("Object containing Nodes expected");return r}return Oe(a,[{key:"type",get:function(){return jp}},{key:"isObjectNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r={};for(var n in this.properties)if(Ne(this.properties,n)){var i=Zr(n),a=JSON.parse(i),o=Te(this.properties,n);r[a]=o._compile(e,t)}return function(e,t,n){var i={};for(var a in r)Ne(r,a)&&(i[a]=r[a](e,t,n));return i}}},{key:"forEach",value:function(e){for(var t in this.properties)Ne(this.properties,t)&&e(this.properties[t],"properties["+Zr(t)+"]",this)}},{key:"map",value:function(e){var t={};for(var r in this.properties)Ne(this.properties,r)&&(t[r]=this._ifNode(e(this.properties[r],"properties["+Zr(r)+"]",this)));return new a(t)}},{key:"clone",value:function(){var e={};for(var t in this.properties)Ne(this.properties,t)&&(e[t]=this.properties[t]);return new a(e)}},{key:"_toString",value:function(e){var t=[];for(var r in this.properties)Ne(this.properties,r)&&t.push(Zr(r)+": "+this.properties[r].toString(e));return"{"+t.join(", ")+"}"}},{key:"toJSON",value:function(){return{mathjs:jp,properties:this.properties}}},{key:"toHTML",value:function(e){var t=[];for(var r in this.properties)Ne(this.properties,r)&&t.push(''+Wr(r)+':'+this.properties[r].toHTML(e));return'{'+t.join(',')+'}'}},{key:"_toTex",value:function(e){var t=[];for(var r in this.properties)Ne(this.properties,r)&&t.push("\\mathbf{"+r+":} & "+this.properties[r].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"}}],[{key:"fromJSON",value:function(e){return new a(e.properties)}}]),a}(e.Node);return Ba(r,"name",jp),r}),{isClass:!0,isNode:!0});var Lp="OperatorNode",Up=Ee(Lp,["Node"],(function(e){function t(e,r){var n=e;if("auto"===r)for(;j(n);)n=n.content;return!!T(n)||!!q(n)&&t(n.args[0],r)}function r(e,r,n,i,a){var o,u=vp(e,r,n),s=yp(e,r);if("all"===r||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}}));switch(i.length){case 0:o=[];break;case 1:var c=vp(i[0],r,n,e);if(a&&null!==c){var f,l;if("keep"===r?(f=i[0].getIdentifier(),l=e.getIdentifier()):(f=i[0].getContent().getIdentifier(),l=e.getContent().getIdentifier()),!1===hp[u][l].latexLeftParens){o=[!1];break}if(!1===hp[c][f].latexParens){o=[!1];break}}if(null===c){o=[!1];break}if(c<=u){o=[!0];break}o=[!1];break;case 2:var p,m,h=vp(i[0],r,n,e),d=gp(e,i[0],r);p=null!==h&&(h===u&&"right"===s&&!d||h=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==r&&"hide"===n)for(var w=1;w2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var l=i.map((function(t,r){return t=t.toString(e),a[r]&&(t="("+t+")"),t}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?l.join(" "):l.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}},{key:"toJSON",value:function(){return{mathjs:Lp,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}},{key:"toHTML",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,a=r(this,t,n,i,!1);if(1===i.length){var o=yp(this,t),u=i[0].toHTML(e);return a[0]&&(u='('+u+')'),"right"===o?''+Wr(this.op)+""+u:u+''+Wr(this.op)+""}if(2===i.length){var s=i[0].toHTML(e),c=i[1].toHTML(e);return a[0]&&(s='('+s+')'),a[1]&&(c='('+c+')'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?s+''+c:s+''+Wr(this.op)+""+c}var f=i.map((function(t,r){return t=t.toHTML(e),a[r]&&(t='('+t+')'),t}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===n?f.join(''):f.join(''+Wr(this.op)+""):''+Wr(this.fn)+'('+f.join(',')+')'}},{key:"_toTex",value:function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=e&&e.implicit?e.implicit:"hide",i=this.args,a=r(this,t,n,i,!0),o=Cp[this.fn];if(o=void 0===o?this.op:o,1===i.length){var u=yp(this,t),s=i[0].toTex(e);return a[0]&&(s="\\left(".concat(s,"\\right)")),"right"===u?o+s:s+o}if(2===i.length){var c=i[0],f=c.toTex(e);a[0]&&(f="\\left(".concat(f,"\\right)"));var l,p=i[1].toTex(e);switch(a[1]&&(p="\\left(".concat(p,"\\right)")),l="keep"===t?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+f+"}{"+p+"}";case"OperatorNode:pow":switch(f="{"+f+"}",p="{"+p+"}",l){case"ConditionalNode":case"OperatorNode:divide":f="\\left(".concat(f,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===n)return f+"~"+p}return f+o+p}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var m=i.map((function(t,r){return t=t.toTex(e),a[r]&&(t="\\left(".concat(t,"\\right)")),t}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===n?m.join("~"):m.join(o)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(t){return t.toTex(e)})).join(",")+"\\right)"}},{key:"getIdentifier",value:function(){return this.type+":"+this.fn}}],[{key:"fromJSON",value:function(e){return new a(e.op,e.fn,e.args,e.implicit,e.isPercentage)}}]),a}(e.Node);return Ba(n,"name",Lp),n}),{isClass:!0,isNode:!0});var $p="ParenthesisNode",Hp=Ee($p,["Node"],(function(e){var t=function(e){ip(i,e);var t,r,n=(t=i,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=op(t);if(r){var i=op(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return ap(this,e)});function i(e){var t;if(Ce(this,i),t=n.call(this),!R(e))throw new TypeError('Node expected for parameter "content"');return t.content=e,t}return Oe(i,[{key:"type",get:function(){return $p}},{key:"isParenthesisNode",get:function(){return!0}},{key:"_compile",value:function(e,t){return this.content._compile(e,t)}},{key:"getContent",value:function(){return this.content.getContent()}},{key:"forEach",value:function(e){e(this.content,"content",this)}},{key:"map",value:function(e){return new i(e(this.content,"content",this))}},{key:"clone",value:function(){return new i(this.content)}},{key:"_toString",value:function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}},{key:"toJSON",value:function(){return{mathjs:$p,content:this.content}}},{key:"toHTML",value:function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'('+this.content.toHTML(e)+')':this.content.toHTML(e)}},{key:"_toTex",value:function(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)}}],[{key:"fromJSON",value:function(e){return new i(e.content)}}]),i}(e.Node);return Ba(t,"name",$p),t}),{isClass:!0,isNode:!0});var Gp="RangeNode",Vp=Ee(Gp,["Node"],(function(e){function t(e,t,r){var n=vp(e,t,r),i={},a=vp(e.start,t,r);if(i.start=null!==a&&a<=n||"all"===t,e.step){var o=vp(e.step,t,r);i.step=null!==o&&o<=n||"all"===t}var u=vp(e.end,t,r);return i.end=null!==u&&u<=n||"all"===t,i}var r=function(e){ip(a,e);var r,n,i=(r=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=op(r);if(n){var i=op(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return ap(this,e)});function a(e,t,r){var n;if(Ce(this,a),n=i.call(this),!R(e))throw new TypeError("Node expected");if(!R(t))throw new TypeError("Node expected");if(r&&!R(r))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");return n.start=e,n.end=t,n.step=r||null,n}return Oe(a,[{key:"type",get:function(){return Gp}},{key:"isRangeNode",get:function(){return!0}},{key:"needsEnd",value:function(){return this.filter((function(e){return U(e)&&"end"===e.name})).length>0}},{key:"_compile",value:function(e,t){var r=e.range,n=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){var a=this.step._compile(e,t);return function(e,t,o){return r(n(e,t,o),i(e,t,o),a(e,t,o))}}return function(e,t,a){return r(n(e,t,a),i(e,t,a))}}},{key:"forEach",value:function(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}},{key:"map",value:function(e){return new a(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))}},{key:"clone",value:function(){return new a(this.start,this.end,this.step&&this.step)}},{key:"_toString",value:function(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toString(e);if(n.start&&(i="("+i+")"),r=i,this.step){var a=this.step.toString(e);n.step&&(a="("+a+")"),r+=":"+a}var o=this.end.toString(e);return n.end&&(o="("+o+")"),r+":"+o}},{key:"toJSON",value:function(){return{mathjs:Gp,start:this.start,end:this.end,step:this.step}}},{key:"toHTML",value:function(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toHTML(e);if(n.start&&(i='('+i+')'),r=i,this.step){var a=this.step.toHTML(e);n.step&&(a='('+a+')'),r+=':'+a}var o=this.end.toHTML(e);return n.end&&(o='('+o+')'),r+':'+o}},{key:"_toTex",value:function(e){var r=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),n=this.start.toTex(e);if(r.start&&(n="\\left(".concat(n,"\\right)")),this.step){var i=this.step.toTex(e);r.step&&(i="\\left(".concat(i,"\\right)")),n+=":"+i}var a=this.end.toTex(e);return r.end&&(a="\\left(".concat(a,"\\right)")),n+":"+a}}],[{key:"fromJSON",value:function(e){return new a(e.start,e.end,e.step)}}]),a}(e.Node);return Ba(r,"name",Gp),r}),{isClass:!0,isNode:!0});var Zp="RelationalNode",Wp=Ee(Zp,["Node"],(function(e){var t=e.Node,r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},n=function(e){ip(a,e);var t,n,i=(t=a,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=op(t);if(n){var i=op(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return ap(this,e)});function a(e,t){var r;if(Ce(this,a),r=i.call(this),!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");return r.conditionals=e,r.params=t,r}return Oe(a,[{key:"type",get:function(){return Zp}},{key:"isRelationalNode",get:function(){return!0}},{key:"_compile",value:function(e,t){var r=this,n=this.params.map((function(r){return r._compile(e,t)}));return function(t,i,a){for(var o,u=n[0](t,i,a),s=0;s('+r.toHTML(e)+')':r.toHTML(e)})),a=i[0],o=0;o'+Wr(r[this.conditionals[o]])+""+i[o+1];return a}},{key:"_toTex",value:function(e){for(var t=e&&e.parenthesis?e.parenthesis:"keep",r=vp(this,t,e&&e.implicit),n=this.params.map((function(n,i){var a=vp(n,t,e&&e.implicit);return"all"===t||null!==a&&a<=r?"\\left("+n.toTex(e)+"\right)":n.toTex(e)})),i=n[0],a=0;a'+t+"":"i"===t?''+t+"":"Infinity"===t?''+t+"":"NaN"===t?''+t+"":"null"===t?''+t+"":"undefined"===t?''+t+"":''+t+""}},{key:"toJSON",value:function(){return{mathjs:"SymbolNode",name:this.name}}},{key:"_toTex",value:function(e){var r=!1;void 0===t[this.name]&&n(this.name)&&(r=!0);var i=Tp(this.name,r);return"\\"===i[0]?i:" "+i}}],[{key:"onUndefinedSymbol",value:function(e){throw new Error("Undefined symbol "+e)}},{key:"fromJSON",value:function(e){return new u(e.name)}}]),u}(e.Node);return i}),{isClass:!0,isNode:!0});function Jp(){return Jp="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=op(e)););return e}(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},Jp.apply(this,arguments)}function Xp(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n'+Wr(this.fn)+'('+t.join(',')+')'}},{key:"toTex",value:function(e){var r;return e&&"object"===t(e.handler)&&Ne(e.handler,this.name)&&(r=e.handler[this.name](this,e)),void 0!==r?r:Jp(op(c.prototype),"toTex",this).call(this,e)}},{key:"_toTex",value:function(e){var n,i,a=this.args.map((function(t){return t.toTex(e)}));switch(Mp[this.name]&&(n=Mp[this.name]),!r[this.name]||"function"!=typeof r[this.name].toTex&&"object"!==t(r[this.name].toTex)&&"string"!=typeof r[this.name].toTex||(n=r[this.name].toTex),t(n)){case"function":i=n(this,e);break;case"string":i=o(n,this,e);break;case"object":switch(t(n[a.length])){case"function":i=n[a.length](this,e);break;case"string":i=o(n[a.length],this,e)}}return void 0!==i?i:o("\\mathrm{${name}}\\left(${args}\\right)",this,e)}},{key:"getIdentifier",value:function(){return this.type+":"+this.name}}]),c}(n);return Ba(u,"name",Qp),Ba(u,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),Ba(u,"fromJSON",(function(e){return new u(e.fn,e.args)})),u}),{isClass:!0,isNode:!0}),em="parse",tm=Ee(em,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(function(e){var t=e.typed,r=e.numeric,n=e.config,i=e.AccessorNode,a=e.ArrayNode,o=e.AssignmentNode,u=e.BlockNode,s=e.ConditionalNode,c=e.ConstantNode,f=e.FunctionAssignmentNode,l=e.FunctionNode,p=e.IndexNode,m=e.ObjectNode,h=e.OperatorNode,d=e.ParenthesisNode,v=e.RangeNode,y=e.RelationalNode,g=e.SymbolNode,x=t(em,{string:function(e){return P(e,{})},"Array | Matrix":function(e){return b(e,{})},"string, Object":function(e,t){return P(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":b});function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=void 0!==t.nodes?t.nodes:{};return _n(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return P(e,r)}))}var 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},D={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},E={true:!0,false:!1,null:null,undefined:void 0},A=["NaN","Infinity"];function C(e,t){return e.expression.substr(e.index,t)}function M(e){return C(e,1)}function F(e){e.index++}function O(e){return e.expression.charAt(e.index-1)}function _(e){return e.expression.charAt(e.index+1)}function I(e){for(e.tokenType=w.NULL,e.token="",e.comment="";;){if("#"===M(e))for(;"\n"!==M(e)&&""!==M(e);)e.comment+=M(e),F(e);if(!x.isWhitespace(M(e),e.nestingLevel))break;F(e)}if(""!==M(e)){if("\n"===M(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=M(e),void F(e);var t=M(e),r=C(e,2),n=C(e,3);if(3===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,F(e),F(e),void F(e);if(2===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,F(e),void F(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void F(e);if(x.isDigitDot(t)){e.tokenType=w.NUMBER;var i=C(e,2);if("0b"===i||"0o"===i||"0x"===i){for(e.token+=M(e),F(e),e.token+=M(e),F(e);x.isHexDigit(M(e));)e.token+=M(e),F(e);if("."===M(e))for(e.token+=".",F(e);x.isHexDigit(M(e));)e.token+=M(e),F(e);else if("i"===M(e))for(e.token+="i",F(e);x.isDigit(M(e));)e.token+=M(e),F(e);return}if("."===M(e)){if(e.token+=M(e),F(e),!x.isDigit(M(e)))return void(e.tokenType=w.DELIMITER)}else{for(;x.isDigit(M(e));)e.token+=M(e),F(e);x.isDecimalMark(M(e),_(e))&&(e.token+=M(e),F(e))}for(;x.isDigit(M(e));)e.token+=M(e),F(e);if("E"===M(e)||"e"===M(e))if(x.isDigit(_(e))||"-"===_(e)||"+"===_(e)){if(e.token+=M(e),F(e),"+"!==M(e)&&"-"!==M(e)||(e.token+=M(e),F(e)),!x.isDigit(M(e)))throw ce(e,'Digit expected, got "'+M(e)+'"');for(;x.isDigit(M(e));)e.token+=M(e),F(e);if(x.isDecimalMark(M(e),_(e)))throw ce(e,'Digit expected, got "'+M(e)+'"')}else if("."===_(e))throw F(e),ce(e,'Digit expected, got "'+M(e)+'"')}else{if(!x.isAlpha(M(e),O(e),_(e))){for(e.tokenType=w.UNKNOWN;""!==M(e);)e.token+=M(e),F(e);throw ce(e,'Syntax error in part "'+e.token+'"')}for(;x.isAlpha(M(e),O(e),_(e))||x.isDigit(M(e));)e.token+=M(e),F(e);Ne(D,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}else e.tokenType=w.DELIMITER}function R(e){do{I(e)}while("\n"===e.token)}function z(e){e.nestingLevel++}function j(e){e.nestingLevel--}function P(e,t){var r={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};of(r,{expression:e,extraNodes:t}),I(r);var n=function(e){var t,r,n=[];for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=L(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})),I(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=L(e),e.comment&&(t.comment=e.comment),r=";"!==e.token,n.push({node:t,visible:r}));return n.length>0?new u(n):(t||(t=new c(void 0),e.comment&&(t.comment=e.comment)),t)}(r);if(""!==r.token)throw r.tokenType===w.DELIMITER?fe(r,"Unexpected operator "+r.token):ce(r,'Unexpected part "'+r.token+'"');return n}function L(e){var t,r,n,i,a=function(e){for(var t=function(e){for(var t=$(e);"or"===e.token;)R(e),t=new h("or","or",[t,$(e)]);return t}(e);"?"===e.token;){var r=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,R(e);var n=t,i=L(e);if(":"!==e.token)throw ce(e,"False part of conditional expression expected");e.conditionalLevel=null,R(e);var a=L(e);t=new s(n,i,a),e.conditionalLevel=r}return t}(e);if("="===e.token){if(U(a))return t=a.name,R(e),n=L(e),new o(new g(t),n);if(S(a))return R(e),n=L(e),new o(a.object,a.index,n);if(k(a)&&U(a.fn)&&(i=!0,r=[],t=a.name,a.args.forEach((function(e,t){U(e)?r[t]=e.name:i=!1})),i))return R(e),n=L(e),new f(t,r,n);throw ce(e,"Invalid left hand side of assignment operator =")}return a}function $(e){for(var t=H(e);"xor"===e.token;)R(e),t=new h("xor","xor",[t,H(e)]);return t}function H(e){for(var t=G(e);"and"===e.token;)R(e),t=new h("and","and",[t,G(e)]);return t}function G(e){for(var t=V(e);"|"===e.token;)R(e),t=new h("|","bitOr",[t,V(e)]);return t}function V(e){for(var t=Z(e);"^|"===e.token;)R(e),t=new h("^|","bitXor",[t,Z(e)]);return t}function Z(e){for(var t=W(e);"&"===e.token;)R(e),t=new h("&","bitAnd",[t,W(e)]);return t}function W(e){for(var t=[Y(e)],r=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Ne(n,e.token);){var i={name:e.token,fn:n[e.token]};r.push(i),R(e),t.push(Y(e))}return 1===t.length?t[0]:2===t.length?new h(r[0].name,r[0].fn,t):new y(r.map((function(e){return e.fn})),t)}function Y(e){var t,r,n,i;t=J(e);for(var a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Ne(a,e.token);)n=a[r=e.token],R(e),i=[t,J(e)],t=new h(r,n,i);return t}function J(e){var t,r,n,i;t=X(e);for(var a={to:"to",in:"to"};Ne(a,e.token);)n=a[r=e.token],R(e),"in"===r&&""===e.token?t=new h("*","multiply",[t,new g("in")],!0):(i=[t,X(e)],t=new h(r,n,i));return t}function X(e){var t,r=[];if(t=":"===e.token?new c(1):Q(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(r.push(t);":"===e.token&&r.length<3;)R(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?r.push(new g("end")):r.push(Q(e));t=3===r.length?new v(r[0],r[2],r[1]):new v(r[0],r[1])}return t}function Q(e){var t,r,n,i;t=K(e);for(var a={"+":"add","-":"subtract"};Ne(a,e.token);){n=a[r=e.token],R(e);var o=K(e);i=o.isPercentage?[t,new h("*","multiply",[t,o])]:[t,o],t=new h(r,n,i)}return t}function K(e){var t,r,n,i;r=t=ee(e);for(var a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Ne(a,e.token);)i=a[n=e.token],R(e),r=ee(e),t=new h(n,i,[t,r]);return t}function ee(e){var t,r;for(r=t=te(e);e.tokenType===w.SYMBOL||"in"===e.token&&T(t)||!(e.tokenType!==w.NUMBER||T(r)||q(r)&&"!"!==r.op)||"("===e.token;)r=te(e),t=new h("*","multiply",[t,r],!0);return t}function te(e){for(var t=re(e),r=t,n=[];"/"===e.token&&B(r);){if(n.push(of({},e)),R(e),e.tokenType!==w.NUMBER){of(e,n.pop());break}if(n.push(of({},e)),R(e),e.tokenType!==w.SYMBOL&&"("!==e.token){n.pop(),of(e,n.pop());break}of(e,n.pop()),n.pop(),r=re(e),t=new h("/","divide",[t,r])}return t}function re(e){var t,r,n,i;t=ne(e);for(var a={"%":"mod",mod:"mod"};Ne(a,e.token);)n=a[r=e.token],R(e),"%"===r&&e.tokenType===w.DELIMITER&&"("!==e.token?t=new h("/","divide",[t,new c(100)],!1,!0):(i=[t,ne(e)],t=new h(r,n,i));return t}function ne(e){var t,i,o,u={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Ne(u,e.token)?(o=u[e.token],t=e.token,R(e),i=[ne(e)],new h(t,o,i)):function(e){var t,i,o,u;return t=function(e){var t,i,o;t=function(e){var t=[];if(e.tokenType===w.SYMBOL&&Ne(e.extraNodes,e.token)){var i=e.extraNodes[e.token];if(I(e),"("===e.token){if(t=[],z(e),I(e),")"!==e.token)for(t.push(L(e));","===e.token;)I(e),t.push(L(e));if(")"!==e.token)throw ce(e,"Parenthesis ) expected");j(e),I(e)}return new i(t)}return function(e){var t;return e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in D?(t=e.token,I(e),ie(e,Ne(E,t)?new c(E[t]):-1!==A.indexOf(t)?new c(r(t,"number")):new g(t))):function(e){var t;return'"'===e.token?(t=ae(e),ie(e,new c(t))):function(e){var t;return"'"===e.token?(t=oe(e),ie(e,new c(t))):function(e){var t,i,o,u;if("["===e.token){if(z(e),I(e),"]"!==e.token){var s=ue(e);if(";"===e.token){for(o=1,i=[s];";"===e.token;)I(e),i[o]=ue(e),o++;if("]"!==e.token)throw ce(e,"End of matrix ] expected");j(e),I(e),u=i[0].items.length;for(var f=1;f0},x.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},x.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},x.isDigit=function(e){return e>="0"&&e<="9"},x.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},t.addConversion({from:"string",to:"Node",convert:x}),x})),rm="compile",nm=Ee(rm,["typed","parse"],(function(e){var t=e.typed,r=e.parse;return t(rm,{string:function(e){return r(e).compile()},"Array | Matrix":function(e){return _n(e,(function(e){return r(e).compile()}))}})})),im="evaluate",am=Ee(im,["typed","parse"],(function(e){var t=e.typed,r=e.parse;return t(im,{string:function(e){var t=Le();return r(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return r(e).compile().evaluate(t)},"Array | Matrix":function(e){var t=Le();return _n(e,(function(e){return r(e).compile().evaluate(t)}))},"Array | Matrix, Map | Object":function(e,t){return _n(e,(function(e){return r(e).compile().evaluate(t)}))}})})),om=Ee("Parser",["evaluate"],(function(e){var t=e.evaluate;function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Le(),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 Pe)return e.wrappedObject;var t,r={},n=qe(e.keys());try{for(n.s();!(t=n.n()).done;){var i=t.value;Be(r,i,e.get(i))}}catch(e){n.e(e)}finally{n.f()}return r}(this.scope)},r.prototype.getAllAsMap=function(){return this.scope},r.prototype.set=function(e,t){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}),um="parser",sm=Ee(um,["typed","Parser"],(function(e){var t=e.typed,r=e.Parser;return t(um,{"":function(){return new r}})})),cm=Ee("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtract","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(function(e){var t=e.typed,r=e.matrix,n=e.abs,i=e.addScalar,a=e.divideScalar,o=e.multiplyScalar,u=e.subtract,s=e.larger,c=e.equalScalar,f=e.unaryMinus,l=e.DenseMatrix,p=e.SparseMatrix,m=e.Spa;return t("lup",{DenseMatrix:function(e){return h(e)},SparseMatrix:function(e){return function(e){var t,r,i,u=e._size[0],l=e._size[1],h=Math.min(u,l),d=e._values,v=e._index,y=e._ptr,g=[],x=[],b=[],w=[u,h],N=[],D=[],E=[],A=[h,l],S=[],C=[];for(t=0;t0&&e.forEach(0,r-1,(function(t,r){p._forEachRow(t,g,x,b,(function(n,i){n>t&&e.accumulate(n,f(o(i,r)))}))}));var M,F,O,T,B=r,_=e.get(r),k=n(_);e.forEach(r+1,u-1,(function(e,t){var r=n(t);s(r,k)&&(B=e,k=r,_=t)})),r!==B&&(p._swapRows(r,B,w[1],g,x,b),p._swapRows(r,B,A[1],N,D,E),e.swap(r,B),F=B,O=C[M=r],T=C[F],S[O]=F,S[T]=M,C[M]=T,C[F]=O),e.forEach(0,u-1,(function(e,t){e<=r?(N.push(t),D.push(e)):(t=a(t,_),c(t,0)||(g.push(t),x.push(e)))}))};for(r=0;r0)for(t=0;t0)for(var n="Complex"===r[0][0].type?d(0):0,i=0;i=0;){var s=r[o+u],c=r[n+s];-1===c?(u--,a[t++]=s):(r[n+s]=r[i+c],r[o+ ++u]=c)}return t}function pm(e){return-e-2}var mm=Ee("csAmd",["add","multiply","transpose"],(function(e){var t=e.add,r=e.multiply,n=e.transpose;return function(e,o){if(!o||e<=0||e>3)return null;var u=o._size,s=u[0],c=u[1],f=0,l=Math.max(16,10*Math.sqrt(c)),p=function(e,i,a,o,u){var s=n(i);if(1===e&&o===a)return t(i,s);if(2===e){for(var c=s._index,f=s._ptr,l=0,p=0;pu))for(var h=f[p+1];mo)r[u+p]=0,r[i+p]=-1,l++,t[p]=pm(e),r[u+e]++;else{var h=r[s+m];-1!==h&&(c[h]=p),r[f+p]=r[s+m],r[s+m]=p}}return l}(c,O,_,q,z,j,l,k,R,L,I),H=0;$G?(g=d,x=W,b=_[0+d]-G):(x=O[g=F[W++]],b=_[0+g]),y=1;y<=b;y++)(w=_[k+(m=F[x++])])<=0||(Z+=w,_[k+m]=-w,F[J++]=m,-1!==_[I+m]&&(L[_[I+m]]=L[m]),-1!==L[m]?_[I+L[m]]=_[I+m]:_[R+_[q+m]]=_[I+m]);g!==d&&(O[g]=pm(d),_[j+g]=0)}for(0!==G&&(T=J),_[q+d]=Z,O[d]=Y,_[0+d]=J-Y,_[z+d]=-2,U=i(U,f,_,j,c),N=Y;N=U?_[j+g]-=w:0!==_[j+g]&&(_[j+g]=_[q+g]+X)}for(N=Y;N0?(M+=Q,F[S++]=g,C+=g):(O[g]=pm(d),_[j+g]=0)}_[z+m]=S-E+1;var K=S,ee=E+_[0+m];for(W=A+1;W=0))for(m=_[P+(C=L[m])],_[P+C]=-1;-1!==m&&-1!==_[I+m];m=_[I+m],U++){for(b=_[0+m],D=_[z+m],W=O[m]+1;W<=O[m]+b-1;W++)_[j+F[W]]=U;var re=m;for(h=_[I+m];-1!==h;){var ne=_[0+h]===b&&_[z+h]===D;for(W=O[h]+1;ne&&W<=O[h]+b-1;W++)_[j+F[W]]!==U&&(ne=0);ne?(O[h]=pm(m),_[k+m]+=_[k+h],_[k+h]=0,_[z+h]=-1,h=_[I+h],_[I+re]=h):(re=h,h=_[I+h])}}for(W=Y,N=Y;N=0;h--)_[k+h]>0||(_[I+h]=_[R+O[h]],_[R+O[h]]=h);for(g=c;g>=0;g--)_[k+g]<=0||-1!==O[g]&&(_[I+g]=_[R+O[g]],_[R+O[g]]=g);for(d=0,m=0;m<=c;m++)-1===O[m]&&(d=lm(m,d,_,R,I,B,j));return B.splice(B.length-1,1),B};function i(e,t,r,n,i){if(e<2||e+t<0){for(var a=0;a=1&&N[o]++,2===S.jleaf&&N[S.q]--}-1!==r[o]&&(v[0+o]=r[o])}for(o=0;o=0;r--)-1!==e[r]&&(a[o+r]=a[0+e[r]],a[0+e[r]]=r);for(r=0;r=0;s--)for(f=r[s],l=r[s+1],c=f;c=0;u--)m[u]=-1,-1!==(s=h[u])&&(0==d[g+s]++&&(d[y+s]=u),d[0+u]=d[v+s],d[v+s]=u);for(t.lnz=0,t.m2=a,s=0;s=0;){e=n[l];var p=i?i[e]:e;ym(c,e)||(gm(c,e),n[f+l]=p<0?0:xm(c[p]));var m=1;for(o=n[f+l],u=p<0?0:xm(c[p+1]);o3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||r>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=l(t,e,!1),i=p(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function Em(e,t){var r,n=t.length,i=[];if(e)for(r=0;r0&&r(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError("Polynomial [".concat(e,", ").concat(t,"] must have a non-zero non-constant coefficient"));switch(h.length){case 2:return[c(u(h[0],h[1]))];case 3:var d=la(h,3),v=d[0],y=d[1],g=d[2],x=o(2,g),b=o(y,y),w=o(4,g,v);if(n(b,w))return[u(c(y),x)];var N=s(a(b,w));return[u(a(N,y),x),u(a(c(N),y),x)];case 4:var D=la(h,4),E=D[0],A=D[1],S=D[2],C=D[3],M=c(o(3,C)),F=o(S,S),O=o(3,C,A),T=i(o(2,S,S,S),o(27,C,C,E)),B=o(9,C,S,A);if(n(F,O)&&n(T,B))return[u(S,M)];var _,k=a(F,O),I=a(T,B),R=i(o(18,C,S,A,E),o(S,S,A,A)),z=i(o(4,S,S,S,E),o(4,C,A,A,A),o(27,C,C,E,E));return n(R,z)?[u(a(o(4,C,S,A),i(o(9,C,C,E),o(S,S,S))),o(C,k)),u(a(o(9,C,E),o(S,A)),o(2,k))]:(_=n(F,O)?I:u(i(I,s(a(o(I,I),o(4,k,k,k)))),2),f(_,!0).toArray().map((function(e){return u(i(S,e,u(k,e)),M)})).map((function(e){return"Complex"===l(e)&&n(m(e),m(e)+p(e))?m(e):e})));default:throw new RangeError("only implemented for cubic or lower-order polynomials, not ".concat(h))}}})})),Fm=Ee("Help",["parse"],(function(e){var t=e.parse;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){var e=this.doc||{},r="\n";if(e.name&&(r+="Name: "+e.name+"\n\n"),e.category&&(r+="Category: "+e.category+"\n\n"),e.description&&(r+="Description:\n "+e.description+"\n\n"),e.syntax&&(r+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){r+="Examples:\n";for(var n={},i=0;i1, -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"]},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 indicant 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 eigenvectors of a real symmetric matrix",examples:["eigs([[5, 2.3], [2.3, 1]])"],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)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],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:[]},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 probablity 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"]},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 hyperbolic arccotangent 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 hyperbolic arccosecant 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: $0, $1, $2", [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, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","fraction","bignumber","string","format"]}},km="help",Im=Ee(km,["typed","mathWithTransform","Help"],(function(e){var t=e.typed,r=e.mathWithTransform,n=e.Help;return t(km,{any:function(e){var t,i=e;if("string"!=typeof e)for(t in r)if(Ne(r,t)&&e===r[t]){i=t;break}var a=Te(_m,i);if(!a){var o="function"==typeof i?i.name:i;throw new Error('No documentation found on "'+o+'"')}return new n(a)}})})),Rm="chain",zm=Ee(Rm,["typed","Chain"],(function(e){var t=e.typed,r=e.Chain;return t(Rm,{"":function(){return new r},any:function(e){return new r(e)}})})),qm=Ee("det",["typed","matrix","subtract","multiply","divideScalar","isZero","unaryMinus"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.multiply,a=e.divideScalar,o=e.isZero,u=e.unaryMinus;return t("det",{any:function(e){return he(e)},"Array | Matrix":function(e){var t;switch((t=l(e)?e.size():Array.isArray(e)?(e=r(e)).size():[]).length){case 0:return he(e);case 1:if(1===t[0])return he(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+Vr(t)+")");case 2:var s=t[0],c=t[1];if(s===c)return function(e,t,r){if(1===t)return he(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var s=!1,c=new Array(t).fill(0).map((function(e,t){return t})),f=0;fx&&(x=c(v[f][g]),b=f),f++;if(0===x)throw Error("Cannot calculate inverse, determinant is zero");(f=b)!==g&&(h=v[g],v[g]=v[f],v[f]=h,h=y[g],y[g]=y[f],y[f]=h);var w=v[g],N=y[g];for(f=0;f=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function $m(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:t.epsilon,u=arguments.length>3?arguments[3]:void 0;if("number"===u)return function(e,r){for(var n,i=e.length,a=Math.abs(r/i),o=new Array(i),u=0;u=Math.abs(a);){var h=p[0][0],d=p[0][1];e=v(e,(s=e[h][h],c=e[d][d],f=e[h][d],l=void 0,l=c-s,n=Math.abs(l)<=t.epsilon?Math.PI/4:.5*Math.atan(2*f/(c-s))),h,d),o=m(o,n,h,d),p=y(e)}for(var g=b(i,0),w=0;w=i(p);){var A=E[0][0],S=E[0][1];e=d(e,(y=e[A][A],w=e[S][S],N=e[A][S],D=void 0,D=n(w,y),o=i(D)<=t.epsilon?f(-1).acos().div(4):s(.5,a(l(2,N,c(D))))),A,S),m=h(m,o,A,S),E=g(e)}for(var C=b(u,0),M=0;M=5)return null;for(u=0;;){var s=m(e,a);if(g(C(S(a,[s])),n))break;if(++u>=10)return null;a=M(s)}return a}function A(e,t,r){var n="BigNumber"===r,i="Complex"===r,a=Array(e).fill(0).map((function(e){return 2*Math.random()-1}));return n&&(a=a.map((function(e){return c(e)}))),i&&(a=a.map((function(e){return v(e)}))),M(a=S(a,t),r)}function S(e,t){var n,a=Um(t);try{for(a.s();!(n=a.n()).done;){var u=n.value;e=r(e,i(o(b(u,e),b(u,u)),u))}}catch(e){a.e(e)}finally{a.f()}return e}function C(e){return s(u(b(e,e)))}function M(e,t){var r="Complex"===t,n="BigNumber"===t?c(1):r?v(1):1;return i(o(n,C(e)),e)}return function(e,m,b,A,S){void 0===S&&(S=!0);var C=function(e,r,n,i,u){var l,p="BigNumber"===i,m="Complex"===i,h=p?c(0):0,x=p?c(1):m?v(1):1,b=p?c(1):1,w=p?c(10):2,N=a(w,w);u&&(l=Array(r).fill(x));for(var D=!1;!D;){D=!0;for(var E=0;E1&&(k=f(Array(T-1).fill(y)))),T-=1,F.pop();for(var L=0;L2&&(k=f(Array(T-2).fill(y)))),T-=2,F.pop(),F.pop();for(var $=0;$100){var H=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+O.join(", "));throw H.values=O,H.vectors=[],H}var G=m?i(_,function(e,t){for(var r=[],n=0;n1&&(g=o(g,m),x=-x),d=n(d,o(y=y*(l-b+1)/((2*l-b+1)*b),g)),v=n(v,o(y*x,g));for(var w=o(a(v),d),N=0;Nm&&++a>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>m);return o}return t(Zm,{"Array | Matrix":function(e){var t=l(e)?e.size():Kr(e);switch(t.length){case 1:if(1===t[0])return a(e,o);throw new RangeError("Matrix must be square (size: "+Vr(t)+")");case 2:if(t[0]===t[1])return h(e);throw new RangeError("Matrix must be square (size: "+Vr(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+Vr(t)+")")}}})})),Ym="sylvester",Jm=Ee(Ym,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(function(e){var t=e.typed,r=e.schur,n=e.matrixFromColumns,i=e.matrix,a=e.multiply,o=e.range,u=e.concat,s=e.transpose,c=e.index,f=e.subset,l=e.add,p=e.subtract,m=e.identity,h=e.lusolve,d=e.abs;return t(Ym,{"Matrix, Matrix, Matrix":v,"Array, Matrix, Matrix":function(e,t,r){return v(i(e),t,r)},"Array, Array, Matrix":function(e,t,r){return v(i(e),i(t),r)},"Array, Matrix, Array":function(e,t,r){return v(i(e),t,i(r))},"Matrix, Array, Matrix":function(e,t,r){return v(e,i(t),r)},"Matrix, Array, Array":function(e,t,r){return v(e,i(t),i(r))},"Matrix, Matrix, Array":function(e,t,r){return v(e,t,i(r))},"Array, Array, Array":function(e,t,r){return v(i(e),i(t),i(r)).toArray()}});function v(e,t,v){for(var y=t.size()[0],g=e.size()[0],x=r(e),b=x.T,w=x.U,N=r(a(-1,t)),D=N.T,E=N.U,A=a(a(s(w),v),E),S=o(0,g),C=[],M=function(e,t){return u(e,t,1)},F=function(e,t){return u(e,t,0)},O=0;O1e-5){for(var T=F(f(A,c(S,O)),f(A,c(S,O+1))),B=0;B100)break}while(o(u(s,t))>1e-4);return{U:c,T:s}}})),Km="lyap",eh=Ee(Km,["typed","matrix","sylvester","multiply","transpose"],(function(e){var t=e.typed,r=e.matrix,n=e.sylvester,i=e.multiply,a=e.transpose;return t(Km,{"Matrix, Matrix":function(e,t){return n(e,a(e),i(-1,t))},"Array, Matrix":function(e,t){return n(r(e),a(r(e)),i(-1,t))},"Matrix, Array":function(e,t){return n(e,a(r(e)),r(i(-1,t)))},"Array, Array":function(e,t){return n(r(e),a(r(e)),r(i(-1,t))).toArray()}})})),th=Ee("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(function(e){var t=e.typed,r=e.matrix,n=e.multiply,i=e.equalScalar,a=e.divideScalar,o=e.inv,u=pa({typed:t,equalScalar:i}),s=ha({typed:t});return t("divide",ve({"Array | Matrix, Array | Matrix":function(e,t){return n(e,o(t))},"DenseMatrix, any":function(e,t){return s(e,t,a,!1)},"SparseMatrix, any":function(e,t){return u(e,t,a,!1)},"Array, any":function(e,t){return s(r(e),t,a,!1).valueOf()},"any, Array | Matrix":function(e,t){return n(e,o(t))}},a.signatures))})),rh="distance",nh=Ee(rh,["typed","addScalar","subtract","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(function(e){var t=e.typed,r=e.addScalar,n=e.subtract,i=e.multiplyScalar,o=e.divideScalar,u=e.deepEqual,s=e.sqrt,c=e.abs;return t(rh,{"Array, Array, Array":function(e,t,r){if(2===e.length&&2===t.length&&2===r.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(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(u(t,r))throw new TypeError("LinePoint1 should not be same with LinePoint2");var a=n(r[1],t[1]),o=n(t[0],r[0]),s=n(i(r[0],t[1]),i(t[0],r[1]));return v(e[0],e[1],a,o,s)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,r){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(r).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(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(u(d(t),d(r)))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 r&&"lineTwoPtY"in r){var a=n(r.lineTwoPtY,t.lineOnePtY),o=n(t.lineOnePtX,r.lineTwoPtX),s=n(i(r.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,r.lineTwoPtY));return v(e.pointX,e.pointY,a,o,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(!p(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return v(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!p(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!h(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(!m(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return g(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(!p(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 v(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(!p(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!h(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 g([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(!p(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!p(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 g([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&&f(e[0][0])&&f(e[0][1])){if(e.some((function(e){return 2!==e.length||!f(e[0])||!f(e[1])})))return!1}else{if(!(3===e[0].length&&f(e[0][0])&&f(e[0][1])&&f(e[0][2])))return!1;if(e.some((function(e){return 3!==e.length||!f(e[0])||!f(e[1])||!f(e[2])})))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var t=[],r=[],n=[],i=0;i1&&Array.isArray(e[0])&&e.every((function(e){return Array.isArray(e)&&1===e.length}))?m(e):e}function x(e){return 2===e.length&&d(e[0])&&d(e[1])}function b(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,t,r,n,i,o,u,c,l,p,m,h){var d=s(f(e,t),f(r,n)),v=s(f(i,o),f(u,c)),y=s(f(l,p),f(m,h));return a(a(d,v),y)}})),ah=Ee("sum",["typed","config","add","numeric"],(function(e){var t=e.typed,r=e.config,n=e.add,i=e.numeric;return t("sum",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){try{return kn(e,t,n)}catch(e){throw Es(e,"sum")}},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function sum");return a(e)}});function a(e){var t;return Bn(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Es(t,"sum",e)}})),void 0===t&&(t=i(0,r.number)),"string"==typeof t&&(t=i(t,r.number)),t}})),oh="cumsum",uh=Ee(oh,["typed","add","unaryPlus"],(function(e){var t=e.typed,r=e.add,n=e.unaryPlus;return t(oh,{Array:i,Matrix:function(e){return e.create(i(e.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,t){return e.create(o(e.valueOf(),t))},"...":function(e){if(Tn(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return a(e)}catch(e){throw Es(e,oh)}}function a(e){if(0===e.length)return[];for(var t=[n(e[0])],i=1;i=r.length)throw new Qr(t,r.length);try{return u(e,t)}catch(e){throw Es(e,oh)}}function u(e,t){var r,n,i;if(t<=0){var o=e[0][0];if(Array.isArray(o)){for(i=On(e),n=[],r=0;r0&&(o=e[c]);return s(o,n)}var f=a(e,(t-1)/2);return u(f)}catch(e){throw Es(e,"median")}}var u=t({"number | BigNumber | Complex | Unit":function(e){return e}}),s=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return n(r(e,t),2)}});return t(fh,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(Tn(e))throw new TypeError("Scalar values expected in function median");return o(e)}})})),ph=Ee("mad",["typed","abs","map","median","subtract"],(function(e){var t=e.typed,r=e.abs,n=e.map,i=e.median,a=e.subtract;return t("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(0===(e=mn(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var t=i(e);return i(n(e,(function(e){return r(a(e,t))})))}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf("median")?new TypeError(e.message.replace("median","mad")):Es(e,"mad")}}})),mh="unbiased",hh="variance",dh=Ee(hh,["typed","add","subtract","multiply","divide","apply","isNaN"],(function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,o=e.divide,u=e.apply,s=e.isNaN;return t(hh,{"Array | Matrix":function(e){return c(e,mh)},"Array | Matrix, string":c,"Array | Matrix, number | BigNumber":function(e,t){return f(e,t,mh)},"Array | Matrix, number | BigNumber, string":f,"...":function(e){return c(e,mh)}});function c(e,t){var u,c=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Bn(e,(function(e){try{u=void 0===u?e:r(u,e),c++}catch(t){throw Es(t,"variance",e)}})),0===c)throw new Error("Cannot calculate variance of an empty array");var f=o(u,c);if(u=void 0,Bn(e,(function(e){var t=n(e,f);u=void 0===u?i(t,t):r(u,i(t,t))})),s(u))return u;switch(t){case"uncorrected":return o(u,c);case"biased":return o(u,c+1);case"unbiased":var l=a(u)?u.mul(0):0;return 1===c?l:o(u,c-1);default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function f(e,t,r){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return u(e,t,(function(e){return c(e,r)}))}catch(e){throw Es(e,"variance")}}})),vh=Ee("quantileSeq",["typed","add","multiply","partitionSelect","compare"],(function(e){var t=e.typed,r=e.add,n=e.multiply,o=e.partitionSelect,u=e.compare;function s(e,t,a){var s=mn(e),f=s.length;if(0===f)throw new Error("Cannot calculate quantile of an empty sequence");if(i(t)){var l=t*(f-1),p=l%1;if(0===p){var m=a?s[l]:o(s,l);return c(m),m}var h,d,v=Math.floor(l);if(a)h=s[v],d=s[v+1];else{d=o(s,v+1),h=s[v];for(var y=0;y0&&(h=s[y])}return c(h),c(d),r(n(h,1-p),n(d,p))}var g=t.times(f-1);if(g.isInteger()){g=g.toNumber();var x=a?s[g]:o(s,g);return c(x),x}var b,w,N=g.floor(),D=g.minus(N),E=N.toNumber();if(a)b=s[E],w=s[E+1];else{w=o(s,E+1),b=s[E];for(var A=0;A0&&(b=s[A])}c(b),c(w);var S=new D.constructor(1);return r(n(b,S.minus(D)),n(w,D))}var c=t({"number | BigNumber | Unit":function(e){return e}});return function(e,t,r){var n,o,u;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(p(e)){if("boolean"==typeof(r=r||!1)){if(o=e.valueOf(),i(t)){if(t<0)throw new Error("N/prob must be non-negative");if(t<=1)return s(o,t,r);if(t>1){if(!V(t))throw new Error("N must be a positive integer");var c=t+1;n=new Array(t);for(var f=0;f4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var h=new l(m+1);n=new Array(m);for(var d=0;d1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!a(g))throw new TypeError("Unexpected type of argument in function quantileSeq");if(u=new g.constructor(1),g.isNegative()||g.gt(u))throw new Error("Probability must be between 0 and 1, inclusive")}n[y]=s(o,g,r)}return n}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}})),yh=Ee("std",["typed","map","sqrt","variance"],(function(e){var t=e.typed,r=e.map,n=e.sqrt,i=e.variance;return t("std",{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var a=i.apply(null,arguments);return p(a)?r(a,n):n(a)}catch(e){throw e instanceof TypeError&&-1!==e.message.indexOf(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}}));function gh(e,t){if(t>1;return gh(e,r)*gh(r+1,t)}function xh(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!V(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");for(var r=e-t,n=1,i=2,a=t171?1/0:gh(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Sh(1-e));if(e>=171.35)return 1/0;if(e>85){var r=e*e,n=r*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*r)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,t=Mh[0];for(var o=1;o=1;n--)r+=Oh[n]/(e+n);return Fh+(e+.5)*Math.log(t)-t+Math.log(r)}Th.signature="number";var Bh="gamma",_h=Ee(Bh,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(function(e){var t=e.typed,r=e.config,n=(e.multiplyScalar,e.pow,e.BigNumber),i=e.Complex;return t(Bh,{number:Sh,Complex:function e(t){if(0===t.im)return Sh(t.re);if(t.re<.5){var r=new i(1-t.re,-t.im),n=new i(Math.PI*t.re,Math.PI*t.im);return new i(Math.PI).div(n.sin()).div(e(r))}t=new i(t.re-1,t.im);for(var a=new i(Mh[0],0),o=1;o2;)s+=o-=2,u=u.times(s);return new n(u.toPrecision(n.precision))}})),kh="lgamma",Ih=Ee(kh,["Complex","typed"],(function(e){var t=e.Complex,r=e.typed,n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(kh,{number:Th,Complex:function e(r){if(r.isNaN())return new t(NaN,NaN);if(0===r.im)return new t(Th(r.re),0);if(r.re>=7||Math.abs(r.im)>=7)return i(r);if(r.re<=.1){var n=(s=6.283185307179586,(!0^((c=r.im)>0||!(c<0)&&1/c==1/0)?-s:s)*Math.floor(.5*r.re+.25)),o=r.mul(Math.PI).sin().log(),u=e(new t(1-r.re,-r.im));return new t(1.1447298858494002,n).sub(o).sub(u)}return r.im>=0?a(r):a(r.conjugate()).conjugate();var s,c},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){for(var r=e.sub(.5).mul(e.log()).sub(e).add(Fh),i=new t(1,0).div(e),a=i.div(e),o=n[0],u=n[1],s=2*a.re,c=a.re*a.re+a.im*a.im,f=2;f<8;f++){var l=u;u=-c*o+n[f],o=s*o+l}var p=i.mul(a.mul(o).add(u));return r.add(p)}function a(e){var r=0,n=0,a=e;for(e=e.add(1);e.re<=7;){var o=(a=a.mul(e)).im<0?1:0;0!==o&&0===n&&r++,n=o,e=e.add(1)}return i(e).sub(a.log()).sub(new t(0,2*r*Math.PI*1))}})),Rh="factorial",zh=Ee(Rh,["typed","gamma"],(function(e){var t=e.typed,r=e.gamma;return t(Rh,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":t.referToSelf((function(e){return function(t){return _n(t,e)}}))})})),qh="kldivergence",jh=Ee(qh,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(function(e){var t=e.typed,r=e.matrix,n=e.divide,i=e.sum,a=e.multiply,o=e.map,u=e.dotDivide,s=e.log,c=e.isNumeric;return t(qh,{"Array, Array":function(e,t){return f(r(e),r(t))},"Matrix, Array":function(e,t){return f(e,r(t))},"Array, Matrix":function(e,t){return f(r(e),t)},"Matrix, Matrix":function(e,t){return f(e,t)}});function f(e,t){var r=t.size().length,f=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(f>1)throw new Error("second object must be one dimensional");if(r!==f)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");var l=n(e,i(e)),p=n(t,i(t)),m=i(a(l,o(u(l,p),(function(e){return s(e)}))));return c(m)?m:Number.NaN}})),Ph="multinomial",Lh=Ee(Ph,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=e.multiply,a=e.factorial,o=e.isInteger,u=e.isPositive;return t(Ph,{"Array | Matrix":function(e){var t=0,s=1;return Bn(e,(function(e){if(!o(e)||!u(e))throw new TypeError("Positive integer value expected in function multinomial");t=r(t,e),s=i(s,a(e))})),n(a(t),s)}})})),Uh="permutations",$h=Ee(Uh,["typed","factorial"],(function(e){var t=e.typed,r=e.factorial;return t(Uh,{"number | BigNumber":r,"number, number":function(e,t){if(!V(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!V(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 gh(e-t+1,e)},"BigNumber, BigNumber":function(e,t){var r,n;if(!Hh(e)||!Hh(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(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})}));function Hh(e){return e.isInteger()&&e.gte(0)}r(3843);var Gh=r(6377),Vh=Gh(Date.now());function Zh(e){var t,r;return t=null===(r=e)?Vh:Gh(String(r)),function(){return t()}}var Wh="pickRandom",Yh=Ee(Wh,["typed","config","?on"],(function(e){var t=e.typed,r=e.config,n=e.on,a=Zh(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(a=Zh(e.randomSeed))})),t(Wh,{"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,r){return o(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return o(e,{number:t,weights:r})}});function o(e,t){var r=t.number,n=t.weights,o=t.elementWise,u=void 0===o||o,s=void 0===r;s&&(r=1);var c=l(e)?e.create:l(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===u&&(e=mn(e),n=mn(n));var f=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var p=0,m=n.length;p1)for(var n=0,i=e.shift();nv)return m[d][v];for(var y=0;y<=d;++y)if(m[y]||(m[y]=[h(0===y?1:0)]),0!==y)for(var g=m[y],x=m[y-1],b=g.length;b<=y&&b<=v;++b)g[b]=b===y?1:r(n(h(b),x[b]),x[b-1]);return m[d][v]}})})),nd="bellNumbers",id=Ee(nd,["typed","addScalar","isNegative","isInteger","stirlingS2"],(function(e){var t=e.typed,r=e.addScalar,n=e.isNegative,i=e.isInteger,a=e.stirlingS2;return t(nd,{"number | BigNumber":function(e){if(!i(e)||n(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var t=0,o=0;o<=e;o++)t=r(t,a(e,o));return t}})})),ad="catalan",od=Ee(ad,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(function(e){var t=e.typed,r=e.addScalar,n=e.divideScalar,i=e.multiplyScalar,a=e.combinations,o=e.isNegative,u=e.isInteger;return t(ad,{"number | BigNumber":function(e){if(!u(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),r(e,1))}})})),ud="composition",sd=Ee(ud,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(function(e){var t=e.typed,r=e.addScalar,n=e.combinations,i=e.isPositive,a=(e.isNegative,e.isInteger),o=e.larger;return t(ud,{"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(o(t,e))throw new TypeError("k must be less than or equal to n in function composition");return n(r(e,-1),r(t,-1))}})})),cd="leafCount",fd=Ee(cd,["parse","typed"],(function(e){function t(e){var r=0;return e.forEach((function(e){r+=t(e)})),r||1}return e.parse,(0,e.typed)(cd,{Node:function(e){return t(e)}})}));function ld(e){return T(e)||q(e)&&e.isUnary()&&T(e.args[0])}function pd(e){return!!T(e)||!(!k(e)&&!q(e)||!e.args.every(pd))||!(!j(e)||!pd(e.content))}function md(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function hd(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:u,n=o;if("string"==typeof e?n=e:q(e)?n=e.fn.toString():k(e)?n=e.name:j(e)&&(n="paren"),Ne(r,n)){var i=r[n];if(Ne(i,t))return i[t];if(Ne(u,n))return u[n][t]}if(Ne(r,o)){var a=r[o];return Ne(a,t)?a[t]:u[o][t]}if(Ne(u,n)){var s=u[n];if(Ne(s,t))return s[t]}return u[o][t]}function c(e){return s(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:u)}function f(e,t){var r,n=[];return c(e,t)?(r=e.op,function e(t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:u)},isAssociative:c,mergeContext:function(e,t){var r=hd({},e);for(var n in t)Ne(e,n)?r[n]=hd(hd({},t[n]),e[n]):r[n]=t[n];return r},flatten:function e(t,r){if(!t.args||0===t.args.length)return t;t.args=f(t,r);for(var n=0;n2&&c(t,r)){for(var o=t.args.pop();t.args.length>0;)o=n([t.args.pop(),o]);t.args=o.args}}},unflattenl:function e(t,r){if(t.args&&0!==t.args.length){for(var n=l(t),i=t.args.length,a=0;a2&&c(t,r)){for(var o=t.args.shift();t.args.length>0;)o=n([o,t.args.shift()]);t.args=o.args}}},defaultContext:u,realContext:{divide:{total:a},log:{total:a}},positiveContext:{subtract:{total:a},abs:{trivial:i},log:{total:i}}}})),vd=Ee("simplify",["config","typed","parse","add","subtract","multiply","divide","pow","isZero","equal","resolve","simplifyConstant","simplifyCore","?fraction","?bignumber","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){e.config;var r=e.typed,n=e.parse,i=(e.add,e.subtract,e.multiply,e.divide,e.pow,e.isZero,e.equal),a=e.resolve,o=e.simplifyConstant,u=e.simplifyCore,s=(e.fraction,e.bignumber,e.mathWithTransform,e.matrix,e.AccessorNode),c=e.ArrayNode,f=e.ConstantNode,l=e.FunctionNode,p=e.IndexNode,m=e.ObjectNode,h=e.OperatorNode,d=e.ParenthesisNode,v=e.SymbolNode,y=dd({FunctionNode:l,OperatorNode:h,SymbolNode:v}),g=y.hasProperty,x=y.isCommutative,b=y.isAssociative,w=y.mergeContext,N=y.flatten,D=y.unflattenr,E=y.unflattenl,A=y.createMakeNodeFunction,S=y.defaultContext,C=y.realContext,M=y.positiveContext;r.addConversion({from:"Object",to:"Map",convert:Ue});var F=r("simplify",{Node:R,"Node, Map":function(e,t){return R(e,!1,t)},"Node, Map, Object":function(e,t,r){return R(e,!1,t,r)},"Node, Array":R,"Node, Array, Map":R,"Node, Array, Map, Object":R});function O(e){return e.transform((function(e,t,r){return j(e)?O(e.content):e}))}r.removeConversion({from:"Object",to:"Map",convert:Ue}),F.defaultContext=S,F.realContext=C,F.positiveContext=M;var B={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){var r={};if(e.s){var i=e.s.split("->");if(2!==i.length)throw SyntaxError("Could not parse rule: "+e.s);r.l=i[0],r.r=i[1]}else r.l=e.l,r.r=e.r;r.l=O(n(r.l)),r.r=O(n(r.r));for(var a=0,o=["imposeContext","repeat","assuming"];a 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"}];var k=0;function I(){return new v("_p"+k++)}function R(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Le(),i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i.consoleDebug;r=function(e,r){for(var n=[],i=0;i ").concat(r[l].r.toString()))),o){var m=u.toString({parenthesis:"all"});m!==f&&(console.log("Applying",p,"produced",m),f=m)}E(u,i.context)}c=u.toString({parenthesis:"all"})}return u}function z(e,t,r){var n=e;if(e)for(var i=0;i=2&&2===e.args.length){for(var o=function(e,t){var r,n,i=[],a=A(e);if(x(e,t))for(var o=0;o1&&(s=a(e.args.slice(0,u))),r=1===(n=e.args.slice(u)).length?n[0]:a(n),i.push(a([s,r]))}return i}(t,r),u=[],s=0;s2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var p=[],m=0;m2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var y=$(e.args[0],t.args[1],r);if(0===y.length)return[];var g=$(e.args[1],t.args[0],r);if(0===g.length)return[];p=[y,g]}a=function(e){if(0===e.length)return e;for(var t=e.reduce(L),r=[],n={},i=0;i="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":a[0].placeholders[e.name]=t;break;case"c":case"cl":if(!T(t))return[];a[0].placeholders[e.name]=t;break;case"v":if(T(t))return[];a[0].placeholders[e.name]=t;break;case"vl":if(!U(t))return[];a[0].placeholders[e.name]=t;break;case"cd":if(!ld(t))return[];a[0].placeholders[e.name]=t;break;case"vd":if(ld(t))return[];a[0].placeholders[e.name]=t;break;case"ce":if(!pd(t))return[];a[0].placeholders[e.name]=t;break;case"ve":if(pd(t))return[];a[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof f))return[];if(!i(e.value,t.value))return[]}return a}function H(e,t){if(e instanceof f&&t instanceof f){if(!i(e.value,t.value))return!1}else if(e instanceof v&&t instanceof v){if(e.name!==t.name)return!1}else{if(!(e instanceof h&&t instanceof h||e instanceof l&&t instanceof l))return!1;if(e instanceof h){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(var r=0;r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function gd(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r1?(v=_(y,E,g,r),S.unshift(v),v=_(y,S,g,r)):v=_(y,s,g,r)}else v=_(y,s,g,r);else v=_(y,s=e.args.map((function(e){return k(e,r)})),g,r);return v;case"ParenthesisNode":return k(e.content,r);case"AccessorNode":return function(e,t,r){if(!I(t))return new c(M(e),M(t));if(C(e)||l(e)){for(var n=Array.from(t.dimensions);n.length>0;)if(T(n[0])&&"string"!=typeof n[0].value){var i=O(n.shift().value,r);C(e)?e=e.items[i-1]:(e=e.valueOf()[i-1])instanceof Array&&(e=a(e))}else{if(!(n.length>1&&T(n[1])&&"string"!=typeof n[1].value))break;var o,u=O(n[1].value,r),s=[],m=C(e)?e.items:e.valueOf(),d=yd(m);try{for(d.s();!(o=d.n()).done;){var v=o.value;if(C(v))s.push(v.items[u-1]);else{if(!l(e))break;s.push(v[u-1])}}}catch(e){d.e(e)}finally{d.f()}if(s.length!==m.length)break;e=C(e)?new f(s):a(s),n.splice(1,1)}return n.length===t.dimensions.length?new c(M(e),t):n.length>0?(t=new h(n),new c(M(e),t)):e}if(z(e)&&1===t.dimensions.length&&T(t.dimensions[0])){var y=t.dimensions[0].value;return y in e.properties?e.properties[y]:new p}return new c(M(e),t)}(k(e.object,r),k(e.index,r),r);case"ArrayNode":var B=e.items.map((function(e){return k(e,r)}));return B.some(R)?new f(B.map(M)):a(B);case"IndexNode":return new h(e.dimensions.map((function(e){return D(e,r)})));case"ObjectNode":var j={};for(var P in e.properties)j[P]=D(e.properties[P],r);return new d(j);default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return D})),bd="simplifyCore",wd=Ee(bd,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){var t=e.typed,r=(e.parse,e.equal),n=e.isZero,i=(e.add,e.subtract,e.multiply,e.divide,e.pow,e.AccessorNode),a=e.ArrayNode,o=e.ConstantNode,u=e.FunctionNode,s=e.IndexNode,c=e.ObjectNode,f=e.OperatorNode,l=(e.ParenthesisNode,e.SymbolNode),p=new o(0),m=new o(1),h=new o(!0),d=new o(!1);function v(e){return q(e)&&["and","not","or"].includes(e.op)}var y=dd({FunctionNode:u,OperatorNode:f,SymbolNode:l}),g=y.hasProperty,x=y.isCommutative;function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=t?t.context:void 0;if(g(e,"trivial",o)){if(k(e)&&1===e.args.length)return b(e.args[0],t);var l=!1,y=0;if(e.forEach((function(e){1==++y&&(l=b(e,t))})),1===y)return l}var w=e;if(k(w)){var N=function(e){var t,r="OperatorNode:"+e,n=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return mp(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?mp(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}(hp);try{for(n.s();!(t=n.n()).done;){var i=t.value;if(r in i)return i[r].op}}catch(e){n.e(e)}finally{n.f()}return null}(w.name);if(!N)return new u(b(w.fn),w.args.map((function(e){return b(e,t)})));if(w.args.length>2&&g(w,"associative",o))for(;w.args.length>2;){var D=w.args.pop(),E=w.args.pop();w.args.push(new f(N,w.name,[D,E]))}w=new f(N,w.name,w.args)}if(q(w)&&w.isUnary()){var A=b(w.args[0],t);if("~"===w.op&&q(A)&&A.isUnary()&&"~"===A.op)return A.args[0];if("not"===w.op&&q(A)&&A.isUnary()&&"not"===A.op&&v(A.args[0]))return A.args[0];var M=!0;if("-"===w.op&&q(A)&&(A.isBinary()&&"subtract"===A.fn&&(w=new f("-","subtract",[A.args[1],A.args[0]]),M=!1),A.isUnary()&&"-"===A.op))return A.args[0];if(M)return new f(w.op,w.fn,[A])}if(q(w)&&w.isBinary()){var F=b(w.args[0],t),O=b(w.args[1],t);if("+"===w.op){if(T(F)&&n(F.value))return O;if(T(O)&&n(O.value))return F;q(O)&&O.isUnary()&&"-"===O.op&&(O=O.args[0],w=new f("-","subtract",[F,O]))}if("-"===w.op)return q(O)&&O.isUnary()&&"-"===O.op?b(new f("+","add",[F,O.args[0]]),t):T(F)&&n(F.value)?b(new f("-","unaryMinus",[O])):T(O)&&n(O.value)?F:new f(w.op,w.fn,[F,O]);if("*"===w.op){if(T(F)){if(n(F.value))return p;if(r(F.value,1))return O}if(T(O)){if(n(O.value))return p;if(r(O.value,1))return F;if(x(w,o))return new f(w.op,w.fn,[O,F],w.implicit)}return new f(w.op,w.fn,[F,O],w.implicit)}if("/"===w.op)return T(F)&&n(F.value)?p:T(O)&&r(O.value,1)?F:new f(w.op,w.fn,[F,O]);if("^"===w.op&&T(O)){if(n(O.value))return m;if(r(O.value,1))return F}if("and"===w.op){if(T(F)){if(!F.value)return d;if(v(O))return O}if(T(O)){if(!O.value)return d;if(v(F))return F}}if("or"===w.op){if(T(F)){if(F.value)return h;if(v(O))return O}if(T(O)){if(O.value)return h;if(v(F))return F}}return new f(w.op,w.fn,[F,O])}if(q(w))return new f(w.op,w.fn,w.args.map((function(e){return b(e,t)})));if(C(w))return new a(w.items.map((function(e){return b(e,t)})));if(S(w))return new i(b(w.object,t),b(w.index,t));if(I(w))return new s(w.dimensions.map((function(e){return b(e,t)})));if(z(w)){var B={};for(var _ in w.properties)B[_]=b(w.properties[_],t);return new c(B)}return w}return t(bd,{Node:b,"Node,Object":b})})),Nd=Ee("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(function(e){var t=e.typed,r=e.parse,n=e.ConstantNode,i=e.FunctionNode,a=e.OperatorNode,o=e.ParenthesisNode;function u(e,t){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(U(e)){if(s.has(e.name)){var c=Array.from(s).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(c,"}"))}var f=t.get(e.name);if(R(f)){var l=new Set(s);return l.add(e.name),u(f,t,l)}return"number"==typeof f?r(String(f)):void 0!==f?new n(f):e}if(q(e)){var p=e.args.map((function(e){return u(e,t,s)}));return new a(e.op,e.fn,p,e.implicit)}if(j(e))return new o(u(e.content,t,s));if(k(e)){var m=e.args.map((function(e){return u(e,t,s)}));return new i(e.name,m)}return e.map((function(e){return u(e,t,s)}))}return t("resolve",{Node:u,"Node, Map | null | undefined":u,"Node, Object":function(e,t){return u(e,Ue(t))},"Array | Matrix":t.referToSelf((function(e){return function(t){return t.map((function(t){return e(t)}))}})),"Array | Matrix, null | undefined":t.referToSelf((function(e){return function(t){return t.map((function(t){return e(t)}))}})),"Array, Object":t.referTo("Array,Map",(function(e){return function(t,r){return e(t,Ue(r))}})),"Matrix, Object":t.referTo("Matrix,Map",(function(e){return function(t,r){return e(t,Ue(r))}})),"Array | Matrix, Map":t.referToSelf((function(e){return function(t,r){return t.map((function(t){return e(t,r)}))}}))})})),Dd="symbolicEqual",Ed=Ee(Dd,["parse","simplify","typed","OperatorNode"],(function(e){e.parse;var t=e.simplify,r=e.typed,n=e.OperatorNode;function i(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new n("-","subtract",[e,r]),o=t(a,{},i);return T(o)&&!o.value}return r(Dd,{"Node, Node":i,"Node, Node, Object":i})})),Ad="derivative",Sd=Ee(Ad,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(function(e){var t=e.typed,r=e.config,n=e.parse,i=e.simplify,a=e.equal,o=e.isZero,u=e.numeric,s=e.ConstantNode,c=e.FunctionNode,f=e.OperatorNode,l=e.ParenthesisNode,p=e.SymbolNode;function m(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0},n={};v(n,e,t.name);var a=y(e,n);return r.simplify?i(a):a}t.addConversion({from:"identifier",to:"SymbolNode",convert:n});var h=t(Ad,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});t.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),h._simplify=!0,h.toTex=function(e){return d.apply(null,e.args)};var d=t("_derivTex",{"Node, SymbolNode":function(e,t){return T(e)&&"string"===H(e.value)?d(n(e.value).toString(),t.toString(),1):d(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===H(t.value))return d(e,n(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,r){return d(e.toString(),t.name,r.value)},"string, string, number":function(e,t,r){return(1===r?"{d\\over d"+t+"}":"{d^{"+r+"}\\over d"+t+"^{"+r+"}}")+"\\left[".concat(e,"\\right]")}}),v=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0,!0},"Object, SymbolNode, string":function(e,t,r){return t.name!==r&&(e[t]=!0,!0)},"Object, ParenthesisNode, string":function(e,t,r){return v(e,t.content,r)},"Object, FunctionAssignmentNode, string":function(e,t,r){return-1===t.params.indexOf(r)?(e[t]=!0,!0):v(e,t.expr,r)},"Object, FunctionNode | OperatorNode, string":function(e,t,r){if(t.args.length>0){for(var n=v(e,t.args[0],r),i=1;i0){var n=e.args.filter((function(e){return void 0===t[e]})),i=1===n.length?n[0]:new f("*","multiply",n),u=r.concat(y(i,t));return new f("*","multiply",u)}return new f("+","add",e.args.map((function(r){return new f("*","multiply",e.args.map((function(e){return e===r?y(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){var s=e.args[0],l=e.args[1];return void 0!==t[l]?new f("/","divide",[y(s,t),l]):void 0!==t[s]?new f("*","multiply",[new f("-","unaryMinus",[s]),new f("/","divide",[y(l,t),new f("^","pow",[l.clone(),g(2)])])]):new f("/","divide",[new f("-","subtract",[new f("*","multiply",[y(s,t),l.clone()]),new f("*","multiply",[s.clone(),y(l,t)])]),new f("^","pow",[l.clone(),g(2)])])}if("^"===e.op&&e.isBinary()){var p=e.args[0],m=e.args[1];if(void 0!==t[p])return T(p)&&(o(p.value)||a(p.value,1))?g(0):new f("*","multiply",[e,new f("*","multiply",[new c("log",[p.clone()]),y(m.clone(),t)])]);if(void 0!==t[m]){if(T(m)){if(o(m.value))return g(0);if(a(m.value,1))return y(p,t)}var h=new f("^","pow",[p.clone(),new f("-","subtract",[m,g(1)])]);return new f("*","multiply",[m.clone(),new f("*","multiply",[y(p,t),h])])}return new f("*","multiply",[new f("^","pow",[p.clone(),m.clone()]),new f("+","add",[new f("*","multiply",[y(p,t),new f("/","divide",[m.clone(),p.clone()])]),new f("*","multiply",[y(m,t),new c("log",[p.clone()])])])])}throw new Error('Operator "'+e.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function g(e,t){return new s(u(e,t||r.number))}return h})),Cd="rationalize",Md=Ee(Cd,["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"],(function(e){e.config;var t=e.typed,r=(e.equal,e.isZero,e.add,e.subtract,e.multiply,e.divide,e.pow,e.parse,e.simplifyConstant),n=e.simplifyCore,i=e.simplify,a=(e.fraction,e.bignumber,e.mathWithTransform,e.matrix,e.AccessorNode,e.ArrayNode,e.ConstantNode),o=(e.FunctionNode,e.IndexNode,e.ObjectNode,e.OperatorNode),u=e.SymbolNode;function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=function(){var e=[n,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},r,{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)"}],i=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],a={};return a.firstRules=e.concat(t,i),a.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)"}],a.sucDivRules=i,a.firstRulesAgain=e.concat(t),a.finalRules=[n,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},r,{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))"}],a}(),u=function(e,t,r,n){var a=[],o=i(e,n,t,{exactFractions:!1}),u="+-*"+((r=!!r)?"/":"");!function e(t){var r=t.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!V(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(-1===u.indexOf(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(var n=0;n=1){var m,h;e=c(e);var d,v=!0,y=!1;for(e=i(e,o.firstRules,{},l);h=v?o.distrDivRules:o.sucDivRules,v=!v,(d=(e=i(e,h,{},p)).toString())!==m;)y=!0,m=d;y&&(e=i(e,o.firstRulesAgain,{},l)),e=i(e,o.finalRules,{},l)}var g=[],x={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===s&&(e.args[0]=f(e.args[0],g),e.args[1]=f(e.args[1])),a&&(x.numerator=e.args[0],x.denominator=e.args[1])):(1===s&&(e=f(e,g)),a&&(x.numerator=e,x.denominator=null)),a?(x.coefficients=g,x.variables=u.variables,x.expression=e,x):e}return e.ParenthesisNode,t(Cd,{Node:s,"Node, boolean":function(e,t){return s(e,{},t)},"Node, Object":s,"Node, Object, boolean":s});function c(e,t,r){var n=e.type,i=arguments.length>1;if("OperatorNode"===n&&e.isBinary()){var u,s=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(s=(u=parseFloat(e.args[1].value))>=2&&V(u))),s){if(u>2){var f=e.args[0],l=new o("^","pow",[e.args[0].cloneDeep(),new a(u-1)]);e=new o("*","multiply",[f,l])}else e=new o("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===r?t.content=e:t.args[r]=e)}}if("ParenthesisNode"===n)c(e.content,e,"content");else if("ConstantNode"!==n&&"SymbolNode"!==n)for(var p=0;pr&&(t[c]=0),t[c]+=o.cte*("+"===o.oper?1:-1),void(r=Math.max(c,r))}o.cte=c,""===o.fire&&(t[0]+=o.cte*("+"===o.oper?1:-1))}}(e,null,{cte:1,oper:"+",fire:""});for(var i,s=!0,c=r=t.length-1;c>=0;c--)if(0!==t[c]){var f=new a(s?t[c]:Math.abs(t[c])),l=t[c]<0?"-":"+";if(c>0){var p=new u(n);if(c>1){var m=new a(c);p=new o("^","pow",[p,m])}f=-1===t[c]&&s?new o("-","unaryMinus",[p]):1===Math.abs(t[c])?p:new o("*","multiply",[f,p])}i=s?f:"+"===l?new o("+","add",[i,f]):new o("-","subtract",[i,f]),s=!1}return s?new a(0):i}})),Fd="zpk2tf",Od=Ee(Fd,["typed","add","multiply","Complex","number"],(function(e){var t=e.typed,r=e.add,n=e.multiply,i=e.Complex,a=e.number;return t(Fd,{"Array,Array,number":function(e,t,r){return o(e,t,r)},"Array,Array":function(e,t){return o(e,t,1)},"Matrix,Matrix,number":function(e,t,r){return o(e.valueOf(),t.valueOf(),r)},"Matrix,Matrix":function(e,t){return o(e.valueOf(),t.valueOf(),1)}});function o(e,t,r){e.some((function(e){return"BigNumber"===e.type}))&&(e=e.map((function(e){return a(e)}))),t.some((function(e){return"BigNumber"===e.type}))&&(t=t.map((function(e){return a(e)})));for(var o=[i(1,0)],s=[i(1,0)],c=0;c=0&&o-u0?0:2;else if(o&&!0===o.isSet)o=o.map((function(e){return e-1}));else if(f(o)||l(o))o=o.map((function(e){return e-1}));else if(i(o))o--;else if(a(o))o=o.toNumber()-1;else if("string"!=typeof o)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[r]=o}var u=new t;return t.apply(u,e),u}}),{isTransformFunction:!0}),cy=Ee("map",["typed"],(function(e){var t=e.typed;function r(e,t,r){var i,a;return e[0]&&(i=e[0].compile().evaluate(r)),e[1]&&(a=U(e[1])||_(e[1])?e[1].compile().evaluate(r):iy(e[1],t,r)),n(i,a)}r.rawArgs=!0;var n=t("map",{"Array, function":function(e,t){return fy(e,t,e)},"Matrix, function":function(e,t){return e.create(fy(e.valueOf(),t,e))}});return r}),{isTransformFunction:!0});function fy(e,t,r){return function e(n,i){return Array.isArray(n)?hn(n,(function(t,r){return e(t,i.concat(r+1))})):yu(t,n,i,r,"map")}(e,[])}function ly(e){if(2===e.length&&p(e[0])){var t=(e=e.slice())[1];i(t)?e[1]=t-1:a(t)&&(e[1]=t.minus(1))}return e}var py=Ee("max",["typed","config","numeric","larger"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.larger,a=Kc({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),my=Ee("mean",["typed","add","divide"],(function(e){var t=e.typed,r=e.add,n=e.divide,i=ch({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){e=ly(e);try{return i.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),hy=Ee("min",["typed","config","numeric","smaller"],(function(e){var t=e.typed,r=e.config,n=e.numeric,i=e.smaller,a=ef({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),dy=Ee("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(function(e){var t=e.typed,r=e.config,n=e.matrix,i=e.bignumber,a=e.smaller,o=e.smallerEq,u=e.larger,s=e.largerEq,c=e.add,f=e.isPositive,l=Pu({typed:t,config:r,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:u,largerEq:s,add:c,isPositive:f});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),l.apply(null,e)}})}),{isTransformFunction:!0}),vy=Ee("row",["typed","Index","matrix","range"],(function(e){var t=e.typed,r=e.Index,n=e.matrix,a=e.range,o=Wu({typed:t,Index:r,matrix:n,range:a});return t("row",{"...any":function(e){var t=e.length-1,r=e[t];i(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),yy=Ee("subset",["typed","matrix"],(function(e){var t=e.typed,r=e.matrix,n=es({typed:t,matrix:r});return t("subset",{"...any":function(e){try{return n.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),gy=Ee("concat",["typed","matrix","isInteger"],(function(e){var t=e.typed,r=e.matrix,n=e.isInteger,o=uu({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){var t=e.length-1,r=e[t];i(r)?e[t]=r-1:a(r)&&(e[t]=r.minus(1));try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),xy="diff",by=Ee(xy,["typed","matrix","subtract","number","bignumber"],(function(e){var t=e.typed,r=e.matrix,n=e.subtract,i=e.number,a=e.bignumber,o=ku({typed:t,matrix:r,subtract:n,number:i,bignumber:a});return t(xy,{"...any":function(e){e=ly(e);try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),wy=Ee("std",["typed","map","sqrt","variance"],(function(e){var t=e.typed,r=e.map,n=e.sqrt,i=e.variance,a=yh({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Ny=Ee("sum",["typed","config","add","numeric"],(function(e){var t=e.typed,r=e.config,n=e.add,i=e.numeric,a=ah({typed:t,config:r,add:n,numeric:i});return t("sum",{"...any":function(e){e=ly(e);try{return a.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Dy="cumsum",Ey=Ee(Dy,["typed","add","unaryPlus"],(function(e){var t=e.typed,r=e.add,n=e.unaryPlus,o=uh({typed:t,add:r,unaryPlus:n});return t(Dy,{"...any":function(e){if(2===e.length&&p(e[0])){var t=e[1];i(t)?e[1]=t-1:a(t)&&(e[1]=t.minus(1))}try{return o.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Ay="variance",Sy=Ee(Ay,["typed","add","subtract","multiply","divide","apply","isNaN"],(function(e){var t=e.typed,r=e.add,n=e.subtract,i=e.multiply,a=e.divide,o=e.apply,u=e.isNaN,s=dh({typed:t,add:r,subtract:n,multiply:i,divide:a,apply:o,isNaN:u});return t(Ay,{"...any":function(e){e=ly(e);try{return s.apply(null,e)}catch(e){throw up(e)}}})}),{isTransformFunction:!0}),Cy=(r(4812),r(4279));var My={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},Fy=["Matrix","Array"],Oy=["number","BigNumber","Fraction"];function Ty(e,t){function r(r){if(r){var n=de(e,he);By(r,"matrix",Fy),By(r,"number",Oy),ye(e,r);var i=de(e,he),a=de(r,he);return t("config",i,n,a),i}return de(e,he)}return r.MATRIX_OPTIONS=Fy,r.NUMBER_OPTIONS=Oy,Object.keys(My).forEach((function(t){Object.defineProperty(r,t,{get:function(){return e[t]},enumerable:!0,configurable:!0})})),r}function By(e,t,r){var n,i;void 0!==e[t]&&(n=r,i=e[t],-1===n.indexOf(i))&&console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map((function(e){return JSON.stringify(e)})).join(", ")+".")}const _y=function e(r,n){var B=of({},My,n);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.");var H,V,Z=(H={isNumber:i,isComplex:o,isBigNumber:a,isFraction:u,isUnit:s,isString:c,isArray:f,isMatrix:l,isCollection:p,isDenseMatrix:m,isSparseMatrix:h,isRange:d,isIndex:v,isBoolean:y,isResultSet:g,isHelp:x,isFunction:b,isDate:w,isRegExp:N,isObject:D,isNull:E,isUndefined:A,isAccessorNode:S,isArrayNode:C,isAssignmentNode:M,isBlockNode:F,isConditionalNode:O,isConstantNode:T,isFunctionAssignmentNode:_,isFunctionNode:k,isIndexNode:I,isNode:R,isObjectNode:z,isOperatorNode:q,isParenthesisNode:j,isRangeNode:P,isRelationalNode:L,isSymbolNode:U,isChain:$},V=new Cy,H.on=V.on.bind(V),H.off=V.off.bind(V),H.once=V.once.bind(V),H.emit=V.emit.bind(V),H);Z.config=Ty(B,Z.emit),Z.expression={transform:{},mathWithTransform:{config:Z.config}};var W={};function Y(){for(var e=arguments.length,t=new Array(e),r=0;r2&&void 0!==arguments[2]?arguments[2]:t.fn;if(Nn(a,"."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(a));var o=v(t)?n.expression.transform:n,u=a in n.expression.transform,s=Ne(o,a)?o[a]:void 0,c=function(){var i={};t.dependencies.map(Se).forEach((function(e){if(Nn(e,"."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?i.math=n:"mathWithTransform"===e?i.mathWithTransform=n.expression.mathWithTransform:"classes"===e?i.classes=n:i[e]=n[e]}));var o=t(i);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(void 0===s||r.override)return o;if(e.isTypedFunction(s)&&e.isTypedFunction(o))return e(s,o);if(r.silent)return s;throw new Error('Cannot import "'+a+'": already exists')};t.meta&&!1===t.meta.lazy?(o[a]=c(),s&&u?p(a):(v(t)||d(t))&&we(n.expression.mathWithTransform,a,(function(){return o[a]}))):(we(o,a,c),s&&u?p(a):(v(t)||d(t))&&we(n.expression.mathWithTransform,a,(function(){return o[a]}))),i[a]=t,n.emit("import",a,c)}function h(e){return!Ne(y,e)}function d(e){return!(-1!==e.fn.indexOf(".")||Ne(y,e.fn)||e.meta&&e.meta.isClass)}function v(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}var y={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,r){var n=arguments.length;if(1!==n&&2!==n)throw new Pa("import",n,1,2);r||(r={});var i,f={};for(var p in function e(n,i,a){if(Array.isArray(i))i.forEach((function(t){return e(n,t)}));else if("object"===t(i))for(var o in i)Ne(i,o)&&e(n,i[o],o);else if(Ae(i)||void 0!==a){var u=Ae(i)?v(i)?i.fn+".transform":i.fn:a;if(Ne(n,u)&&n[u]!==i&&!r.silent)throw new Error('Cannot import "'+u+'" twice');n[u]=i}else if(!r.silent)throw new TypeError("Factory, Object, or Array expected")}(f,e),f)if(Ne(f,p)){var h=f[p];if(Ae(h))m(h,r);else if("function"==typeof(i=h)||"number"==typeof i||"string"==typeof i||"boolean"==typeof i||null===i||s(i)||o(i)||a(i)||u(i)||l(i)||Array.isArray(i))c(p,h,r);else if(!r.silent)throw new TypeError("Factory, Object, or Array expected")}}}(Y,0,Z,W);return Z.import=J,Z.on("config",(function(){De(W).forEach((function(e){e&&e.meta&&e.meta.recreateOnConfigChange&&J(e,{override:!0})}))})),Z.create=e.bind(null,r),Z.factory=Ee,Z.import(De(xe(r))),Z.ArgumentsError=Pa,Z.DimensionError=Xr,Z.IndexError=Qr,Z}(e)})(),n.default})())); //# sourceMappingURL=math.js.map