dicomweb-pacs
Version:
A self contained easy to use PACS with DICOMWEB and DIMSE service support
3 lines • 625 kB
JavaScript
/*! For license information please see 2343.bundle.92e4bd57d2649cbf37e9.js.LICENSE.txt */
(self.webpackChunk=self.webpackChunk||[]).push([[2343],{75183:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.Interaction="Interaction",e.HandlesUpdated="HandlesUpdated",e.StatsUpdated="StatsUpdated",e.InitialSetup="InitialSetup",e.Completed="Completed",e.InterpolationUpdated="InterpolationUpdated",e.History="History",e.MetadataReferenceModified="MetadataReferenceModified",e.LabelChange="LabelChange"}(n||(n={}));const i=n},94021:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.TOOL_ACTIVATED="CORNERSTONE_TOOLS_TOOL_ACTIVATED",e.TOOLGROUP_VIEWPORT_ADDED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_ADDED",e.TOOLGROUP_VIEWPORT_REMOVED="CORNERSTONE_TOOLS_TOOLGROUP_VIEWPORT_REMOVED",e.TOOL_MODE_CHANGED="CORNERSTONE_TOOLS_TOOL_MODE_CHANGED",e.CROSSHAIR_TOOL_CENTER_CHANGED="CORNERSTONE_TOOLS_CROSSHAIR_TOOL_CENTER_CHANGED",e.ANNOTATION_ADDED="CORNERSTONE_TOOLS_ANNOTATION_ADDED",e.ANNOTATION_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_COMPLETED",e.ANNOTATION_MODIFIED="CORNERSTONE_TOOLS_ANNOTATION_MODIFIED",e.ANNOTATION_REMOVED="CORNERSTONE_TOOLS_ANNOTATION_REMOVED",e.ANNOTATION_SELECTION_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_SELECTION_CHANGE",e.ANNOTATION_LOCK_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_LOCK_CHANGE",e.ANNOTATION_VISIBILITY_CHANGE="CORNERSTONE_TOOLS_ANNOTATION_VISIBILITY_CHANGE",e.ANNOTATION_RENDERED="CORNERSTONE_TOOLS_ANNOTATION_RENDERED",e.ANNOTATION_INTERPOLATION_PROCESS_COMPLETED="CORNERSTONE_TOOLS_ANNOTATION_INTERPOLATION_PROCESS_COMPLETED",e.INTERPOLATED_ANNOTATIONS_REMOVED="CORNERSTONE_TOOLS_INTERPOLATED_ANNOTATIONS_REMOVED",e.SEGMENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_MODIFIED",e.SEGMENTATION_RENDERED="CORNERSTONE_TOOLS_SEGMENTATION_RENDERED",e.SEGMENTATION_REPRESENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_ADDED",e.SEGMENTATION_ADDED="CORNERSTONE_TOOLS_SEGMENTATION_ADDED",e.SEGMENTATION_REPRESENTATION_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_MODIFIED",e.SEGMENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REMOVED",e.SEGMENTATION_REPRESENTATION_REMOVED="CORNERSTONE_TOOLS_SEGMENTATION_REPRESENTATION_REMOVED",e.SEGMENTATION_DATA_MODIFIED="CORNERSTONE_TOOLS_SEGMENTATION_DATA_MODIFIED",e.HISTORY_UNDO="CORNERSTONE_TOOLS_HISTORY_UNDO",e.HISTORY_REDO="CORNERSTONE_TOOLS_HISTORY_REDO",e.KEY_DOWN="CORNERSTONE_TOOLS_KEY_DOWN",e.KEY_UP="CORNERSTONE_TOOLS_KEY_UP",e.MOUSE_DOWN="CORNERSTONE_TOOLS_MOUSE_DOWN",e.MOUSE_UP="CORNERSTONE_TOOLS_MOUSE_UP",e.MOUSE_DOWN_ACTIVATE="CORNERSTONE_TOOLS_MOUSE_DOWN_ACTIVATE",e.MOUSE_DRAG="CORNERSTONE_TOOLS_MOUSE_DRAG",e.MOUSE_MOVE="CORNERSTONE_TOOLS_MOUSE_MOVE",e.MOUSE_CLICK="CORNERSTONE_TOOLS_MOUSE_CLICK",e.MOUSE_DOUBLE_CLICK="CORNERSTONE_TOOLS_MOUSE_DOUBLE_CLICK",e.MOUSE_WHEEL="CORNERSTONE_TOOLS_MOUSE_WHEEL",e.TOUCH_START="CORNERSTONE_TOOLS_TOUCH_START",e.TOUCH_START_ACTIVATE="CORNERSTONE_TOOLS_TOUCH_START_ACTIVATE",e.TOUCH_PRESS="CORNERSTONE_TOOLS_TOUCH_PRESS",e.TOUCH_DRAG="CORNERSTONE_TOOLS_TOUCH_DRAG",e.TOUCH_END="CORNERSTONE_TOOLS_TOUCH_END",e.TOUCH_TAP="CORNERSTONE_TOOLS_TAP",e.TOUCH_SWIPE="CORNERSTONE_TOOLS_SWIPE"}(n||(n={}));const i=n},18682:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.Labelmap="Labelmap",e.Contour="Contour",e.Surface="Surface"}(n||(n={}));const i=n},84093:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.OnInteractionStart="onInteractionStart",e.OnInteractionEnd="onInteractionEnd",e.Preview="preview",e.RejectPreview="rejectPreview",e.AcceptPreview="acceptPreview",e.Fill="fill",e.Interpolate="interpolate",e.StrategyFunction="strategyFunction",e.CreateIsInThreshold="createIsInThreshold",e.Initialize="initialize",e.INTERNAL_setValue="setValue",e.AddPreview="addPreview",e.ComputeInnerCircleRadius="computeInnerCircleRadius",e.GetStatistics="getStatistics",e.EnsureImageVolumeFor3DManipulation="ensureImageVolumeFor3DManipulation",e.EnsureSegmentationVolumeFor3DManipulation="ensureSegmentationVolumeFor3DManipulation"}(n||(n={}));const i=n},66452:(e,r,t)=>{"use strict";var n,i;t.d(r,{i:()=>n,q:()=>i}),function(e){e[e.Primary=1]="Primary",e[e.Secondary=2]="Secondary",e[e.Primary_And_Secondary=3]="Primary_And_Secondary",e[e.Auxiliary=4]="Auxiliary",e[e.Primary_And_Auxiliary=5]="Primary_And_Auxiliary",e[e.Secondary_And_Auxiliary=6]="Secondary_And_Auxiliary",e[e.Primary_And_Secondary_And_Auxiliary=7]="Primary_And_Secondary_And_Auxiliary",e[e.Fourth_Button=8]="Fourth_Button",e[e.Fifth_Button=16]="Fifth_Button",e[e.Wheel=524288]="Wheel",e[e.Wheel_Primary=524289]="Wheel_Primary"}(n||(n={})),function(e){e[e.Shift=16]="Shift",e[e.Ctrl=17]="Ctrl",e[e.Alt=18]="Alt",e[e.Meta=91]="Meta",e[e.ShiftCtrl=1617]="ShiftCtrl",e[e.ShiftAlt=1618]="ShiftAlt",e[e.ShiftMeta=1691]="ShiftMeta",e[e.CtrlAlt=1718]="CtrlAlt",e[e.CtrlMeta=1791]="CtrlMeta",e[e.AltMeta=1891]="AltMeta"}(i||(i={}))},49892:(e,r,t)=>{"use strict";var n;t.d(r,{A:()=>i}),function(e){e.Active="Active",e.Passive="Passive",e.Enabled="Enabled",e.Disabled="Disabled"}(n||(n={}));const i=n},10401:(e,r,t)=>{"use strict";var n;t.d(r,{H:()=>n}),function(e){e.UP="UP",e.DOWN="DOWN",e.LEFT="LEFT",e.RIGHT="RIGHT"}(n||(n={}))},99737:(e,r,t)=>{"use strict";t.r(r),t.d(r,{AnnotationStyleStates:()=>o,ChangeTypes:()=>p.A,Events:()=>u.A,KeyboardBindings:()=>i.q,MouseBindings:()=>i.i,SegmentationRepresentations:()=>l.A,StrategyCallbacks:()=>f.A,Swipe:()=>c.H,ToolModes:()=>a.A,WorkerTypes:()=>m});var n,i=t(66452),a=t(49892);!function(e){e.Default="",e.Highlighted="Highlighted",e.Selected="Selected",e.Locked="Locked",e.AutoGenerated="AutoGenerated"}(n||(n={}));const o=n;var s,u=t(94021),l=t(18682),c=t(10401),f=t(84093),p=t(75183);!function(e){e.POLYSEG_CONTOUR_TO_LABELMAP="Converting Contour to Labelmap",e.POLYSEG_SURFACE_TO_LABELMAP="Converting Surfaces to Labelmap",e.POLYSEG_CONTOUR_TO_SURFACE="Converting Contour to Surface",e.POLYSEG_LABELMAP_TO_SURFACE="Converting Labelmap to Surface",e.SURFACE_CLIPPING="Clipping Surfaces",e.COMPUTE_STATISTICS="Computing Statistics",e.INTERPOLATE_LABELMAP="Interpolating Labelmap",e.COMPUTE_LARGEST_BIDIRECTIONAL="Computing Largest Bidirectional",e.GENERATE_CONTOUR_SETS="Generating Contour Sets"}(s||(s={}));const m=s},2682:e=>{"use strict";var r=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},t={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},n={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},i=function(e,t){return r({},e,t)};e.exports=function(e){for(var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=a.preserveFormatting,s=void 0!==o&&o,u=a.escapeMapFn,l=void 0===u?i:u,c=String(e),f="",p=l(r({},t),s?r({},n):{}),m=Object.keys(p),d=function(){var e=!1;m.forEach((function(r,t){e||c.length>=r.length&&c.slice(0,r.length)===r&&(f+=p[m[t]],c=c.slice(r.length,c.length),e=!0)})),e||(f+=c.slice(0,1),c=c.slice(1,c.length))};c;)d();return f}},67042:function(e){!function(r){"use strict";var t={s:1,n:0,d:1};function n(e,r){if(isNaN(e=parseInt(e,10)))throw c();return e*r}function i(e,r){if(0===r)throw l();var t=Object.create(u.prototype);t.s=e<0?-1:1;var n=s(e=e<0?-e:e,r);return t.n=e/n,t.d=r/n,t}function a(e){for(var r={},t=e,n=2,i=4;i<=t;){for(;t%n==0;)t/=n,r[n]=(r[n]||0)+1;i+=1+2*n++}return t!==e?t>1&&(r[t]=(r[t]||0)+1):r[e]=(r[e]||0)+1,r}var o=function(e,r){var i,a=0,o=1,s=1,u=0,p=0,m=0,d=1,h=1,g=0,y=1,v=1,x=1,b=1e7;if(null==e);else if(void 0!==r){if(s=(a=e)*(o=r),a%1!=0||o%1!=0)throw f()}else switch(typeof e){case"object":if("d"in e&&"n"in e)a=e.n,o=e.d,"s"in e&&(a*=e.s);else{if(!(0 in e))throw c();a=e[0],1 in e&&(o=e[1])}s=a*o;break;case"number":if(e<0&&(s=e,e=-e),e%1==0)a=e;else if(e>0){for(e>=1&&(e/=h=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));y<=b&&x<=b;){if(e===(i=(g+v)/(y+x))){y+x<=b?(a=g+v,o=y+x):x>y?(a=v,o=x):(a=g,o=y);break}e>i?(g+=v,y+=x):(v+=g,x+=y),y>b?(a=v,o=x):(a=g,o=y)}a*=h}else(isNaN(e)||isNaN(r))&&(o=a=NaN);break;case"string":if(null===(y=e.match(/\d+|./g)))throw c();if("-"===y[g]?(s=-1,g++):"+"===y[g]&&g++,y.length===g+1?p=n(y[g++],s):"."===y[g+1]||"."===y[g]?("."!==y[g]&&(u=n(y[g++],s)),(++g+1===y.length||"("===y[g+1]&&")"===y[g+3]||"'"===y[g+1]&&"'"===y[g+3])&&(p=n(y[g],s),d=Math.pow(10,y[g].length),g++),("("===y[g]&&")"===y[g+2]||"'"===y[g]&&"'"===y[g+2])&&(m=n(y[g+1],s),h=Math.pow(10,y[g+1].length)-1,g+=3)):"/"===y[g+1]||":"===y[g+1]?(p=n(y[g],s),d=n(y[g+2],1),g+=3):"/"===y[g+3]&&" "===y[g+1]&&(u=n(y[g],s),p=n(y[g+2],s),d=n(y[g+4],1),g+=5),y.length<=g){s=a=m+(o=d*h)*u+h*p;break}default:throw c()}if(0===o)throw l();t.s=s<0?-1:1,t.n=Math.abs(a),t.d=Math.abs(o)};function s(e,r){if(!e)return r;if(!r)return e;for(;;){if(!(e%=r))return r;if(!(r%=e))return e}}function u(e,r){if(o(e,r),!(this instanceof u))return i(t.s*t.n,t.d);e=s(t.d,t.n),this.s=t.s,this.n=t.n/e,this.d=t.d/e}var l=function(){return new Error("Division by Zero")},c=function(){return new Error("Invalid argument")},f=function(){return new Error("Parameters must be integer")};u.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(e,r){return o(e,r),i(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(e,r){return o(e,r),i(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(e,r){return o(e,r),i(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(e,r){return o(e,r),i(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(e,r){if(isNaN(this.n)||isNaN(this.d))return new u(NaN);if(void 0===e)return i(this.s*this.n%this.d,1);if(o(e,r),0===t.n&&0===this.d)throw l();return i(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(e,r){return o(e,r),i(s(t.n,this.n)*s(t.d,this.d),t.d*this.d)},lcm:function(e,r){return o(e,r),0===t.n&&0===this.n?i(0,1):i(t.n*this.n,s(t.n,this.n)*s(t.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new u(NaN):i(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 u(NaN):i(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 u(NaN):i(Math.round(e*this.s*this.n/this.d),e)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(e,r){if(o(e,r),1===t.d)return t.s<0?i(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n)):i(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var n=a(this.n),s=a(this.d),u=1,l=1;for(var c in n)if("1"!==c){if("0"===c){u=0;break}if(n[c]*=t.n,n[c]%t.d!=0)return null;n[c]/=t.d,u*=Math.pow(c,n[c])}for(var c in s)if("1"!==c){if(s[c]*=t.n,s[c]%t.d!=0)return null;s[c]/=t.d,l*=Math.pow(c,s[c])}return t.s<0?i(l,u):i(u,l)},equals:function(e,r){return o(e,r),this.s*this.n*t.d==t.s*t.n*this.d},compare:function(e,r){o(e,r);var n=this.s*this.n*t.d-t.s*t.n*this.d;return(0<n)-(n<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var r=this.abs(),t=r.toContinued(),n=1;n<t.length;n++){for(var a=i(t[n-1],1),o=n-2;o>=0;o--)a=a.inverse().add(t[o]);if(Math.abs(a.sub(r).valueOf())<e)return a.mul(this.s)}return this},divisible:function(e,r){return o(e,r),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var r,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(e&&(r=Math.floor(n/i))>0&&(t+=r,t+=" ",n%=i),t+=n,t+="/",t+=i),t},toLatex:function(e){var r,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(e&&(r=Math.floor(n/i))>0&&(t+=r,n%=i),t+="\\frac{",t+=n,t+="}{",t+=i,t+="}"),t},toContinued:function(){var e,r=this.n,t=this.d,n=[];if(isNaN(r)||isNaN(t))return n;do{n.push(Math.floor(r/t)),e=r%t,r=t,t=e}while(1!==r);return n},toString:function(e){var r=this.n,t=this.d;if(isNaN(r)||isNaN(t))return"NaN";e=e||15;var n=function(e,r){for(;r%2==0;r/=2);for(;r%5==0;r/=5);if(1===r)return 0;for(var t=10%r,n=1;1!==t;n++)if(t=10*t%r,n>2e3)return 0;return n}(0,t),i=function(e,r,t){for(var n=1,i=function(e,r,t){for(var n=1;r>0;e=e*e%t,r>>=1)1&r&&(n=n*e%t);return n}(10,t,r),a=0;a<300;a++){if(n===i)return a;n=10*n%r,i=10*i%r}return 0}(0,t,n),a=this.s<0?"-":"";if(a+=r/t|0,r%=t,(r*=10)&&(a+="."),n){for(var o=i;o--;)a+=r/t|0,r%=t,r*=10;a+="(";for(o=n;o--;)a+=r/t|0,r%=t,r*=10;a+=")"}else for(o=e;r&&o--;)a+=r/t|0,r%=t,r*=10;return a}},Object.defineProperty(u,"__esModule",{value:!0}),u.default=u,u.Fraction=u,e.exports=u}()},52794:e=>{e.exports=function e(r,t){"use strict";var n,i,a=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,l=/^0/,c=function(r){return e.insensitive&&(""+r).toLowerCase()||""+r},f=c(r).replace(o,"")||"",p=c(t).replace(o,"")||"",m=f.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=p.replace(a,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||h&&p.match(s)&&Date.parse(p)||null;if(g){if(h<g)return-1;if(h>g)return 1}for(var y=0,v=Math.max(m.length,d.length);y<v;y++){if(n=!(m[y]||"").match(l)&&parseFloat(m[y])||m[y]||0,i=!(d[y]||"").match(l)&&parseFloat(d[y])||d[y]||0,isNaN(n)!==isNaN(i))return isNaN(n)?1:-1;if(typeof n!=typeof i&&(n+="",i+=""),n<i)return-1;if(n>i)return 1}return 0}},45422:e=>{function r(){}r.prototype={on:function(e,r,t){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:r,ctx:t}),this},once:function(e,r,t){var n=this;function i(){n.off(e,i),r.apply(t,arguments)}return i._=r,this.on(e,i,t)},emit:function(e){for(var r=[].slice.call(arguments,1),t=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=t.length;n<i;n++)t[n].fn.apply(t[n].ctx,r);return this},off:function(e,r){var t=this.e||(this.e={}),n=t[e],i=[];if(n&&r)for(var a=0,o=n.length;a<o;a++)n[a].fn!==r&&n[a].fn._!==r&&i.push(n[a]);return i.length?t[e]=i:delete t[e],this}},e.exports=r,e.exports.TinyEmitter=r},55807:(e,r,t)=>{"use strict";t.d(r,{WCD:()=>Qw,lwT:()=>mw});var n=t(77940),i={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function a(e){return"number"==typeof e}function o(e){return!(!e||"object"!=typeof e||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function s(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function u(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function l(e){return e&&!0===e.constructor.prototype.isUnit||!1}function c(e){return"string"==typeof e}var f=Array.isArray;function p(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function m(e){return Array.isArray(e)||p(e)}function d(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 g(e){return e&&!0===e.constructor.prototype.isRange||!1}function y(e){return e&&!0===e.constructor.prototype.isIndex||!1}function v(e){return"boolean"==typeof e}function x(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function b(e){return e&&!0===e.constructor.prototype.isHelp||!1}function w(e){return"function"==typeof e}function N(e){return e instanceof Date}function D(e){return e instanceof RegExp}function E(e){return!(!e||"object"!=typeof e||e.constructor!==Object||s(e)||u(e))}function A(e){return null===e}function S(e){return void 0===e}function C(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function M(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function O(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function T(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function F(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function _(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function B(e){return _(e)||P(e)&&1===e.args.length&&_(e.args[0])&&"-+~".includes(e.op)}function I(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function z(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function q(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 k(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function P(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function U(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function j(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.constructor.prototype.isChain||!1}function G(e){var r=typeof e;return"object"===r?null===e?"null":o(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":r}function V(e){var r=typeof e;if("number"===r||"string"===r||"boolean"===r||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return V(e)}));if(e instanceof Date)return new Date(e.valueOf());if(o(e))return e;if(E(e))return function(e,r){var t={};for(var n in e)Y(e,n)&&(t[n]=r(e[n]));return t}(e,V);throw new TypeError("Cannot clone: unknown type of value (value: ".concat(e,")"))}function Z(e,r){for(var t in r)Y(r,t)&&(e[t]=r[t]);return e}function W(e,r){var t,n,i;if(Array.isArray(e)){if(!Array.isArray(r))return!1;if(e.length!==r.length)return!1;for(n=0,i=e.length;n<i;n++)if(!W(e[n],r[n]))return!1;return!0}if("function"==typeof e)return e===r;if(e instanceof Object){if(Array.isArray(r)||!(r instanceof Object))return!1;for(t in e)if(!(t in r)||!W(e[t],r[t]))return!1;for(t in r)if(!(t in e))return!1;return!0}return e===r}function Y(e,r){return e&&Object.hasOwnProperty.call(e,r)}var J=["Matrix","Array"],X=["number","BigNumber","Fraction"];var Q=function(e){if(e)throw new Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(i)};function K(){return!0}function ee(){return!1}function re(){}(0,n.A)(Q,i,{MATRIX_OPTIONS:J,NUMBER_OPTIONS:X});const te="Argument is not a typed-function.";const ne=function e(){function r(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const t=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:r},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],n={name:"any",test:K,isAny:!0};let i,a,o=0,s={createCount:0};function u(e){const r=i.get(e);if(r)return r;let t='Unknown type "'+e+'"';const n=e.toLowerCase();let o;for(o of a)if(o.toLowerCase()===n){t+='. Did you mean "'+o+'" ?';break}throw new TypeError(t)}function l(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const t=r?u(r).index:a.length,n=[];for(let r=0;r<e.length;++r){if(!e[r]||"string"!=typeof e[r].name||"function"!=typeof e[r].test)throw new TypeError("Object with properties {name: string, test: function} expected");const a=e[r].name;if(i.has(a))throw new TypeError('Duplicate type name "'+a+'"');n.push(a),i.set(a,{name:a,test:e[r].test,isAny:e[r].isAny,index:t+r,conversionsTo:[]})}const o=a.slice(t);a=a.slice(0,t).concat(n).concat(o);for(let e=t+n.length;e<a.length;++e)i.get(a[e]).index=e}function c(){i=new Map,a=[],o=0,l([n],!1)}function f(e){const r=a.filter((r=>{const t=i.get(r);return!t.isAny&&t.test(e)}));return r.length?r:["any"]}function p(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function m(e,r,t){if(!p(e))throw new TypeError(te);const n=t&&t.exact,i=v(Array.isArray(r)?r.join(","):r),a=d(i);if(!n||a in e.signatures){const r=e._typedFunctionData.signatureMap.get(a);if(r)return r}const o=i.length;let s,u;if(n){let r;for(r in s=[],e.signatures)s.push(e._typedFunctionData.signatureMap.get(r))}else s=e._typedFunctionData.signatures;for(let e=0;e<o;++e){const r=i[e],t=[];let n;for(n of s){const i=N(n.params,e);if(i&&(!r.restParam||i.restParam)){if(!i.hasAny){const e=y(i);if(r.types.some((r=>!e.has(r.name))))continue}t.push(n)}}if(s=t,0===s.length)break}for(u of s)if(u.params.length<=o)return u;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+d(i,", ")+"))")}function d(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(r)}function h(e){const r=0===e.indexOf("..."),t=(r?e.length>3?e.slice(3):"any":e).split("|").map((e=>u(e.trim())));let n=!1,i=r?"...":"";return{types:t.map((function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:r}}function g(e){const r=function(e){if(0===e.length)return[];const r=e.map(u);e.length>1&&r.sort(((e,r)=>e.index-r.index));let t=r[0].conversionsTo;if(1===e.length)return t;t=t.concat([]);const n=new Set(e);for(let e=1;e<r.length;++e){let i;for(i of r[e].conversionsTo)n.has(i.from)||(t.push(i),n.add(i.from))}return t}(e.types.map((e=>e.name)));let t=e.hasAny,n=e.name;const i=r.map((function(e){const r=u(e.from);return t=r.isAny||t,n+="|"+e.from,{name:e.from,typeIndex:r.index,test:r.test,isAny:r.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:n,hasAny:t,hasConversion:i.length>0,restParam:e.restParam}}function y(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((r=>e.typeSet.add(r.name)))),e.typeSet}function v(e){const r=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const t=e.trim();if(""===t)return r;const n=t.split(",");for(let e=0;e<n.length;++e){const t=h(n[e].trim());if(t.restParam&&e!==n.length-1)throw new SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===t.types.length)return null;r.push(t)}return r}function x(e){const r=U(e);return!!r&&r.restParam}function b(e){if(e&&0!==e.types.length){if(1===e.types.length)return u(e.types[0].name).test;if(2===e.types.length){const r=u(e.types[0].name).test,t=u(e.types[1].name).test;return function(e){return r(e)||t(e)}}{const r=e.types.map((function(e){return u(e.name).test}));return function(e){for(let t=0;t<r.length;t++)if(r[t](e))return!0;return!1}}}return K}function w(e){let r,t,n;if(x(e)){r=P(e).map(b);const t=r.length,n=b(U(e)),i=function(e){for(let r=t;r<e.length;r++)if(!n(e[r]))return!1;return!0};return function(e){for(let t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return i(e)&&e.length>=t+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(t=b(e[0]),function(e){return t(e[0])&&1===e.length}):2===e.length?(t=b(e[0]),n=b(e[1]),function(e){return t(e[0])&&n(e[1])&&2===e.length}):(r=e.map(b),function(e){for(let t=0;t<r.length;t++)if(!r[t](e[t]))return!1;return e.length===r.length})}function N(e,r){return r<e.length?e[r]:x(e)?U(e):null}function D(e,r){const t=N(e,r);return t?y(t):new Set}function E(e){return null===e.conversion||void 0===e.conversion}function A(e,r){const t=new Set;return e.forEach((e=>{const n=D(e.params,r);let i;for(i of n)t.add(i)})),t.has("any")?["any"]:Array.from(t)}function S(e,r,t){let n,i;const a=e||"unnamed";let o,s=t;for(o=0;o<r.length;o++){const e=[];if(s.forEach((t=>{const n=b(N(t.params,o));(o<t.params.length||x(t.params))&&n(r[o])&&e.push(t)})),0===e.length){if(i=A(s,o),i.length>0){const e=f(r[o]);return n=new TypeError("Unexpected type of argument in function "+a+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+o+")"),n.data={category:"wrongType",fn:a,index:o,actual:e,expected:i},n}}else s=e}const u=s.map((function(e){return x(e.params)?1/0:e.params.length}));if(r.length<Math.min.apply(null,u))return i=A(s,o),n=new TypeError("Too few arguments in function "+a+" (expected: "+i.join(" or ")+", index: "+r.length+")"),n.data={category:"tooFewArgs",fn:a,index:r.length,expected:i},n;const l=Math.max.apply(null,u);if(r.length>l)return n=new TypeError("Too many arguments in function "+a+" (expected: "+l+", actual: "+r.length+")"),n.data={category:"tooManyArgs",fn:a,index:r.length,expectedLength:l},n;const c=[];for(let e=0;e<r.length;++e)c.push(f(r[e]).join("|"));return n=new TypeError('Arguments of type "'+c.join(", ")+'" do not match any of the defined signatures of function '+a+"."),n.data={category:"mismatch",actual:c},n}function C(e){let r=a.length+1;for(let t=0;t<e.types.length;t++)E(e.types[t])&&(r=Math.min(r,e.types[t].typeIndex));return r}function M(e){let r=o+1;for(let t=0;t<e.types.length;t++)E(e.types[t])||(r=Math.min(r,e.types[t].conversionIndex));return r}function O(e,r){if(e.hasAny){if(!r.hasAny)return 1}else if(r.hasAny)return-1;if(e.restParam){if(!r.restParam)return 1}else if(r.restParam)return-1;if(e.hasConversion){if(!r.hasConversion)return 1}else if(r.hasConversion)return-1;const t=C(e)-C(r);if(t<0)return-1;if(t>0)return 1;const n=M(e)-M(r);return n<0?-1:n>0?1:0}function T(e,r){const t=e.params,n=r.params,i=U(t),a=U(n),o=x(t),s=x(n);if(o&&i.hasAny){if(!s||!a.hasAny)return 1}else if(s&&a.hasAny)return-1;let u,l=0,c=0;for(u of t)u.hasAny&&++l,u.hasConversion&&++c;let f=0,p=0;for(u of n)u.hasAny&&++f,u.hasConversion&&++p;if(l!==f)return l-f;if(o&&i.hasConversion){if(!s||!a.hasConversion)return 1}else if(s&&a.hasConversion)return-1;if(c!==p)return c-p;if(o){if(!s)return 1}else if(s)return-1;const m=(t.length-n.length)*(o?-1:1);if(0!==m)return m;const d=[];let h,g=0;for(let e=0;e<t.length;++e){const r=O(t[e],n[e]);d.push(r),g+=r}if(0!==g)return g;for(h of d)if(0!==h)return h;return 0}function F(e,r){let t=r;if(e.some((e=>e.hasConversion))){const n=x(e),i=e.map(_);t=function(){const e=[],t=n?arguments.length-1:arguments.length;for(let r=0;r<t;r++)e[r]=i[r](arguments[r]);return n&&(e[t]=arguments[t].map(i[t])),r.apply(this,e)}}let n=t;if(x(e)){const r=e.length-1;n=function(){return t.apply(this,L(arguments,0,r).concat([L(arguments,r)]))}}return n}function _(e){let r,t,n,i;const a=[],o=[];switch(e.types.forEach((function(e){e.conversion&&(a.push(u(e.conversion.from).test),o.push(e.conversion.convert))})),o.length){case 0:return function(e){return e};case 1:return r=a[0],n=o[0],function(e){return r(e)?n(e):e};case 2:return r=a[0],t=a[1],n=o[0],i=o[1],function(e){return r(e)?n(e):t(e)?i(e):e};default:return function(e){for(let r=0;r<o.length;r++)if(a[r](e))return o[r](e);return e}}}function B(e){return function e(r,t,n){if(t<r.length){const o=r[t];let s=[];if(o.restParam){const e=o.types.filter(E);e.length<o.types.length&&s.push({types:e,name:"..."+e.map((e=>e.name)).join("|"),hasAny:e.some((e=>e.isAny)),hasConversion:!1,restParam:!0}),s.push(o)}else s=o.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return i=s,a=function(i){return e(r,t+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(a))}return[n];var i,a}(e,0,[])}function I(e,r){const t=Math.max(e.length,r.length);for(let n=0;n<t;n++){const t=D(e,n),i=D(r,n);let a,o=!1;for(a of i)if(t.has(a)){o=!0;break}if(!o)return!1}const n=e.length,i=r.length,a=x(e),o=x(r);return a?o?n===i:i>=n:o?n>=i:n===i}function z(e,r,t){const n=[];let i;for(i of e){let e=t[i];if("number"!=typeof e)throw new TypeError('No definition for referenced signature "'+i+'"');if(e=r[e],"function"!=typeof e)return!1;n.push(e)}return n}function q(e,r,t){const n=function(e){return e.map((e=>G(e)?H(e.referToSelf.callback):$(e)?j(e.referTo.references,e.referTo.callback):e))}(e),i=new Array(n.length).fill(!1);let a=!0;for(;a;){a=!1;let e=!0;for(let o=0;o<n.length;++o){if(i[o])continue;const s=n[o];if(G(s))n[o]=s.referToSelf.callback(t),n[o].referToSelf=s.referToSelf,i[o]=!0,e=!1;else if($(s)){const t=z(s.referTo.references,n,r);t?(n[o]=s.referTo.callback.apply(this,t),n[o].referTo=s.referTo,i[o]=!0,e=!1):a=!0}}if(e&&a)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return n}function R(e,r){if(s.createCount++,0===Object.keys(r).length)throw new SyntaxError("No signatures provided");s.warnAgainstDeprecatedThis&&function(e){const r=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach((t=>{const n=e[t];if(r.test(n.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")}))}(r);const t=[],n=[],i={},a=[];let o;for(o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;const e=v(o);if(!e)continue;t.forEach((function(r){if(I(r,e))throw new TypeError('Conflicting signatures "'+d(r)+'" and "'+d(e)+'".')})),t.push(e);const s=n.length;n.push(r[o]);const u=e.map(g);let l;for(l of B(u)){const e=d(l);a.push({params:l,name:e,fn:s}),l.every((e=>!e.hasConversion))&&(i[e]=s)}}a.sort(T);const u=q(n,i,se);let l;for(l in i)Object.prototype.hasOwnProperty.call(i,l)&&(i[l]=u[i[l]]);const c=[],f=new Map;for(l of a)f.has(l.name)||(l.fn=u[l.fn],c.push(l),f.set(l.name,l));const p=c[0]&&c[0].params.length<=2&&!x(c[0].params),m=c[1]&&c[1].params.length<=2&&!x(c[1].params),h=c[2]&&c[2].params.length<=2&&!x(c[2].params),y=c[3]&&c[3].params.length<=2&&!x(c[3].params),N=c[4]&&c[4].params.length<=2&&!x(c[4].params),D=c[5]&&c[5].params.length<=2&&!x(c[5].params),E=p&&m&&h&&y&&N&&D;for(let e=0;e<c.length;++e)c[e].test=w(c[e].params);const A=p?b(c[0].params[0]):ee,S=m?b(c[1].params[0]):ee,C=h?b(c[2].params[0]):ee,M=y?b(c[3].params[0]):ee,O=N?b(c[4].params[0]):ee,_=D?b(c[5].params[0]):ee,z=p?b(c[0].params[1]):ee,R=m?b(c[1].params[1]):ee,k=h?b(c[2].params[1]):ee,P=y?b(c[3].params[1]):ee,U=N?b(c[4].params[1]):ee,L=D?b(c[5].params[1]):ee;for(let e=0;e<c.length;++e)c[e].implementation=F(c[e].params,c[e].fn);const j=p?c[0].implementation:re,H=m?c[1].implementation:re,$=h?c[2].implementation:re,G=y?c[3].implementation:re,V=N?c[4].implementation:re,Z=D?c[5].implementation:re,W=p?c[0].params.length:-1,Y=m?c[1].params.length:-1,J=h?c[2].params.length:-1,X=y?c[3].params.length:-1,Q=N?c[4].params.length:-1,K=D?c[5].params.length:-1,te=E?6:0,ne=c.length,ie=c.map((e=>e.test)),ae=c.map((e=>e.implementation)),oe=function(){for(let e=te;e<ne;e++)if(ie[e](arguments))return ae[e].apply(this,arguments);return s.onMismatch(e,arguments,c)};function se(e,r){return arguments.length===W&&A(e)&&z(r)?j.apply(this,arguments):arguments.length===Y&&S(e)&&R(r)?H.apply(this,arguments):arguments.length===J&&C(e)&&k(r)?$.apply(this,arguments):arguments.length===X&&M(e)&&P(r)?G.apply(this,arguments):arguments.length===Q&&O(e)&&U(r)?V.apply(this,arguments):arguments.length===K&&_(e)&&L(r)?Z.apply(this,arguments):oe.apply(this,arguments)}try{Object.defineProperty(se,"name",{value:e})}catch(e){}return se.signatures=i,se._typedFunctionData={signatures:c,signatureMap:f},se}function k(e,r,t){throw S(e,r,t)}function P(e){return L(e,0,e.length-1)}function U(e){return e[e.length-1]}function L(e,r,t){return Array.prototype.slice.call(e,r,t)}function j(e,r){return{referTo:{references:e,callback:r}}}function H(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function $(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function G(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function V(e,r){if(!e)return r;if(r&&r!==e){const t=new Error("Function names do not match (expected: "+e+", actual: "+r+")");throw t.data={actual:r,expected:e},t}return e}function Z(e){let r;for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(p(e[t])||"string"==typeof e[t].signature)&&(r=V(r,e[t].name));return r}function W(e,r){let t;for(t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(t in e&&r[t]!==e[t]){const n=new Error('Signature "'+t+'" is defined twice');throw n.data={signature:t,sourceFunction:r[t],destFunction:e[t]},n}e[t]=r[t]}}c(),l(t);const Y=s;function J(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw new SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return s=function(e){const t="string"==typeof e;let n=t?e:"";const i={};for(let e=t?1:0;e<arguments.length;++e){const a=arguments[e];let o,s={};if("function"==typeof a?(o=a.name,"string"==typeof a.signature?s[a.signature]=a:p(a)&&(s=a.signatures)):r(a)&&(s=a,t||(o=Z(a))),0===Object.keys(s).length){const r=new TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw r.data={index:e,argument:a},r}t||(n=V(n,o)),W(i,s)}return R(n||"",i)},s.create=e,s.createCount=Y.createCount,s.onMismatch=k,s.throwMismatchError=k,s.createError=S,s.clear=c,s.clearConversions=function(){let e;for(e of a)i.get(e).conversionsTo=[];o=0},s.addTypes=l,s._findType=u,s.referTo=function(){const e=P(arguments).map((e=>d(v(e)))),r=U(arguments);if("function"!=typeof r)throw new TypeError("Callback function expected as last argument");return j(e,r)},s.referToSelf=H,s.convert=function(e,r){const t=u(r);if(t.test(e))return e;const n=t.conversionsTo;if(0===n.length)throw new Error("There are no conversions to "+r+" defined.");for(let r=0;r<n.length;r++){if(u(n[r].from).test(e))return n[r].convert(e)}throw new Error("Cannot convert "+e+" to "+r)},s.findSignature=m,s.find=function(e,r,t){return m(e,r,t).implementation},s.isTypedFunction=p,s.warnAgainstDeprecatedThis=!0,s.addType=function(e,r){let t="any";!1!==r&&i.has("Object")&&(t="Object"),s.addTypes([e],t)},s.addConversion=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};J(e);const t=u(e.to),n=t.conversionsTo.find((r=>r.from===e.from));if(n){if(!r||!r.override)throw new Error('There is already a conversion from "'+e.from+'" to "'+t.name+'"');s.removeConversion({from:n.from,to:e.to,convert:n.convert})}t.conversionsTo.push({from:e.from,convert:e.convert,index:o++})},s.addConversions=function(e,r){e.forEach((e=>s.addConversion(e,r)))},s.removeConversion=function(e){J(e);const r=u(e.to),t=function(e,r){for(let t=0;t<e.length;t++)if(r(e[t]))return e[t]}(r.conversionsTo,(r=>r.from===e.from));if(!t)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(t.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");const n=r.conversionsTo.indexOf(t);r.conversionsTo.splice(n,1)},s.resolve=function(e,r){if(!p(e))throw new TypeError(te);const t=e._typedFunctionData.signatures;for(let e=0;e<t.length;++e)if(t[e].test(r))return t[e];return null},s}();function ie(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}var ae=Math.sign||function(e){return e>0?1:e<0?-1:0},oe=Math.log2||function(e){return Math.log(e)/Math.LN2},se=Math.log10||function(e){return Math.log(e)/Math.LN10},ue=Math.log1p||function(e){return Math.log(e+1)},le=Math.cbrt||function(e){if(0===e)return e;var r,t=e<0;return t&&(e=-e),r=isFinite(e)?(e/((r=Math.exp(Math.log(e)/3))*r)+2*r)/3:e,t?-r:r},ce=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function fe(e,r,t){var n={2:"0b",8:"0o",16:"0x"}[r],i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!ie(t))throw new Error("size must be an integer");if(e>2**(t-1)-1||e<-(2**(t-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!ie(e))throw new Error("Value must be an integer");e<0&&(e+=2**t),i="i".concat(t)}var a="";return e<0&&(e=-e,a="-"),"".concat(a).concat(n).concat(e.toString(r)).concat(i)}function pe(e,r){if("function"==typeof r)return r(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";var{notation:t,precision:n,wordSize:i}=me(r);switch(t){case"fixed":return he(e,n);case"exponential":return ge(e,n);case"engineering":return function(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=de(e),n=ye(t,r),i=n.exponent,o=n.coefficients,s=i%3==0?i:i<0?i-3-i%3:i-i%3;if(a(r))for(;r>o.length||i-s+1>o.length;)o.push(0);else for(var u=Math.abs(i-s)-(o.length-1),l=0;l<u;l++)o.push(0);var c=Math.abs(i-s),f=1;for(;c>0;)f++,c--;var p=o.slice(f).join(""),m=a(r)&&p.length||p.match(/[1-9]/)?"."+p:"",d=o.slice(0,f).join("")+m+"e"+(i>=0?"+":"")+s.toString();return n.sign+d}(e,n);case"bin":return fe(e,2,i);case"oct":return fe(e,8,i);case"hex":return fe(e,16,i);case"auto":return function(e,r,t){if(isNaN(e)||!isFinite(e))return String(e);var n=Me(null==t?void 0:t.lowerExp,-3),i=Me(null==t?void 0:t.upperExp,5),a=de(e),o=r?ye(a,r):a;if(o.exponent<n||o.exponent>=i)return ge(e,r);var s=o.coefficients,u=o.exponent;s.length<r&&(s=s.concat(ve(r-s.length))),s=s.concat(ve(u-s.length+1+(s.length<r?r-s.length:0)));var l=u>0?u:0;return l<(s=ve(-u).concat(s)).length-1&&s.splice(l+1,0,"."),o.sign+s.join("")}(e,n,r).replace(/((\.\d*?)(0+))($|e)/,(function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r}));default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function me(e){var r,t,n="auto";if(void 0!==e)if(a(e))r=e;else if(o(e))r=e.toNumber();else{if(!E(e))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==e.precision&&(r=Ce(e.precision,(()=>{throw new Error('Option "precision" must be a number or BigNumber')}))),void 0!==e.wordSize&&(t=Ce(e.wordSize,(()=>{throw new Error('Option "wordSize" must be a number or BigNumber')}))),e.notation&&(n=e.notation)}return{notation:n,precision:r,wordSize:t}}function de(e){var r=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!r)throw new SyntaxError("Invalid number "+e);var t=r[1],n=r[2],i=parseFloat(r[4]||"0"),a=n.indexOf(".");i+=-1!==a?a-1:n.length-1;var o=n.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===o.length&&(o.push(0),i++),{sign:t,coefficients:o,exponent:i}}function he(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=de(e),n="number"==typeof r?ye(t,t.exponent+1+r):t,i=n.coefficients,a=n.exponent+1,o=a+(r||0);return i.length<o&&(i=i.concat(ve(o-i.length))),a<0&&(i=ve(1-a).concat(i),a=1),a<i.length&&i.splice(a,0,0===a?"0.":"."),n.sign+i.join("")}function ge(e,r){if(isNaN(e)||!isFinite(e))return String(e);var t=de(e),n=r?ye(t,r):t,i=n.coefficients,a=n.exponent;i.length<r&&(i=i.concat(ve(r-i.length)));var o=i.shift();return n.sign+o+(i.length>0?"."+i.join(""):"")+"e"+(a>=0?"+":"")+a}function ye(e,r){for(var t={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=t.coefficients;r<=0;)n.unshift(0),t.exponent++,r++;if(n.length>r&&n.splice(r,n.length-r)[0]>=5){var i=r-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),t.exponent++,i++),n[--i]++}return t}function ve(e){for(var r=[],t=0;t<e;t++)r.push(0);return r}var xe=Number.EPSILON||2220446049250313e-31;function be(e,r,t){if(null==t)return e===r;if(e===r)return!0;if(isNaN(e)||isNaN(r))return!1;if(isFinite(e)&&isFinite(r)){var n=Math.abs(e-r);return n<=xe||n<=Math.max(Math.abs(e),Math.abs(r))*t}return!1}var we=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},Ne=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},De=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Ee=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},Ae=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Se=Math.tanh||function(e){var r=Math.exp(2*e);return(r-1)/(r+1)};function Ce(e,r){return a(e)?e:o(e)?e.toNumber():void r()}function Me(e,r){return a(e)?e:o(e)?e.toNumber():r}function Oe(e,r,t,n){function i(n){var i=function(e,r){for(var t={},n=0;n<r.length;n++){var i=r[n],a=e[i];void 0!==a&&(t[i]=a)}return t}(n,r.map(Te));return function(e,r,t){var n=r.filter((e=>!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==t[e]));if(!n){var i=r.filter((e=>void 0===t[e]));throw new Error('Cannot create function "'.concat(e,'", ')+"some dependencies are missing: ".concat(i.map((e=>'"'.concat(e,'"'))).join(", "),"."))}}(e,r,n),t(i)}return i.isFactory=!0,i.fn=e,i.dependencies=r.slice().sort(),n&&(i.meta=n),i}function Te(e){return e&&"?"===e[0]?e.slice(1):e}function Fe(e,r){if(ze(e)&&Be(e,r))return e[r];if("function"==typeof e[r]&&Ie(e,r))throw new Error('Cannot access method "'+r+'" as a property');throw new Error('No access to property "'+r+'"')}function _e(e,r,t){if(ze(e)&&Be(e,r))return e[r]=t,t;throw new Error('No access to property "'+r+'"')}function Be(e,r){return!(!e||"object"!=typeof e)&&(!!Y(qe,r)||!(r in Object.prototype)&&!(r in Function.prototype))}function Ie(e,r){return null!=e&&"function"==typeof e[r]&&(!(Y(e,r)&&Object.getPrototypeOf&&r in Object.getPrototypeOf(e))&&(!!Y(Re,r)||!(r in Object.prototype)&&!(r in Function.prototype)))}function ze(e){return"object"==typeof e&&e&&e.constructor===Object}var qe={length:!0,name:!0},Re={toString:!0,valueOf:!0,toLocaleString:!0};class ke{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(e){return Fe(this.wrappedObject,e)}set(e,r){return _e(this.wrappedObject,e,r),this}has(e){return r=this.wrappedObject,e in r;var r}entries(){return Ue(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){delete this.wrappedObject[e]}clear(){for(var e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class Pe{constructor(e,r,t){this.a=e,this.b=r,this.bKeys=t,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,r){return this.bKeys.has(e)?this.b.set(e,r):this.a.set(e,r),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return Ue(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(var r of this.keys())e(this.get(r),r,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function Ue(e,r){return{next:()=>{var t=e.next();return t.done?t:{value:r(t.value),done:!1}}}}function Le(){return new Map}function je(e){if(!e)return Le();if(He(e))return e;if(E(e))return new ke(e);throw new Error("createMap can create maps from objects or Maps")}function He(e){return!!e&&(e instanceof Map||e instanceof ke||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}var $e=function(){return $e=ne.create,ne},Ge=Oe("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){var{BigNumber:r,Complex:t,DenseMatrix:n,Fraction:i}=e,B=$e();return B.clear(),B.addTypes([{name:"number",test:a},{name:"Complex",test:s},{name:"BigNumber",test:o},{name:"Fraction",test:u},{name:"Unit",test:l},{name:"identifier",test:e=>c&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(e)},{name:"string",test:c},{name:"Chain",test:$},{name:"Array",test:f},{name:"Matrix",test:p},{name:"DenseMatrix",test:d},{name:"SparseMatrix",test:h},{name:"Range",test:g},{name:"Index",test:y},{name:"boolean",test:v},{name:"ResultSet",test:x},{name:"Help",test:b},{name:"function",test:w},{name:"Date",test:N},{name:"RegExp",test:D},{name:"null",test:A},{name:"undefined",test:S},{name:"AccessorNode",test:C},{name:"ArrayNode",test:M},{name:"AssignmentNode",test:O},{name:"BlockNode",test:T},{name:"ConditionalNode",test:F},{name:"ConstantNode",test:_},{name:"FunctionNode",test:z},{name:"FunctionAssignmentNode",test:I},{name:"IndexNode",test:q},{name:"Node",test:R},{name:"ObjectNode",test:k},{name:"OperatorNode",test:P},{name:"ParenthesisNode",test:U},{name:"RangeNode",test:L},{name:"RelationalNode",test:j},{name:"SymbolNode",test:H},{name:"Map",test:He},{name:"Object",test:E}]),B.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(r||Ve(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new r(e)}},{from:"number",to:"Complex",convert:function(e){return t||Ze(e),new t(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return t||Ze(e),new t(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 t||Ze(e),new t(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||We(e);var r=new i(e);if(r.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 r}},{from:"string",to:"number",convert:function(e){var r=Number(e);if(isNaN(r))throw new Error('Cannot convert "'+e+'" to a number');return r}},{from:"string",to:"BigNumber",convert:function(e){r||Ve(e);try{return new r(e)}catch(r){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(e){i||We(e);try{return new i(e)}catch(r){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){t||Ze(e);try{return new t(e)}catch(r){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 r||Ve(e),new r(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||We(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return n||function(){throw 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()}}]),B.onMismatch=(e,r,t)=>{var n=B.createError(e,r,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&m(r[0])&&t.some((e=>!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},B.onMismatch=(e,r,t)=>{var n=B.createError(e,r,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===r.length&&m(r[0])&&t.some((e=>!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},B}));function Ve(e){throw new Error("Cannot convert value ".concat(e," into a BigNumber: no class 'BigNumber' provided"))}function Ze(e){throw new Error("Cannot convert value ".concat(e," into a Complex number: no class 'Complex' provided"))}function We(e){throw new Error("Cannot convert value ".concat(e," into a Fraction, no class 'Fraction' provided."))}var Ye,Je,Xe=Oe("ResultSet",[],(()=>{function e(r){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=r||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(r){return new e(r.entries)},e}),{isClass:!0}),Qe=9e15,Ke=1e9,er="0123456789abcdef",rr="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",tr="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",nr={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Qe,maxE:Qe,crypto:!1},ir=!0,ar="[DecimalError] ",or=ar+"Invalid argument: ",sr=ar+"Precision limit exceeded",ur=ar+"crypto unavailable",lr="[object Decimal]",cr=Math.floor,fr=Math.pow,pr=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,mr=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,dr=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,hr=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,gr=1e7,yr=7,vr=rr.length-1,xr=tr.length-1,br={toStringTag:lr};function wr(e){var r,t,n,i=e.length-1,a="",o=e[0];if(i>0){for(a+=o,r=1;r<i;r++)n=e[r]+"",(t=yr-n.length)&&(a+=_r(t)),a+=n;o=e[r],(t=yr-(n=o+"").length)&&(a+=_r(t))}else if(0===o)return"0";for(;o%10==0;)o/=10;return a+o}function Nr(e,r,t){if(e!==~~e||e<r||e>t)throw Error(or+e)}function Dr(e,r,t,n){var i,a,o,s;for(a=e[0];a>=10;a/=10)--r;return--r<0?(r+=yr,i=0):(i=Math.ceil((r+1)/yr),r%=yr),a=fr(10,yr-r),s=e[i]%a|0,null==n?r<3?(0==r?s=s/100|0:1==r&&(s=s/10|0),o=t<4&&99999==s||t>3&&49999==s||5e4==s||0==s):o=(t<4&&s+1==a||t>3&&s+1==a/2)&&(e[i+1]/a/100|0)==fr(10,r-2)-1||(s==a/2||0==s)&&!(e[i+1]/a/100|0):r<4?(0==r?s=s/1e3|0:1==r?s=s/100|0:2==r&&(s=s/10|0),o=(n||t<4)&&9999==s||!n&&t>3&&4999==s):o=((n||t<4)&&s+1==a||!n&&t>3&&s+1==a/2)&&(e[i+1]/a/1e3|0)==fr(10,r-3)-1,o}function Er(e,r,t){for(var n,i,a=[0],o=0,s=e.length;o<s;){for(i=a.length;i--;)a[i]*=r;for(a[0]+=er.indexOf(e.charAt(o++)),n=0;n<a.length;n++)a[n]>t-1&&(void 0===a[n+1]&&(a[n+1]=0),a[n+1]+=a[n]/t|0,a[n]%=t)}return a.reverse()}br.absoluteValue=br.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Sr(e)},br.ceil=function(){return Sr(new this.constructor(this),this.e+1,2)},br.clampedTo=br.clamp=function(e,r){var t=this,n=t.constructor;if(e=new n(e),r=new n(r),!e.s||!r.s)return new n(NaN);if(e.gt(r))throw Error(or+r);return t.cmp(e)<0?e:t.cmp(r)>0?r:new n(t)},br.comparedTo=br.cmp=function(e){var r,t,n,i,a=this,o=a.d,s=(e=new a.constructor(e)).d,u=a.s,l=e.s;if(!o||!s)return u&&l?u!==l?u:o===s?0:!o^u<0?1:-1:NaN;if(!o[0]||!s[0])return o[0]?u:s[0]?-l:0;if(u!==l)return u;if(a.e!==e.e)return a.e>e.e^u<0?1:-1;for(r=0,t=(n=o.length)<(i=s.length)?n:i;r<t;++r)if(o[r]!==s[r])return o[r]>s[r]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},br.cosine=br.cos=function(){var e,r,t=this,n=t.constructor;return t.d?t.d[0]?(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+yr,n.rounding=1,t=function(e,r){var t,n,i;if(r.isZero())return r;n=r.d.length,n<32?i=(1/jr(4,t=Math.ceil(n/3))).toString():(t=16,i="2.3283064365386962890625e-10");e.precision+=t,r=Lr(e,1,r.times(i),new e(1));for(var a=t;a--;){var o=r.times(r);r=o.times(o).minus(o).times(8).plus(1)}return e.precision-=t,r}(n,Hr(n,t)),n.precision=e,n.rounding=r,Sr(2==Je||3==Je?t.neg():t,e,r,!0)):new n(1):new n(NaN)},br.cubeRoot=br.cbrt=function(){var e,r,t,n,i,a,o,s,u,l,c=this,f=c.constructor;if(!c.isFinite()||c.isZero())return new f(c);for(ir=!1,(a=c.s*fr(c.s*c,1/3))&&Math.abs(a)!=1/0?n=new f(a.toString()):(t=wr(c.d),(a=((e=c.e)-t.length+1)%3)&&(t+=1==a||-2==a?"0":"00"),a=fr(t,1/3),e=cr((e+1)/3)-(e%3==(e<0?-1:2)),(n=new f(t=a==1/0?"5e"+e:(t=a.toExponential()).slice(0,t.indexOf("e")+1)+e)).s=c.s),o=(e=f.precision)+3;;)if(l=(u=(s=n).times(s).times(s)).plus(c),n=Ar(l.plus(c).times(s),l.plus(u),o+2,1),wr(s.d).slice(0,o)===(t=wr(n.d)).slice(0,o)){if("9999"!=(t=t.slice(o-3,o+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Sr(n,e+1,1),r=!n.times(n).times(n).eq(c));break}if(!i&&(Sr(s,e+1,0),s.times(s).times(s).eq(c))){n=s;break}o+=4,i=1}return ir=!0,Sr(n,e,f.rounding,r)},br.decimalPlaces=br.dp=function(){var e,r=this.d,t=NaN;if(r){if(t=((e=r.length-1)-cr(this.e/yr))*yr,e=r[e])for(;e%10==0;e/=10)t--;t<0&&(t=0)}return t},br.dividedBy=br.div=function(e){return Ar(this,new this.constructor(e))},br.dividedToIntegerBy=br.divToInt=function(e){var r=this.constructor;return Sr(Ar(this,new r(e),0,1,1),r.precision,r.rounding)},br.equals=br.eq=function(e){return 0===this.cmp(e)},br.floor=function(){return Sr(new this.constructor(this),this.e+1,3)},br.greaterThan=br.gt=function(e){return this.cmp(e)>0},br.greaterThanOrEqualTo=br.gte=function(e){var r=this.cmp(e);return 1==r||0===r},br.hyperbolicCosine=br.cosh=function(){var e,r,t,n,i,a=this,o=a.constructor,s=new o(1);if(!a.isFinite())return new o(a.s?1/0:NaN);if(a.isZero())return s;t=o.precision,n=o.rounding,o.precision=t+Math.max(a.e,a.sd())+4,o.rounding=1,(i=a.d.length)<32?r=(1/jr(4,e=Math.ceil(i/3))).toString():(e=16,r="2.3283064365386962890625e-10"),a=Lr(o,1,a.times(r),new o(1),!0);for(var u,l=e,c=new o(8);l--;)u=a.times(a),a=s.minus(u.times(c.minus(u.times(c))));return Sr(a,o.precision=t,o.rounding=n,!0)},br.hyperbolicSine=br.sinh=function(){var e,r,t,n,i=this,a=i.constructor;if(!i.isFinite()||i.isZero())return new a(i);if(r=a.precision,t=a.rounding,a.precision=r+Math.max(i.e,i.sd())+4,a.rounding=1,(n=i.d.length)<3)i=Lr(a,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=Lr(a,2,i=i.times(1/jr(5,e)),i,!0);for(var o,s=new a(5),u=new a(16),l=new a(20);e--;)o=i.times(i),i=i.times(s.plus(o.times(u.times(o).plus(l))))}return a.precision=r,a.rounding=t,Sr(i,r,t,!0)},br.hyperbolicTangent=br.tanh=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+7,n.rounding=1,Ar(t.sinh(),t.cosh(),n.precision=e,n.rounding=r)):new n(t.s)},br.inverseCosine=br.acos=function(){var e,r=this,t=r.constructor,n=r.abs().cmp(1),i=t.precision,a=t.rounding;return-1!==n?0===n?r.isNeg()?Tr(t,i,a):new t(0):new t(NaN):r.isZero()?Tr(t,i+4,a).times(.5):(t.precision=i+6,t.rounding=1,r=r.asin(),e=Tr(t,i+4,a).times(.5),t.precision=i,t.rounding=a,e.minus(r))},br.inverseHyperbolicCosine=br.acosh=function(){var e,r,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(e=n.precision,r=n.rounding,n.precision=e+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,ir=!1,t=t.times(t).minus(1).sqrt().plus(t),ir=!0,n.precision=e,n.rounding=r,t.ln()):new n(t)},br.inverseHyperbolicSine=br.asinh=function(){var e,r,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,ir=!1,t=t.times(t).plus(1).sqrt().plus(t),ir=!0,n.precision=e,n.rounding=r,t.ln())},br.inverseHyperbolicTangent=br.atanh=function(){var e,r,t,n,i=this,a=i.constructor;return i.isFinite()?i.e>=0?new a(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=a.precision,r=a.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Sr(new a(i),e,r,!0):(a.precision=t=n-i.e,i=Ar(i.plus(1),new a(1).minus(i),t+e,1),a.precision=e+4,a.rounding=1,i=i.ln(),a.precision=e,a.rounding=r,i.times(.5))):new a(NaN)},br.inverseSine=br.asin=function(){var e,r,t,n,i=this,a=i.constructor;return i.isZero()?new a(i):(r=i.abs().cmp(1),t=a.precision,n=a.rounding,-1!==r?0===r?((e=Tr(a,t+4,n).times(.5)).s=i.s,e):new a(NaN):(a.precision=t+6,a.rounding=1,i=i.div(new a(1).minus(i.times(i)).sqrt().plus(1)).atan(),a.precision=t,a.rounding=n,i.times(2)))},br.inverseTangent=br.atan=function(){var e,r,t,n,i,a,o,s,u,l=this,c=l.constructor,f=c.precision,p=c.rounding;if(l.isFinite()){if(l.isZero())return new c(l);if(l.abs().eq(1)&&f+4<=xr)return(o=Tr(c,f+4,p).times(.25)).s=l.s,o}else{if(!l.s)return new c(NaN);if(f+4<=xr)return(o=Tr(c,f+4,p).times(.5)).s=l.s,o}for(c.precision=s=f+10,c.rounding=1,e=t=Math.min(28,s/yr+2|0);e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(ir=!1,r=Math.ceil(s/yr),n=1,u=l.times(l),o=new c(l),i=l;-1!==e;)if(i=i.times(u),a=o.minus(i.div(n+=2)),i=i.times(u),void 0!==(o=a.plus(i.div(n+=2))).d[r])for(e=r;o.d[e]===a.d[e]&&e--;);return t&&(o=o.times(2<<t-1)),ir=!0,Sr(o,c.precision=f,c.rounding=p,!0)},br.isFinite=function(){return!!this.d},br.isInteger=br.isInt=function(){return!!this.d&&cr(this.e/yr)>this.d.length-2},br.isNaN=function(){return!this.s},br.isNegative=br.isNeg=function(){return this.s<0},br.isPositive=br.isPos=function(){return this.s>0},br.isZero=function(){return!!this.d&&0===this.d[0]},br.lessThan=br.lt=function(e){return this.cmp(e)<0},br.lessThanOrEqualTo=br.lte=function(e){return this.cmp(e)<1},br.logarithm=br.log=function(e){var r,t,n,i,a,o,s,u,l=this,c=l.constructor,f=c.precision,p=c.rounding;if(null==e)e=new c(10),r=!0;else{if(t=(e=new c(e)).d,e.s<0||!t||!t[0]||e.eq(1))return new c(NaN);r=e.eq(10)}if(t=l.d,l.s<0||!t||!t[0]||l.eq(1))return new c(t&&!t[0]?-1/0:1!=l.s?NaN:t?0:1/0);if(r)if(t.length>1)a=!0;else{for(i=t[0];i%10==0;)i/=10;a=1!==i}if(ir=!1,o=Rr(l,s=f+5),n=r?Or(c,s+10):Rr(e,s),Dr((u=Ar(o,n,s,1)).d,i=f,p))do{if(o=Rr(l,s+=10),n=r?Or(c,s+10):Rr(e,s),u=Ar(o,n,s,1),!a){+wr(u.d).slice(i+1,i+15)+1==1e14&&(u=Sr(u,f+1,0));break}}while(Dr(u.d,i+=10,p));return ir=!0,Sr(u,f,p)},br.minus=br.sub=function(e){var r,t,n,i,a,o,s,u,l,c,f,p,m=this,d=m.constructor;if(e=new d(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new d(e.d||m.s!==e.s?m:NaN):e=new d(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(l=m.d,p=e.d,s=d.precision,u=d.rounding,!l[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!l[0])return new d(3===u?-0:0);e=new d(m)}return ir?Sr(e,s,u):e}if(t=cr(e.e/yr),c=cr(m.e/yr),l=l.slice(),a=c-t){for((f=a<0)?(r=l,a=-a,o=p.length):(r=p,t=c,o=l.length),a>(n=Math.max(Math.ceil(s/yr),o)+2)&&(a=n,r.length=1),r.reverse(),n=a;n--;)r.push(0);r.reverse()}else{for((f=(n=l.length)<(o=p.length))&&(o=n),n=0;n<o;n++)if(l[n]!=p[n]){f=l[n]<p[n];break}a=0}for(f&&(r=l,l=p,p=r,e.s=-e.s),o=l.length,n=p.length-o;n>0;--n)l[o++]=0;for(n=p.length;n>a;){if(l[--n]<p[n]){for(i=n;i&&0===l[--i];)l[i]=gr-1;--l[i],l[n]+=gr}l[n]-=p[n]}for(;0===l[--o];)l.pop();for(;0===l[0];l.shift())--t;return l[0]?(e.d=l,e.e=Mr(l,t),ir?Sr(e,s,u):e):new d(3===u?-0:0)},br.modulo=br.mod=function(e){var r,t=this,n=t.constructor;return e=new n(e),!t.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||t.d&&!t.d[0]?Sr(new n(t),n.precision,n.rounding):(ir=!1,9==n.modulo?(r=Ar(t,e.abs(),0,3,1)).s*=e.s:r=Ar(t,e,0,n.modulo,1),r=r.times(e),ir=!0,t.minus(r))},br.naturalExponential=br.exp=function(){return qr(this)},br.naturalLogarithm=br.ln=function(){return Rr(this)},br.negated=br.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Sr(e)},br.plus=br.add=function(e){var r,t,n,i,a,o,s,u,l,c,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new p(e.d||f.s===e.s?f:NaN)):e=new p(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(l=f.d,c=e.d,s=p.precision,u=p.rounding,!l[0]||!c[0])return c[0]||(e=new p(f)),ir?Sr(e,s,u):e;if(a=cr(f.e/yr),n=cr(e.e/yr),l=l.slice(),i=a-n){for(i<0?(t=l,i=-i,o=c.length):(t=c,n=a,o=l.length),i>(o=(a=Math.ceil(s/yr))>o?a+1:o+1)&&(i=o,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for((o=l.length)-(i=c.length)<0&&(i=o,t=c,c=l,l=t),r=0;i;)r=(l[--i]=l[i]+c[i]+r)/gr|0,l[i]%=gr;for(r&&(l.unshift(r),++n),o=l.length;0==l[--o];)l.pop();return e.d=l,e.e=Mr(l,n),ir?Sr(e,s,u):e},br.precision=br.sd=function(e){var r,t=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(or+e);return t.d?(r=Fr(t.d),e&&t.e+1>r&&(r=t.e+1)):r=NaN,r},br.round=function(){var e=this,r=e.constructor;return Sr(new r(e),e.e+1,r.rounding)},br.sine=br.sin=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+Math.max(t.e,t.sd())+yr,n.rounding=1,t=function(e,r){var t,n=r.d.length;if(n<3)return r.isZero()?r:Lr(e,2,r,r);t=(t=1.4*Math.sqrt(n))>16?16:0|t,r=r.times(1/jr(5,t)),r=Lr(e,2,r,r);for(var i,a=new e(5),o=new e(16),s=new e(20);t--;)i=r.times(r),r=r.times(a.plus(i.times(o.times(i).minus(s))));return r}(n,Hr(n,t)),n.precision=e,n.rounding=r,Sr(Je>2?t.neg():t,e,r,!0)):new n(NaN)},br.squareRoot=br.sqrt=function(){var e,r,t,n,i,a,o=this,s=o.d,u=o.e,l=o.s,c=o.constructor;if(1!==l||!s||!s[0])return new c(!l||l<0&&(!s||s[0])?NaN:s?o:1/0);for(ir=!1,0==(l=Math.sqrt(+o))||l==1/0?(((r=wr(s)).length+u)%2==0&&(r+="0"),l=Math.sqrt(r),u=cr((u+1)/2)-(u<0||u%2),n=new c(r=l==1/0?"5e"+u:(r=l.toExponential()).slice(0,r.indexOf("e")+1)+u)):n=new c(l.toString()),t=(u=c.precision)+3;;)if(n=(a=n).plus(Ar(o,a,t+2,1)).times(.5),wr(a.d).slice(0,t)===(r=wr(n.d)).slice(0,t)){if("9999"!=(r=r.slice(t-3,t+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(Sr(n,u+1,1),e=!n.times(n).eq(o));break}if(!i&&(Sr(a,u+1,0),a.times(a).eq(o))){n=a;break}t+=4,i=1}return ir=!0,Sr(n,u,c.rounding,e)},br.tangent=br.tan=function(){var e,r,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(e=n.precision,r=n.rounding,n.precision=e+10,n.rounding=1,(t=t.sin()).s=1,t=Ar(t,new n(1).minus(t.times(t)).sqrt(),e+10,0),n.precision=e,n.rounding=r,Sr(2==Je||4==Je?t.neg():t,e,r,!0)):new n(NaN)},br.times=br.mul=function(e){var r,t,n,i,a,o,s,u,l,c=this,f=c.constructor,p=c.d,m=(e=new f(e)).d;if(e.s*=c.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(t=cr(c.e/yr)+cr(e.e/yr),(u=p.length)<(l=m.length)&&(a=p,p=m,m=a,o=u,u=l,l=o),a=[],n=o=u+l;n--;)a.push(0);for(n=l;--n>=0;){for(r=0,i=u+n;i>n;)s=a[i]+m[n]*p[i-n-1]+r,a[i--]=s%gr|0,r=s/gr|0;a[i]=(a[i]+r)%gr|0}for(;!a[--o];)a.pop();return r?++t:a.shift(),e.d=a,e.e=Mr(a,t),ir?Sr(e,f.precision,f.rounding):e},br.toBinary=function(e,r){return $r(this,2,e,r)},br.toDecimalPlaces=br.toDP=function(e,r){var t=this,n=t.constructor;return t=new n(t),void 0===e?t:(Nr(e,0,Ke),void 0===r?r=n.rounding:Nr(r,0,8),Sr(t,e+t.e+1,r))},br.toExponential=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=Cr(n,!0):(Nr(e,0,Ke),void 0===r?r=i.rounding:Nr(r,0,8),t=Cr(n=Sr(new i(n),e+1,r),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+t:t},br.toFixed=function(e,r){var t,n,i=this,a=i.constructor;return void 0===e?t=Cr(i):(Nr(e,0,Ke),void 0===r?r=a.rounding:Nr(r,0,8),t=Cr(n=Sr(new a(i),e+i.e+1,r),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+t:t},br.toFraction=function(e){var r,t,n,i,a,o,s,u,l,c,f,p,m=this,d=m.d,h=m.constructor;if(!d)return new h(m);if(l=t=new h(1),n=u=new h(0),o=(a=(r=new h(n)).e=Fr(d)-m.e-1)%yr,r.d[0]=fr(10,o<0?yr+o:o),null==e)e=a>0?r:l;else{if(!(s=new h(e)).isInt()||s.lt(l))throw Error(or+s);e=s.gt(r)?a>0?r:l:s}for(ir=!1,s=new h(wr(d)),c=h.precision,h.precision=a=d.length*yr*2;f=Ar(s,r,0,1,1),1!=(i=t.plus(f.times(n))).cmp(e);)t=n,n=i,i=l,l=u.plus(f.times(i)),u=i,i=r,r=s.minus(f.times(i)),s=i;return i=Ar(e.minus(t),n,0,1,1),u=u.plus(i.times(l)),t=t.plus(i.times(n)),u.s=l.s=m.s,p=Ar(l,n,a,1).minus(m).abs().cmp(Ar(u,t,a,1).minus(m).abs())<1?[l,n]:[u,t],h.precision=c,ir=!0,p},br.toHexadecimal=br.toHex=function(e,r){return $r(this,16,e,r)},br.toNearest=function(e,r){var t=this,n=t.constructor;if(t=new n(t),null==e){if(!t.d)return t;e=new n(1),r=n.rounding}else{if(e=new n(e),void 0===r?r=n.rounding:Nr(r,0,8),!t.d)return e.s?t:e;if(!e.d)return e.s&&(e.s=t.s),e}return e.d[0]?(ir=!1,t=Ar(t,e,0,r,1).times(e),ir=!0,Sr(t)):(e.s=t.s,t=e),t},br.toNumber=function(){return+this},br.toOctal=function(e,r){return $r(this,8,e,r)},br.toPower=br.pow=function(e){var r,t,n,i,a,o,s=this,u=s.constructor,l=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(fr(+s,l));if((s=new u(s)).eq(1))return s;if(n=u.precision,a=u.rounding,e.eq(1))return Sr(s,n,a);if((r=cr(e.e/yr))>=e.d.length-1&&(t=l<0?-l:l)<=9007199254740991)return i=Br(u,s,t,n),e.s<0?new u(1).div(i):Sr(i,n,a);if((o=s.s)<0){if(r<e.d.length-1)return new u(NaN);if(1&e.d[r]||(o=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=o,s}return(r=0!=(t=fr(+s,l))&&isFinite(t)?new u(t+"").e:cr(l*(Math.log("0."+wr(s.d))/Math.LN10+s.e+1)))>u.maxE+1||r<u.minE-1?new u(r>0?o/0:0):(ir=!1,u.rounding=s.s=1,t=Math.min(12,(r+"").length),(i=qr(e.times(Rr(s,n+t)),n)).d&&Dr((i=Sr(i,n+5,1)).d,n,a)&&(r=n+10,+wr((i=Sr(qr(e.times(Rr(s,r+t)),r),r+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=Sr(i,n+1,0))),i.s=o,ir=!0,u.rounding=a,Sr(i,n,a))},br.toPrecision=function(e,r){var t,n=this,i=n.constructor;return void 0===e?t=Cr(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Nr(e,1,Ke),void 0===r?r=i.rounding:Nr(r,0,8),t=Cr(n=Sr(new i(n),e,r),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+t:t},br.toSignificantDigits=br.toSD=function(e,r){var t=this.constructor;return void 0===e?(e=t.precision,r=t.rounding):(Nr(e,1,Ke),void 0===r?r=t.rounding:Nr(r,0,8)),Sr(new t(this),e,r)},br.toString=function(){var e=this,r=e.constructor,t=Cr(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()&&!e.isZero()?"-"+t:t},br.truncated=br.trunc=function(){return Sr(new this.constructor(this),this.e+1,1)},br.valueOf=br.toJSON=function(){var e=this,r=e.constructor,t=Cr(e,e.e<=r.toExpNeg||e.e>=r.toExpPos);return e.isNeg()?"-"+t:t};var Ar=function(){function e(e,r,t){var n,i=0,a=e.length;for(e=e.slice();a--;)n=e[a]*r+i,e[a]=n%t|0,i=n/t|0;return i&&e.unshift(i),e}function r(e,r,t,n){var i,a;if(t!=n)a=t>n?1:-1;else for(i=a=0;i<t;i++)if(e[i]!=r[i]){a=e[i]>r[i]?1:-1;break}return a}function t(e,r,t,n){for(var i=0;t--;)e[t]-=i,i=e[t]<r[t]?1:0,e[t]=i*n+e[t]-r[t];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,a,o,s,u){var l,c,f,p,m,d,h,g,y,v,x,b,w,N,D,E,A,S,C,M,O=n.constructor,T=n.s==i.s?1:-1,F=n.d,_=i.d;if(!(F&&F[0]&&_&&_[0]))return new O(n.s&&i.s&&(F?!_||F[0]!=_[0]:_)?F&&0==F[0]||!_?0*T:T/0:NaN);for(u?(m=1,c=n.e-i.e):(u=gr,m=yr,c=cr(n.e/m)-cr(i.e/m)),C=_.length,A=F.length,v=(y=new O(T)).d=[],f=0;_[f]==(F[f]||0);f++);if(_[f]>(F[f]||0)&&c--,null==a?(N=a=O.precision,o=O.rounding):N=s?a+(n.e-i.e)+1:a,N<0)v.push(1),d=!0;else{if(N=N/m+2|0,f=0,1==C){for(p=0,_=_[0],N++;(f<A||p)&&N--;f++)D=p*u+(F[f]||0),v[f]=D/_|0,p=D%_|0;d=p||f<A}else{for((p=u/(_[0]+1)|0)>1&&(_=e(_,p,u),F=e(F,p,u),C=_.length,A=F.length),E=C,b=(x=F.slice(0,C)).length;b<C;)x[b++]=0;(M=_.slice()).unshift(0),S=_[0],_[1]>=u/2&&++S;do{p=0,(l=r(_,x,C,b))<0?(w=x[0],C!=b&&(w=w*u+(x[1]||0)),(p=w/S|0)>1?(p>=u&&(p=u-1),1==(l=r(h=e(_,p,u),x,g=h.length,b=x.length))&&(p--,t(h,C<g?M:_,g,u))):(0==p&&(l=p=1),h=_.slice()),(g=h.length)<b&&h.unshift(0),t(x,h,b,u),-1==l&&(l=r(_,x,C,b=x.length))<1&&(p++,t(x,C<b?M:_,b,u)),b=x.length):0===l&&(p++,x=[0]),v[f++]=p,l&&x[0]?x[b++]=F[E]||0:(x=[F[E]],b=1)}while((E++<A||void 0!==x[0])&&N--);d=void 0!==x[0]}v[0]||v.shift()}if(1==m)y.e=c,Ye=d;else{for(f=1,p=v[0];p>=10;p/=10)f++;y.e=f+c*m-1,Sr(y,s?a+y.e+1:a,o,d)}return y}}();function Sr(e,r,t,n){var i,a,o,s,u,l,c,f,p,m=e.constructor;e:if(null!=r){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((a=r-i)<0)a+=yr,o=r,u=(c=f[p=0])/fr(10,i-o-1)%10|0;else if((p=Math.ceil((a+1)/yr))>=(s=f.length)){if(!n)break e;for(;s++<=p;)f.push(0);c=u=0,i=1,o=(a%=yr)-yr+1}else{for(c=s=f[p],i=1;s>=10;s/=10)i++;u=(o=(a%=yr)-yr+i)<0?0:c/fr(10,i-o-1)%10|0}if(n=n||r<0||void 0!==f[p+1]||(o<0?c:c%fr(10,i-o-1)),l=t<4?(u||n)&&(0==t||t==(e.s<0?3:2)):u>5||5==u&&(4==t||n||6==t&&(a>0?o>0?c/fr(10,i-o):0:f[p-1])%10&1||t==(e.s<0?8:7)),r<1||!f[0])return f.length=0,l?(r-=e.e+1,f[0]=fr(10,(yr-r%yr)%yr),e.e=-r||0):f[0]=e.e=0,e;if(0==a?(f.length=p,s=1,p--):(f.length=p+1,s=fr(10,yr-a),f[p]=o>0?(c/fr(10,i-o)%fr(10,o)|0)*s:0),l)for(;;){if(0==p){for(a=1,o=f[0];o>=10;o/=10)a++;for(o=f[0]+=s,s=1;o>=10;o/=10)s++;a!=s&&(e.e++,f[0]==gr&&(f[0]=1));break}if(f[p]+=s,f[p]!=gr)break;f[p--]=0,s=1}for(a=f.length;0===f[--a];)f.pop()}return ir&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function Cr(e,r,t){if(!e.isFinite())return kr(e);var n,i=e.e,a=wr(e.d),o=a.length;return r?(t&&(n=t-o)>0?a=a.charAt(0)+"."+a.slice(1)+_r(n):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(e.e<0?"e":"e+")+e.e):i<0?(a="0."+_r(-i-1)+a,t&&(n=t-o)>0&&(a+=_r(n))):i>=o?(a+=_r(i+1-o),t&&(n=t-i-1)>0&&(a=a+"."+_r(n))):((n=i+1)<o&&(a=a.slice(0,n)+"."+a.slice(n)),t&&(n=t-o)>0&&(i+1===o&&(a+="."),a+=_r(n))),a}function Mr(e,r){var t=e[0];for(r*=yr;t>=10;t/=10)r++;return r}function Or(e,r,t){if(r>vr)throw ir=!0,t&&(e.precision=t),Error(sr);return Sr(new e(rr),r,1,!0)}function Tr(e,r,t){if(r>xr)throw Error(sr);return Sr(new e(tr),r,t,!0)}function Fr(e){var r=e.length-1,t=r*yr+1;if(r=e[r]){for(;r%10==0;r/=10)t--;for(r=e[0];r>=10;r/=10)t++}return t}function _r(e){for(var r="";e--;)r+="0";return r}function Br(e,r,t,n){var i,a=new e(1),o=Math.ceil(n/yr+4);for(ir=!1;;){if(t%2&&Gr((a=a.times(r)).d,o)&&(i=!0),0===(t=cr(t/2))){t=a.d.length-1,i&&0===a.d[t]&&++a.d[t];break}Gr((r=r.times(r)).d,o)}return ir=!0,a}function Ir(e){return 1&e.d[e.d.length-1]}function zr(e,r,t){for(var n,i=new e(r[0]),a=0;++a<r.length;){if(!(n=new e(r[a])).s){i=n;break}i[t](n)&&(i=n)}return i}function qr(e,r){var t,n,i,a,o,s,u,l=0,c=0,f=0,p=e.constructor,m=p.rounding,d=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==r?(ir=!1,u=d):u=r,s=new p(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=n=Math.log(fr(2,f))/Math.LN10*2+5|0,t=a=o=new p(1),p.precision=u;;){if(a=Sr(a.times(e),u,1),t=t.times(++c),wr((s=o.plus(Ar(a,t,u,1))).d).slice(0,u)===wr(o.d).slice(0,u)){for(i=f;i--;)o=Sr(o.times(o),u,1);if(null!=r)return p.precision=d,o;if(!(l<3&&Dr(o.d,u-n,m,l)))return Sr(o,p.precision=d,m,ir=!0);p.precision=u+=10,t=a=s=new p(1),c=0,l++}o=s}}function Rr(e,r){var t,n,i,a,o,s,u,l,c,f,p,m=1,d=e,h=d.d,g=d.constructor,y=g.rounding,v=g.precision;if(d.s<0||!h||!h[0]||!d.e&&1==h[0]&&1==h.length)return new g(h&&!h[0]?-1/0:1!=d.s?NaN:h?0:d);if(null==r?(ir=!1,c=v):c=r,g.precision=c+=10,n=(t=wr(h)).charAt(0),!(Math.abs(a=d.e)<15e14))return l=Or(g,c+2,v).times(a+""),d=Rr(new g(n+"."+t.slice(1)),c-10).plus(l),g.precision=v,null==r?Sr(d,v,y,ir=!0):d;for(;n<7&&1!=n||1==n&&t.charAt(1)>3;)n=(t=wr((d=d.times(e)).d)).charAt(0),m++;for(a=d.e,n>1?(d=new g("0."+t),a++):d=new g(n+"."+t.slice(1)),f=d,u=o=d=Ar(d.minus(1),d.plus(1),c,1),p=Sr(d.times(d),c,1),i=3;;){if(o=Sr(o.times(p),c,1),wr((l=u.plus(Ar(o,new g(i),c,1))).d).slice(0,c)===wr(u.d).slice(0,c)){if(u=u.times(2),0!==a&&(u=u.plus(Or(g,c+2,v).times(a+""))),u=Ar(u,new g(m),c,1),null!=r)return g.precision=v,u;if(!Dr(u.d,c-10,y,s))return Sr(u,g.precision=v,y,ir=!0);g.precision=c+=10,l=o=d=Ar(f.minus(1),f.plus(1),c,1),p=Sr(d.times(d),c,1),i=s=1}u=l,i+=2}}function kr(e){return String(e.s*e.s/0)}function Pr(e,r){var t,n,i;for((t=r.indexOf("."))>-1&&(r=r.replace(".","")),(n=r.search(/e/i))>0?(t<0&&(t=n),t+=+r.slice(n+1),r=r.substring(0,n)):t<0&&(t=r.length),n=0;48===r.charCodeAt(n);n++);for(i=r.length;48===r.charCodeAt(i-1);--i);if(r=r.slice(n,i)){if(i-=n,e.e=t=t-n-1,e.d=[],n=(t+1)%yr,t<0&&(n+=yr),n<i){for(n&&e.d.push(+r.slice(0,n)),i-=yr;n<i;)e.d.push(+r.slice(n,n+=yr));r=r.slice(n),n=yr-r.length}else n-=i;for(;n--;)r+="0";e.d.push(+r),ir&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Ur(e,r){var t,n,i,a,o,s,u,l,c;if(r.indexOf("_")>-1){if(r=r.replace(/(\d)_(?=\d)/g,"$1"),hr.test(r))return Pr(e,r)}else if("Infinity"===r||"NaN"===r)return+r||(e.s=NaN),e.e=NaN,e.d=null,e;if(mr.test(r))t=16,r=r.toLowerCase();else if(pr.test(r))t=2;else{if(!dr.test(r))throw Error(or+r);t=8}for((a=r.search(/p/i))>0?(u=+r.slice(a+1),r=r.substring(2,a)):r=r.slice(2),o=(a=r.indexOf("."))>=0,n=e.constructor,o&&(a=(s=(r=r.replace(".","")).length)-a,i=Br(n,new n(t),a,2*a)),a=c=(l=Er(r,t,gr)).length-1;0===l[a];--a)l.pop();return a<0?new n(0*e.s):(e.e=Mr(l,c),e.d=l,ir=!1,o&&(e=Ar(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?fr(2,u):_t.pow(2,u))),ir=!0,e)}function Lr(e,r,t,n,i){var a,o,s,u,l=e.precision,c=Math.ceil(l/yr);for(ir=!1,u=t.times(t),s=new e(n);;){if(o=Ar(s.times(u),new e(r++*r++),l,1),s=i?n.plus(o):n.minus(o),n=Ar(o.times(u),new e(r++*r++),l,1),void 0!==(o=s.plus(n)).d[c]){for(a=c;o.d[a]===s.d[a]&&a--;);if(-1==a)break}a=s,s=n,n=o,o=a}return ir=!0,o.d.length=c+1,o}function jr(e,r){for(var t=e;--r;)t*=e;return t}function Hr(e,r){var t,n=r.s<0,i=Tr(e,e.precision,1),a=i.times(.5);if((r=r.abs()).lte(a))return Je=n?4:1,r;if((t=r.divToInt(i)).isZero())Je=n?3:2;else{if((r=r.minus(t.times(i))).lte(a))return Je=Ir(t)?n?2:3:n?4:1,r;Je=Ir(t)?n?1:4:n?3:2}return r.minus(i).abs()}function $r(e,r,t,n){var i,a,o,s,u,l,c,f,p,m=e.constructor,d=void 0!==t;if(d?(Nr(t,1,Ke),void 0===n?n=m.rounding:Nr(n,0,8)):(t=m.precision,n=m.rounding),e.isFinite()){for(d?(i=2,16==r?t=4*t-3:8==r&&(t=3*t-2)):i=r,(o=(c=Cr(e)).indexOf("."))>=0&&(c=c.replace(".",""),(p=new m(1)).e=c.length-o,p.d=Er(Cr(p),10,i),p.e=p.d.length),a=u=(f=Er(c,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(o<0?a--:((e=new m(e)).d=f,e.e=a,f=(e=Ar(e,p,t,n,0,i)).d,a=e.e,l=Ye),o=f[t],s=i/2,l=l||void 0!==f[t+1],l=n<4?(void 0!==o||l)&&(0===n||n===(e.s<0?3:2)):o>s||o===s&&(4===n||l||6===n&&1&f[t-1]||n===(e.s<0?8:7)),f.length=t,l)for(;++f[--t]>i-1;)f[t]=0,t||(++a,f.unshift(1));for(u=f.length;!f[u-1];--u);for(o=0,c="";o<u;o++)c+=er.charAt(f[o]);if(d){if(u>1)if(16==r||8==r){for(o=16==r?4:3,--u;u%o;u++)c+="0";for(u=(f=Er(c,i,r)).length;!f[u-1];--u);for(o=1,c="1.";o<u;o++)c+=er.charAt(f[o])}else c=c.charAt(0)+"."+c.slice(1);c=c+(a<0?"p":"p+")+a}else if(a<0){for(;++a;)c="0"+c;c="0."+c}else if(++a>u)for(a-=u;a--;)c+="0";else a<u&&(c=c.slice(0,a)+"."+c.slice(a))}else c=d?"0p+0":"0";c=(16==r?"0x":2==r?"0b":8==r?"0o":"")+c}else c=kr(e);return e.s<0?"-"+c:c}function Gr(e,r){if(e.length>r)return e.length=r,!0}function Vr(e){return new this(e).abs()}function Zr(e){return new this(e).acos()}function Wr(e){return new this(e).acosh()}function Yr(e,r){return new this(e).plus(r)}function Jr(e){return new this(e).asin()}function Xr(e){return new this(e).asinh()}function Qr(e){return new this(e).atan()}function Kr(e){return new this(e).atanh()}function et(e,r){e=new this(e),r=new this(r);var t,n=this.precision,i=this.rounding,a=n+4;return e.s&&r.s?e.d||r.d?!r.d||e.isZero()?(t=r.s<0?Tr(this,n,i):new this(0)).s=e.s:!e.d||r.isZero()?(t=Tr(this,a,1).times(.5)).s=e.s:r.s<0?(this.precision=a,this.rounding=1,t=this.atan(Ar(e,r,a,1)),r=Tr(this,a,1),this.precision=n,this.rounding=i,t=e.s<0?t.minus(r):t.plus(r)):t=this.atan(Ar(e,r,a,1)):(t=Tr(this,a,1).times(r.s>0?.25:.75)).s=e.s:t=new this(NaN),t}function rt(e){return new this(e).cbrt()}function tt(e){return Sr(e=new this(e),e.e+1,2)}function nt(e,r,t){return new this(e).clamp(r,t)}function it(e){if(!e||"object"!=typeof e)throw Error(ar+"Object expected");var r,t,n,i=!0===e.defaults,a=["precision",1,Ke,"rounding",0,8,"toExpNeg",-Qe,0,"toExpPos",0,Qe,"maxE",0,Qe,"minE",-Qe,0,"modulo",0,9];for(r=0;r<a.length;r+=3)if(t=a[r],i&&(this[t]=nr[t]),void 0!==(n=e[t])){if(!(cr(n)===n&&n>=a[r+1]&&n<=a[r+2]))throw Error(or+t+": "+n);this[t]=n}if(t="crypto",i&&(this[t]=nr[t]),void 0!==(n=e[t])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(or+t+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(ur);this[t]=!0}else this[t]=!1}return this}function at(e){return new this(e).cos()}function ot(e){return new this(e).cosh()}function st(e,r){return new this(e).div(r)}function ut(e){return new this(e).exp()}function lt(e){return Sr(e=new this(e),e.e+1,3)}function ct(){var e,r,t=new this(0);for(ir=!1,e=0;e<arguments.length;)if((r=new this(arguments[e++])).d)t.d&&(t=t.plus(r.times(r)));else{if(r.s)return ir=!0,new this(1/0);t=r}return ir=!0,t.sqrt()}function ft(e){return e instanceof _t||e&&e.toStringTag===lr||!1}function pt(e){return new this(e).ln()}function mt(e,r){return new this(e).log(r)}function dt(e){return new this(e).log(2)}function ht(e){return new this(e).log(10)}function gt(){return zr(this,arguments,"lt")}function yt(){return zr(this,arguments,"gt")}function vt(e,r){return new this(e).mod(r)}function xt(e,r){return new this(e).mul(r)}function bt(e,r){return new this(e).pow(r)}function wt(e){var r,t,n,i,a=0,o=new this(1),s=[];if(void 0===e?e=this.precision:Nr(e,1,Ke),n=Math.ceil(e/yr),this.crypto)if(crypto.getRandomValues)for(r=crypto.getRandomValues(new Uint32Array(n));a<n;)(i=r[a])>=429e7?r[a]=crypto.getRandomValues(new Uint32Array(1))[0]:s[a++]=i%1e7;else{if(!crypto.randomBytes)throw Error(ur);for(r=crypto.randomBytes(n*=4);a<n;)(i=r[a]+(r[a+1]<<8)+(r[a+2]<<16)+((127&r[a+3])<<24))>=214e7?crypto.randomBytes(4).copy(r,a):(s.push(i%1e7),a+=4);a=n/4}else for(;a<n;)s[a++]=1e7*Math.random()|0;for(n=s[--a],e%=yr,n&&e&&(i=fr(10,yr-e),s[a]=(n/i|0)*i);0===s[a];a--)s.pop();if(a<0)t=0,s=[0];else{for(t=-1;0===s[0];t-=yr)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<yr&&(t-=yr-n)}return o.e=t,o.d=s,o}function Nt(e){return Sr(e=new this(e),e.e+1,this.rounding)}function Dt(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function Et(e){return new this(e).sin()}function At(e){return new this(e).sinh()}function St(e){return new this(e).sqrt()}function Ct(e,r){return new this(e).sub(r)}function Mt(){var e=0,r=arguments,t=new this(r[e]);for(ir=!1;t.s&&++e<r.length;)t=t.plus(r[e]);return ir=!0,Sr(t,this.precision,this.rounding)}function Ot(e){return new this(e).tan()}function Tt(e){return new this(e).tanh()}function Ft(e){return Sr(e=new this(e),e.e+1,1)}br[Symbol.for("nodejs.util.inspect.custom")]=br.toString,br[Symbol.toStringTag]="Decimal";var _t=br.constructor=function e(r){var t,n,i;function a(e){var r,t,n,i=this;if(!(i instanceof a))return new a(e);if(i.constructor=a,ft(e))return i.s=e.s,void(ir?!e.d||e.e>a.maxE?(i.e=NaN,i.d=null):e.e<a.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"===(n=typeof e)){if(0===e)return i.s=1/e<0?-1:1,i.e=0,void(i.d=[0]);if(e<0?(e=-e,i.s=-1):i.s=1,e===~~e&&e<1e7){for(r=0,t=e;t>=10;t/=10)r++;return void(ir?r>a.maxE?(i.e=NaN,i.d=null):r<a.minE?(i.e=0,i.d=[0]):(i.e=r,i.d=[e]):(i.e=r,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):Pr(i,e.toString())}if("string"!==n)throw Error(or+e);return 45===(t=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===t&&(e=e.slice(1)),i.s=1),hr.test(e)?Pr(i,e):Ur(i,e)}if(a.prototype=br,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.EUCLID=9,a.config=a.set=it,a.clone=e,a.isDecimal=ft,a.abs=Vr,a.acos=Zr,a.acosh=Wr,a.add=Yr,a.asin=Jr,a.asinh=Xr,a.atan=Qr,a.atanh=Kr,a.atan2=et,a.cbrt=rt,a.ceil=tt,a.clamp=nt,a.cos=at,a.cosh=ot,a.div=st,a.exp=ut,a.floor=lt,a.hypot=ct,a.ln=pt,a.log=mt,a.log10=ht,a.log2=dt,a.max=gt,a.min=yt,a.mod=vt,a.mul=xt,a.pow=bt,a.random=wt,a.round=Nt,a.sign=Dt,a.sin=Et,a.sinh=At,a.sqrt=St,a.sub=Ct,a.sum=Mt,a.tan=Ot,a.tanh=Tt,a.trunc=Ft,void 0===r&&(r={}),r&&!0!==r.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],t=0;t<i.length;)r.hasOwnProperty(n=i[t++])||(r[n]=this[n]);return a.config(r),a}(nr);rr=new _t(rr),tr=new _t(tr);const Bt=_t;var It=Oe("BigNumber",["?on","config"],(e=>{var{on:r,config:t}=e,n=Bt.clone({precision:t.precision,modulo:Bt.EUCLID});return n.prototype=Object.create(n.prototype),n.prototype.type="BigNumber",n.prototype.isBigNumber=!0,n.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},n.fromJSON=function(e){return new n(e.value)},r&&r("config",(function(e,r){e.precision!==r.precision&&n.config({precision:e.precision})})),n}),{isClass:!0}),zt=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},qt=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},Rt=function(){throw SyntaxError("Invalid Param")};function kt(e,r){var t=Math.abs(e),n=Math.abs(r);return 0===e?Math.log(n):0===r?Math.log(t):t<3e3&&n<3e3?.5*Math.log(e*e+r*r):(e/=2,r/=2,.5*Math.log(e*e+r*r)+Math.LN2)}function Pt(e,r){if(!(this instanceof Pt))return new Pt(e,r);var t=function(e,r){var t={re:0,im:0};if(null==e)t.re=t.im=0;else if(void 0!==r)t.re=e,t.im=r;else switch(typeof e){case"object":if("im"in e&&"re"in e)t.re=e.re,t.im=e.im;else if("abs"in e&&"arg"in e){if(!Number.isFinite(e.abs)&&Number.isFinite(e.arg))return Pt.INFINITY;t.re=e.abs*Math.cos(e.arg),t.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 Pt.INFINITY;t.re=e.r*Math.cos(e.phi),t.im=e.r*Math.sin(e.phi)}else 2===e.length?(t.re=e[0],t.im=e[1]):Rt();break;case"string":t.im=t.re=0;var n=e.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,a=0;null===n&&Rt();for(var o=0;o<n.length;o++){var s=n[o];" "===s||"\t"===s||"\n"===s||("+"===s?i++:"-"===s?a++:"i"===s||"I"===s?(i+a===0&&Rt()," "===n[o+1]||isNaN(n[o+1])?t.im+=parseFloat((a%2?"-":"")+"1"):(t.im+=parseFloat((a%2?"-":"")+n[o+1]),o++),i=a=0):((i+a===0||isNaN(s))&&Rt(),"i"===n[o+1]||"I"===n[o+1]?(t.im+=parseFloat((a%2?"-":"")+s),o++):t.re+=parseFloat((a%2?"-":"")+s),i=a=0))}i+a>0&&Rt();break;case"number":t.im=0,t.re=e;break;default:Rt()}return isNaN(t.re)||isNaN(t.im),t}(e,r);this.re=t.re,this.im=t.im}Pt.prototype={re:0,im:0,sign:function(){var e=this.abs();return new Pt(this.re/e,this.im/e)},add:function(e,r){var t=new Pt(e,r);return this.isInfinite()&&t.isInfinite()?Pt.NAN:this.isInfinite()||t.isInfinite()?Pt.INFINITY:new Pt(this.re+t.re,this.im+t.im)},sub:function(e,r){var t=new Pt(e,r);return this.isInfinite()&&t.isInfinite()?Pt.NAN:this.isInfinite()||t.isInfinite()?Pt.INFINITY:new Pt(this.re-t.re,this.im-t.im)},mul:function(e,r){var t=new Pt(e,r);return this.isInfinite()&&t.isZero()||this.isZero()&&t.isInfinite()?Pt.NAN:this.isInfinite()||t.isInfinite()?Pt.INFINITY:0===t.im&&0===this.im?new Pt(this.re*t.re,0):new Pt(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)},div:function(e,r){var t=new Pt(e,r);if(this.isZero()&&t.isZero()||this.isInfinite()&&t.isInfinite())return Pt.NAN;if(this.isInfinite()||t.isZero())return Pt.INFINITY;if(this.isZero()||t.isInfinite())return Pt.ZERO;e=this.re,r=this.im;var n,i,a=t.re,o=t.im;return 0===o?new Pt(e/a,r/a):Math.abs(a)<Math.abs(o)?new Pt((e*(i=a/o)+r)/(n=a*i+o),(r*i-e)/n):new Pt((e+r*(i=o/a))/(n=o*i+a),(r-e*i)/n)},pow:function(e,r){var t=new Pt(e,r);if(e=this.re,r=this.im,t.isZero())return Pt.ONE;if(0===t.im){if(0===r&&e>0)return new Pt(Math.pow(e,t.re),0);if(0===e)switch((t.re%4+4)%4){case 0:return new Pt(Math.pow(r,t.re),0);case 1:return new Pt(0,Math.pow(r,t.re));case 2:return new Pt(-Math.pow(r,t.re),0);case 3:return new Pt(0,-Math.pow(r,t.re))}}if(0===e&&0===r&&t.re>0&&t.im>=0)return Pt.ZERO;var n=Math.atan2(r,e),i=kt(e,r);return e=Math.exp(t.re*i-t.im*n),r=t.im*i+t.re*n,new Pt(e*Math.cos(r),e*Math.sin(r))},sqrt:function(){var e,r,t=this.re,n=this.im,i=this.abs();if(t>=0){if(0===n)return new Pt(Math.sqrt(t),0);e=.5*Math.sqrt(2*(i+t))}else e=Math.abs(n)/Math.sqrt(2*(i-t));return r=t<=0?.5*Math.sqrt(2*(i-t)):Math.abs(n)/Math.sqrt(2*(i+t)),new Pt(e,n<0?-r:r)},exp:function(){var e=Math.exp(this.re);return this.im,new Pt(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){var e=this.re,r=this.im;return new Pt(Math.expm1(e)*Math.cos(r)+function(e){var r=Math.PI/4;if(-r>e||e>r)return Math.cos(e)-1;var t=e*e;return t*(t*(t*(t*(t*(t*(t*(t/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(r),Math.exp(e)*Math.sin(r))},log:function(){var e=this.re,r=this.im;return new Pt(kt(e,r),Math.atan2(r,e))},abs:function(){return e=this.re,r=this.im,t=Math.abs(e),n=Math.abs(r),t<3e3&&n<3e3?Math.sqrt(t*t+n*n):(t<n?(t=n,n=e/r):n=r/e,t*Math.sqrt(1+n*n));var e,r,t,n},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var e=this.re,r=this.im;return new Pt(Math.sin(e)*zt(r),Math.cos(e)*qt(r))},cos:function(){var e=this.re,r=this.im;return new Pt(Math.cos(e)*zt(r),-Math.sin(e)*qt(r))},tan:function(){var e=2*this.re,r=2*this.im,t=Math.cos(e)+zt(r);return new Pt(Math.sin(e)/t,qt(r)/t)},cot:function(){var e=2*this.re,r=2*this.im,t=Math.cos(e)-zt(r);return new Pt(-Math.sin(e)/t,qt(r)/t)},sec:function(){var e=this.re,r=this.im,t=.5*zt(2*r)+.5*Math.cos(2*e);return new Pt(Math.cos(e)*zt(r)/t,Math.sin(e)*qt(r)/t)},csc:function(){var e=this.re,r=this.im,t=.5*zt(2*r)-.5*Math.cos(2*e);return new Pt(Math.sin(e)*zt(r)/t,-Math.cos(e)*qt(r)/t)},asin:function(){var e=this.re,r=this.im,t=new Pt(r*r-e*e+1,-2*e*r).sqrt(),n=new Pt(t.re-r,t.im+e).log();return new Pt(n.im,-n.re)},acos:function(){var e=this.re,r=this.im,t=new Pt(r*r-e*e+1,-2*e*r).sqrt(),n=new Pt(t.re-r,t.im+e).log();return new Pt(Math.PI/2-n.im,n.re)},atan:function(){var e=this.re,r=this.im;if(0===e){if(1===r)return new Pt(0,1/0);if(-1===r)return new Pt(0,-1/0)}var t=e*e+(1-r)*(1-r),n=new Pt((1-r*r-e*e)/t,-2*e/t).log();return new Pt(-.5*n.im,.5*n.re)},acot:function(){var e=this.re,r=this.im;if(0===r)return new Pt(Math.atan2(1,e),0);var t=e*e+r*r;return 0!==t?new Pt(e/t,-r/t).atan():new Pt(0!==e?e/0:0,0!==r?-r/0:0).atan()},asec:function(){var e=this.re,r=this.im;if(0===e&&0===r)return new Pt(0,1/0);var t=e*e+r*r;return 0!==t?new Pt(e/t,-r/t).acos():new Pt(0!==e?e/0:0,0!==r?-r/0:0).acos()},acsc:function(){var e=this.re,r=this.im;if(0===e&&0===r)return new Pt(Math.PI/2,1/0);var t=e*e+r*r;return 0!==t?new Pt(e/t,-r/t).asin():new Pt(0!==e?e/0:0,0!==r?-r/0:0).asin()},sinh:function(){var e=this.re,r=this.im;return new Pt(qt(e)*Math.cos(r),zt(e)*Math.sin(r))},cosh:function(){var e=this.re,r=this.im;return new Pt(zt(e)*Math.cos(r),qt(e)*Math.sin(r))},tanh:function(){var e=2*this.re,r=2*this.im,t=zt(e)+Math.cos(r);return new Pt(qt(e)/t,Math.sin(r)/t)},coth:function(){var e=2*this.re,r=2*this.im,t=zt(e)-Math.cos(r);return new Pt(qt(e)/t,-Math.sin(r)/t)},csch:function(){var e=this.re,r=this.im,t=Math.cos(2*r)-zt(2*e);return new Pt(-2*qt(e)*Math.cos(r)/t,2*zt(e)*Math.sin(r)/t)},sech:function(){var e=this.re,r=this.im,t=Math.cos(2*r)+zt(2*e);return new Pt(2*zt(e)*Math.cos(r)/t,-2*qt(e)*Math.sin(r)/t)},asinh:function(){var e=this.im;this.im=-this.re,this.re=e;var r=this.asin();return this.re=-this.im,this.im=e,e=r.re,r.re=-r.im,r.im=e,r},acosh:function(){var e=this.acos();if(e.im<=0){var r=e.re;e.re=-e.im,e.im=r}else{r=e.im;e.im=-e.re,e.re=r}return e},atanh:function(){var e=this.re,r=this.im,t=e>1&&0===r,n=1-e,i=1+e,a=n*n+r*r,o=0!==a?new Pt((i*n-r*r)/a,(r*n+i*r)/a):new Pt(-1!==e?e/0:0,0!==r?r/0:0),s=o.re;return o.re=kt(o.re,o.im)/2,o.im=Math.atan2(o.im,s)/2,t&&(o.im=-o.im),o},acoth:function(){var e=this.re,r=this.im;if(0===e&&0===r)return new Pt(0,Math.PI/2);var t=e*e+r*r;return 0!==t?new Pt(e/t,-r/t).atanh():new Pt(0!==e?e/0:0,0!==r?-r/0:0).atanh()},acsch:function(){var e=this.re,r=this.im;if(0===r)return new Pt(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);var t=e*e+r*r;return 0!==t?new Pt(e/t,-r/t).asinh():new Pt(0!==e?e/0:0,0!==r?-r/0:0).asinh()},asech:function(){var e=this.re,r=this.im;if(this.isZero())return Pt.INFINITY;var t=e*e+r*r;return 0!==t?new Pt(e/t,-r/t).acosh():new Pt(0!==e?e/0:0,0!==r?-r/0:0).acosh()},inverse:function(){if(this.isZero())return Pt.INFINITY;if(this.isInfinite())return Pt.ZERO;var e=this.re,r=this.im,t=e*e+r*r;return new Pt(e/t,-r/t)},conjugate:function(){return new Pt(this.re,-this.im)},neg:function(){return new Pt(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new Pt(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new Pt(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new Pt(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,r){var t=new Pt(e,r);return Math.abs(t.re-this.re)<=Pt.EPSILON&&Math.abs(t.im-this.im)<=Pt.EPSILON},clone:function(){return new Pt(this.re,this.im)},toString:function(){var e=this.re,r=this.im,t="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<Pt.EPSILON&&(e=0),Math.abs(r)<Pt.EPSILON&&(r=0),0===r?t+e:(0!==e?(t+=e,t+=" ",r<0?(r=-r,t+="-"):t+="+",t+=" "):r<0&&(r=-r,t+="-"),1!==r&&(t+=r),t+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},Pt.ZERO=new Pt(0,0),Pt.ONE=new Pt(1,0),Pt.I=new Pt(0,1),Pt.PI=new Pt(Math.PI,0),Pt.E=new Pt(Math.E,0),Pt.INFINITY=new Pt(1/0,1/0),Pt.NAN=new Pt(NaN,NaN),Pt.EPSILON=1e-15;var Ut=Oe("Complex",[],(()=>(Object.defineProperty(Pt,"name",{value:"Complex"}),Pt.prototype.constructor=Pt,Pt.prototype.type="Complex",Pt.prototype.isComplex=!0,Pt.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Pt.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Pt.prototype.format=function(e){var r=this.im,t=this.re,n=pe(this.re,e),i=pe(this.im,e),o=a(e)?e:e?e.precision:null;if(null!==o){var s=Math.pow(10,-o);Math.abs(t/r)<s&&(t=0),Math.abs(r/t)<s&&(r=0)}return 0===r?n:0===t?1===r?"i":-1===r?"-i":i+"i":r<0?-1===r?n+" - i":n+" - "+i.substring(1)+"i":1===r?n+" + i":n+" + "+i+"i"},Pt.fromPolar=function(e){switch(arguments.length){case 1:var r=arguments[0];if("object"==typeof r)return Pt(r);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var t=arguments[0],n=arguments[1];if(a(t)){if(l(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),a(n))return new Pt({r:t,phi:n});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Pt.prototype.valueOf=Pt.prototype.toString,Pt.fromJSON=function(e){return new Pt(e)},Pt.compare=function(e,r){return e.re>r.re?1:e.re<r.re?-1:e.im>r.im?1:e.im<r.im?-1:0},Pt)),{isClass:!0}),Lt=t(67042),jt=Oe("Fraction",[],(()=>(Object.defineProperty(Lt,"name",{value:"Fraction"}),Lt.prototype.constructor=Lt,Lt.prototype.type="Fraction",Lt.prototype.isFraction=!0,Lt.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Lt.fromJSON=function(e){return new Lt(e)},Lt)),{isClass:!0}),Ht=Oe("Range",[],(()=>{function e(r,t,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");var i=null!=r,a=null!=t,s=null!=n;if(i)if(o(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter start must be a number");if(a)if(o(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter end must be a number");if(s)if(o(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter step must be a number");this.start=i?parseFloat(r):0,this.end=a?parseFloat(t):0,this.step=s?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(r){if("string"!=typeof r)return null;var t=r.split(":").map((function(e){return parseFloat(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[2],t[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){var e=0,r=this.start,t=this.step,n=this.end-r;return ae(t)===ae(n)?e=Math.ceil(n/t):0===n&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){var e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){var e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){var r=this.start,t=this.step,n=this.end,i=0;if(t>0)for(;r<n;)e(r,[i],this),r+=t,i++;else if(t<0)for(;r>n;)e(r,[i],this),r+=t,i++},e.prototype.map=function(e){var r=[];return this.forEach((function(t,n,i){r[n[0]]=e(t,n,i)})),r},e.prototype.toArray=function(){var e=[];return this.forEach((function(r,t){e[t[0]]=r})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){var r=pe(this.start,e);return 1!==this.step&&(r+=":"+pe(this.step,e)),r+=":"+pe(this.end,e)},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(r){return new e(r.start,r.end,r.step)},e}),{isClass:!0}),$t=Oe("Matrix",[],(()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,r){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,r,t){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,r,t){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,r){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,r){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,r){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e}),{isClass:!0});function Gt(e,r,t){var n=new(0,e.constructor)(2),i="";if(t){if(t<1)throw new Error("size must be in greater than 0");if(!ie(t))throw new Error("size must be an integer");if(e.greaterThan(n.pow(t-1).sub(1))||e.lessThan(n.pow(t-1).mul(-1)))throw new Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(t))),i="i".concat(t)}switch(r){case 2:return"".concat(e.toBinary()).concat(i);case 8:return"".concat(e.toOctal()).concat(i);case 16:return"".concat(e.toHexadecimal()).concat(i);default:throw new Error("Base ".concat(r," not supported "))}}function Vt(e,r){if("function"==typeof r)return r(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:i}=me(r);switch(t){case"fixed":return function(e,r){return e.toFixed(r)}(e,n);case"exponential":return Zt(e,n);case"engineering":return function(e,r){var t=e.e,n=t%3==0?t:t<0?t-3-t%3:t-t%3,i=e.mul(Math.pow(10,-n)),a=i.toPrecision(r);if(a.includes("e")){a=new(0,e.constructor)(a).toFixed()}return a+"e"+(t>=0?"+":"")+n.toString()}(e,n);case"bin":return Gt(e,2,i);case"oct":return Gt(e,8,i);case"hex":return Gt(e,16,i);case"auto":var a=Wt(null==r?void 0:r.lowerExp,-3),o=Wt(null==r?void 0:r.upperExp,5);if(e.isZero())return"0";var s=e.toSignificantDigits(n),u=s.e;return(u>=a&&u<o?s.toFixed():Zt(e,n)).replace(/((\.\d*?)(0+))($|e)/,(function(){var e=arguments[2],r=arguments[4];return"."!==e?e+r:r}));default:throw new Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Zt(e,r){return void 0!==r?e.toExponential(r-1):e.toExponential()}function Wt(e,r){return a(e)?e:o(e)?e.toNumber():r}function Yt(e,r){var t=e.length-r.length,n=e.length;return e.substring(t,n)===r}function Jt(e,r){var t=function(e,r){if("number"==typeof e)return pe(e,r);if(o(e))return Vt(e,r);if(function(e){return e&&"object"==typeof e&&"number"==typeof e.s&&"number"==typeof e.n&&"number"==typeof e.d||!1}(e))return r&&"decimal"===r.fraction?e.toString():e.s*e.n+"/"+e.d;if(Array.isArray(e))return en(e,r);if(c(e))return Xt(e);if("function"==typeof e)return e.syntax?String(e.syntax):"function";if(e&&"object"==typeof e){return"function"==typeof e.format?e.format(r):e&&e.toString(r)!=={}.toString()?e.toString(r):"{"+Object.keys(e).map((t=>Xt(t)+": "+Jt(e[t],r))).join(", ")+"}"}return String(e)}(e,r);return r&&"object"==typeof r&&"truncate"in r&&t.length>r.truncate?t.substring(0,r.truncate-3)+"...":t}function Xt(e){for(var r=String(e),t="",n=0;n<r.length;){var i=r.charAt(n);t+=i in Qt?Qt[i]:i,n++}return'"'+t+'"'}var Qt={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function Kt(e){var r=String(e);return r=r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function en(e,r){if(Array.isArray(e)){for(var t="[",n=e.length,i=0;i<n;i++)0!==i&&(t+=", "),t+=en(e[i],r);return t+="]"}return Jt(e,r)}function rn(e,r){if(!c(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+G(e)+", index: 0)");if(!c(r))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+G(r)+", index: 1)");return e===r?0:e>r?1:-1}function tn(e,r,t){if(!(this instanceof tn))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=r,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(r)?"["+r.join(", ")+"]":r)+")",this.stack=(new Error).stack}function nn(e,r,t){if(!(this instanceof nn))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=r):(this.min=r,this.max=t),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}function an(e){for(var r=[];Array.isArray(e);)r.push(e.length),e=e[0];return r}function on(e,r,t){var n,i=e.length;if(i!==r[t])throw new tn(i,r[t]);if(t<r.length-1){var a=t+1;for(n=0;n<i;n++){var o=e[n];if(!Array.isArray(o))throw new tn(r.length-1,r.length,"<");on(e[n],r,a)}}else for(n=0;n<i;n++)if(Array.isArray(e[n]))throw new tn(r.length+1,r.length,">")}function sn(e,r){if(0===r.length){if(Array.isArray(e))throw new tn(e.length,0)}else on(e,r,0)}function un(e,r){var t=e.isMatrix?e._size:an(e);r._sourceSize.forEach(((e,r)=>{if(null!==e&&e!==t[r])throw new tn(e,t[r])}))}function ln(e,r){if(void 0!==e){if(!a(e)||!ie(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof r&&e>=r)throw new nn(e,r)}}function cn(e){for(var r=0;r<e._dimensions.length;++r){var t=e._dimensions[r];if(t._data&&f(t._data)){if(0===t._size[0])return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(c(t)&&0===t.length)return!0}return!1}function fn(e,r,t){if(!Array.isArray(r))throw new TypeError("Array expected");if(0===r.length)throw new Error("Resizing to scalar is not supported");return r.forEach((function(e){if(!a(e)||!ie(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Jt(r)+")")})),(a(e)||o(e))&&(e=[e]),pn(e,r,0,void 0!==t?t:0),e}function pn(e,r,t,n){var i,a,o=e.length,s=r[t],u=Math.min(o,s);if(e.length=s,t<r.length-1){var l=t+1;for(i=0;i<u;i++)a=e[i],Array.isArray(a)||(a=[a],e[i]=a),pn(a,r,l,n);for(i=u;i<s;i++)a=[],e[i]=a,pn(a,r,l,n)}else{for(i=0;i<u;i++)for(;Array.isArray(e[i]);)e[i]=e[i][0];for(i=u;i<s;i++)e[i]=n}}function mn(e,r){var t=bn(e),n=t.length;if(!Array.isArray(e)||!Array.isArray(r))throw new TypeError("Array expected");if(0===r.length)throw new tn(0,n,"!=");var i=hn(r=dn(r,n));if(n!==i)throw new tn(i,n,"!=");try{return function(e,r){for(var t,n=e,i=r.length-1;i>0;i--){var a=r[i];t=[];for(var o=n.length/a,s=0;s<o;s++)t.push(n.slice(s*a,(s+1)*a));n=t}return n}(t,r)}catch(e){if(e instanceof tn)throw new tn(i,n,"!=");throw e}}function dn(e,r){var t=hn(e),n=e.slice(),i=e.indexOf(-1);if(e.indexOf(-1,i+1)>=0)throw new Error("More than one wildcard in sizes");if(i>=0){if(!(r%t==0))throw new Error("Could not replace wildcard, since "+r+" is no multiple of "+-t);n[i]=-r/t}return n}function hn(e){return e.reduce(((e,r)=>e*r),1)}function gn(e,r){for(var t=r||an(e);Array.isArray(e)&&1===e.length;)e=e[0],t.shift();for(var n=t.length;1===t[n-1];)n--;return n<t.length&&(e=yn(e,n,0),t.length=n),e}function yn(e,r,t){var n,i;if(t<r){var a=t+1;for(n=0,i=e.length;n<i;n++)e[n]=yn(e[n],r,a)}else for(;Array.isArray(e);)e=e[0];return e}function vn(e,r,t,n){var i=n||an(e);if(t)for(var a=0;a<t;a++)e=[e],i.unshift(1);for(e=xn(e,r,0);i.length<r;)i.push(1);return e}function xn(e,r,t){var n,i;if(Array.isArray(e)){var a=t+1;for(n=0,i=e.length;n<i;n++)e[n]=xn(e[n],r,a)}else for(var o=t;o<r;o++)e=[e];return e}function bn(e){if(!Array.isArray(e))return e;var r=[];return e.forEach((function e(t){Array.isArray(t)?t.forEach(e):r.push(t)})),r}function wn(e,r){return Array.prototype.map.call(e,r)}function Nn(e,r){Array.prototype.forEach.call(e,r)}function Dn(e,r){if(1!==an(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,r)}function En(e,r){if(1!==an(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(e=>r.test(e)))}function An(e,r){return Array.prototype.join.call(e,r)}function Sn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;var r=[],t=0;r[0]={value:e[0],identifier:0};for(var n=1;n<e.length;n++)e[n]===e[n-1]?t++:t=0,r.push({value:e[n],identifier:t});return r}function Cn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;for(var r=[],t=0;t<e.length;t++)r.push(e[t].value);return r}function Mn(e,r){for(var t,n=0,i=0;i<e.length;i++){var a=e[i],o=Array.isArray(a);if(0===i&&o&&(n=a.length),o&&a.length!==n)return;var s=o?Mn(a,r):r(a);if(void 0===t)t=s;else if(t!==s)return"mixed"}return t}function On(e,r,t,n){if(n<t){if(e.length!==r.length)throw new tn(e.length,r.length);for(var i=[],a=0;a<e.length;a++)i[a]=On(e[a],r[a],t,n+1);return i}return e.concat(r)}function Tn(){var e=Array.prototype.slice.call(arguments,0,-1),r=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce((function(e,t){return On(e,t,r,0)}),e[0]);throw new Error("Wrong number of arguments in function concat")}function Fn(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];for(var n=r.map((e=>e.length)),i=Math.max(...n),a=new Array(i).fill(null),o=0;o<r.length;o++)for(var s=r[o],u=n[o],l=0;l<u;l++){var c=i-u+l;s[l]>a[c]&&(a[c]=s[l])}for(var f=0;f<r.length;f++)_n(r[f],a);return a}function _n(e,r){for(var t=r.length,n=e.length,i=0;i<n;i++){var a=t-n+i;if(e[i]<r[a]&&e[i]>1||e[i]>r[a])throw new Error("shape missmatch: missmatch is found in arg with shape (".concat(e,") not possible to broadcast dimension ").concat(n," with size ").concat(e[i]," to size ").concat(r[a]))}}function Bn(e,r){var t=an(e);if(W(t,r))return e;_n(t,r);var i,a,o,s=Fn(t,r),u=s.length,l=[...Array(u-t.length).fill(1),...t],c=function(e){return(0,n.A)([],e)}(e);t.length<u&&(t=an(c=mn(c,l)));for(var f=0;f<u;f++)t[f]<s[f]&&(i=c,a=s[f],o=f,t=an(c=Tn(...Array(a).fill(i),o)));return c}function In(e){var r=0,t=1,n=Object.create(null),i=Object.create(null),a=0,o=function(e){var o=i[e];if(o&&(delete n[o],delete i[e],--r,t===o)){if(!r)return a=0,void(t=1);for(;!Object.prototype.hasOwnProperty.call(n,++t););}};return e=Math.abs(e),{hit:function(s){var u=i[s],l=++a;if(n[l]=s,i[s]=l,!u){if(++r<=e)return;return s=n[t],o(s),s}if(delete n[u],t===u)for(;!Object.prototype.hasOwnProperty.call(n,++t););},delete:o,clear:function(){r=a=0,t=1,n=Object.create(null),i=Object.create(null)}}}function zn(e){var{hasher:r,limit:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=null==t?Number.POSITIVE_INFINITY:t,r=null==r?JSON.stringify:r,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:In(t||Number.POSITIVE_INFINITY)});for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var o=r(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);var s=e.apply(e,i);return n.cache.values.set(o,s),n.cache.values.delete(n.cache.lru.hit(o)),s}}function qn(e){return Object.keys(e.signatures||{}).reduce((function(e,r){var t=(r.match(/,/g)||[]).length+1;return Math.max(e,t)}),-1)}tn.prototype=new RangeError,tn.prototype.constructor=RangeError,tn.prototype.name="DimensionError",tn.prototype.isDimensionError=!0,nn.prototype=new RangeError,nn.prototype.constructor=RangeError,nn.prototype.name="IndexError",nn.prototype.isIndexError=!0;var Rn=Oe("DenseMatrix",["Matrix"],(e=>{var{Matrix:r}=e;function t(e,r){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!c(r))throw new Error("Invalid datatype: "+r);if(p(e))"DenseMatrix"===e.type?(this._data=V(e._data),this._size=V(e._size),this._datatype=r||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=r||e._datatype);else if(e&&f(e.data)&&f(e.size))this._data=e.data,this._size=e.size,sn(this._data,this._size),this._datatype=r||e.datatype;else if(f(e))this._data=l(e),this._size=an(this._data),sn(this._data,this._size),this._datatype=r;else{if(e)throw new TypeError("Unsupported type of data ("+G(e)+")");this._data=[],this._size=[0],this._datatype=r}}function n(e,r,t,i){var a=i===t-1,o=r.dimension(i);return a?o.map((function(r){return ln(r,e.length),e[r]})).valueOf():o.map((function(a){return ln(a,e.length),n(e[a],r,t,i+1)})).valueOf()}function i(e,r,t,n,a){var o=a===n-1,s=r.dimension(a);o?s.forEach((function(r,n){ln(r),e[r]=t[n[0]]})):s.forEach((function(o,s){ln(o),i(e[o],r,t[s[0]],n,a+1)}))}function s(e,r,t){if(0===r.length){for(var n=e._data;f(n);)n=n[0];return n}return e._size=r.slice(0),e._data=fn(e._data,e._size,t),e}function u(e,r,t){for(var n=e._size.slice(0),i=!1;n.length<r.length;)n.push(0),i=!0;for(var a=0,o=r.length;a<o;a++)r[a]>n[a]&&(n[a]=r[a],i=!0);i&&s(e,n,t)}function l(e){return p(e)?l(e.valueOf()):f(e)?e.map(l):e}return t.prototype=new r,t.prototype.createDenseMatrix=function(e,r){return new t(e,r)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return Mn(this._data,G)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(e,r){return new t(e,r)},t.prototype.subset=function(e,r,a){switch(arguments.length){case 1:return function(e,r){if(!y(r))throw new TypeError("Invalid index");var i=r.isScalar();if(i)return e.get(r.min());var a=r.size();if(a.length!==e._size.length)throw new tn(a.length,e._size.length);for(var o=r.min(),s=r.max(),u=0,l=e._size.length;u<l;u++)ln(o[u],e._size[u]),ln(s[u],e._size[u]);return new t(n(e._data,r,a.length,0),e._datatype)}(this,e);case 2:case 3:return function(e,r,t,n){if(!r||!0!==r.isIndex)throw new TypeError("Invalid index");var a,o=r.size(),s=r.isScalar();p(t)?(a=t.size(),t=t.valueOf()):a=an(t);if(s){if(0!==a.length)throw new TypeError("Scalar expected");e.set(r.min(),t,n)}else{if(!W(a,o))try{a=an(t=0===a.length?Bn([t],o):Bn(t,o))}catch(e){}if(o.length<e._size.length)throw new tn(o.length,e._size.length,"<");if(a.length<o.length){for(var l=0,c=0;1===o[l]&&1===a[l];)l++;for(;1===o[l];)c++,l++;t=vn(t,o.length,c,a)}if(!W(o,a))throw new tn(o,a,">");var f=r.max().map((function(e){return e+1}));u(e,f,n);var m=o.length,d=0;i(e._data,r,t,m,d)}return e}(this,e,r,a);default:throw new SyntaxError("Wrong number of arguments")}},t.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new tn(e.length,this._size.length);for(var r=0;r<e.length;r++)ln(e[r],this._size[r]);for(var t=this._data,n=0,i=e.length;n<i;n++){var a=e[n];ln(a,t.length),t=t[a]}return t},t.prototype.set=function(e,r,t){if(!f(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new tn(e.length,this._size.length,"<");var n,i,a,o=e.map((function(e){return e+1}));u(this,o,t);var s=this._data;for(n=0,i=e.length-1;n<i;n++)ln(a=e[n],s.length),s=s[a];return ln(a=e[e.length-1],s.length),s[a]=r,this},t.prototype.resize=function(e,r,t){if(!m(e))throw new TypeError("Array or Matrix expected");var n=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));return s(t?this.clone():this,n,r)},t.prototype.reshape=function(e,r){var t=r?this.clone():this;t._data=mn(t._data,e);var n=t._size.reduce(((e,r)=>e*r));return t._size=dn(e,n),t},t.prototype.clone=function(){return new t({data:V(this._data),size:V(this._size),datatype:this._datatype})},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(e){var r=this,n=qn(e),i=function t(i,a){return f(i)?i.map((function(e,r){return t(e,a.concat(r))})):1===n?e(i):2===n?e(i,a):e(i,a,r)}(this._data,[]);return new t(i,void 0!==this._datatype?Mn(i,G):void 0)},t.prototype.forEach=function(e){var r=this;!function t(n,i){f(n)?n.forEach((function(e,r){t(e,i.concat(r))})):e(n,i,r)}(this._data,[])},t.prototype[Symbol.iterator]=function*(){yield*function*e(r,t){if(f(r))for(var n=0;n<r.length;n++)yield*e(r[n],t.concat(n));else yield{value:r,index:t}}(this._data,[])},t.prototype.rows=function(){var e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");var r=this._data;for(var n of r)e.push(new t([n],this._datatype));return e},t.prototype.columns=function(){var e=this,r=[],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((e=>[e[n]]));r.push(new t(a,e._datatype))},o=0;o<n[1];o++)a(o);return r},t.prototype.toArray=function(){return V(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(e){return Jt(this._data,e)},t.prototype.toString=function(){return Jt(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(e){if(e){if(o(e)&&(e=e.toNumber()),!a(e)||!ie(e))throw new TypeError("The parameter k must be an integer number")}else e=0;for(var r=e>0?e:0,n=e<0?-e:0,i=this._size[0],s=this._size[1],u=Math.min(i-n,s-r),l=[],c=0;c<u;c++)l[c]=this._data[c+n][c+r];return new t({data:l,size:[u],datatype:this._datatype})},t.diagonal=function(e,r,n,i){if(!f(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(o(e)&&(e=e.toNumber()),!a(e)||!ie(e)||e<1)throw new Error("Size values must be positive integers");return e})),n){if(o(n)&&(n=n.toNumber()),!a(n)||!ie(n))throw new TypeError("The parameter k must be an integer number")}else n=0;var s,u=n>0?n:0,l=n<0?-n:0,c=e[0],m=e[1],d=Math.min(c-l,m-u);if(f(r)){if(r.length!==d)throw new Error("Invalid value array length");s=function(e){return r[e]}}else if(p(r)){var h=r.size();if(1!==h.length||h[0]!==d)throw new Error("Invalid matrix length");s=function(e){return r.get([e])}}else s=function(){return r};i||(i=o(s(0))?s(0).mul(0):0);var g=[];if(e.length>0){g=fn(g,e,i);for(var y=0;y<d;y++)g[y+l][y+u]=s(y)}return new t({data:g,size:[c,m]})},t.fromJSON=function(e){return new t(e)},t.prototype.swapRows=function(e,r){if(!(a(e)&&ie(e)&&a(r)&&ie(r)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return ln(e,this._size[0]),ln(r,this._size[0]),t._swapRows(e,r,this._data),this},t._swapRows=function(e,r,t){var n=t[e];t[e]=t[r],t[r]=n},t}),{isClass:!0}),kn="clone",Pn=Oe(kn,["typed"],(e=>{var{typed:r}=e;return r(kn,{any:V})}));function Un(e){var r,t,n=e.length,i=e[0].length,a=[];for(t=0;t<i;t++){var o=[];for(r=0;r<n;r++)o.push(e[r][t]);a.push(o)}return a}function Ln(e){for(var r=0;r<e.length;r++)if(m(e[r]))return!0;return!1}function jn(e,r){p(e)&&(e=e.valueOf());for(var t=0,n=e.length;t<n;t++){var i=e[t];Array.isArray(i)?jn(i,r):r(i)}}function Hn(e,r,t){return e&&"function"==typeof e.map?e.map((function(e){return Hn(e,r,t)})):r(e)}function $n(e,r,t){var n=Array.isArray(e)?an(e):e.size();if(r<0||r>=n.length)throw new nn(r,n.length);return p(e)?e.create(Gn(e.valueOf(),r,t)):Gn(e,r,t)}function Gn(e,r,t){var n,i,a,o;if(r<=0){if(Array.isArray(e[0])){for(o=Un(e),i=[],n=0;n<o.length;n++)i[n]=Gn(o[n],r-1,t);return i}for(a=e[0],n=1;n<e.length;n++)a=t(a,e[n]);return a}for(i=[],n=0;n<e.length;n++)i[n]=Gn(e[n],r-1,t);return i}function Vn(e,r,t,n,i,a,o,s,u,l,c){var f,p,m,d,h=e._values,g=e._index,y=e._ptr;if(n)for(p=y[r],m=y[r+1],f=p;f<m;f++)t[d=g[f]]!==a?(t[d]=a,o.push(d),l?(n[d]=u?s(h[f],c):s(c,h[f]),i[d]=a):n[d]=h[f]):(n[d]=u?s(h[f],n[d]):s(n[d],h[f]),i[d]=a);else for(p=y[r],m=y[r+1],f=p;f<m;f++)t[d=g[f]]!==a?(t[d]=a,o.push(d)):i[d]=a}var Zn="isInteger",Wn=Oe(Zn,["typed"],(e=>{var{typed:r}=e;return r(Zn,{number:ie,BigNumber:function(e){return e.isInt()},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Yn="number",Jn="number, number";function Xn(e){return Math.abs(e)}function Qn(e,r){return e+r}function Kn(e,r){return e-r}function ei(e,r){return e*r}function ri(e){return-e}function ti(e){return e}function ni(e){return le(e)}function ii(e){return e*e*e}function ai(e){return Math.exp(e)}function oi(e){return ce(e)}function si(e,r){if(!ie(e)||!ie(r))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===r)return 0;for(var t,n=e*r;0!==r;)r=e%(t=r),e=t;return Math.abs(n/e)}function ui(e){return se(e)}function li(e){return oe(e)}function ci(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=r<0;if(t&&(r=-r),0===r)throw new Error("Root must be non-zero");if(e<0&&Math.abs(r)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return t?1/0:0;if(!isFinite(e))return t?0:e;var n=Math.pow(Math.abs(e),1/r);return n=e<0?-n:n,t?1/n:n}function fi(e){return ae(e)}function pi(e){return e*e}function mi(e,r){var t,n,i,a=0,o=1,s=1,u=0;if(!ie(e)||!ie(r))throw new Error("Parameters in function xgcd must be integer numbers");for(;r;)i=e-(n=Math.floor(e/r))*r,t=a,a=o-n*a,o=t,t=s,s=u-n*s,u=t,e=r,r=i;return e<0?[-e,-o,-u]:[e,e?o:0,u]}function di(e,r){return e*e<1&&r===1/0||e*e>1&&r===-1/0?0:Math.pow(e,r)}function hi(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ie(r)||r<0||r>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(he(e,r))}Xn.signature=Yn,Qn.signature=Jn,Kn.signature=Jn,ei.signature=Jn,ri.signature=Yn,ti.signature=Yn,ni.signature=Yn,ii.signature=Yn,ai.signature=Yn,oi.signature=Yn,si.signature=Jn,ui.signature=Yn,li.signature=Yn,fi.signature=Yn,pi.signature=Yn,mi.signature=Jn,di.signature=Jn;var gi="number, number";function yi(e,r){if(!ie(e)||!ie(r))throw new Error("Integers expected in function bitAnd");return e&r}function vi(e){if(!ie(e))throw new Error("Integer expected in function bitNot");return~e}function xi(e,r){if(!ie(e)||!ie(r))throw new Error("Integers expected in function bitOr");return e|r}function bi(e,r){if(!ie(e)||!ie(r))throw new Error("Integers expected in function bitXor");return e^r}function wi(e,r){if(!ie(e)||!ie(r))throw new Error("Integers expected in function leftShift");return e<<r}function Ni(e,r){if(!ie(e)||!ie(r))throw new Error("Integers expected in function rightArithShift");return e>>r}function Di(e,r){if(!ie(e)||!ie(r))throw new Error("Integers expected in function rightLogShift");return e>>>r}function Ei(e,r){if(r<e)return 1;if(r===e)return r;var t=r+e>>1;return Ei(e,t)*Ei(t+1,r)}function Ai(e,r){if(!ie(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!ie(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(r>e)throw new TypeError("k must be less than or equal to n");for(var t=e-r,n=1,i=2,a=r<t?r:t,o=r<t?t+1:r+1;o<=e;++o)for(n*=o;i<=a&&n%i==0;)n/=i,++i;return i<=a&&(n/=Ei(i,a)),n}yi.signature=gi,vi.signature="number",xi.signature=gi,bi.signature=gi,wi.signature=gi,Ni.signature=gi,Di.signature=gi,Ai.signature="number, number";var Si=Math.PI,Ci=2*Math.PI,Mi=Math.E,Oi="number, number";function Ti(e){return!e}function Fi(e,r){return!(!e&&!r)}function _i(e,r){return!!e!=!!r}function Bi(e,r){return!(!e||!r)}function Ii(e){var r;if(ie(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:Ei(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Ii(1-e));if(e>=171.35)return 1/0;if(e>85){var t=e*e,n=t*e,i=n*e,a=i*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*n)-571/(2488320*i)+163879/(209018880*a)+5246819/(75246796800*a*e))}--e,r=qi[0];for(var o=1;o<qi.length;++o)r+=qi[o]/(e+o);var s=e+zi+.5;return Math.sqrt(2*Math.PI)*Math.pow(s,e+.5)*Math.exp(-s)*r}Ti.signature="number",Fi.signature=Oi,_i.signature=Oi,Bi.signature=Oi,Ii.signature="number";var zi=4.7421875,qi=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Ri=.9189385332046728,ki=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Pi(e){if(e<0)return NaN;if(0===e)return 1/0;if(!isFinite(e))return e;if(e<.5)return Math.log(Math.PI/Math.sin(Math.PI*e))-Pi(1-e);for(var r=(e-=1)+5+.5,t=ki[0],n=6;n>=1;n--)t+=ki[n]/(e+n);return Ri+(e+.5)*Math.log(r)-r+Math.log(t)}Pi.signature="number";var Ui="number";function Li(e){return we(e)}function ji(e){return Math.atan(1/e)}function Hi(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function $i(e){return Math.asin(1/e)}function Gi(e){var r=1/e;return Math.log(r+Math.sqrt(r*r+1))}function Vi(e){return Math.acos(1/e)}function Zi(e){var r=1/e,t=Math.sqrt(r*r-1);return Math.log(t+r)}function Wi(e){return Ne(e)}function Yi(e){return De(e)}function Ji(e){return 1/Math.tan(e)}function Xi(e){var r=Math.exp(2*e);return(r+1)/(r-1)}function Qi(e){return 1/Math.sin(e)}function Ki(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*ae(e)}function ea(e){return 1/Math.cos(e)}function ra(e){return 2/(Math.exp(e)+Math.exp(-e))}function ta(e){return Ae(e)}Li.signature=Ui,ji.signature=Ui,Hi.signature=Ui,$i.signature=Ui,Gi.signature=Ui,Vi.signature=Ui,Zi.signature=Ui,Wi.signature=Ui,Yi.signature=Ui,Ji.signature=Ui,Xi.signature=Ui,Qi.signature=Ui,Ki.signature=Ui,ea.signature=Ui,ra.signature=Ui,ta.signature=Ui;var na="number";function ia(e){return e<0}function aa(e){return e>0}function oa(e){return 0===e}function sa(e){return Number.isNaN(e)}ia.signature=na,aa.signature=na,oa.signature=na,sa.signature=na;var ua="isNegative",la=Oe(ua,["typed"],(e=>{var{typed:r}=e;return r(ua,{number:ia,BigNumber:function(e){return e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s<0},Unit:r.referToSelf((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),ca="isNumeric",fa=Oe(ca,["typed"],(e=>{var{typed:r}=e;return r(ca,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),pa="hasNumericValue",ma=Oe(pa,["typed","isNumeric"],(e=>{var{typed:r,isNumeric:t}=e;return r(pa,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return t(e)}})})),da="isPositive",ha=Oe(da,["typed"],(e=>{var{typed:r}=e;return r(da,{number:aa,BigNumber:function(e){return!e.isNeg()&&!e.isZero()&&!e.isNaN()},Fraction:function(e){return e.s>0&&e.n>0},Unit:r.referToSelf((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),ga="isZero",ya=Oe(ga,["typed"],(e=>{var{typed:r}=e;return r(ga,{number:oa,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:r.referToSelf((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),va="isNaN",xa=Oe(va,["typed"],(e=>{var{typed:r}=e;return r(va,{number:sa,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":r.referToSelf((e=>r=>Hn(r,e)))})})),ba="typeOf",wa=Oe(ba,["typed"],(e=>{var{typed:r}=e;return r(ba,{any:G})}));function Na(e,r,t){if(null==t)return e.eq(r);if(e.eq(r))return!0;if(e.isNaN()||r.isNaN())return!1;if(e.isFinite()&&r.isFinite()){var n=e.minus(r).abs();if(n.isZero())return!0;var i=e.constructor.max(e.abs(),r.abs());return n.lte(i.times(t))}return!1}var Da=Oe("compareUnits",["typed"],(e=>{var{typed:r}=e;return{"Unit, Unit":r.referToSelf((e=>(t,n)=>{if(!t.equalBase(n))throw new Error("Cannot compare units with different base");return r.find(e,[t.valueType(),n.valueType()])(t.value,n.value)}))}})),Ea="equalScalar",Aa=Oe(Ea,["typed","config"],(e=>{var{typed:r,config:t}=e,n=Da({typed:r});return r(Ea,{"boolean, boolean":function(e,r){return e===r},"number, number":function(e,r){return be(e,r,t.epsilon)},"BigNumber, BigNumber":function(e,r){return e.eq(r)||Na(e,r,t.epsilon)},"Fraction, Fraction":function(e,r){return e.equals(r)},"Complex, Complex":function(e,r){return function(e,r,t){return be(e.re,r.re,t)&&be(e.im,r.im,t)}(e,r,t.epsilon)}},n)})),Sa=(Oe(Ea,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(Ea,{"number, number":function(e,r){return be(e,r,t.epsilon)}})})),Oe("SparseMatrix",["typed","equalScalar","Matrix"],(e=>{var{typed:r,equalScalar:t,Matrix:n}=e;function i(e,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!c(r))throw new Error("Invalid datatype: "+r);if(p(e))!function(e,r,t){"SparseMatrix"===r.type?(e._values=r._values?V(r._values):void 0,e._index=V(r._index),e._ptr=V(r._ptr),e._size=V(r._size),e._datatype=t||r._datatype):s(e,r.valueOf(),t||r._datatype)}(this,e,r);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=r||e.datatype;else if(f(e))s(this,e,r);else{if(e)throw new TypeError("Unsupported type of data ("+G(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=r}}function s(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;var a=n.length,o=0,s=t,u=0;if(c(i)&&(s=r.find(t,[i,i])||t,u=r.convert(0,i)),a>0){var l=0;do{e._ptr.push(e._index.length);for(var p=0;p<a;p++){var m=n[p];if(f(m)){if(0===l&&o<m.length&&(o=m.length),l<m.length){var d=m[l];s(d,u)||(e._values.push(d),e._index.push(p))}}else 0===l&&o<1&&(o=1),s(m,u)||(e._values.push(m),e._index.push(p))}l++}while(l<o)}e._ptr.push(e._index.length),e._size=[a,o]}function u(e,r,t,n){if(t-r==0)return t;for(var i=r;i<t;i++)if(n[i]===e)return i;return r}function l(e,r,t,n,i,a,o){i.splice(e,0,n),a.splice(e,0,r);for(var s=t+1;s<o.length;s++)o[s]++}function d(e,n,i,a){var o=a||0,s=t,u=0;c(e._datatype)&&(s=r.find(t,[e._datatype,e._datatype])||t,u=r.convert(0,e._datatype),o=r.convert(o,e._datatype));var l,f,p,m=!s(o,u),d=e._size[0],h=e._size[1];if(i>h){for(f=h;f<i;f++)if(e._ptr[f]=e._values.length,m)for(l=0;l<d;l++)e._values.push(o),e._index.push(l);e._ptr[i]=e._values.length}else i<h&&(e._ptr.splice(i+1,h-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(h=i,n>d){if(m){var g=0;for(f=0;f<h;f++){e._ptr[f]=e._ptr[f]+g,p=e._ptr[f+1]+g;var y=0;for(l=d;l<n;l++,y++)e._values.splice(p+y,0,o),e._index.splice(p+y,0,l),g++}e._ptr[h]=e._values.length}}else if(n<d){var v=0;for(f=0;f<h;f++){e._ptr[f]=e._ptr[f]-v;var x=e._ptr[f],b=e._ptr[f+1]-v;for(p=x;p<b;p++)(l=e._index[p])>n-1&&(e._values.splice(p,1),e._index.splice(p,1),v++)}e._ptr[f]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function h(e,r,t,n,i){var a,o,s=n[0],u=n[1],l=[];for(a=0;a<s;a++)for(l[a]=[],o=0;o<u;o++)l[a][o]=0;for(o=0;o<u;o++)for(var c=t[o],f=t[o+1],p=c;p<f;p++)l[a=r[p]][o]=e?i?V(e[p]):e[p]:1;return l}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,r){return new i(e,r)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Mn(this._values,G)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,r){return new i(e,r)},i.prototype.density=function(){var e=this._size[0],r=this._size[1];return 0!==e&&0!==r?this._index.length/(e*r):0},i.prototype.subset=function(e,r,t){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,r){if(!y(r))throw new TypeError("Invalid index");if(r.isScalar())return e.get(r.min());var t,n,a,o,s=r.size();if(s.length!==e._size.length)throw new tn(s.length,e._size.length);var u=r.min(),l=r.max();for(t=0,n=e._size.length;t<n;t++)ln(u[t],e._size[t]),ln(l[t],e._size[t]);var c=e._values,f=e._index,p=e._ptr,m=r.dimension(0),d=r.dimension(1),h=[],g=[];m.forEach((function(e,r){g[e]=r[0],h[e]=!0}));var v=c?[]:void 0,x=[],b=[];return d.forEach((function(e){for(b.push(x.length),a=p[e],o=p[e+1];a<o;a++)t=f[a],!0===h[t]&&(x.push(g[t]),v&&v.push(c[a]))})),b.push(x.length),new i({values:v,index:x,ptr:b,size:s,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,r,t,n){if(!r||!0!==r.isIndex)throw new TypeError("Invalid index");var i,a=r.size(),o=r.isScalar();p(t)?(i=t.size(),t=t.toArray()):i=an(t);if(o){if(0!==i.length)throw new TypeError("Scalar expected");e.set(r.min(),t,n)}else{if(1!==a.length&&2!==a.length)throw new tn(a.length,e._size.length,"<");if(i.length<a.length){for(var s=0,u=0;1===a[s]&&1===i[s];)s++;for(;1===a[s];)u++,s++;t=vn(t,a.length,u,i)}if(!W(a,i))throw new tn(a,i,">");if(1===a.length){r.dimension(0).forEach((function(r,i){ln(r),e.set([r,0],t[i[0]],n)}))}else{var l=r.dimension(0),c=r.dimension(1);l.forEach((function(r,i){ln(r),c.forEach((function(a,o){ln(a),e.set([r,a],t[i[0]][o[0]],n)}))}))}}return e}(this,e,r,t);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new tn(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var r=e[0],t=e[1];ln(r,this._size[0]),ln(t,this._size[1]);var n=u(r,this._ptr[t],this._ptr[t+1],this._index);return n<this._ptr[t+1]&&this._index[n]===r?this._values[n]:0},i.prototype.set=function(e,n,i){if(!f(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new tn(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var a=e[0],o=e[1],s=this._size[0],p=this._size[1],m=t,h=0;c(this._datatype)&&(m=r.find(t,[this._datatype,this._datatype])||t,h=r.convert(0,this._datatype)),(a>s-1||o>p-1)&&(d(this,Math.max(a+1,s),Math.max(o+1,p),i),s=this._size[0],p=this._size[1]),ln(a,s),ln(o,p);var g=u(a,this._ptr[o],this._ptr[o+1],this._index);return g<this._ptr[o+1]&&this._index[g]===a?m(n,h)?function(e,r,t,n,i){t.splice(e,1),n.splice(e,1);for(var a=r+1;a<i.length;a++)i[a]--}(g,o,this._values,this._index,this._ptr):this._values[g]=n:m(n,h)||l(g,a,o,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,r,t){if(!m(e))throw new TypeError("Array or Matrix expected");var n=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));if(2!==n.length)throw new Error("Only two dimensions matrix are supported");return n.forEach((function(e){if(!a(e)||!ie(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+Jt(n)+")")})),d(t?this.clone():this,n[0],n[1],r)},i.prototype.reshape=function(e,r){if(!f(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");e.forEach((function(r){if(!a(r)||!ie(r)||r<=-2||0===r)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+Jt(e)+")")}));var t=this._size[0]*this._size[1];if(t!==(e=dn(e,t))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var n=r?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return n;for(var i=[],o=0;o<n._ptr.length;o++)for(var s=0;s<n._ptr[o+1]-n._ptr[o];s++)i.push(o);for(var c=n._values.slice(),p=n._index.slice(),m=0;m<n._index.length;m++){var d=p[m],h=i[m],g=d*n._size[1]+h;i[m]=g%e[1],p[m]=Math.floor(g/e[1])}n._values.length=0,n._index.length=0,n._ptr.length=e[1]+1,n._size=e.slice();for(var y=0;y<n._ptr.length;y++)n._ptr[y]=0;for(var v=0;v<c.length;v++){var x=p[v],b=i[v],w=c[v];l(u(x,n._ptr[b],n._ptr[b+1],n._index),x,b,w,n._values,n._index,n._ptr)}return n},i.prototype.clone=function(){return new i({values:this._values?V(this._values):void 0,index:V(this._index),ptr:V(this._ptr),size:V(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var a=this,o=this._size[0],s=this._size[1],u=qn(e);return function(e,n,a,o,s,u,l){var f=[],p=[],m=[],d=t,h=0;c(e._datatype)&&(d=r.find(t,[e._datatype,e._datatype])||t,h=r.convert(0,e._datatype));for(var g=function(e,r,t){e=u(e,r,t),d(e,h)||(f.push(e),p.push(r))},y=o;y<=s;y++){m.push(f.length);var v=e._ptr[y],x=e._ptr[y+1];if(l)for(var b=v;b<x;b++){var w=e._index[b];w>=n&&w<=a&&g(e._values[b],w-n,y-o)}else{for(var N={},D=v;D<x;D++){N[e._index[D]]=e._values[D]}for(var E=n;E<=a;E++){g(E in N?N[E]:0,E-n,y-o)}}}return m.push(f.length),new i({values:f,index:p,ptr:m,size:[a-n+1,s-o+1]})}(this,0,o-1,0,s-1,(function(r,t,n){return 1===u?e(r):2===u?e(r,[t,n]):e(r,[t,n],a)}),n)},i.prototype.forEach=function(e,r){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var t=this._size[0],n=this._size[1],i=0;i<n;i++){var a=this._ptr[i],o=this._ptr[i+1];if(r)for(var s=a;s<o;s++){var u=this._index[s];e(this._values[s],[u,i],this)}else{for(var l={},c=a;c<o;c++){l[this._index[c]]=this._values[c]}for(var f=0;f<t;f++){e(f in l?l[f]:0,[f,i],this)}}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");for(var e=this._size[1],r=0;r<e;r++)for(var t=this._ptr[r],n=this._ptr[r+1],i=t;i<n;i++){var a=this._index[i];yield{value:this._values[i],index:[a,r]}}},i.prototype.toArray=function(){return h(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return h(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){for(var r=this._size[0],t=this._size[1],n=this.density(),i="Sparse Matrix ["+Jt(r,e)+" x "+Jt(t,e)+"] density: "+Jt(n,e)+"\n",a=0;a<t;a++)for(var o=this._ptr[a],s=this._ptr[a+1],u=o;u<s;u++){i+="\n ("+Jt(this._index[u],e)+", "+Jt(a,e)+") ==> "+(this._values?Jt(this._values[u],e):"X")}return i},i.prototype.toString=function(){return Jt(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(o(e)&&(e=e.toNumber()),!a(e)||!ie(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var r=e>0?e:0,t=e<0?-e:0,n=this._size[0],s=this._size[1],u=Math.min(n-t,s-r),l=[],c=[],f=[];f[0]=0;for(var p=r;p<s&&l.length<u;p++)for(var m=this._ptr[p],d=this._ptr[p+1],h=m;h<d;h++){var g=this._index[h];if(g===p-r+t){l.push(this._values[h]),c[l.length-1]=g-t;break}}return f.push(l.length),new i({values:l,index:c,ptr:f,size:[u,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,s,u,l){if(!f(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(o(e)&&(e=e.toNumber()),!a(e)||!ie(e)||e<1)throw new Error("Size values must be positive integers");return e})),s){if(o(s)&&(s=s.toNumber()),!a(s)||!ie(s))throw new TypeError("The parameter k must be an integer number")}else s=0;var m=t,d=0;c(l)&&(m=r.find(t,[l,l])||t,d=r.convert(0,l));var h,g=s>0?s:0,y=s<0?-s:0,v=e[0],x=e[1],b=Math.min(v-y,x-g);if(f(n)){if(n.length!==b)throw new Error("Invalid value array length");h=function(e){return n[e]}}else if(p(n)){var w=n.size();if(1!==w.length||w[0]!==b)throw new Error("Invalid matrix length");h=function(e){return n.get([e])}}else h=function(){return n};for(var N=[],D=[],E=[],A=0;A<x;A++){E.push(N.length);var S=A-g;if(S>=0&&S<b){var C=h(S);m(C,d)||(D.push(S+y),N.push(C))}}return E.push(N.length),new i({values:N,index:D,ptr:E,size:[v,x]})},i.prototype.swapRows=function(e,r){if(!(a(e)&&ie(e)&&a(r)&&ie(r)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return ln(e,this._size[0]),ln(r,this._size[0]),i._swapRows(e,r,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,r,t,n,i){for(var a=n[e],o=n[e+1],s=a;s<o;s++)i(t[s],r[s])},i._swapRows=function(e,r,t,n,i,a){for(var o=0;o<t;o++){var s=a[o],l=a[o+1],c=u(e,s,l,i),f=u(r,s,l,i);if(c<l&&f<l&&i[c]===e&&i[f]===r){if(n){var p=n[c];n[c]=n[f],n[f]=p}}else if(c<l&&i[c]===e&&(f>=l||i[f]!==r)){var m=n?n[c]:void 0;i.splice(f,0,r),n&&n.splice(f,0,m),i.splice(f<=c?c+1:c,1),n&&n.splice(f<=c?c+1:c,1)}else if(f<l&&i[f]===r&&(c>=l||i[c]!==e)){var d=n?n[f]:void 0;i.splice(c,0,e),n&&n.splice(c,0,d),i.splice(c<=f?f+1:f,1),n&&n.splice(c<=f?f+1:f,1)}}},i}),{isClass:!0}));var Ca=Oe("number",["typed"],(e=>{var{typed:r}=e,t=r("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;var r,t,n=(t=(r=e).match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/))?{input:r,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null;if(n)return function(e){for(var r=parseInt(e.integerPart,e.radix),t=0,n=0;n<e.fractionalPart.length;n++)t+=parseInt(e.fractionalPart[n],e.radix)/Math.pow(e.radix,n+1);var i=r+t;if(isNaN(i))throw new SyntaxError('String "'+e.input+'" is not a valid number');return i}(n);var i=0,a=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);a&&(i=Number(a[2]),e=a[1]);var o=Number(e);if(isNaN(o))throw new SyntaxError('String "'+e+'" is not a valid number');if(a){if(o>2**i-1)throw new SyntaxError('String "'.concat(e,'" is out of range'));o>=2**(i-1)&&(o-=2**i)}return o},BigNumber:function(e){return e.toNumber()},Fraction:function(e){return e.valueOf()},Unit:r.referToSelf((e=>r=>{var t=r.clone();return t.value=e(r.value),t})),null:function(e){return 0},"Unit, string | Unit":function(e,r){return e.toNumber(r)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))});return t.fromJSON=function(e){return parseFloat(e.value)},t})),Ma="string",Oa=Oe(Ma,["typed"],(e=>{var{typed:r}=e;return r(Ma,{"":function(){return""},number:pe,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e))),any:function(e){return String(e)}})})),Ta="boolean",Fa=Oe(Ta,["typed"],(e=>{var{typed:r}=e;return r(Ta,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){var r=e.toLowerCase();if("true"===r)return!0;if("false"===r)return!1;var t=Number(e);if(""!==e&&!isNaN(t))return!!t;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),_a=Oe("bignumber",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("bignumber",{"":function(){return new t(0)},number:function(e){return new t(e+"")},string:function(e){var r=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(r){var n=r[2],i=t(r[1]),a=new t(2).pow(Number(n));if(i.gt(a.sub(1)))throw new SyntaxError('String "'.concat(e,'" is out of range'));var o=new t(2).pow(Number(n)-1);return i.gte(o)?i.sub(a):i}return new t(e)},BigNumber:function(e){return e},Unit:r.referToSelf((e=>r=>{var t=r.clone();return t.value=e(r.value),t})),Fraction:function(e){return new t(e.n).div(e.d).times(e.s)},null:function(e){return new t(0)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Ba=Oe("complex",["typed","Complex"],(e=>{var{typed:r,Complex:t}=e;return r("complex",{"":function(){return t.ZERO},number:function(e){return new t(e,0)},"number, number":function(e,r){return new t(e,r)},"BigNumber, BigNumber":function(e,r){return new t(e.toNumber(),r.toNumber())},Fraction:function(e){return new t(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return t(e)},null:function(e){return t(0)},Object:function(e){if("re"in e&&"im"in e)return new t(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new t(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Ia=Oe("fraction",["typed","Fraction"],(e=>{var{typed:r,Fraction:t}=e;return r("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new t(e)},string:function(e){return new t(e)},"number, number":function(e,r){return new t(e,r)},null:function(e){return new t(0)},BigNumber:function(e){return new t(e.toString())},Fraction:function(e){return e},Unit:r.referToSelf((e=>r=>{var t=r.clone();return t.value=e(r.value),t})),Object:function(e){return new t(e)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),za="matrix",qa=Oe(za,["typed","Matrix","DenseMatrix","SparseMatrix"],(e=>{var{typed:r,Matrix:t,DenseMatrix:n,SparseMatrix:i}=e;return r(za,{"":function(){return a([])},string:function(e){return a([],e)},"string, string":function(e,r){return a([],e,r)},Array:function(e){return a(e)},Matrix:function(e){return a(e,e.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});function a(e,r,t){if("dense"===r||"default"===r||void 0===r)return new n(e,t);if("sparse"===r)return new i(e,t);throw new TypeError("Unknown matrix type "+JSON.stringify(r)+".")}})),Ra="matrixFromFunction",ka=Oe(Ra,["typed","matrix","isZero"],(e=>{var{typed:r,matrix:t,isZero:n}=e;return r(Ra,{"Array | Matrix, function, string, string":function(e,r,t,n){return i(e,r,t,n)},"Array | Matrix, function, string":function(e,r,t){return i(e,r,t)},"Matrix, function":function(e,r){return i(e,r,"dense")},"Array, function":function(e,r){return i(e,r,"dense").toArray()},"Array | Matrix, string, function":function(e,r,t){return i(e,t,r)},"Array | Matrix, string, string, function":function(e,r,t,n){return i(e,n,r,t)}});function i(e,r,i,a){var o;return(o=void 0!==a?t(i,a):t(i)).resize(e),o.forEach((function(e,t){var i=r(t);n(i)||o.set(t,i)})),o}})),Pa="matrixFromRows",Ua=Oe(Pa,["typed","matrix","flatten","size"],(e=>{var{typed:r,matrix:t,flatten:n,size:i}=e;return r(Pa,{"...Array":function(e){return a(e)},"...Matrix":function(e){return t(a(e.map((e=>e.toArray()))))}});function a(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");var r=o(e[0]),t=[];for(var i of e){var a=o(i);if(a!==r)throw new TypeError("The vectors had different length: "+(0|r)+" ≠ "+(0|a));t.push(n(i))}return t}function o(e){var r=i(e);if(1===r.length)return r[0];if(2===r.length){if(1===r[0])return r[1];if(1===r[1])return r[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.")}})),La="matrixFromColumns",ja=Oe(La,["typed","matrix","flatten","size"],(e=>{var{typed:r,matrix:t,flatten:n,size:i}=e;return r(La,{"...Array":function(e){return a(e)},"...Matrix":function(e){return t(a(e.map((e=>e.toArray()))))}});function a(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");for(var r=o(e[0]),t=[],i=0;i<r;i++)t[i]=[];for(var a of e){var s=o(a);if(s!==r)throw new TypeError("The vectors had different length: "+(0|r)+" ≠ "+(0|s));for(var u=n(a),l=0;l<r;l++)t[l].push(u[l])}return t}function o(e){var r=i(e);if(1===r.length)return r[0];if(2===r.length){if(1===r[0])return r[1];if(1===r[1])return r[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.")}})),Ha="splitUnit",$a=Oe(Ha,["typed"],(e=>{var{typed:r}=e;return r(Ha,{"Unit, Array":function(e,r){return e.splitUnit(r)}})})),Ga="unaryMinus",Va=Oe(Ga,["typed"],(e=>{var{typed:r}=e;return r(Ga,{number:ri,"Complex | BigNumber | Fraction":e=>e.neg(),Unit:r.referToSelf((e=>t=>{var n=t.clone();return n.value=r.find(e,n.valueType())(t.value),n})),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0)))})})),Za="unaryPlus",Wa=Oe(Za,["typed","config","BigNumber"],(e=>{var{typed:r,config:t,BigNumber:n}=e;return r(Za,{number:ti,Complex:function(e){return e},BigNumber:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0))),"boolean | string":function(e){return"BigNumber"===t.number?new n(+e):+e}})})),Ya=Oe("abs",["typed"],(e=>{var{typed:r}=e;return r("abs",{number:Xn,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0)))})})),Ja="apply",Xa=Oe(Ja,["typed","isInteger"],(e=>{var{typed:r,isInteger:t}=e;return r(Ja,{"Array | Matrix, number | BigNumber, function":function(e,r,n){if(!t(r))throw new TypeError("Integer number expected for dimension");var i=Array.isArray(e)?an(e):e.size();if(r<0||r>=i.length)throw new nn(r,i.length);return p(e)?e.create(Qa(e.valueOf(),r,n)):Qa(e,r,n)}})}));function Qa(e,r,t){var n,i,a;if(r<=0){if(Array.isArray(e[0])){for(a=function(e){var r,t,n=e.length,i=e[0].length,a=[];for(t=0;t<i;t++){var o=[];for(r=0;r<n;r++)o.push(e[r][t]);a.push(o)}return a}(e),i=[],n=0;n<a.length;n++)i[n]=Qa(a[n],r-1,t);return i}return t(e)}for(i=[],n=0;n<e.length;n++)i[n]=Qa(e[n],r-1,t);return i}var Ka="addScalar",eo=Oe(Ka,["typed"],(e=>{var{typed:r}=e;return r(Ka,{"number, number":Qn,"Complex, Complex":function(e,r){return e.add(r)},"BigNumber, BigNumber":function(e,r){return e.plus(r)},"Fraction, Fraction":function(e,r){return e.add(r)},"Unit, Unit":r.referToSelf((e=>(t,n)=>{if(null===t.value||void 0===t.value)throw new Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw new Error("Units do not match");var i=t.clone();return i.value=r.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))})})),ro="subtractScalar",to=Oe(ro,["typed"],(e=>{var{typed:r}=e;return r(ro,{"number, number":Kn,"Complex, Complex":function(e,r){return e.sub(r)},"BigNumber, BigNumber":function(e,r){return e.minus(r)},"Fraction, Fraction":function(e,r){return e.sub(r)},"Unit, Unit":r.referToSelf((e=>(t,n)=>{if(null===t.value||void 0===t.value)throw new Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw new Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw new Error("Units do not match");var i=t.clone();return i.value=r.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))})})),no="cbrt",io=Oe(no,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],(e=>{var{config:r,typed:t,isNegative:n,unaryMinus:i,matrix:a,Complex:l,BigNumber:c,Fraction:f}=e;return t(no,{number:ni,Complex:p,"Complex, boolean":p,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&s(e.value)){var r=e.clone();return r.value=1,(r=r.pow(1/3)).value=p(e.value),r}var t,a=n(e.value);a&&(e.value=i(e.value)),t=o(e.value)?new c(1).div(3):u(e.value)?new f(1,3):1/3;var l=e.pow(t);return a&&(l.value=i(l.value)),l}});function p(e,t){var n=e.arg()/3,i=e.abs(),o=new l(ni(i),0).mul(new l(0,n).exp());if(t){var s=[o,new l(ni(i),0).mul(new l(0,n+2*Math.PI/3).exp()),new l(ni(i),0).mul(new l(0,n-2*Math.PI/3).exp())];return"Array"===r.matrix?s:a(s)}return o}})),ao=Oe("matAlgo11xS0s",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,l=e._size,c=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=l[0],m=l[1],d=t,h=0,g=i;"string"==typeof c&&(f=c,d=r.find(t,[f,f]),h=r.convert(0,f),n=r.convert(n,f),g=r.find(i,[f,f]));for(var y=[],v=[],x=[],b=0;b<m;b++){x[b]=v.length;for(var w=u[b],N=u[b+1],D=w;D<N;D++){var E=s[D],A=a?g(n,o[D]):g(o[D],n);d(A,h)||(v.push(E),y.push(A))}}return x[m]=v.length,e.createSparseMatrix({values:y,index:v,ptr:x,size:[p,m],datatype:f})}})),oo=Oe("matAlgo12xSfs",["typed","DenseMatrix"],(e=>{var{typed:r,DenseMatrix:t}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,l=e._size,c=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=l[0],m=l[1],d=i;"string"==typeof c&&(f=c,n=r.convert(n,f),d=r.find(i,[f,f]));for(var h=[],g=[],y=[],v=0;v<m;v++){for(var x=v+1,b=u[v],w=u[v+1],N=b;N<w;N++){var D=s[N];g[D]=o[N],y[D]=x}for(var E=0;E<p;E++)0===v&&(h[E]=[]),y[E]===x?h[E][v]=a?d(n,g[E]):d(g[E],n):h[E][v]=a?d(n,0):d(0,n)}return new t({data:h,size:[p,m],datatype:f})}})),so=Oe("matAlgo14xDs",["typed"],(e=>{var{typed:r}=e;return function(e,n,i,a){var o,s=e._data,u=e._size,l=e._datatype,c=i;"string"==typeof l&&(o=l,n=r.convert(n,o),c=r.find(i,[o,o]));var f=u.length>0?t(c,0,u,u[0],s,n,a):[];return e.createDenseMatrix({data:f,size:V(u),datatype:o})};function t(e,r,n,i,a,o,s){var u=[];if(r===n.length-1)for(var l=0;l<i;l++)u[l]=s?e(o,a[l]):e(a[l],o);else for(var c=0;c<i;c++)u[c]=t(e,r+1,n,n[r+1],a[c],o,s);return u}})),uo="ceil",lo=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],co=Oe(uo,["typed","config","round"],(e=>{var{typed:r,config:t,round:n}=e;return r(uo,{number:function(e){return be(e,n(e),t.epsilon)?n(e):Math.ceil(e)},"number, number":function(e,r){if(be(e,n(e,r),t.epsilon))return n(e,r);var[i,a]="".concat(e,"e").split("e"),o=Math.ceil(Number("".concat(i,"e").concat(Number(a)+r)));return[i,a]="".concat(o,"e").split("e"),Number("".concat(i,"e").concat(Number(a)-r))}})})),fo=Oe(uo,lo,(e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=ao({typed:r,equalScalar:a}),l=oo({typed:r,DenseMatrix:s}),c=so({typed:r}),f=co({typed:r,config:t,round:n});return r("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,r){return e.ceil(r)},"Complex, BigNumber":function(e,r){return e.ceil(r.toNumber())},BigNumber:function(e){return Na(e,n(e),t.epsilon)?n(e):e.ceil()},"BigNumber, BigNumber":function(e,r){return Na(e,n(e,r),t.epsilon)?n(e,r):e.toDecimalPlaces(r.toNumber(),Bt.ROUND_CEIL)},Fraction:function(e){return e.ceil()},"Fraction, number":function(e,r){return e.ceil(r)},"Fraction, BigNumber":function(e,r){return e.ceil(r.toNumber())},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0))),"Array, number | BigNumber":r.referToSelf((e=>(r,t)=>Hn(r,(r=>e(r,t)),!0))),"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>u(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>c(r,t,e,!1))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf((e=>(r,t)=>c(i(t),r,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf((e=>(r,t)=>a(r,0)?o(t.size(),t.storage()):"dense"===t.storage()?c(t,r,e,!0):l(t,r,e,!0)))})})),po="cube",mo=Oe(po,["typed"],(e=>{var{typed:r}=e;return r(po,{number:ii,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})})),ho=Oe("exp",["typed"],(e=>{var{typed:r}=e;return r("exp",{number:ai,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),go="expm1",yo=Oe(go,["typed","Complex"],(e=>{var{typed:r,Complex:t}=e;return r(go,{number:oi,Complex:function(e){var r=Math.exp(e.re);return new t(r*Math.cos(e.im)-1,r*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),vo="fix",xo=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],bo=Oe(vo,["typed","ceil","floor"],(e=>{var{typed:r,ceil:t,floor:n}=e;return r(vo,{number:function(e){return e>0?n(e):t(e)},"number, number":function(e,r){return e>0?n(e,r):t(e,r)}})})),wo=Oe(vo,xo,(e=>{var{typed:r,Complex:t,matrix:n,ceil:i,floor:a,equalScalar:o,zeros:s,DenseMatrix:u}=e,l=oo({typed:r,DenseMatrix:u}),c=so({typed:r}),f=bo({typed:r,ceil:i,floor:a});return r("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new t(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,r){return new t(e.re>0?a(e.re,r):i(e.re,r),e.im>0?a(e.im,r):i(e.im,r))},"Complex, BigNumber":function(e,r){var n=r.toNumber();return new t(e.re>0?a(e.re,n):i(e.re,n),e.im>0?a(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):a(e)},"BigNumber, number | BigNumber":function(e,r){return e.isNegative()?i(e,r):a(e,r)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,r){return e.s<0?i(e,r):a(e,r)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0))),"Array | Matrix, number | BigNumber":r.referToSelf((e=>(r,t)=>Hn(r,(r=>e(r,t)),!0))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf((e=>(r,t)=>c(n(t),r,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf((e=>(r,t)=>o(r,0)?s(t.size(),t.storage()):"dense"===t.storage()?c(t,r,e,!0):l(t,r,e,!0)))})})),No="floor",Do=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Eo=Oe(No,["typed","config","round"],(e=>{var{typed:r,config:t,round:n}=e;return r(No,{number:function(e){return be(e,n(e),t.epsilon)?n(e):Math.floor(e)},"number, number":function(e,r){if(be(e,n(e,r),t.epsilon))return n(e,r);var[i,a]="".concat(e,"e").split("e"),o=Math.floor(Number("".concat(i,"e").concat(Number(a)+r)));return[i,a]="".concat(o,"e").split("e"),Number("".concat(i,"e").concat(Number(a)-r))}})})),Ao=Oe(No,Do,(e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}=e,u=ao({typed:r,equalScalar:a}),l=oo({typed:r,DenseMatrix:s}),c=so({typed:r}),f=Eo({typed:r,config:t,round:n});return r("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,r){return e.floor(r)},"Complex, BigNumber":function(e,r){return e.floor(r.toNumber())},BigNumber:function(e){return Na(e,n(e),t.epsilon)?n(e):e.floor()},"BigNumber, BigNumber":function(e,r){return Na(e,n(e,r),t.epsilon)?n(e,r):e.toDecimalPlaces(r.toNumber(),Bt.ROUND_FLOOR)},Fraction:function(e){return e.floor()},"Fraction, number":function(e,r){return e.floor(r)},"Fraction, BigNumber":function(e,r){return e.floor(r.toNumber())},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0))),"Array, number | BigNumber":r.referToSelf((e=>(r,t)=>Hn(r,(r=>e(r,t)),!0))),"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>u(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>c(r,t,e,!1))),"number | Complex | Fraction | BigNumber, Array":r.referToSelf((e=>(r,t)=>c(i(t),r,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":r.referToSelf((e=>(r,t)=>a(r,0)?o(t.size(),t.storage()):"dense"===t.storage()?c(t,r,e,!0):l(t,r,e,!0)))})})),So=Oe("matAlgo02xDS0",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i,a){var o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=n._values,c=n._index,f=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(s.length!==p.length)throw new tn(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!l)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var d,h=s[0],g=s[1],y=t,v=0,x=i;"string"==typeof u&&u===m&&"mixed"!==u&&(d=u,y=r.find(t,[d,d]),v=r.convert(0,d),x=r.find(i,[d,d]));for(var b=[],w=[],N=[],D=0;D<g;D++){N[D]=w.length;for(var E=f[D],A=f[D+1],S=E;S<A;S++){var C=c[S],M=a?x(l[S],o[C][D]):x(o[C][D],l[S]);y(M,v)||(w.push(C),b.push(M))}}return N[g]=w.length,n.createSparseMatrix({values:b,index:w,ptr:N,size:[h,g],datatype:u===e._datatype&&m===n._datatype?d:void 0})}})),Co=Oe("matAlgo03xDSf",["typed"],(e=>{var{typed:r}=e;return function(e,t,n,i){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),u=t._values,l=t._index,c=t._ptr,f=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(o.length!==f.length)throw new tn(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,d=o[0],h=o[1],g=0,y=n;"string"==typeof s&&s===p&&"mixed"!==s&&(m=s,g=r.convert(0,m),y=r.find(n,[m,m]));for(var v=[],x=0;x<d;x++)v[x]=[];for(var b=[],w=[],N=0;N<h;N++){for(var D=N+1,E=c[N],A=c[N+1],S=E;S<A;S++){var C=l[S];b[C]=i?y(u[S],a[C][N]):y(a[C][N],u[S]),w[C]=D}for(var M=0;M<d;M++)w[M]===D?v[M][N]=b[M]:v[M][N]=i?y(g,a[M][N]):y(a[M][N],g)}return e.createDenseMatrix({data:v,size:[d,h],datatype:s===e._datatype&&p===t._datatype?m:void 0})}})),Mo=Oe("matAlgo05xSfSf",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,l=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new tn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof l&&l===d&&"mixed"!==l&&(h=l,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));var w,N,D,E,A=a&&c?[]:void 0,S=[],C=[],M=A?[]:void 0,O=A?[]:void 0,T=[],F=[];for(N=0;N<y;N++){C[N]=S.length;var _=N+1;for(D=s[N],E=s[N+1];D<E;D++)w=o[D],S.push(w),T[w]=_,M&&(M[w]=a[D]);for(D=p[N],E=p[N+1];D<E;D++)T[w=f[D]]!==_&&S.push(w),F[w]=_,O&&(O[w]=c[D]);if(A)for(D=C[N];D<S.length;){var B=T[w=S[D]],I=F[w];if(B===_||I===_){var z=b(B===_?M[w]:x,I===_?O[w]:x);v(z,x)?S.splice(D,1):(A.push(z),D++)}}}return C[y]=S.length,e.createSparseMatrix({values:A,index:S,ptr:C,size:[g,y],datatype:l===e._datatype&&d===n._datatype?h:void 0})}})),Oo=Oe("matAlgo13xDD",["typed"],(e=>{var{typed:r}=e;return function(e,n,i){var a,o=e._data,s=e._size,u=e._datatype,l=n._data,c=n._size,f=n._datatype,p=[];if(s.length!==c.length)throw new tn(s.length,c.length);for(var m=0;m<s.length;m++){if(s[m]!==c[m])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+c+")");p[m]=s[m]}var d=i;"string"==typeof u&&u===f&&(a=u,d=r.find(i,[a,a]));var h=p.length>0?t(d,0,p,p[0],o,l):[];return e.createDenseMatrix({data:h,size:p,datatype:a})};function t(e,r,n,i,a,o){var s=[];if(r===n.length-1)for(var u=0;u<i;u++)s[u]=e(a[u],o[u]);else for(var l=0;l<i;l++)s[l]=t(e,r+1,n,n[r+1],a[l],o[l]);return s}})),To=Oe("broadcast",["concat"],(e=>{var{concat:r}=e;return function(e,r){var i=Math.max(e._size.length,r._size.length);if(e._size.length===r._size.length&&e._size.every(((e,t)=>e===r._size[t])))return[e,r];for(var a=t(e._size,i,0),o=t(r._size,i,0),s=[],u=0;u<i;u++)s[u]=Math.max(a[u],o[u]);_n(a,s),_n(o,s);var l=e.clone(),c=r.clone();l._size.length<i?l.reshape(t(l._size,i,1)):c._size.length<i&&c.reshape(t(c._size,i,1));for(var f=0;f<i;f++)l._size[f]<s[f]&&(l=n(l,s[f],f)),c._size[f]<s[f]&&(c=n(c,s[f],f));return[l,c]};function t(e,r,t){return[...Array(r-e.length).fill(t),...e]}function n(e,t,n){return r(...Array(t).fill(e),n)}})),Fo=Oe("matrixAlgorithmSuite",["typed","matrix","concat"],(e=>{var{typed:r,matrix:t,concat:n}=e,i=Oo({typed:r}),a=so({typed:r}),o=To({concat:n});return function(e){var n,s=e.elop,u=e.SD||e.DS;s?(n={"DenseMatrix, DenseMatrix":(e,r)=>i(...o(e,r),s),"Array, Array":(e,r)=>i(...o(t(e),t(r)),s).valueOf(),"Array, DenseMatrix":(e,r)=>i(...o(t(e),r),s),"DenseMatrix, Array":(e,r)=>i(...o(e,t(r)),s)},e.SS&&(n["SparseMatrix, SparseMatrix"]=(r,t)=>e.SS(...o(r,t),s,!1)),e.DS&&(n["DenseMatrix, SparseMatrix"]=(r,t)=>e.DS(...o(r,t),s,!1),n["Array, SparseMatrix"]=(r,n)=>e.DS(...o(t(r),n),s,!1)),u&&(n["SparseMatrix, DenseMatrix"]=(e,r)=>u(...o(r,e),s,!0),n["SparseMatrix, Array"]=(e,r)=>u(...o(t(r),e),s,!0))):(n={"DenseMatrix, DenseMatrix":r.referToSelf((e=>(r,t)=>i(...o(r,t),e))),"Array, Array":r.referToSelf((e=>(r,n)=>i(...o(t(r),t(n)),e).valueOf())),"Array, DenseMatrix":r.referToSelf((e=>(r,n)=>i(...o(t(r),n),e))),"DenseMatrix, Array":r.referToSelf((e=>(r,n)=>i(...o(r,t(n)),e)))},e.SS&&(n["SparseMatrix, SparseMatrix"]=r.referToSelf((r=>(t,n)=>e.SS(...o(t,n),r,!1)))),e.DS&&(n["DenseMatrix, SparseMatrix"]=r.referToSelf((r=>(t,n)=>e.DS(...o(t,n),r,!1))),n["Array, SparseMatrix"]=r.referToSelf((r=>(n,i)=>e.DS(...o(t(n),i),r,!1)))),u&&(n["SparseMatrix, DenseMatrix"]=r.referToSelf((e=>(r,t)=>u(...o(t,r),e,!0))),n["SparseMatrix, Array"]=r.referToSelf((e=>(r,n)=>u(...o(t(n),r),e,!0)))));var l=e.scalar||"any";(e.Ds||e.Ss)&&(s?(n["DenseMatrix,"+l]=(e,r)=>a(e,r,s,!1),n[l+", DenseMatrix"]=(e,r)=>a(r,e,s,!0),n["Array,"+l]=(e,r)=>a(t(e),r,s,!1).valueOf(),n[l+", Array"]=(e,r)=>a(t(r),e,s,!0).valueOf()):(n["DenseMatrix,"+l]=r.referToSelf((e=>(r,t)=>a(r,t,e,!1))),n[l+", DenseMatrix"]=r.referToSelf((e=>(r,t)=>a(t,r,e,!0))),n["Array,"+l]=r.referToSelf((e=>(r,n)=>a(t(r),n,e,!1).valueOf())),n[l+", Array"]=r.referToSelf((e=>(r,n)=>a(t(n),r,e,!0).valueOf()))));var c=void 0!==e.sS?e.sS:e.Ss;return s?(e.Ss&&(n["SparseMatrix,"+l]=(r,t)=>e.Ss(r,t,s,!1)),c&&(n[l+", SparseMatrix"]=(e,r)=>c(r,e,s,!0))):(e.Ss&&(n["SparseMatrix,"+l]=r.referToSelf((r=>(t,n)=>e.Ss(t,n,r,!1)))),c&&(n[l+", SparseMatrix"]=r.referToSelf((e=>(r,t)=>c(t,r,e,!0))))),s&&s.signatures&&Z(n,s.signatures),n}})),_o=Oe("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{var{typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s,concat:u}=e,l=Ao({typed:r,config:t,round:n,matrix:i,equalScalar:a,zeros:o,DenseMatrix:s}),c=So({typed:r,equalScalar:a}),f=Co({typed:r}),p=Mo({typed:r,equalScalar:a}),m=ao({typed:r,equalScalar:a}),d=oo({typed:r,DenseMatrix:s});return r("mod",{"number, number":function(e,r){return 0===r?e:e-r*l(e/r)},"BigNumber, BigNumber":function(e,r){return r.isZero()?e:e.sub(r.mul(l(e.div(r))))},"Fraction, Fraction":function(e,r){return r.equals(0)?e:e.sub(r.mul(l(e.div(r))))}},Fo({typed:r,matrix:i,concat:u})({SS:p,DS:f,SD:c,Ss:m,sS:d}))})),Bo=Oe("matAlgo01xDSid",["typed"],(e=>{var{typed:r}=e;return function(e,t,n,i){var a=e._data,o=e._size,s=e._datatype||e.getDataType(),u=t._values,l=t._index,c=t._ptr,f=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(o.length!==f.length)throw new tn(o.length,f.length);if(o[0]!==f[0]||o[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m,d,h=o[0],g=o[1],y="string"==typeof s&&"mixed"!==s&&s===p?s:void 0,v=y?r.find(n,[y,y]):n,x=[];for(m=0;m<h;m++)x[m]=[];var b=[],w=[];for(d=0;d<g;d++){for(var N=d+1,D=c[d],E=c[d+1],A=D;A<E;A++)b[m=l[A]]=i?v(u[A],a[m][d]):v(a[m][d],u[A]),w[m]=N;for(m=0;m<h;m++)w[m]===N?x[m][d]=b[m]:x[m][d]=a[m][d]}return e.createDenseMatrix({data:x,size:[h,g],datatype:s===e._datatype&&p===t._datatype?y:void 0})}})),Io=Oe("matAlgo04xSidSid",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,l=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new tn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof l&&l===d&&"mixed"!==l&&(h=l,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));var w,N,D,E,A,S=a&&c?[]:void 0,C=[],M=[],O=a&&c?[]:void 0,T=a&&c?[]:void 0,F=[],_=[];for(N=0;N<y;N++){M[N]=C.length;var B=N+1;for(E=s[N],A=s[N+1],D=E;D<A;D++)w=o[D],C.push(w),F[w]=B,O&&(O[w]=a[D]);for(E=p[N],A=p[N+1],D=E;D<A;D++)if(F[w=f[D]]===B){if(O){var I=b(O[w],c[D]);v(I,x)?F[w]=null:O[w]=I}}else C.push(w),_[w]=B,T&&(T[w]=c[D]);if(O&&T)for(D=M[N];D<C.length;)F[w=C[D]]===B?(S[D]=O[w],D++):_[w]===B?(S[D]=T[w],D++):C.splice(D,1)}return M[y]=C.length,e.createSparseMatrix({values:S,index:C,ptr:M,size:[g,y],datatype:l===e._datatype&&d===n._datatype?h:void 0})}})),zo=Oe("matAlgo10xSids",["typed","DenseMatrix"],(e=>{var{typed:r,DenseMatrix:t}=e;return function(e,n,i,a){var o=e._values,s=e._index,u=e._ptr,l=e._size,c=e._datatype;if(!o)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var f,p=l[0],m=l[1],d=i;"string"==typeof c&&(f=c,n=r.convert(n,f),d=r.find(i,[f,f]));for(var h=[],g=[],y=[],v=0;v<m;v++){for(var x=v+1,b=u[v],w=u[v+1],N=b;N<w;N++){var D=s[N];g[D]=o[N],y[D]=x}for(var E=0;E<p;E++)0===v&&(h[E]=[]),y[E]===x?h[E][v]=a?d(n,g[E]):d(g[E],n):h[E][v]=n}return new t({data:h,size:[p,m],datatype:f})}}));function qo(e,r,t,n){if(!(this instanceof qo))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=r,this.min=t,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+r+" provided, "+t+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}qo.prototype=new Error,qo.prototype.constructor=Error,qo.prototype.name="ArgumentsError",qo.prototype.isArgumentsError=!0;var Ro=["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],ko="number | BigNumber | Fraction | Matrix | Array",Po="".concat(ko,", ").concat(ko,", ...").concat(ko);function Uo(e){return!e.some((e=>Array.isArray(e)))}var Lo=Oe("gcd",Ro,(e=>{var{typed:r,matrix:t,config:n,round:i,equalScalar:a,zeros:o,BigNumber:s,DenseMatrix:u,concat:l}=e,c=_o({typed:r,config:n,round:i,matrix:t,equalScalar:a,zeros:o,DenseMatrix:u,concat:l}),f=Bo({typed:r}),p=Io({typed:r,equalScalar:a}),m=zo({typed:r,DenseMatrix:u});return r("gcd",{"number, number":function(e,r){if(!ie(e)||!ie(r))throw new Error("Parameters in function gcd must be integer numbers");var t;for(;0!==r;)t=c(e,r),e=r,r=t;return e<0?-e:e},"BigNumber, BigNumber":function(e,r){if(!e.isInt()||!r.isInt())throw new Error("Parameters in function gcd must be integer numbers");var t=new s(0);for(;!r.isZero();){var n=c(e,r);e=r,r=n}return e.lt(t)?e.neg():e},"Fraction, Fraction":(e,r)=>e.gcd(r)},Fo({typed:r,matrix:t,concat:l})({SS:p,DS:f,Ss:m}),{[Po]:r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i})),Array:r.referToSelf((e=>r=>{if(1===r.length&&Array.isArray(r[0])&&Uo(r[0]))return e(...r[0]);if(Uo(r))return e(...r);throw new qo("gcd() supports only 1d matrices!")})),Matrix:r.referToSelf((e=>r=>e(r.toArray())))})})),jo=Oe("matAlgo06xS0S0",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=n._values,l=n._size,c=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(o.length!==l.length)throw new tn(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+")");var f,p=o[0],m=o[1],d=t,h=0,g=i;"string"==typeof s&&s===c&&"mixed"!==s&&(f=s,d=r.find(t,[f,f]),h=r.convert(0,f),g=r.find(i,[f,f]));for(var y=a&&u?[]:void 0,v=[],x=[],b=y?[]:void 0,w=[],N=[],D=0;D<m;D++){x[D]=v.length;var E=D+1;if(Vn(e,D,w,b,N,E,v,g),Vn(n,D,w,b,N,E,v,g),b)for(var A=x[D];A<v.length;){var S=v[A];if(N[S]===E){var C=b[S];d(C,h)?v.splice(A,1):(y.push(C),A++)}else v.splice(A,1)}else for(var M=x[D];M<v.length;){N[v[M]]!==E?v.splice(M,1):M++}}return x[m]=v.length,e.createSparseMatrix({values:y,index:v,ptr:x,size:[p,m],datatype:s===e._datatype&&c===n._datatype?f:void 0})}})),Ho=Oe("lcm",["typed","matrix","equalScalar","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,concat:i}=e,a=So({typed:r,equalScalar:n}),o=jo({typed:r,equalScalar:n}),s=ao({typed:r,equalScalar:n}),u=Fo({typed:r,matrix:t,concat:i}),l="number | BigNumber | Fraction | Matrix | Array",c={};return c["".concat(l,", ").concat(l,", ...").concat(l)]=r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i})),r("lcm",{"number, number":si,"BigNumber, BigNumber":function(e,r){if(!e.isInt()||!r.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(r.isZero())return r;var t=e.times(r);for(;!r.isZero();){var n=r;r=e.mod(n),e=n}return t.div(e).abs()},"Fraction, Fraction":(e,r)=>e.lcm(r)},u({SS:o,DS:a,Ss:s}),c)})),$o="log10",Go=Oe($o,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r($o,{number:function(e){return e>=0||t.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()||t.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Vo="log2",Zo=Oe(Vo,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(Vo,{number:function(e){return e>=0||t.predictable?li(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||t.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))});function i(e){var r=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(r):Math.log(r)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),Wo=Oe("multiplyScalar",["typed"],(e=>{var{typed:r}=e;return r("multiplyScalar",{"number, number":ei,"Complex, Complex":function(e,r){return e.mul(r)},"BigNumber, BigNumber":function(e,r){return e.times(r)},"Fraction, Fraction":function(e,r){return e.mul(r)},"number | Fraction | BigNumber | Complex, Unit":(e,r)=>r.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,r)=>e.multiply(r)})})),Yo="multiply",Jo=Oe(Yo,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:a,dot:o}=e,s=ao({typed:r,equalScalar:a}),u=so({typed:r});function l(e,r){switch(e.length){case 1:switch(r.length){case 1:if(e[0]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+r[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}break;case 2:switch(r.length){case 1:if(e[1]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+r[0]+")");break;case 2:if(e[1]!==r[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+r[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+r.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}function c(e,t){if("dense"!==t.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,t){var a,o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._data,c=t._size,f=t._datatype||t.getDataType(),p=s[0],m=c[1],d=n,h=i;u&&f&&u===f&&"string"==typeof u&&"mixed"!==u&&(a=u,d=r.find(n,[a,a]),h=r.find(i,[a,a]));for(var g=[],y=0;y<m;y++){for(var v=h(o[0],l[0][y]),x=1;x<p;x++)v=d(v,h(o[x],l[x][y]));g[y]=v}return e.createDenseMatrix({data:g,size:[m],datatype:u===e._datatype&&f===t._datatype?a:void 0})}(e,t)}var f=r("_multiplyMatrixVector",{"DenseMatrix, any":function(e,t){var a,o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._data,c=t._datatype||t.getDataType(),f=s[0],p=s[1],m=n,d=i;u&&c&&u===c&&"string"==typeof u&&"mixed"!==u&&(a=u,m=r.find(n,[a,a]),d=r.find(i,[a,a]));for(var h=[],g=0;g<f;g++){for(var y=o[g],v=d(y[0],l[0]),x=1;x<p;x++)v=m(v,d(y[x],l[x]));h[g]=v}return e.createDenseMatrix({data:h,size:[f],datatype:u===e._datatype&&c===t._datatype?a:void 0})},"SparseMatrix, any":function(e,t){var o=e._values,s=e._index,u=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!o)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var c,f=t._data,p=t._datatype||t.getDataType(),m=e._size[0],d=t._size[0],h=[],g=[],y=[],v=n,x=i,b=a,w=0;l&&p&&l===p&&"string"==typeof l&&"mixed"!==l&&(c=l,v=r.find(n,[c,c]),x=r.find(i,[c,c]),b=r.find(a,[c,c]),w=r.convert(0,c));var N=[],D=[];y[0]=0;for(var E=0;E<d;E++){var A=f[E];if(!b(A,w))for(var S=u[E],C=u[E+1],M=S;M<C;M++){var O=s[M];D[O]?N[O]=v(N[O],x(A,o[M])):(D[O]=!0,g.push(O),N[O]=x(A,o[M]))}}for(var T=g.length,F=0;F<T;F++){var _=g[F];h[F]=N[_]}return y[1]=g.length,e.createSparseMatrix({values:h,index:g,ptr:y,size:[m,1],datatype:l===e._datatype&&p===t._datatype?c:void 0})}}),m=r("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,t){var a,o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._data,c=t._size,f=t._datatype||t.getDataType(),p=s[0],m=s[1],d=c[1],h=n,g=i;u&&f&&u===f&&"string"==typeof u&&"mixed"!==u&&"mixed"!==u&&(a=u,h=r.find(n,[a,a]),g=r.find(i,[a,a]));for(var y=[],v=0;v<p;v++){var x=o[v];y[v]=[];for(var b=0;b<d;b++){for(var w=g(x[0],l[0][b]),N=1;N<m;N++)w=h(w,g(x[N],l[N][b]));y[v][b]=w}}return e.createDenseMatrix({data:y,size:[p,d],datatype:u===e._datatype&&f===t._datatype?a:void 0})},"DenseMatrix, SparseMatrix":function(e,t){var o=e._data,s=e._size,u=e._datatype||e.getDataType(),l=t._values,c=t._index,f=t._ptr,p=t._size,m=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!l)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var d,h=s[0],g=p[1],y=n,v=i,x=a,b=0;u&&m&&u===m&&"string"==typeof u&&"mixed"!==u&&(d=u,y=r.find(n,[d,d]),v=r.find(i,[d,d]),x=r.find(a,[d,d]),b=r.convert(0,d));for(var w=[],N=[],D=[],E=t.createSparseMatrix({values:w,index:N,ptr:D,size:[h,g],datatype:u===e._datatype&&m===t._datatype?d:void 0}),A=0;A<g;A++){D[A]=N.length;var S=f[A],C=f[A+1];if(C>S)for(var M=0,O=0;O<h;O++){for(var T=O+1,F=void 0,_=S;_<C;_++){var B=c[_];M!==T?(F=v(o[O][B],l[_]),M=T):F=y(F,v(o[O][B],l[_]))}M!==T||x(F,b)||(N.push(O),w.push(F))}}return D[g]=N.length,E},"SparseMatrix, DenseMatrix":function(e,t){var o=e._values,s=e._index,u=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!o)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var c,f=t._data,p=t._datatype||t.getDataType(),m=e._size[0],d=t._size[0],h=t._size[1],g=n,y=i,v=a,x=0;l&&p&&l===p&&"string"==typeof l&&"mixed"!==l&&(c=l,g=r.find(n,[c,c]),y=r.find(i,[c,c]),v=r.find(a,[c,c]),x=r.convert(0,c));for(var b=[],w=[],N=[],D=e.createSparseMatrix({values:b,index:w,ptr:N,size:[m,h],datatype:l===e._datatype&&p===t._datatype?c:void 0}),E=[],A=[],S=0;S<h;S++){N[S]=w.length;for(var C=S+1,M=0;M<d;M++){var O=f[M][S];if(!v(O,x))for(var T=u[M],F=u[M+1],_=T;_<F;_++){var B=s[_];A[B]!==C?(A[B]=C,w.push(B),E[B]=y(O,o[_])):E[B]=g(E[B],y(O,o[_]))}}for(var I=N[S],z=w.length,q=I;q<z;q++){var R=w[q];b[q]=E[R]}}return N[h]=w.length,D},"SparseMatrix, SparseMatrix":function(e,t){var a,o=e._values,s=e._index,u=e._ptr,l=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=t._values,f=t._index,p=t._ptr,m=t._datatype||void 0===t._data?t._datatype:t.getDataType(),d=e._size[0],h=t._size[1],g=o&&c,y=n,v=i;l&&m&&l===m&&"string"==typeof l&&"mixed"!==l&&(a=l,y=r.find(n,[a,a]),v=r.find(i,[a,a]));for(var x,b,w,N,D,E,A,S,C=g?[]:void 0,M=[],O=[],T=e.createSparseMatrix({values:C,index:M,ptr:O,size:[d,h],datatype:l===e._datatype&&m===t._datatype?a:void 0}),F=g?[]:void 0,_=[],B=0;B<h;B++){O[B]=M.length;var I=B+1;for(D=p[B],E=p[B+1],N=D;N<E;N++)if(S=f[N],g)for(b=u[S],w=u[S+1],x=b;x<w;x++)_[A=s[x]]!==I?(_[A]=I,M.push(A),F[A]=v(c[N],o[x])):F[A]=y(F[A],v(c[N],o[x]));else for(b=u[S],w=u[S+1],x=b;x<w;x++)_[A=s[x]]!==I&&(_[A]=I,M.push(A));if(g)for(var z=O[B],q=M.length,R=z;R<q;R++){var k=M[R];C[R]=F[k]}}return O[h]=M.length,T}});return r(Yo,i,{"Array, Array":r.referTo("Matrix, Matrix",(e=>(r,n)=>{l(an(r),an(n));var i=e(t(r),t(n));return p(i)?i.valueOf():i})),"Matrix, Matrix":function(e,r){var t=e.size(),n=r.size();return l(t,n),1===t.length?1===n.length?function(e,r,t){if(0===t)throw new Error("Cannot multiply two empty vectors");return o(e,r)}(e,r,t[0]):c(e,r):1===n.length?f(e,r):m(e,r)},"Matrix, Array":r.referTo("Matrix,Matrix",(e=>(r,n)=>e(r,t(n)))),"Array, Matrix":r.referToSelf((e=>(r,n)=>e(t(r,n.storage()),n))),"SparseMatrix, any":function(e,r){return s(e,r,i,!1)},"DenseMatrix, any":function(e,r){return u(e,r,i,!1)},"any, SparseMatrix":function(e,r){return s(r,e,i,!0)},"any, DenseMatrix":function(e,r){return u(r,e,i,!0)},"Array, any":function(e,r){return u(t(e),r,i,!1).valueOf()},"any, Array":function(e,r){return u(t(r),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i}))})})),Xo="nthRoot",Qo=Oe(Xo,["typed","matrix","equalScalar","BigNumber","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:i,concat:a}=e,o=Bo({typed:r}),s=So({typed:r,equalScalar:n}),u=jo({typed:r,equalScalar:n}),l=ao({typed:r,equalScalar:n}),c=Fo({typed:r,matrix:t,concat:a});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return r(Xo,{number:ci,"number, number":ci,BigNumber:e=>p(e,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:r.referTo("DenseMatrix,number",(e=>r=>e(t(r),2).valueOf())),DenseMatrix:r.referTo("DenseMatrix,number",(e=>r=>e(r,2))),SparseMatrix:r.referTo("SparseMatrix,number",(e=>r=>e(r,2))),"SparseMatrix, SparseMatrix":r.referToSelf((e=>(r,t)=>{if(1===t.density())return u(r,t,e);throw new Error("Root must be non-zero")})),"DenseMatrix, SparseMatrix":r.referToSelf((e=>(r,t)=>{if(1===t.density())return o(r,t,e,!1);throw new Error("Root must be non-zero")})),"Array, SparseMatrix":r.referTo("DenseMatrix,SparseMatrix",(e=>(r,n)=>e(t(r),n))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>{if(1===t.density())return l(t,r,e,!0);throw new Error("Root must be non-zero")}))},c({scalar:"number | BigNumber",SD:s,Ss:l,sS:!1}));function p(e,r){var t=i.precision,n=i.clone({precision:t+2}),a=new i(0),o=new n(1),s=r.isNegative();if(s&&(r=r.neg()),r.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!r.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return s?new n(1/0):0;if(!e.isFinite())return s?a:e;var u=e.abs().pow(o.div(r));return u=e.isNeg()?u.neg():u,new i((s?o.div(u):u).toPrecision(t))}})),Ko="sign",es=Oe(Ko,["typed","BigNumber","Fraction","complex"],(e=>{var{typed:r,BigNumber:t,complex:n,Fraction:i}=e;return r(Ko,{number:fi,Complex:function(e){return 0===e.im?n(fi(e.re)):e.sign()},BigNumber:function(e){return new t(e.cmp(0))},Fraction:function(e){return new i(e.s,1)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0))),Unit:r.referToSelf((e=>t=>{if(!t._isDerived()&&0!==t.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return r.find(e,t.valueType())(t.value)}))})})),rs=Oe("sqrt",["config","typed","Complex"],(e=>{var{config:r,typed:t,Complex:n}=e;return t("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||r.predictable?Math.sqrt(e):new n(e,0).sqrt()}})),ts="square",ns=Oe(ts,["typed"],(e=>{var{typed:r}=e;return r(ts,{number:pi,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)}})})),is="subtract",as=Oe(is,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,subtractScalar:i,unaryMinus:a,DenseMatrix:o,concat:s}=e,u=Bo({typed:r}),l=Co({typed:r}),c=Mo({typed:r,equalScalar:n}),f=zo({typed:r,DenseMatrix:o}),p=oo({typed:r,DenseMatrix:o}),m=Fo({typed:r,matrix:t,concat:s});return r(is,{"any, any":i},m({elop:i,SS:c,DS:u,SD:l,Ss:p,sS:f}))})),os="xgcd",ss=Oe(os,["typed","config","matrix","BigNumber"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r(os,{"number, number":function(e,r){var i=mi(e,r);return"Array"===t.matrix?i:n(i)},"BigNumber, BigNumber":function(e,r){var a,o,s,u,l=new i(0),c=new i(1),f=l,p=c,m=c,d=l;if(!e.isInt()||!r.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!r.isZero();)o=e.div(r).floor(),s=e.mod(r),a=f,f=p.minus(o.times(f)),p=a,a=m,m=d.minus(o.times(m)),d=a,e=r,r=s;u=e.lt(l)?[e.neg(),p.neg(),d.neg()]:[e,e.isZero()?0:p,d];return"Array"===t.matrix?u:n(u)}})})),us="invmod",ls=Oe(us,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(e=>{var{typed:r,config:t,BigNumber:n,xgcd:i,equal:a,smaller:o,mod:s,add:u,isInteger:l}=e;return r(us,{"number, number":c,"BigNumber, BigNumber":c});function c(e,r){if(!l(e)||!l(r))throw new Error("Parameters in function invmod must be integer numbers");if(e=s(e,r),a(r,0))throw new Error("Divisor must be non zero");var t=i(e,r);t=t.valueOf();var[c,f]=t;return a(c,n(1))?(f=s(f,r),o(f,n(0))&&(f=u(f,r)),f):NaN}})),cs=Oe("matAlgo09xS0Sf",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,l=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new tn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof l&&l===d&&"mixed"!==l&&(h=l,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));var w,N,D,E,A,S=a&&c?[]:void 0,C=[],M=[],O=S?[]:void 0,T=[];for(N=0;N<y;N++){M[N]=C.length;var F=N+1;if(O)for(E=p[N],A=p[N+1],D=E;D<A;D++)T[w=f[D]]=F,O[w]=c[D];for(E=s[N],A=s[N+1],D=E;D<A;D++)if(w=o[D],O){var _=T[w]===F?O[w]:x,B=b(a[D],_);v(B,x)||(C.push(w),S.push(B))}else C.push(w)}return M[y]=C.length,e.createSparseMatrix({values:S,index:C,ptr:M,size:[g,y],datatype:l===e._datatype&&d===n._datatype?h:void 0})}})),fs="dotMultiply",ps=Oe(fs,["typed","matrix","equalScalar","multiplyScalar","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,multiplyScalar:i,concat:a}=e,o=So({typed:r,equalScalar:n}),s=cs({typed:r,equalScalar:n}),u=ao({typed:r,equalScalar:n}),l=Fo({typed:r,matrix:t,concat:a});return r(fs,l({elop:i,SS:s,DS:o,Ss:u}))}));function ms(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitAnd");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero()||r.eq(-1)||e.eq(r))return e;if(r.isZero()||e.eq(-1))return r;if(!e.isFinite()||!r.isFinite()){if(!e.isFinite()&&!r.isFinite())return e.isNegative()===r.isNegative()?e:new t(0);if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r;if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e}return gs(e,r,(function(e,r){return e&r}))}function ds(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var r=e.constructor,t=r.precision;r.config({precision:1e9});var n=e.plus(new r(1));return n.s=-n.s||null,r.config({precision:t}),n}function hs(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitOr");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);var n=new t(-1);return e.isZero()||r.eq(n)||e.eq(r)?r:r.isZero()||e.eq(n)?e:e.isFinite()&&r.isFinite()?gs(e,r,(function(e,r){return e|r})):!e.isFinite()&&!e.isNegative()&&r.isNegative()||e.isNegative()&&!r.isNegative()&&!r.isFinite()?n:e.isNegative()&&r.isNegative()?e.isFinite()?e:r:e.isFinite()?r:e}function gs(e,r,t){var n,i,a,o,s,u=e.constructor,l=+(e.s<0),c=+(r.s<0);if(l){n=ys(ds(e));for(var f=0;f<n.length;++f)n[f]^=1}else n=ys(e);if(c){i=ys(ds(r));for(var p=0;p<i.length;++p)i[p]^=1}else i=ys(r);n.length<=i.length?(a=n,o=i,s=l):(a=i,o=n,s=c);var m=a.length,d=o.length,h=1^t(l,c),g=new u(1^h),y=new u(1),v=new u(2),x=u.precision;for(u.config({precision:1e9});m>0;)t(a[--m],o[--d])===h&&(g=g.plus(y)),y=y.times(v);for(;d>0;)t(s,o[--d])===h&&(g=g.plus(y)),y=y.times(v);return u.config({precision:x}),0===h&&(g.s=-g.s),g}function ys(e){for(var r=e.d,t=r[0]+"",n=1;n<r.length;++n){for(var i=r[n]+"",a=7-i.length;a--;)i="0"+i;t+=i}for(var o=t.length;"0"===t.charAt(o);)o--;var s=e.e,u=t.slice(0,o+1||1),l=u.length;if(s>0)if(++s>l)for(s-=l;s--;)u+="0";else s<l&&(u=u.slice(0,s)+"."+u.slice(s));for(var c=[0],f=0;f<u.length;){for(var p=c.length;p--;)c[p]*=10;c[0]+=parseInt(u.charAt(f++));for(var m=0;m<c.length;++m)c[m]>1&&(null!==c[m+1]&&void 0!==c[m+1]||(c[m+1]=0),c[m+1]+=c[m]>>1,c[m]&=1)}return c.reverse()}function vs(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function bitXor");var t=e.constructor;if(e.isNaN()||r.isNaN())return new t(NaN);if(e.isZero())return r;if(r.isZero())return e;if(e.eq(r))return new t(0);var n=new t(-1);return e.eq(n)?ds(r):r.eq(n)?ds(e):e.isFinite()&&r.isFinite()?gs(e,r,(function(e,r){return e^r})):e.isFinite()||r.isFinite()?new t(e.isNegative()===r.isNegative()?1/0:-1/0):n}function xs(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function leftShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:e.isFinite()||r.isFinite()?r.lt(55)?e.times(Math.pow(2,r.toNumber())+""):e.times(new t(2).pow(r)):new t(NaN)}function bs(e,r){if(e.isFinite()&&!e.isInteger()||r.isFinite()&&!r.isInteger())throw new Error("Integers expected in function rightArithShift");var t=e.constructor;return e.isNaN()||r.isNaN()||r.isNegative()&&!r.isZero()?new t(NaN):e.isZero()||r.isZero()?e:r.isFinite()?r.lt(55)?e.div(Math.pow(2,r.toNumber())+"").floor():e.div(new t(2).pow(r)).floor():e.isNegative()?new t(-1):e.isFinite()?new t(0):new t(NaN)}var ws="bitAnd",Ns=Oe(ws,["typed","matrix","equalScalar","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,concat:i}=e,a=So({typed:r,equalScalar:n}),o=jo({typed:r,equalScalar:n}),s=ao({typed:r,equalScalar:n}),u=Fo({typed:r,matrix:t,concat:i});return r(ws,{"number, number":yi,"BigNumber, BigNumber":ms},u({SS:o,DS:a,Ss:s}))})),Ds="bitNot",Es=Oe(Ds,["typed"],(e=>{var{typed:r}=e;return r(Ds,{number:vi,BigNumber:ds,"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),As="bitOr",Ss=Oe(As,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Bo({typed:r}),s=Io({typed:r,equalScalar:n}),u=zo({typed:r,DenseMatrix:i}),l=Fo({typed:r,matrix:t,concat:a});return r(As,{"number, number":xi,"BigNumber, BigNumber":hs},l({SS:s,DS:o,Ss:u}))})),Cs=Oe("matAlgo07xSSf",["typed","DenseMatrix"],(e=>{var{typed:r,DenseMatrix:t}=e;return function(e,i,a){var o=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=i._size,l=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(o.length!==u.length)throw new tn(o.length,u.length);if(o[0]!==u[0]||o[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+u+")");var c,f,p,m=o[0],d=o[1],h=0,g=a;"string"==typeof s&&s===l&&"mixed"!==s&&(c=s,h=r.convert(0,c),g=r.find(a,[c,c]));var y=[];for(f=0;f<m;f++)y[f]=[];var v=[],x=[],b=[],w=[];for(p=0;p<d;p++){var N=p+1;for(n(e,p,b,v,N),n(i,p,w,x,N),f=0;f<m;f++){var D=b[f]===N?v[f]:h,E=w[f]===N?x[f]:h;y[f][p]=g(D,E)}}return new t({data:y,size:[m,d],datatype:s===e._datatype&&l===i._datatype?c:void 0})};function n(e,r,t,n,i){for(var a=e._values,o=e._index,s=e._ptr,u=s[r],l=s[r+1];u<l;u++){var c=o[u];t[c]=i,n[c]=a[u]}}})),Ms="bitXor",Os=Oe(Ms,["typed","matrix","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:i}=e,a=Co({typed:r}),o=Cs({typed:r,DenseMatrix:n}),s=oo({typed:r,DenseMatrix:n}),u=Fo({typed:r,matrix:t,concat:i});return r(Ms,{"number, number":bi,"BigNumber, BigNumber":vs},u({SS:o,DS:a,Ss:s}))})),Ts=Oe("arg",["typed"],(e=>{var{typed:r}=e;return r("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Fs="conj",_s=Oe(Fs,["typed"],(e=>{var{typed:r}=e;return r(Fs,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Bs=Oe("im",["typed"],(e=>{var{typed:r}=e;return r("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Is=Oe("re",["typed"],(e=>{var{typed:r}=e;return r("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),zs=Oe("not",["typed"],(e=>{var{typed:r}=e;return r("not",{"null | undefined":()=>!0,number:Ti,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},Unit:r.referToSelf((e=>t=>r.find(e,t.valueType())(t.value))),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),qs=Oe("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Co({typed:r}),s=Mo({typed:r,equalScalar:n}),u=oo({typed:r,DenseMatrix:i}),l=Fo({typed:r,matrix:t,concat:a});return r("or",{"number, number":Fi,"Complex, Complex":function(e,r){return 0!==e.re||0!==e.im||0!==r.re||0!==r.im},"BigNumber, BigNumber":function(e,r){return!e.isZero()&&!e.isNaN()||!r.isZero()&&!r.isNaN()},"Unit, Unit":r.referToSelf((e=>(r,t)=>e(r.value||0,t.value||0)))},l({SS:s,DS:o,Ss:u}))})),Rs=Oe("xor",["typed","matrix","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,DenseMatrix:n,concat:i}=e,a=Co({typed:r}),o=Cs({typed:r,DenseMatrix:n}),s=oo({typed:r,DenseMatrix:n}),u=Fo({typed:r,matrix:t,concat:i});return r("xor",{"number, number":_i,"Complex, Complex":function(e,r){return(0!==e.re||0!==e.im)!=(0!==r.re||0!==r.im)},"BigNumber, BigNumber":function(e,r){return(!e.isZero()&&!e.isNaN())!=(!r.isZero()&&!r.isNaN())},"Unit, Unit":r.referToSelf((e=>(r,t)=>e(r.value||0,t.value||0)))},u({SS:o,DS:a,Ss:s}))})),ks="concat",Ps=Oe(ks,["typed","matrix","isInteger"],(e=>{var{typed:r,matrix:t,isInteger:n}=e;return r(ks,{"...Array | Matrix | number | BigNumber":function(e){var r,i,s=e.length,u=-1,l=!1,c=[];for(r=0;r<s;r++){var f=e[r];if(p(f)&&(l=!0),a(f)||o(f)){if(r!==s-1)throw new Error("Dimension must be specified as last argument");if(i=u,u=f.valueOf(),!n(u))throw new TypeError("Integer number expected for dimension");if(u<0||r>0&&u>i)throw new nn(u,i+1)}else{var m=V(f).valueOf(),d=an(m);if(c[r]=m,i=u,u=d.length-1,r>0&&u!==i)throw new tn(i+1,u+1)}}if(0===c.length)throw new SyntaxError("At least one matrix expected");for(var h=c.shift();c.length;)h=Tn(h,c.shift(),u);return l?t(h):h},"...string":function(e){return e.join("")}})})),Us="column",Ls=Oe(Us,["typed","Index","matrix","range"],(e=>{var{typed:r,Index:t,matrix:n,range:i}=e;return r(Us,{"Matrix, number":a,"Array, number":function(e,r){return a(n(V(e)),r).valueOf()}});function a(e,r){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");ln(r,e.size()[1]);var a=i(0,e.size()[0]),o=new t(a,r),s=e.subset(o);return p(s)?s:n([[s]])}})),js="count",Hs=Oe(js,["typed","size","prod"],(e=>{var{typed:r,size:t,prod:n}=e;return r(js,{string:function(e){return e.length},"Matrix | Array":function(e){return n(t(e))}})})),$s="cross",Gs=Oe($s,["typed","matrix","subtract","multiply"],(e=>{var{typed:r,matrix:t,subtract:n,multiply:i}=e;return r($s,{"Matrix, Matrix":function(e,r){return t(a(e.toArray(),r.toArray()))},"Matrix, Array":function(e,r){return t(a(e.toArray(),r))},"Array, Matrix":function(e,r){return t(a(e,r.toArray()))},"Array, Array":a});function a(e,r){var t=Math.max(an(e).length,an(r).length);e=gn(e),r=gn(r);var a=an(e),o=an(r);if(1!==a.length||1!==o.length||3!==a[0]||3!==o[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+a.join(", ")+"], B = ["+o.join(", ")+"])");var s=[n(i(e[1],r[2]),i(e[2],r[1])),n(i(e[2],r[0]),i(e[0],r[2])),n(i(e[0],r[1]),i(e[1],r[0]))];return t>1?[s]:s}})),Vs="diag",Zs=Oe(Vs,["typed","matrix","DenseMatrix","SparseMatrix"],(e=>{var{typed:r,matrix:t,DenseMatrix:n,SparseMatrix:i}=e;return r(Vs,{Array:function(e){return a(e,0,an(e),null)},"Array, number":function(e,r){return a(e,r,an(e),null)},"Array, BigNumber":function(e,r){return a(e,r.toNumber(),an(e),null)},"Array, string":function(e,r){return a(e,0,an(e),r)},"Array, number, string":function(e,r,t){return a(e,r,an(e),t)},"Array, BigNumber, string":function(e,r,t){return a(e,r.toNumber(),an(e),t)},Matrix:function(e){return a(e,0,e.size(),e.storage())},"Matrix, number":function(e,r){return a(e,r,e.size(),e.storage())},"Matrix, BigNumber":function(e,r){return a(e,r.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,r){return a(e,0,e.size(),r)},"Matrix, number, string":function(e,r,t){return a(e,r,e.size(),t)},"Matrix, BigNumber, string":function(e,r,t){return a(e,r.toNumber(),e.size(),t)}});function a(e,r,a,o){if(!ie(r))throw new TypeError("Second parameter in function diag must be an integer");var s=r>0?r:0,u=r<0?-r:0;switch(a.length){case 1:return function(e,r,t,a,o,s){var u=[a+o,a+s];if(t&&"sparse"!==t&&"dense"!==t)throw new TypeError("Unknown matrix type ".concat(t,'"'));var l="sparse"===t?i.diagonal(u,e,r):n.diagonal(u,e,r);return null!==t?l:l.valueOf()}(e,r,o,a[0],u,s);case 2:return function(e,r,n,i,a,o){if(p(e)){var s=e.diagonal(r);return null!==n?n!==s.storage()?t(s,n):s:s.valueOf()}for(var u=Math.min(i[0]-a,i[1]-o),l=[],c=0;c<u;c++)l[c]=e[c+a][c+o];return null!==n?t(l):l}(e,r,o,a,u,s)}throw new RangeError("Matrix for function diag must be 2 dimensional")}}));function Ws(e,r,t,n,i){if(ne.isTypedFunction(e)){var a=[r,t,n],o=ne.resolve(e,a);if(o)return f(o.implementation,a);var s=[r,t],u=ne.resolve(e,s);if(u)return f(u.implementation,s);var l=[r],c=ne.resolve(e,l);return c?f(c.implementation,l):f(e,a)}return e(r,t,n);function f(a,o){try{return a.apply(a,o)}catch(a){var s;if(a instanceof TypeError&&"wrongType"===(null===(s=a.data)||void 0===s?void 0:s.category)){var u=[];throw u.push("value: ".concat(G(r))),o.length>=2&&u.push("index: ".concat(G(t))),o.length>=3&&u.push("array: ".concat(G(n))),new TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(e.name,"(").concat(u.join(", "),") at index ").concat(JSON.stringify(t)))}throw new TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(e.name,": ").concat(a.message))}}}var Ys=Oe("filter",["typed"],(e=>{var{typed:r}=e;return r("filter",{"Array, function":Js,"Matrix, function":function(e,r){return e.create(Js(e.toArray(),r))},"Array, RegExp":En,"Matrix, RegExp":function(e,r){return e.create(En(e.toArray(),r))}})}));function Js(e,r){return Dn(e,(function(e,t,n){return Ws(r,e,[t],n,"filter")}))}var Xs="flatten",Qs=Oe(Xs,["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return r(Xs,{Array:function(e){return bn(e)},Matrix:function(e){var r=bn(e.toArray());return t(r)}})})),Ks="forEach",eu=Oe(Ks,["typed"],(e=>{var{typed:r}=e;return r(Ks,{"Array, function":ru,"Matrix, function":function(e,r){e.forEach(r)}})}));function ru(e,r){!function t(n,i){if(!Array.isArray(n))return Ws(r,n,i,e,"forEach");Nn(n,(function(e,r){t(e,i.concat(r))}))}(e,[])}var tu="getMatrixDataType",nu=Oe(tu,["typed"],(e=>{var{typed:r}=e;return r(tu,{Array:function(e){return Mn(e,G)},Matrix:function(e){return e.getDataType()}})})),iu="identity",au=Oe(iu,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i,DenseMatrix:a,SparseMatrix:s}=e;return r(iu,{"":function(){return"Matrix"===t.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return l(e,e,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber, string":function(e,r){return l(e,e,r)},"number | BigNumber, number | BigNumber":function(e,r){return l(e,r,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,r,t){return l(e,r,t)},Array:function(e){return u(e)},"Array, string":function(e,r){return u(e,r)},Matrix:function(e){return u(e.valueOf(),e.storage())},"Matrix, string":function(e,r){return u(e.valueOf(),r)}});function u(e,r){switch(e.length){case 0:return r?n(r):[];case 1:return l(e[0],e[0],r);case 2:return l(e[0],e[1],r);default:throw new Error("Vector containing two values expected")}}function l(e,r,t){var n=o(e)||o(r)?i:null;if(o(e)&&(e=e.toNumber()),o(r)&&(r=r.toNumber()),!ie(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!ie(r)||r<1)throw new Error("Parameters in function identity must be positive integers");var u=n?new i(1):1,l=n?new n(0):0,c=[e,r];if(t){if("sparse"===t)return s.diagonal(c,u,0,l);if("dense"===t)return a.diagonal(c,u,0,l);throw new TypeError('Unknown matrix type "'.concat(t,'"'))}for(var f=fn([],c,l),p=e<r?e:r,m=0;m<p;m++)f[m][m]=u;return f}})),ou="kron",su=Oe(ou,["typed","matrix","multiplyScalar"],(e=>{var{typed:r,matrix:t,multiplyScalar:n}=e;return r(ou,{"Matrix, Matrix":function(e,r){return t(i(e.toArray(),r.toArray()))},"Matrix, Array":function(e,r){return t(i(e.toArray(),r))},"Array, Matrix":function(e,r){return t(i(e,r.toArray()))},"Array, Array":i});function i(e,r){if(1===an(e).length&&(e=[e]),1===an(r).length&&(r=[r]),an(e).length>2||an(r).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(r.length)+")");var t=[],i=[];return e.map((function(e){return r.map((function(r){return i=[],t.push(i),e.map((function(e){return r.map((function(r){return i.push(n(e,r))}))}))}))}))&&t}})),uu=Oe("map",["typed"],(e=>{var{typed:r}=e;return r("map",{"Array, function":lu,"Matrix, function":function(e,r){return e.map(r)}})}));function lu(e,r){return function t(n,i){return Array.isArray(n)?n.map((function(e,r){return t(e,i.concat(r))})):Ws(r,n,i,e,"map")}(e,[])}var cu="diff",fu=Oe(cu,["typed","matrix","subtract","number"],(e=>{var{typed:r,matrix:t,subtract:n,number:i}=e;return r(cu,{"Array | Matrix":function(e){return p(e)?t(o(e.toArray())):o(e)},"Array | Matrix, number":function(e,r){if(!ie(r))throw new RangeError("Dimension must be a whole number");return p(e)?t(a(e.toArray(),r)):a(e,r)},"Array, BigNumber":r.referTo("Array,number",(e=>(r,t)=>e(r,i(t)))),"Matrix, BigNumber":r.referTo("Matrix,number",(e=>(r,t)=>e(r,i(t))))});function a(e,r){if(p(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(r>0){var t=[];return e.forEach((e=>{t.push(a(e,r-1))})),t}if(0===r)return o(e);throw RangeError("Cannot have negative dimension")}function o(e){for(var r=[],t=e.length,n=1;n<t;n++)r.push(s(e[n-1],e[n]));return r}function s(e,r){p(e)&&(e=e.toArray()),p(r)&&(r=r.toArray());var t=Array.isArray(e),i=Array.isArray(r);if(t&&i)return function(e,r){if(e.length!==r.length)throw RangeError("Not all sub-arrays have the same length");for(var t=[],n=e.length,i=0;i<n;i++)t.push(s(e[i],r[i]));return t}(e,r);if(!t&&!i)return n(r,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}})),pu=Oe("ones",["typed","config","matrix","BigNumber"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r("ones",{"":function(){return"Array"===t.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var r=e.pop();return a(e,r)}return"Array"===t.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var r=e.storage();return a(e.valueOf(),r)},"Array | Matrix, string":function(e,r){return a(e.valueOf(),r)}});function a(e,r){var t=function(e){var r=!1;return e.forEach((function(e,t,n){o(e)&&(r=!0,n[t]=e.toNumber())})),r}(e),a=t?new i(1):1;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ie(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}))}(e),r){var s=n(r);return e.length>0?s.resize(e,a):s}var u=[];return e.length>0?fn(u,e,a):u}}));function mu(){throw new Error('No "bignumber" implementation available')}function du(){throw new Error('No "fraction" implementation available')}function hu(){throw new Error('No "matrix" implementation available')}var gu="range",yu=Oe(gu,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{var{typed:r,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u,add:l,isPositive:c}=e;return r(gu,{string:p,"string, boolean":p,"number, number":function(e,r){return f(m(e,r,1,!1))},"number, number, number":function(e,r,t){return f(m(e,r,t,!1))},"number, number, boolean":function(e,r,t){return f(m(e,r,1,t))},"number, number, number, boolean":function(e,r,t,n){return f(m(e,r,t,n))},"BigNumber, BigNumber":function(e,r){return f(m(e,r,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,r,t){return f(m(e,r,t,!1))},"BigNumber, BigNumber, boolean":function(e,r,t){return f(m(e,r,new(0,e.constructor)(1),t))},"BigNumber, BigNumber, BigNumber, boolean":function(e,r,t,n){return f(m(e,r,t,n))},"Unit, Unit, Unit":function(e,r,t){return f(m(e,r,t,!1))},"Unit, Unit, Unit, boolean":function(e,r,t,n){return f(m(e,r,t,n))}});function f(e){return"Matrix"===t.matrix?n?n(e):hu():e}function p(e,r){var n=function(e){var r=e.split(":"),t=r.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"===t.number?(void 0===i&&mu(),f(m(i(n.start),i(n.end),i(n.step)))):f(m(n.start,n.end,n.step,r))}function m(e,r,t,n){for(var i=[],f=c(t)?n?o:a:n?u:s,p=e;f(p,r);)i.push(p),p=l(p,t);return i}})),vu="reshape",xu=Oe(vu,["typed","isInteger","matrix"],(e=>{var{typed:r,isInteger:t}=e;return r(vu,{"Matrix, Array":function(e,r){return e.reshape(r,!0)},"Array, Array":function(e,r){return r.forEach((function(e){if(!t(e))throw new TypeError("Invalid size for dimension: "+e)})),mn(e,r)}})})),bu=Oe("resize",["config","matrix"],(e=>{var{config:r,matrix:t}=e;return function(e,n,i){if(2!==arguments.length&&3!==arguments.length)throw new qo("resize",arguments.length,2,3);if(p(n)&&(n=n.valueOf()),o(n[0])&&(n=n.map((function(e){return o(e)?e.toNumber():e}))),p(e))return e.resize(n,i,!0);if("string"==typeof e)return function(e,r,t){if(void 0!==t){if("string"!=typeof t||1!==t.length)throw new TypeError("Single character expected as defaultValue")}else t=" ";if(1!==r.length)throw new tn(r.length,1);var n=r[0];if("number"!=typeof n||!ie(n))throw new TypeError("Invalid size, must contain positive integers (size: "+Jt(r)+")");if(e.length>n)return e.substring(0,n);if(e.length<n){for(var i=e,a=0,o=n-e.length;a<o;a++)i+=t;return i}return e}(e,n,i);var a=!Array.isArray(e)&&"Array"!==r.matrix;if(0===n.length){for(;Array.isArray(e);)e=e[0];return V(e)}Array.isArray(e)||(e=[e]);var s=fn(e=V(e),n,i);return a?t(s):s}})),wu="rotate",Nu=Oe(wu,["typed","multiply","rotationMatrix"],(e=>{var{typed:r,multiply:t,rotationMatrix:n}=e;return r(wu,{"Array , number | BigNumber | Complex | Unit":function(e,r){return i(e,2),t(n(r),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,r){return i(e,2),t(n(r),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,r,a){return i(e,3),t(n(r,a),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,r,a){return i(e,3),t(n(r,a),e)}});function i(e,r){var t=Array.isArray(e)?an(e):e.size();if(t.length>2)throw new RangeError("Vector must be of dimensions 1x".concat(r));if(2===t.length&&1!==t[1])throw new RangeError("Vector must be of dimensions 1x".concat(r));if(t[0]!==r)throw new RangeError("Vector must be of dimensions 1x".concat(r))}})),Du="rotationMatrix",Eu=Oe(Du,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(e=>{var{typed:r,config:t,multiplyScalar:n,addScalar:i,unaryMinus:a,norm:s,BigNumber:u,matrix:l,DenseMatrix:c,SparseMatrix:f,cos:p,sin:m}=e;return r(Du,{"":function(){return"Matrix"===t.matrix?l([]):[]},string:function(e){return l(e)},"number | BigNumber | Complex | Unit":function(e){return d(e,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,r){return d(e,r)},"number | BigNumber | Complex | Unit, Array":function(e,r){var t=l(r);return h(t),v(e,t,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,r){h(r);var n=r.storage()||("Matrix"===t.matrix?"dense":void 0);return v(e,r,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,r,t){var n=l(r);return h(n),v(e,n,t)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,r,t){return h(r),v(e,r,t)}});function d(e,r){var t=o(e)?new u(-1):-1,i=p(e),a=m(e);return y([[i,n(t,a)],[a,i]],r)}function h(e){var r=e.size();if(r.length<1||3!==r[0])throw new RangeError("Vector must be of dimensions 1x3")}function g(e){return e.reduce(((e,r)=>n(e,r)))}function y(e,r){if(r){if("sparse"===r)return new f(e);if("dense"===r)return new c(e);throw new TypeError('Unknown matrix type "'.concat(r,'"'))}return e}function v(e,r,t){var n=s(r);if(0===n)throw new RangeError("Rotation around zero vector");var l=o(e)?u:null,c=l?new l(1):1,f=l?new l(-1):-1,d=l?new l(r.get([0])/n):r.get([0])/n,h=l?new l(r.get([1])/n):r.get([1])/n,v=l?new l(r.get([2])/n):r.get([2])/n,x=p(e),b=i(c,a(x)),w=m(e);return y([[i(x,g([d,d,b])),i(g([d,h,b]),g([f,v,w])),i(g([d,v,b]),g([h,w]))],[i(g([d,h,b]),g([v,w])),i(x,g([h,h,b])),i(g([h,v,b]),g([f,d,w]))],[i(g([d,v,b]),g([f,h,w])),i(g([h,v,b]),g([d,w])),i(x,g([v,v,b]))]],t)}})),Au=Oe("row",["typed","Index","matrix","range"],(e=>{var{typed:r,Index:t,matrix:n,range:i}=e;return r("row",{"Matrix, number":a,"Array, number":function(e,r){return a(n(V(e)),r).valueOf()}});function a(e,r){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");ln(r,e.size()[0]);var a=i(0,e.size()[1]),o=new t(r,a),s=e.subset(o);return p(s)?s:n([[s]])}})),Su="size",Cu=Oe(Su,["typed","config","?matrix"],(e=>{var{typed:r,config:t,matrix:n}=e;return r(Su,{Matrix:function(e){return e.create(e.size())},Array:an,string:function(e){return"Array"===t.matrix?[e.length]:n([e.length])},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===t.matrix?[]:n?n([]):hu()}})})),Mu="squeeze",Ou=Oe(Mu,["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return r(Mu,{Array:function(e){return gn(V(e))},Matrix:function(e){var r=gn(e.toArray());return Array.isArray(r)?t(r):r},any:function(e){return V(e)}})})),Tu="subset",Fu=Oe(Tu,["typed","matrix","zeros","add"],(e=>{var{typed:r,matrix:t,zeros:n,add:i}=e;return r(Tu,{"Matrix, Index":function(e,r){return cn(r)?t():(un(e,r),e.subset(r))},"Array, Index":r.referTo("Matrix, Index",(function(e){return function(r,n){var i=e(t(r),n);return n.isScalar()?i:i.valueOf()}})),"Object, Index":Iu,"string, Index":_u,"Matrix, Index, any, any":function(e,r,t,a){return cn(r)?e:(un(e,r),e.clone().subset(r,function(e,r){if("string"==typeof e)throw new Error("can't boradcast a string");if(r._isScalar)return e;var t=r.size();if(!t.every((e=>e>0)))return e;try{return i(e,n(t))}catch(r){return e}}(t,r),a))},"Array, Index, any, any":r.referTo("Matrix, Index, any, any",(function(e){return function(r,n,i,a){var o=e(t(r),n,i,a);return o.isMatrix?o.valueOf():o}})),"Array, Index, any":r.referTo("Matrix, Index, any, any",(function(e){return function(r,n,i){return e(t(r),n,i,void 0).valueOf()}})),"Matrix, Index, any":r.referTo("Matrix, Index, any, any",(function(e){return function(r,t,n){return e(r,t,n,void 0)}})),"string, Index, string":Bu,"string, Index, string, string":Bu,"Object, Index, any":zu})}));function _u(e,r){if(!y(r))throw new TypeError("Index expected");if(cn(r))return"";if(un(Array.from(e),r),1!==r.size().length)throw new tn(r.size().length,1);var t=e.length;ln(r.min()[0],t),ln(r.max()[0],t);var n=r.dimension(0),i="";return n.forEach((function(r){i+=e.charAt(r)})),i}function Bu(e,r,t,n){if(!r||!0!==r.isIndex)throw new TypeError("Index expected");if(cn(r))return e;if(un(Array.from(e),r),1!==r.size().length)throw new tn(r.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=r.dimension(0);if(i.size()[0]!==t.length)throw new tn(i.size()[0],t.length);var a=e.length;ln(r.min()[0]),ln(r.max()[0]);for(var o=[],s=0;s<a;s++)o[s]=e.charAt(s);if(i.forEach((function(e,r){o[e]=t.charAt(r[0])})),o.length>a)for(var u=a-1,l=o.length;u<l;u++)o[u]||(o[u]=n);return o.join("")}function Iu(e,r){if(!cn(r)){if(1!==r.size().length)throw new tn(r.size(),1);var t=r.dimension(0);if("string"!=typeof t)throw new TypeError("String expected as index to retrieve an object property");return Fe(e,t)}}function zu(e,r,t){if(cn(r))return e;if(1!==r.size().length)throw new tn(r.size(),1);var n=r.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");var i=V(e);return _e(i,n,t),i}var qu="transpose",Ru=Oe(qu,["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return r(qu,{Array:e=>n(t(e)).valueOf(),Matrix:n,any:V});function n(e){var r,t=e.size();switch(t.length){case 1:r=e.clone();break;case 2:var n=t[0],i=t[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+Jt(t)+")");switch(e.storage()){case"dense":r=function(e,r,t){for(var n,i=e._data,a=[],o=0;o<t;o++){n=a[o]=[];for(var s=0;s<r;s++)n[s]=V(i[s][o])}return e.createDenseMatrix({data:a,size:[t,r],datatype:e._datatype})}(e,n,i);break;case"sparse":r=function(e,r,t){for(var n,i,a,o=e._values,s=e._index,u=e._ptr,l=o?[]:void 0,c=[],f=[],p=[],m=0;m<r;m++)p[m]=0;for(n=0,i=s.length;n<i;n++)p[s[n]]++;for(var d=0,h=0;h<r;h++)f.push(d),d+=p[h],p[h]=f[h];for(f.push(d),a=0;a<t;a++)for(var g=u[a],y=u[a+1],v=g;v<y;v++){var x=p[s[v]]++;c[x]=a,o&&(l[x]=V(o[v]))}return e.createSparseMatrix({values:l,index:c,ptr:f,size:[t,r],datatype:e._datatype})}(e,n,i)}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+Jt(t)+")")}return r}})),ku="ctranspose",Pu=Oe(ku,["typed","transpose","conj"],(e=>{var{typed:r,transpose:t,conj:n}=e;return r(ku,{any:function(e){return n(t(e))}})})),Uu="zeros",Lu=Oe(Uu,["typed","config","matrix","BigNumber"],(e=>{var{typed:r,config:t,matrix:n,BigNumber:i}=e;return r(Uu,{"":function(){return"Array"===t.matrix?a([]):a([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){var r=e.pop();return a(e,r)}return"Array"===t.matrix?a(e):a(e,"default")},Array:a,Matrix:function(e){var r=e.storage();return a(e.valueOf(),r)},"Array | Matrix, string":function(e,r){return a(e.valueOf(),r)}});function a(e,r){var t=function(e){var r=!1;return e.forEach((function(e,t,n){o(e)&&(r=!0,n[t]=e.toNumber())})),r}(e),a=t?new i(0):0;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ie(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}))}(e),r){var s=n(r);return e.length>0?s.resize(e,a):s}var u=[];return e.length>0?fn(u,e,a):u}})),ju=Oe("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(e=>{var{typed:r,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:a,exp:o,tau:s,i:u,dotDivide:l,conj:c,pow:f,ceil:p,log2:m}=e;return r("fft",{Array:d,Matrix:function(e){return e.create(d(e.toArray()))}});function d(e){var r=an(e);return 1===r.length?g(e,r[0]):h(e.map((e=>d(e,r.slice(1)))),0)}function h(e,r){var t=an(e);if(0!==r)return new Array(t[0]).fill(0).map(((t,n)=>h(e[n],r-1)));if(1===t.length)return g(e);function n(e){var r=an(e);return new Array(r[1]).fill(0).map(((t,n)=>new Array(r[0]).fill(0).map(((r,t)=>e[t][n]))))}return n(h(n(e),1))}function g(e){var r=e.length;if(1===r)return[e[0]];if(r%2==0){for(var t=[...g(e.filter(((e,r)=>r%2==0))),...g(e.filter(((e,r)=>r%2==1)))],h=0;h<r/2;h++){var y=t[h],v=i(t[h+r/2],o(i(i(s,u),a(-h,r))));t[h]=n(y,v),t[h+r/2]=n(y,i(-1,v))}return t}return function(e){for(var r=e.length,t=o(a(i(-1,i(u,s)),r)),n=[],h=1-r;h<r;h++)n.push(f(t,a(f(h,2),2)));for(var y=f(2,p(m(r+r-1))),v=[...new Array(r).fill(0).map(((t,a)=>i(e[a],n[r-1+a]))),...new Array(y-r).fill(0)],x=[...new Array(r+r-1).fill(0).map(((e,r)=>a(1,n[r]))),...new Array(y-(r+r-1)).fill(0)],b=g(v),w=g(x),N=new Array(y).fill(0).map(((e,r)=>i(b[r],w[r]))),D=l(c(d(c(N))),y),E=[],A=r-1;A<r+r-1;A++)E.push(i(D[A],n[A]));return E}(e)}})),Hu="ifft",$u=Oe(Hu,["typed","fft","dotDivide","conj"],(e=>{var{typed:r,fft:t,dotDivide:n,conj:i}=e;return r(Hu,{"Array | Matrix":function(e){var r=p(e)?e.size():an(e);return n(i(t(i(e))),r.reduce(((e,r)=>e*r),1))}})})),Gu=t(36111);function Vu(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}var Zu=Oe("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],(e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:s,max:u,map:c,abs:f,isPositive:p,isNegative:m,larger:d,smaller:h,matrix:g,bignumber:y,unaryMinus:v}=e;function x(e){return function(r,a,g,x){if(!(2===a.length&&(a.every(D)||a.every(l))))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var b=a[0],w=a[1],N=d(w,b),E=x.firstStep;if(void 0!==E&&!p(E))throw new Error('"firstStep" must be positive');var A=x.maxStep;if(void 0!==A&&!p(A))throw new Error('"maxStep" must be positive');var S=x.minStep;if(S&&m(S))throw new Error('"minStep" must be positive or zero');var C=[b,w,E,S,A].filter((e=>void 0!==e));if(!C.every(D)&&!C.every(l))throw new Error('Inconsistent type of "t" dependant variables');for(var M=x.tol?x.tol:1e-4,O=x.minDelta?x.minDelta:.2,T=x.maxDelta?x.maxDelta:5,F=x.maxIter?x.maxIter:1e4,_=[b,w,...g,A,S].some(o),[B,I,z,q]=_?[y(e.a),y(e.c),y(e.b),y(e.bp)]:[e.a,e.c,e.b,e.bp],R=E?N?E:v(E):s(n(w,b),1),k=[b],P=[g],U=n(z,q),L=0,j=0,H=function(e){return e?h:d}(N),$=function(e){var r=e?d:h;return function(e,i,a){var o=t(e,a);return r(o,i)?n(i,e):a}}(N);H(k[L],w);){var G=[];R=$(k[L],w,R),G.push(r(k[L],P[L]));for(var V=1;V<I.length;++V)G.push(r(t(k[L],i(I[V],R)),t(P[L],i(R,B[V],G))));var Z=u(f(c(i(U,G),(e=>l(e)?e.value:e))));Z<M&&M/Z>1/4&&(k.push(t(k[L],R)),P.push(t(P[L],i(R,z,G))),L++);var W=.84*(M/Z)**.2;if(h(W,O)?W=O:d(W,T)&&(W=T),W=_?y(W):W,R=i(R,W),A&&d(f(R),A)?R=N?A:v(A):S&&h(f(R),S)&&(R=N?S:v(S)),++j>F)throw new Error("Maximum number of iterations reached, try changing options")}return{t:k,y:P}}}function b(e,r,t,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,r,t,n)}function w(e,r,t,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,r,t,n)}function N(e,r,t,n){var i=n.method?n.method:"RK45",a={RK23:b,RK45:w};if(i.toUpperCase()in a){var o=function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Vu(Object(t),!0).forEach((function(r){(0,Gu.A)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Vu(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}({},n);return delete o.method,a[i.toUpperCase()](e,r,t,o)}var s=Object.keys(a).map((e=>'"'.concat(e,'"'))),u="".concat(s.slice(0,-1).join(", ")," and ").concat(s.slice(-1));throw new Error('Unavailable method "'.concat(i,'". Available methods are ').concat(u))}function D(e){return o(e)||a(e)}function E(e,r,t,n){var i=N(e,r.toArray(),t.toArray(),n);return{t:g(i.t),y:g(i.y)}}return r("solveODE",{"function, Array, Array, Object":N,"function, Matrix, Matrix, Object":E,"function, Array, Array":(e,r,t)=>N(e,r,t,{}),"function, Matrix, Matrix":(e,r,t)=>E(e,r,t,{}),"function, Array, number | BigNumber | Unit":(e,r,t)=>{var n=N(e,r,[t],{});return{t:n.t,y:n.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit":(e,r,t)=>{var n=N(e,r.toArray(),[t],{});return{t:g(n.t),y:g(n.y.map((e=>e[0])))}},"function, Array, number | BigNumber | Unit, Object":(e,r,t,n)=>{var i=N(e,r,[t],n);return{t:i.t,y:i.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit, Object":(e,r,t,n)=>{var i=N(e,r.toArray(),[t],n);return{t:g(i.t),y:g(i.y.map((e=>e[0])))}}})})),Wu=Oe("erf",["typed"],(e=>{var{typed:r}=e;return r("name",{number:function(e){var r=Math.abs(e);return r>=Ku?ae(e):r<=Yu?ae(e)*function(e){var r,t=e*e,n=Xu[0][4]*t,i=t;for(r=0;r<3;r+=1)n=(n+Xu[0][r])*t,i=(i+Qu[0][r])*t;return e*(n+Xu[0][3])/(i+Qu[0][3])}(r):r<=4?ae(e)*(1-function(e){var r,t=Xu[1][8]*e,n=e;for(r=0;r<7;r+=1)t=(t+Xu[1][r])*e,n=(n+Qu[1][r])*e;var i=(t+Xu[1][7])/(n+Qu[1][7]),a=parseInt(16*e)/16,o=(e-a)*(e+a);return Math.exp(-a*a)*Math.exp(-o)*i}(r)):ae(e)*(1-function(e){var r,t=1/(e*e),n=Xu[2][5]*t,i=t;for(r=0;r<4;r+=1)n=(n+Xu[2][r])*t,i=(i+Qu[2][r])*t;var a=t*(n+Xu[2][4])/(i+Qu[2][4]);a=(Ju-a)/e,t=parseInt(16*e)/16;var o=(e-t)*(e+t);return Math.exp(-t*t)*Math.exp(-o)*a}(r))},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Yu=.46875,Ju=.5641895835477563,Xu=[[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]],Qu=[[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]],Ku=Math.pow(2,53),el="zeta",rl=Oe(el,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],(e=>{var{typed:r,config:t,multiply:n,pow:i,divide:a,factorial:o,equal:s,smallerEq:u,isNegative:l,gamma:c,sin:f,subtract:p,add:m,Complex:d,BigNumber:h,pi:g}=e;return r(el,{number:e=>y(e,(e=>e),(()=>20)),BigNumber:e=>y(e,(e=>new h(e)),(()=>Math.abs(Math.log10(t.epsilon)))),Complex:function(e){if(0===e.re&&0===e.im)return new d(-.5);if(1===e.re)return new d(NaN,NaN);if(e.re===1/0&&0===e.im)return new d(1);if(e.im===1/0||e.re===-1/0)return new d(NaN,NaN);return v(e,(e=>e),(e=>Math.round(19.5+.9*Math.abs(e.im))),(e=>e.re))}});function y(e,r,t){return s(e,0)?r(-.5):s(e,1)?r(NaN):isFinite(e)?v(e,r,t,(e=>e)):l(e)?r(NaN):r(1)}function v(e,r,t,o){var s=t(e);if(o(e)>-(s-1)/2)return function(e,r,t){for(var o=a(1,n(x(t(0),r),p(1,i(2,p(1,e))))),s=t(0),l=t(1);u(l,r);l=m(l,1))s=m(s,a(n((-1)**(l-1),x(l,r)),i(l,e)));return n(o,s)}(e,r(s),r);var l=n(i(2,e),i(r(g),p(e,1)));return l=n(l,f(n(a(r(g),2),e))),l=n(l,c(p(1,e))),n(l,v(p(1,e),r,t,o))}function x(e,r){for(var t=e,s=e;u(s,r);s=m(s,1)){var l=a(n(o(m(r,p(s,1))),i(4,s)),n(o(p(r,s)),o(n(2,s))));t=m(t,l)}return n(r,t)}})),tl="mode",nl=Oe(tl,["typed","isNaN","isNumeric"],(e=>{var{typed:r,isNaN:t,isNumeric:n}=e;return r(tl,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=bn(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var r={},i=[],a=0,o=0;o<e.length;o++){var s=e[o];if(n(s)&&t(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in r||(r[s]=0),r[s]++,r[s]===a?i.push(s):r[s]>a&&(a=r[s],i=[s])}return i}}));function il(e,r,t){var n;return String(e).includes("Unexpected type")?(n=arguments.length>2?" (type: "+G(t)+", value: "+JSON.stringify(t)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+r+", unexpected type of argument"+n)):String(e).includes("complex numbers")?(n=arguments.length>2?" (type: "+G(t)+", value: "+JSON.stringify(t)+")":"",new TypeError("Cannot calculate "+r+", no ordering relation is defined for complex numbers"+n)):e}var al="prod",ol=Oe(al,["typed","config","multiplyScalar","numeric"],(e=>{var{typed:r,config:t,multiplyScalar:n,numeric:i}=e;return r(al,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,r){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return a(e)}});function a(e){var r;if(jn(e,(function(e){try{r=void 0===r?e:n(r,e)}catch(r){throw il(r,"prod",e)}})),"string"==typeof r&&(r=i(r,t.number)),void 0===r)throw new Error("Cannot calculate prod of an empty array");return r}})),sl="format",ul=Oe(sl,["typed"],(e=>{var{typed:r}=e;return r(sl,{any:Jt,"any, Object | function | number | BigNumber":Jt})})),ll=Oe("bin",["typed","format"],(e=>{var{typed:r,format:t}=e;return r("bin",{"number | BigNumber":function(e){return t(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,r){return t(e,{notation:"bin",wordSize:r})}})})),cl=Oe("oct",["typed","format"],(e=>{var{typed:r,format:t}=e;return r("oct",{"number | BigNumber":function(e){return t(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,r){return t(e,{notation:"oct",wordSize:r})}})})),fl=Oe("hex",["typed","format"],(e=>{var{typed:r,format:t}=e;return r("hex",{"number | BigNumber":function(e){return t(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,r){return t(e,{notation:"hex",wordSize:r})}})})),pl=/\$([\w.]+)/g,ml="print",dl=Oe(ml,["typed"],(e=>{var{typed:r}=e;return r(ml,{"string, Object | Array":hl,"string, Object | Array, number | Object":hl})}));function hl(e,r,t){return e.replace(pl,(function(e,n){var i=n.split("."),a=r[i.shift()];for(void 0!==a&&a.isMatrix&&(a=a.toArray());i.length&&void 0!==a;){var o=i.shift();a=o?a[o]:a+"."}return void 0!==a?c(a)?a:Jt(a,t):e}))}var gl=Oe("to",["typed","matrix","concat"],(e=>{var{typed:r,matrix:t,concat:n}=e;return r("to",{"Unit, Unit | string":(e,r)=>e.to(r)},Fo({typed:r,matrix:t,concat:n})({Ds:!0}))})),yl="isPrime",vl=Oe(yl,["typed"],(e=>{var{typed:r}=e;return r(yl,{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 r=5;r*r<=e;r+=6)if(e%r==0||e%(r+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 r=e.toNumber(),t=5;t*t<=r;t+=6)if(r%t==0||r%(t+2)==0)return!1;return!0}function n(e,r,t){for(var n=1;!r.eq(0);)r.mod(2).eq(0)?(r=r.div(2),e=e.mul(e).mod(t)):(r=r.sub(1),n=e.mul(n).mod(t));return n}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 s=null;if(e.lt("3317044064679887385961981"))s=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((r=>r<e));else{var u=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));s=[];for(var l=2;l<=u;l+=1)s.push(u)}for(var c=0;c<s.length;c+=1){var f=s[c],p=n(e.sub(e).add(f),o,e);if(!p.eq(1))for(var m=0,d=p;!d.eq(e.sub(1));m+=1,d=d.mul(d).mod(e))if(m===a-1)return!1}return!0},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),xl=Oe("numeric",["number","?bignumber","?fraction"],(e=>{var{number:r,bignumber:t,fraction:n}=e,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},a={number:e=>r(e),BigNumber:t?e=>t(e):mu,Fraction:n?e=>n(e):du};return function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(arguments.length>2?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");var t=G(e);if(!(t in i))throw new TypeError("Cannot convert "+e+' of type "'+t+'"; valid input types are '+Object.keys(i).join(", "));if(!(r in a))throw new TypeError("Cannot convert "+e+' to type "'+r+'"; valid output types are '+Object.keys(a).join(", "));return r===t?e:a[r](e)}})),bl="divideScalar",wl=Oe(bl,["typed","numeric"],(e=>{var{typed:r,numeric:t}=e;return r(bl,{"number, number":function(e,r){return e/r},"Complex, Complex":function(e,r){return e.div(r)},"BigNumber, BigNumber":function(e,r){return e.div(r)},"Fraction, Fraction":function(e,r){return e.div(r)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,r)=>e.divide(r),"number | Fraction | Complex | BigNumber, Unit":(e,r)=>r.divideInto(e)})})),Nl=Oe("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(e=>{var{typed:r,config:t,identity:n,multiply:i,matrix:a,inv:o,number:s,fraction:u,Complex:l}=e;return r("pow",{"number, number":c,"Complex, Complex":function(e,r){return e.pow(r)},"BigNumber, BigNumber":function(e,r){return r.isInteger()||e>=0||t.predictable?e.pow(r):new l(e.toNumber(),0).pow(r.toNumber(),0)},"Fraction, Fraction":function(e,r){var n=e.pow(r);if(null!=n)return n;if(t.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return c(e.valueOf(),r.valueOf())},"Array, number":f,"Array, BigNumber":function(e,r){return f(e,r.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,r){return p(e,r.toNumber())},"Unit, number | BigNumber":function(e,r){return e.pow(r)}});function c(e,r){if(t.predictable&&!ie(r)&&e<0)try{var n=u(r),i=s(n);if((r===i||Math.abs((r-i)/r)<1e-14)&&n.d%2==1)return(n.n%2==0?1:-1)*Math.pow(-e,r)}catch(e){}return t.predictable&&(e<-1&&r===1/0||e>-1&&e<0&&r===-1/0)?NaN:ie(r)||e>=0||t.predictable?di(e,r):e*e<1&&r===1/0||e*e>1&&r===-1/0?0:new l(e,0).pow(r,0)}function f(e,r){if(!ie(r))throw new TypeError("For A^b, b must be an integer (value is "+r+")");var t=an(e);if(2!==t.length)throw new Error("For A^b, A must be 2 dimensional (A has "+t.length+" dimensions)");if(t[0]!==t[1])throw new Error("For A^b, A must be square (size is "+t[0]+"x"+t[1]+")");if(r<0)try{return f(o(e),-r)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+r+")");throw e}for(var a=n(t[0]).valueOf(),s=e;r>=1;)1&~r||(a=i(s,a)),r>>=1,s=i(s,s);return a}function p(e,r){return a(f(e.valueOf(),r))}})),Dl="Number of decimals in function round must be an integer",El="round",Al=Oe(El,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(e=>{var{typed:r,config:t,matrix:n,equalScalar:i,zeros:a,BigNumber:o,DenseMatrix:s}=e,u=ao({typed:r,equalScalar:i}),l=oo({typed:r,DenseMatrix:s}),c=so({typed:r});function f(e){return Math.abs(de(e).exponent)}return r(El,{number:function(e){var r=hi(e,f(t.epsilon));return hi(be(e,r,t.epsilon)?r:e)},"number, number":function(e,r){var n=f(t.epsilon);if(r>=n)return hi(e,r);var i=hi(e,n);return hi(be(e,i,t.epsilon)?i:e,r)},"number, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(Dl);return new o(e).toDecimalPlaces(r.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,r){if(r%1)throw new TypeError(Dl);return e.round(r)},"Complex, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(Dl);var t=r.toNumber();return e.round(t)},BigNumber:function(e){var r=new o(e).toDecimalPlaces(f(t.epsilon));return(Na(e,r,t.epsilon)?r:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(Dl);var n=f(t.epsilon);if(r>=n)return e.toDecimalPlaces(r.toNumber());var i=e.toDecimalPlaces(n);return(Na(e,i,t.epsilon)?i:e).toDecimalPlaces(r.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,r){if(r%1)throw new TypeError(Dl);return e.round(r)},"Fraction, BigNumber":function(e,r){if(!r.isInteger())throw new TypeError(Dl);return e.round(r.toNumber())},"Unit, number, Unit":r.referToSelf((e=>function(r,t,n){var i=r.toNumeric(n);return n.multiply(e(i,t))})),"Unit, BigNumber, Unit":r.referToSelf((e=>(r,t,n)=>e(r,t.toNumber(),n))),"Unit, Unit":r.referToSelf((e=>(r,t)=>e(r,0,t))),"Array | Matrix, number, Unit":r.referToSelf((e=>(r,t,n)=>Hn(r,(r=>e(r,t,n)),!0))),"Array | Matrix, BigNumber, Unit":r.referToSelf((e=>(r,t,n)=>e(r,t.toNumber(),n))),"Array | Matrix, Unit":r.referToSelf((e=>(r,t)=>e(r,0,t))),"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e,!0))),"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>u(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>c(r,t,e,!1))),"Array, number | BigNumber":r.referToSelf((e=>(r,t)=>c(n(r),t,e,!1).valueOf())),"number | Complex | BigNumber | Fraction, SparseMatrix":r.referToSelf((e=>(r,t)=>i(r,0)?a(t.size(),t.storage()):l(t,r,e,!0))),"number | Complex | BigNumber | Fraction, DenseMatrix":r.referToSelf((e=>(r,t)=>i(r,0)?a(t.size(),t.storage()):c(t,r,e,!0))),"number | Complex | BigNumber | Fraction, Array":r.referToSelf((e=>(r,t)=>c(n(t),r,e,!0).valueOf()))})})),Sl=Oe("log",["config","typed","divideScalar","Complex"],(e=>{var{typed:r,config:t,divideScalar:n,Complex:i}=e;return r("log",{number:function(e){return e>=0||t.predictable?function(e,r){return r?Math.log(e)/Math.log(r):Math.log(e)}(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.ln():new i(e.toNumber(),0).log()},"any, any":r.referToSelf((e=>(r,t)=>n(e(r),e(t))))})})),Cl="log1p",Ml=Oe(Cl,["typed","config","divideScalar","log","Complex"],(e=>{var{typed:r,config:t,divideScalar:n,log:i,Complex:a}=e;return r(Cl,{number:function(e){return e>=-1||t.predictable?ue(e):o(new a(e,0))},Complex:o,BigNumber:function(e){var r=e.plus(1);return!r.isNegative()||t.predictable?r.ln():o(new a(e.toNumber(),0))},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e))),"any, any":r.referToSelf((e=>(r,t)=>n(e(r),i(t))))});function o(e){var r=e.re+1;return new a(Math.log(Math.sqrt(r*r+e.im*e.im)),Math.atan2(e.im,r))}})),Ol="nthRoots",Tl=Oe(Ol,["config","typed","divideScalar","Complex"],(e=>{var{typed:r,config:t,divideScalar:n,Complex:i}=e,a=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function o(e,r){if(r<0)throw new Error("Root must be greater than zero");if(0===r)throw new Error("Root must be non-zero");if(r%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];var t,n="number"==typeof e;(n||0===e.re||0===e.im)&&(t=n?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);for(var o=e.arg(),s=e.abs(),u=[],l=Math.pow(s,1/r),c=0;c<r;c++){var f=(t+4*c)/r;f!==Math.round(f)?u.push(new i({r:l,phi:(o+2*Math.PI*c)/r})):u.push(a[f%4](l))}return u}return r(Ol,{Complex:function(e){return o(e,2)},"Complex, number":o})})),Fl="dotPow",_l=Oe(Fl,["typed","equalScalar","matrix","pow","DenseMatrix","concat"],(e=>{var{typed:r,equalScalar:t,matrix:n,pow:i,DenseMatrix:a,concat:o}=e,s=Co({typed:r}),u=Cs({typed:r,DenseMatrix:a}),l=ao({typed:r,equalScalar:t}),c=oo({typed:r,DenseMatrix:a}),f=Fo({typed:r,matrix:n,concat:o}),p={};for(var m in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,m)&&(m.includes("Matrix")||m.includes("Array")||(p[m]=i.signatures[m]));var d=r(p);return r(Fl,f({elop:d,SS:u,DS:s,Ss:l,sS:c}))})),Bl="dotDivide",Il=Oe(Bl,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:a,concat:o}=e,s=So({typed:r,equalScalar:n}),u=Co({typed:r}),l=Cs({typed:r,DenseMatrix:a}),c=ao({typed:r,equalScalar:n}),f=oo({typed:r,DenseMatrix:a}),p=Fo({typed:r,matrix:t,concat:o});return r(Bl,p({elop:i,SS:l,DS:u,SD:s,Ss:c,sS:f}))}));function zl(e){var{DenseMatrix:r}=e;return function(e,t,n){var i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+Jt(i)+")");var a=i[0];if(a!==i[1])throw new RangeError("Matrix must be square (size: "+Jt(i)+")");var o=[];if(p(t)){var s=t.size(),u=t._data;if(1===s.length){if(s[0]!==a)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var l=0;l<a;l++)o[l]=[u[l]];return new r({data:o,size:[a,1],datatype:t._datatype})}if(2===s.length){if(s[0]!==a||1!==s[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(d(t)){if(n){o=[];for(var c=0;c<a;c++)o[c]=[u[c][0]];return new r({data:o,size:[a,1],datatype:t._datatype})}return t}if(h(t)){for(var m=0;m<a;m++)o[m]=[0];for(var g=t._values,y=t._index,v=t._ptr,x=v[1],b=v[0];b<x;b++){o[y[b]][0]=g[b]}return new r({data:o,size:[a,1],datatype:t._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(f(t)){var w=an(t);if(1===w.length){if(w[0]!==a)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var N=0;N<a;N++)o[N]=[t[N]];return new r({data:o,size:[a,1]})}if(2===w.length){if(w[0]!==a||1!==w[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var D=0;D<a;D++)o[D]=[t[D][0]];return new r({data:o,size:[a,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}var ql="lsolve",Rl=Oe(ql,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=zl({DenseMatrix:s});return r(ql,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=e._values,p=e._index,m=e._ptr,d=[],h=0;h<c;h++){var g=t[h][0]||0;if(o(g,0))d[h]=[0];else{for(var y=0,v=[],x=[],b=m[h],w=m[h+1],N=b;N<w;N++){var D=p[N];D===h?y=f[N]:D>h&&(v.push(f[N]),x.push(D))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var E=n(g,y),A=0,S=x.length;A<S;A++){var C=x[A];t[C]=[a(t[C][0]||0,i(E,v[A]))]}d[h]=[E]}}return new s({data:d,size:[l,1]})}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).valueOf()}});function l(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=[],p=e._data,m=0;m<c;m++){var d=t[m][0]||0,h=void 0;if(o(d,0))h=0;else{var g=p[m][m];if(o(g,0))throw new Error("Linear system cannot be solved since matrix is singular");h=n(d,g);for(var y=m+1;y<l;y++)t[y]=[a(t[y][0]||0,i(h,p[y][m]))]}f[m]=[h]}return new s({data:f,size:[l,1]})}})),kl="usolve",Pl=Oe(kl,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=zl({DenseMatrix:s});return r(kl,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=e._values,p=e._index,m=e._ptr,d=[],h=c-1;h>=0;h--){var g=t[h][0]||0;if(o(g,0))d[h]=[0];else{for(var y=0,v=[],x=[],b=m[h],w=m[h+1]-1;w>=b;w--){var N=p[w];N===h?y=f[w]:N<h&&(v.push(f[w]),x.push(N))}if(o(y,0))throw new Error("Linear system cannot be solved since matrix is singular");for(var D=n(g,y),E=0,A=x.length;E<A;E++){var S=x[E];t[S]=[a(t[S][0],i(D,v[E]))]}d[h]=[D]}}return new s({data:d,size:[l,1]})}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).valueOf()}});function l(e,r){for(var t=(r=u(e,r,!0))._data,l=e._size[0],c=e._size[1],f=[],p=e._data,m=c-1;m>=0;m--){var d=t[m][0]||0,h=void 0;if(o(d,0))h=0;else{var g=p[m][m];if(o(g,0))throw new Error("Linear system cannot be solved since matrix is singular");h=n(d,g);for(var y=m-1;y>=0;y--)t[y]=[a(t[y][0]||0,i(h,p[y][m]))]}f[m]=[h]}return new s({data:f,size:[l,1]})}})),Ul="lsolveAll",Ll=Oe(Ul,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=zl({DenseMatrix:s});return r(Ul,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],l=e._size[0],c=e._size[1],f=e._values,p=e._index,m=e._ptr,d=0;d<c;d++)for(var h=t.length,g=0;g<h;g++){for(var y=t[g],v=[],x=[],b=m[d],w=m[d+1],N=0,D=b;D<w;D++){var E=p[D];E===d?N=f[D]:E>d&&(v.push(f[D]),x.push(E))}if(o(N,0))if(o(y[d],0)){if(0===g){var A=[...y];A[d]=1;for(var S=0,C=x.length;S<C;S++){var M=x[S];A[M]=a(A[M],v[S])}t.push(A)}}else{if(0===g)return[];t.splice(g,1),g-=1,h-=1}else{y[d]=n(y[d],N);for(var O=0,T=x.length;O<T;O++){var F=x[O];y[F]=a(y[F],i(y[d],v[O]))}}}return t.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).map((e=>e.valueOf()))}});function l(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],l=e._data,c=e._size[0],f=e._size[1],p=0;p<f;p++)for(var m=t.length,d=0;d<m;d++){var h=t[d];if(o(l[p][p],0))if(o(h[p],0)){if(0===d){var g=[...h];g[p]=1;for(var y=p+1;y<f;y++)g[y]=a(g[y],l[y][p]);t.push(g)}}else{if(0===d)return[];t.splice(d,1),d-=1,m-=1}else{h[p]=n(h[p],l[p][p]);for(var v=p+1;v<f;v++)h[v]=a(h[v],i(h[p],l[v][p]))}}return t.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}})),jl="usolveAll",Hl=Oe(jl,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{var{typed:r,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:a,equalScalar:o,DenseMatrix:s}=e,u=zl({DenseMatrix:s});return r(jl,{"SparseMatrix, Array | Matrix":function(e,r){return function(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],l=e._size[0],c=e._size[1],f=e._values,p=e._index,m=e._ptr,d=c-1;d>=0;d--)for(var h=t.length,g=0;g<h;g++){for(var y=t[g],v=[],x=[],b=m[d],w=0,N=m[d+1]-1;N>=b;N--){var D=p[N];D===d?w=f[N]:D<d&&(v.push(f[N]),x.push(D))}if(o(w,0))if(o(y[d],0)){if(0===g){var E=[...y];E[d]=1;for(var A=0,S=x.length;A<S;A++){var C=x[A];E[C]=a(E[C],v[A])}t.push(E)}}else{if(0===g)return[];t.splice(g,1),g-=1,h-=1}else{y[d]=n(y[d],w);for(var M=0,O=x.length;M<O;M++){var T=x[M];y[T]=a(y[T],i(y[d],v[M]))}}}return t.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}(e,r)},"DenseMatrix, Array | Matrix":function(e,r){return l(e,r)},"Array, Array | Matrix":function(e,r){return l(t(e),r).map((e=>e.valueOf()))}});function l(e,r){for(var t=[u(e,r,!0)._data.map((e=>e[0]))],l=e._data,c=e._size[0],f=e._size[1]-1;f>=0;f--)for(var p=t.length,m=0;m<p;m++){var d=t[m];if(o(l[f][f],0))if(o(d[f],0)){if(0===m){var h=[...d];h[f]=1;for(var g=f-1;g>=0;g--)h[g]=a(h[g],l[g][f]);t.push(h)}}else{if(0===m)return[];t.splice(m,1),m-=1,p-=1}else{d[f]=n(d[f],l[f][f]);for(var y=f-1;y>=0;y--)d[y]=a(d[y],i(d[f],l[y][f]))}}return t.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}})),$l=Oe("matAlgo08xS0Sid",["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return function(e,n,i){var a=e._values,o=e._index,s=e._ptr,u=e._size,l=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=n._values,f=n._index,p=n._ptr,m=n._size,d=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new tn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!a||!c)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var h,g=u[0],y=u[1],v=t,x=0,b=i;"string"==typeof l&&l===d&&"mixed"!==l&&(h=l,v=r.find(t,[h,h]),x=r.convert(0,h),b=r.find(i,[h,h]));for(var w,N,D,E,A=[],S=[],C=[],M=[],O=[],T=0;T<y;T++){C[T]=S.length;var F=T+1;for(N=s[T],D=s[T+1],w=N;w<D;w++)O[E=o[w]]=F,M[E]=a[w],S.push(E);for(N=p[T],D=p[T+1],w=N;w<D;w++)O[E=f[w]]===F&&(M[E]=b(M[E],c[w]));for(w=C[T];w<S.length;){var _=M[E=S[w]];v(_,x)?S.splice(w,1):(A.push(_),w++)}}return C[y]=S.length,e.createSparseMatrix({values:A,index:S,ptr:C,size:[g,y],datatype:l===e._datatype&&d===n._datatype?h:void 0})}})),Gl=Oe("useMatrixForArrayScalar",["typed","matrix"],(e=>{var{typed:r,matrix:t}=e;return{"Array, number":r.referTo("DenseMatrix, number",(e=>(r,n)=>e(t(r),n).valueOf())),"Array, BigNumber":r.referTo("DenseMatrix, BigNumber",(e=>(r,n)=>e(t(r),n).valueOf())),"number, Array":r.referTo("number, DenseMatrix",(e=>(r,n)=>e(r,t(n)).valueOf())),"BigNumber, Array":r.referTo("BigNumber, DenseMatrix",(e=>(r,n)=>e(r,t(n)).valueOf()))}})),Vl="leftShift",Zl=Oe(Vl,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:r}),u=So({typed:r,equalScalar:n}),l=$l({typed:r,equalScalar:n}),c=zo({typed:r,DenseMatrix:a}),f=ao({typed:r,equalScalar:n}),p=so({typed:r}),m=Fo({typed:r,matrix:t,concat:o}),d=Gl({typed:r,matrix:t});return r(Vl,{"number, number":wi,"BigNumber, BigNumber":xs,"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():p(r,t,e,!1))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):c(t,r,e,!0))),"number | BigNumber, DenseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):p(t,r,e,!0)))},d,m({SS:l,DS:s,SD:u}))})),Wl="rightArithShift",Yl=Oe(Wl,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:r}),u=So({typed:r,equalScalar:n}),l=$l({typed:r,equalScalar:n}),c=zo({typed:r,DenseMatrix:a}),f=ao({typed:r,equalScalar:n}),p=so({typed:r}),m=Fo({typed:r,matrix:t,concat:o}),d=Gl({typed:r,matrix:t});return r(Wl,{"number, number":Ni,"BigNumber, BigNumber":bs,"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():p(r,t,e,!1))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):c(t,r,e,!0))),"number | BigNumber, DenseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):p(t,r,e,!0)))},d,m({SS:l,DS:s,SD:u}))})),Jl="rightLogShift",Xl=Oe(Jl,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,DenseMatrix:a,concat:o}=e,s=Bo({typed:r}),u=So({typed:r,equalScalar:n}),l=$l({typed:r,equalScalar:n}),c=zo({typed:r,DenseMatrix:a}),f=ao({typed:r,equalScalar:n}),p=so({typed:r}),m=Fo({typed:r,matrix:t,concat:o}),d=Gl({typed:r,matrix:t});return r(Jl,{"number, number":Di,"SparseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():f(r,t,e,!1))),"DenseMatrix, number | BigNumber":r.referToSelf((e=>(r,t)=>n(t,0)?r.clone():p(r,t,e,!1))),"number | BigNumber, SparseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):c(t,r,e,!0))),"number | BigNumber, DenseMatrix":r.referToSelf((e=>(r,t)=>n(r,0)?i(t.size(),t.storage()):p(t,r,e,!0)))},d,m({SS:l,DS:s,SD:u}))})),Ql=Oe("and",["typed","matrix","equalScalar","zeros","not","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=e,s=So({typed:r,equalScalar:n}),u=jo({typed:r,equalScalar:n}),l=ao({typed:r,equalScalar:n}),c=so({typed:r}),f=Fo({typed:r,matrix:t,concat:o});return r("and",{"number, number":Bi,"Complex, Complex":function(e,r){return!(0===e.re&&0===e.im||0===r.re&&0===r.im)},"BigNumber, BigNumber":function(e,r){return!(e.isZero()||r.isZero()||e.isNaN()||r.isNaN())},"Unit, Unit":r.referToSelf((e=>(r,t)=>e(r.value||0,t.value||0))),"SparseMatrix, any":r.referToSelf((e=>(r,t)=>a(t)?i(r.size(),r.storage()):l(r,t,e,!1))),"DenseMatrix, any":r.referToSelf((e=>(r,t)=>a(t)?i(r.size(),r.storage()):c(r,t,e,!1))),"any, SparseMatrix":r.referToSelf((e=>(r,t)=>a(r)?i(r.size(),r.storage()):l(t,r,e,!0))),"any, DenseMatrix":r.referToSelf((e=>(r,t)=>a(r)?i(r.size(),r.storage()):c(t,r,e,!0))),"Array, any":r.referToSelf((e=>(r,n)=>e(t(r),n).valueOf())),"any, Array":r.referToSelf((e=>(r,n)=>e(r,t(n)).valueOf()))},f({SS:u,DS:s}))})),Kl="compare",ec=Oe(Kl,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],(e=>{var{typed:r,config:t,equalScalar:n,matrix:i,BigNumber:a,Fraction:o,DenseMatrix:s,concat:u}=e,l=Co({typed:r}),c=Mo({typed:r,equalScalar:n}),f=oo({typed:r,DenseMatrix:s}),p=Fo({typed:r,matrix:i,concat:u}),m=Da({typed:r});return r(Kl,rc({typed:r,config:t}),{"boolean, boolean":function(e,r){return e===r?0:e>r?1:-1},"BigNumber, BigNumber":function(e,r){return Na(e,r,t.epsilon)?new a(0):new a(e.cmp(r))},"Fraction, Fraction":function(e,r){return new o(e.compare(r))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:c,DS:l,Ss:f}))})),rc=Oe(Kl,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(Kl,{"number, number":function(e,r){return be(e,r,t.epsilon)?0:e>r?1:-1}})})),tc=t(52794),nc="compareNatural",ic=Oe(nc,["typed","compare"],(e=>{var{typed:r,compare:t}=e,n=t.signatures["boolean,boolean"];return r(nc,{"any, any":function e(r,o){var s,u=G(r),l=G(o);if(!("number"!==u&&"BigNumber"!==u&&"Fraction"!==u||"number"!==l&&"BigNumber"!==l&&"Fraction"!==l))return"0"!==(s=t(r,o)).toString()?s>0?1:-1:tc(u,l);var c=["Array","DenseMatrix","SparseMatrix"];if(c.includes(u)||c.includes(l))return 0!==(s=i(e,r,o))?s:tc(u,l);if(u!==l)return tc(u,l);if("Complex"===u)return function(e,r){if(e.re>r.re)return 1;if(e.re<r.re)return-1;if(e.im>r.im)return 1;if(e.im<r.im)return-1;return 0}(r,o);if("Unit"===u)return r.equalBase(o)?e(r.value,o.value):a(e,r.formatUnits(),o.formatUnits());if("boolean"===u)return n(r,o);if("string"===u)return tc(r,o);if("Object"===u)return function(e,r,t){var n=Object.keys(r),i=Object.keys(t);n.sort(tc),i.sort(tc);var o=a(e,n,i);if(0!==o)return o;for(var s=0;s<n.length;s++){var u=e(r[n[s]],t[i[s]]);if(0!==u)return u}return 0}(e,r,o);if("null"===u)return 0;if("undefined"===u)return 0;throw new TypeError('Unsupported type of value "'+u+'"')}});function i(e,r,t){return h(r)&&h(t)?a(e,r.toJSON().values,t.toJSON().values):h(r)?i(e,r.toArray(),t):h(t)?i(e,r,t.toArray()):d(r)?i(e,r.toJSON().data,t):d(t)?i(e,r,t.toJSON().data):Array.isArray(r)?Array.isArray(t)?a(e,r,t):i(e,r,[t]):i(e,[r],t)}function a(e,r,t){for(var n=0,i=Math.min(r.length,t.length);n<i;n++){var a=e(r[n],t[n]);if(0!==a)return a}return r.length>t.length?1:r.length<t.length?-1:0}}));var ac="compareText",oc=["typed","matrix","concat"];rn.signature="any, any";var sc=Oe(ac,oc,(e=>{var{typed:r,matrix:t,concat:n}=e,i=Fo({typed:r,matrix:t,concat:n});return r(ac,rn,i({elop:rn,Ds:!0}))})),uc="equal",lc=Oe(uc,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Co({typed:r}),s=Cs({typed:r,DenseMatrix:i}),u=oo({typed:r,DenseMatrix:i}),l=Fo({typed:r,matrix:t,concat:a});return r(uc,cc({typed:r,equalScalar:n}),l({elop:n,SS:s,DS:o,Ss:u}))})),cc=Oe(uc,["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return r(uc,{"any, any":function(e,r){return null===e?null===r:null===r?null===e:void 0===e?void 0===r:void 0===r?void 0===e:t(e,r)}})})),fc="equalText",pc=Oe(fc,["typed","compareText","isZero"],(e=>{var{typed:r,compareText:t,isZero:n}=e;return r(fc,{"any, any":function(e,r){return n(t(e,r))}})})),mc="smaller",dc=Oe(mc,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Co({typed:r}),s=Cs({typed:r,DenseMatrix:i}),u=oo({typed:r,DenseMatrix:i}),l=Fo({typed:r,matrix:n,concat:a}),c=Da({typed:r});return r(mc,hc({typed:r,config:t}),{"boolean, boolean":(e,r)=>e<r,"BigNumber, BigNumber":function(e,r){return e.lt(r)&&!Na(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>-1===e.compare(r),"Complex, Complex":function(e,r){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:s,DS:o,Ss:u}))})),hc=Oe(mc,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(mc,{"number, number":function(e,r){return e<r&&!be(e,r,t.epsilon)}})})),gc="smallerEq",yc=Oe(gc,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Co({typed:r}),s=Cs({typed:r,DenseMatrix:i}),u=oo({typed:r,DenseMatrix:i}),l=Fo({typed:r,matrix:n,concat:a}),c=Da({typed:r});return r(gc,vc({typed:r,config:t}),{"boolean, boolean":(e,r)=>e<=r,"BigNumber, BigNumber":function(e,r){return e.lte(r)||Na(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>1!==e.compare(r),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:s,DS:o,Ss:u}))})),vc=Oe(gc,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(gc,{"number, number":function(e,r){return e<=r||be(e,r,t.epsilon)}})})),xc="larger",bc=Oe(xc,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Co({typed:r}),s=Cs({typed:r,DenseMatrix:i}),u=oo({typed:r,DenseMatrix:i}),l=Fo({typed:r,matrix:n,concat:a}),c=Da({typed:r});return r(xc,wc({typed:r,config:t}),{"boolean, boolean":(e,r)=>e>r,"BigNumber, BigNumber":function(e,r){return e.gt(r)&&!Na(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>1===e.compare(r),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:s,DS:o,Ss:u}))})),wc=Oe(xc,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(xc,{"number, number":function(e,r){return e>r&&!be(e,r,t.epsilon)}})})),Nc="largerEq",Dc=Oe(Nc,["typed","config","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,matrix:n,DenseMatrix:i,concat:a}=e,o=Co({typed:r}),s=Cs({typed:r,DenseMatrix:i}),u=oo({typed:r,DenseMatrix:i}),l=Fo({typed:r,matrix:n,concat:a}),c=Da({typed:r});return r(Nc,Ec({typed:r,config:t}),{"boolean, boolean":(e,r)=>e>=r,"BigNumber, BigNumber":function(e,r){return e.gte(r)||Na(e,r,t.epsilon)},"Fraction, Fraction":(e,r)=>-1!==e.compare(r),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},c,l({SS:s,DS:o,Ss:u}))})),Ec=Oe(Nc,["typed","config"],(e=>{var{typed:r,config:t}=e;return r(Nc,{"number, number":function(e,r){return e>=r||be(e,r,t.epsilon)}})})),Ac="deepEqual",Sc=Oe(Ac,["typed","equal"],(e=>{var{typed:r,equal:t}=e;return r(Ac,{"any, any":function(e,r){return n(e.valueOf(),r.valueOf())}});function n(e,r){if(Array.isArray(e)){if(Array.isArray(r)){var i=e.length;if(i!==r.length)return!1;for(var a=0;a<i;a++)if(!n(e[a],r[a]))return!1;return!0}return!1}return!Array.isArray(r)&&t(e,r)}})),Cc="unequal",Mc=Oe(Cc,["typed","config","equalScalar","matrix","DenseMatrix","concat"],(e=>{var{typed:r,config:t,equalScalar:n,matrix:i,DenseMatrix:a,concat:o}=e,s=Co({typed:r}),u=Cs({typed:r,DenseMatrix:a}),l=oo({typed:r,DenseMatrix:a}),c=Fo({typed:r,matrix:i,concat:o});return r(Cc,Oc({typed:r,equalScalar:n}),c({elop:function(e,r){return!n(e,r)},SS:u,DS:s,Ss:l}))})),Oc=Oe(Cc,["typed","equalScalar"],(e=>{var{typed:r,equalScalar:t}=e;return r(Cc,{"any, any":function(e,r){return null===e?null!==r:null===r?null!==e:void 0===e?void 0!==r:void 0===r?void 0!==e:!t(e,r)}})})),Tc="partitionSelect",Fc=Oe(Tc,["typed","isNumeric","isNaN","compare"],(e=>{var{typed:r,isNumeric:t,isNaN:n,compare:i}=e,a=i,o=(e,r)=>-i(e,r);return r(Tc,{"Array | Matrix, number":function(e,r){return s(e,r,a)},"Array | Matrix, number, string":function(e,r,t){if("asc"===t)return s(e,r,a);if("desc"===t)return s(e,r,o);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(e,r,t){if(!ie(r)||r<0)throw new Error("k must be a non-negative integer");if(p(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),r,t)}if(Array.isArray(e))return u(e,r,t)}function u(e,r,i){if(r>=e.length)throw new Error("k out of bounds");for(var a=0;a<e.length;a++)if(t(e[a])&&n(e[a]))return e[a];for(var o=0,s=e.length-1;o<s;){for(var u=o,l=s,c=e[Math.floor(Math.random()*(s-o+1))+o];u<l;)if(i(e[u],c)>=0){var f=e[l];e[l]=e[u],e[u]=f,--l}else++u;i(e[u],c)>0&&--u,r<=u?s=u:o=u+1}return e[r]}})),_c="sort",Bc=Oe(_c,["typed","matrix","compare","compareNatural"],(e=>{var{typed:r,matrix:t,compare:n,compareNatural:i}=e,a=n,o=(e,r)=>-n(e,r);return r(_c,{Array:function(e){return u(e),e.sort(a)},Matrix:function(e){return l(e),t(e.toArray().sort(a),e.storage())},"Array, function":function(e,r){return u(e),e.sort(r)},"Matrix, function":function(e,r){return l(e),t(e.toArray().sort(r),e.storage())},"Array, string":function(e,r){return u(e),e.sort(s(r))},"Matrix, string":function(e,r){return l(e),t(e.toArray().sort(s(r)),e.storage())}});function s(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 u(e){if(1!==an(e).length)throw new Error("One dimensional array expected")}function l(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),Ic=Oe("max",["typed","config","numeric","larger"],(e=>{var{typed:r,config:t,numeric:n,larger:i}=e;return r("max",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,r){return $n(e,r.valueOf(),a)},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function max");return o(e)}});function a(e,r){try{return i(e,r)?e:r}catch(e){throw il(e,"max",r)}}function o(e){var r;if(jn(e,(function(e){try{isNaN(e)&&"number"==typeof e?r=NaN:(void 0===r||i(e,r))&&(r=e)}catch(r){throw il(r,"max",e)}})),void 0===r)throw new Error("Cannot calculate max of an empty array");return"string"==typeof r&&(r=n(r,t.number)),r}})),zc=Oe("min",["typed","config","numeric","smaller"],(e=>{var{typed:r,config:t,numeric:n,smaller:i}=e;return r("min",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,r){return $n(e,r.valueOf(),a)},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function min");return o(e)}});function a(e,r){try{return i(e,r)?e:r}catch(e){throw il(e,"min",r)}}function o(e){var r;if(jn(e,(function(e){try{isNaN(e)&&"number"==typeof e?r=NaN:(void 0===r||i(e,r))&&(r=e)}catch(r){throw il(r,"min",e)}})),void 0===r)throw new Error("Cannot calculate min of an empty array");return"string"==typeof r&&(r=n(r,t.number)),r}})),qc=Oe("ImmutableDenseMatrix",["smaller","DenseMatrix"],(e=>{var{smaller:r,DenseMatrix:t}=e;function n(e,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!c(r))throw new Error("Invalid datatype: "+r);if(p(e)||f(e)){var i=new t(e,r);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(e&&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 ("+G(e)+")");this._data=[],this._size=[0],this._datatype=r,this._min=null,this._max=null}}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:var r=t.prototype.subset.call(this,e);return p(r)?new n({data:r._data,size:r._size,datatype:r._datatype}):r;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:V(this._data),size:V(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(t){(null===e||r(t,e))&&(e=t)})),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var e=null;this.forEach((function(t){(null===e||r(e,t))&&(e=t)})),this._max=null!==e?e:void 0}return this._max},n}),{isClass:!0}),Rc=Oe("Index",["ImmutableDenseMatrix","getMatrixDataType"],(e=>{var{ImmutableDenseMatrix:r,getMatrixDataType:t}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var r=0,a=arguments.length;r<a;r++){var o=arguments[r],s=f(o),u=p(o),l=null;if(g(o))this._dimensions.push(o),this._isScalar=!1;else if(s||u){var c=void 0;"boolean"===t(o)?(s&&(c=i(kc(o).valueOf())),u&&(c=i(kc(o._data).valueOf())),l=o.valueOf().length):c=i(o.valueOf()),this._dimensions.push(c);var m=c.size();1===m.length&&1===m[0]&&null===l||(this._isScalar=!1)}else if("number"==typeof o)this._dimensions.push(i([o]));else{if("string"!=typeof o)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(o)}this._sourceSize.push(l)}}function i(e){for(var t=0,n=e.length;t<n;t++)if("number"!=typeof e[t]||!ie(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new r(e)}return n.prototype.type="Index",n.prototype.isIndex=!0,n.prototype.clone=function(){var e=new n;return e._dimensions=V(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},n.create=function(e){var r=new n;return n.apply(r,e),r},n.prototype.size=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?1:n.size()[0]}return e},n.prototype.max=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?n:n.max()}return e},n.prototype.min=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e[r]="string"==typeof n?n:n.min()}return e},n.prototype.forEach=function(e){for(var r=0,t=this._dimensions.length;r<t;r++)e(this._dimensions[r],r,this)},n.prototype.dimension=function(e){return this._dimensions[e]||null},n.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];e.push("string"==typeof n?n:n.toArray())}return e},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var e=[],r=0,t=this._dimensions.length;r<t;r++){var n=this._dimensions[r];"string"==typeof n?e.push(JSON.stringify(n)):e.push(n.toString())}return"["+e.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},n.fromJSON=function(e){return n.create(e.dimensions)},n}),{isClass:!0});function kc(e){var r=[];return e.forEach(((e,t)=>{e&&r.push(t)})),r}var Pc=Oe("FibonacciHeap",["smaller","larger"],(e=>{var{smaller:r,larger:t}=e,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function a(e,r,t){r.left.right=r.right,r.right.left=r.left,t.degree--,t.child===r&&(t.child=r.right),0===t.degree&&(t.child=null),r.left=e,r.right=e.right,e.right=r,r.right.left=r,r.parent=null,r.mark=!1}function o(e,r){var t=r.parent;t&&(r.mark?(a(e,r,t),o(t)):r.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,t){var n={key:e,value:t,degree:0};if(this._minimum){var i=this._minimum;n.left=i,n.right=i.right,i.right=n,n.right.left=n,r(e,i.key)&&(this._minimum=n)}else n.left=n,n.right=n,this._minimum=n;return this._size++,n},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return 0===this._size},i.prototype.extractMinimum=function(){var e=this._minimum;if(null===e)return e;for(var i=this._minimum,a=e.degree,o=e.child;a>0;){var u=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=u,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,u=new Array(o),l=0,c=e;if(c)for(l++,c=c.right;c!==e;)l++,c=c.right;for(;l>0;){for(var f=c.degree,p=c.right;a=u[f];){if(t(c.key,a.key)){var m=a;a=c,c=m}s(a,c),u[f]=null,f++}u[f]=c,c=p,l--}e=null;for(var d=0;d<o;d++)(a=u[d])&&(e?(a.left.right=a.right,a.right.left=a.left,a.left=e,a.right=e.right,e.right=a,a.right.left=a,r(a.key,e.key)&&(e=a)):e=a);return e}(i=e.right,this._size),this._size--,this._minimum=i,e},i.prototype.remove=function(e){this._minimum=function(e,t,n){t.key=n;var i=t.parent;i&&r(t.key,i.key)&&(a(e,t,i),o(e,i));r(t.key,e.key)&&(e=t);return e}(this._minimum,e,-1),this.extractMinimum()};var s=function(e,r){e.left.right=e.right,e.right.left=e.left,e.parent=r,r.child?(e.left=r.child,e.right=r.child.right,r.child.right=e,e.right.left=e):(r.child=e,e.right=e,e.left=e),r.degree++,e.mark=!1};return i}),{isClass:!0}),Uc=Oe("Spa",["addScalar","equalScalar","FibonacciHeap"],(e=>{var{addScalar:r,equalScalar:t,FibonacciHeap:n}=e;function i(){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(e,r){if(this._values[e])this._values[e].value=r;else{var t=this._heap.insert(e,r);this._values[e]=t}},i.prototype.get=function(e){var r=this._values[e];return r?r.value:0},i.prototype.accumulate=function(e,t){var n=this._values[e];n?n.value=r(n.value,t):(n=this._heap.insert(e,t),this._values[e]=n)},i.prototype.forEach=function(e,r,n){var i=this._heap,a=this._values,o=[],s=i.extractMinimum();for(s&&o.push(s);s&&s.key<=r;)s.key>=e&&(t(s.value,0)||n(s.key,s.value,this)),(s=i.extractMinimum())&&o.push(s);for(var u=0;u<o.length;u++){var l=o[u];a[(s=i.insert(l.key,l.value)).key]=s}},i.prototype.swap=function(e,r){var t=this._values[e],n=this._values[r];if(!t&&n)t=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=t,this._values[r]=void 0;else if(t&&!n)n=this._heap.insert(r,t.value),this._heap.remove(t),this._values[r]=n,this._values[e]=void 0;else if(t&&n){var i=t.value;t.value=n.value,n.value=i}},i}),{isClass:!0}),Lc=zn((function(e){return new e(1).exp()}),{hasher:Gc}),jc=zn((function(e){return new e(1).plus(new e(5).sqrt()).div(2)}),{hasher:Gc}),Hc=zn((function(e){return e.acos(-1)}),{hasher:Gc}),$c=zn((function(e){return Hc(e).times(2)}),{hasher:Gc});function Gc(e){return e[0].precision}function Vc(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function Zc(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Vc(Object(t),!0).forEach((function(r){(0,Gu.A)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Vc(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var Wc=Oe("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],(e=>{var r,t,i,{on:a,config:o,addScalar:u,subtractScalar:c,multiplyScalar:f,divideScalar:p,pow:m,abs:d,fix:h,round:g,equal:y,isNumeric:v,format:x,number:b,Complex:w,BigNumber:N,Fraction:D}=e,E=b;function A(e,r){if(!(this instanceof A))throw new Error("Constructor must be called with the new operator");if(null!=e&&!v(e)&&!s(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===r)this.units=[],this.dimensions=q.map((e=>0));else if("string"==typeof r){var t=A.parse(r);this.units=t.units,this.dimensions=t.dimensions}else{if(!l(r)||null!==r.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=r.fixPrefix,this.skipAutomaticSimplification=r.skipAutomaticSimplification,this.dimensions=r.dimensions.slice(0),this.units=r.units.map((e=>(0,n.A)({},e)))}this.value=this._normalize(e)}function S(){for(;" "===i||"\t"===i;)M()}function C(e){return e>="0"&&e<="9"}function M(){t++,i=r.charAt(t)}function O(e){t=e,i=r.charAt(t)}function T(){var e="",r=t;if("+"===i?M():"-"===i&&(e+=i,M()),!function(e){return e>="0"&&e<="9"||"."===e}(i))return O(r),null;if("."===i){if(e+=i,M(),!C(i))return O(r),null}else{for(;C(i);)e+=i,M();"."===i&&(e+=i,M())}for(;C(i);)e+=i,M();if("E"===i||"e"===i){var n="",a=t;if(n+=i,M(),"+"!==i&&"-"!==i||(n+=i,M()),!C(i))return O(a),e;for(e+=n;C(i);)e+=i,M()}return e}function F(){for(var e="";C(i)||A.isValidAlpha(i);)e+=i,M();var r=e.charAt(0);return A.isValidAlpha(r)?e:null}function _(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,n){if(n=n||{},t=-1,i="","string"!=typeof(r=e))throw new TypeError("Invalid argument in Unit.parse, string expected");var a=new A;a.units=[];var s=1,u=!1;M(),S();var l=T(),c=null;if(l){if("BigNumber"===o.number)c=new N(l);else if("Fraction"===o.number)try{c=new D(l)}catch(e){c=parseFloat(l)}else c=parseFloat(l);S(),_("*")?(s=1,u=!0):_("/")&&(s=-1,u=!0)}for(var f=[],p=1;;){for(S();"("===i;)f.push(s),p*=s,s=1,M(),S();var m=void 0;if(!i)break;var d=i;if(null===(m=F()))throw new SyntaxError('Unexpected "'+d+'" in "'+r+'" at index '+t.toString());var h=B(m);if(null===h)throw new SyntaxError('Unit "'+m+'" not found.');var g=s*p;if(S(),_("^")){S();var y=T();if(null===y)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');g*=y}a.units.push({unit:h.unit,prefix:h.prefix,power:g});for(var v=0;v<q.length;v++)a.dimensions[v]+=(h.unit.dimensions[v]||0)*g;for(S();")"===i;){if(0===f.length)throw new SyntaxError('Unmatched ")" in "'+r+'" at index '+t.toString());p/=f.pop(),M(),S()}if(u=!1,_("*")?(s=1,u=!0):_("/")?(s=-1,u=!0):s=1,h.unit.base){var x=h.unit.base.key;H.auto[x]={unit:h.unit,prefix:h.prefix}}}if(S(),i)throw new SyntaxError('Could not parse: "'+e+'"');if(u)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==f.length)throw new SyntaxError('Unmatched "(" in "'+r+'"');if(0===a.units.length&&!n.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return a.value=void 0!==c?a._normalize(c):null,a},A.prototype.clone=function(){var e=new A;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=V(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var r=0;r<this.units.length;r++)for(var t in e.units[r]={},this.units[r])Y(this.units[r],t)&&(e.units[r][t]=this.units[r][t]);return e},A.prototype.valueType=function(){return G(this.value)},A.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||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 r=e,t=A._getNumberConverter(G(e)),n=0;n<this.units.length;n++){var i=t(this.units[n].unit.value),a=t(this.units[n].prefix.value),o=t(this.units[n].power);r=f(r,m(f(i,a),o))}return r},A.prototype._denormalize=function(e,r){if(null==e||0===this.units.length)return e;for(var t=e,n=A._getNumberConverter(G(e)),i=0;i<this.units.length;i++){var a=n(this.units[i].unit.value),o=n(this.units[i].prefix.value),s=n(this.units[i].power);t=p(t,m(f(a,o),s))}return t};var B=zn((e=>{if(Y(U,e)){var r=U[e];return{unit:r,prefix:r.prefixes[""]}}for(var t in U)if(Y(U,t)&&Yt(e,t)){var n=U[t],i=e.length-t.length,a=e.substring(0,i),o=Y(n.prefixes,a)?n.prefixes[a]:void 0;if(void 0!==o)return{unit:n,prefix:o}}return null}),{hasher:e=>e[0],limit:100});function I(e){return e.equalBase(R.NONE)&&null!==e.value&&!o.predictable?e.value:e}A.isValuelessUnit=function(e){return null!==B(e)},A.prototype.hasBase=function(e){if("string"==typeof e&&(e=R[e]),!e)return!1;for(var r=0;r<q.length;r++)if(Math.abs((this.dimensions[r]||0)-(e.dimensions[r]||0))>1e-12)return!1;return!0},A.prototype.equalBase=function(e){for(var r=0;r<q.length;r++)if(Math.abs((this.dimensions[r]||0)-(e.dimensions[r]||0))>1e-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 r=this.clone(),t=l(e)?e:new A(e),n=0;n<q.length;n++)r.dimensions[n]=(this.dimensions[n]||0)+(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var a=Zc({},t.units[i]);r.units.push(a)}if(null!==this.value||null!==t.value){var o=null===this.value?this._normalize(1):this.value,s=null===t.value?t._normalize(1):t.value;r.value=f(o,s)}else r.value=null;return l(e)&&(r.skipAutomaticSimplification=!1),I(r)},A.prototype.divideInto=function(e){return new A(e).divide(this)},A.prototype.divide=function(e){for(var r=this.clone(),t=l(e)?e:new A(e),n=0;n<q.length;n++)r.dimensions[n]=(this.dimensions[n]||0)-(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var a=Zc(Zc({},t.units[i]),{},{power:-t.units[i].power});r.units.push(a)}if(null!==this.value||null!==t.value){var o=null===this.value?this._normalize(1):this.value,s=null===t.value?t._normalize(1):t.value;r.value=p(o,s)}else r.value=null;return l(e)&&(r.skipAutomaticSimplification=!1),I(r)},A.prototype.pow=function(e){for(var r=this.clone(),t=0;t<q.length;t++)r.dimensions[t]=(this.dimensions[t]||0)*e;for(var n=0;n<r.units.length;n++)r.units[n].power*=e;return null!==r.value?r.value=m(r.value,e):r.value=null,r.skipAutomaticSimplification=!1,I(r)},A.prototype.abs=function(){var e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units.length||0===e.units[0].unit.offset)e.value=d(e.value);else{var r=e._numberConverter(),t=r(e.units[0].unit.value),n=r(e.units[0].unit.offset),i=f(t,n);e.value=c(d(u(e.value,i)),i)}for(var a in e.units)"VA"!==e.units[a].unit.name&&"VAR"!==e.units[a].unit.name||(e.units[a].unit=U.W);return e},A.prototype.to=function(e){var r,t=null===this.value?this._normalize(1):this.value;if("string"==typeof e)r=A.parse(e);else{if(!l(e))throw new Error("String or Unit expected as parameter");r=e.clone()}if(!this.equalBase(r))throw new Error("Units do not match ('".concat(r.toString(),"' != '").concat(this.toString(),"')"));if(null!==r.value)throw new Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||0===this.units.length||0===r.units.length||this.units[0].unit.offset===r.units[0].unit.offset)r.value=V(t);else{var n=A._getNumberConverter(G(t)),i=this.units[0].unit.value,a=this.units[0].unit.offset,o=f(i,a),s=r.units[0].unit.value,p=r.units[0].unit.offset,m=f(s,p);r.value=u(t,n(c(o,m)))}return r.fixPrefix=!0,r.skipAutomaticSimplification=!0,r},A.prototype.toNumber=function(e){return E(this.toNumeric(e))},A.prototype.toNumeric=function(e){var r;return(r=e?this.to(e):this.clone())._isDerived()||0===r.units.length?r._denormalize(r.value):r._denormalize(r.value,r.units[0].prefix.value)},A.prototype.toString=function(){return this.format()},A.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},A.fromJSON=function(e){var r,t=new A(e.value,null!==(r=e.unit)&&void 0!==r?r:void 0);return t.fixPrefix=e.fixPrefix||!1,t},A.prototype.valueOf=A.prototype.toString,A.prototype.simplify=function(){var e,r,t=this.clone(),n=[];for(var i in $)if(Y($,i)&&t.hasBase(R[i])){e=i;break}if("NONE"===e)t.units=[];else if(e&&Y($,e)&&(r=$[e]),r)t.units=[{unit:r.unit,prefix:r.prefix,power:1}];else{for(var a=!1,o=0;o<q.length;o++){var s=q[o];Math.abs(t.dimensions[o]||0)>1e-12&&(Y($,s)?n.push({unit:$[s].unit,prefix:$[s].prefix,power:t.dimensions[o]||0}):a=!0)}n.length<t.units.length&&!a&&(t.units=n)}return t},A.prototype.toSI=function(){for(var e=this.clone(),r=[],t=0;t<q.length;t++){var n=q[t];if(Math.abs(e.dimensions[t]||0)>1e-12){if(!Y(H.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");r.push({unit:H.si[n].unit,prefix:H.si[n].prefix,power:e.dimensions[t]||0})}}return e.units=r,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value?(e.value=null,this.to(e)):e},A.prototype.formatUnits=function(){for(var e="",r="",t=0,n=0,i=0;i<this.units.length;i++)this.units[i].power>0?(t++,e+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(e+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var a=0;a<this.units.length;a++)this.units[a].power<0&&(t>0?(r+=" "+this.units[a].prefix.name+this.units[a].unit.name,Math.abs(this.units[a].power+1)>1e-15&&(r+="^"+-this.units[a].power)):(r+=" "+this.units[a].prefix.name+this.units[a].unit.name,r+="^"+this.units[a].power));e=e.substr(1),r=r.substr(1),t>1&&n>0&&(e="("+e+")"),n>1&&t>0&&(r="("+r+")");var o=e;return t>0&&n>0&&(o+=" / "),o+=r},A.prototype.format=function(e){var r=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),t=!1;for(var n in void 0!==r.value&&null!==r.value&&s(r.value)&&(t=Math.abs(r.value.re)<1e-14),r.units)Y(r.units,n)&&r.units[n].unit&&("VA"===r.units[n].unit.name&&t?r.units[n].unit=U.VAR:"VAR"!==r.units[n].unit.name||t||(r.units[n].unit=U.VA));1!==r.units.length||r.fixPrefix||Math.abs(r.units[0].power-Math.round(r.units[0].power))<1e-14&&(r.units[0].prefix=r._bestPrefix());var i=r._denormalize(r.value),a=null!==r.value?x(i,e||{}):"",o=r.formatUnits();return r.value&&s(r.value)&&(a="("+a+")"),o.length>0&&a.length>0&&(a+=" "),a+=o},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?d(this.value):0,r=d(this.units[0].unit.value),t=this.units[0].prefix;if(0===e)return t;var n=this.units[0].power,i=Math.log(e/Math.pow(t.value*r,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return t;i=Math.abs(i);var a=this.units[0].unit.prefixes;for(var o in a)if(Y(a,o)){var s=a[o];if(s.scientific){var u=Math.abs(Math.log(e/Math.pow(s.value*r,n))/Math.LN10-1.2);(u<i||u===i&&s.name.length<t.name.length)&&(t=s,i=u)}}return t},A.prototype.splitUnit=function(e){for(var r=this.clone(),t=[],n=0;n<e.length&&(r=r.to(e[n]),n!==e.length-1);n++){var i=r.toNumeric(),a=g(i),o=new A(y(a,i)?a:h(r.toNumeric()),e[n].toString());t.push(o),r=c(r,o)}for(var s=0,l=0;l<t.length;l++)s=u(s,t[l].value);return y(s,this.value)&&(r.value=0),t.push(r),t};var z={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};z.SHORTLONG=(0,n.A)({},z.SHORT,z.LONG),z.BINARY_SHORT=(0,n.A)({},z.BINARY_SHORT_SI,z.BINARY_SHORT_IEC),z.BINARY_LONG=(0,n.A)({},z.BINARY_LONG_SI,z.BINARY_LONG_IEC);var q=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],R={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var k in R)Y(R,k)&&(R[k].key=k);var P={name:"",base:{},value:1,offset:0,dimensions:q.map((e=>0))},U={meter:{name:"meter",base:R.LENGTH,prefixes:z.LONG,value:1,offset:0},inch:{name:"inch",base:R.LENGTH,prefixes:z.NONE,value:.0254,offset:0},foot:{name:"foot",base:R.LENGTH,prefixes:z.NONE,value:.3048,offset:0},yard:{name:"yard",base:R.LENGTH,prefixes:z.NONE,value:.9144,offset:0},mile:{name:"mile",base:R.LENGTH,prefixes:z.NONE,value:1609.344,offset:0},link:{name:"link",base:R.LENGTH,prefixes:z.NONE,value:.201168,offset:0},rod:{name:"rod",base:R.LENGTH,prefixes:z.NONE,value:5.0292,offset:0},chain:{name:"chain",base:R.LENGTH,prefixes:z.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:R.LENGTH,prefixes:z.NONE,value:1e-10,offset:0},m:{name:"m",base:R.LENGTH,prefixes:z.SHORT,value:1,offset:0},in:{name:"in",base:R.LENGTH,prefixes:z.NONE,value:.0254,offset:0},ft:{name:"ft",base:R.LENGTH,prefixes:z.NONE,value:.3048,offset:0},yd:{name:"yd",base:R.LENGTH,prefixes:z.NONE,value:.9144,offset:0},mi:{name:"mi",base:R.LENGTH,prefixes:z.NONE,value:1609.344,offset:0},li:{name:"li",base:R.LENGTH,prefixes:z.NONE,value:.201168,offset:0},rd:{name:"rd",base:R.LENGTH,prefixes:z.NONE,value:5.02921,offset:0},ch:{name:"ch",base:R.LENGTH,prefixes:z.NONE,value:20.1168,offset:0},mil:{name:"mil",base:R.LENGTH,prefixes:z.NONE,value:254e-7,offset:0},m2:{name:"m2",base:R.SURFACE,prefixes:z.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:R.SURFACE,prefixes:z.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:R.SURFACE,prefixes:z.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:R.SURFACE,prefixes:z.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:R.SURFACE,prefixes:z.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:R.SURFACE,prefixes:z.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:R.SURFACE,prefixes:z.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:R.SURFACE,prefixes:z.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:R.SURFACE,prefixes:z.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:R.SURFACE,prefixes:z.NONE,value:1e4,offset:0},m3:{name:"m3",base:R.VOLUME,prefixes:z.CUBIC,value:1,offset:0},L:{name:"L",base:R.VOLUME,prefixes:z.SHORT,value:.001,offset:0},l:{name:"l",base:R.VOLUME,prefixes:z.SHORT,value:.001,offset:0},litre:{name:"litre",base:R.VOLUME,prefixes:z.LONG,value:.001,offset:0},cuin:{name:"cuin",base:R.VOLUME,prefixes:z.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:R.VOLUME,prefixes:z.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:R.VOLUME,prefixes:z.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:R.VOLUME,prefixes:z.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:R.VOLUME,prefixes:z.NONE,value:15e-6,offset:0},drop:{name:"drop",base:R.VOLUME,prefixes:z.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:R.VOLUME,prefixes:z.NONE,value:5e-8,offset:0},minim:{name:"minim",base:R.VOLUME,prefixes:z.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:R.VOLUME,prefixes:z.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:R.VOLUME,prefixes:z.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:R.VOLUME,prefixes:z.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:R.VOLUME,prefixes:z.NONE,value:1e-6,offset:0},cup:{name:"cup",base:R.VOLUME,prefixes:z.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:R.VOLUME,prefixes:z.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:R.VOLUME,prefixes:z.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:R.VOLUME,prefixes:z.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:R.VOLUME,prefixes:z.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:R.VOLUME,prefixes:z.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:R.VOLUME,prefixes:z.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:R.VOLUME,prefixes:z.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:R.VOLUME,prefixes:z.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:R.VOLUME,prefixes:z.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:R.VOLUME,prefixes:z.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:R.VOLUME,prefixes:z.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:R.VOLUME,prefixes:z.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:R.VOLUME,prefixes:z.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:R.VOLUME,prefixes:z.NONE,value:.1173478,offset:0},obl:{name:"obl",base:R.VOLUME,prefixes:z.NONE,value:.1589873,offset:0},g:{name:"g",base:R.MASS,prefixes:z.SHORT,value:.001,offset:0},gram:{name:"gram",base:R.MASS,prefixes:z.LONG,value:.001,offset:0},ton:{name:"ton",base:R.MASS,prefixes:z.SHORT,value:907.18474,offset:0},t:{name:"t",base:R.MASS,prefixes:z.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:R.MASS,prefixes:z.LONG,value:1e3,offset:0},grain:{name:"grain",base:R.MASS,prefixes:z.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:R.MASS,prefixes:z.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:R.MASS,prefixes:z.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:R.MASS,prefixes:z.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:R.MASS,prefixes:z.NONE,value:45.359237,offset:0},stick:{name:"stick",base:R.MASS,prefixes:z.NONE,value:.115,offset:0},stone:{name:"stone",base:R.MASS,prefixes:z.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:R.MASS,prefixes:z.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:R.MASS,prefixes:z.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:R.MASS,prefixes:z.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:R.MASS,prefixes:z.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:R.MASS,prefixes:z.NONE,value:45.359237,offset:0},s:{name:"s",base:R.TIME,prefixes:z.SHORT,value:1,offset:0},min:{name:"min",base:R.TIME,prefixes:z.NONE,value:60,offset:0},h:{name:"h",base:R.TIME,prefixes:z.NONE,value:3600,offset:0},second:{name:"second",base:R.TIME,prefixes:z.LONG,value:1,offset:0},sec:{name:"sec",base:R.TIME,prefixes:z.LONG,value:1,offset:0},minute:{name:"minute",base:R.TIME,prefixes:z.NONE,value:60,offset:0},hour:{name:"hour",base:R.TIME,prefixes:z.NONE,value:3600,offset:0},day:{name:"day",base:R.TIME,prefixes:z.NONE,value:86400,offset:0},week:{name:"week",base:R.TIME,prefixes:z.NONE,value:604800,offset:0},month:{name:"month",base:R.TIME,prefixes:z.NONE,value:2629800,offset:0},year:{name:"year",base:R.TIME,prefixes:z.NONE,value:31557600,offset:0},decade:{name:"decade",base:R.TIME,prefixes:z.NONE,value:315576e3,offset:0},century:{name:"century",base:R.TIME,prefixes:z.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:R.TIME,prefixes:z.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:R.FREQUENCY,prefixes:z.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:R.FREQUENCY,prefixes:z.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:R.ANGLE,prefixes:z.SHORT,value:1,offset:0},radian:{name:"radian",base:R.ANGLE,prefixes:z.LONG,value:1,offset:0},deg:{name:"deg",base:R.ANGLE,prefixes:z.SHORT,value:null,offset:0},degree:{name:"degree",base:R.ANGLE,prefixes:z.LONG,value:null,offset:0},grad:{name:"grad",base:R.ANGLE,prefixes:z.SHORT,value:null,offset:0},gradian:{name:"gradian",base:R.ANGLE,prefixes:z.LONG,value:null,offset:0},cycle:{name:"cycle",base:R.ANGLE,prefixes:z.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:R.ANGLE,prefixes:z.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:R.ANGLE,prefixes:z.NONE,value:null,offset:0},A:{name:"A",base:R.CURRENT,prefixes:z.SHORT,value:1,offset:0},ampere:{name:"ampere",base:R.CURRENT,prefixes:z.LONG,value:1,offset:0},K:{name:"K",base:R.TEMPERATURE,prefixes:z.SHORT,value:1,offset:0},degC:{name:"degC",base:R.TEMPERATURE,prefixes:z.SHORT,value:1,offset:273.15},degF:{name:"degF",base:R.TEMPERATURE,prefixes:z.SHORT,value:new D(5,9),offset:459.67},degR:{name:"degR",base:R.TEMPERATURE,prefixes:z.SHORT,value:new D(5,9),offset:0},kelvin:{name:"kelvin",base:R.TEMPERATURE,prefixes:z.LONG,value:1,offset:0},celsius:{name:"celsius",base:R.TEMPERATURE,prefixes:z.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:R.TEMPERATURE,prefixes:z.LONG,value:new D(5,9),offset:459.67},rankine:{name:"rankine",base:R.TEMPERATURE,prefixes:z.LONG,value:new D(5,9),offset:0},mol:{name:"mol",base:R.AMOUNT_OF_SUBSTANCE,prefixes:z.SHORT,value:1,offset:0},mole:{name:"mole",base:R.AMOUNT_OF_SUBSTANCE,prefixes:z.LONG,value:1,offset:0},cd:{name:"cd",base:R.LUMINOUS_INTENSITY,prefixes:z.SHORT,value:1,offset:0},candela:{name:"candela",base:R.LUMINOUS_INTENSITY,prefixes:z.LONG,value:1,offset:0},N:{name:"N",base:R.FORCE,prefixes:z.SHORT,value:1,offset:0},newton:{name:"newton",base:R.FORCE,prefixes:z.LONG,value:1,offset:0},dyn:{name:"dyn",base:R.FORCE,prefixes:z.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:R.FORCE,prefixes:z.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:R.FORCE,prefixes:z.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:R.FORCE,prefixes:z.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:R.FORCE,prefixes:z.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:R.FORCE,prefixes:z.NONE,value:9.80665,offset:0},J:{name:"J",base:R.ENERGY,prefixes:z.SHORT,value:1,offset:0},joule:{name:"joule",base:R.ENERGY,prefixes:z.LONG,value:1,offset:0},erg:{name:"erg",base:R.ENERGY,prefixes:z.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:R.ENERGY,prefixes:z.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:R.ENERGY,prefixes:z.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:R.ENERGY,prefixes:z.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:R.ENERGY,prefixes:z.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:R.POWER,prefixes:z.SHORT,value:1,offset:0},watt:{name:"watt",base:R.POWER,prefixes:z.LONG,value:1,offset:0},hp:{name:"hp",base:R.POWER,prefixes:z.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:R.POWER,prefixes:z.SHORT,value:w.I,offset:0},VA:{name:"VA",base:R.POWER,prefixes:z.SHORT,value:1,offset:0},Pa:{name:"Pa",base:R.PRESSURE,prefixes:z.SHORT,value:1,offset:0},psi:{name:"psi",base:R.PRESSURE,prefixes:z.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:R.PRESSURE,prefixes:z.NONE,value:101325,offset:0},bar:{name:"bar",base:R.PRESSURE,prefixes:z.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:R.PRESSURE,prefixes:z.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:R.PRESSURE,prefixes:z.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:R.PRESSURE,prefixes:z.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:R.PRESSURE,prefixes:z.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:R.ELECTRIC_CHARGE,prefixes:z.LONG,value:1,offset:0},C:{name:"C",base:R.ELECTRIC_CHARGE,prefixes:z.SHORT,value:1,offset:0},farad:{name:"farad",base:R.ELECTRIC_CAPACITANCE,prefixes:z.LONG,value:1,offset:0},F:{name:"F",base:R.ELECTRIC_CAPACITANCE,prefixes:z.SHORT,value:1,offset:0},volt:{name:"volt",base:R.ELECTRIC_POTENTIAL,prefixes:z.LONG,value:1,offset:0},V:{name:"V",base:R.ELECTRIC_POTENTIAL,prefixes:z.SHORT,value:1,offset:0},ohm:{name:"ohm",base:R.ELECTRIC_RESISTANCE,prefixes:z.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:R.ELECTRIC_INDUCTANCE,prefixes:z.LONG,value:1,offset:0},H:{name:"H",base:R.ELECTRIC_INDUCTANCE,prefixes:z.SHORT,value:1,offset:0},siemens:{name:"siemens",base:R.ELECTRIC_CONDUCTANCE,prefixes:z.LONG,value:1,offset:0},S:{name:"S",base:R.ELECTRIC_CONDUCTANCE,prefixes:z.SHORT,value:1,offset:0},weber:{name:"weber",base:R.MAGNETIC_FLUX,prefixes:z.LONG,value:1,offset:0},Wb:{name:"Wb",base:R.MAGNETIC_FLUX,prefixes:z.SHORT,value:1,offset:0},tesla:{name:"tesla",base:R.MAGNETIC_FLUX_DENSITY,prefixes:z.LONG,value:1,offset:0},T:{name:"T",base:R.MAGNETIC_FLUX_DENSITY,prefixes:z.SHORT,value:1,offset:0},b:{name:"b",base:R.BIT,prefixes:z.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:R.BIT,prefixes:z.BINARY_LONG,value:1,offset:0},B:{name:"B",base:R.BIT,prefixes:z.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:R.BIT,prefixes:z.BINARY_LONG,value:8,offset:0}},L={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function j(e){if("BigNumber"===e.number){var r=Hc(N);U.rad.value=new N(1),U.deg.value=r.div(180),U.grad.value=r.div(200),U.cycle.value=r.times(2),U.arcsec.value=r.div(648e3),U.arcmin.value=r.div(10800)}else U.rad.value=1,U.deg.value=Math.PI/180,U.grad.value=Math.PI/200,U.cycle.value=2*Math.PI,U.arcsec.value=Math.PI/648e3,U.arcmin.value=Math.PI/10800;U.radian.value=U.rad.value,U.degree.value=U.deg.value,U.gradian.value=U.grad.value}j(o),a&&a("config",(function(e,r){e.number!==r.number&&j(e)}));var H={si:{NONE:{unit:P,prefix:z.NONE[""]},LENGTH:{unit:U.m,prefix:z.SHORT[""]},MASS:{unit:U.g,prefix:z.SHORT.k},TIME:{unit:U.s,prefix:z.SHORT[""]},CURRENT:{unit:U.A,prefix:z.SHORT[""]},TEMPERATURE:{unit:U.K,prefix:z.SHORT[""]},LUMINOUS_INTENSITY:{unit:U.cd,prefix:z.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:U.mol,prefix:z.SHORT[""]},ANGLE:{unit:U.rad,prefix:z.SHORT[""]},BIT:{unit:U.bits,prefix:z.SHORT[""]},FORCE:{unit:U.N,prefix:z.SHORT[""]},ENERGY:{unit:U.J,prefix:z.SHORT[""]},POWER:{unit:U.W,prefix:z.SHORT[""]},PRESSURE:{unit:U.Pa,prefix:z.SHORT[""]},ELECTRIC_CHARGE:{unit:U.C,prefix:z.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:U.F,prefix:z.SHORT[""]},ELECTRIC_POTENTIAL:{unit:U.V,prefix:z.SHORT[""]},ELECTRIC_RESISTANCE:{unit:U.ohm,prefix:z.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:U.H,prefix:z.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:U.S,prefix:z.SHORT[""]},MAGNETIC_FLUX:{unit:U.Wb,prefix:z.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:U.T,prefix:z.SHORT[""]},FREQUENCY:{unit:U.Hz,prefix:z.SHORT[""]}}};H.cgs=JSON.parse(JSON.stringify(H.si)),H.cgs.LENGTH={unit:U.m,prefix:z.SHORT.c},H.cgs.MASS={unit:U.g,prefix:z.SHORT[""]},H.cgs.FORCE={unit:U.dyn,prefix:z.SHORT[""]},H.cgs.ENERGY={unit:U.erg,prefix:z.NONE[""]},H.us=JSON.parse(JSON.stringify(H.si)),H.us.LENGTH={unit:U.ft,prefix:z.NONE[""]},H.us.MASS={unit:U.lbm,prefix:z.NONE[""]},H.us.TEMPERATURE={unit:U.degF,prefix:z.NONE[""]},H.us.FORCE={unit:U.lbf,prefix:z.NONE[""]},H.us.ENERGY={unit:U.BTU,prefix:z.BTU[""]},H.us.POWER={unit:U.hp,prefix:z.NONE[""]},H.us.PRESSURE={unit:U.psi,prefix:z.NONE[""]},H.auto=JSON.parse(JSON.stringify(H.si));var $=H.auto;for(var Z in A.setUnitSystem=function(e){if(!Y(H,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(H).join(", "));$=H[e]},A.getUnitSystem=function(){for(var e in H)if(Y(H,e)&&H[e]===$)return e},A.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new N(e.n).div(e.d).times(e.s):new N(e+"")},Fraction:function(e){return new D(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?b(e):e}},A.prototype._numberConverter=function(){var e=A.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},A._getNumberConverter=function(e){if(!A.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return A.typeConverters[e]},U)if(Y(U,Z)){var W=U[Z];W.dimensions=W.base.dimensions}for(var J in L)if(Y(L,J)){var X=U[L[J]],Q={};for(var K in X)Y(X,K)&&(Q[K]=X[K]);Q.name=J,U[J]=Q}return A.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},A.createUnit=function(e,r){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(r&&r.override)for(var t in e)if(Y(e,t)&&A.deleteUnit(t),e[t].aliases)for(var n=0;n<e[t].aliases.length;n++)A.deleteUnit(e[t].aliases[n]);var i;for(var a in e)Y(e,a)&&(i=A.createUnitSingle(a,e[a]));return i},A.createUnitSingle=function(e,r){if(null==r&&(r={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(Y(U,e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(var r=0;r<e.length;r++){if(i=e.charAt(r),0===r&&!A.isValidAlpha(i))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(r>0&&!A.isValidAlpha(i)&&!C(i))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);var t,n,a,o=null,s=[],u=0;if(r&&"Unit"===r.type)o=r.clone();else if("string"==typeof r)""!==r&&(t=r);else{if("object"!=typeof r)throw new TypeError('Cannot create unit "'+e+'" from "'+r.toString()+'": expecting "string" or "Unit" or "Object"');t=r.definition,n=r.prefixes,u=r.offset,a=r.baseName,r.aliases&&(s=r.aliases.valueOf())}if(s)for(var l=0;l<s.length;l++)if(Y(U,s[l]))throw new Error('Cannot create alias "'+s[l]+'": a unit with that name already exists');if(t&&"string"==typeof t&&!o)try{o=A.parse(t,{allowNoUnits:!0})}catch(r){throw r.message='Could not create unit "'+e+'" from "'+t+'": '+r.message,r}else t&&"Unit"===t.type&&(o=t.clone());s=s||[],u=u||0,n=n&&n.toUpperCase&&z[n.toUpperCase()]||z.NONE;var c={};if(o){c={name:e,value:o.value,dimensions:o.dimensions.slice(0),prefixes:n,offset:u};var f=!1;for(var p in R)if(Y(R,p)){for(var m=!0,d=0;d<q.length;d++)if(Math.abs((c.dimensions[d]||0)-(R[p].dimensions[d]||0))>1e-12){m=!1;break}if(m){f=!0,c.base=R[p];break}}if(!f){a=a||e+"_STUFF";var h={dimensions:o.dimensions.slice(0)};h.key=a,R[a]=h,$[a]={unit:c,prefix:z.NONE[""]},c.base=R[a]}}else{if(a=a||e+"_STUFF",q.indexOf(a)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');for(var g in q.push(a),R)Y(R,g)&&(R[g].dimensions[q.length-1]=0);for(var y={dimensions:[]},v=0;v<q.length;v++)y.dimensions[v]=0;y.dimensions[q.length-1]=1,y.key=a,R[a]=y,c={name:e,value:1,dimensions:R[a].dimensions.slice(0),prefixes:n,offset:u,base:R[a]},$[a]={unit:c,prefix:z.NONE[""]}}A.UNITS[e]=c;for(var x=0;x<s.length;x++){var b=s[x],w={};for(var N in c)Y(c,N)&&(w[N]=c[N]);w.name=b,A.UNITS[b]=w}return delete B.cache,new A(null,e)},A.deleteUnit=function(e){delete A.UNITS[e],delete B.cache},A.PREFIXES=z,A.BASE_DIMENSIONS=q,A.BASE_UNITS=R,A.UNIT_SYSTEMS=H,A.UNITS=U,A}),{isClass:!0}),Yc="unit",Jc=Oe(Yc,["typed","Unit"],(e=>{var{typed:r,Unit:t}=e;return r(Yc,{Unit:function(e){return e.clone()},string:function(e){return t.isValuelessUnit(e)?new t(null,e):t.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,r){return new t(e,r)},"number | BigNumber | Fraction":function(e){return new t(e)},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Xc="sparse",Qc=Oe(Xc,["typed","SparseMatrix"],(e=>{var{typed:r,SparseMatrix:t}=e;return r(Xc,{"":function(){return new t([])},string:function(e){return new t([],e)},"Array | Matrix":function(e){return new t(e)},"Array | Matrix, string":function(e,r){return new t(e,r)}})})),Kc="createUnit",ef=Oe(Kc,["typed","Unit"],(e=>{var{typed:r,Unit:t}=e;return r(Kc,{"Object, Object":function(e,r){return t.createUnit(e,r)},Object:function(e){return t.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,r,n){var i={};return i[e]=r,t.createUnit(i,n)},"string, Unit | string | Object":function(e,r){var n={};return n[e]=r,t.createUnit(n,{})},string:function(e){var r={};return r[e]={},t.createUnit(r,{})}})})),rf="acos",tf=Oe(rf,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(rf,{number:function(e){return e>=-1&&e<=1||t.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),nf="acosh",af=Oe(nf,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(nf,{number:function(e){return e>=1||t.predictable?Li(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()}})})),of="acot",sf=Oe(of,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(of,{number:ji,Complex:function(e){return e.acot()},BigNumber:function(e){return new t(1).div(e).atan()}})})),uf="acoth",lf=Oe(uf,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(uf,{number:function(e){return e>=1||e<=-1||t.predictable?Hi(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),cf="acsc",ff=Oe(cf,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(cf,{number:function(e){return e<=-1||e>=1||t.predictable?$i(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),pf="acsch",mf=Oe(pf,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(pf,{number:Gi,Complex:function(e){return e.acsch()},BigNumber:function(e){return new t(1).div(e).asinh()}})})),df="asec",hf=Oe(df,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(df,{number:function(e){return e<=-1||e>=1||t.predictable?Vi(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),gf="asech",yf=Oe(gf,["typed","config","Complex","BigNumber"],(e=>{var{typed:r,config:t,Complex:n,BigNumber:i}=e;return r(gf,{number:function(e){if(e<=1&&e>=-1||t.predictable){var r=1/e;if(r>0||t.predictable)return Zi(e);var i=Math.sqrt(r*r-1);return new n(Math.log(i-r),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),vf="asin",xf=Oe(vf,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(vf,{number:function(e){return e>=-1&&e<=1||t.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),bf=Oe("asinh",["typed"],(e=>{var{typed:r}=e;return r("asinh",{number:Wi,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),wf=Oe("atan",["typed"],(e=>{var{typed:r}=e;return r("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),Nf="atan2",Df=Oe(Nf,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(e=>{var{typed:r,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:a,concat:o}=e,s=So({typed:r,equalScalar:n}),u=Co({typed:r}),l=cs({typed:r,equalScalar:n}),c=ao({typed:r,equalScalar:n}),f=oo({typed:r,DenseMatrix:a}),p=Fo({typed:r,matrix:t,concat:o});return r(Nf,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,r)=>i.atan2(e,r)},p({scalar:"number | BigNumber",SS:l,DS:u,SD:s,Ss:c,sS:f}))})),Ef="atanh",Af=Oe(Ef,["typed","config","Complex"],(e=>{var{typed:r,config:t,Complex:n}=e;return r(Ef,{number:function(e){return e<=1&&e>=-1||t.predictable?Yi(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),Sf=Oe("trigUnit",["typed"],(e=>{var{typed:r}=e;return{Unit:r.referToSelf((e=>t=>{if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return r.find(e,t.valueType())(t.value)}))}})),Cf=Oe("cos",["typed"],(e=>{var{typed:r}=e,t=Sf({typed:r});return r("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},t)})),Mf="cosh",Of=Oe(Mf,["typed"],(e=>{var{typed:r}=e;return r(Mf,{number:Ee,"Complex | BigNumber":e=>e.cosh()})})),Tf=Oe("cot",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("cot",{number:Ji,Complex:e=>e.cot(),BigNumber:e=>new t(1).div(e.tan())},Sf({typed:r}))})),Ff="coth",_f=Oe(Ff,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(Ff,{number:Xi,Complex:e=>e.coth(),BigNumber:e=>new t(1).div(e.tanh())})})),Bf=Oe("csc",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("csc",{number:Qi,Complex:e=>e.csc(),BigNumber:e=>new t(1).div(e.sin())},Sf({typed:r}))})),If="csch",zf=Oe(If,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(If,{number:Ki,Complex:e=>e.csch(),BigNumber:e=>new t(1).div(e.sinh())})})),qf=Oe("sec",["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r("sec",{number:ea,Complex:e=>e.sec(),BigNumber:e=>new t(1).div(e.cos())},Sf({typed:r}))})),Rf="sech",kf=Oe(Rf,["typed","BigNumber"],(e=>{var{typed:r,BigNumber:t}=e;return r(Rf,{number:ra,Complex:e=>e.sech(),BigNumber:e=>new t(1).div(e.cosh())})})),Pf=Oe("sin",["typed"],(e=>{var{typed:r}=e,t=Sf({typed:r});return r("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},t)})),Uf="sinh",Lf=Oe(Uf,["typed"],(e=>{var{typed:r}=e;return r(Uf,{number:ta,"Complex | BigNumber":e=>e.sinh()})})),jf=Oe("tan",["typed"],(e=>{var{typed:r}=e,t=Sf({typed:r});return r("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},t)})),Hf=Oe("tanh",["typed"],(e=>{var{typed:r}=e;return r("tanh",{number:Se,"Complex | BigNumber":e=>e.tanh()})})),$f="setCartesian",Gf=Oe($f,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r($f,{"Array | Matrix, Array | Matrix":function(e,r){var s=[];if(0!==n(t(e),new a(0))&&0!==n(t(r),new a(0))){var u=bn(Array.isArray(e)?e:e.toArray()).sort(i),l=bn(Array.isArray(r)?r:r.toArray()).sort(i);s=[];for(var c=0;c<u.length;c++)for(var f=0;f<l.length;f++)s.push([u[c],l[f]])}return Array.isArray(e)&&Array.isArray(r)?s:new o(s)}})})),Vf="setDifference",Zf=Oe(Vf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Vf,{"Array | Matrix, Array | Matrix":function(e,r){var s;if(0===n(t(e),new a(0)))s=[];else{if(0===n(t(r),new a(0)))return bn(e.toArray());var u,l=Sn(bn(Array.isArray(e)?e:e.toArray()).sort(i)),c=Sn(bn(Array.isArray(r)?r:r.toArray()).sort(i));s=[];for(var f=0;f<l.length;f++){u=!1;for(var p=0;p<c.length;p++)if(0===i(l[f].value,c[p].value)&&l[f].identifier===c[p].identifier){u=!0;break}u||s.push(l[f])}}return Array.isArray(e)&&Array.isArray(r)?Cn(s):new o(Cn(s))}})})),Wf="setDistinct",Yf=Oe(Wf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Wf,{"Array | Matrix":function(e){var r;if(0===n(t(e),new a(0)))r=[];else{var s=bn(Array.isArray(e)?e:e.toArray()).sort(i);(r=[]).push(s[0]);for(var u=1;u<s.length;u++)0!==i(s[u],s[u-1])&&r.push(s[u])}return Array.isArray(e)?r:new o(r)}})})),Jf="setIntersect",Xf=Oe(Jf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a,DenseMatrix:o}=e;return r(Jf,{"Array | Matrix, Array | Matrix":function(e,r){var s;if(0===n(t(e),new a(0))||0===n(t(r),new a(0)))s=[];else{var u=Sn(bn(Array.isArray(e)?e:e.toArray()).sort(i)),l=Sn(bn(Array.isArray(r)?r:r.toArray()).sort(i));s=[];for(var c=0;c<u.length;c++)for(var f=0;f<l.length;f++)if(0===i(u[c].value,l[f].value)&&u[c].identifier===l[f].identifier){s.push(u[c]);break}}return Array.isArray(e)&&Array.isArray(r)?Cn(s):new o(Cn(s))}})})),Qf="setIsSubset",Kf=Oe(Qf,["typed","size","subset","compareNatural","Index"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(Qf,{"Array | Matrix, Array | Matrix":function(e,r){if(0===n(t(e),new a(0)))return!0;if(0===n(t(r),new a(0)))return!1;for(var o,s=Sn(bn(Array.isArray(e)?e:e.toArray()).sort(i)),u=Sn(bn(Array.isArray(r)?r:r.toArray()).sort(i)),l=0;l<s.length;l++){o=!1;for(var c=0;c<u.length;c++)if(0===i(s[l].value,u[c].value)&&s[l].identifier===u[c].identifier){o=!0;break}if(!1===o)return!1}return!0}})})),ep="setMultiplicity",rp=Oe(ep,["typed","size","subset","compareNatural","Index"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(ep,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,r){if(0===n(t(r),new a(0)))return 0;for(var o=bn(Array.isArray(r)?r:r.toArray()),s=0,u=0;u<o.length;u++)0===i(o[u],e)&&s++;return s}})})),tp="setPowerset",np=Oe(tp,["typed","size","subset","compareNatural","Index"],(e=>{var{typed:r,size:t,subset:n,compareNatural:i,Index:a}=e;return r(tp,{"Array | Matrix":function(e){if(0===n(t(e),new a(0)))return[];for(var r=bn(Array.isArray(e)?e:e.toArray()).sort(i),s=[],u=0;u.toString(2).length<=r.length;)s.push(o(r,u.toString(2).split("").reverse())),u++;return function(e){for(var r=[],t=e.length-1;t>0;t--)for(var n=0;n<t;n++)e[n].length>e[n+1].length&&(r=e[n],e[n]=e[n+1],e[n+1]=r);return e}(s)}});function o(e,r){for(var t=[],n=0;n<r.length;n++)"1"===r[n]&&t.push(e[n]);return t}})),ip="setSize",ap=Oe(ip,["typed","compareNatural"],(e=>{var{typed:r,compareNatural:t}=e;return r(ip,{"Array | Matrix":function(e){return Array.isArray(e)?bn(e).length:bn(e.toArray()).length},"Array | Matrix, boolean":function(e,r){if(!1===r||0===e.length)return Array.isArray(e)?bn(e).length:bn(e.toArray()).length;for(var n=bn(Array.isArray(e)?e:e.toArray()).sort(t),i=1,a=1;a<n.length;a++)0!==t(n[a],n[a-1])&&i++;return i}})})),op="setSymDifference",sp=Oe(op,["typed","size","concat","subset","setDifference","Index"],(e=>{var{typed:r,size:t,concat:n,subset:i,setDifference:a,Index:o}=e;return r(op,{"Array | Matrix, Array | Matrix":function(e,r){if(0===i(t(e),new o(0)))return bn(r);if(0===i(t(r),new o(0)))return bn(e);var s=bn(e),u=bn(r);return n(a(s,u),a(u,s))}})})),up="setUnion",lp=Oe(up,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],(e=>{var{typed:r,size:t,concat:n,subset:i,setIntersect:a,setSymDifference:o,Index:s}=e;return r(up,{"Array | Matrix, Array | Matrix":function(e,r){if(0===i(t(e),new s(0)))return bn(r);if(0===i(t(r),new s(0)))return bn(e);var u=bn(e),l=bn(r);return n(o(u,l),a(u,l))}})})),cp=Oe("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],(e=>{var{typed:r,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:a,SparseMatrix:o,concat:s}=e,u=Bo({typed:r}),l=Io({typed:r,equalScalar:i}),c=zo({typed:r,DenseMatrix:a}),f=Fo({typed:r,matrix:t,concat:s});return r("add",{"any, any":n,"any, any, ...any":r.referToSelf((e=>(r,t,n)=>{for(var i=e(r,t),a=0;a<n.length;a++)i=e(i,n[a]);return i}))},f({elop:n,DS:u,SS:l,Ss:c}))})),fp="hypot",pp=Oe(fp,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],(e=>{var{typed:r,abs:t,addScalar:n,divideScalar:i,multiplyScalar:a,sqrt:o,smaller:u,isPositive:l}=e;return r(fp,{"... number | BigNumber":c,Array:c,Matrix:e=>c(bn(e.toArray()))});function c(e){for(var r=0,c=0,f=0;f<e.length;f++){if(s(e[f]))throw new TypeError("Unexpected type of argument to hypot");var p=t(e[f]);u(c,p)?(r=a(r,a(i(c,p),i(c,p))),r=n(r,1),c=p):r=n(r,l(p)?a(i(p,c),i(p,c)):p)}return a(c,o(r))}})),mp="norm",dp=Oe(mp,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],(e=>{var{typed:r,abs:t,add:n,pow:i,conj:a,sqrt:o,multiply:s,equalScalar:u,larger:l,smaller:c,matrix:f,ctranspose:p,eigs:m}=e;return r(mp,{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return g(f(e),2)},Matrix:function(e){return g(e,2)},"Array, number | BigNumber | string":function(e,r){return g(f(e),r)},"Matrix, number | BigNumber | string":function(e,r){return g(e,r)}});function d(e,r){if(r===Number.POSITIVE_INFINITY||"inf"===r)return function(e){var r=0;return e.forEach((function(e){var n=t(e);l(n,r)&&(r=n)}),!0),r}(e);if(r===Number.NEGATIVE_INFINITY||"-inf"===r)return function(e){var r;return e.forEach((function(e){var n=t(e);r&&!c(n,r)||(r=n)}),!0),r||0}(e);if("fro"===r)return g(e,2);if("number"==typeof r&&!isNaN(r)){if(!u(r,0)){var a=0;return e.forEach((function(e){a=n(i(t(e),r),a)}),!0),i(a,1/r)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}function h(e,r){if(1===r)return function(e){var r=[],i=0;return e.forEach((function(e,a){var o=a[1],s=n(r[o]||0,t(e));l(s,i)&&(i=s),r[o]=s}),!0),i}(e);if(r===Number.POSITIVE_INFINITY||"inf"===r)return function(e){var r=[],i=0;return e.forEach((function(e,a){var o=a[0],s=n(r[o]||0,t(e));l(s,i)&&(i=s),r[o]=s}),!0),i}(e);if("fro"===r)return function(e){var r=0;return e.forEach((function(e,t){r=n(r,s(e,a(e)))})),t(o(r))}(e);if(2===r)return function(e){var r=e.size();if(r[0]!==r[1])throw new RangeError("Invalid matrix dimensions");var n=p(e),i=s(n,e),a=m(i).values.toArray(),u=a[a.length-1];return t(o(u))}(e);throw new Error("Unsupported parameter value "+r)}function g(e,r){var t=e.size();if(1===t.length)return d(e,r);if(2===t.length){if(t[0]&&t[1])return h(e,r);throw new RangeError("Invalid matrix dimensions")}}})),hp=Oe("dot",["typed","addScalar","multiplyScalar","conj","size"],(e=>{var{typed:r,addScalar:t,multiplyScalar:n,conj:i,size:a}=e;return r("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,a){var u=o(e,a),l=p(e)?e._data:e,c=p(e)?e._datatype||e.getDataType():void 0,f=p(a)?a._data:a,m=p(a)?a._datatype||a.getDataType():void 0,d=2===s(e).length,h=2===s(a).length,g=t,y=n;if(c&&m&&c===m&&"string"==typeof c&&"mixed"!==c){var v=c;g=r.find(t,[v,v]),y=r.find(n,[v,v])}if(!d&&!h){for(var x=y(i(l[0]),f[0]),b=1;b<u;b++)x=g(x,y(i(l[b]),f[b]));return x}if(!d&&h){for(var w=y(i(l[0]),f[0][0]),N=1;N<u;N++)w=g(w,y(i(l[N]),f[N][0]));return w}if(d&&!h){for(var D=y(i(l[0][0]),f[0]),E=1;E<u;E++)D=g(D,y(i(l[E][0]),f[E]));return D}if(d&&h){for(var A=y(i(l[0][0]),f[0][0]),S=1;S<u;S++)A=g(A,y(i(l[S][0]),f[S][0]));return A}},"SparseMatrix, SparseMatrix":function(e,r){o(e,r);var i=e._index,a=e._values,s=r._index,u=r._values,l=0,c=t,f=n,p=0,m=0;for(;p<i.length&&m<s.length;){var d=i[p],h=s[m];d<h?p++:d>h?m++:d===h&&(l=c(l,f(a[p],u[m])),p++,m++)}return l}});function o(e,r){var t,n,i=s(e),a=s(r);if(1===i.length)t=i[0];else{if(2!==i.length||1!==i[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");t=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(t!==n)throw new RangeError("Vectors must have equal length ("+t+" != "+n+")");if(0===t)throw new RangeError("Cannot calculate the dot product of empty vectors");return t}function s(e){return p(e)?e.size():a(e)}})),gp=Oe("trace",["typed","matrix","add"],(e=>{var{typed:r,matrix:t,add:n}=e;return r("trace",{Array:function(e){return i(t(e))},SparseMatrix:function(e){var r=e._values,t=e._index,i=e._ptr,a=e._size,o=a[0],s=a[1];if(o===s){var u=0;if(r.length>0)for(var l=0;l<s;l++)for(var c=i[l],f=i[l+1],p=c;p<f;p++){var m=t[p];if(m===l){u=n(u,r[p]);break}if(m>l)break}return u}throw new RangeError("Matrix must be square (size: "+Jt(a)+")")},DenseMatrix:i,any:V});function i(e){var r=e._size,t=e._data;switch(r.length){case 1:if(1===r[0])return V(t[0]);throw new RangeError("Matrix must be square (size: "+Jt(r)+")");case 2:var i=r[0];if(i===r[1]){for(var a=0,o=0;o<i;o++)a=n(a,t[o][o]);return a}throw new RangeError("Matrix must be square (size: "+Jt(r)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Jt(r)+")")}}})),yp="index",vp=Oe(yp,["typed","Index"],(e=>{var{typed:r,Index:t}=e;return r(yp,{"...number | string | BigNumber | Range | Array | Matrix":function(e){var r=e.map((function(e){return o(e)?e.toNumber():f(e)||p(e)?e.map((function(e){return o(e)?e.toNumber():e})):e})),n=new t;return t.apply(n,r),n}})})),xp=new Set(["end"]),bp=Oe("Node",["mathWithTransform"],(e=>{var{mathWithTransform:r}=e;return class{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){var e=this._compile(r,{}),t={};return{evaluate:function(r){var n=je(r);return function(e){for(var r of[...xp])if(e.has(r))throw new Error('Scope contains an illegal symbol, "'+r+'" is a reserved keyword')}(n),e(n,t,null)}}}_compile(e,r){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw new Error("Cannot run forEach on a Node interface")}map(e){throw new Error("Cannot run map on a Node interface")}_ifNode(e){if(!R(e))throw new TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),function e(r,t){r.forEach((function(r,n,i){t(r,n,i),e(r,t)}))}(this,e)}transform(e){return function r(t,n,i){var a=e(t,n,i);return a!==t?a:t.map(r)}(this,null,null)}filter(e){var r=[];return this.traverse((function(t,n,i){e(t,n,i)&&r.push(t)})),r}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map((function(e){return e.cloneDeep()}))}equals(e){return!!e&&(this.type===e.type&&W(this,e))}toString(e){var r=this._getCustomString(e);return void 0!==r?r:this._toString(e)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){var r=this._getCustomString(e);return void 0!==r?r:this._toHTML(e)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(e){var r=this._getCustomString(e);return void 0!==r?r:this._toTex(e)}_toTex(e){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(e){if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}}),{isClass:!0,isNode:!0});function wp(e){return e&&e.isIndexError?new nn(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function Np(e){var{subset:r}=e;return function(e,t){try{if(Array.isArray(e))return r(e,t);if(e&&"function"==typeof e.subset)return e.subset(t);if("string"==typeof e)return r(e,t);if("object"==typeof e){if(!t.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return Fe(e,t.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw wp(e)}}}var Dp="AccessorNode",Ep=Oe(Dp,["subset","Node"],(e=>{var{subset:r,Node:t}=e,n=Np({subset:r});function i(e){return!(C(e)||M(e)||_(e)||z(e)||k(e)||U(e)||H(e))}class a extends t{constructor(e,r){if(super(),!R(e))throw new TypeError('Node expected for parameter "object"');if(!q(r))throw new TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=r}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Dp}get isAccessorNode(){return!0}_compile(e,r){var t=this.object._compile(e,r),i=this.index._compile(e,r);if(this.index.isObjectProperty()){var a=this.index.getObjectProperty();return function(e,r,n){return Fe(t(e,r,n),a)}}return function(e,r,a){var o=t(e,r,a),s=i(e,r,o);return n(o,s)}}forEach(e){e(this.object,"object",this),e(this.index,"index",this)}map(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(e){var r=this.object.toString(e);return i(this.object)&&(r="("+r+")"),r+this.index.toString(e)}_toHTML(e){var r=this.object.toHTML(e);return i(this.object)&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+this.index.toHTML(e)}_toTex(e){var r=this.object.toTex(e);return i(this.object)&&(r="\\left(' + object + '\\right)"),r+this.index.toTex(e)}toJSON(){return{mathjs:Dp,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return(0,Gu.A)(a,"name",Dp),a}),{isClass:!0,isNode:!0}),Ap="ArrayNode",Sp=Oe(Ap,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(R))throw new TypeError("Array containing Nodes expected")}get type(){return Ap}get isArrayNode(){return!0}_compile(e,r){var t=wn(this.items,(function(t){return t._compile(e,r)}));if("Array"!==e.config.matrix){var n=e.matrix;return function(e,r,i){return n(wn(t,(function(t){return t(e,r,i)})))}}return function(e,r,n){return wn(t,(function(t){return t(e,r,n)}))}}forEach(e){for(var r=0;r<this.items.length;r++){e(this.items[r],"items["+r+"]",this)}}map(e){for(var r=[],n=0;n<this.items.length;n++)r[n]=this._ifNode(e(this.items[n],"items["+n+"]",this));return new t(r)}clone(){return new t(this.items.slice(0))}_toString(e){return"["+this.items.map((function(r){return r.toString(e)})).join(", ")+"]"}toJSON(){return{mathjs:Ap,items:this.items}}static fromJSON(e){return new t(e.items)}_toHTML(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map((function(r){return r.toHTML(e)})).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){return function r(t,n){var i=t.some(M)&&!t.every(M),a=n||i,o=a?"&":"\\\\",s=t.map((function(t){return t.items?r(t.items,!n):t.toTex(e)})).join(o);return i||!a||a&&!n?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return(0,Gu.A)(t,"name",Ap),t}),{isClass:!0,isNode:!0});var Cp=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{op:"or",associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{op:"xor",associativity:"left",associativeWith:[]}},{"OperatorNode:and":{op:"and",associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{op:"|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{op:"^|",associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{op:"&",associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{op:"==",associativity:"left",associativeWith:[]},"OperatorNode:unequal":{op:"!=",associativity:"left",associativeWith:[]},"OperatorNode:smaller":{op:"<",associativity:"left",associativeWith:[]},"OperatorNode:larger":{op:">",associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{op:"<=",associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{op:">=",associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{op:"<<",associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{op:">>",associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{op:">>>",associativity:"left",associativeWith:[]}},{"OperatorNode:to":{op:"to",associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{op:"+",associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{op:"-",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{op:"*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{op:"/",associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{op:".*",associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{op:"./",associativity:"left",associativeWith:[]},"OperatorNode:mod":{op:"mod",associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]}},{"OperatorNode:unaryPlus":{op:"+",associativity:"right"},"OperatorNode:unaryMinus":{op:"-",associativity:"right"},"OperatorNode:bitNot":{op:"~",associativity:"right"},"OperatorNode:not":{op:"not",associativity:"right"}},{"OperatorNode:pow":{op:"^",associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{op:".^",associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{op:"!",associativity:"left"}},{"OperatorNode:ctranspose":{op:"'",associativity:"left"}}];function Mp(e,r){if(!r||"auto"!==r)return e;for(var t=e;U(t);)t=t.content;return t}function Op(e,r,t,n){var i=e;"keep"!==r&&(i=e.getContent());for(var a=i.getIdentifier(),o=null,s=0;s<Cp.length;s++)if(a in Cp[s]){o=s;break}if("OperatorNode:multiply"===a&&i.implicit&&"show"!==t){var u=Mp(i.args[0],r);_(u)&&n&&"OperatorNode:divide"===n.getIdentifier()&&B(Mp(n.args[0],r))||"OperatorNode:divide"===u.getIdentifier()&&B(Mp(u.args[0],r))&&_(Mp(u.args[1]))||(o+=1)}return o}function Tp(e,r){var t=e;"keep"!==r&&(t=e.getContent());var n=t.getIdentifier(),i=Op(t,r);if(null===i)return null;var a=Cp[i][n];if(Y(a,"associativity")){if("left"===a.associativity)return"left";if("right"===a.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+a.associativity+"'.")}return null}function Fp(e,r,t){var n="keep"!==t?e.getContent():e,i="keep"!==t?e.getContent():r,a=n.getIdentifier(),o=i.getIdentifier(),s=Op(n,t);if(null===s)return null;var u=Cp[s][a];if(Y(u,"associativeWith")&&u.associativeWith instanceof Array){for(var l=0;l<u.associativeWith.length;l++)if(u.associativeWith[l]===o)return!0;return!1}return null}var _p="AssignmentNode",Bp=Oe(_p,["subset","?matrix","Node"],(e=>{var{subset:r,matrix:t,Node:n}=e,i=Np({subset:r}),a=function(e){var{subset:r,matrix:t}=e;return function(e,n,i){try{if(Array.isArray(e))return t(e).subset(n,i).valueOf().forEach(((r,t)=>{e[t]=r})),e;if(e&&"function"==typeof e.subset)return e.subset(n,i);if("string"==typeof e)return r(e,n,i);if("object"==typeof e){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return _e(e,n.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw wp(e)}}}({subset:r,matrix:t});function o(e,r,t){r||(r="keep");var n=Op(e,r,t),i=Op(e.value,r,t);return"all"===r||null!==i&&i<=n}class s extends n{constructor(e,r,t){if(super(),this.object=e,this.index=t?r:null,this.value=t||r,!H(e)&&!C(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(H(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!q(this.index))throw new TypeError('IndexNode expected as "index"');if(!R(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return _p}get isAssignmentNode(){return!0}_compile(e,r){var t=this.object._compile(e,r),n=this.index?this.index._compile(e,r):null,o=this.value._compile(e,r),s=this.object.name;if(this.index){if(this.index.isObjectProperty()){var u=this.index.getObjectProperty();return function(e,r,n){var i=t(e,r,n),a=o(e,r,n);return _e(i,u,a),a}}if(H(this.object))return function(e,r,i){var u=t(e,r,i),l=o(e,r,i),c=n(e,r,u);return e.set(s,a(u,c,l)),l};var l=this.object.object._compile(e,r);if(this.object.index.isObjectProperty()){var c=this.object.index.getObjectProperty();return function(e,r,t){var i=l(e,r,t),s=Fe(i,c),u=n(e,r,s),f=o(e,r,t);return _e(i,c,a(s,u,f)),f}}var f=this.object.index._compile(e,r);return function(e,r,t){var s=l(e,r,t),u=f(e,r,s),c=i(s,u),p=n(e,r,c),m=o(e,r,t);return a(s,u,a(c,p,m)),m}}if(!H(this.object))throw new TypeError("SymbolNode expected as object");return function(e,r,t){var n=o(e,r,t);return e.set(s,n),n}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){var r=this._ifNode(e(this.object,"object",this)),t=this.index?this._ifNode(e(this.index,"index",this)):null,n=this._ifNode(e(this.value,"value",this));return new s(r,t,n)}clone(){return new s(this.object,this.index,this.value)}_toString(e){var r=this.object.toString(e),t=this.index?this.index.toString(e):"",n=this.value.toString(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n="("+n+")"),r+t+" = "+n}toJSON(){return{mathjs:_p,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new s(e.object,e.index,e.value)}_toHTML(e){var r=this.object.toHTML(e),t=this.index?this.index.toHTML(e):"",n=this.value.toHTML(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n='<span class="math-paranthesis math-round-parenthesis">(</span>'+n+'<span class="math-paranthesis math-round-parenthesis">)</span>'),r+t+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n}_toTex(e){var r=this.object.toTex(e),t=this.index?this.index.toTex(e):"",n=this.value.toTex(e);return o(this,e&&e.parenthesis,e&&e.implicit)&&(n="\\left(".concat(n,"\\right)")),r+t+"="+n}}return(0,Gu.A)(s,"name",_p),s}),{isClass:!0,isNode:!0}),Ip="BlockNode",zp=Oe(Ip,["ResultSet","Node"],(e=>{var{ResultSet:r,Node:t}=e;class n extends t{constructor(e){if(super(),!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){var r=e&&e.node,t=!e||void 0===e.visible||e.visible;if(!R(r))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof t)throw new TypeError('Property "visible" must be a boolean');return{node:r,visible:t}}))}get type(){return Ip}get isBlockNode(){return!0}_compile(e,t){var n=wn(this.blocks,(function(r){return{evaluate:r.node._compile(e,t),visible:r.visible}}));return function(e,t,i){var a=[];return Nn(n,(function(r){var n=r.evaluate(e,t,i);r.visible&&a.push(n)})),new r(a)}}forEach(e){for(var r=0;r<this.blocks.length;r++)e(this.blocks[r].node,"blocks["+r+"].node",this)}map(e){for(var r=[],t=0;t<this.blocks.length;t++){var i=this.blocks[t],a=this._ifNode(e(i.node,"blocks["+t+"].node",this));r[t]={node:a,visible:i.visible}}return new n(r)}clone(){var e=this.blocks.map((function(e){return{node:e.node,visible:e.visible}}));return new n(e)}_toString(e){return this.blocks.map((function(r){return r.node.toString(e)+(r.visible?"":";")})).join("\n")}toJSON(){return{mathjs:Ip,blocks:this.blocks}}static fromJSON(e){return new n(e.blocks)}_toHTML(e){return this.blocks.map((function(r){return r.node.toHTML(e)+(r.visible?"":'<span class="math-separator">;</span>')})).join('<span class="math-separator"><br /></span>')}_toTex(e){return this.blocks.map((function(r){return r.node.toTex(e)+(r.visible?"":";")})).join("\\;\\;\n")}}return(0,Gu.A)(n,"name",Ip),n}),{isClass:!0,isNode:!0}),qp="ConditionalNode",Rp=Oe(qp,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e,r,t){if(super(),!R(e))throw new TypeError("Parameter condition must be a Node");if(!R(r))throw new TypeError("Parameter trueExpr must be a Node");if(!R(t))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=r,this.falseExpr=t}get type(){return qp}get isConditionalNode(){return!0}_compile(e,r){var t=this.condition._compile(e,r),n=this.trueExpr._compile(e,r),i=this.falseExpr._compile(e,r);return function(e,r,a){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(o(e))return!e.isZero();if(s(e))return!(!e.re&&!e.im);if(l(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+G(e)+'"')}(t(e,r,a))?n(e,r,a):i(e,r,a)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new t(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new t(this.condition,this.trueExpr,this.falseExpr)}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=Op(this,r,e&&e.implicit),n=this.condition.toString(e),i=Op(this.condition,r,e&&e.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==i&&i<=t)&&(n="("+n+")");var a=this.trueExpr.toString(e),o=Op(this.trueExpr,r,e&&e.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==o&&o<=t)&&(a="("+a+")");var s=this.falseExpr.toString(e),u=Op(this.falseExpr,r,e&&e.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=t)&&(s="("+s+")"),n+" ? "+a+" : "+s}toJSON(){return{mathjs:qp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new t(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=Op(this,r,e&&e.implicit),n=this.condition.toHTML(e),i=Op(this.condition,r,e&&e.implicit);("all"===r||"OperatorNode"===this.condition.type||null!==i&&i<=t)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');var a=this.trueExpr.toHTML(e),o=Op(this.trueExpr,r,e&&e.implicit);("all"===r||"OperatorNode"===this.trueExpr.type||null!==o&&o<=t)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.falseExpr.toHTML(e),u=Op(this.falseExpr,r,e&&e.implicit);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==u&&u<=t)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+'<span class="math-operator math-conditional-operator">?</span>'+a+'<span class="math-operator math-conditional-operator">:</span>'+s}_toTex(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return(0,Gu.A)(t,"name",qp),t}),{isClass:!0,isNode:!0}),kp=t(2682),Pp={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{?}"},Up={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"},Lp={abs:{1:"\\left|${args[0]}\\right|"},add:{2:"\\left(${args[0]}".concat(Up.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(Up.dotDivide,"${args[1]}\\right)")},dotMultiply:{2:"\\left(${args[0]}".concat(Up.dotMultiply,"${args[1]}\\right)")},dotPow:{2:"\\left(${args[0]}".concat(Up.dotPow,"${args[1]}\\right)")},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:"\\left(e".concat(Up.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(Up.mod,"${args[1]}\\right)")},multiply:{2:"\\left(${args[0]}".concat(Up.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(Up.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(Up.subtract,"${args[1]}\\right)")},unaryMinus:{1:"".concat(Up.unaryMinus,"\\left(${args[0]}\\right)")},unaryPlus:{1:"".concat(Up.unaryPlus,"\\left(${args[0]}\\right)")},bitAnd:{2:"\\left(${args[0]}".concat(Up.bitAnd,"${args[1]}\\right)")},bitNot:{1:Up.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:"\\left(${args[0]}".concat(Up.bitOr,"${args[1]}\\right)")},bitXor:{2:"\\left(${args[0]}".concat(Up.bitXor,"${args[1]}\\right)")},leftShift:{2:"\\left(${args[0]}".concat(Up.leftShift,"${args[1]}\\right)")},rightArithShift:{2:"\\left(${args[0]}".concat(Up.rightArithShift,"${args[1]}\\right)")},rightLogShift:{2:"\\left(${args[0]}".concat(Up.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(Up.and,"${args[1]}\\right)")},not:{1:Up.not+"\\left(${args[0]}\\right)"},or:{2:"\\left(${args[0]}".concat(Up.or,"${args[1]}\\right)")},xor:{2:"\\left(${args[0]}".concat(Up.xor,"${args[1]}\\right)")},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:"\\left(${args[0]}\\right)".concat(Up.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(Up.pow,"{\\frac{1}{2}}")},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:"\\left(${args[0]}\\right)".concat(Up.transpose)},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:"\\left(${args[0]}\\right)".concat(Up.factorial)},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:"\\left(${args[0]}".concat(Up.equal,"${args[1]}\\right)")},larger:{2:"\\left(${args[0]}".concat(Up.larger,"${args[1]}\\right)")},largerEq:{2:"\\left(${args[0]}".concat(Up.largerEq,"${args[1]}\\right)")},smaller:{2:"\\left(${args[0]}".concat(Up.smaller,"${args[1]}\\right)")},smallerEq:{2:"\\left(${args[0]}".concat(Up.smallerEq,"${args[1]}\\right)")},unequal:{2:"\\left(${args[0]}".concat(Up.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(Up.to,"${args[1]}\\right)")},numeric:function(e,r){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(Pp.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)"}},jp={deg:"^\\circ"};function Hp(e){return kp(e,{preserveFormatting:!0})}function $p(e,r){return(r=void 0!==r&&r)?Y(jp,e)?jp[e]:"\\mathrm{"+Hp(e)+"}":Y(Pp,e)?Pp[e]:Hp(e)}var Gp="ConstantNode",Vp=Oe(Gp,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){super(),this.value=e}get type(){return Gp}get isConstantNode(){return!0}_compile(e,r){var t=this.value;return function(){return t}}forEach(e){}map(e){return this.clone()}clone(){return new t(this.value)}_toString(e){return Jt(this.value,e)}_toHTML(e){var r=this._toString(e);switch(G(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+r+"</span>";case"string":return'<span class="math-string">'+r+"</span>";case"boolean":return'<span class="math-boolean">'+r+"</span>";case"null":return'<span class="math-null-symbol">'+r+"</span>";case"undefined":return'<span class="math-undefined">'+r+"</span>";default:return'<span class="math-symbol">'+r+"</span>"}}toJSON(){return{mathjs:Gp,value:this.value}}static fromJSON(e){return new t(e.value)}_toTex(e){var r=this._toString(e),t=G(this.value);switch(t){case"string":return"\\mathtt{"+Hp(r)+"}";case"number":case"BigNumber":if(!("BigNumber"===t?this.value.isFinite():isFinite(this.value)))return this.value.valueOf()<0?"-\\infty":"\\infty";var n=r.toLowerCase().indexOf("e");return-1!==n?r.substring(0,n)+"\\cdot10^{"+r.substring(n+1)+"}":r;case"Fraction":return this.value.toLatex();default:return r}}}return(0,Gu.A)(t,"name",Gp),t}),{isClass:!0,isNode:!0}),Zp="FunctionAssignmentNode",Wp=Oe(Zp,["typed","Node"],(e=>{var{typed:r,Node:t}=e;function n(e,r,t){var n=Op(e,r,t),i=Op(e.expr,r,t);return"all"===r||null!==i&&i<=n}class i extends t{constructor(e,r,t){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(r))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!R(t))throw new TypeError('Node expected for parameter "expr"');if(xp.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');var n=new Set;for(var i of r){var a="string"==typeof i?i:i.name;if(n.has(a))throw new Error('Duplicate parameter name "'.concat(a,'"'));n.add(a)}this.name=e,this.params=r.map((function(e){return e&&e.name||e})),this.types=r.map((function(e){return e&&e.type||"any"})),this.expr=t}get type(){return Zp}get isFunctionAssignmentNode(){return!0}_compile(e,t){var n=Object.create(t);Nn(this.params,(function(e){n[e]=!0}));var i=this.expr._compile(e,n),a=this.name,o=this.params,s=An(this.types,","),u=a+"("+An(this.params,", ")+")";return function(e,t,n){var l={};l[s]=function(){for(var r=Object.create(t),a=0;a<o.length;a++)r[o[a]]=arguments[a];return i(e,r,n)};var c=r(a,l);return c.syntax=u,e.set(a,c),c}}forEach(e){e(this.expr,"expr",this)}map(e){var r=this._ifNode(e(this.expr,"expr",this));return new i(this.name,this.params.slice(0),r)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=this.expr.toString(e);return n(this,r,e&&e.implicit)&&(t="("+t+")"),this.name+"("+this.params.join(", ")+") = "+t}toJSON(){var e=this.types;return{mathjs:Zp,name:this.name,params:this.params.map((function(r,t){return{name:r,type:e[t]}})),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",t=[],i=0;i<this.params.length;i++)t.push('<span class="math-symbol math-parameter">'+Kt(this.params[i])+"</span>");var a=this.expr.toHTML(e);return n(this,r,e&&e.implicit)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+Kt(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+a}_toTex(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=this.expr.toTex(e);return n(this,r,e&&e.implicit)&&(t="\\left(".concat(t,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map($p).join(",")+"\\right)="+t}}return(0,Gu.A)(i,"name",Zp),i}),{isClass:!0,isNode:!0}),Yp="IndexNode",Jp=Oe(Yp,["Node","size"],(e=>{var{Node:r,size:t}=e;class n extends r{constructor(e,r){if(super(),this.dimensions=e,this.dotNotation=r||!1,!Array.isArray(e)||!e.every(R))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return Yp}get isIndexNode(){return!0}_compile(e,r){var n=wn(this.dimensions,(function(n,i){if(n.filter((e=>e.isSymbolNode&&"end"===e.name)).length>0){var a=Object.create(r);a.end=!0;var o=n._compile(e,a);return function(e,r,n){if(!p(n)&&!f(n)&&!c(n))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+G(n));var a=t(n).valueOf(),s=Object.create(r);return s.end=a[i],o(e,s,n)}}return n._compile(e,r)})),i=Fe(e,"index");return function(e,r,t){var a=wn(n,(function(n){return n(e,r,t)}));return i(...a)}}forEach(e){for(var r=0;r<this.dimensions.length;r++)e(this.dimensions[r],"dimensions["+r+"]",this)}map(e){for(var r=[],t=0;t<this.dimensions.length;t++)r[t]=this._ifNode(e(this.dimensions[t],"dimensions["+t+"]",this));return new n(r,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&_(this.dimensions[0])&&"string"==typeof this.dimensions[0].value}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:Yp,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new n(e.dimensions,e.dotNotation)}_toHTML(e){for(var r=[],t=0;t<this.dimensions.length;t++)r[t]=this.dimensions[t].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+Kt(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){var r=this.dimensions.map((function(r){return r.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+r.join(",")+"}"}}return(0,Gu.A)(n,"name",Yp),n}),{isClass:!0,isNode:!0}),Xp="ObjectNode",Qp=Oe(Xp,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every((function(r){return R(e[r])}))))throw new TypeError("Object containing Nodes expected")}get type(){return Xp}get isObjectNode(){return!0}_compile(e,r){var t={};for(var n in this.properties)if(Y(this.properties,n)){var i=Xt(n),a=JSON.parse(i),o=Fe(this.properties,n);t[a]=o._compile(e,r)}return function(e,r,n){var i={};for(var a in t)Y(t,a)&&(i[a]=t[a](e,r,n));return i}}forEach(e){for(var r in this.properties)Y(this.properties,r)&&e(this.properties[r],"properties["+Xt(r)+"]",this)}map(e){var r={};for(var n in this.properties)Y(this.properties,n)&&(r[n]=this._ifNode(e(this.properties[n],"properties["+Xt(n)+"]",this)));return new t(r)}clone(){var e={};for(var r in this.properties)Y(this.properties,r)&&(e[r]=this.properties[r]);return new t(e)}_toString(e){var r=[];for(var t in this.properties)Y(this.properties,t)&&r.push(Xt(t)+": "+this.properties[t].toString(e));return"{"+r.join(", ")+"}"}toJSON(){return{mathjs:Xp,properties:this.properties}}static fromJSON(e){return new t(e.properties)}_toHTML(e){var r=[];for(var t in this.properties)Y(this.properties,t)&&r.push('<span class="math-symbol math-property">'+Kt(t)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[t].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(e){var r=[];for(var t in this.properties)Y(this.properties,t)&&r.push("\\mathbf{"+t+":} & "+this.properties[t].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+r.join("\n")+"\\end{array}\\right\\}"}}return(0,Gu.A)(t,"name",Xp),t}),{isClass:!0,isNode:!0});function Kp(e,r){return new Pe(e,new ke(r),new Set(Object.keys(r)))}var em="OperatorNode",rm=Oe(em,["Node"],(e=>{var{Node:r}=e;function t(e,r){var n=e;if("auto"===r)for(;U(n);)n=n.content;return!!_(n)||!!P(n)&&t(n.args[0],r)}function n(e,r,n,i,a){var o,s=Op(e,r,n),u=Tp(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 l=Op(i[0],r,n,e);if(a&&null!==l){var c,f;if("keep"===r?(c=i[0].getIdentifier(),f=e.getIdentifier()):(c=i[0].getContent().getIdentifier(),f=e.getContent().getIdentifier()),!1===Cp[s][f].latexLeftParens){o=[!1];break}if(!1===Cp[l][c].latexParens){o=[!1];break}}if(null===l){o=[!1];break}if(l<=s){o=[!0];break}o=[!1];break;case 2:var p,m,d=Op(i[0],r,n,e),h=Fp(e,i[0],r);p=null!==d&&(d===s&&"right"===u&&!h||d<s);var g,y,v,x=Op(i[1],r,n,e),b=Fp(e,i[1],r);if(m=null!==x&&(x===s&&"left"===u&&!b||x<s),a)"keep"===r?(g=e.getIdentifier(),y=e.args[0].getIdentifier(),v=e.args[1].getIdentifier()):(g=e.getContent().getIdentifier(),y=e.args[0].getContent().getIdentifier(),v=e.args[1].getContent().getIdentifier()),null!==d&&(!1===Cp[s][g].latexLeftParens&&(p=!1),!1===Cp[d][y].latexParens&&(p=!1)),null!==x&&(!1===Cp[s][g].latexRightParens&&(m=!1),!1===Cp[x][v].latexParens&&(m=!1));o=[p,m];break;default:"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()||(o=i.map((function(t){var i=Op(t,r,n,e),a=Fp(e,t,r),o=Tp(t,r);return null!==i&&(s===i&&u===o&&!a||i<s)})))}if(i.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==r&&"hide"===n)for(var w=1;w<o.length;++w)!t(i[w],r)||o[w-1]||"keep"===r&&U(i[w-1])||(o[w]=!0);return o}class i extends r{constructor(e,r,t,n,i){if(super(),"string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof r)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(t)||!t.every(R))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===n,this.isPercentage=!0===i,this.op=e,this.fn=r,this.args=t||[]}get type(){return em}get isOperatorNode(){return!0}_compile(e,r){if("string"!=typeof this.fn||!Ie(e,this.fn))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var t=Fe(e,this.fn),n=wn(this.args,(function(t){return t._compile(e,r)}));if("function"==typeof t&&!0===t.rawArgs){var i=this.args;return function(r,n,a){return t(i,e,Kp(r,n))}}if(1===n.length){var a=n[0];return function(e,r,n){return t(a(e,r,n))}}if(2===n.length){var o=n[0],s=n[1];return function(e,r,n){return t(o(e,r,n),s(e,r,n))}}return function(e,r,i){return t.apply(null,wn(n,(function(t){return t(e,r,i)})))}}forEach(e){for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)}map(e){for(var r=[],t=0;t<this.args.length;t++)r[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new i(this.op,this.fn,r,this.implicit,this.isPercentage)}clone(){return new i(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return 1===this.args.length}isBinary(){return 2===this.args.length}_toString(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,r,t,i,!1);if(1===i.length){var o=Tp(this,r),s=i[0].toString(e);a[0]&&(s="("+s+")");var u=/[a-zA-Z]+/.test(this.op);return"right"===o?this.op+(u?" ":"")+s:"left"===o?s+(u?" ":"")+this.op:s+this.op}if(2===i.length){var l=i[0].toString(e),c=i[1].toString(e);return a[0]&&(l="("+l+")"),a[1]&&(c="("+c+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?l+" "+c:l+" "+this.op+" "+c}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var f=i.map((function(r,t){return r=r.toString(e),a[t]&&(r="("+r+")"),r}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?f.join(" "):f.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:em,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new i(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,r,t,i,!1);if(1===i.length){var o=Tp(this,r),s=i[0].toHTML(e);return a[0]&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===o?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+Kt(this.op)+"</span>"+s:s+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+Kt(this.op)+"</span>"}if(2===i.length){var u=i[0].toHTML(e),l=i[1].toHTML(e);return a[0]&&(u='<span class="math-parenthesis math-round-parenthesis">(</span>'+u+'<span class="math-parenthesis math-round-parenthesis">)</span>'),a[1]&&(l='<span class="math-parenthesis math-round-parenthesis">(</span>'+l+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?u+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+l:u+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Kt(this.op)+"</span>"+l}var c=i.map((function(r,t){return r=r.toHTML(e),a[t]&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===t?c.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):c.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Kt(this.op)+"</span>"):'<span class="math-function">'+Kt(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+c.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}_toTex(e){var r=e&&e.parenthesis?e.parenthesis:"keep",t=e&&e.implicit?e.implicit:"hide",i=this.args,a=n(this,r,t,i,!0),o=Up[this.fn];if(o=void 0===o?this.op:o,1===i.length){var s=Tp(this,r),u=i[0].toTex(e);return a[0]&&(u="\\left(".concat(u,"\\right)")),"right"===s?o+u:u+o}if(2===i.length){var l=i[0],c=l.toTex(e);a[0]&&(c="\\left(".concat(c,"\\right)"));var f,p=i[1].toTex(e);switch(a[1]&&(p="\\left(".concat(p,"\\right)")),f="keep"===r?l.getIdentifier():l.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+c+"}{"+p+"}";case"OperatorNode:pow":switch(c="{"+c+"}",p="{"+p+"}",f){case"ConditionalNode":case"OperatorNode:divide":c="\\left(".concat(c,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===t)return c+"~"+p}return c+o+p}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var m=i.map((function(r,t){return r=r.toTex(e),a[t]&&(r="\\left(".concat(r,"\\right)")),r}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===t?m.join("~"):m.join(o)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(r){return r.toTex(e)})).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return(0,Gu.A)(i,"name",em),i}),{isClass:!0,isNode:!0}),tm="ParenthesisNode",nm=Oe(tm,["Node"],(e=>{var{Node:r}=e;class t extends r{constructor(e){if(super(),!R(e))throw new TypeError('Node expected for parameter "content"');this.content=e}get type(){return tm}get isParenthesisNode(){return!0}_compile(e,r){return this.content._compile(e,r)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){var r=e(this.content,"content",this);return new t(r)}clone(){return new t(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:tm,content:this.content}}static fromJSON(e){return new t(e.content)}_toHTML(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(e)}_toTex(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"\\left(".concat(this.content.toTex(e),"\\right)"):this.content.toTex(e)}}return(0,Gu.A)(t,"name",tm),t}),{isClass:!0,isNode:!0}),im="RangeNode",am=Oe(im,["Node"],(e=>{var{Node:r}=e;function t(e,r,t){var n=Op(e,r,t),i={},a=Op(e.start,r,t);if(i.start=null!==a&&a<=n||"all"===r,e.step){var o=Op(e.step,r,t);i.step=null!==o&&o<=n||"all"===r}var s=Op(e.end,r,t);return i.end=null!==s&&s<=n||"all"===r,i}class n extends r{constructor(e,r,t){if(super(),!R(e))throw new TypeError("Node expected");if(!R(r))throw new TypeError("Node expected");if(t&&!R(t))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=r,this.step=t||null}get type(){return im}get isRangeNode(){return!0}needsEnd(){return this.filter((function(e){return H(e)&&"end"===e.name})).length>0}_compile(e,r){var t=e.range,n=this.start._compile(e,r),i=this.end._compile(e,r);if(this.step){var a=this.step._compile(e,r);return function(e,r,o){return t(n(e,r,o),i(e,r,o),a(e,r,o))}}return function(e,r,a){return t(n(e,r,a),i(e,r,a))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new n(this._ifNode(e(this.start,"start",this)),this._ifNode(e(this.end,"end",this)),this.step&&this._ifNode(e(this.step,"step",this)))}clone(){return new n(this.start,this.end,this.step&&this.step)}_toString(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toString(e);if(n.start&&(i="("+i+")"),r=i,this.step){var a=this.step.toString(e);n.step&&(a="("+a+")"),r+=":"+a}var o=this.end.toString(e);return n.end&&(o="("+o+")"),r+=":"+o}toJSON(){return{mathjs:im,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new n(e.start,e.end,e.step)}_toHTML(e){var r,n=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),i=this.start.toHTML(e);if(n.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r=i,this.step){var a=this.step.toHTML(e);n.step&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+a}var o=this.end.toHTML(e);return n.end&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),r+='<span class="math-operator math-range-operator">:</span>'+o}_toTex(e){var r=t(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit),n=this.start.toTex(e);if(r.start&&(n="\\left(".concat(n,"\\right)")),this.step){var i=this.step.toTex(e);r.step&&(i="\\left(".concat(i,"\\right)")),n+=":"+i}var a=this.end.toTex(e);return r.end&&(a="\\left(".concat(a,"\\right)")),n+=":"+a}}return(0,Gu.A)(n,"name",im),n}),{isClass:!0,isNode:!0}),om="RelationalNode",sm=Oe(om,["Node"],(e=>{var{Node:r}=e,t={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends r{constructor(e,r){if(super(),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(r))throw new TypeError("Parameter params must be an array");if(e.length!==r.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=r}get type(){return om}get isRelationalNode(){return!0}_compile(e,r){var t=this,n=this.params.map((t=>t._compile(e,r)));return function(r,i,a){for(var o,s=n[0](r,i,a),u=0;u<t.conditionals.length;u++){if(o=s,s=n[u+1](r,i,a),!Fe(e,t.conditionals[u])(o,s))return!1}return!0}}forEach(e){this.params.forEach(((r,t)=>e(r,"params["+t+"]",this)),this)}map(e){return new n(this.conditionals.slice(),this.params.map(((r,t)=>this._ifNode(e(r,"params["+t+"]",this))),this))}clone(){return new n(this.conditionals,this.params)}_toString(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",n=Op(this,r,e&&e.implicit),i=this.params.map((function(t,i){var a=Op(t,r,e&&e.implicit);return"all"===r||null!==a&&a<=n?"("+t.toString(e)+")":t.toString(e)})),a=i[0],o=0;o<this.conditionals.length;o++)a+=" "+t[this.conditionals[o]],a+=" "+i[o+1];return a}toJSON(){return{mathjs:om,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new n(e.conditionals,e.params)}_toHTML(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",n=Op(this,r,e&&e.implicit),i=this.params.map((function(t,i){var a=Op(t,r,e&&e.implicit);return"all"===r||null!==a&&a<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+t.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':t.toHTML(e)})),a=i[0],o=0;o<this.conditionals.length;o++)a+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+Kt(t[this.conditionals[o]])+"</span>"+i[o+1];return a}_toTex(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",t=Op(this,r,e&&e.implicit),n=this.params.map((function(n,i){var a=Op(n,r,e&&e.implicit);return"all"===r||null!==a&&a<=t?"\\left("+n.toTex(e)+"\right)":n.toTex(e)})),i=n[0],a=0;a<this.conditionals.length;a++)i+=Up[this.conditionals[a]]+n[a+1];return i}}return(0,Gu.A)(n,"name",om),n}),{isClass:!0,isNode:!0}),um=Oe("SymbolNode",["math","?Unit","Node"],(e=>{var{math:r,Unit:t,Node:n}=e;function i(e){return!!t&&t.isValuelessUnit(e)}class a extends n{constructor(e){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');this.name=e}get type(){return"SymbolNode"}get isSymbolNode(){return!0}_compile(e,r){var n=this.name;if(!0===r[n])return function(e,r,t){return Fe(r,n)};if(n in e)return function(r,t,i){return r.has(n)?r.get(n):Fe(e,n)};var o=i(n);return function(e,r,i){return e.has(n)?e.get(n):o?new t(null,n):a.onUndefinedSymbol(n)}}forEach(e){}map(e){return this.clone()}static onUndefinedSymbol(e){throw new Error("Undefined symbol "+e)}clone(){return new a(this.name)}_toString(e){return this.name}_toHTML(e){var r=Kt(this.name);return"true"===r||"false"===r?'<span class="math-symbol math-boolean">'+r+"</span>":"i"===r?'<span class="math-symbol math-imaginary-symbol">'+r+"</span>":"Infinity"===r?'<span class="math-symbol math-infinity-symbol">'+r+"</span>":"NaN"===r?'<span class="math-symbol math-nan-symbol">'+r+"</span>":"null"===r?'<span class="math-symbol math-null-symbol">'+r+"</span>":"undefined"===r?'<span class="math-symbol math-undefined-symbol">'+r+"</span>":'<span class="math-symbol">'+r+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){var t=!1;void 0===r[this.name]&&i(this.name)&&(t=!0);var n=$p(this.name,t);return"\\"===n[0]?n:" "+n}}return a}),{isClass:!0,isNode:!0}),lm="FunctionNode",cm=Oe(lm,["math","Node","SymbolNode"],(e=>{var r,{math:t,Node:n,SymbolNode:i}=e,a=e=>Jt(e,{truncate:78});function o(e,r,t){for(var n,i="",a=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi,o=0;null!==(n=a.exec(e));)if(i+=e.substring(o,n.index),o=n.index,"$$"===n[0])i+="$",o++;else{o+=n[0].length;var s=r[n[1]];if(!s)throw new ReferenceError("Template: Property "+n[1]+" does not exist.");if(void 0===n[2])switch(typeof s){case"string":i+=s;break;case"object":if(R(s))i+=s.toTex(t);else{if(!Array.isArray(s))throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes");i+=s.map((function(e,r){if(R(e))return e.toTex(t);throw new TypeError("Template: "+n[1]+"["+r+"] is not a Node.")})).join(",")}break;default:throw new TypeError("Template: "+n[1]+" has to be a Node, String or array of Nodes")}else{if(!R(s[n[2]]&&s[n[2]]))throw new TypeError("Template: "+n[1]+"["+n[2]+"] is not a Node.");i+=s[n[2]].toTex(t)}}return i+=e.slice(o)}class s extends n{constructor(e,r){if(super(),"string"==typeof e&&(e=new i(e)),!R(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(r)||!r.every(R))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=r||[]}get name(){return this.fn.name||""}get type(){return lm}get isFunctionNode(){return!0}_compile(e,r){var t=this.args.map((t=>t._compile(e,r)));if(!H(this.fn)){if(C(this.fn)&&q(this.fn.index)&&this.fn.index.isObjectProperty()){var n=this.fn.object._compile(e,r),i=this.fn.index.getObjectProperty(),o=this.args;return function(r,a,s){var u=n(r,a,s),l=function(e,r){if(!Ie(e,r))throw new Error('No access to method "'+r+'"');return e[r]}(u,i);if(null!=l&&l.rawArgs)return l(o,e,Kp(r,a));var c=t.map((e=>e(r,a,s)));return l.apply(u,c)}}var u=this.fn.toString(),l=this.fn._compile(e,r),c=this.args;return function(r,n,i){var o=l(r,n,i);if("function"!=typeof o)throw new TypeError("Expression '".concat(u,"' did not evaluate to a function; value is:")+"\n ".concat(a(o)));if(o.rawArgs)return o(c,e,Kp(r,n));var s=t.map((e=>e(r,n,i)));return o.apply(o,s)}}var f=this.fn.name;if(r[f]){var p=this.args;return function(r,n,i){var o=Fe(n,f);if("function"!=typeof o)throw new TypeError("Argument '".concat(f,"' was not a function; received: ").concat(a(o)));if(o.rawArgs)return o(p,e,Kp(r,n));var s=t.map((e=>e(r,n,i)));return o.apply(o,s)}}var m=f in e?Fe(e,f):void 0,d="function"==typeof m&&!0===m.rawArgs,h=r=>{var t;if(r.has(f))t=r.get(f);else{if(!(f in e))return s.onUndefinedFunction(f);t=Fe(e,f)}if("function"==typeof t)return t;throw new TypeError("'".concat(f,"' is not a function; its value is:\n ").concat(a(t)))};if(d){var g=this.args;return function(r,t,n){return h(r)(g,e,Kp(r,t))}}switch(t.length){case 0:return function(e,r,t){return h(e)()};case 1:return function(e,r,n){return h(e)((0,t[0])(e,r,n))};case 2:return function(e,r,n){var i=h(e),a=t[0],o=t[1];return i(a(e,r,n),o(e,r,n))};default:return function(e,r,n){return h(e)(...t.map((t=>t(e,r,n))))}}}forEach(e){e(this.fn,"fn",this);for(var r=0;r<this.args.length;r++)e(this.args[r],"args["+r+"]",this)}map(e){for(var r=this._ifNode(e(this.fn,"fn",this)),t=[],n=0;n<this.args.length;n++)t[n]=this._ifNode(e(this.args[n],"args["+n+"]",this));return new s(r,t)}clone(){return new s(this.fn,this.args.slice(0))}toString(e){var r,t=this.fn.toString(e);return e&&"object"==typeof e.handler&&Y(e.handler,t)&&(r=e.handler[t](this,e)),void 0!==r?r:super.toString(e)}_toString(e){var r=this.args.map((function(r){return r.toString(e)}));return(I(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+r.join(", ")+")"}toJSON(){return{mathjs:lm,fn:this.fn,args:this.args}}_toHTML(e){var r=this.args.map((function(r){return r.toHTML(e)}));return'<span class="math-function">'+Kt(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(e){var r;return e&&"object"==typeof e.handler&&Y(e.handler,this.name)&&(r=e.handler[this.name](this,e)),void 0!==r?r:super.toTex(e)}_toTex(e){var r,n,i=this.args.map((function(r){return r.toTex(e)}));switch(Lp[this.name]&&(r=Lp[this.name]),!t[this.name]||"function"!=typeof t[this.name].toTex&&"object"!=typeof t[this.name].toTex&&"string"!=typeof t[this.name].toTex||(r=t[this.name].toTex),typeof r){case"function":n=r(this,e);break;case"string":n=o(r,this,e);break;case"object":switch(typeof r[i.length]){case"function":n=r[i.length](this,e);break;case"string":n=o(r[i.length],this,e)}}return void 0!==n?n:o("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return r=s,(0,Gu.A)(s,"name",lm),(0,Gu.A)(s,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),(0,Gu.A)(s,"fromJSON",(function(e){return new r(e.fn,e.args)})),s}),{isClass:!0,isNode:!0}),fm="parse",pm=Oe(fm,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(e=>{var{typed:r,numeric:t,config:i,AccessorNode:a,ArrayNode:o,AssignmentNode:s,BlockNode:u,ConditionalNode:l,ConstantNode:c,FunctionAssignmentNode:f,FunctionNode:p,IndexNode:m,ObjectNode:d,OperatorNode:h,ParenthesisNode:g,RangeNode:y,RelationalNode:v,SymbolNode:x}=e,b=r(fm,{string:function(e){return j(e,{})},"Array | Matrix":function(e){return w(e,{})},"string, Object":function(e,r){return j(e,void 0!==r.nodes?r.nodes:{})},"Array | Matrix, Object":w});function w(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=void 0!==r.nodes?r.nodes:{};return Hn(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return j(e,t)}))}var N={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},D={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function O(e,r){return e.expression.substr(e.index,r)}function T(e){return O(e,1)}function F(e){e.index++}function I(e){return e.expression.charAt(e.index-1)}function q(e){return e.expression.charAt(e.index+1)}function R(e){for(e.tokenType=N.NULL,e.token="",e.comment="";;){if("#"===T(e))for(;"\n"!==T(e)&&""!==T(e);)e.comment+=T(e),F(e);if(!b.isWhitespace(T(e),e.nestingLevel))break;F(e)}if(""!==T(e)){if("\n"===T(e)&&!e.nestingLevel)return e.tokenType=N.DELIMITER,e.token=T(e),void F(e);var r=T(e),t=O(e,2),n=O(e,3);if(3===n.length&&D[n])return e.tokenType=N.DELIMITER,e.token=n,F(e),F(e),void F(e);if(2===t.length&&D[t])return e.tokenType=N.DELIMITER,e.token=t,F(e),void F(e);if(D[r])return e.tokenType=N.DELIMITER,e.token=r,void F(e);if(b.isDigitDot(r)){e.tokenType=N.NUMBER;var i=O(e,2);if("0b"===i||"0o"===i||"0x"===i){for(e.token+=T(e),F(e),e.token+=T(e),F(e);b.isHexDigit(T(e));)e.token+=T(e),F(e);if("."===T(e))for(e.token+=".",F(e);b.isHexDigit(T(e));)e.token+=T(e),F(e);else if("i"===T(e))for(e.token+="i",F(e);b.isDigit(T(e));)e.token+=T(e),F(e);return}if("."===T(e)){if(e.token+=T(e),F(e),!b.isDigit(T(e)))return void(e.tokenType=N.DELIMITER)}else{for(;b.isDigit(T(e));)e.token+=T(e),F(e);b.isDecimalMark(T(e),q(e))&&(e.token+=T(e),F(e))}for(;b.isDigit(T(e));)e.token+=T(e),F(e);if("E"===T(e)||"e"===T(e))if(b.isDigit(q(e))||"-"===q(e)||"+"===q(e)){if(e.token+=T(e),F(e),"+"!==T(e)&&"-"!==T(e)||(e.token+=T(e),F(e)),!b.isDigit(T(e)))throw fe(e,'Digit expected, got "'+T(e)+'"');for(;b.isDigit(T(e));)e.token+=T(e),F(e);if(b.isDecimalMark(T(e),q(e)))throw fe(e,'Digit expected, got "'+T(e)+'"')}else if("."===q(e))throw F(e),fe(e,'Digit expected, got "'+T(e)+'"')}else{if(!b.isAlpha(T(e),I(e),q(e))){for(e.tokenType=N.UNKNOWN;""!==T(e);)e.token+=T(e),F(e);throw fe(e,'Syntax error in part "'+e.token+'"')}for(;b.isAlpha(T(e),I(e),q(e))||b.isDigit(T(e));)e.token+=T(e),F(e);Y(E,e.token)?e.tokenType=N.DELIMITER:e.tokenType=N.SYMBOL}}else e.tokenType=N.DELIMITER}function k(e){do{R(e)}while("\n"===e.token)}function U(e){e.nestingLevel++}function L(e){e.nestingLevel--}function j(e,r){var t={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:N.NULL,nestingLevel:0,conditionalLevel:null};(0,n.A)(t,{expression:e,extraNodes:r}),R(t);var i=function(e){var r,t,n=[];""!==e.token&&"\n"!==e.token&&";"!==e.token&&(r=$(e),e.comment&&(r.comment=e.comment));for(;"\n"===e.token||";"===e.token;)0===n.length&&r&&(t=";"!==e.token,n.push({node:r,visible:t})),R(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(r=$(e),e.comment&&(r.comment=e.comment),t=";"!==e.token,n.push({node:r,visible:t}));return n.length>0?new u(n):(r||(r=new c(void 0),e.comment&&(r.comment=e.comment)),r)}(t);if(""!==t.token)throw t.tokenType===N.DELIMITER?pe(t,"Unexpected operator "+t.token):fe(t,'Unexpected part "'+t.token+'"');return i}function $(e){var r,t,n,i,a=function(e){var r=function(e){var r=G(e);for(;"or"===e.token;)k(e),r=new h("or","or",[r,G(e)]);return r}(e);for(;"?"===e.token;){var t=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,k(e);var n=r,i=$(e);if(":"!==e.token)throw fe(e,"False part of conditional expression expected");e.conditionalLevel=null,k(e);var a=$(e);r=new l(n,i,a),e.conditionalLevel=t}return r}(e);if("="===e.token){if(H(a))return r=a.name,k(e),n=$(e),new s(new x(r),n);if(C(a))return k(e),n=$(e),new s(a.object,a.index,n);if(z(a)&&H(a.fn)&&(i=!0,t=[],r=a.name,a.args.forEach((function(e,r){H(e)?t[r]=e.name:i=!1})),i))return k(e),n=$(e),new f(r,t,n);throw fe(e,"Invalid left hand side of assignment operator =")}return a}function G(e){for(var r=V(e);"xor"===e.token;)k(e),r=new h("xor","xor",[r,V(e)]);return r}function V(e){for(var r=Z(e);"and"===e.token;)k(e),r=new h("and","and",[r,Z(e)]);return r}function Z(e){for(var r=W(e);"|"===e.token;)k(e),r=new h("|","bitOr",[r,W(e)]);return r}function W(e){for(var r=J(e);"^|"===e.token;)k(e),r=new h("^|","bitXor",[r,J(e)]);return r}function J(e){for(var r=X(e);"&"===e.token;)k(e),r=new h("&","bitAnd",[r,X(e)]);return r}function X(e){for(var r=[Q(e)],t=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};Y(n,e.token);){var i={name:e.token,fn:n[e.token]};t.push(i),k(e),r.push(Q(e))}return 1===r.length?r[0]:2===r.length?new h(t[0].name,t[0].fn,r):new v(t.map((e=>e.fn)),r)}function Q(e){var r,t,n,i;r=K(e);for(var a={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};Y(a,e.token);)n=a[t=e.token],k(e),i=[r,K(e)],r=new h(t,n,i);return r}function K(e){var r,t,n,i;r=ee(e);for(var a={to:"to",in:"to"};Y(a,e.token);)n=a[t=e.token],k(e),"in"===t&&""===e.token?r=new h("*","multiply",[r,new x("in")],!0):(i=[r,ee(e)],r=new h(t,n,i));return r}function ee(e){var r,t=[];if(r=":"===e.token?new c(1):re(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(t.push(r);":"===e.token&&t.length<3;)k(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?t.push(new x("end")):t.push(re(e));r=3===t.length?new y(t[0],t[2],t[1]):new y(t[0],t[1])}return r}function re(e){var r,t,n,i;r=te(e);for(var a={"+":"add","-":"subtract"};Y(a,e.token);){n=a[t=e.token],k(e);var o=te(e);i=o.isPercentage?[r,new h("*","multiply",[r,o])]:[r,o],r=new h(t,n,i)}return r}function te(e){var r,t,n,i;t=r=ne(e);for(var a={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};Y(a,e.token);)i=a[n=e.token],k(e),t=ne(e),r=new h(n,i,[r,t]);return r}function ne(e){var r,t;for(t=r=ie(e);e.tokenType===N.SYMBOL||"in"===e.token&&_(r)||!(e.tokenType!==N.NUMBER||_(t)||P(t)&&"!"!==t.op)||"("===e.token;)t=ie(e),r=new h("*","multiply",[r,t],!0);return r}function ie(e){for(var r=ae(e),t=r,i=[];"/"===e.token&&B(t);){if(i.push((0,n.A)({},e)),k(e),e.tokenType!==N.NUMBER){(0,n.A)(e,i.pop());break}if(i.push((0,n.A)({},e)),k(e),e.tokenType!==N.SYMBOL&&"("!==e.token){i.pop(),(0,n.A)(e,i.pop());break}(0,n.A)(e,i.pop()),i.pop(),t=ae(e),r=new h("/","divide",[r,t])}return r}function ae(e){var r,t,n,i;r=oe(e);for(var a={"%":"mod",mod:"mod"};Y(a,e.token);)n=a[t=e.token],k(e),"%"===t&&e.tokenType===N.DELIMITER&&"("!==e.token?r=new h("/","divide",[r,new c(100)],!1,!0):(i=[r,oe(e)],r=new h(t,n,i));return r}function oe(e){var r,n,a,s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return Y(s,e.token)?(a=s[e.token],r=e.token,k(e),n=[oe(e)],new h(r,a,n)):function(e){var r,n,a,s;r=function(e){var r,n,a;r=function(e){var r=[];if(e.tokenType===N.SYMBOL&&Y(e.extraNodes,e.token)){var n=e.extraNodes[e.token];if(R(e),"("===e.token){if(r=[],U(e),R(e),")"!==e.token)for(r.push($(e));","===e.token;)R(e),r.push($(e));if(")"!==e.token)throw fe(e,"Parenthesis ) expected");L(e),R(e)}return new n(r)}return function(e){var r;if(e.tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in E)return r=e.token,R(e),se(e,Y(A,r)?new c(A[r]):S.includes(r)?new c(t(r,"number")):new x(r));return function(e){var r;if('"'===e.token||"'"===e.token)return r=ue(e,e.token),se(e,new c(r));return function(e){var r,n,a,s;if("["===e.token){if(U(e),R(e),"]"!==e.token){var u=le(e);if(";"===e.token){for(a=1,n=[u];";"===e.token;)R(e),"]"!==e.token&&(n[a]=le(e),a++);if("]"!==e.token)throw fe(e,"End of matrix ] expected");L(e),R(e),s=n[0].items.length;for(var l=1;l<a;l++)if(n[l].items.length!==s)throw pe(e,"Column dimensions mismatch ("+n[l].items.length+" !== "+s+")");r=new o(n)}else{if("]"!==e.token)throw fe(e,"End of matrix ] expected");L(e),R(e),r=u}}else L(e),R(e),r=new o([]);return se(e,r)}return function(e){if("{"===e.token){var r;U(e);var n={};do{if(R(e),"}"!==e.token){if('"'===e.token||"'"===e.token)r=ue(e,e.token);else{if(!(e.tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in E))throw fe(e,"Symbol or string expected as object key");r=e.token,R(e)}if(":"!==e.token)throw fe(e,"Colon : expected after object key");R(e),n[r]=$(e)}}while(","===e.token);if("}"!==e.token)throw fe(e,"Comma , or bracket } expected after object value");L(e),R(e);var a=new d(n);return a=se(e,a)}return function(e){var r;if(e.tokenType===N.NUMBER)return r=e.token,R(e),new c(t(r,i.number));return function(e){var r;if("("===e.token){if(U(e),R(e),r=$(e),")"!==e.token)throw fe(e,"Parenthesis ) expected");return L(e),R(e),r=se(e,r=new g(r))}return function(e){throw""===e.token?fe(e,"Unexpected end of expression"):fe(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e);var s={"!":"factorial","'":"ctranspose"};for(;Y(s,e.token);)a=s[n=e.token],R(e),r=se(e,r=new h(n,a,[r]));return r}(e),("^"===e.token||".^"===e.token)&&(a="^"===(n=e.token)?"pow":"dotPow",k(e),s=[r,oe(e)],r=new h(n,a,s));return r}(e)}function se(e,r,t){for(var n;("("===e.token||"["===e.token||"."===e.token)&&(!t||t.includes(e.token));)if(n=[],"("===e.token){if(!H(r)&&!C(r))return r;if(U(e),R(e),")"!==e.token)for(n.push($(e));","===e.token;)R(e),n.push($(e));if(")"!==e.token)throw fe(e,"Parenthesis ) expected");L(e),R(e),r=new p(r,n)}else if("["===e.token){if(U(e),R(e),"]"!==e.token)for(n.push($(e));","===e.token;)R(e),n.push($(e));if("]"!==e.token)throw fe(e,"Parenthesis ] expected");L(e),R(e),r=new a(r,new m(n))}else{if(R(e),!(e.tokenType===N.SYMBOL||e.tokenType===N.DELIMITER&&e.token in E))throw fe(e,"Property name expected after dot");n.push(new c(e.token)),R(e);r=new a(r,new m(n,!0))}return r}function ue(e,r){for(var t="";""!==T(e)&&T(e)!==r;)if("\\"===T(e)){F(e);var n=T(e),i=M[n];if(void 0!==i)t+=i,e.index+=1;else{if("u"!==n)throw fe(e,"Bad escape character \\".concat(n));var a=e.expression.slice(e.index+1,e.index+5);if(!/^[0-9A-Fa-f]{4}$/.test(a))throw fe(e,"Invalid unicode character \\u".concat(a));t+=String.fromCharCode(parseInt(a,16)),e.index+=5}}else t+=T(e),F(e);if(R(e),e.token!==r)throw fe(e,"End of string ".concat(r," expected"));return R(e),t}function le(e){for(var r=[$(e)],t=1;","===e.token;)R(e),"]"!==e.token&&";"!==e.token&&(r[t]=$(e),t++);return new o(r)}function ce(e){return e.index-e.token.length+1}function fe(e,r){var t=ce(e),n=new SyntaxError(r+" (char "+t+")");return n.char=t,n}function pe(e,r){var t=ce(e),n=new SyntaxError(r+" (char "+t+")");return n.char=t,n}return b.isAlpha=function(e,r,t){return b.isValidLatinOrGreek(e)||b.isValidMathSymbol(e,t)||b.isValidMathSymbol(r,e)},b.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},b.isValidMathSymbol=function(e,r){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(r)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(r)},b.isWhitespace=function(e,r){return" "===e||"\t"===e||"\n"===e&&r>0},b.isDecimalMark=function(e,r){return"."===e&&"/"!==r&&"*"!==r&&"^"!==r},b.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},b.isDigit=function(e){return e>="0"&&e<="9"},b.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},r.addConversion({from:"string",to:"Node",convert:b}),b})),mm="compile",dm=Oe(mm,["typed","parse"],(e=>{var{typed:r,parse:t}=e;return r(mm,{string:function(e){return t(e).compile()},"Array | Matrix":function(e){return Hn(e,(function(e){return t(e).compile()}))}})})),hm="evaluate",gm=Oe(hm,["typed","parse"],(e=>{var{typed:r,parse:t}=e;return r(hm,{string:function(e){var r=Le();return t(e).compile().evaluate(r)},"string, Map | Object":function(e,r){return t(e).compile().evaluate(r)},"Array | Matrix":function(e){var r=Le();return Hn(e,(function(e){return t(e).compile().evaluate(r)}))},"Array | Matrix, Map | Object":function(e,r){return Hn(e,(function(e){return t(e).compile().evaluate(r)}))}})})),ym=Oe("Parser",["evaluate"],(e=>{var{evaluate:r}=e;function t(){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:Le(),writable:!1})}return t.prototype.type="Parser",t.prototype.isParser=!0,t.prototype.evaluate=function(e){return r(e,this.scope)},t.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},t.prototype.getAll=function(){return function(e){if(e instanceof ke)return e.wrappedObject;var r={};for(var t of e.keys())_e(r,t,e.get(t));return r}(this.scope)},t.prototype.getAllAsMap=function(){return this.scope},t.prototype.set=function(e,r){return this.scope.set(e,r),r},t.prototype.remove=function(e){this.scope.delete(e)},t.prototype.clear=function(){this.scope.clear()},t}),{isClass:!0}),vm="parser",xm=Oe(vm,["typed","Parser"],(e=>{var{typed:r,Parser:t}=e;return r(vm,{"":function(){return new t}})})),bm=Oe("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(e=>{var{typed:r,matrix:t,abs:n,addScalar:i,divideScalar:a,multiplyScalar:o,subtractScalar:s,larger:u,equalScalar:l,unaryMinus:c,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return r("lup",{DenseMatrix:function(e){return d(e)},SparseMatrix:function(e){return h(e)},Array:function(e){var r=d(t(e));return{L:r.L.valueOf(),U:r.U.valueOf(),p:r.p}}});function d(e){var r,t,c,p=e._size[0],m=e._size[1],d=Math.min(p,m),h=V(e._data),g=[],y=[p,d],v=[],x=[d,m],b=[];for(r=0;r<p;r++)b[r]=r;for(t=0;t<m;t++){if(t>0)for(r=0;r<p;r++){var w=Math.min(r,t),N=0;for(c=0;c<w;c++)N=i(N,o(h[r][c],h[c][t]));h[r][t]=s(h[r][t],N)}var D=t,E=0,A=0;for(r=t;r<p;r++){var S=h[r][t],C=n(S);u(C,E)&&(D=r,E=C,A=S)}if(t!==D&&(b[t]=[b[D],b[D]=b[t]][0],f._swapRows(t,D,h)),t<p)for(r=t+1;r<p;r++){var M=h[r][t];l(M,0)||(h[r][t]=a(h[r][t],A))}}for(t=0;t<m;t++)for(r=0;r<p;r++)0===t&&(r<m&&(v[r]=[]),g[r]=[]),r<t?(r<m&&(v[r][t]=h[r][t]),t<p&&(g[r][t]=0)):r!==t?(r<m&&(v[r][t]=0),t<p&&(g[r][t]=h[r][t])):(r<m&&(v[r][t]=h[r][t]),t<p&&(g[r][t]=1));var O=new f({data:g,size:y}),T=new f({data:v,size:x}),F=[];for(r=0,d=b.length;r<d;r++)F[b[r]]=r;return{L:O,U:T,p:F,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}function h(e){var r,t,i,s=e._size[0],f=e._size[1],d=Math.min(s,f),h=e._values,g=e._index,y=e._ptr,v=[],x=[],b=[],w=[s,d],N=[],D=[],E=[],A=[d,f],S=[],C=[];for(r=0;r<s;r++)S[r]=r,C[r]=r;var M=function(){var e=new m;t<s&&(b.push(v.length),v.push(1),x.push(t)),E.push(N.length);var f=y[t],d=y[t+1];for(i=f;i<d;i++)r=g[i],e.set(S[r],h[i]);t>0&&e.forEach(0,t-1,(function(r,t){p._forEachRow(r,v,x,b,(function(n,i){n>r&&e.accumulate(n,c(o(i,t)))}))}));var M,O,T,F,_=t,B=e.get(t),I=n(B);e.forEach(t+1,s-1,(function(e,r){var t=n(r);u(t,I)&&(_=e,I=t,B=r)})),t!==_&&(p._swapRows(t,_,w[1],v,x,b),p._swapRows(t,_,A[1],N,D,E),e.swap(t,_),O=_,T=C[M=t],F=C[O],S[T]=O,S[F]=M,C[M]=F,C[O]=T),e.forEach(0,s-1,(function(e,r){e<=t?(N.push(r),D.push(e)):(r=a(r,B),l(r,0)||(v.push(r),x.push(e)))}))};for(t=0;t<f;t++)M();return E.push(N.length),b.push(v.length),{L:new p({values:v,index:x,ptr:b,size:w}),U:new p({values:N,index:D,ptr:E,size:A}),p:S,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}})),wm=Oe("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],(e=>{var{typed:r,matrix:t,zeros:i,identity:a,isZero:o,equal:s,sign:u,sqrt:l,conj:c,unaryMinus:f,addScalar:p,divideScalar:m,multiplyScalar:d,subtractScalar:h,complex:g}=e;return(0,n.A)(r("qr",{DenseMatrix:function(e){return v(e)},SparseMatrix:function(e){return function(e){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){var r=v(t(e));return{Q:r.Q.valueOf(),R:r.R.valueOf()}}}),{_denseQRimpl:y});function y(e){var r,t,n,g=e._size[0],y=e._size[1],v=a([g],"dense"),x=v._data,b=e.clone(),w=b._data,N=i([g],"");for(n=0;n<Math.min(y,g);++n){var D=w[n][n],E=f(s(D,0)?1:u(D)),A=c(E),S=0;for(r=n;r<g;r++)S=p(S,d(w[r][n],c(w[r][n])));var C=d(E,l(S));if(!o(C)){var M=h(D,C);for(N[n]=1,r=n+1;r<g;r++)N[r]=m(w[r][n],M);var O=f(c(m(M,C))),T=void 0;for(t=n;t<y;t++){for(T=0,r=n;r<g;r++)T=p(T,d(c(N[r]),w[r][t]));for(T=d(T,O),r=n;r<g;r++)w[r][t]=d(h(w[r][t],d(N[r],T)),A)}for(r=0;r<g;r++){for(T=0,t=n;t<g;t++)T=p(T,d(x[r][t],N[t]));for(T=d(T,O),t=n;t<g;++t)x[r][t]=m(h(x[r][t],d(T,c(N[t]))),A)}}}return{Q:v,R:b,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function v(e){var r=y(e),t=r.R._data;if(e._data.length>0)for(var n="Complex"===t[0][0].type?g(0):0,i=0;i<t.length;++i)for(var a=0;a<i&&a<(t[0]||[]).length;++a)t[i][a]=n;return r}}));function Nm(e,r,t,n,i,a,o){var s=0;for(t[o]=e;s>=0;){var u=t[o+s],l=t[n+u];-1===l?(s--,a[r++]=u):(t[n+u]=t[i+l],t[o+ ++s]=l)}return r}function Dm(e){return-e-2}var Em=Oe("csAmd",["add","multiply","transpose"],(e=>{var{add:r,multiply:t,transpose:n}=e;return function(e,o){if(!o||e<=0||e>3)return null;var s=o._size,u=s[0],l=s[1],c=0,f=Math.max(16,10*Math.sqrt(l)),p=function(e,i,a,o,s){var u=n(i);if(1===e&&o===a)return r(i,u);if(2===e){for(var l=u._index,c=u._ptr,f=0,p=0;p<a;p++){var m=c[p];if(c[p]=f,!(c[p+1]-m>s))for(var d=c[p+1];m<d;m++)l[f++]=l[m]}return c[a]=f,i=n(u),t(u,i)}return t(u,i)}(e,o,u,l,f=Math.min(l-2,f));!function(e,r,t){for(var n=e._values,i=e._index,a=e._ptr,o=e._size[1],s=0,u=0;u<o;u++){var l=a[u];for(a[u]=s;l<a[u+1];l++)r(i[l],u,n?n[l]:1,t)&&(i[s]=i[l],n&&(n[s]=n[l]),s++)}a[o]=s,i.splice(s,i.length-s),n&&n.splice(s,n.length-s)}(p,a,null);for(var m,d,h,g,y,v,x,b,w,N,D,E,A,S,C,M,O=p._index,T=p._ptr,F=T[l],_=[],B=[],I=l+1,z=2*(l+1),q=3*(l+1),R=4*(l+1),k=5*(l+1),P=6*(l+1),U=7*(l+1),L=_,j=function(e,r,t,n,a,o,s,u,l,c,f,p){for(var m=0;m<e;m++)t[n+m]=r[m+1]-r[m];t[n+e]=0;for(var d=0;d<=e;d++)t[a+d]=-1,o[d]=-1,t[s+d]=-1,t[u+d]=-1,t[l+d]=1,t[c+d]=1,t[f+d]=0,t[p+d]=t[n+d];var h=i(0,0,t,c,e);return t[f+e]=-2,r[e]=-1,t[c+e]=0,h}(l,T,B,0,q,L,z,U,I,P,R,k),H=function(e,r,t,n,i,a,o,s,u,l,c){for(var f=0,p=0;p<e;p++){var m=t[n+p];if(0===m)t[i+p]=-2,f++,r[p]=-1,t[a+p]=0;else if(m>o)t[s+p]=0,t[i+p]=-1,f++,r[p]=Dm(e),t[s+e]++;else{var d=t[u+m];-1!==d&&(l[d]=p),t[c+p]=t[u+m],t[u+m]=p}}return f}(l,T,B,k,R,P,f,I,q,L,z),$=0;H<l;){for(h=-1;$<l&&-1===(h=B[q+$]);$++);-1!==B[z+h]&&(L[B[z+h]]=-1),B[q+$]=B[z+h];var G=B[R+h],V=B[I+h];H+=V;var Z=0;B[I+h]=-V;var W=T[h],Y=0===G?W:F,J=Y;for(g=1;g<=G+1;g++){for(g>G?(v=h,x=W,b=B[0+h]-G):(x=T[v=O[W++]],b=B[0+v]),y=1;y<=b;y++)(w=B[I+(m=O[x++])])<=0||(Z+=w,B[I+m]=-w,O[J++]=m,-1!==B[z+m]&&(L[B[z+m]]=L[m]),-1!==L[m]?B[z+L[m]]=B[z+m]:B[q+B[k+m]]=B[z+m]);v!==h&&(T[v]=Dm(h),B[P+v]=0)}for(0!==G&&(F=J),B[k+h]=Z,T[h]=Y,B[0+h]=J-Y,B[R+h]=-2,j=i(j,c,B,P,l),N=Y;N<J;N++)if(!((D=B[R+(m=O[N])])<=0)){var X=j-(w=-B[I+m]);for(W=T[m],E=T[m]+D-1;W<=E;W++)B[P+(v=O[W])]>=j?B[P+v]-=w:0!==B[P+v]&&(B[P+v]=B[k+v]+X)}for(N=Y;N<J;N++){for(A=(E=T[m=O[N]])+B[R+m]-1,S=E,C=0,M=0,W=E;W<=A;W++)if(0!==B[P+(v=O[W])]){var Q=B[P+v]-j;Q>0?(M+=Q,O[S++]=v,C+=v):(T[v]=Dm(h),B[P+v]=0)}B[R+m]=S-E+1;var K=S,ee=E+B[0+m];for(W=A+1;W<ee;W++){var re=B[I+(d=O[W])];re<=0||(M+=re,O[S++]=d,C+=d)}0===M?(T[m]=Dm(h),Z-=w=-B[I+m],V+=w,H+=w,B[I+m]=0,B[R+m]=-1):(B[k+m]=Math.min(B[k+m],M),O[S]=O[K],O[K]=O[E],O[E]=h,B[0+m]=S-E+1,C=(C<0?-C:C)%l,B[z+m]=B[U+C],B[U+C]=m,L[m]=C)}for(B[k+h]=Z,j=i(j+(c=Math.max(c,Z)),c,B,P,l),N=Y;N<J;N++)if(!(B[I+(m=O[N])]>=0))for(m=B[U+(C=L[m])],B[U+C]=-1;-1!==m&&-1!==B[z+m];m=B[z+m],j++){for(b=B[0+m],D=B[R+m],W=T[m]+1;W<=T[m]+b-1;W++)B[P+O[W]]=j;var te=m;for(d=B[z+m];-1!==d;){var ne=B[0+d]===b&&B[R+d]===D;for(W=T[d]+1;ne&&W<=T[d]+b-1;W++)B[P+O[W]]!==j&&(ne=0);ne?(T[d]=Dm(m),B[I+m]+=B[I+d],B[I+d]=0,B[R+d]=-1,d=B[z+d],B[z+te]=d):(te=d,d=B[z+d])}}for(W=Y,N=Y;N<J;N++)(w=-B[I+(m=O[N])])<=0||(B[I+m]=w,M=B[k+m]+Z-w,-1!==B[q+(M=Math.min(M,l-H-w))]&&(L[B[q+M]]=m),B[z+m]=B[q+M],L[m]=-1,B[q+M]=m,$=Math.min($,M),B[k+m]=M,O[W++]=m);B[I+h]=V,0==(B[0+h]=W-Y)&&(T[h]=-1,B[P+h]=0),0!==G&&(F=W)}for(m=0;m<l;m++)T[m]=Dm(T[m]);for(d=0;d<=l;d++)B[q+d]=-1;for(d=l;d>=0;d--)B[I+d]>0||(B[z+d]=B[q+T[d]],B[q+T[d]]=d);for(v=l;v>=0;v--)B[I+v]<=0||-1!==T[v]&&(B[z+v]=B[q+T[v]],B[q+T[v]]=v);for(h=0,m=0;m<=l;m++)-1===T[m]&&(h=Nm(m,h,B,q,z,_,P));return _.splice(_.length-1,1),_};function i(e,r,t,n,i){if(e<2||e+r<0){for(var a=0;a<i;a++)0!==t[n+a]&&(t[n+a]=1);e=2}return e}function a(e,r){return e!==r}}));function Am(e,r,t,n,i,a,o){var s,u,l,c=0;if(e<=r||t[n+r]<=t[i+e])return-1;t[i+e]=t[n+r];var f=t[a+e];if(t[a+e]=r,-1===f)c=1,l=e;else{for(c=2,l=f;l!==t[o+l];l=t[o+l]);for(s=f;s!==l;s=u)u=t[o+s],t[o+s]=l}return{jleaf:c,q:l}}var Sm=Oe("csCounts",["transpose"],(e=>{var{transpose:r}=e;return function(e,t,n,i){if(!e||!t||!n)return null;var a,o,s,u,l,c,f,p=e._size,m=p[0],d=p[1],h=4*d+(i?d+m+1:0),g=[],y=d,v=2*d,x=3*d,b=4*d,w=5*d+1;for(s=0;s<h;s++)g[s]=-1;var N=[],D=r(e),E=D._index,A=D._ptr;for(s=0;s<d;s++)for(N[o=n[s]]=-1===g[x+o]?1:0;-1!==o&&-1===g[x+o];o=t[o])g[x+o]=s;if(i){for(s=0;s<d;s++)g[n[s]]=s;for(a=0;a<m;a++){for(s=d,c=A[a],f=A[a+1],l=c;l<f;l++)s=Math.min(s,g[E[l]]);g[w+a]=g[b+s],g[b+s]=a}}for(a=0;a<d;a++)g[0+a]=a;for(s=0;s<d;s++){for(-1!==t[o=n[s]]&&N[t[o]]--,u=i?g[b+s]:o;-1!==u;u=i?g[w+u]:-1)for(l=A[u];l<A[u+1];l++){var S=Am(a=E[l],o,g,x,y,v,0);S.jleaf>=1&&N[o]++,2===S.jleaf&&N[S.q]--}-1!==t[o]&&(g[0+o]=t[o])}for(o=0;o<d;o++)-1!==t[o]&&(N[t[o]]+=N[o]);return N}})),Cm=Oe("csSqr",["add","multiply","transpose"],(e=>{var{add:r,multiply:t,transpose:n}=e,i=Em({add:r,multiply:t,transpose:n}),a=Sm({transpose:n});return function(e,r,t){var n,o=r._ptr,s=r._size[1],u={};if(u.q=i(e,r),e&&!u.q)return null;if(t){var l=e?function(e,r,t,n){for(var i=e._values,a=e._index,o=e._ptr,s=e._size,u=e._datatype,l=s[0],c=s[1],f=n&&e._values?[]:null,p=[],m=[],d=0,h=0;h<c;h++){m[h]=d;for(var g=t?t[h]:h,y=o[g],v=o[g+1],x=y;x<v;x++){var b=r?r[a[x]]:a[x];p[d]=b,f&&(f[d]=i[x]),d++}}return m[c]=d,e.createSparseMatrix({values:f,index:p,ptr:m,size:[l,c],datatype:u})}(r,null,u.q,0):r;u.parent=function(e,r){if(!e)return null;var t,n,i=e._index,a=e._ptr,o=e._size,s=o[0],u=o[1],l=[],c=[],f=u;if(r)for(t=0;t<s;t++)c[f+t]=-1;for(var p=0;p<u;p++){l[p]=-1,c[0+p]=-1;for(var m=a[p],d=a[p+1],h=m;h<d;h++){var g=i[h];for(t=r?c[f+g]:g;-1!==t&&t<p;t=n)n=c[0+t],c[0+t]=p,-1===n&&(l[t]=p);r&&(c[f+g]=p)}}return l}(l,1);var c=function(e,r){if(!e)return null;var t,n=0,i=[],a=[],o=r,s=2*r;for(t=0;t<r;t++)a[0+t]=-1;for(t=r-1;t>=0;t--)-1!==e[t]&&(a[o+t]=a[0+e[t]],a[0+e[t]]=t);for(t=0;t<r;t++)-1===e[t]&&(n=Nm(t,n,a,0,o,i,s));return i}(u.parent,s);if(u.cp=a(l,u.parent,c,1),l&&u.parent&&u.cp&&function(e,r){var t=e._ptr,n=e._index,i=e._size,a=i[0],o=i[1];r.pinv=[],r.leftmost=[];var s,u,l,c,f,p=r.parent,m=r.pinv,d=r.leftmost,h=[],g=0,y=a,v=a+o,x=a+2*o;for(u=0;u<o;u++)h[y+u]=-1,h[v+u]=-1,h[x+u]=0;for(s=0;s<a;s++)d[s]=-1;for(u=o-1;u>=0;u--)for(c=t[u],f=t[u+1],l=c;l<f;l++)d[n[l]]=u;for(s=a-1;s>=0;s--)m[s]=-1,-1!==(u=d[s])&&(0==h[x+u]++&&(h[v+u]=s),h[g+s]=h[y+u],h[y+u]=s);for(r.lnz=0,r.m2=a,u=0;u<o;u++)if(s=h[y+u],r.lnz++,s<0&&(s=r.m2++),m[s]=u,!(--x[u]<=0)){r.lnz+=h[x+u];var b=p[u];-1!==b&&(0===h[x+b]&&(h[v+b]=h[v+u]),h[g+h[v+u]]=h[y+b],h[y+b]=h[g+s],h[x+b]+=h[x+u])}for(s=0;s<a;s++)m[s]<0&&(m[s]=u++);return!0}(l,u))for(u.unz=0,n=0;n<s;n++)u.unz+=u.cp[n]}else u.unz=4*o[s]+s,u.lnz=u.unz;return u}}));function Mm(e,r){return e[r]<0}function Om(e,r){e[r]=Dm(e[r])}function Tm(e){return e<0?Dm(e):e}function Fm(e,r,t,n,i){var a,o,s,u=r._index,l=r._ptr,c=r._size[1],f=0;for(n[0]=e;f>=0;){e=n[f];var p=i?i[e]:e;Mm(l,e)||(Om(l,e),n[c+f]=p<0?0:Tm(l[p]));var m=1;for(o=n[c+f],s=p<0?0:Tm(l[p+1]);o<s;o++)if(!Mm(l,a=u[o])){n[c+f]=o,n[++f]=a,m=0;break}m&&(f--,n[--t]=e)}return t}var _m=Oe("csSpsolve",["divideScalar","multiply","subtract"],(e=>{var{divideScalar:r,multiply:t,subtract:n}=e;return function(e,i,a,o,s,u,l){var c,f,p,m,d=e._values,h=e._index,g=e._ptr,y=e._size[1],v=i._values,x=i._index,b=i._ptr,w=function(e,r,t,n,i){var a,o,s,u=e._ptr,l=e._size,c=r._index,f=r._ptr,p=l[1],m=p;for(o=f[t],s=f[t+1],a=o;a<s;a++){var d=c[a];Mm(u,d)||(m=Fm(d,e,m,n,i))}for(a=m;a<p;a++)Om(u,n[a]);return m}(e,i,a,o,u);for(c=w;c<y;c++)s[o[c]]=0;for(f=b[a],p=b[a+1],c=f;c<p;c++)s[x[c]]=v[c];for(var N=w;N<y;N++){var D=o[N],E=u?u[D]:D;if(!(E<0))for(f=g[E],p=g[E+1],s[D]=r(s[D],d[l?f:p-1]),c=l?f+1:f,m=l?p:p-1;c<m;c++){var A=h[c];s[A]=n(s[A],t(d[c],s[D]))}}return w}})),Bm=Oe("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],(e=>{var{abs:r,divideScalar:t,multiply:n,subtract:i,larger:a,largerEq:o,SparseMatrix:s}=e,u=_m({divideScalar:t,multiply:n,subtract:i});return function(e,i,l){if(!e)return null;var c,f=e._size[1],p=100,m=100;i&&(c=i.q,p=i.lnz||p,m=i.unz||m);var d,h,g=[],y=[],v=[],x=new s({values:g,index:y,ptr:v,size:[f,f]}),b=[],w=[],N=[],D=new s({values:b,index:w,ptr:N,size:[f,f]}),E=[],A=[],S=[];for(d=0;d<f;d++)A[d]=0,E[d]=-1,v[d+1]=0;p=0,m=0;for(var C=0;C<f;C++){v[C]=p,N[C]=m;var M=c?c[C]:C,O=u(x,e,M,S,A,E,1),T=-1,F=-1;for(h=O;h<f;h++)if(E[d=S[h]]<0){var _=r(A[d]);a(_,F)&&(F=_,T=d)}else w[m]=E[d],b[m++]=A[d];if(-1===T||F<=0)return null;E[M]<0&&o(r(A[M]),n(F,l))&&(T=M);var B=A[T];for(w[m]=C,b[m++]=B,E[T]=C,y[p]=T,g[p++]=1,h=O;h<f;h++)E[d=S[h]]<0&&(y[p]=d,g[p++]=t(A[d],B)),A[d]=0}for(v[f]=p,N[f]=m,h=0;h<p;h++)y[h]=E[y[h]];return g.splice(p,g.length-p),y.splice(p,y.length-p),b.splice(m,b.length-m),w.splice(m,w.length-m),{L:x,U:D,pinv:E}}})),Im=Oe("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],(e=>{var{typed:r,abs:t,add:n,multiply:i,transpose:a,divideScalar:o,subtract:s,larger:u,largerEq:l,SparseMatrix:c}=e,f=Cm({add:n,multiply:i,transpose:a}),p=Bm({abs:t,divideScalar:o,multiply:i,subtract:s,larger:u,largerEq:l,SparseMatrix:c});return r("slu",{"SparseMatrix, number, number":function(e,r,t){if(!ie(r)||r<0||r>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(t<0||t>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var n=f(r,e,!1),i=p(e,n,t);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function zm(e,r){var t,n=r.length,i=[];if(e)for(t=0;t<n;t++)i[e[t]]=r[t];else for(t=0;t<n;t++)i[t]=r[t];return i}var qm="lusolve",Rm=["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],km=Oe(qm,Rm,(e=>{var{typed:r,matrix:t,lup:n,slu:i,usolve:a,lsolve:o,DenseMatrix:s}=e,u=zl({DenseMatrix:s});return r(qm,{"Array, Array | Matrix":function(e,r){e=t(e);var i=n(e);return c(i.L,i.U,i.p,null,r).valueOf()},"DenseMatrix, Array | Matrix":function(e,r){var t=n(e);return c(t.L,t.U,t.p,null,r)},"SparseMatrix, Array | Matrix":function(e,r){var t=n(e);return c(t.L,t.U,t.p,null,r)},"SparseMatrix, Array | Matrix, number, number":function(e,r,t,n){var a=i(e,t,n);return c(a.L,a.U,a.p,a.q,r)},"Object, Array | Matrix":function(e,r){return c(e.L,e.U,e.p,e.q,r)}});function l(e){if(p(e))return e;if(f(e))return t(e);throw new TypeError("Invalid Matrix LU decomposition")}function c(e,r,t,n,i){e=l(e),r=l(r),t&&((i=u(e,i,!0))._data=zm(t,i._data));var s=o(e,i),c=a(r,s);return n&&(c._data=zm(n,c._data)),c}})),Pm="polynomialRoot",Um=["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],Lm=Oe(Pm,Um,(e=>{var{typed:r,isZero:t,equalScalar:n,add:i,subtract:a,multiply:o,divide:s,sqrt:u,unaryMinus:l,cbrt:c,typeOf:f,im:p,re:m}=e;return r(Pm,{"number|Complex, ...number|Complex":(e,r)=>{for(var d=[e,...r];d.length>0&&t(d[d.length-1]);)d.pop();if(d.length<2)throw new RangeError("Polynomial [".concat(e,", ").concat(r,"] must have a non-zero non-constant coefficient"));switch(d.length){case 2:return[l(s(d[0],d[1]))];case 3:var[h,g,y]=d,v=o(2,y),x=o(g,g),b=o(4,y,h);if(n(x,b))return[s(l(g),v)];var w=u(a(x,b));return[s(a(w,g),v),s(a(l(w),g),v)];case 4:var[N,D,E,A]=d,S=l(o(3,A)),C=o(E,E),M=o(3,A,D),O=i(o(2,E,E,E),o(27,A,A,N)),T=o(9,A,E,D);if(n(C,M)&&n(O,T))return[s(E,S)];var F,_=a(C,M),B=a(O,T),I=i(o(18,A,E,D,N),o(E,E,D,D)),z=i(o(4,E,E,E,N),o(4,A,D,D,D),o(27,A,A,N,N));if(n(I,z))return[s(a(o(4,A,E,D),i(o(9,A,A,N),o(E,E,E))),o(A,_)),s(a(o(9,A,N),o(E,D)),o(2,_))];F=n(C,M)?B:s(i(B,u(a(o(B,B),o(4,_,_,_)))),2);return c(F,!0).toArray().map((e=>s(i(E,e,s(_,e)),S))).map((e=>"Complex"===f(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(d))}}})})),jm=["evaluate"],Hm=Oe("Help",jm,(e=>{var{evaluate:r}=e;function t(e){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return t.prototype.type="Help",t.prototype.isHelp=!0,t.prototype.toString=function(){var e=this.doc||{},t="\n";if(e.name&&(t+="Name: "+e.name+"\n\n"),e.category&&(t+="Category: "+e.category+"\n\n"),e.description&&(t+="Description:\n "+e.description+"\n\n"),e.syntax&&(t+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){t+="Examples:\n";for(var n=!1,i=r("config()"),a={config:e=>(n=!0,r("config(newConfig)",{newConfig:e}))},o=0;o<e.examples.length;o++){var s=e.examples[o];t+=" "+s+"\n";var u=void 0;try{u=r(s,a)}catch(e){u=e}void 0===u||b(u)||(t+=" "+Jt(u,{precision:14})+"\n")}t+="\n",n&&r("config(originalConfig)",{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(t+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(t+="See also: "+e.seealso.join(", ")+"\n"),t},t.prototype.toJSON=function(){var e=V(this.doc);return e.mathjs="Help",e},t.fromJSON=function(e){var r={};return Object.keys(e).filter((e=>"mathjs"!==e)).forEach((t=>{r[t]=e[t]})),new t(r)},t.prototype.valueOf=t.prototype.toString,t}),{isClass:!0}),$m=["?on","math","typed"],Gm=Oe("Chain",$m,(e=>{var{on:r,math:t,typed:n}=e;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");$(e)?this.value=e.value:this.value=e}function a(e,r){var t,n,a,s,u;t=i.prototype,n=e,a=function(){var e=r();if("function"==typeof e)return o(e)},u=!0,Object.defineProperty(t,n,{get:function(){return u&&(s=a(),u=!1),s},set:function(e){s=e,u=!1},configurable:!0,enumerable:!0})}function o(e){return function(){if(0===arguments.length)return new i(e(this.value));for(var r=[this.value],t=0;t<arguments.length;t++)r[t+1]=arguments[t];if(n.isTypedFunction(e)){var a=n.resolve(e,r);if(1===a.params.length)throw new Error("chain function "+e.name+" cannot match rest parameter between chain value and additional arguments.");return new i(a.implementation.apply(e,r))}return new i(e.apply(e,r))}}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return Jt(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(e){return new i(e.value)},i.createProxy=function(e,r){if("string"==typeof e)u=e,"function"==typeof(l=r)&&(i.prototype[u]=o(l));else{var t=function(r){Y(e,r)&&void 0===s[r]&&a(r,(()=>e[r]))};for(var n in e)t(n)}var u,l};var s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(t),r&&r("import",(function(e,r,t){t||a(e,r)})),i}),{isClass:!0}),Vm={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},Zm={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]},Wm={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:Vm,E:Vm,false:{name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},i:{name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},Infinity:{name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},LN2:{name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LN10:{name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LOG2E:{name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},LOG10E:{name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},NaN:{name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},null:{name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},pi:Zm,PI:Zm,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Borh magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Borh radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},lsolveAll:{name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},leafCount:{name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},polynomialRoot:{name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},resolve:{name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},simplifyConstant:{name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCore:{name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},symbolicEqual:{name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},usolveAll:{name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]},cube:{name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},divide:{name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},dotDivide:{name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},dotMultiply:{name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},dotPow:{name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},exp:{name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},expm:{name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},expm1:{name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},fix:{name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]},gcd:{name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},hypot:{name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -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 optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},matrixFromFunction:{name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},matrixFromRows:{name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},matrixFromColumns:{name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)"],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:[]},zeta:{name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemanns Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},cumsum:{name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of 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"]},corr:{name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the 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: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOf:{name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, 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"]}},Ym="help",Jm=Oe(Ym,["typed","mathWithTransform","Help"],(e=>{var{typed:r,mathWithTransform:t,Help:n}=e;return r(Ym,{any:function(e){var r,i=e;if("string"!=typeof e)for(r in t)if(Y(t,r)&&e===t[r]){i=r;break}var a=Fe(Wm,i);if(!a){var o="function"==typeof i?i.name:i;throw new Error('No documentation found on "'+o+'"')}return new n(a)}})})),Xm="chain",Qm=Oe(Xm,["typed","Chain"],(e=>{var{typed:r,Chain:t}=e;return r(Xm,{"":function(){return new t},any:function(e){return new t(e)}})})),Km=Oe("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],(e=>{var{typed:r,matrix:t,subtractScalar:n,multiply:i,divideScalar:a,isZero:o,unaryMinus:s}=e;return r("det",{any:function(e){return V(e)},"Array | Matrix":function(e){var r;switch((r=p(e)?e.size():Array.isArray(e)?(e=t(e)).size():[]).length){case 0:return V(e);case 1:if(1===r[0])return V(e.valueOf()[0]);if(0===r[0])return 1;throw new RangeError("Matrix must be square (size: "+Jt(r)+")");case 2:var u=r[0],l=r[1];if(u===l)return function(e,r,t){if(1===r)return V(e[0][0]);if(2===r)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));for(var u=!1,l=new Array(r).fill(0).map(((e,r)=>r)),c=0;c<r;c++){var f=l[c];if(o(e[f][c])){var p=void 0;for(p=c+1;p<r;p++)if(!o(e[l[p]][c])){f=l[p],l[p]=l[c],l[c]=f,u=!u;break}if(p===r)return e[f][c]}for(var m=e[f][c],d=0===c?1:e[l[c-1]][c-1],h=c+1;h<r;h++)for(var g=l[h],y=c+1;y<r;y++)e[g][y]=a(n(i(e[g][y],m),i(e[g][c],e[f][y])),d)}var v=e[l[r-1]][r-1];return u?s(v):v}(e.clone().valueOf(),u);if(0===l)return 1;throw new RangeError("Matrix must be square (size: "+Jt(r)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Jt(r)+")")}}})})),ed=Oe("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],(e=>{var{typed:r,matrix:t,divideScalar:n,addScalar:i,multiply:a,unaryMinus:o,det:s,identity:u,abs:l}=e;return r("inv",{"Array | Matrix":function(e){var r=p(e)?e.size():an(e);switch(r.length){case 1:if(1===r[0])return p(e)?t([n(1,e.valueOf()[0])]):[n(1,e[0])];throw new RangeError("Matrix must be square (size: "+Jt(r)+")");case 2:var i=r[0],a=r[1];if(i===a)return p(e)?t(c(e.valueOf(),i,a),e.storage()):c(e,i,a);throw new RangeError("Matrix must be square (size: "+Jt(r)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+Jt(r)+")")}},any:function(e){return n(1,e)}});function c(e,r,t){var c,f,p,m,d;if(1===r){if(0===(m=e[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,m)]]}if(2===r){var h=s(e);if(0===h)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],h),n(o(e[0][1]),h)],[n(o(e[1][0]),h),n(e[0][0],h)]]}var g=e.concat();for(c=0;c<r;c++)g[c]=g[c].concat();for(var y=u(r).valueOf(),v=0;v<t;v++){var x=l(g[v][v]),b=v;for(c=v+1;c<r;)l(g[c][v])>x&&(x=l(g[c][v]),b=c),c++;if(0===x)throw Error("Cannot calculate inverse, determinant is zero");(c=b)!==v&&(d=g[v],g[v]=g[c],g[c]=d,d=y[v],y[v]=y[c],y[c]=d);var w=g[v],N=y[v];for(c=0;c<r;c++){var D=g[c],E=y[c];if(c!==v){if(0!==D[v]){for(p=n(o(D[v]),w[v]),f=v;f<t;f++)D[f]=i(D[f],a(p,w[f]));for(f=0;f<t;f++)E[f]=i(E[f],a(p,N[f]))}}else{for(p=w[v],f=v;f<t;f++)D[f]=n(D[f],p);for(f=0;f<t;f++)E[f]=n(E[f],p)}}}return y}})),rd="pinv",td=Oe(rd,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],(e=>{var{typed:r,matrix:t,inv:n,deepEqual:i,equal:a,dotDivide:o,dot:s,ctranspose:u,divideScalar:l,multiply:c,add:f,Complex:m}=e;return r(rd,{"Array | Matrix":function(e){var r=p(e)?e.size():an(e);switch(r.length){case 1:return g(e)?u(e):1===r[0]?n(e):o(u(e),s(e,e));case 2:if(g(e))return u(e);var i=r[0],a=r[1];if(i===a)try{return n(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return p(e)?t(d(e.valueOf(),i,a),e.storage()):d(e,i,a);default:throw new RangeError("Matrix must be two dimensional (size: "+Jt(r)+")")}},any:function(e){return a(e,0)?V(e):l(1,e)}});function d(e,r,t){var{C:i,F:a}=function(e,r,t){var n=function(e,r,t){for(var n=V(e),i=0,a=0;a<r;a++){if(t<=i)return n;for(var s=a;h(n[s][i]);)if(r===++s&&(s=a,t===++i))return n;[n[s],n[a]]=[n[a],n[s]];for(var u=n[a][i],l=0;l<t;l++)n[a][l]=o(n[a][l],u);for(var p=0;p<r;p++)if(p!==a){u=n[p][i];for(var m=0;m<t;m++)n[p][m]=f(n[p][m],c(-1,c(u,n[a][m])))}i++}return n}(e,r,t),i=e.map(((e,t)=>e.filter(((e,t)=>t<r&&!h(s(n[t],n[t])))))),a=n.filter(((e,r)=>!h(s(n[r],n[r]))));return{C:i,F:a}}(e,r,t),l=c(n(c(u(i),i)),u(i)),p=c(u(a),n(c(a,u(a))));return c(p,l)}function h(e){return a(f(e,m(1,1)),f(0,m(1,1)))}function g(e){return i(f(e,m(1,1)),f(c(e,0),m(1,1)))}}));function nd(e){var{addScalar:r,subtract:t,flatten:n,multiply:i,multiplyScalar:a,divideScalar:o,sqrt:s,abs:u,bignumber:l,diag:c,size:f,reshape:p,inv:m,qr:d,usolve:h,usolveAll:g,equal:y,complex:v,larger:x,smaller:b,matrixFromColumns:w,dot:N}=e;function D(e,n,i,o){var u=r(e,o),l=t(a(e,o),a(n,i)),c=a(u,.5),f=a(s(t(a(u,u),a(4,l))),.5);return[r(c,f),t(c,f)]}function E(e,r,n,i,a,o,s,c){var f="BigNumber"===c,p="Complex"===c,m=f?l(0):p?v(0):0,d=f?l(1):p?v(1):1;if(b(u(n),s))return[[d,m],[m,d]];if(x(u(t(a,o)),s))return[[t(a,i),t(o,i)],[n,n]];var h=t(e,a),g=t(i,a);return b(u(r),s)&&b(u(g),s)?[[h,d],[n,m]]:[[r,m],[g,d]]}function A(e,r){for(var t=0;t<e.length;t++)e[t].push(...Array(r-e[t].length).fill(0));for(var n=e.length;n<r;n++)e.push(Array(r).fill(0)),e[n][n]=1;return e}function S(e,r,t){for(var n=0;n<e.length;n++)if(t(e[n],r))return n;return-1}function C(e,r,t,n,i){for(var a,o="BigNumber"===i?l(1e3):1e3,s=0;s<5;++s){a=M(r,t,i);try{a=h(e,a)}catch(e){continue}if(x(T(a),o))break}if(s>=5)return null;for(s=0;;){var u=h(e,a);if(b(T(O(a,[u])),n))break;if(++s>=10)return null;a=F(u)}return a}function M(e,r,t){var n="BigNumber"===t,i="Complex"===t,a=Array(e).fill(0).map((e=>2*Math.random()-1));return n&&(a=a.map((e=>l(e)))),i&&(a=a.map((e=>v(e)))),F(a=O(a,r),t)}function O(e,r){var n=f(e);for(var a of r)a=p(a,n),e=t(e,i(o(N(a,e),N(a,a)),a));return e}function T(e){return u(s(N(e,e)))}function F(e,r){var t="Complex"===r,n="BigNumber"===r?l(1):t?v(1):1;return i(o(n,T(e)),e)}return function(e,s,f,p){var h=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],w=function(e,t,n,i,s){var f,p="BigNumber"===i,m="Complex"===i,d=p?l(0):0,h=p?l(1):m?v(1):1,g=p?l(1):1,w=p?l(10):2,N=a(w,w);s&&(f=Array(t).fill(h));var D=!1;for(;!D;){D=!0;for(var E=0;E<t;E++){for(var A=d,S=d,C=0;C<t;C++)E!==C&&(A=r(A,u(e[C][E])),S=r(S,u(e[E][C])));if(!y(A,0)&&!y(S,0)){for(var M=g,O=A,T=o(S,w),F=a(S,w);b(O,T);)O=a(O,N),M=a(M,w);for(;x(O,F);)O=o(O,N),M=o(M,w);if(b(o(r(O,S),M),a(r(A,S),.95))){D=!1;for(var _=o(1,M),B=0;B<t;B++)E!==B&&(e[E][B]=a(e[E][B],_),e[B][E]=a(e[B][E],M));s&&(f[E]=a(f[E],_))}}}}return s?c(f):null}(e,s,0,p,h);!function(e,n,i,s,c,f){var p="BigNumber"===s,m="Complex"===s,d=p?l(0):m?v(0):0;p&&(i=l(i));for(var h=0;h<n-2;h++){for(var g=0,y=d,x=h+1;x<n;x++){var w=e[x][h];b(u(y),u(w))&&(y=w,g=x)}if(!b(u(y),i)){if(g!==h+1){var N=e[g];e[g]=e[h+1],e[h+1]=N;for(var D=0;D<n;D++){var E=e[D][g];e[D][g]=e[D][h+1],e[D][h+1]=E}if(c){var A=f[g];f[g]=f[h+1],f[h+1]=A}}for(var S=h+2;S<n;S++){var C=o(e[S][h],y);if(0!==C){for(var M=0;M<n;M++)e[S][M]=t(e[S][M],a(C,e[h+1][M]));for(var O=0;O<n;O++)e[O][h+1]=r(e[O][h+1],a(C,e[O][S]));if(c)for(var T=0;T<n;T++)f[S][T]=t(f[S][T],a(C,f[h+1][T]))}}}}}(e,s,f,p,h,w);var{values:N,C:M}=function(e,n,a,o,s){var f="BigNumber"===o,p="Complex"===o,m=f?l(1):p?v(1):1;f&&(a=l(a));var h=V(e),g=[],y=n,x=[],w=s?c(Array(n).fill(m)):void 0,N=s?c(Array(y).fill(m)):void 0,S=0;for(;S<=100;){S+=1;for(var C=h[y-1][y-1],M=0;M<y;M++)h[M][M]=t(h[M][M],C);var{Q:O,R:T}=d(h);h=i(T,O);for(var F=0;F<y;F++)h[F][F]=r(h[F][F],C);if(s&&(N=i(N,O)),1===y||b(u(h[y-1][y-2]),a)){S=0,g.push(h[y-1][y-1]),s&&(x.unshift([[1]]),A(N,n),w=i(w,N),y>1&&(N=c(Array(y-1).fill(m)))),y-=1,h.pop();for(var _=0;_<y;_++)h[_].pop()}else if(2===y||b(u(h[y-2][y-3]),a)){S=0;var B=D(h[y-2][y-2],h[y-2][y-1],h[y-1][y-2],h[y-1][y-1]);g.push(...B),s&&(x.unshift(E(h[y-2][y-2],h[y-2][y-1],h[y-1][y-2],h[y-1][y-1],B[0],B[1],a,o)),A(N,n),w=i(w,N),y>2&&(N=c(Array(y-2).fill(m)))),y-=2,h.pop(),h.pop();for(var I=0;I<y;I++)h[I].pop(),h[I].pop()}if(0===y)break}if(g.sort(((e,r)=>+t(u(e),u(r)))),S>100){var z=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw z.values=g,z.vectors=[],z}var q=s?i(w,function(e,r){for(var t=[],n=0;n<r;n++)t[n]=Array(r).fill(0);var i=0;for(var a of e){for(var o=a.length,s=0;s<o;s++)for(var u=0;u<o;u++)t[i+s][i+u]=a[s][u];i+=o}return t}(x,n)):void 0;return{values:g,C:q}}(e,s,f,p,h);if(h){var O=function(e,r,a,o,s,u,f){var p=m(a),d=i(p,e,a),h="BigNumber"===f,x="Complex"===f,b=h?l(0):x?v(0):0,w=h?l(1):x?v(1):1,N=[],D=[];for(var E of s){var A=S(N,E,y);-1===A?(N.push(E),D.push(1)):D[A]+=1}for(var M=[],O=N.length,T=Array(r).fill(b),F=c(Array(r).fill(w)),_=function(){var e=N[B],s=t(d,i(e,F)),l=g(s,T);for(l.shift();l.length<D[B];){var c=C(s,r,l,u,f);if(null===c)break;l.push(c)}var p=i(m(o),a);l=l.map((e=>i(p,e))),M.push(...l.map((r=>({value:e,vector:n(r)}))))},B=0;B<O;B++)_();return M}(e,s,M,w,N,f,p);return{values:N,eigenvectors:O}}return{values:N}}}function id(e){var{config:r,addScalar:t,subtract:n,abs:i,atan:a,cos:o,sin:s,multiplyScalar:u,inv:l,bignumber:c,multiply:f,add:p}=e;function m(e,t,n){var i=t-e;return Math.abs(i)<=r.epsilon?Math.PI/4:.5*Math.atan(2*n/(t-e))}function d(e,t,o){var s=n(t,e);return i(s)<=r.epsilon?c(-1).acos().div(4):u(.5,a(f(2,o,l(s))))}function h(e,r,t,n){for(var i=e.length,a=Math.cos(r),o=Math.sin(r),s=Array(i).fill(0),u=Array(i).fill(0),l=0;l<i;l++)s[l]=a*e[l][t]-o*e[l][n],u[l]=o*e[l][t]+a*e[l][n];for(var c=0;c<i;c++)e[c][t]=s[c],e[c][n]=u[c];return e}function g(e,r,i,a){for(var l=e.length,f=o(r),p=s(r),m=Array(l).fill(c(0)),d=Array(l).fill(c(0)),h=0;h<l;h++)m[h]=n(u(f,e[h][i]),u(p,e[h][a])),d[h]=t(u(p,e[h][i]),u(f,e[h][a]));for(var g=0;g<l;g++)e[g][i]=m[g],e[g][a]=d[g];return e}function y(e,r,i,a){for(var l=e.length,m=c(o(r)),d=c(s(r)),h=u(m,m),g=u(d,d),y=Array(l).fill(c(0)),v=Array(l).fill(c(0)),x=f(c(2),m,d,e[i][a]),b=t(n(u(h,e[i][i]),x),u(g,e[a][a])),w=p(u(g,e[i][i]),x,u(h,e[a][a])),N=0;N<l;N++)y[N]=n(u(m,e[i][N]),u(d,e[a][N])),v[N]=t(u(d,e[i][N]),u(m,e[a][N]));e[i][i]=b,e[a][a]=w,e[i][a]=c(0),e[a][i]=c(0);for(var D=0;D<l;D++)D!==i&&D!==a&&(e[i][D]=y[D],e[D][i]=y[D],e[a][D]=v[D],e[D][a]=v[D]);return e}function v(e,r,t,n){for(var i=e.length,a=Math.cos(r),o=Math.sin(r),s=a*a,u=o*o,l=Array(i).fill(0),c=Array(i).fill(0),f=s*e[t][t]-2*a*o*e[t][n]+u*e[n][n],p=u*e[t][t]+2*a*o*e[t][n]+s*e[n][n],m=0;m<i;m++)l[m]=a*e[t][m]-o*e[n][m],c[m]=o*e[t][m]+a*e[n][m];e[t][t]=f,e[n][n]=p,e[t][n]=0,e[n][t]=0;for(var d=0;d<i;d++)d!==t&&d!==n&&(e[t][d]=l[d],e[d][t]=l[d],e[n][d]=c[d],e[d][n]=c[d]);return e}function x(e){for(var r=e.length,t=0,n=[0,1],i=0;i<r;i++)for(var a=i+1;a<r;a++)Math.abs(t)<Math.abs(e[i][a])&&(t=Math.abs(e[i][a]),n=[i,a]);return[n,t]}function b(e){for(var r=e.length,t=0,n=[0,1],a=0;a<r;a++)for(var o=a+1;o<r;o++)i(t)<i(e[a][o])&&(t=i(e[a][o]),n=[a,o]);return[n,t]}function w(e,r,t){var n,a=e.length,o=Array(a);if(t){n=Array(a);for(var s=0;s<a;s++)n[s]=Array(a)}for(var u=0;u<a;u++){for(var l=0,c=e[0],f=0;f<e.length;f++)i(e[f])<i(c)&&(c=e[l=f]);if(o[u]=e.splice(l,1)[0],t)for(var p=0;p<a;p++)n[u][p]=r[p][l],r[p].splice(l,1)}if(!t)return{values:o};var m=n.map(((e,r)=>({value:o[r],vector:e})));return{values:o,eigenvectors:m}}return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.epsilon,a=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;if("number"===a)return function(e,r,t){var n,i,a=e.length,o=Math.abs(r/a);if(t){i=new Array(a);for(var s=0;s<a;s++)i[s]=Array(a).fill(0),i[s][s]=1}var u=x(e);for(;Math.abs(u[1])>=Math.abs(o);){var l=u[0][0],c=u[0][1];e=v(e,n=m(e[l][l],e[c][c],e[l][c]),l,c),t&&(i=h(i,n,l,c)),u=x(e)}for(var f=Array(a).fill(0),p=0;p<a;p++)f[p]=e[p][p];return w(V(f),i,t)}(e,n,o);if("BigNumber"===a)return function(e,r,t){var n,a,o=e.length,s=i(r/o);if(t){a=new Array(o);for(var u=0;u<o;u++)a[u]=Array(o).fill(0),a[u][u]=1}var l=b(e);for(;i(l[1])>=i(s);){var c=l[0][0],f=l[0][1];e=y(e,n=d(e[c][c],e[f][f],e[c][f]),c,f),t&&(a=g(a,n,c,f)),l=b(e)}for(var p=Array(o).fill(0),m=0;m<o;m++)p[m]=e[m][m];return w(V(p),a,t)}(e,n,o);throw TypeError("Unsupported data type: "+a)}}var ad=Oe("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],(e=>{var{config:r,typed:t,matrix:i,addScalar:l,subtract:c,equal:f,abs:p,atan:m,cos:d,sin:h,multiplyScalar:g,divideScalar:y,inv:v,bignumber:x,multiply:b,add:w,larger:N,column:D,flatten:E,number:A,complex:S,sqrt:C,diag:M,size:O,reshape:T,qr:F,usolve:_,usolveAll:B,im:I,re:z,smaller:q,matrixFromColumns:R,dot:k}=e,P=id({config:r,addScalar:l,subtract:c,column:D,flatten:E,equal:f,abs:p,atan:m,cos:d,sin:h,multiplyScalar:g,inv:v,bignumber:x,complex:S,multiply:b,add:w}),U=nd({config:r,addScalar:l,subtract:c,multiply:b,multiplyScalar:g,flatten:E,divideScalar:y,sqrt:C,abs:p,bignumber:x,diag:M,size:O,reshape:T,qr:F,inv:v,usolve:_,usolveAll:B,equal:f,complex:S,larger:N,smaller:q,matrixFromColumns:R,dot:k});return t("eigs",{Array:function(e){return L(i(e))},"Array, number|BigNumber":function(e,r){return L(i(e),{precision:r})},"Array, Object":(e,r)=>L(i(e),r),Matrix:function(e){return L(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,r){return L(e,{precision:r,matricize:!0})},"Matrix, Object":function(e,r){var t={matricize:!0};return(0,n.A)(t,r),L(e,t)}});function L(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=!("eigenvectors"in n)||n.eigenvectors,o=function(e,r,t){var n=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw new RangeError("Matrix must be square (size: ".concat(Jt(i),")"));var a=i[0];if(function(e,r,t){for(var n=0;n<r;n++)for(var i=0;i<r;i++)if(N(x(p(I(e[n][i]))),t))return!1;return!0}(n,a,r)&&(function(e,r){for(var t=0;t<r;t++)for(var n=0;n<r;n++)e[t][n]=z(e[t][n])}(n,a),function(e,r,t){for(var n=0;n<r;n++)for(var i=n;i<r;i++)if(N(x(p(c(e[n][i],e[i][n]))),t))return!1;return!0}(n,a,r))){var o=j(e,n,a);return P(n,a,r,o,t)}var s=j(e,n,a);return U(n,a,r,s,t)}(e,null!==(t=n.precision)&&void 0!==t?t:r.epsilon,a);return n.matricize&&(o.values=i(o.values),a&&(o.eigenvectors=o.eigenvectors.map((e=>{var{value:r,vector:t}=e;return{value:r,vector:i(t)}})))),a&&Object.defineProperty(o,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),o}function j(e,r,t){var n=e.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;for(var i=!1,l=!1,c=!1,f=0;f<t;f++)for(var p=0;p<t;p++){var m=r[f][p];if(a(m)||u(m))i=!0;else if(o(m))l=!0;else{if(!s(m))throw TypeError("Unsupported type in Matrix: "+G(m));c=!0}}if(l&&c&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),c){for(var d=0;d<t;d++)for(var h=0;h<t;h++)r[d][h]=S(r[d][h]);return"Complex"}if(l){for(var g=0;g<t;g++)for(var y=0;y<t;y++)r[g][y]=x(r[g][y]);return"BigNumber"}if(i){for(var v=0;v<t;v++)for(var b=0;b<t;b++)r[v][b]=A(r[v][b]);return"number"}throw TypeError("Matrix contains unsupported types only.")}})),od="expm",sd=Oe(od,["typed","abs","add","identity","inv","multiply"],(e=>{var{typed:r,abs:t,add:n,identity:i,inv:a,multiply:o}=e;return r(od,{Matrix:function(e){var r=e.size();if(2!==r.length||r[0]!==r[1])throw new RangeError("Matrix must be square (size: "+Jt(r)+")");for(var u=r[0],l=function(e){for(var r=e.size()[0],n=0,i=0;i<r;i++){for(var a=0,o=0;o<r;o++)a+=t(e.get([i,o]));n=Math.max(a,n)}return n}(e),c=function(e,r){for(var t=30,n=0;n<t;n++)for(var i=0;i<=n;i++){var a=n-i;if(s(e,i,a)<r)return{q:i,j:a}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(l,1e-15),f=c.q,p=c.j,m=o(e,Math.pow(2,-p)),d=i(u),g=i(u),y=1,v=m,x=-1,b=1;b<=f;b++)b>1&&(v=o(v,m),x=-x),d=n(d,o(y=y*(f-b+1)/((2*f-b+1)*b),v)),g=n(g,o(y*x,v));for(var w=o(a(g),d),N=0;N<p;N++)w=o(w,w);return h(e)?e.createSparseMatrix(w):w}});function s(e,r,t){for(var n=1,i=2;i<=r;i++)n*=i;for(var a=n,o=r+1;o<=2*r;o++)a*=o;var s=a*(2*r+1);return 8*Math.pow(e/Math.pow(2,t),2*r)*n*n/(a*s)}})),ud="sqrtm",ld=Oe(ud,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],(e=>{var{typed:r,abs:t,add:n,multiply:i,map:a,sqrt:o,subtract:s,inv:u,size:l,max:c,identity:f}=e,m=1e-6;function d(e){var r,a=0,o=e,p=f(l(e));do{var d=o;if(o=i(.5,n(d,u(p))),p=i(.5,n(p,u(d))),(r=c(t(s(o,d))))>m&&++a>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(r>m);return o}return r(ud,{"Array | Matrix":function(e){var r=p(e)?e.size():an(e);switch(r.length){case 1:if(1===r[0])return a(e,o);throw new RangeError("Matrix must be square (size: "+Jt(r)+")");case 2:if(r[0]===r[1])return d(e);throw new RangeError("Matrix must be square (size: "+Jt(r)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+Jt(r)+")")}}})})),cd="sylvester",fd=Oe(cd,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(e=>{var{typed:r,schur:t,matrixFromColumns:n,matrix:i,multiply:a,range:o,concat:s,transpose:u,index:l,subset:c,add:f,subtract:p,identity:m,lusolve:d,abs:h}=e;return r(cd,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,r,t){return g(i(e),r,t)},"Array, Array, Matrix":function(e,r,t){return g(i(e),i(r),t)},"Array, Matrix, Array":function(e,r,t){return g(i(e),r,i(t))},"Matrix, Array, Matrix":function(e,r,t){return g(e,i(r),t)},"Matrix, Array, Array":function(e,r,t){return g(e,i(r),i(t))},"Matrix, Matrix, Array":function(e,r,t){return g(e,r,i(t))},"Array, Array, Array":function(e,r,t){return g(i(e),i(r),i(t)).toArray()}});function g(e,r,g){for(var y=r.size()[0],v=e.size()[0],x=t(e),b=x.T,w=x.U,N=t(a(-1,r)),D=N.T,E=N.U,A=a(a(u(w),g),E),S=o(0,v),C=[],M=(e,r)=>s(e,r,1),O=(e,r)=>s(e,r,0),T=0;T<y;T++)if(T<y-1&&h(c(D,l(T+1,T)))>1e-5){for(var F=O(c(A,l(S,T)),c(A,l(S,T+1))),_=0;_<T;_++)F=f(F,O(a(C[_],c(D,l(_,T))),a(C[_],c(D,l(_,T+1)))));var B=a(m(v),a(-1,c(D,l(T,T)))),I=a(m(v),a(-1,c(D,l(T+1,T)))),z=a(m(v),a(-1,c(D,l(T,T+1)))),q=a(m(v),a(-1,c(D,l(T+1,T+1)))),R=O(M(f(b,B),I),M(z,f(b,q))),k=d(R,F);C[T]=k.subset(l(o(0,v),0)),C[T+1]=k.subset(l(o(v,2*v),0)),T++}else{for(var P=c(A,l(S,T)),U=0;U<T;U++)P=f(P,a(C[U],c(D,l(U,T))));var L=c(D,l(T,T)),j=p(b,a(L,m(v)));C[T]=d(j,P)}var H=i(n(...C));return a(w,a(H,u(E)))}})),pd="schur",md=Oe(pd,["typed","matrix","identity","multiply","qr","norm","subtract"],(e=>{var{typed:r,matrix:t,identity:n,multiply:i,qr:a,norm:o,subtract:s}=e;return r(pd,{Array:function(e){var r=u(t(e));return{U:r.U.valueOf(),T:r.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){var r,t=e.size()[0],u=e,l=n(t),c=0;do{r=u;var f=a(u),p=f.Q,m=f.R;if(u=i(m,p),l=i(l,p),c++>100)break}while(o(s(u,r))>1e-4);return{U:l,T:u}}})),dd="lyap",hd=Oe(dd,["typed","matrix","sylvester","multiply","transpose"],(e=>{var{typed:r,matrix:t,sylvester:n,multiply:i,transpose:a}=e;return r(dd,{"Matrix, Matrix":function(e,r){return n(e,a(e),i(-1,r))},"Array, Matrix":function(e,r){return n(t(e),a(t(e)),i(-1,r))},"Matrix, Array":function(e,r){return n(e,a(t(e)),t(i(-1,r)))},"Array, Array":function(e,r){return n(t(e),a(t(e)),t(i(-1,r))).toArray()}})})),gd=Oe("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(e=>{var{typed:r,matrix:t,multiply:n,equalScalar:i,divideScalar:a,inv:o}=e,s=ao({typed:r,equalScalar:i}),u=so({typed:r});return r("divide",Z({"Array | Matrix, Array | Matrix":function(e,r){return n(e,o(r))},"DenseMatrix, any":function(e,r){return u(e,r,a,!1)},"SparseMatrix, any":function(e,r){return s(e,r,a,!1)},"Array, any":function(e,r){return u(t(e),r,a,!1).valueOf()},"any, Array | Matrix":function(e,r){return n(e,o(r))}},a.signatures))})),yd="distance",vd=Oe(yd,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:a,deepEqual:s,sqrt:u,abs:l}=e;return r(yd,{"Array, Array, Array":function(e,r,t){if(2===e.length&&2===r.length&&2===t.length){if(!f(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!f(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(s(r,t))throw new TypeError("LinePoint1 should not be same with LinePoint2");var a=n(t[1],r[1]),o=n(r[0],t[0]),u=n(i(t[0],r[1]),i(r[0],t[1]));return g(e[0],e[1],a,o,u)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,r,t){if(2===Object.keys(e).length&&2===Object.keys(r).length&&2===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(r))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(s(h(r),h(t)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in r&&"lineOnePtY"in r&&"lineTwoPtX"in t&&"lineTwoPtY"in t){var a=n(t.lineTwoPtY,r.lineOnePtY),o=n(r.lineOnePtX,t.lineTwoPtX),u=n(i(t.lineTwoPtX,r.lineOnePtY),i(r.lineOnePtX,t.lineTwoPtY));return g(e.pointX,e.pointY,a,o,u)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,r){if(2===e.length&&3===r.length){if(!f(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!p(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return g(e[0],e[1],r[0],r[1],r[2])}if(3===e.length&&6===r.length){if(!p(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!d(r))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],r[0],r[1],r[2],r[3],r[4],r[5])}if(e.length===r.length&&e.length>0){if(!m(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!m(r))throw new TypeError("All values of an array should be numbers or BigNumbers");return v(e,r)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,r){if(2===Object.keys(e).length&&3===Object.keys(r).length){if(!f(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!p(r))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in r&&"yCoeffLine"in r&&"constant"in r)return g(e.pointX,e.pointY,r.xCoeffLine,r.yCoeffLine,r.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(r).length){if(!p(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!d(r))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 r&&"y0"in r&&"z0"in r&&"a"in r&&"b"in r&&"c"in r)return y(e.pointX,e.pointY,e.pointZ,r.x0,r.y0,r.z0,r.a,r.b,r.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(r).length){if(!f(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!f(r))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in r&&"pointTwoY"in r)return v([e.pointOneX,e.pointOneY],[r.pointTwoX,r.pointTwoY]);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(r).length){if(!p(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!p(r))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 r&&"pointTwoY"in r&&"pointTwoZ"in r)return v([e.pointOneX,e.pointOneY,e.pointOneZ],[r.pointTwoX,r.pointTwoY,r.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&c(e[0][0])&&c(e[0][1])){if(e.some((e=>2!==e.length||!c(e[0])||!c(e[1]))))return!1}else{if(!(3===e[0].length&&c(e[0][0])&&c(e[0][1])&&c(e[0][2])))return!1;if(e.some((e=>3!==e.length||!c(e[0])||!c(e[1])||!c(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){for(var r=[],t=[],n=[],i=0;i<e.length-1;i++)for(var a=i+1;a<e.length;a++)2===e[0].length?(t=[e[i][0],e[i][1]],n=[e[a][0],e[a][1]]):3===e[0].length&&(t=[e[i][0],e[i][1],e[i][2]],n=[e[a][0],e[a][1],e[a][2]]),r.push(v(t,n));return r}(e)}});function c(e){return"number"==typeof e||o(e)}function f(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])}function p(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])}function m(e){return Array.isArray(e)||(e=h(e)),e.every(c)}function d(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])&&c(e[3])&&c(e[4])&&c(e[5])}function h(e){for(var r=Object.keys(e),t=[],n=0;n<r.length;n++)t.push(e[r[n]]);return t}function g(e,r,n,o,s){var c=l(t(t(i(n,e),i(o,r)),s)),f=u(t(i(n,n),i(o,o)));return a(c,f)}function y(e,r,o,s,l,c,f,p,m){var d=[n(i(n(l,r),m),i(n(c,o),p)),n(i(n(c,o),f),i(n(s,e),m)),n(i(n(s,e),p),i(n(l,r),f))];d=u(t(t(i(d[0],d[0]),i(d[1],d[1])),i(d[2],d[2])));var h=u(t(t(i(f,f),i(p,p)),i(m,m)));return a(d,h)}function v(e,r){for(var a=e.length,o=0,s=0,l=0;l<a;l++)s=n(e[l],r[l]),o=t(i(s,s),o);return u(o)}})),xd=Oe("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],(e=>{var{typed:r,config:t,abs:n,add:i,addScalar:a,matrix:o,multiply:s,multiplyScalar:u,divideScalar:l,subtract:c,smaller:f,equalScalar:p,flatten:m,isZero:d,isNumeric:h}=e;return r("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(e,r,t){var n=g(e.valueOf(),r.valueOf(),t.valueOf());return null===n?null:o(n)},"Matrix, Matrix, Matrix, Matrix":function(e,r,t,n){var i=y(e.valueOf(),r.valueOf(),t.valueOf(),n.valueOf());return null===i?null:o(i)}});function g(e,r,t){if(e=v(e),r=v(r),t=v(t),!b(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&h(e[0])&&h(e[1])&&h(e[2])&&h(e[3])}(t))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,r,t,n,i,o,s,f,p,m){var d=u(e,s),h=u(n,s),g=u(r,f),y=u(i,f),v=u(t,p),x=u(o,p),b=c(c(c(m,d),g),v),w=c(c(c(a(a(h,y),x),d),g),v),N=l(b,w),D=a(e,u(N,c(n,e))),E=a(r,u(N,c(i,r))),A=a(t,u(N,c(o,t)));return[D,E,A]}(e[0],e[1],e[2],r[0],r[1],r[2],t[0],t[1],t[2],t[3])}function y(e,r,o,m){if(e=v(e),r=v(r),o=v(o),m=v(m),2===e.length){if(!x(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!x(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!x(o))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!x(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,r,o,p){var m=e,h=o,g=c(m,r),y=c(h,p),v=c(u(g[0],y[1]),u(y[0],g[1]));if(d(v))return null;if(f(n(v),t.epsilon))return null;var x=u(y[0],m[1]),b=u(y[1],m[0]),w=u(y[0],h[1]),N=u(y[1],h[0]),D=l(a(c(c(x,b),w),N),v);return i(s(g,D),m)}(e,r,o,m)}if(3===e.length){if(!b(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!b(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!b(o))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,r,t,n,i,o,s,f,m,h,g,y){var v=w(e,s,h,s,r,f,g,f,t,m,y,m),x=w(h,s,n,e,g,f,i,r,y,m,o,t),b=w(e,s,n,e,r,f,i,r,t,m,o,t),N=w(h,s,h,s,g,f,g,f,y,m,y,m),D=w(n,e,n,e,i,r,i,r,o,t,o,t),E=c(u(v,x),u(b,N)),A=c(u(D,N),u(x,x));if(d(A))return null;var S=l(E,A),C=l(a(v,u(S,x)),N),M=a(e,u(S,c(n,e))),O=a(r,u(S,c(i,r))),T=a(t,u(S,c(o,t))),F=a(s,u(C,c(h,s))),_=a(f,u(C,c(g,f))),B=a(m,u(C,c(y,m)));return p(M,F)&&p(O,_)&&p(T,B)?[M,O,T]:null}(e[0],e[1],e[2],r[0],r[1],r[2],o[0],o[1],o[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function v(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every((e=>Array.isArray(e)&&1===e.length))?m(e):e}function x(e){return 2===e.length&&h(e[0])&&h(e[1])}function b(e){return 3===e.length&&h(e[0])&&h(e[1])&&h(e[2])}function w(e,r,t,n,i,o,s,l,f,p,m,d){var h=u(c(e,r),c(t,n)),g=u(c(i,o),c(s,l)),y=u(c(f,p),c(m,d));return a(a(h,g),y)}})),bd=Oe("sum",["typed","config","add","numeric"],(e=>{var{typed:r,config:t,add:n,numeric:i}=e;return r("sum",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,r){try{return $n(e,r,n)}catch(e){throw il(e,"sum")}},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function sum");return a(e)}});function a(e){var r;return jn(e,(function(e){try{r=void 0===r?e:n(r,e)}catch(r){throw il(r,"sum",e)}})),void 0===r&&(r=i(0,t.number)),"string"==typeof r&&(r=i(r,t.number)),r}})),wd="cumsum",Nd=Oe(wd,["typed","add","unaryPlus"],(e=>{var{typed:r,add:t,unaryPlus:n}=e;return r(wd,{Array:i,Matrix:function(e){return e.create(i(e.valueOf()))},"Array, number | BigNumber":o,"Matrix, number | BigNumber":function(e,r){return e.create(o(e.valueOf(),r))},"...":function(e){if(Ln(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 il(e,wd)}}function a(e){if(0===e.length)return[];for(var r=[n(e[0])],i=1;i<e.length;++i)r.push(t(r[i-1],e[i]));return r}function o(e,r){var t=an(e);if(r<0||r>=t.length)throw new nn(r,t.length);try{return s(e,r)}catch(e){throw il(e,wd)}}function s(e,r){var t,n,i;if(r<=0){var o=e[0][0];if(Array.isArray(o)){for(i=Un(e),n=[],t=0;t<i.length;t++)n[t]=s(i[t],r-1);return n}return a(e)}for(n=[],t=0;t<e.length;t++)n[t]=s(e[t],r-1);return n}})),Dd="mean",Ed=Oe(Dd,["typed","add","divide"],(e=>{var{typed:r,add:t,divide:n}=e;return r(Dd,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,r){try{var i=$n(e,r,t),a=Array.isArray(e)?an(e):e.size();return n(i,a[r])}catch(e){throw il(e,"mean")}},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){var r,i=0;if(jn(e,(function(e){try{r=void 0===r?e:t(r,e),i++}catch(r){throw il(r,"mean",e)}})),0===i)throw new Error("Cannot calculate the mean of an empty array");return n(r,i)}})),Ad="median",Sd=Oe(Ad,["typed","add","divide","compare","partitionSelect"],(e=>{var{typed:r,add:t,divide:n,compare:i,partitionSelect:a}=e;function o(e){try{var r=(e=bn(e.valueOf())).length;if(0===r)throw new Error("Cannot calculate median of an empty array");if(r%2==0){for(var t=r/2-1,n=a(e,t+1),o=e[t],l=0;l<t;++l)i(e[l],o)>0&&(o=e[l]);return u(o,n)}var c=a(e,(r-1)/2);return s(c)}catch(e){throw il(e,"median")}}var s=r({"number | BigNumber | Complex | Unit":function(e){return e}}),u=r({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,r){return n(t(e,r),2)}});return r(Ad,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,r){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(Ln(e))throw new TypeError("Scalar values expected in function median");return o(e)}})})),Cd=Oe("mad",["typed","abs","map","median","subtract"],(e=>{var{typed:r,abs:t,map:n,median:i,subtract:a}=e;return r("mad",{"Array | Matrix":o,"...":function(e){return o(e)}});function o(e){if(0===(e=bn(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var r=i(e);return i(n(e,(function(e){return t(a(e,r))})))}catch(e){throw e instanceof TypeError&&e.message.includes("median")?new TypeError(e.message.replace("median","mad")):il(e,"mad")}}})),Md="unbiased",Od="variance",Td=Oe(Od,["typed","add","subtract","multiply","divide","apply","isNaN"],(e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:a,apply:s,isNaN:u}=e;return r(Od,{"Array | Matrix":function(e){return l(e,Md)},"Array | Matrix, string":l,"Array | Matrix, number | BigNumber":function(e,r){return c(e,r,Md)},"Array | Matrix, number | BigNumber, string":c,"...":function(e){return l(e,Md)}});function l(e,r){var s,l=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(jn(e,(function(e){try{s=void 0===s?e:t(s,e),l++}catch(r){throw il(r,"variance",e)}})),0===l)throw new Error("Cannot calculate variance of an empty array");var c=a(s,l);if(s=void 0,jn(e,(function(e){var r=n(e,c);s=void 0===s?i(r,r):t(s,i(r,r))})),u(s))return s;switch(r){case"uncorrected":return a(s,l);case"biased":return a(s,l+1);case"unbiased":var f=o(s)?s.mul(0):0;return 1===l?f:a(s,l-1);default:throw new Error('Unknown normalization "'+r+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function c(e,r,t){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return s(e,r,(e=>l(e,t)))}catch(e){throw il(e,"variance")}}})),Fd="quantileSeq",_d=Oe(Fd,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],(e=>{var{typed:r,bignumber:t,add:n,subtract:i,divide:o,multiply:s,partitionSelect:u,compare:l,isInteger:c,smaller:f,smallerEq:p,larger:m}=e,d=Xa({typed:r,isInteger:c});return r(Fd,{"Array | Matrix, number | BigNumber":(e,r)=>g(e,r,!1),"Array | Matrix, number | BigNumber, number":(e,r,t)=>h(e,r,!1,t,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(e,r,t,n)=>h(e,r,t,n,g),"Array | Matrix, Array | Matrix":(e,r)=>y(e,r,!1),"Array | Matrix, Array | Matrix, number":(e,r,t)=>h(e,r,!1,t,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(e,r,t,n)=>h(e,r,t,n,y)});function h(e,r,t,n,i){return d(e,n,(e=>i(e,r,t)))}function g(e,r,i){var s,u=e.valueOf();if(f(r,0))throw new Error("N/prob must be non-negative");if(p(r,1))return a(r)?v(u,r,i):t(v(u,r,i));if(m(r,1)){if(!c(r))throw new Error("N must be a positive integer");if(m(r,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var l=n(r,1);s=[];for(var d=0;f(d,r);d++){var h=o(d+1,l);s.push(v(u,h,i))}return a(r)?s:t(s)}}function y(e,r,t){for(var n=e.valueOf(),i=r.valueOf(),a=[],o=0;o<i.length;++o)a.push(v(n,i[o],t));return a}function v(e,r,t){var o=bn(e),f=o.length;if(0===f)throw new Error("Cannot calculate quantile of an empty sequence");var p,m,d=a(r)?r*(f-1):r.times(f-1),h=a(r)?Math.floor(d):d.floor().toNumber(),g=a(r)?d%1:d.minus(h);if(c(d))return t?o[d]:u(o,a(r)?d:d.valueOf());if(t)p=o[h],m=o[h+1];else{m=u(o,h+1),p=o[h];for(var y=0;y<h;++y)l(o[y],p)>0&&(p=o[y])}return n(s(p,i(1,g)),s(m,g))}})),Bd=Oe("std",["typed","map","sqrt","variance"],(e=>{var{typed:r,map:t,sqrt:n,variance:i}=e;return r("std",{"Array | Matrix":a,"Array | Matrix, string":a,"Array | Matrix, number | BigNumber":a,"Array | Matrix, number | BigNumber, string":a,"...":function(e){return a(e)}});function a(e,r){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{var a=i.apply(null,arguments);return m(a)?t(a,n):n(a)}catch(e){throw e instanceof TypeError&&e.message.includes(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),Id="corr",zd=Oe(Id,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],(e=>{var{typed:r,matrix:t,sqrt:n,sum:i,add:a,subtract:o,multiply:s,pow:u,divide:l}=e;return r(Id,{"Array, Array":function(e,r){return c(e,r)},"Matrix, Matrix":function(e,r){var n=c(e.toArray(),r.toArray());return Array.isArray(n)?t(n):n}});function c(e,r){var t=[];if(Array.isArray(e[0])&&Array.isArray(r[0])){if(e.length!==r.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var n=0;n<e.length;n++){if(e[n].length!==r[n].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");t.push(f(e[n],r[n]))}return t}if(e.length!==r.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(e,r)}function f(e,r){var t=e.length,c=i(e),f=i(r),p=e.reduce(((e,t,n)=>a(e,s(t,r[n]))),0),m=i(e.map((e=>u(e,2)))),d=i(r.map((e=>u(e,2)))),h=o(s(t,p),s(c,f)),g=n(s(o(s(t,m),u(c,2)),o(s(t,d),u(f,2))));return l(h,g)}})),qd="combinations",Rd=Oe(qd,["typed"],(e=>{var{typed:r}=e;return r(qd,{"number, number":Ai,"BigNumber, BigNumber":function(e,r){var t,n,i=e.constructor,a=e.minus(r),o=new i(1);if(!kd(e)||!kd(r))throw new TypeError("Positive integer value expected in function combinations");if(r.gt(e))throw new TypeError("k must be less than n in function combinations");if(t=o,r.lt(a))for(n=o;n.lte(a);n=n.plus(o))t=t.times(r.plus(n)).dividedBy(n);else for(n=o;n.lte(r);n=n.plus(o))t=t.times(a.plus(n)).dividedBy(n);return t}})}));function kd(e){return e.isInteger()&&e.gte(0)}var Pd="combinationsWithRep",Ud=Oe(Pd,["typed"],(e=>{var{typed:r}=e;return r(Pd,{"number, number":function(e,r){if(!ie(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ie(r)||r<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return r<e-1?Ei(e,e+r-1)/Ei(1,r):Ei(r+1,e+r-1)/Ei(1,e-1)},"BigNumber, BigNumber":function(e,r){var t,n,i=new(0,e.constructor)(1),a=e.minus(i);if(!Ld(e)||!Ld(r))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(t=i,r.lt(a))for(n=i;n.lte(a);n=n.plus(i))t=t.times(r.plus(n)).dividedBy(n);else for(n=i;n.lte(r);n=n.plus(i))t=t.times(a.plus(n)).dividedBy(n);return t}})}));function Ld(e){return e.isInteger()&&e.gte(0)}var jd="gamma",Hd=Oe(jd,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(e=>{var{typed:r,config:t,multiplyScalar:n,pow:i,BigNumber:a,Complex:o}=e;return r(jd,{number:Ii,Complex:function e(r){if(0===r.im)return Ii(r.re);if(r.re<.5){var t=new o(1-r.re,-r.im),n=new o(Math.PI*r.re,Math.PI*r.im);return new o(Math.PI).div(n.sin()).div(e(t))}r=new o(r.re-1,r.im);for(var i=new o(qi[0],0),a=1;a<qi.length;++a){var s=new o(qi[a],0);i=i.add(s.div(r.add(a)))}var u=new o(r.re+zi+.5,r.im),l=Math.sqrt(2*Math.PI),c=u.pow(r.add(.5)),f=u.neg().exp();return i.mul(l).mul(c).mul(f)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new a(1/0):s(e.minus(1));if(!e.isFinite())return new a(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(e){if(e<8)return new a([1,1,2,6,24,120,720,5040][e]);var r=t.precision+(0|Math.log(e.toNumber())),n=a.clone({precision:r});if(e%2==1)return e.times(s(new a(e-1)));for(var i=e,o=new n(e),u=e.toNumber();i>2;)u+=i-=2,o=o.times(u);return new a(o.toPrecision(a.precision))}})),$d="lgamma",Gd=Oe($d,["Complex","typed"],(e=>{var{Complex:r,typed:t}=e,n=7,i=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return t($d,{number:Pi,Complex:function e(t){if(t.isNaN())return new r(NaN,NaN);if(0===t.im)return new r(Pi(t.re),0);if(t.re>=n||Math.abs(t.im)>=7)return a(t);if(t.re<=.1){var i=(l=6.283185307179586,c=t.im,((l>0||!(l<0)&&1/l==1/0)^(c>0||!(c<0)&&1/c==1/0)?-l:l)*Math.floor(.5*t.re+.25)),s=t.mul(Math.PI).sin().log(),u=e(new r(1-t.re,-t.im));return new r(1.1447298858494002,i).sub(s).sub(u)}return t.im>=0?o(t):o(t.conjugate()).conjugate();var l,c},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function a(e){for(var t=e.sub(.5).mul(e.log()).sub(e).add(Ri),n=new r(1,0).div(e),a=n.div(e),o=i[0],s=i[1],u=2*a.re,l=a.re*a.re+a.im*a.im,c=2;c<8;c++){var f=s;s=-l*o+i[c],o=u*o+f}var p=n.mul(a.mul(o).add(s));return t.add(p)}function o(e){var t=0,i=0,o=e;for(e=e.add(1);e.re<=n;){var s=(o=o.mul(e)).im<0?1:0;0!==s&&0===i&&t++,i=s,e=e.add(1)}return a(e).sub(o.log()).sub(new r(0,2*t*Math.PI*1))}})),Vd="factorial",Zd=Oe(Vd,["typed","gamma"],(e=>{var{typed:r,gamma:t}=e;return r(Vd,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return t(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return t(e.plus(1))},"Array | Matrix":r.referToSelf((e=>r=>Hn(r,e)))})})),Wd="kldivergence",Yd=Oe(Wd,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(e=>{var{typed:r,matrix:t,divide:n,sum:i,multiply:a,map:o,dotDivide:s,log:u,isNumeric:l}=e;return r(Wd,{"Array, Array":function(e,r){return c(t(e),t(r))},"Matrix, Array":function(e,r){return c(e,t(r))},"Array, Matrix":function(e,r){return c(t(e),r)},"Matrix, Matrix":function(e,r){return c(e,r)}});function c(e,r){var t=r.size().length,c=e.size().length;if(t>1)throw new Error("first object must be one dimensional");if(c>1)throw new Error("second object must be one dimensional");if(t!==c)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(r))throw new Error("Sum of elements in second object must be non zero");var f=n(e,i(e)),p=n(r,i(r)),m=i(a(f,o(s(f,p),(e=>u(e)))));return l(m)?m:Number.NaN}})),Jd="multinomial",Xd=Oe(Jd,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(e=>{var{typed:r,add:t,divide:n,multiply:i,factorial:a,isInteger:o,isPositive:s}=e;return r(Jd,{"Array | Matrix":function(e){var r=0,u=1;return jn(e,(function(e){if(!o(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");r=t(r,e),u=i(u,a(e))})),n(a(r),u)}})})),Qd="permutations",Kd=Oe(Qd,["typed","factorial"],(e=>{var{typed:r,factorial:t}=e;return r(Qd,{"number | BigNumber":t,"number, number":function(e,r){if(!ie(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!ie(r)||r<0)throw new TypeError("Positive integer value expected in function permutations");if(r>e)throw new TypeError("second argument k must be less than or equal to first argument n");return Ei(e-r+1,e)},"BigNumber, BigNumber":function(e,r){var t,n;if(!eh(e)||!eh(r))throw new TypeError("Positive integer value expected in function permutations");if(r.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(t=e.mul(0).add(1),n=e.minus(r).plus(1);n.lte(e);n=n.plus(1))t=t.times(n);return t}})}));function eh(e){return e.isInteger()&&e.gte(0)}var rh=t(56037),th=rh(Date.now());function nh(e){var r,t;return r=null===(t=e)?th:rh(String(t)),function(){return r()}}var ih="pickRandom",ah=Oe(ih,["typed","config","?on"],(e=>{var{typed:r,config:t,on:n}=e,i=nh(t.randomSeed);return n&&n("config",(function(e,r){e.randomSeed!==r.randomSeed&&(i=nh(e.randomSeed))})),r(ih,{"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,r){return o(e,r)},"Array | Matrix, number":function(e,r){return o(e,{number:r})},"Array | Matrix, Array | Matrix":function(e,r){return o(e,{weights:r})},"Array | Matrix, Array | Matrix, number":function(e,r,t){return o(e,{number:t,weights:r})},"Array | Matrix, number, Array | Matrix":function(e,r,t){return o(e,{number:r,weights:t})}});function o(e,r){var{number:t,weights:n,elementWise:o=!0}=r,s=void 0===t;s&&(t=1);var u=p(e)?e.create:p(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===o&&(e=bn(e),n=bn(n));var l=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(var c=0,f=n.length;c<f;c++){if(!a(n[c])||n[c]<0)throw new Error("Weights must be an array of positive numbers");l+=n[c]}}for(var m,d=e.length,h=[];h.length<t;){if(void 0===n)m=e[Math.floor(i()*d)];else for(var g=i()*l,y=0,v=e.length;y<v;y++)if((g-=n[y])<0){m=e[y];break}h.push(m)}return s?h[0]:u?u(h):h}}));function oh(e,r){var t=[];if((e=e.slice(0)).length>1)for(var n=0,i=e.shift();n<i;n++)t.push(oh(e,r));else for(var a=0,o=e.shift();a<o;a++)t.push(r());return t}var sh="random",uh=Oe(sh,["typed","config","?on"],(e=>{var{typed:r,config:t,on:n}=e,i=nh(t.randomSeed);return n&&n("config",(function(e,r){e.randomSeed!==r.randomSeed&&(i=nh(e.randomSeed))})),r(sh,{"":()=>o(0,1),number:e=>o(0,e),"number, number":(e,r)=>o(e,r),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,r)=>a(e,0,r),"Array | Matrix, number, number":(e,r,t)=>a(e,r,t)});function a(e,r,t){var n=oh(e.valueOf(),(()=>o(r,t)));return p(e)?e.create(n):n}function o(e,r){return e+i()*(r-e)}})),lh="randomInt",ch=Oe(lh,["typed","config","?on"],(e=>{var{typed:r,config:t,on:n}=e,i=nh(t.randomSeed);return n&&n("config",(function(e,r){e.randomSeed!==r.randomSeed&&(i=nh(e.randomSeed))})),r(lh,{"":()=>o(0,1),number:e=>o(0,e),"number, number":(e,r)=>o(e,r),"Array | Matrix":e=>a(e,0,1),"Array | Matrix, number":(e,r)=>a(e,0,r),"Array | Matrix, number, number":(e,r,t)=>a(e,r,t)});function a(e,r,t){var n=oh(e.valueOf(),(()=>o(r,t)));return p(e)?e.create(n):n}function o(e,r){return Math.floor(e+i()*(r-e))}})),fh="stirlingS2",ph=Oe(fh,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],(e=>{var{typed:r,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:o,pow:s,factorial:u,combinations:l,isNegative:c,isInteger:f,number:p,bignumber:m,larger:d}=e,h=[],g=[];return r(fh,{"number | BigNumber, number | BigNumber":function(e,r){if(!f(e)||c(e)||!f(r)||c(r))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(d(r,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");var n=!(a(e)&&a(r)),o=n?g:h,s=n?m:p,u=p(e),l=p(r);if(o[u]&&o[u].length>l)return o[u][l];for(var y=0;y<=u;++y)if(o[y]||(o[y]=[s(0===y?1:0)]),0!==y)for(var v=o[y],x=o[y-1],b=v.length;b<=y&&b<=l;++b)v[b]=b===y?1:t(i(s(b),x[b]),x[b-1]);return o[u][l]}})})),mh="bellNumbers",dh=Oe(mh,["typed","addScalar","isNegative","isInteger","stirlingS2"],(e=>{var{typed:r,addScalar:t,isNegative:n,isInteger:i,stirlingS2:a}=e;return r(mh,{"number | BigNumber":function(e){if(!i(e)||n(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var r=0,o=0;o<=e;o++)r=t(r,a(e,o));return r}})})),hh="catalan",gh=Oe(hh,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(e=>{var{typed:r,addScalar:t,divideScalar:n,multiplyScalar:i,combinations:a,isNegative:o,isInteger:s}=e;return r(hh,{"number | BigNumber":function(e){if(!s(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(a(i(e,2),e),t(e,1))}})})),yh="composition",vh=Oe(yh,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(e=>{var{typed:r,addScalar:t,combinations:n,isPositive:i,isNegative:a,isInteger:o,larger:s}=e;return r(yh,{"number | BigNumber, number | BigNumber":function(e,r){if(!(o(e)&&i(e)&&o(r)&&i(r)))throw new TypeError("Positive integer value expected in function composition");if(s(r,e))throw new TypeError("k must be less than or equal to n in function composition");return n(t(e,-1),t(r,-1))}})})),xh="leafCount",bh=Oe(xh,["parse","typed"],(e=>{var{parse:r,typed:t}=e;function n(e){var r=0;return e.forEach((e=>{r+=n(e)})),r||1}return t(xh,{Node:function(e){return n(e)}})}));function wh(e){return _(e)||P(e)&&e.isUnary()&&_(e.args[0])}function Nh(e){return!!_(e)||(!(!z(e)&&!P(e)||!e.args.every(Nh))||!(!U(e)||!Nh(e.content)))}function Dh(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function Eh(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?Dh(Object(t),!0).forEach((function(r){(0,Gu.A)(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Dh(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var Ah=Oe("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],(e=>{var{FunctionNode:r,OperatorNode:t,SymbolNode:n}=e,i=!0,a=!1,o="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:a,total:i,commutative:a,associative:a},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:a,total:i,commutative:a,associative:a},paren:{trivial:i,total:i,commutative:i,associative:a},defaultF:{trivial:a,total:i,commutative:a,associative:a}};function u(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,n=o;if("string"==typeof e?n=e:P(e)?n=e.fn.toString():z(e)?n=e.name:U(e)&&(n="paren"),Y(t,n)){var i=t[n];if(Y(i,r))return i[r];if(Y(s,n))return s[n][r]}if(Y(t,o)){var a=t[o];return Y(a,r)?a[r]:s[o][r]}if(Y(s,n)){var u=s[n];if(Y(u,r))return u[r]}return s[o][r]}function l(e){return u(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)}function c(e,r){var t,n=[];return l(e,r)?(t=e.op,function e(r){for(var i=0;i<r.args.length;i++){var a=r.args[i];P(a)&&t===a.op?e(a):n.push(a)}}(e),n):e.args}function f(e){return P(e)?function(r){try{return new t(e.op,e.fn,r,e.implicit)}catch(e){return console.error(e),[]}}:function(t){return new r(new n(e.name),t)}}return{createMakeNodeFunction:f,hasProperty:u,isCommutative:function(e){return u(e,"commutative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)},isAssociative:l,mergeContext:function(e,r){var t=Eh({},e);for(var n in r)Y(e,n)?t[n]=Eh(Eh({},r[n]),e[n]):t[n]=r[n];return t},flatten:function e(r,t){if(!r.args||0===r.args.length)return r;r.args=c(r,t);for(var n=0;n<r.args.length;n++)e(r.args[n],t)},allChildren:c,unflattenr:function e(r,t){if(r.args&&0!==r.args.length){for(var n=f(r),i=r.args.length,a=0;a<i;a++)e(r.args[a],t);if(i>2&&l(r,t)){for(var o=r.args.pop();r.args.length>0;)o=n([r.args.pop(),o]);r.args=o.args}}},unflattenl:function e(r,t){if(r.args&&0!==r.args.length){for(var n=f(r),i=r.args.length,a=0;a<i;a++)e(r.args[a],t);if(i>2&&l(r,t)){for(var o=r.args.shift();r.args.length>0;)o=n([o,r.args.shift()]);r.args=o.args}}},defaultContext:s,realContext:{divide:{total:a},log:{total:a}},positiveContext:{subtract:{total:a},abs:{trivial:i},log:{total:i}}}})),Sh=Oe("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"],(e=>{var{config:r,typed:t,parse:n,add:i,subtract:a,multiply:o,divide:s,pow:u,isZero:l,equal:c,resolve:f,simplifyConstant:p,simplifyCore:m,fraction:d,bignumber:h,mathWithTransform:g,matrix:y,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:D,OperatorNode:E,ParenthesisNode:A,SymbolNode:S}=e,{hasProperty:C,isCommutative:M,isAssociative:O,mergeContext:T,flatten:F,unflattenr:B,unflattenl:I,createMakeNodeFunction:z,defaultContext:q,realContext:R,positiveContext:k}=Ah({FunctionNode:w,OperatorNode:E,SymbolNode:S});t.addConversion({from:"Object",to:"Map",convert:je});var P=t("simplify",{Node:Z,"Node, Map":(e,r)=>Z(e,!1,r),"Node, Map, Object":(e,r,t)=>Z(e,!1,r,t),"Node, Array":Z,"Node, Array, Map":Z,"Node, Array, Map, Object":Z});function L(e){return e.transform((function(e,r,t){return U(e)?L(e.content):e}))}t.removeConversion({from:"Object",to:"Map",convert:je}),P.defaultContext=q,P.realContext=R,P.positiveContext=k;var j={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,r){var t={};if(e.s){var i=e.s.split("->");if(2!==i.length)throw SyntaxError("Could not parse rule: "+e.s);t.l=i[0],t.r=i[1]}else t.l=e.l,t.r=e.r;for(var a of(t.l=L(n(t.l)),t.r=L(n(t.r)),["imposeContext","repeat","assuming"]))a in e&&(t[a]=e[a]);if(e.evaluate&&(t.evaluate=n(e.evaluate)),O(t.l,r)){var o,s=!M(t.l,r);s&&(o=V());var u=z(t.l),l=V();t.expanded={},t.expanded.l=u([t.l,l]),F(t.expanded.l,r),B(t.expanded.l,r),t.expanded.r=u([t.r,l]),s&&(t.expandedNC1={},t.expandedNC1.l=u([o,t.l]),t.expandedNC1.r=u([o,t.r]),t.expandedNC2={},t.expandedNC2.l=u([o,t.expanded.l]),t.expandedNC2.r=u([o,t.expanded.r]))}return t}P.rules=[m,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},p,{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}}},p,{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 G=0;function V(){return new S("_p"+G++)}function Z(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Le(),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=n.consoleDebug;r=function(e,r){for(var t=[],n=0;n<e.length;n++){var i=e[n],a=void 0,o=typeof i;switch(o){case"string":i={s:i};case"object":a=$(i,r);break;case"function":a=i;break;default:throw TypeError("Unsupported type of rule: "+o)}t.push(a)}return t}(r||P.rules,n.context);for(var a=f(e,t),o={},s=(a=L(a)).toString({parenthesis:"all"});!o[s];){o[s]=!0,G=0;var u=s;i&&console.log("Working on: ",s);for(var l=0;l<r.length;l++){var c="";if("function"==typeof r[l]?(a=r[l](a,n),i&&(c=r[l].name)):(F(a,n.context),a=J(a,r[l],n.context),i&&(c="".concat(r[l].l.toString()," -> ").concat(r[l].r.toString()))),i){var p=a.toString({parenthesis:"all"});p!==u&&(console.log("Applying",c,"produced",p),u=p)}I(a,n.context)}s=a.toString({parenthesis:"all"})}return a}function W(e,r,t){var n=e;if(e)for(var i=0;i<e.length;++i){var a=J(e[i],r,t);a!==e[i]&&(n===e&&(n=e.slice()),n[i]=a)}return n}function J(e,r,t){if(r.assuming)for(var n in r.assuming)for(var i in r.assuming[n])if(C(n,i,t)!==r.assuming[n][i])return e;var a=T(r.imposeContext,t),o=e;if(o instanceof E||o instanceof w){var s=W(o.args,r,t);s!==o.args&&((o=o.clone()).args=s)}else if(o instanceof A){if(o.content){var u=J(o.content,r,t);u!==o.content&&(o=new A(u))}}else if(o instanceof x){var l=W(o.items,r,t);l!==o.items&&(o=new x(l))}else if(o instanceof v){var c=o.object;o.object&&(c=J(o.object,r,t));var f=o.index;o.index&&(f=J(o.index,r,t)),c===o.object&&f===o.index||(o=new v(c,f))}else if(o instanceof N){var p=W(o.dimensions,r,t);p!==o.dimensions&&(o=new N(p))}else if(o instanceof D){var m=!1,d={};for(var h in o.properties)d[h]=J(o.properties[h],r,t),d[h]!==o.properties[h]&&(m=!0);m&&(o=new D(d))}var g=r.r,y=K(r.l,o,a)[0];if(!y&&r.expanded&&(g=r.expanded.r,y=K(r.expanded.l,o,a)[0]),!y&&r.expandedNC1&&(g=r.expandedNC1.r,(y=K(r.expandedNC1.l,o,a)[0])||(g=r.expandedNC2.r,y=K(r.expandedNC2.l,o,a)[0])),y){var b=o.implicit;o=g.clone(),b&&"implicit"in g&&(o.implicit=!0),o=o.transform((function(e){return e.isSymbolNode&&Y(y.placeholders,e.name)?y.placeholders[e.name].clone():e}))}return r.repeat&&o!==e&&(o=J(o,r,t)),o}function X(e,r){var t={placeholders:{}};if(!e.placeholders&&!r.placeholders)return t;if(!e.placeholders)return r;if(!r.placeholders)return e;for(var n in e.placeholders)if(Y(e.placeholders,n)&&(t.placeholders[n]=e.placeholders[n],Y(r.placeholders,n)&&!ee(e.placeholders[n],r.placeholders[n])))return null;for(var i in r.placeholders)Y(r.placeholders,i)&&(t.placeholders[i]=r.placeholders[i]);return t}function Q(e,r){var t,n=[];if(0===e.length||0===r.length)return n;for(var i=0;i<e.length;i++)for(var a=0;a<r.length;a++)(t=X(e[i],r[a]))&&n.push(t);return n}function K(e,r,t,n){var i=[{placeholders:{}}];if(e instanceof E&&r instanceof E||e instanceof w&&r instanceof w){if(e instanceof E){if(e.op!==r.op||e.fn!==r.fn)return[]}else if(e instanceof w&&e.name!==r.name)return[];if(!(1===r.args.length&&1===e.args.length||!O(r,t)&&r.args.length===e.args.length||n)){if(r.args.length>=2&&2===e.args.length){for(var a=function(e,r){var t,n,i=[],a=z(e);if(M(e,r))for(var o=0;o<e.args.length;o++)(n=e.args.slice(0)).splice(o,1),t=1===n.length?n[0]:a(n),i.push(a([e.args[o],t]));else for(var s=1;s<e.args.length;s++){var u=e.args[0];s>1&&(u=a(e.args.slice(0,s))),t=1===(n=e.args.slice(s)).length?n[0]:a(n),i.push(a([u,t]))}return i}(r,t),o=[],s=0;s<a.length;s++){var u=K(e,a[s],t,!0);o=o.concat(u)}return o}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var l=[],f=0;f<e.args.length;f++){var p=K(e.args[f],r.args[f],t);if(0===p.length)break;l.push(p)}if(l.length!==e.args.length){if(!M(r,t)||1===e.args.length)return[];if(e.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");var m=K(e.args[0],r.args[1],t);if(0===m.length)return[];var d=K(e.args[1],r.args[0],t);if(0===d.length)return[];l=[m,d]}i=function(e){if(0===e.length)return e;for(var r=e.reduce(Q),t=[],n={},i=0;i<r.length;i++){var a=JSON.stringify(r[i]);n[a]||(n[a]=!0,t.push(r[i]))}return t}(l)}else if(e instanceof S){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(j[e.name]){if(e.name!==r.name)return[]}else switch(e.name[1]>="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":i[0].placeholders[e.name]=r;break;case"c":case"cl":if(!_(r))return[];i[0].placeholders[e.name]=r;break;case"v":if(_(r))return[];i[0].placeholders[e.name]=r;break;case"vl":if(!H(r))return[];i[0].placeholders[e.name]=r;break;case"cd":if(!wh(r))return[];i[0].placeholders[e.name]=r;break;case"vd":if(wh(r))return[];i[0].placeholders[e.name]=r;break;case"ce":if(!Nh(r))return[];i[0].placeholders[e.name]=r;break;case"ve":if(Nh(r))return[];i[0].placeholders[e.name]=r;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof b))return[];if(!c(e.value,r.value))return[]}return i}function ee(e,r){if(e instanceof b&&r instanceof b){if(!c(e.value,r.value))return!1}else if(e instanceof S&&r instanceof S){if(e.name!==r.name)return!1}else{if(!(e instanceof E&&r instanceof E||e instanceof w&&r instanceof w))return!1;if(e instanceof E){if(e.op!==r.op||e.fn!==r.fn)return!1}else if(e instanceof w&&e.name!==r.name)return!1;if(e.args.length!==r.args.length)return!1;for(var t=0;t<e.args.length;t++)if(!ee(e.args[t],r.args[t]))return!1}return!0}return P})),Ch=Oe("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],(e=>{var{typed:r,config:t,mathWithTransform:n,matrix:i,fraction:a,bignumber:o,AccessorNode:s,ArrayNode:l,ConstantNode:c,FunctionNode:f,IndexNode:m,ObjectNode:d,OperatorNode:h,SymbolNode:g}=e,{isCommutative:y,isAssociative:v,allChildren:x,createMakeNodeFunction:b}=Ah({FunctionNode:f,OperatorNode:h,SymbolNode:g}),w=r("simplifyConstant",{Node:e=>A(F(e,{})),"Node, Object":function(e,r){return A(F(e,r))}});function N(e){return u(e)?e.valueOf():e instanceof Array?e.map(N):p(e)?i(N(e.valueOf())):e}function D(e,r,t){try{return n[e].apply(null,r)}catch(i){return r=r.map(N),C(n[e].apply(null,r),t)}}var E=r({Fraction:function(e){var r,t=e.s*e.n;r=t<0?new h("-","unaryMinus",[new c(-t)]):new c(t);if(1===e.d)return r;return new h("/","divide",[r,new c(e.d)])},number:function(e){return e<0?O(new c(-e)):new c(e)},BigNumber:function(e){return e<0?O(new c(-e)):new c(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new c(e)},Matrix:function(e){return new l(e.valueOf().map((e=>E(e))))}});function A(e){return R(e)?e:E(e)}function S(e,r){if(r&&!1!==r.exactFractions&&isFinite(e)&&a){var t=a(e),n=r&&"number"==typeof r.fractionsLimit?r.fractionsLimit:1/0;if(t.valueOf()===e&&t.n<n&&t.d<n)return t}return e}var C=r({"string, Object":function(e,r){return"BigNumber"===t.number?(void 0===o&&mu(),o(e)):"Fraction"===t.number?(void 0===a&&du(),a(e)):S(parseFloat(e),r)},"Fraction, Object":function(e,r){return e},"BigNumber, Object":function(e,r){return e},"number, Object":function(e,r){return S(e,r)},"Complex, Object":function(e,r){return 0!==e.im?e:S(e.re,r)},"Matrix, Object":function(e,r){return i(S(e.valueOf()))},"Array, Object":function(e,r){return e.map(S)}});function O(e){return new h("-","unaryMinus",[e])}function T(e,r,t,n){var i=r.shift(),a=r.reduce(((r,i)=>{if(!R(i)){var a=r.pop();if(R(a))return[a,i];try{return r.push(D(e,[a,i],n)),r}catch(e){r.push(a)}}r.push(A(r.pop()));var o=1===r.length?r[0]:t(r);return[t([o,A(i)])]}),[i]);return 1===a.length?a[0]:t([a[0],E(a[1])])}function F(e,r){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":return C(e.value,r);case"string":return e.value;default:if(!isNaN(e.value))return C(e.value,r)}return e;case"FunctionNode":if(n[e.name]&&n[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){var t=e.args.map((e=>F(e,r)));if(!t.some(R))try{return D(e.name,t,r)}catch(e){}if("size"===e.name&&1===t.length&&M(t[0])){for(var a=[],o=t[0];M(o);)a.push(o.items.length),o=o.items[0];return i(a)}return new f(e.name,t.map(A))}case"OperatorNode":var u,h,g=e.fn.toString(),N=b(e);if(P(e)&&e.isUnary())h=R((u=[F(e.args[0],r)])[0])?N(u):D(g,u,r);else if(v(e,r.context))if(u=(u=x(e,r.context)).map((e=>F(e,r))),y(g,r.context)){for(var E=[],S=[],O=0;O<u.length;O++)R(u[O])?S.push(u[O]):E.push(u[O]);E.length>1?(h=T(g,E,N,r),S.unshift(h),h=T(g,S,N,r)):h=T(g,u,N,r)}else h=T(g,u,N,r);else u=e.args.map((e=>F(e,r))),h=T(g,u,N,r);return h;case"ParenthesisNode":return F(e.content,r);case"AccessorNode":return function(e,r,t){if(!q(r))return new s(A(e),A(r));if(M(e)||p(e)){for(var n=Array.from(r.dimensions);n.length>0;)if(_(n[0])&&"string"!=typeof n[0].value){var a=C(n.shift().value,t);M(e)?e=e.items[a-1]:(e=e.valueOf()[a-1])instanceof Array&&(e=i(e))}else{if(!(n.length>1&&_(n[1])&&"string"!=typeof n[1].value))break;var o=C(n[1].value,t),u=[],f=M(e)?e.items:e.valueOf();for(var d of f)if(M(d))u.push(d.items[o-1]);else{if(!p(e))break;u.push(d[o-1])}if(u.length!==f.length)break;e=M(e)?new l(u):i(u),n.splice(1,1)}return n.length===r.dimensions.length?new s(A(e),r):n.length>0?(r=new m(n),new s(A(e),r)):e}if(k(e)&&1===r.dimensions.length&&_(r.dimensions[0])){var h=r.dimensions[0].value;return h in e.properties?e.properties[h]:new c}return new s(A(e),r)}(F(e.object,r),F(e.index,r),r);case"ArrayNode":var B=e.items.map((e=>F(e,r)));return B.some(R)?new l(B.map(A)):i(B);case"IndexNode":return new m(e.dimensions.map((e=>w(e,r))));case"ObjectNode":var I={};for(var z in e.properties)I[z]=w(e.properties[z],r);return new d(I);default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(e.type))}}return w})),Mh="simplifyCore",Oh=Oe(Mh,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{var{typed:r,parse:t,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:l,AccessorNode:c,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:d,ObjectNode:h,OperatorNode:g,ParenthesisNode:y,SymbolNode:v}=e,x=new p(0),b=new p(1),w=new p(!0),N=new p(!1);function D(e){return P(e)&&["and","not","or"].includes(e.op)}var{hasProperty:E,isCommutative:A}=Ah({FunctionNode:m,OperatorNode:g,SymbolNode:v});function S(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=r?r.context:void 0;if(E(e,"trivial",t)){if(z(e)&&1===e.args.length)return S(e.args[0],r);var a=!1,o=0;if(e.forEach((e=>{1===++o&&(a=S(e,r))})),1===o)return a}var s=e;if(z(s)){var u=function(e){var r="OperatorNode:"+e;for(var t of Cp)if(r in t)return t[r].op;return null}(s.name);if(!u)return new m(S(s.fn),s.args.map((e=>S(e,r))));if(s.args.length>2&&E(s,"associative",t))for(;s.args.length>2;){var l=s.args.pop(),p=s.args.pop();s.args.push(new g(u,s.name,[l,p]))}s=new g(u,s.name,s.args)}if(P(s)&&s.isUnary()){var y=S(s.args[0],r);if("~"===s.op&&P(y)&&y.isUnary()&&"~"===y.op)return y.args[0];if("not"===s.op&&P(y)&&y.isUnary()&&"not"===y.op&&D(y.args[0]))return y.args[0];var v=!0;if("-"===s.op&&P(y)&&(y.isBinary()&&"subtract"===y.fn&&(s=new g("-","subtract",[y.args[1],y.args[0]]),v=!1),y.isUnary()&&"-"===y.op))return y.args[0];if(v)return new g(s.op,s.fn,[y])}if(P(s)&&s.isBinary()){var O=S(s.args[0],r),T=S(s.args[1],r);if("+"===s.op){if(_(O)&&i(O.value))return T;if(_(T)&&i(T.value))return O;P(T)&&T.isUnary()&&"-"===T.op&&(T=T.args[0],s=new g("-","subtract",[O,T]))}if("-"===s.op)return P(T)&&T.isUnary()&&"-"===T.op?S(new g("+","add",[O,T.args[0]]),r):_(O)&&i(O.value)?S(new g("-","unaryMinus",[T])):_(T)&&i(T.value)?O:new g(s.op,s.fn,[O,T]);if("*"===s.op){if(_(O)){if(i(O.value))return x;if(n(O.value,1))return T}if(_(T)){if(i(T.value))return x;if(n(T.value,1))return O;if(A(s,t))return new g(s.op,s.fn,[T,O],s.implicit)}return new g(s.op,s.fn,[O,T],s.implicit)}if("/"===s.op)return _(O)&&i(O.value)?x:_(T)&&n(T.value,1)?O:new g(s.op,s.fn,[O,T]);if("^"===s.op&&_(T)){if(i(T.value))return b;if(n(T.value,1))return O}if("and"===s.op){if(_(O)){if(!O.value)return N;if(D(T))return T;if(_(T))return T.value?w:N}if(_(T)){if(!T.value)return N;if(D(O))return O}}if("or"===s.op){if(_(O)){if(O.value)return w;if(D(T))return T}if(_(T)){if(T.value)return w;if(D(O))return O}}return new g(s.op,s.fn,[O,T])}if(P(s))return new g(s.op,s.fn,s.args.map((e=>S(e,r))));if(M(s))return new f(s.items.map((e=>S(e,r))));if(C(s))return new c(S(s.object,r),S(s.index,r));if(q(s))return new d(s.dimensions.map((e=>S(e,r))));if(k(s)){var F={};for(var B in s.properties)F[B]=S(s.properties[B],r);return new h(F)}return s}return r(Mh,{Node:S,"Node,Object":S})})),Th=Oe("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(e=>{var{typed:r,parse:t,ConstantNode:n,FunctionNode:i,OperatorNode:a,ParenthesisNode:o}=e;function s(e,r){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!r)return e;if(H(e)){if(u.has(e.name)){var l=Array.from(u).join(", ");throw new ReferenceError("recursive loop of variable definitions among {".concat(l,"}"))}var c=r.get(e.name);if(R(c)){var f=new Set(u);return f.add(e.name),s(c,r,f)}return"number"==typeof c?t(String(c)):void 0!==c?new n(c):e}if(P(e)){var p=e.args.map((function(e){return s(e,r,u)}));return new a(e.op,e.fn,p,e.implicit)}if(U(e))return new o(s(e.content,r,u));if(z(e)){var m=e.args.map((function(e){return s(e,r,u)}));return new i(e.name,m)}return e.map((e=>s(e,r,u)))}return r("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,r)=>s(e,je(r)),"Array | Matrix":r.referToSelf((e=>r=>r.map((r=>e(r))))),"Array | Matrix, null | undefined":r.referToSelf((e=>r=>r.map((r=>e(r))))),"Array, Object":r.referTo("Array,Map",(e=>(r,t)=>e(r,je(t)))),"Matrix, Object":r.referTo("Matrix,Map",(e=>(r,t)=>e(r,je(t)))),"Array | Matrix, Map":r.referToSelf((e=>(r,t)=>r.map((r=>e(r,t)))))})})),Fh="symbolicEqual",_h=Oe(Fh,["parse","simplify","typed","OperatorNode"],(e=>{var{parse:r,simplify:t,typed:n,OperatorNode:i}=e;function a(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=new i("-","subtract",[e,r]),o=t(a,{},n);return _(o)&&!o.value}return n(Fh,{"Node, Node":a,"Node, Node, Object":a})})),Bh="derivative",Ih=Oe(Bh,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{var{typed:r,config:t,parse:n,simplify:i,equal:a,isZero:o,numeric:s,ConstantNode:u,FunctionNode:l,OperatorNode:c,ParenthesisNode:f,SymbolNode:p}=e;function m(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0},n={};g(n,e,r.name);var a=y(e,n);return t.simplify?i(a):a}r.addConversion({from:"identifier",to:"SymbolNode",convert:n});var d=r(Bh,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m});r.removeConversion({from:"identifier",to:"SymbolNode",convert:n}),d._simplify=!0,d.toTex=function(e){return h.apply(null,e.args)};var h=r("_derivTex",{"Node, SymbolNode":function(e,r){return _(e)&&"string"===G(e.value)?h(n(e.value).toString(),r.toString(),1):h(e.toTex(),r.toString(),1)},"Node, ConstantNode":function(e,r){if("string"===G(r.value))return h(e,n(r.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,r,t){return h(e.toString(),r.name,t.value)},"string, string, number":function(e,r,t){return(1===t?"{d\\over d"+r+"}":"{d^{"+t+"}\\over d"+r+"^{"+t+"}}")+"\\left[".concat(e,"\\right]")}}),g=r("constTag",{"Object, ConstantNode, string":function(e,r){return e[r]=!0,!0},"Object, SymbolNode, string":function(e,r,t){return r.name!==t&&(e[r]=!0,!0)},"Object, ParenthesisNode, string":function(e,r,t){return g(e,r.content,t)},"Object, FunctionAssignmentNode, string":function(e,r,t){return r.params.includes(t)?g(e,r.expr,t):(e[r]=!0,!0)},"Object, FunctionNode | OperatorNode, string":function(e,r,t){if(r.args.length>0){for(var n=g(e,r.args[0],t),i=1;i<r.args.length;++i)n=g(e,r.args[i],t)&&n;if(n)return e[r]=!0,!0}return!1}}),y=r("_derivative",{"ConstantNode, Object":function(e){return v(0)},"SymbolNode, Object":function(e,r){return void 0!==r[e]?v(0):v(1)},"ParenthesisNode, Object":function(e,r){return new f(y(e.content,r))},"FunctionAssignmentNode, Object":function(e,r){return void 0!==r[e]?v(0):y(e.expr,r)},"FunctionNode, Object":function(e,r){if(void 0!==r[e])return v(0);var t,n,i,a,o=e.args[0],s=!1,u=!1;switch(e.name){case"cbrt":s=!0,n=new c("*","multiply",[v(3),new c("^","pow",[o,new c("/","divide",[v(2),v(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,n=new c("*","multiply",[v(2),new l("sqrt",[o])]);else if(2===e.args.length)return r[t=new c("/","divide",[v(1),e.args[1]])]=r[e.args[1]],y(new c("^","pow",[o,t]),r);break;case"log10":t=v(10);case"log":if(t||1!==e.args.length){if(1===e.args.length&&t||2===e.args.length&&void 0!==r[e.args[1]])n=new c("*","multiply",[o.clone(),new l("log",[t||e.args[1]])]),s=!0;else if(2===e.args.length)return y(new c("/","divide",[new l("log",[o]),new l("log",[e.args[1]])]),r)}else n=o.clone(),s=!0;break;case"pow":if(2===e.args.length)return r[t]=r[e.args[1]],y(new c("^","pow",[o,e.args[1]]),r);break;case"exp":n=new l("exp",[o.clone()]);break;case"sin":n=new l("cos",[o.clone()]);break;case"cos":n=new c("-","unaryMinus",[new l("sin",[o.clone()])]);break;case"tan":n=new c("^","pow",[new l("sec",[o.clone()]),v(2)]);break;case"sec":n=new c("*","multiply",[e,new l("tan",[o.clone()])]);break;case"csc":u=!0,n=new c("*","multiply",[e,new l("cot",[o.clone()])]);break;case"cot":u=!0,n=new c("^","pow",[new l("csc",[o.clone()]),v(2)]);break;case"asin":s=!0,n=new l("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[o.clone(),v(2)])])]);break;case"acos":s=!0,u=!0,n=new l("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[o.clone(),v(2)])])]);break;case"atan":s=!0,n=new c("+","add",[new c("^","pow",[o.clone(),v(2)]),v(1)]);break;case"asec":s=!0,n=new c("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acsc":s=!0,u=!0,n=new c("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new c("-","subtract",[new c("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acot":s=!0,u=!0,n=new c("+","add",[new c("^","pow",[o.clone(),v(2)]),v(1)]);break;case"sinh":n=new l("cosh",[o.clone()]);break;case"cosh":n=new l("sinh",[o.clone()]);break;case"tanh":n=new c("^","pow",[new l("sech",[o.clone()]),v(2)]);break;case"sech":u=!0,n=new c("*","multiply",[e,new l("tanh",[o.clone()])]);break;case"csch":u=!0,n=new c("*","multiply",[e,new l("coth",[o.clone()])]);break;case"coth":u=!0,n=new c("^","pow",[new l("csch",[o.clone()]),v(2)]);break;case"asinh":s=!0,n=new l("sqrt",[new c("+","add",[new c("^","pow",[o.clone(),v(2)]),v(1)])]);break;case"acosh":s=!0,n=new l("sqrt",[new c("-","subtract",[new c("^","pow",[o.clone(),v(2)]),v(1)])]);break;case"atanh":s=!0,n=new c("-","subtract",[v(1),new c("^","pow",[o.clone(),v(2)])]);break;case"asech":s=!0,u=!0,n=new c("*","multiply",[o.clone(),new l("sqrt",[new c("-","subtract",[v(1),new c("^","pow",[o.clone(),v(2)])])])]);break;case"acsch":s=!0,u=!0,n=new c("*","multiply",[new l("abs",[o.clone()]),new l("sqrt",[new c("+","add",[new c("^","pow",[o.clone(),v(2)]),v(1)])])]);break;case"acoth":s=!0,u=!0,n=new c("-","subtract",[v(1),new c("^","pow",[o.clone(),v(2)])]);break;case"abs":n=new c("/","divide",[new l(new p("abs"),[o.clone()]),o.clone()]);break;default:throw new Error('Cannot process function "'+e.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}s?(i="/",a="divide"):(i="*",a="multiply");var f=y(o,r);return u&&(f=new c("-","unaryMinus",[f])),new c(i,a,[f,n])},"OperatorNode, Object":function(e,r){if(void 0!==r[e])return v(0);if("+"===e.op)return new c(e.op,e.fn,e.args.map((function(e){return y(e,r)})));if("-"===e.op){if(e.isUnary())return new c(e.op,e.fn,[y(e.args[0],r)]);if(e.isBinary())return new c(e.op,e.fn,[y(e.args[0],r),y(e.args[1],r)])}if("*"===e.op){var t=e.args.filter((function(e){return void 0!==r[e]}));if(t.length>0){var n=e.args.filter((function(e){return void 0===r[e]})),i=1===n.length?n[0]:new c("*","multiply",n),s=t.concat(y(i,r));return new c("*","multiply",s)}return new c("+","add",e.args.map((function(t){return new c("*","multiply",e.args.map((function(e){return e===t?y(e,r):e.clone()})))})))}if("/"===e.op&&e.isBinary()){var u=e.args[0],f=e.args[1];return void 0!==r[f]?new c("/","divide",[y(u,r),f]):void 0!==r[u]?new c("*","multiply",[new c("-","unaryMinus",[u]),new c("/","divide",[y(f,r),new c("^","pow",[f.clone(),v(2)])])]):new c("/","divide",[new c("-","subtract",[new c("*","multiply",[y(u,r),f.clone()]),new c("*","multiply",[u.clone(),y(f,r)])]),new c("^","pow",[f.clone(),v(2)])])}if("^"===e.op&&e.isBinary()){var p=e.args[0],m=e.args[1];if(void 0!==r[p])return _(p)&&(o(p.value)||a(p.value,1))?v(0):new c("*","multiply",[e,new c("*","multiply",[new l("log",[p.clone()]),y(m.clone(),r)])]);if(void 0!==r[m]){if(_(m)){if(o(m.value))return v(0);if(a(m.value,1))return y(p,r)}var d=new c("^","pow",[p.clone(),new c("-","subtract",[m,v(1)])]);return new c("*","multiply",[m.clone(),new c("*","multiply",[y(p,r),d])])}return new c("*","multiply",[new c("^","pow",[p.clone(),m.clone()]),new c("+","add",[new c("*","multiply",[y(p,r),new c("/","divide",[m.clone(),p.clone()])]),new c("*","multiply",[y(m,r),new l("log",[p.clone()])])])])}throw new Error('Cannot process operator "'+e.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function v(e,r){return new u(s(e,r||t.number))}return d})),zh="rationalize",qh=Oe(zh,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],(e=>{var{config:r,typed:t,equal:n,isZero:i,add:a,subtract:o,multiply:s,divide:u,pow:l,parse:c,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:d,bignumber:h,mathWithTransform:g,matrix:y,AccessorNode:v,ArrayNode:x,ConstantNode:b,FunctionNode:w,IndexNode:N,ObjectNode:D,OperatorNode:E,SymbolNode:A,ParenthesisNode:S}=e;function C(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=function(){var e=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],r=[{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)"}],t=[{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)"}],n=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],i={};return i.firstRules=e.concat(r,n),i.distrDivRules=t,i.sucDivRules=n,i.firstRulesAgain=e.concat(r),i.finalRules=[p,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},f,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],i}(),i=function(e,r,t,n){var i=[],a=m(e,n,r,{exactFractions:!1}),o="+-*"+((t=!!t)?"/":"");u(a);var s={};return s.expression=a,s.variables=i,s;function u(e){var r=e.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===e.op){if("ConstantNode"!==e.args[1].type||!ie(parseFloat(e.args[1].value)))throw new Error("There is a non-integer exponent");u(e.args[0])}else{if(!o.includes(e.op))throw new Error("Operator "+e.op+" invalid in polynomial expression");for(var t=0;t<e.args.length;t++)u(e.args[t])}else if("SymbolNode"===r){var n=e.name;-1===i.indexOf(n)&&i.push(n)}else if("ParenthesisNode"===r)u(e.content);else if("ConstantNode"!==r)throw new Error("type "+r+" is not allowed in polynomial expression")}}(e,r,!0,n.firstRules),a=i.variables.length,o={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,a>=1){var u,l;e=M(e);var c,d=!0,h=!1;for(e=m(e,n.firstRules,{},o);l=d?n.distrDivRules:n.sucDivRules,d=!d,(c=(e=m(e,l,{},s)).toString())!==u;)h=!0,u=c;h&&(e=m(e,n.firstRulesAgain,{},o)),e=m(e,n.finalRules,{},o)}var g=[],y={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===a&&(e.args[0]=O(e.args[0],g),e.args[1]=O(e.args[1])),t&&(y.numerator=e.args[0],y.denominator=e.args[1])):(1===a&&(e=O(e,g)),t&&(y.numerator=e,y.denominator=null)),t?(y.coefficients=g,y.variables=i.variables,y.expression=e,y):e}return t(zh,{Node:C,"Node, boolean":(e,r)=>C(e,{},r),"Node, Object":C,"Node, Object, boolean":C});function M(e,r,t){var n=e.type,i=arguments.length>1;if("OperatorNode"===n&&e.isBinary()){var a,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(o=(a=parseFloat(e.args[1].value))>=2&&ie(a))),o){if(a>2){var s=e.args[0],u=new E("^","pow",[e.args[0].cloneDeep(),new b(a-1)]);e=new E("*","multiply",[s,u])}else e=new E("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===t?r.content=e:r.args[t]=e)}}if("ParenthesisNode"===n)M(e.content,e,"content");else if("ConstantNode"!==n&&"SymbolNode"!==n)for(var l=0;l<e.args.length;l++)M(e.args[l],e,l);if(!i)return e}function O(e,r){void 0===r&&(r=[]),r[0]=0;var t={cte:1,oper:"+",fire:""},n=0,i="";!function e(t,a,o){var s=t.type;if("FunctionNode"===s)throw new Error("There is an unsolved function call");if("OperatorNode"===s){if(!"+-*^".includes(t.op))throw new Error("Operator "+t.op+" invalid");if(null!==a){if(("unaryMinus"===t.fn||"pow"===t.fn)&&"add"!==a.fn&&"subtract"!==a.fn&&"multiply"!==a.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"multiply"===t.fn)&&"add"!==a.fn&&"subtract"!==a.fn)throw new Error("Invalid "+t.op+" placing");if(("subtract"===t.fn||"add"===t.fn||"unaryMinus"===t.fn)&&0!==o.noFil)throw new Error("Invalid "+t.op+" placing")}"^"!==t.op&&"*"!==t.op||(o.fire=t.op);for(var u=0;u<t.args.length;u++)"unaryMinus"===t.fn&&(o.oper="-"),"+"!==t.op&&"subtract"!==t.fn||(o.fire="",o.cte=1,o.oper=0===u?"+":t.op),o.noFil=u,e(t.args[u],t,o)}else if("SymbolNode"===s){if(t.name!==i&&""!==i)throw new Error("There is more than one variable");if(i=t.name,null===a)return void(r[1]=1);if("^"===a.op&&0!==o.noFil)throw new Error("In power the variable should be the first parameter");if("*"===a.op&&1!==o.noFil)throw new Error("In multiply the variable should be the second parameter");""!==o.fire&&"*"!==o.fire||(n<1&&(r[1]=0),r[1]+=o.cte*("+"===o.oper?1:-1),n=Math.max(1,n))}else{if("ConstantNode"!==s)throw new Error("Type "+s+" is not allowed");var l=parseFloat(t.value);if(null===a)return void(r[0]=l);if("^"===a.op){if(1!==o.noFil)throw new Error("Constant cannot be powered");if(!ie(l)||l<=0)throw new Error("Non-integer exponent is not allowed");for(var c=n+1;c<l;c++)r[c]=0;return l>n&&(r[l]=0),r[l]+=o.cte*("+"===o.oper?1:-1),void(n=Math.max(l,n))}o.cte=l,""===o.fire&&(r[0]+=o.cte*("+"===o.oper?1:-1))}}(e,null,t);for(var a,o=!0,s=n=r.length-1;s>=0;s--)if(0!==r[s]){var u=new b(o?r[s]:Math.abs(r[s])),l=r[s]<0?"-":"+";if(s>0){var c=new A(i);if(s>1){var f=new b(s);c=new E("^","pow",[c,f])}u=-1===r[s]&&o?new E("-","unaryMinus",[c]):1===Math.abs(r[s])?c:new E("*","multiply",[u,c])}a=o?u:"+"===l?new E("+","add",[a,u]):new E("-","subtract",[a,u]),o=!1}return o?new b(0):a}})),Rh="zpk2tf",kh=Oe(Rh,["typed","add","multiply","Complex","number"],(e=>{var{typed:r,add:t,multiply:n,Complex:i,number:a}=e;return r(Rh,{"Array,Array,number":function(e,r,t){return o(e,r,t)},"Array,Array":function(e,r){return o(e,r,1)},"Matrix,Matrix,number":function(e,r,t){return o(e.valueOf(),r.valueOf(),t)},"Matrix,Matrix":function(e,r){return o(e.valueOf(),r.valueOf(),1)}});function o(e,r,t){e.some((e=>"BigNumber"===e.type))&&(e=e.map((e=>a(e)))),r.some((e=>"BigNumber"===e.type))&&(r=r.map((e=>a(e))));for(var o=[i(1,0)],u=[i(1,0)],l=0;l<e.length;l++){var c=e[l];"number"==typeof c&&(c=i(c,0)),o=s(o,[i(1,0),i(-c.re,-c.im)])}for(var f=0;f<r.length;f++){var p=r[f];"number"==typeof p&&(p=i(p,0)),u=s(u,[i(1,0),i(-p.re,-p.im)])}for(var m=0;m<o.length;m++)o[m]=n(o[m],t);return[o,u]}function s(e,r){for(var a=[],o=0;o<e.length+r.length-1;o++){a[o]=i(0,0);for(var s=0;s<e.length;s++)o-s>=0&&o-s<r.length&&(a[o]=t(a[o],n(e[s],r[o-s])))}return a}})),Ph="freqz",Uh=Oe(Ph,["typed","add","multiply","Complex","divide","matrix"],(e=>{var{typed:r,add:t,multiply:n,Complex:i,divide:a,matrix:o}=e;return r(Ph,{"Array, Array":function(e,r){return s(e,r,u(512))},"Array, Array, Array":function(e,r,t){return s(e,r,t)},"Array, Array, number":function(e,r,t){if(t<0)throw new Error("w must be a positive number");return s(e,r,u(t))},"Matrix, Matrix":function(e,r){var t=u(512),{w:n,h:i}=s(e.valueOf(),r.valueOf(),t);return{w:o(n),h:o(i)}},"Matrix, Matrix, Matrix":function(e,r,t){var{h:n}=s(e.valueOf(),r.valueOf(),t.valueOf());return{h:o(n),w:o(t)}},"Matrix, Matrix, number":function(e,r,t){if(t<0)throw new Error("w must be a positive number");var n=u(t),{h:i}=s(e.valueOf(),r.valueOf(),n);return{h:o(i),w:o(n)}}});function s(e,r,o){for(var s=[],u=[],l=0;l<o.length;l++){for(var c=i(0,0),f=i(0,0),p=0;p<e.length;p++)c=t(c,n(e[p],i(Math.cos(-p*o[l]),Math.sin(-p*o[l]))));for(var m=0;m<r.length;m++)f=t(f,n(r[m],i(Math.cos(-m*o[l]),Math.sin(-m*o[l]))));s.push(c),u.push(f)}for(var d=[],h=0;h<s.length;h++)d.push(a(s[h],u[h]));return{h:d,w:o}}function u(e){for(var r=[],t=0;t<e;t++)r.push(t/e*Math.PI);return r}})),Lh=Oe("reviver",["classes"],(e=>{var{classes:r}=e;return function(e,t){var n=r[t&&t.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(t):t}})),jh=Oe("replacer",[],(()=>function(e,r){return"number"!=typeof r||isFinite(r)&&!isNaN(r)?r:{mathjs:"number",value:String(r)}})),Hh=Oe("true",[],(()=>!0)),$h=Oe("false",[],(()=>!1)),Gh=Oe("null",[],(()=>null)),Vh=og("Infinity",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1/0):1/0})),Zh=og("NaN",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(NaN):NaN})),Wh=og("pi",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?Hc(t):Si})),Yh=og("tau",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?$c(t):Ci})),Jh=og("e",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?Lc(t):Mi})),Xh=og("phi",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?jc(t):1.618033988749895})),Qh=og("LN2",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(2).ln():Math.LN2})),Kh=og("LN10",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(10).ln():Math.LN10})),eg=og("LOG2E",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1).div(new t(2).ln()):Math.LOG2E})),rg=og("LOG10E",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(1).div(new t(10).ln()):Math.LOG10E})),tg=og("SQRT1_2",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t("0.5").sqrt():Math.SQRT1_2})),ng=og("SQRT2",["config","?BigNumber"],(e=>{var{config:r,BigNumber:t}=e;return"BigNumber"===r.number?new t(2).sqrt():Math.SQRT2})),ig=og("i",["Complex"],(e=>{var{Complex:r}=e;return r.I})),ag=Oe("version",[],(()=>"12.4.3"));function og(e,r,t){return Oe(e,r,t,{recreateOnConfigChange:!0})}var sg=ny("speedOfLight","299792458","m s^-1"),ug=ny("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),lg=ny("planckConstant","6.62607015e-34","J s"),cg=ny("reducedPlanckConstant","1.0545718176461565e-34","J s"),fg=ny("magneticConstant","1.25663706212e-6","N A^-2"),pg=ny("electricConstant","8.8541878128e-12","F m^-1"),mg=ny("vacuumImpedance","376.730313667","ohm"),dg=ny("coulomb","8.987551792261171e9","N m^2 C^-2"),hg=ny("elementaryCharge","1.602176634e-19","C"),gg=ny("bohrMagneton","9.2740100783e-24","J T^-1"),yg=ny("conductanceQuantum","7.748091729863649e-5","S"),vg=ny("inverseConductanceQuantum","12906.403729652257","ohm"),xg=ny("magneticFluxQuantum","2.0678338484619295e-15","Wb"),bg=ny("nuclearMagneton","5.0507837461e-27","J T^-1"),wg=ny("klitzing","25812.807459304513","ohm"),Ng=ny("bohrRadius","5.29177210903e-11","m"),Dg=ny("classicalElectronRadius","2.8179403262e-15","m"),Eg=ny("electronMass","9.1093837015e-31","kg"),Ag=ny("fermiCoupling","1.1663787e-5","GeV^-2"),Sg=iy("fineStructure",.0072973525693),Cg=ny("hartreeEnergy","4.3597447222071e-18","J"),Mg=ny("protonMass","1.67262192369e-27","kg"),Og=ny("deuteronMass","3.3435830926e-27","kg"),Tg=ny("neutronMass","1.6749271613e-27","kg"),Fg=ny("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),_g=ny("rydberg","10973731.568160","m^-1"),Bg=ny("thomsonCrossSection","6.6524587321e-29","m^2"),Ig=iy("weakMixingAngle",.2229),zg=iy("efimovFactor",22.7),qg=ny("atomicMass","1.66053906660e-27","kg"),Rg=ny("avogadro","6.02214076e23","mol^-1"),kg=ny("boltzmann","1.380649e-23","J K^-1"),Pg=ny("faraday","96485.33212331001","C mol^-1"),Ug=ny("firstRadiation","3.7417718521927573e-16","W m^2"),Lg=ny("loschmidt","2.686780111798444e25","m^-3"),jg=ny("gasConstant","8.31446261815324","J K^-1 mol^-1"),Hg=ny("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),$g=ny("molarVolume","0.022413969545014137","m^3 mol^-1"),Gg=iy("sackurTetrode",-1.16487052358),Vg=ny("secondRadiation","0.014387768775039337","m K"),Zg=ny("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Wg=ny("wienDisplacement","2.897771955e-3","m K"),Yg=ny("molarMass","0.99999999965e-3","kg mol^-1"),Jg=ny("molarMassC12","11.9999999958e-3","kg mol^-1"),Xg=ny("gravity","9.80665","m s^-2"),Qg=ny("planckLength","1.616255e-35","m"),Kg=ny("planckMass","2.176435e-8","kg"),ey=ny("planckTime","5.391245e-44","s"),ry=ny("planckCharge","1.87554603778e-18","C"),ty=ny("planckTemperature","1.416785e+32","K");function ny(e,r,t){return Oe(e,["config","Unit","BigNumber"],(e=>{var{config:n,Unit:i,BigNumber:a}=e,o=new i("BigNumber"===n.number?new a(r):parseFloat(r),t);return o.fixPrefix=!0,o}))}function iy(e,r){return Oe(e,["config","BigNumber"],(e=>{var{config:t,BigNumber:n}=e;return"BigNumber"===t.number?new n(r):r}))}var ay=Oe("apply",["typed","isInteger"],(e=>{var{typed:r,isInteger:t}=e,n=Xa({typed:r,isInteger:t});return r("apply",{"...any":function(e){var r=e[1];a(r)?e[1]=r-1:o(r)&&(e[1]=r.minus(1));try{return n.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),oy=Oe("column",["typed","Index","matrix","range"],(e=>{var{typed:r,Index:t,matrix:n,range:i}=e,o=Ls({typed:r,Index:t,matrix:n,range:i});return r("column",{"...any":function(e){var r=e.length-1,t=e[r];a(t)&&(e[r]=t-1);try{return o.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0});function sy(e,r,t){var n=e.filter((function(e){return H(e)&&!(e.name in r)&&!t.has(e.name)}))[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');var i=n.name,a=new Map,o=new Pe(t,a,new Set([i])),s=e.compile();return function(e){return a.set(i,e),s.evaluate(o)}}var uy=Oe("filter",["typed"],(e=>{var{typed:r}=e;function t(e,r,t){var i,a;return e[0]&&(i=e[0].compile().evaluate(t)),e[1]&&(a=H(e[1])||I(e[1])?e[1].compile().evaluate(t):sy(e[1],r,t)),n(i,a)}t.rawArgs=!0;var n=r("filter",{"Array, function":ly,"Matrix, function":function(e,r){return e.create(ly(e.toArray(),r))},"Array, RegExp":En,"Matrix, RegExp":function(e,r){return e.create(En(e.toArray(),r))}});return t}),{isTransformFunction:!0});function ly(e,r){return Dn(e,(function(e,t,n){return Ws(r,e,[t+1],n,"filter")}))}var cy=Oe("forEach",["typed"],(e=>{var{typed:r}=e;function t(e,r,t){var i,a;return e[0]&&(i=e[0].compile().evaluate(t)),e[1]&&(a=H(e[1])||I(e[1])?e[1].compile().evaluate(t):sy(e[1],r,t)),n(i,a)}t.rawArgs=!0;var n=r("forEach",{"Array | Matrix, function":function(e,r){!function t(n,i){if(!Array.isArray(n))return Ws(r,n,i,e,"forEach");Nn(n,(function(e,r){t(e,i.concat(r+1))}))}(e.valueOf(),[])}});return t}),{isTransformFunction:!0}),fy=Oe("index",["Index","getMatrixDataType"],(e=>{var{Index:r,getMatrixDataType:t}=e;return function(){for(var e=[],n=0,i=arguments.length;n<i;n++){var s=arguments[n];if(g(s))s.start--,s.end-=s.step>0?0:2;else if(s&&!0===s.isSet)s=s.map((function(e){return e-1}));else if(f(s)||p(s))"boolean"!==t(s)&&(s=s.map((function(e){return e-1})));else if(a(s))s--;else if(o(s))s=s.toNumber()-1;else if("string"!=typeof s)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[n]=s}var u=new r;return r.apply(u,e),u}}),{isTransformFunction:!0}),py=Oe("map",["typed"],(e=>{var{typed:r}=e;function t(e,r,t){var i,a;return e[0]&&(i=e[0].compile().evaluate(t)),e[1]&&(a=H(e[1])||I(e[1])?e[1].compile().evaluate(t):sy(e[1],r,t)),n(i,a)}t.rawArgs=!0;var n=r("map",{"Array, function":function(e,r){return my(e,r,e)},"Matrix, function":function(e,r){return e.create(my(e.valueOf(),r,e))}});return t}),{isTransformFunction:!0});function my(e,r,t){return function e(n,i){return Array.isArray(n)?wn(n,(function(r,t){return e(r,i.concat(t+1))})):Ws(r,n,i,t,"map")}(e,[])}function dy(e){if(2===e.length&&m(e[0])){var r=(e=e.slice())[1];a(r)?e[1]=r-1:o(r)&&(e[1]=r.minus(1))}return e}var hy=["typed","config","numeric","larger"],gy=Oe("max",hy,(e=>{var{typed:r,config:t,numeric:n,larger:i}=e,a=Ic({typed:r,config:t,numeric:n,larger:i});return r("max",{"...any":function(e){e=dy(e);try{return a.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),yy=["typed","add","divide"],vy=Oe("mean",yy,(e=>{var{typed:r,add:t,divide:n}=e,i=Ed({typed:r,add:t,divide:n});return r("mean",{"...any":function(e){e=dy(e);try{return i.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),xy=["typed","config","numeric","smaller"],by=Oe("min",xy,(e=>{var{typed:r,config:t,numeric:n,smaller:i}=e,a=zc({typed:r,config:t,numeric:n,smaller:i});return r("min",{"...any":function(e){e=dy(e);try{return a.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),wy=["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],Ny=Oe("range",wy,(e=>{var{typed:r,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u,add:l,isPositive:c}=e,f=yu({typed:r,config:t,matrix:n,bignumber:i,smaller:a,smallerEq:o,larger:s,largerEq:u,add:l,isPositive:c});return r("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),f.apply(null,e)}})}),{isTransformFunction:!0}),Dy=["typed","Index","matrix","range"],Ey=Oe("row",Dy,(e=>{var{typed:r,Index:t,matrix:n,range:i}=e,o=Au({typed:r,Index:t,matrix:n,range:i});return r("row",{"...any":function(e){var r=e.length-1,t=e[r];a(t)&&(e[r]=t-1);try{return o.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),Ay=["typed","matrix","zeros","add"],Sy=Oe("subset",Ay,(e=>{var{typed:r,matrix:t,zeros:n,add:i}=e,a=Fu({typed:r,matrix:t,zeros:n,add:i});return r("subset",{"...any":function(e){try{return a.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),Cy=["typed","matrix","isInteger"],My=Oe("concat",Cy,(e=>{var{typed:r,matrix:t,isInteger:n}=e,i=Ps({typed:r,matrix:t,isInteger:n});return r("concat",{"...any":function(e){var r=e.length-1,t=e[r];a(t)?e[r]=t-1:o(t)&&(e[r]=t.minus(1));try{return i.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),Oy="diff",Ty=["typed","matrix","subtract","number","bignumber"],Fy=Oe(Oy,Ty,(e=>{var{typed:r,matrix:t,subtract:n,number:i,bignumber:a}=e,o=fu({typed:r,matrix:t,subtract:n,number:i,bignumber:a});return r(Oy,{"...any":function(e){e=dy(e);try{return o.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),_y=["typed","map","sqrt","variance"],By=Oe("std",_y,(e=>{var{typed:r,map:t,sqrt:n,variance:i}=e,a=Bd({typed:r,map:t,sqrt:n,variance:i});return r("std",{"...any":function(e){e=dy(e);try{return a.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),Iy=["typed","config","add","numeric"],zy=Oe("sum",Iy,(e=>{var{typed:r,config:t,add:n,numeric:i}=e,a=bd({typed:r,config:t,add:n,numeric:i});return r("sum",{"...any":function(e){e=dy(e);try{return a.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),qy=["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],Ry=Oe("quantileSeq",qy,(e=>{var{typed:r,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:u,isInteger:l,smaller:c,smallerEq:f,larger:p}=e,m=_d({typed:r,bignumber:t,add:n,subtract:i,divide:a,multiply:o,partitionSelect:s,compare:u,isInteger:l,smaller:c,smallerEq:f,larger:p});return r("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(e,r,t)=>m(e,r,d(t)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(e,r,t,n)=>m(e,r,t,d(n)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(e,r,t)=>m(e,r,d(t)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(e,r,t,n)=>m(e,r,t,d(n))});function d(e){return dy([[],e])[1]}}),{isTransformFunction:!0}),ky="cumsum",Py=["typed","add","unaryPlus"],Uy=Oe(ky,Py,(e=>{var{typed:r,add:t,unaryPlus:n}=e,i=Nd({typed:r,add:t,unaryPlus:n});return r(ky,{"...any":function(e){if(2===e.length&&m(e[0])){var r=e[1];a(r)?e[1]=r-1:o(r)&&(e[1]=r.minus(1))}try{return i.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),Ly="variance",jy=["typed","add","subtract","multiply","divide","apply","isNaN"],Hy=Oe(Ly,jy,(e=>{var{typed:r,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:s}=e,u=Td({typed:r,add:t,subtract:n,multiply:i,divide:a,apply:o,isNaN:s});return r(Ly,{"...any":function(e){e=dy(e);try{return u.apply(null,e)}catch(e){throw wp(e)}}})}),{isTransformFunction:!0}),$y="print",Gy=["typed","matrix","zeros","add"],Vy=Oe($y,Gy,(e=>{var{typed:r,matrix:t,zeros:n,add:i}=e,a=dl({typed:r,matrix:t,zeros:n,add:i});return r($y,{"string, Object | Array":function(e,r){return a(o(e),r)},"string, Object | Array, number | Object":function(e,r,t){return a(o(e),r,t)}});function o(e){return e.replace(pl,(e=>"$"+e.slice(1).split(".").map((function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e})).join(".")))}}),{isTransformFunction:!0}),Zy=["typed","matrix","zeros","add","equalScalar","not","concat"],Wy=Oe("and",Zy,(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=e,s=Ql({typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(e,r,t){var n=e[0].compile().evaluate(t);if(!m(n)&&!s(n,!0))return!1;var i=e[1].compile().evaluate(t);return s(n,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Yy=["typed","matrix","equalScalar","DenseMatrix","concat"],Jy=Oe("or",Yy,(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=qs({typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function s(e,r,t){var n=e[0].compile().evaluate(t);if(!m(n)&&o(n,!1))return!0;var i=e[1].compile().evaluate(t);return o(n,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0}),Xy=["typed","matrix","zeros","add","equalScalar","not","concat"],Qy=Oe("bitAnd",Xy,(e=>{var{typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o}=e,s=Ns({typed:r,matrix:t,equalScalar:n,zeros:i,not:a,concat:o});function u(e,r,t){var n=e[0].compile().evaluate(t);if(!m(n)){if(isNaN(n))return NaN;if(0===n||!1===n)return 0}var i=e[1].compile().evaluate(t);return s(n,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Ky=["typed","matrix","equalScalar","DenseMatrix","concat"],ev=Oe("bitOr",Ky,(e=>{var{typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a}=e,o=Ss({typed:r,matrix:t,equalScalar:n,DenseMatrix:i,concat:a});function s(e,r,t){var n=e[0].compile().evaluate(t);if(!m(n)){if(isNaN(n))return NaN;if(-1===n)return-1;if(!0===n)return 1}var i=e[1].compile().evaluate(t);return o(n,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0}),rv=It({config:Q}),tv=Ut({}),nv=Jh({BigNumber:rv,config:Q}),iv=$h({}),av=Sg({BigNumber:rv,config:Q}),ov=jt({}),sv=ig({Complex:tv}),uv=Vh({BigNumber:rv,config:Q}),lv=Kh({BigNumber:rv,config:Q}),cv=rg({BigNumber:rv,config:Q}),fv=$t({}),pv=Zh({BigNumber:rv,config:Q}),mv=Gh({}),dv=Xh({BigNumber:rv,config:Q}),hv=Ht({}),gv=Xe({}),yv=tg({BigNumber:rv,config:Q}),vv=Gg({BigNumber:rv,config:Q}),xv=Yh({BigNumber:rv,config:Q}),bv=Hh({}),wv=ag({}),Nv=Rn({Matrix:fv}),Dv=zg({BigNumber:rv,config:Q}),Ev=Qh({BigNumber:rv,config:Q}),Av=Wh({BigNumber:rv,config:Q}),Sv=jh({}),Cv=ng({BigNumber:rv,config:Q}),Mv=Ge({BigNumber:rv,Complex:tv,DenseMatrix:Nv,Fraction:ov}),Ov=Wa({BigNumber:rv,config:Q,typed:Mv}),Tv=Ig({BigNumber:rv,config:Q}),Fv=Ya({typed:Mv}),_v=tf({Complex:tv,config:Q,typed:Mv}),Bv=sf({BigNumber:rv,typed:Mv}),Iv=ff({BigNumber:rv,Complex:tv,config:Q,typed:Mv}),zv=eo({typed:Mv}),qv=Ts({typed:Mv}),Rv=yf({BigNumber:rv,Complex:tv,config:Q,typed:Mv}),kv=bf({typed:Mv}),Pv=wf({typed:Mv}),Uv=Af({Complex:tv,config:Q,typed:Mv}),Lv=_a({BigNumber:rv,typed:Mv}),jv=Es({typed:Mv}),Hv=Fa({typed:Mv}),$v=Pn({typed:Mv}),Gv=Rd({typed:Mv}),Vv=Ba({Complex:tv,typed:Mv}),Zv=_s({typed:Mv}),Wv=Cf({typed:Mv}),Yv=Tf({BigNumber:rv,typed:Mv}),Jv=Bf({BigNumber:rv,typed:Mv}),Xv=mo({typed:Mv}),Qv=Aa({config:Q,typed:Mv}),Kv=Wu({typed:Mv}),ex=ho({typed:Mv}),rx=yo({Complex:tv,typed:Mv}),tx=Ys({typed:Mv}),nx=eu({typed:Mv}),ix=ul({typed:Mv}),ax=nu({typed:Mv}),ox=fl({format:ix,typed:Mv}),sx=Bs({typed:Mv}),ux=Wn({typed:Mv}),lx=la({typed:Mv}),cx=ha({typed:Mv}),fx=ya({typed:Mv}),px=eg({BigNumber:rv,config:Q}),mx=Gd({Complex:tv,typed:Mv}),dx=Go({Complex:tv,config:Q,typed:Mv}),hx=Zo({Complex:tv,config:Q,typed:Mv}),gx=uu({typed:Mv}),yx=Wo({typed:Mv}),vx=zs({typed:Mv}),xx=Ca({typed:Mv}),bx=cl({format:ix,typed:Mv}),wx=ah({config:Q,typed:Mv}),Nx=dl({typed:Mv}),Dx=uh({config:Q,typed:Mv}),Ex=Is({typed:Mv}),Ax=qf({BigNumber:rv,typed:Mv}),Sx=es({BigNumber:rv,Fraction:ov,complex:Vv,typed:Mv}),Cx=Pf({typed:Mv}),Mx=Sa({Matrix:fv,equalScalar:Qv,typed:Mv}),Ox=$a({typed:Mv}),Tx=ns({typed:Mv}),Fx=Oa({typed:Mv}),_x=to({typed:Mv}),Bx=jf({typed:Mv}),Ix=wa({typed:Mv}),zx=af({Complex:tv,config:Q,typed:Mv}),qx=mf({BigNumber:rv,typed:Mv}),Rx=Xa({isInteger:ux,typed:Mv}),kx=hf({BigNumber:rv,Complex:tv,config:Q,typed:Mv}),Px=ll({format:ix,typed:Mv}),Ux=Ud({typed:Mv}),Lx=Of({typed:Mv}),jx=zf({BigNumber:rv,typed:Mv}),Hx=xa({typed:Mv}),$x=vl({typed:Mv}),Gx=ch({config:Q,typed:Mv}),Vx=kf({BigNumber:rv,typed:Mv}),Zx=Lf({typed:Mv}),Wx=Qc({SparseMatrix:Mx,typed:Mv}),Yx=rs({Complex:tv,config:Q,typed:Mv}),Jx=Hf({typed:Mv}),Xx=Va({typed:Mv}),Qx=lf({BigNumber:rv,Complex:tv,config:Q,typed:Mv}),Kx=_f({BigNumber:rv,typed:Mv}),eb=Ia({Fraction:ov,typed:Mv}),rb=fa({typed:Mv}),tb=qa({DenseMatrix:Nv,Matrix:fv,SparseMatrix:Mx,typed:Mv}),nb=ka({isZero:fx,matrix:tb,typed:Mv}),ib=nl({isNaN:Hx,isNumeric:rb,typed:Mv}),ab=xl({bignumber:Lv,fraction:eb,number:xx}),ob=ol({config:Q,multiplyScalar:yx,numeric:ab,typed:Mv}),sb=xu({isInteger:ux,matrix:tb,typed:Mv}),ub=Cu({matrix:tb,config:Q,typed:Mv}),lb=Ou({matrix:tb,typed:Mv}),cb=Ru({matrix:tb,typed:Mv}),fb=ss({BigNumber:rv,config:Q,matrix:tb,typed:Mv}),pb=Lu({BigNumber:rv,config:Q,matrix:tb,typed:Mv}),mb=xf({Complex:tv,config:Q,typed:Mv}),db=io({BigNumber:rv,Complex:tv,Fraction:ov,config:Q,isNegative:lx,matrix:tb,typed:Mv,unaryMinus:Xx}),hb=Ps({isInteger:ux,matrix:tb,typed:Mv}),gb=Hs({prod:ob,size:ub,typed:Mv}),yb=Pu({conj:Zv,transpose:cb,typed:Mv}),vb=Zs({DenseMatrix:Nv,SparseMatrix:Mx,matrix:tb,typed:Mv}),xb=wl({numeric:ab,typed:Mv}),bb=Il({DenseMatrix:Nv,concat:hb,divideScalar:xb,equalScalar:Qv,matrix:tb,typed:Mv}),wb=lc({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),Nb=Qs({matrix:tb,typed:Mv}),Db=ma({isNumeric:rb,typed:Mv}),Eb=au({BigNumber:rv,DenseMatrix:Nv,SparseMatrix:Mx,config:Q,matrix:tb,typed:Mv}),Ab=su({matrix:tb,multiplyScalar:yx,typed:Mv}),Sb=Dc({DenseMatrix:Nv,concat:hb,config:Q,matrix:tb,typed:Mv}),Cb=Zl({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv,zeros:pb}),Mb=Rl({DenseMatrix:Nv,divideScalar:xb,equalScalar:Qv,matrix:tb,multiplyScalar:yx,subtractScalar:_x,typed:Mv}),Ob=ja({flatten:Nb,matrix:tb,size:ub,typed:Mv}),Tb=Qo({BigNumber:rv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),Fb=pu({BigNumber:rv,config:Q,matrix:tb,typed:Mv}),_b=wm({addScalar:zv,complex:Vv,conj:Zv,divideScalar:xb,equal:wb,identity:Eb,isZero:fx,matrix:tb,multiplyScalar:yx,sign:Sx,sqrt:Yx,subtractScalar:_x,typed:Mv,unaryMinus:Xx,zeros:pb}),Bb=bu({config:Q,matrix:tb}),Ib=Yl({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv,zeros:pb}),zb=Al({BigNumber:rv,DenseMatrix:Nv,config:Q,equalScalar:Qv,matrix:tb,typed:Mv,zeros:pb}),qb=dc({DenseMatrix:Nv,concat:hb,config:Q,matrix:tb,typed:Mv}),Rb=as({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,subtractScalar:_x,typed:Mv,unaryMinus:Xx}),kb=gl({concat:hb,matrix:tb,typed:Mv}),Pb=Mc({DenseMatrix:Nv,concat:hb,config:Q,equalScalar:Qv,matrix:tb,typed:Mv}),Ub=Pl({DenseMatrix:Nv,divideScalar:xb,equalScalar:Qv,matrix:tb,multiplyScalar:yx,subtractScalar:_x,typed:Mv}),Lb=Rs({DenseMatrix:Nv,concat:hb,matrix:tb,typed:Mv}),jb=cp({DenseMatrix:Nv,SparseMatrix:Mx,addScalar:zv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),Hb=Df({BigNumber:rv,DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),$b=Ns({concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),Gb=Ss({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),Vb=Os({DenseMatrix:Nv,concat:hb,matrix:tb,typed:Mv}),Zb=gh({addScalar:zv,combinations:Gv,divideScalar:xb,isInteger:ux,isNegative:lx,multiplyScalar:yx,typed:Mv}),Wb=ec({BigNumber:rv,DenseMatrix:Nv,Fraction:ov,concat:hb,config:Q,equalScalar:Qv,matrix:tb,typed:Mv}),Yb=sc({concat:hb,matrix:tb,typed:Mv}),Jb=Nd({add:jb,typed:Mv,unaryPlus:Ov}),Xb=Sc({equal:wb,typed:Mv}),Qb=fu({matrix:tb,number:xx,subtract:Rb,typed:Mv}),Kb=vd({abs:Fv,addScalar:zv,deepEqual:Xb,divideScalar:xb,multiplyScalar:yx,sqrt:Yx,subtractScalar:_x,typed:Mv}),ew=hp({addScalar:zv,conj:Zv,multiplyScalar:yx,size:ub,typed:Mv}),rw=pc({compareText:Yb,isZero:fx,typed:Mv}),tw=Ao({DenseMatrix:Nv,config:Q,equalScalar:Qv,matrix:tb,round:zb,typed:Mv,zeros:pb}),nw=Lo({BigNumber:rv,DenseMatrix:Nv,concat:hb,config:Q,equalScalar:Qv,matrix:tb,round:zb,typed:Mv,zeros:pb}),iw=pp({abs:Fv,addScalar:zv,divideScalar:xb,isPositive:cx,multiplyScalar:yx,smaller:qb,sqrt:Yx,typed:Mv}),aw=qc({DenseMatrix:Nv,smaller:qb}),ow=Rc({ImmutableDenseMatrix:aw,getMatrixDataType:ax}),sw=bc({DenseMatrix:Nv,concat:hb,config:Q,matrix:tb,typed:Mv}),uw=Sl({Complex:tv,config:Q,divideScalar:xb,typed:Mv}),lw=Ll({DenseMatrix:Nv,divideScalar:xb,equalScalar:Qv,matrix:tb,multiplyScalar:yx,subtractScalar:_x,typed:Mv}),cw=Ua({flatten:Nb,matrix:tb,size:ub,typed:Mv}),fw=zc({config:Q,numeric:ab,smaller:qb,typed:Mv}),pw=_o({DenseMatrix:Nv,concat:hb,config:Q,equalScalar:Qv,matrix:tb,round:zb,typed:Mv,zeros:pb}),mw=Jo({addScalar:zv,dot:ew,equalScalar:Qv,matrix:tb,multiplyScalar:yx,typed:Mv}),dw=Tl({Complex:tv,config:Q,divideScalar:xb,typed:Mv}),hw=qs({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),gw=Fc({compare:Wb,isNaN:Hx,isNumeric:rb,typed:Mv}),yw=Xl({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv,zeros:pb}),vw=Im({SparseMatrix:Mx,abs:Fv,add:jb,divideScalar:xb,larger:sw,largerEq:Sb,multiply:mw,subtract:Rb,transpose:cb,typed:Mv}),xw=Fu({add:jb,matrix:tb,typed:Mv,zeros:pb}),bw=bd({add:jb,config:Q,numeric:ab,typed:Mv}),ww=gp({add:jb,matrix:tb,typed:Mv}),Nw=Hl({DenseMatrix:Nv,divideScalar:xb,equalScalar:Qv,matrix:tb,multiplyScalar:yx,subtractScalar:_x,typed:Mv}),Dw=kh({Complex:tv,add:jb,multiply:mw,number:xx,typed:Mv}),Ew=fo({DenseMatrix:Nv,config:Q,equalScalar:Qv,matrix:tb,round:zb,typed:Mv,zeros:pb}),Aw=ic({compare:Wb,typed:Mv}),Sw=vh({addScalar:zv,combinations:Gv,isInteger:ux,isNegative:lx,isPositive:cx,larger:sw,typed:Mv}),Cw=Gs({matrix:tb,multiply:mw,subtract:Rb,typed:Mv}),Mw=Km({divideScalar:xb,isZero:fx,matrix:tb,multiply:mw,subtractScalar:_x,typed:Mv,unaryMinus:Xx}),Ow=ps({concat:hb,equalScalar:Qv,matrix:tb,multiplyScalar:yx,typed:Mv}),Tw=Pc({larger:sw,smaller:qb}),Fw=wo({Complex:tv,DenseMatrix:Nv,ceil:Ew,equalScalar:Qv,floor:tw,matrix:tb,typed:Mv,zeros:pb}),_w=vp({Index:ow,typed:Mv}),Bw=xd({abs:Fv,add:jb,addScalar:zv,config:Q,divideScalar:xb,equalScalar:Qv,flatten:Nb,isNumeric:rb,isZero:fx,matrix:tb,multiply:mw,multiplyScalar:yx,smaller:qb,subtract:Rb,typed:Mv}),Iw=ls({BigNumber:rv,add:jb,config:Q,equal:wb,isInteger:ux,mod:pw,smaller:qb,typed:Mv,xgcd:fb}),zw=Ho({concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),qw=Ml({Complex:tv,config:Q,divideScalar:xb,log:uw,typed:Mv}),Rw=Ic({config:Q,larger:sw,numeric:ab,typed:Mv}),kw=Gf({DenseMatrix:Nv,Index:ow,compareNatural:Aw,size:ub,subset:xw,typed:Mv}),Pw=Yf({DenseMatrix:Nv,Index:ow,compareNatural:Aw,size:ub,subset:xw,typed:Mv}),Uw=Kf({Index:ow,compareNatural:Aw,size:ub,subset:xw,typed:Mv}),Lw=np({Index:ow,compareNatural:Aw,size:ub,subset:xw,typed:Mv}),jw=yc({DenseMatrix:Nv,concat:hb,config:Q,matrix:tb,typed:Mv}),Hw=Bc({compare:Wb,compareNatural:Aw,matrix:tb,typed:Mv}),$w=Ql({concat:hb,equalScalar:Qv,matrix:tb,not:vx,typed:Mv,zeros:pb}),Gw=yu({bignumber:Lv,matrix:tb,add:jb,config:Q,isPositive:cx,larger:sw,largerEq:Sb,smaller:qb,smallerEq:jw,typed:Mv}),Vw=Au({Index:ow,matrix:tb,range:Gw,typed:Mv}),Zw=Zf({DenseMatrix:Nv,Index:ow,compareNatural:Aw,size:ub,subset:xw,typed:Mv}),Ww=rp({Index:ow,compareNatural:Aw,size:ub,subset:xw,typed:Mv}),Yw=sp({Index:ow,concat:hb,setDifference:Zw,size:ub,subset:xw,typed:Mv}),Jw=Uc({FibonacciHeap:Tw,addScalar:zv,equalScalar:Qv}),Xw=Ls({Index:ow,matrix:tb,range:Gw,typed:Mv}),Qw=ed({abs:Fv,addScalar:zv,det:Mw,divideScalar:xb,identity:Eb,matrix:tb,multiply:mw,typed:Mv,unaryMinus:Xx}),Kw=bm({DenseMatrix:Nv,Spa:Jw,SparseMatrix:Mx,abs:Fv,addScalar:zv,divideScalar:xb,equalScalar:Qv,larger:sw,matrix:tb,multiplyScalar:yx,subtractScalar:_x,typed:Mv,unaryMinus:Xx}),eN=td({Complex:tv,add:jb,ctranspose:yb,deepEqual:Xb,divideScalar:xb,dot:ew,dotDivide:bb,equal:wb,inv:Qw,matrix:tb,multiply:mw,typed:Mv}),rN=Nl({Complex:tv,config:Q,fraction:eb,identity:Eb,inv:Qw,matrix:tb,multiply:mw,number:xx,typed:Mv}),tN=Xf({DenseMatrix:Nv,Index:ow,compareNatural:Aw,size:ub,subset:xw,typed:Mv}),nN=lp({Index:ow,concat:hb,setIntersect:tN,setSymDifference:Yw,size:ub,subset:xw,typed:Mv}),iN=ld({abs:Fv,add:jb,identity:Eb,inv:Qw,map:gx,max:Rw,multiply:mw,size:ub,sqrt:Yx,subtract:Rb,typed:Mv}),aN=Wc({BigNumber:rv,Complex:tv,Fraction:ov,abs:Fv,addScalar:zv,config:Q,divideScalar:xb,equal:wb,fix:Fw,format:ix,isNumeric:rb,multiplyScalar:yx,number:xx,pow:rN,round:zb,subtractScalar:_x}),oN=mg({BigNumber:rv,Unit:aN,config:Q}),sN=Wg({BigNumber:rv,Unit:aN,config:Q}),uN=qg({BigNumber:rv,Unit:aN,config:Q}),lN=gg({BigNumber:rv,Unit:aN,config:Q}),cN=kg({BigNumber:rv,Unit:aN,config:Q}),fN=yg({BigNumber:rv,Unit:aN,config:Q}),pN=dg({BigNumber:rv,Unit:aN,config:Q}),mN=Og({BigNumber:rv,Unit:aN,config:Q}),dN=_l({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,pow:rN,typed:Mv}),hN=pg({BigNumber:rv,Unit:aN,config:Q}),gN=hg({BigNumber:rv,Unit:aN,config:Q}),yN=sd({abs:Fv,add:jb,identity:Eb,inv:Qw,multiply:mw,typed:Mv}),vN=Pg({BigNumber:rv,Unit:aN,config:Q}),xN=ju({addScalar:zv,ceil:Ew,conj:Zv,divideScalar:xb,dotDivide:bb,exp:ex,i:sv,log2:hx,matrix:tb,multiplyScalar:yx,pow:rN,tau:xv,typed:Mv}),bN=Hd({BigNumber:rv,Complex:tv,config:Q,multiplyScalar:yx,pow:rN,typed:Mv}),wN=ug({BigNumber:rv,Unit:aN,config:Q}),NN=Cg({BigNumber:rv,Unit:aN,config:Q}),DN=$u({conj:Zv,dotDivide:bb,fft:xN,typed:Mv}),EN=wg({BigNumber:rv,Unit:aN,config:Q}),AN=Lg({BigNumber:rv,Unit:aN,config:Q}),SN=fg({BigNumber:rv,Unit:aN,config:Q}),CN=Yg({BigNumber:rv,Unit:aN,config:Q}),MN=Hg({BigNumber:rv,Unit:aN,config:Q}),ON=Tg({BigNumber:rv,Unit:aN,config:Q}),TN=bg({BigNumber:rv,Unit:aN,config:Q}),FN=ry({BigNumber:rv,Unit:aN,config:Q}),_N=Qg({BigNumber:rv,Unit:aN,config:Q}),BN=ty({BigNumber:rv,Unit:aN,config:Q}),IN=Mg({BigNumber:rv,Unit:aN,config:Q}),zN=Fg({BigNumber:rv,Unit:aN,config:Q}),qN=cg({BigNumber:rv,Unit:aN,config:Q}),RN=_g({BigNumber:rv,Unit:aN,config:Q}),kN=Vg({BigNumber:rv,Unit:aN,config:Q}),PN=sg({BigNumber:rv,Unit:aN,config:Q}),UN=Zg({BigNumber:rv,Unit:aN,config:Q}),LN=Bg({BigNumber:rv,Unit:aN,config:Q}),jN=Rg({BigNumber:rv,Unit:aN,config:Q}),HN=Ng({BigNumber:rv,Unit:aN,config:Q}),$N=ef({Unit:aN,typed:Mv}),GN=gd({divideScalar:xb,equalScalar:Qv,inv:Qw,matrix:tb,multiply:mw,typed:Mv}),VN=Eg({BigNumber:rv,Unit:aN,config:Q}),ZN=Zd({gamma:bN,typed:Mv}),WN=Ug({BigNumber:rv,Unit:aN,config:Q}),YN=Xg({BigNumber:rv,Unit:aN,config:Q}),JN=vg({BigNumber:rv,Unit:aN,config:Q}),XN=km({DenseMatrix:Nv,lsolve:Mb,lup:Kw,matrix:tb,slu:vw,typed:Mv,usolve:Ub}),QN=xg({BigNumber:rv,Unit:aN,config:Q}),KN=Jg({BigNumber:rv,Unit:aN,config:Q}),eD=Xd({add:jb,divide:GN,factorial:ZN,isInteger:ux,isPositive:cx,multiply:mw,typed:Mv}),rD=Kd({factorial:ZN,typed:Mv}),tD=Kg({BigNumber:rv,Unit:aN,config:Q}),nD=Lm({add:jb,cbrt:db,divide:GN,equalScalar:Qv,im:sx,isZero:fx,multiply:mw,re:Ex,sqrt:Yx,subtract:Rb,typeOf:Ix,typed:Mv,unaryMinus:Xx}),iD=ap({compareNatural:Aw,typed:Mv}),aD=Zu({abs:Fv,add:jb,bignumber:Lv,divide:GN,isNegative:lx,isPositive:cx,larger:sw,map:gx,matrix:tb,max:Rw,multiply:mw,smaller:qb,subtract:Rb,typed:Mv,unaryMinus:Xx}),oD=ph({bignumber:Lv,addScalar:zv,combinations:Gv,divideScalar:xb,factorial:ZN,isInteger:ux,isNegative:lx,larger:sw,multiplyScalar:yx,number:xx,pow:rN,subtractScalar:_x,typed:Mv}),sD=Jc({Unit:aN,typed:Mv}),uD=dh({addScalar:zv,isInteger:ux,isNegative:lx,stirlingS2:oD,typed:Mv}),lD=ad({abs:Fv,add:jb,addScalar:zv,atan:Pv,bignumber:Lv,column:Xw,complex:Vv,config:Q,cos:Wv,diag:vb,divideScalar:xb,dot:ew,equal:wb,flatten:Nb,im:sx,inv:Qw,larger:sw,matrix:tb,matrixFromColumns:Ob,multiply:mw,multiplyScalar:yx,number:xx,qr:_b,re:Ex,reshape:sb,sin:Cx,size:ub,smaller:qb,sqrt:Yx,subtract:Rb,typed:Mv,usolve:Ub,usolveAll:Nw}),cD=Ag({BigNumber:rv,Unit:aN,config:Q}),fD=jg({BigNumber:rv,Unit:aN,config:Q}),pD=Yd({divide:GN,dotDivide:bb,isNumeric:rb,log:uw,map:gx,matrix:tb,multiply:mw,sum:bw,typed:Mv}),mD=Ed({add:jb,divide:GN,typed:Mv}),dD=$g({BigNumber:rv,Unit:aN,config:Q}),hD=lg({BigNumber:rv,Unit:aN,config:Q}),gD=_d({bignumber:Lv,add:jb,compare:Wb,divide:GN,isInteger:ux,larger:sw,multiply:mw,partitionSelect:gw,smaller:qb,smallerEq:jw,subtract:Rb,typed:Mv}),yD=Td({add:jb,apply:Rx,divide:GN,isNaN:Hx,multiply:mw,subtract:Rb,typed:Mv}),vD=Dg({BigNumber:rv,Unit:aN,config:Q}),xD=Sd({add:jb,compare:Wb,divide:GN,partitionSelect:gw,typed:Mv}),bD=zd({add:jb,divide:GN,matrix:tb,mean:mD,multiply:mw,pow:rN,sqrt:Yx,subtract:Rb,sum:bw,typed:Mv}),wD=Uh({Complex:tv,add:jb,divide:GN,matrix:tb,multiply:mw,typed:Mv}),ND=Cd({abs:Fv,map:gx,median:xD,subtract:Rb,typed:Mv}),DD=Bd({map:gx,sqrt:Yx,typed:Mv,variance:yD}),ED=rl({BigNumber:rv,Complex:tv,add:jb,config:Q,divide:GN,equal:wb,factorial:ZN,gamma:bN,isNegative:lx,multiply:mw,pi:Av,pow:rN,sin:Cx,smallerEq:jw,subtract:Rb,typed:Mv}),AD=dp({abs:Fv,add:jb,conj:Zv,ctranspose:yb,eigs:lD,equalScalar:Qv,larger:sw,matrix:tb,multiply:mw,pow:rN,smaller:qb,sqrt:Yx,typed:Mv}),SD=Eu({BigNumber:rv,DenseMatrix:Nv,SparseMatrix:Mx,addScalar:zv,config:Q,cos:Wv,matrix:tb,multiplyScalar:yx,norm:AD,sin:Cx,typed:Mv,unaryMinus:Xx}),CD=ey({BigNumber:rv,Unit:aN,config:Q}),MD=md({identity:Eb,matrix:tb,multiply:mw,norm:AD,qr:_b,subtract:Rb,typed:Mv}),OD=Nu({multiply:mw,rotationMatrix:SD,typed:Mv}),TD=fd({abs:Fv,add:jb,concat:hb,identity:Eb,index:_w,lusolve:XN,matrix:tb,matrixFromColumns:Ob,multiply:mw,range:Gw,schur:MD,subset:xw,subtract:Rb,transpose:cb,typed:Mv}),FD=hd({matrix:tb,multiply:mw,sylvester:TD,transpose:cb,typed:Mv}),_D={},BD={},ID={},zD=bp({mathWithTransform:BD}),qD=Qp({Node:zD}),RD=rm({Node:zD}),kD=nm({Node:zD}),PD=sm({Node:zD}),UD=Sp({Node:zD}),LD=zp({Node:zD,ResultSet:gv}),jD=Rp({Node:zD}),HD=Vp({Node:zD}),$D=am({Node:zD}),GD=Lh({classes:ID}),VD=Gm({math:_D,typed:Mv}),ZD=Wp({Node:zD,typed:Mv}),WD=Qm({Chain:VD,typed:Mv}),YD=Jp({Node:zD,size:ub}),JD=Ep({Node:zD,subset:xw}),XD=Bp({matrix:tb,Node:zD,subset:xw}),QD=um({Unit:aN,Node:zD,math:_D}),KD=cm({Node:zD,SymbolNode:QD,math:_D}),eE=pm({AccessorNode:JD,ArrayNode:UD,AssignmentNode:XD,BlockNode:LD,ConditionalNode:jD,ConstantNode:HD,FunctionAssignmentNode:ZD,FunctionNode:KD,IndexNode:YD,ObjectNode:qD,OperatorNode:RD,ParenthesisNode:kD,RangeNode:$D,RelationalNode:PD,SymbolNode:QD,config:Q,numeric:ab,typed:Mv}),rE=Th({ConstantNode:HD,FunctionNode:KD,OperatorNode:RD,ParenthesisNode:kD,parse:eE,typed:Mv}),tE=Ch({bignumber:Lv,fraction:eb,AccessorNode:JD,ArrayNode:UD,ConstantNode:HD,FunctionNode:KD,IndexNode:YD,ObjectNode:qD,OperatorNode:RD,SymbolNode:QD,config:Q,mathWithTransform:BD,matrix:tb,typed:Mv}),nE=dm({parse:eE,typed:Mv}),iE=Oh({AccessorNode:JD,ArrayNode:UD,ConstantNode:HD,FunctionNode:KD,IndexNode:YD,ObjectNode:qD,OperatorNode:RD,ParenthesisNode:kD,SymbolNode:QD,add:jb,divide:GN,equal:wb,isZero:fx,multiply:mw,parse:eE,pow:rN,subtract:Rb,typed:Mv}),aE=gm({parse:eE,typed:Mv}),oE=Hm({evaluate:aE}),sE=ym({evaluate:aE}),uE=Sh({bignumber:Lv,fraction:eb,AccessorNode:JD,ArrayNode:UD,ConstantNode:HD,FunctionNode:KD,IndexNode:YD,ObjectNode:qD,OperatorNode:RD,ParenthesisNode:kD,SymbolNode:QD,add:jb,config:Q,divide:GN,equal:wb,isZero:fx,mathWithTransform:BD,matrix:tb,multiply:mw,parse:eE,pow:rN,resolve:rE,simplifyConstant:tE,simplifyCore:iE,subtract:Rb,typed:Mv}),lE=_h({OperatorNode:RD,parse:eE,simplify:uE,typed:Mv}),cE=bh({parse:eE,typed:Mv}),fE=xm({Parser:sE,typed:Mv}),pE=qh({bignumber:Lv,fraction:eb,AccessorNode:JD,ArrayNode:UD,ConstantNode:HD,FunctionNode:KD,IndexNode:YD,ObjectNode:qD,OperatorNode:RD,ParenthesisNode:kD,SymbolNode:QD,add:jb,config:Q,divide:GN,equal:wb,isZero:fx,mathWithTransform:BD,matrix:tb,multiply:mw,parse:eE,pow:rN,simplify:uE,simplifyConstant:tE,simplifyCore:iE,subtract:Rb,typed:Mv}),mE=Ih({ConstantNode:HD,FunctionNode:KD,OperatorNode:RD,ParenthesisNode:kD,SymbolNode:QD,config:Q,equal:wb,isZero:fx,numeric:ab,parse:eE,simplify:uE,typed:Mv}),dE=Jm({Help:oE,mathWithTransform:BD,typed:Mv});(0,n.A)(_D,{e:nv,false:iv,fineStructure:av,i:sv,Infinity:uv,LN10:lv,LOG10E:cv,NaN:pv,null:mv,phi:dv,SQRT1_2:yv,sackurTetrode:vv,tau:xv,true:bv,E:nv,version:wv,efimovFactor:Dv,LN2:Ev,pi:Av,replacer:Sv,reviver:GD,SQRT2:Cv,typed:Mv,unaryPlus:Ov,PI:Av,weakMixingAngle:Tv,abs:Fv,acos:_v,acot:Bv,acsc:Iv,addScalar:zv,arg:qv,asech:Rv,asinh:kv,atan:Pv,atanh:Uv,bignumber:Lv,bitNot:jv,boolean:Hv,clone:$v,combinations:Gv,complex:Vv,conj:Zv,cos:Wv,cot:Yv,csc:Jv,cube:Xv,equalScalar:Qv,erf:Kv,exp:ex,expm1:rx,filter:tx,forEach:nx,format:ix,getMatrixDataType:ax,hex:ox,im:sx,isInteger:ux,isNegative:lx,isPositive:cx,isZero:fx,LOG2E:px,lgamma:mx,log10:dx,log2:hx,map:gx,multiplyScalar:yx,not:vx,number:xx,oct:bx,pickRandom:wx,print:Nx,random:Dx,re:Ex,sec:Ax,sign:Sx,sin:Cx,splitUnit:Ox,square:Tx,string:Fx,subtractScalar:_x,tan:Bx,typeOf:Ix,acosh:zx,acsch:qx,apply:Rx,asec:kx,bin:Px,chain:WD,combinationsWithRep:Ux,cosh:Lx,csch:jx,isNaN:Hx,isPrime:$x,randomInt:Gx,sech:Vx,sinh:Zx,sparse:Wx,sqrt:Yx,tanh:Jx,unaryMinus:Xx,acoth:Qx,coth:Kx,fraction:eb,isNumeric:rb,matrix:tb,matrixFromFunction:nb,mode:ib,numeric:ab,prod:ob,reshape:sb,size:ub,squeeze:lb,transpose:cb,xgcd:fb,zeros:pb,asin:mb,cbrt:db,concat:hb,count:gb,ctranspose:yb,diag:vb,divideScalar:xb,dotDivide:bb,equal:wb,flatten:Nb,hasNumericValue:Db,identity:Eb,kron:Ab,largerEq:Sb,leftShift:Cb,lsolve:Mb,matrixFromColumns:Ob,nthRoot:Tb,ones:Fb,qr:_b,resize:Bb,rightArithShift:Ib,round:zb,smaller:qb,subtract:Rb,to:kb,unequal:Pb,usolve:Ub,xor:Lb,add:jb,atan2:Hb,bitAnd:$b,bitOr:Gb,bitXor:Vb,catalan:Zb,compare:Wb,compareText:Yb,cumsum:Jb,deepEqual:Xb,diff:Qb,distance:Kb,dot:ew,equalText:rw,floor:tw,gcd:nw,hypot:iw,larger:sw,log:uw,lsolveAll:lw,matrixFromRows:cw,min:fw,mod:pw,multiply:mw,nthRoots:dw,or:hw,partitionSelect:gw,rightLogShift:yw,slu:vw,subset:xw,sum:bw,trace:ww,usolveAll:Nw,zpk2tf:Dw,ceil:Ew,compareNatural:Aw,composition:Sw,cross:Cw,det:Mw,dotMultiply:Ow,fix:Fw,index:_w,intersect:Bw,invmod:Iw,lcm:zw,log1p:qw,max:Rw,setCartesian:kw,setDistinct:Pw,setIsSubset:Uw,setPowerset:Lw,smallerEq:jw,sort:Hw,and:$w,range:Gw,row:Vw,setDifference:Zw,setMultiplicity:Ww,setSymDifference:Yw,column:Xw,inv:Qw,lup:Kw,pinv:eN,pow:rN,setIntersect:tN,setUnion:nN,sqrtm:iN,vacuumImpedance:oN,wienDisplacement:sN,atomicMass:uN,bohrMagneton:lN,boltzmann:cN,conductanceQuantum:fN,coulomb:pN,deuteronMass:mN,dotPow:dN,electricConstant:hN,elementaryCharge:gN,expm:yN,faraday:vN,fft:xN,gamma:bN,gravitationConstant:wN,hartreeEnergy:NN,ifft:DN,klitzing:EN,loschmidt:AN,magneticConstant:SN,molarMass:CN,molarPlanckConstant:MN,neutronMass:ON,nuclearMagneton:TN,planckCharge:FN,planckLength:_N,planckTemperature:BN,protonMass:IN,quantumOfCirculation:zN,reducedPlanckConstant:qN,rydberg:RN,secondRadiation:kN,speedOfLight:PN,stefanBoltzmann:UN,thomsonCrossSection:LN,avogadro:jN,bohrRadius:HN,createUnit:$N,divide:GN,electronMass:VN,factorial:ZN,firstRadiation:WN,gravity:YN,inverseConductanceQuantum:JN,lusolve:XN,magneticFluxQuantum:QN,molarMassC12:KN,multinomial:eD,parse:eE,permutations:rD,planckMass:tD,polynomialRoot:nD,resolve:rE,setSize:iD,simplifyConstant:tE,solveODE:aD,stirlingS2:oD,unit:sD,bellNumbers:uD,compile:nE,eigs:lD,fermiCoupling:cD,gasConstant:fD,kldivergence:pD,mean:mD,molarVolume:dD,planckConstant:hD,quantileSeq:gD,simplifyCore:iE,variance:yD,classicalElectronRadius:vD,evaluate:aE,median:xD,simplify:uE,symbolicEqual:lE,corr:bD,freqz:wD,leafCount:cE,mad:ND,parser:fE,rationalize:pE,std:DD,zeta:ED,derivative:mE,norm:AD,rotationMatrix:SD,help:dE,planckTime:CD,schur:MD,rotate:OD,sylvester:TD,lyap:FD,config:Q}),(0,n.A)(BD,_D,{filter:uy({typed:Mv}),forEach:cy({typed:Mv}),map:py({typed:Mv}),apply:ay({isInteger:ux,typed:Mv}),or:Jy({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),and:Wy({add:jb,concat:hb,equalScalar:Qv,matrix:tb,not:vx,typed:Mv,zeros:pb}),concat:My({isInteger:ux,matrix:tb,typed:Mv}),max:gy({config:Q,larger:sw,numeric:ab,typed:Mv}),print:Vy({add:jb,matrix:tb,typed:Mv,zeros:pb}),bitAnd:Qy({add:jb,concat:hb,equalScalar:Qv,matrix:tb,not:vx,typed:Mv,zeros:pb}),diff:Fy({bignumber:Lv,matrix:tb,number:xx,subtract:Rb,typed:Mv}),min:by({config:Q,numeric:ab,smaller:qb,typed:Mv}),subset:Sy({add:jb,matrix:tb,typed:Mv,zeros:pb}),bitOr:ev({DenseMatrix:Nv,concat:hb,equalScalar:Qv,matrix:tb,typed:Mv}),cumsum:Uy({add:jb,typed:Mv,unaryPlus:Ov}),index:fy({Index:ow,getMatrixDataType:ax}),sum:zy({add:jb,config:Q,numeric:ab,typed:Mv}),range:Ny({bignumber:Lv,matrix:tb,add:jb,config:Q,isPositive:cx,larger:sw,largerEq:Sb,smaller:qb,smallerEq:jw,typed:Mv}),row:Ey({Index:ow,matrix:tb,range:Gw,typed:Mv}),column:oy({Index:ow,matrix:tb,range:Gw,typed:Mv}),mean:vy({add:jb,divide:GN,typed:Mv}),quantileSeq:Ry({add:jb,bignumber:Lv,compare:Wb,divide:GN,isInteger:ux,larger:sw,multiply:mw,partitionSelect:gw,smaller:qb,smallerEq:jw,subtract:Rb,typed:Mv}),variance:Hy({add:jb,apply:Rx,divide:GN,isNaN:Hx,multiply:mw,subtract:Rb,typed:Mv}),std:By({map:gx,sqrt:Yx,typed:Mv,variance:yD})}),(0,n.A)(ID,{BigNumber:rv,Complex:tv,Fraction:ov,Matrix:fv,Node:zD,ObjectNode:qD,OperatorNode:RD,ParenthesisNode:kD,Range:hv,RelationalNode:PD,ResultSet:gv,ArrayNode:UD,BlockNode:LD,ConditionalNode:jD,ConstantNode:HD,DenseMatrix:Nv,RangeNode:$D,Chain:VD,FunctionAssignmentNode:ZD,SparseMatrix:Mx,IndexNode:YD,ImmutableDenseMatrix:aw,Index:ow,AccessorNode:JD,AssignmentNode:XD,FibonacciHeap:Tw,Spa:Jw,Unit:aN,SymbolNode:QD,FunctionNode:KD,Help:oE,Parser:sE}),VD.createProxy(_D);t(45422)}}]);
//# sourceMappingURL=2343.bundle.92e4bd57d2649cbf37e9.js.map