mathjs 13.2.2 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. package/HISTORY.md +26 -0
  2. package/lib/browser/math.js +1 -1
  3. package/lib/browser/math.js.LICENSE.txt +2 -10
  4. package/lib/browser/math.js.map +1 -1
  5. package/lib/cjs/core/function/import.js +4 -1
  6. package/lib/cjs/core/function/typed.js +1 -1
  7. package/lib/cjs/entry/dependenciesAny/dependenciesBitXor.generated.js +2 -0
  8. package/lib/cjs/entry/dependenciesAny/dependenciesDotDivide.generated.js +2 -0
  9. package/lib/cjs/entry/dependenciesAny/dependenciesDotPow.generated.js +2 -0
  10. package/lib/cjs/entry/dependenciesAny/dependenciesEqual.generated.js +2 -0
  11. package/lib/cjs/entry/dependenciesAny/dependenciesLarger.generated.js +2 -0
  12. package/lib/cjs/entry/dependenciesAny/dependenciesLargerEq.generated.js +2 -0
  13. package/lib/cjs/entry/dependenciesAny/dependenciesLog.generated.js +2 -0
  14. package/lib/cjs/entry/dependenciesAny/dependenciesSimplify.generated.js +2 -0
  15. package/lib/cjs/entry/dependenciesAny/dependenciesSmaller.generated.js +2 -0
  16. package/lib/cjs/entry/dependenciesAny/dependenciesSmallerEq.generated.js +2 -0
  17. package/lib/cjs/entry/dependenciesAny/dependenciesUnequal.generated.js +2 -0
  18. package/lib/cjs/entry/dependenciesAny/dependenciesXor.generated.js +2 -0
  19. package/lib/cjs/entry/dependenciesNumber/dependenciesSimplify.generated.js +2 -0
  20. package/lib/cjs/entry/impureFunctionsAny.generated.js +1 -0
  21. package/lib/cjs/entry/impureFunctionsNumber.generated.js +1 -0
  22. package/lib/cjs/entry/pureFunctionsAny.generated.js +11 -0
  23. package/lib/cjs/expression/embeddedDocs/function/arithmetic/ceil.js +2 -2
  24. package/lib/cjs/expression/embeddedDocs/function/arithmetic/fix.js +2 -2
  25. package/lib/cjs/expression/embeddedDocs/function/arithmetic/floor.js +2 -2
  26. package/lib/cjs/expression/parse.js +26 -36
  27. package/lib/cjs/function/algebra/simplify.js +4 -3
  28. package/lib/cjs/function/algebra/simplifyConstant.js +5 -11
  29. package/lib/cjs/function/arithmetic/ceil.js +21 -2
  30. package/lib/cjs/function/arithmetic/dotDivide.js +4 -3
  31. package/lib/cjs/function/arithmetic/dotPow.js +4 -3
  32. package/lib/cjs/function/arithmetic/fix.js +24 -5
  33. package/lib/cjs/function/arithmetic/floor.js +21 -2
  34. package/lib/cjs/function/arithmetic/log.js +12 -4
  35. package/lib/cjs/function/arithmetic/pow.js +2 -2
  36. package/lib/cjs/function/arithmetic/round.js +3 -5
  37. package/lib/cjs/function/arithmetic/sign.js +1 -1
  38. package/lib/cjs/function/bitwise/bitXor.js +4 -3
  39. package/lib/cjs/function/logical/xor.js +4 -3
  40. package/lib/cjs/function/matrix/filter.js +7 -0
  41. package/lib/cjs/function/matrix/forEach.js +7 -0
  42. package/lib/cjs/function/relational/equal.js +4 -3
  43. package/lib/cjs/function/relational/larger.js +4 -3
  44. package/lib/cjs/function/relational/largerEq.js +4 -3
  45. package/lib/cjs/function/relational/smaller.js +4 -3
  46. package/lib/cjs/function/relational/smallerEq.js +4 -3
  47. package/lib/cjs/function/relational/unequal.js +4 -3
  48. package/lib/cjs/function/utils/isInteger.js +1 -1
  49. package/lib/cjs/function/utils/isNegative.js +1 -1
  50. package/lib/cjs/function/utils/isPositive.js +1 -1
  51. package/lib/cjs/header.js +2 -2
  52. package/lib/cjs/type/bignumber/function/bignumber.js +2 -2
  53. package/lib/cjs/type/fraction/Fraction.js +4 -4
  54. package/lib/cjs/type/fraction/function/fraction.js +3 -0
  55. package/lib/cjs/type/matrix/utils/matAlgo07xSSf.js +39 -43
  56. package/lib/cjs/type/unit/Unit.js +1 -1
  57. package/lib/cjs/utils/object.js +4 -0
  58. package/lib/cjs/utils/string.js +2 -2
  59. package/lib/cjs/version.js +1 -1
  60. package/lib/esm/core/function/import.js +4 -1
  61. package/lib/esm/core/function/typed.js +1 -1
  62. package/lib/esm/entry/dependenciesAny/dependenciesBitXor.generated.js +2 -0
  63. package/lib/esm/entry/dependenciesAny/dependenciesDotDivide.generated.js +2 -0
  64. package/lib/esm/entry/dependenciesAny/dependenciesDotPow.generated.js +2 -0
  65. package/lib/esm/entry/dependenciesAny/dependenciesEqual.generated.js +2 -0
  66. package/lib/esm/entry/dependenciesAny/dependenciesLarger.generated.js +2 -0
  67. package/lib/esm/entry/dependenciesAny/dependenciesLargerEq.generated.js +2 -0
  68. package/lib/esm/entry/dependenciesAny/dependenciesLog.generated.js +2 -0
  69. package/lib/esm/entry/dependenciesAny/dependenciesSimplify.generated.js +2 -0
  70. package/lib/esm/entry/dependenciesAny/dependenciesSmaller.generated.js +2 -0
  71. package/lib/esm/entry/dependenciesAny/dependenciesSmallerEq.generated.js +2 -0
  72. package/lib/esm/entry/dependenciesAny/dependenciesUnequal.generated.js +2 -0
  73. package/lib/esm/entry/dependenciesAny/dependenciesXor.generated.js +2 -0
  74. package/lib/esm/entry/dependenciesNumber/dependenciesSimplify.generated.js +2 -0
  75. package/lib/esm/entry/impureFunctionsAny.generated.js +1 -0
  76. package/lib/esm/entry/impureFunctionsNumber.generated.js +1 -0
  77. package/lib/esm/entry/pureFunctionsAny.generated.js +11 -0
  78. package/lib/esm/expression/embeddedDocs/function/arithmetic/ceil.js +2 -2
  79. package/lib/esm/expression/embeddedDocs/function/arithmetic/fix.js +2 -2
  80. package/lib/esm/expression/embeddedDocs/function/arithmetic/floor.js +2 -2
  81. package/lib/esm/expression/parse.js +26 -36
  82. package/lib/esm/function/algebra/simplify.js +4 -3
  83. package/lib/esm/function/algebra/simplifyConstant.js +5 -11
  84. package/lib/esm/function/arithmetic/ceil.js +21 -2
  85. package/lib/esm/function/arithmetic/dotDivide.js +4 -3
  86. package/lib/esm/function/arithmetic/dotPow.js +4 -3
  87. package/lib/esm/function/arithmetic/fix.js +24 -5
  88. package/lib/esm/function/arithmetic/floor.js +21 -2
  89. package/lib/esm/function/arithmetic/log.js +12 -4
  90. package/lib/esm/function/arithmetic/pow.js +2 -2
  91. package/lib/esm/function/arithmetic/round.js +3 -5
  92. package/lib/esm/function/arithmetic/sign.js +1 -1
  93. package/lib/esm/function/bitwise/bitXor.js +4 -3
  94. package/lib/esm/function/logical/xor.js +4 -3
  95. package/lib/esm/function/matrix/filter.js +7 -0
  96. package/lib/esm/function/matrix/forEach.js +7 -0
  97. package/lib/esm/function/relational/equal.js +4 -3
  98. package/lib/esm/function/relational/larger.js +4 -3
  99. package/lib/esm/function/relational/largerEq.js +4 -3
  100. package/lib/esm/function/relational/smaller.js +4 -3
  101. package/lib/esm/function/relational/smallerEq.js +4 -3
  102. package/lib/esm/function/relational/unequal.js +4 -3
  103. package/lib/esm/function/utils/isInteger.js +1 -1
  104. package/lib/esm/function/utils/isNegative.js +1 -1
  105. package/lib/esm/function/utils/isPositive.js +1 -1
  106. package/lib/esm/type/bignumber/function/bignumber.js +2 -2
  107. package/lib/esm/type/fraction/Fraction.js +4 -4
  108. package/lib/esm/type/fraction/function/fraction.js +3 -0
  109. package/lib/esm/type/matrix/utils/matAlgo07xSSf.js +39 -43
  110. package/lib/esm/type/unit/Unit.js +1 -1
  111. package/lib/esm/utils/object.js +4 -0
  112. package/lib/esm/utils/string.js +2 -2
  113. package/lib/esm/version.js +1 -1
  114. package/package.json +3 -3
  115. package/types/index.d.ts +115 -25
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see math.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,(()=>(()=>{var e={3144:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},n={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},i=function(e,r){return t({},e,r)};e.exports=function(e){for(var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.preserveFormatting,s=void 0!==a&&a,u=o.escapeMapFn,c=void 0===u?i:u,l=String(e),f="",p=c(t({},r),s?t({},n):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,r){e||l.length>=t.length&&l.slice(0,t.length)===t&&(f+=p[m[r]],l=l.slice(t.length,l.length),e=!0)})),e||(f+=l.slice(0,1),l=l.slice(1,l.length))};l;)h();return f}},1880:e=>{e.exports=function e(t,r){"use strict";var n,i,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,a=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,c=/^0/,l=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},f=l(t).replace(a,"")||"",p=l(r).replace(a,"")||"",m=f.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||d&&p.match(s)&&Date.parse(p)||null;if(g){if(d<g)return-1;if(d>g)return 1}for(var y=0,x=Math.max(m.length,h.length);y<x;y++){if(n=!(m[y]||"").match(c)&&parseFloat(m[y])||m[y]||0,i=!(h[y]||"").match(c)&&parseFloat(h[y])||h[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}},7391:(e,t,r)=>{var n=r(7180),i=r(3181),o=r(3031),a=r(9067),s=r(6833),u=r(6098),c=r(4801);c.alea=n,c.xor128=i,c.xorwow=o,c.xorshift7=a,c.xor4096=s,c.tychei=u,e.exports=c},7180:function(e,t,r){var n;!function(e,i){function o(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r<e.length;r++){var n=.02519603282416938*(t+=e.charCodeAt(r));n-=t=n>>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var r=new o(e),n=t&&t.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.alea=s}(0,e=r.nmd(e),r.amdD)},6098:function(e,t,r){var n;!function(e,i){function o(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,i=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var n=0;n<r.length+20;n++)t.b^=0|r.charCodeAt(n),t.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function s(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.tychei=s}(0,e=r.nmd(e),r.amdD)},3181:function(e,t,r){var n;!function(e,i){function o(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var n=0;n<r.length+64;n++)t.x^=0|r.charCodeAt(n),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function s(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor128=s}(0,e=r.nmd(e),r.amdD)},6833:function(e,t,r){var n;!function(e,i){function o(e){var t=this;t.next=function(){var e,r,n=t.w,i=t.X,o=t.i;return t.w=n=n+1640531527|0,r=i[o+34&127],e=i[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=i[o]=r^e,t.i=o,r+(n^n>>>16)|0},function(e,t){var r,n,i,o,a,s=[],u=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,u=Math.max(u,t.length)),i=0,o=-32;o<u;++o)t&&(n^=t.charCodeAt((o+32)%t.length)),0===o&&(a=n),n^=n<<10,n^=n>>>15,n^=n<<4,n^=n>>>13,o>=0&&(a=a+1640531527|0,i=0==(r=s[127&o]^=n+a)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,o=512;o>0;--o)n=s[i+34&127],r=s[i=i+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,s[i]=n^r;e.w=a,e.X=s,e.i=i}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.X&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor4096=s}(0,e=r.nmd(e),r.amdD)},9067:function(e,t,r){var n;!function(e,i){function o(e){var t=this;t.next=function(){var e,r,n=t.x,i=t.i;return e=n[i],r=(e^=e>>>7)^e<<24,r^=(e=n[i+1&7])^e>>>10,r^=(e=n[i+3&7])^e>>>3,r^=(e=n[i+4&7])^e<<7,e=n[i+7&7],r^=(e^=e<<13)^e<<9,n[i]=r,t.i=i+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r<t.length;++r)n[7&r]=n[7&r]<<15^t.charCodeAt(r)+n[r+1&7]<<13;for(;n.length<8;)n.push(0);for(r=0;r<8&&0===n[r];++r);for(8==r?n[7]=-1:n[r],e.x=n,e.i=0,r=256;r>0;--r)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.x&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorshift7=s}(0,e=r.nmd(e),r.amdD)},3031:function(e,t,r){var n;!function(e,i){function o(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var n=0;n<r.length+64;n++)t.x^=0|r.charCodeAt(n),n==r.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function s(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorwow=s}(0,e=r.nmd(e),r.amdD)},4801:function(e,t,r){var n;!function(i,o,a){var s,u=256,c=a.pow(u,6),l=a.pow(2,52),f=2*l,p=255;function m(e,t,r){var n=[],p=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,x(o)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(u):(e=new Uint8Array(u),(i.crypto||i.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=i.navigator,r=t&&t.plugins;return[+new Date,i,r,i.screen,x(o)]}}():e,3),n),m=new h(n),b=function(){for(var e=m.g(6),t=c,r=0;e<l;)e=(e+r)*u,t*=u,r=m.g(1);for(;e>=f;)e/=2,t/=2,r>>>=1;return(e+r)/t};return b.int32=function(){return 0|m.g(4)},b.quick=function(){return m.g(4)/4294967296},b.double=b,y(x(m.S),o),(t.pass||r||function(e,t,r,n){return n&&(n.S&&d(n,m),e.state=function(){return d(m,{})}),r?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,r=e.length,n=this,i=0,o=n.i=n.j=0,a=n.S=[];for(r||(e=[r++]);i<u;)a[i]=i++;for(i=0;i<u;i++)a[i]=a[o=p&o+e[i%r]+(t=a[i])],a[o]=t;(n.g=function(e){for(var t,r=0,i=n.i,o=n.j,a=n.S;e--;)t=a[i=p&i+1],r=r*u+a[p&(a[i]=a[o=p&o+t])+(a[o]=t)];return n.i=i,n.j=o,r})(u)}function d(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var r,n=[],i=typeof e;if(t&&"object"==i)for(r in e)try{n.push(g(e[r],t-1))}catch(e){}return n.length?n:"string"==i?e:e+"\0"}function y(e,t){for(var r,n=e+"",i=0;i<n.length;)t[p&i]=p&(r^=19*t[p&i])+n.charCodeAt(i++);return x(t)}function x(e){return String.fromCharCode.apply(0,e)}if(y(a.random(),o),e.exports){e.exports=m;try{s=r(1234)}catch(e){}}else void 0===(n=function(){return m}.call(t,r,t,e))||(e.exports=n)}("undefined"!=typeof self?self:this,[],Math)},1504:e=>{function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,a=n.length;o<a;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=t,e.exports.TinyEmitter=t},1234:()=>{},9306:(e,t,r)=>{"use strict";var n=r(4901),i=r(6823),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a function")}},5548:(e,t,r)=>{"use strict";var n=r(3517),i=r(6823),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a constructor")}},3506:(e,t,r)=>{"use strict";var n=r(3925),i=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},6469:(e,t,r)=>{"use strict";var n=r(8227),i=r(2360),o=r(4913).f,a=n("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},7829:(e,t,r)=>{"use strict";var n=r(8183).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},679:(e,t,r)=>{"use strict";var n=r(1625),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new i("Incorrect invocation")}},8551:(e,t,r)=>{"use strict";var n=r(34),i=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not an object")}},9617:(e,t,r)=>{"use strict";var n=r(5397),i=r(5610),o=r(6198),a=function(e){return function(t,r,a){var s=n(t),u=o(s);if(0===u)return!e&&-1;var c,l=i(a,u);if(e&&r!=r){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((e||l in s)&&s[l]===r)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},4598:(e,t,r)=>{"use strict";var n=r(9039);e.exports=function(e,t){var r=[][e];return!!r&&n((function(){r.call(null,t||function(){return 1},1)}))}},926:(e,t,r)=>{"use strict";var n=r(9306),i=r(8981),o=r(7055),a=r(6198),s=TypeError,u="Reduce of empty array with no initial value",c=function(e){return function(t,r,c,l){var f=i(t),p=o(f),m=a(f);if(n(r),0===m&&c<2)throw new s(u);var h=e?m-1:0,d=e?-1:1;if(c<2)for(;;){if(h in p){l=p[h],h+=d;break}if(h+=d,e?h<0:m<=h)throw new s(u)}for(;e?h>=0:m>h;h+=d)h in p&&(l=r(l,p[h],h,f));return l}};e.exports={left:c(!1),right:c(!0)}},7680:(e,t,r)=>{"use strict";var n=r(9504);e.exports=n([].slice)},4488:(e,t,r)=>{"use strict";var n=r(7680),i=Math.floor,o=function(e,t){var r=e.length;if(r<8)for(var a,s,u=1;u<r;){for(s=u,a=e[u];s&&t(e[s-1],a)>0;)e[s]=e[--s];s!==u++&&(e[s]=a)}else for(var c=i(r/2),l=o(n(e,0,c),t),f=o(n(e,c),t),p=l.length,m=f.length,h=0,d=0;h<p||d<m;)e[h+d]=h<p&&d<m?t(l[h],f[d])<=0?l[h++]:f[d++]:h<p?l[h++]:f[d++];return e};e.exports=o},6319:(e,t,r)=>{"use strict";var n=r(8551),i=r(9539);e.exports=function(e,t,r,o){try{return o?t(n(r)[0],r[1]):t(r)}catch(t){i(e,"throw",t)}}},4428:(e,t,r)=>{"use strict";var n=r(8227)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},2195:(e,t,r)=>{"use strict";var n=r(9504),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},6955:(e,t,r)=>{"use strict";var n=r(2140),i=r(4901),o=r(2195),a=r(8227)("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}());e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?r:u?o(t):"Object"===(n=o(t))&&i(t.callee)?"Arguments":n}},7740:(e,t,r)=>{"use strict";var n=r(9297),i=r(5031),o=r(7347),a=r(4913);e.exports=function(e,t,r){for(var s=i(t),u=a.f,c=o.f,l=0;l<s.length;l++){var f=s[l];n(e,f)||r&&n(r,f)||u(e,f,c(t,f))}}},2211:(e,t,r)=>{"use strict";var n=r(9039);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},6699:(e,t,r)=>{"use strict";var n=r(3724),i=r(4913),o=r(6980);e.exports=n?function(e,t,r){return i.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4659:(e,t,r)=>{"use strict";var n=r(3724),i=r(4913),o=r(6980);e.exports=function(e,t,r){n?i.f(e,t,o(0,r)):e[t]=r}},2106:(e,t,r)=>{"use strict";var n=r(283),i=r(4913);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),i.f(e,t,r)}},6840:(e,t,r)=>{"use strict";var n=r(4901),i=r(4913),o=r(283),a=r(9433);e.exports=function(e,t,r,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:t;if(n(r)&&o(r,c,s),s.global)u?e[t]=r:a(t,r);else{try{s.unsafe?e[t]&&(u=!0):delete e[t]}catch(e){}u?e[t]=r:i.f(e,t,{value:r,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6279:(e,t,r)=>{"use strict";var n=r(6840);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},9433:(e,t,r)=>{"use strict";var n=r(4576),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},4606:(e,t,r)=>{"use strict";var n=r(6823),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw new i("Cannot delete property "+n(t)+" of "+n(e))}},3724:(e,t,r)=>{"use strict";var n=r(9039);e.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,r)=>{"use strict";var n=r(4576),i=r(34),o=n.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:(e,t,r)=>{"use strict";var n=r(2839).match(/firefox\/(\d+)/i);e.exports=!!n&&+n[1]},3763:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/MSIE|Trident/.test(n)},4265:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/ipad|iphone|ipod/i.test(n)&&"undefined"!=typeof Pebble},9544:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)},6193:(e,t,r)=>{"use strict";var n=r(4215);e.exports="NODE"===n},7860:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/web0s(?!.*chrome)/i.test(n)},2839:(e,t,r)=>{"use strict";var n=r(4576).navigator,i=n&&n.userAgent;e.exports=i?String(i):""},9519:(e,t,r)=>{"use strict";var n,i,o=r(4576),a=r(2839),s=o.process,u=o.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(i=(n=l.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},3607:(e,t,r)=>{"use strict";var n=r(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!n&&+n[1]},4215:(e,t,r)=>{"use strict";var n=r(4576),i=r(2839),o=r(2195),a=function(e){return i.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":n.Bun&&"string"==typeof Bun.version?"BUN":n.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(n.process)?"NODE":n.window&&n.document?"BROWSER":"REST"},6518:(e,t,r)=>{"use strict";var n=r(4576),i=r(7347).f,o=r(6699),a=r(6840),s=r(9433),u=r(7740),c=r(2796);e.exports=function(e,t){var r,l,f,p,m,h=e.target,d=e.global,g=e.stat;if(r=d?n:g?n[h]||s(h,{}):n[h]&&n[h].prototype)for(l in t){if(p=t[l],f=e.dontCallGetSet?(m=i(r,l))&&m.value:r[l],!c(d?l:h+(g?".":"#")+l,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(e.sham||f&&f.sham)&&o(p,"sham",!0),a(r,l,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9228:(e,t,r)=>{"use strict";r(7495);var n=r(9565),i=r(6840),o=r(7323),a=r(9039),s=r(8227),u=r(6699),c=s("species"),l=RegExp.prototype;e.exports=function(e,t,r,f){var p=s(e),m=!a((function(){var t={};return t[p]=function(){return 7},7!==""[e](t)})),h=m&&!a((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[c]=function(){return r},r.flags="",r[p]=/./[p]),r.exec=function(){return t=!0,null},r[p](""),!t}));if(!m||!h||r){var d=/./[p],g=t(p,""[e],(function(e,t,r,i,a){var s=t.exec;return s===o||s===l.exec?m&&!a?{done:!0,value:n(d,t,r,i)}:{done:!0,value:n(e,r,t,i)}:{done:!1}}));i(String.prototype,e,g[0]),i(l,p,g[1])}f&&u(l[p],"sham",!0)}},8745:(e,t,r)=>{"use strict";var n=r(616),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(o):function(){return a.apply(o,arguments)})},6080:(e,t,r)=>{"use strict";var n=r(7476),i=r(9306),o=r(616),a=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},616:(e,t,r)=>{"use strict";var n=r(9039);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,r)=>{"use strict";var n=r(616),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},350:(e,t,r)=>{"use strict";var n=r(3724),i=r(9297),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=i(o,"name"),u=s&&"something"===function(){}.name,c=s&&(!n||n&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},6706:(e,t,r)=>{"use strict";var n=r(9504),i=r(9306);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},7476:(e,t,r)=>{"use strict";var n=r(2195),i=r(9504);e.exports=function(e){if("Function"===n(e))return i(e)}},9504:(e,t,r)=>{"use strict";var n=r(616),i=Function.prototype,o=i.call,a=n&&i.bind.bind(o,o);e.exports=n?a:function(e){return function(){return o.apply(e,arguments)}}},7751:(e,t,r)=>{"use strict";var n=r(4576),i=r(4901);e.exports=function(e,t){return arguments.length<2?(r=n[e],i(r)?r:void 0):n[e]&&n[e][t];var r}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},851:(e,t,r)=>{"use strict";var n=r(6955),i=r(5966),o=r(4117),a=r(6269),s=r(8227)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[n(e)]}},81:(e,t,r)=>{"use strict";var n=r(9565),i=r(9306),o=r(8551),a=r(6823),s=r(851),u=TypeError;e.exports=function(e,t){var r=arguments.length<2?s(e):t;if(i(r))return o(n(r,e));throw new u(a(e)+" is not iterable")}},6933:(e,t,r)=>{"use strict";var n=r(9504),i=r(4376),o=r(4901),a=r(2195),s=r(655),u=n([].push);e.exports=function(e){if(o(e))return e;if(i(e)){for(var t=e.length,r=[],n=0;n<t;n++){var c=e[n];"string"==typeof c?u(r,c):"number"!=typeof c&&"Number"!==a(c)&&"String"!==a(c)||u(r,s(c))}var l=r.length,f=!0;return function(e,t){if(f)return f=!1,t;if(i(this))return t;for(var n=0;n<l;n++)if(r[n]===e)return t}}}},5966:(e,t,r)=>{"use strict";var n=r(9306),i=r(4117);e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}},2478:(e,t,r)=>{"use strict";var n=r(9504),i=r(8981),o=Math.floor,a=n("".charAt),s=n("".replace),u=n("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,r,n,f,p){var m=r+e.length,h=n.length,d=l;return void 0!==f&&(f=i(f),d=c),s(p,d,(function(i,s){var c;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return u(t,0,r);case"'":return u(t,m);case"<":c=f[u(s,1,-1)];break;default:var l=+s;if(0===l)return i;if(l>h){var p=o(l/10);return 0===p?i:p<=h?void 0===n[p-1]?a(s,1):n[p-1]+a(s,1):i}c=n[l-1]}return void 0===c?"":c}))}},4576:function(e){"use strict";var t=function(e){return e&&e.Math===Math&&e};e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||t("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,r)=>{"use strict";var n=r(9504),i=r(8981),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},421:e=>{"use strict";e.exports={}},3138:e=>{"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},397:(e,t,r)=>{"use strict";var n=r(7751);e.exports=n("document","documentElement")},5917:(e,t,r)=>{"use strict";var n=r(3724),i=r(9039),o=r(4055);e.exports=!n&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),o=r(2195),a=Object,s=n("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},3167:(e,t,r)=>{"use strict";var n=r(4901),i=r(34),o=r(2967);e.exports=function(e,t,r){var a,s;return o&&n(a=t.constructor)&&a!==r&&i(s=a.prototype)&&s!==r.prototype&&o(e,s),e}},3706:(e,t,r)=>{"use strict";var n=r(9504),i=r(4901),o=r(7629),a=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},1181:(e,t,r)=>{"use strict";var n,i,o,a=r(8622),s=r(4576),u=r(34),c=r(6699),l=r(9297),f=r(7629),p=r(6119),m=r(421),h="Object already initialized",d=s.TypeError,g=s.WeakMap;if(a||f.state){var y=f.state||(f.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,n=function(e,t){if(y.has(e))throw new d(h);return t.facade=e,y.set(e,t),t},i=function(e){return y.get(e)||{}},o=function(e){return y.has(e)}}else{var x=p("state");m[x]=!0,n=function(e,t){if(l(e,x))throw new d(h);return t.facade=e,c(e,x,t),t},i=function(e){return l(e,x)?e[x]:{}},o=function(e){return l(e,x)}}e.exports={set:n,get:i,has:o,enforce:function(e){return o(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=i(t)).type!==e)throw new d("Incompatible receiver, "+e+" required");return r}}}},4209:(e,t,r)=>{"use strict";var n=r(8227),i=r(6269),o=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},4376:(e,t,r)=>{"use strict";var n=r(2195);e.exports=Array.isArray||function(e){return"Array"===n(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},3517:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),o=r(4901),a=r(6955),s=r(7751),u=r(3706),c=function(){},l=s("Reflect","construct"),f=/^\s*(?:class|function)\b/,p=n(f.exec),m=!f.test(c),h=function(e){if(!o(e))return!1;try{return l(c,[],e),!0}catch(e){return!1}},d=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return m||!!p(f,u(e))}catch(e){return!0}};d.sham=!0,e.exports=!l||i((function(){var e;return h(h.call)||!h(Object)||!h((function(){e=!0}))||e}))?d:h},2796:(e,t,r)=>{"use strict";var n=r(9039),i=r(4901),o=/#|\.prototype\./,a=function(e,t){var r=u[s(e)];return r===l||r!==c&&(i(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,r)=>{"use strict";var n=r(4901);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},3925:(e,t,r)=>{"use strict";var n=r(34);e.exports=function(e){return n(e)||null===e}},6395:e=>{"use strict";e.exports=!1},788:(e,t,r)=>{"use strict";var n=r(34),i=r(2195),o=r(8227)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},757:(e,t,r)=>{"use strict";var n=r(7751),i=r(4901),o=r(1625),a=r(7040),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&o(t.prototype,s(e))}},2652:(e,t,r)=>{"use strict";var n=r(6080),i=r(9565),o=r(8551),a=r(6823),s=r(4209),u=r(6198),c=r(1625),l=r(81),f=r(851),p=r(9539),m=TypeError,h=function(e,t){this.stopped=e,this.result=t},d=h.prototype;e.exports=function(e,t,r){var g,y,x,b,v,w,N,E=r&&r.that,A=!(!r||!r.AS_ENTRIES),S=!(!r||!r.IS_RECORD),M=!(!r||!r.IS_ITERATOR),C=!(!r||!r.INTERRUPTED),T=n(t,E),D=function(e){return g&&p(g,"normal",e),new h(!0,e)},F=function(e){return A?(o(e),C?T(e[0],e[1],D):T(e[0],e[1])):C?T(e,D):T(e)};if(S)g=e.iterator;else if(M)g=e;else{if(!(y=f(e)))throw new m(a(e)+" is not iterable");if(s(y)){for(x=0,b=u(e);b>x;x++)if((v=F(e[x]))&&c(d,v))return v;return new h(!1)}g=l(e,y)}for(w=S?e.next:g.next;!(N=i(w,g)).done;){try{v=F(N.value)}catch(e){p(g,"throw",e)}if("object"==typeof v&&v&&c(d,v))return v}return new h(!1)}},9539:(e,t,r)=>{"use strict";var n=r(9565),i=r(8551),o=r(5966);e.exports=function(e,t,r){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw r;return r}a=n(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw r;if(s)throw a;return i(a),r}},9462:(e,t,r)=>{"use strict";var n=r(9565),i=r(2360),o=r(6699),a=r(6279),s=r(8227),u=r(1181),c=r(5966),l=r(7657).IteratorPrototype,f=r(2529),p=r(9539),m=s("toStringTag"),h="IteratorHelper",d="WrapForValidIterator",g=u.set,y=function(e){var t=u.getterFor(e?d:h);return a(i(l),{next:function(){var r=t(this);if(e)return r.nextHandler();try{var n=r.done?void 0:r.nextHandler();return f(n,r.done)}catch(e){throw r.done=!0,e}},return:function(){var r=t(this),i=r.iterator;if(r.done=!0,e){var o=c(i,"return");return o?n(o,i):f(void 0,!0)}if(r.inner)try{p(r.inner.iterator,"normal")}catch(e){return p(i,"throw",e)}return i&&p(i,"normal"),f(void 0,!0)}})},x=y(!0),b=y(!1);o(b,m,"Iterator Helper"),e.exports=function(e,t){var r=function(r,n){n?(n.iterator=r.iterator,n.next=r.next):n=r,n.type=t?d:h,n.nextHandler=e,n.counter=0,n.done=!1,g(this,n)};return r.prototype=t?x:b,r}},713:(e,t,r)=>{"use strict";var n=r(9565),i=r(9306),o=r(8551),a=r(1767),s=r(9462),u=r(6319),c=s((function(){var e=this.iterator,t=o(n(this.next,e));if(!(this.done=!!t.done))return u(e,this.mapper,[t.value,this.counter++],!0)}));e.exports=function(e){return o(this),i(e),new c(a(this),{mapper:e})}},7657:(e,t,r)=>{"use strict";var n,i,o,a=r(9039),s=r(4901),u=r(34),c=r(2360),l=r(2787),f=r(6840),p=r(8227),m=r(6395),h=p("iterator"),d=!1;[].keys&&("next"in(o=[].keys())?(i=l(l(o)))!==Object.prototype&&(n=i):d=!0),!u(n)||a((function(){var e={};return n[h].call(e)!==e}))?n={}:m&&(n=c(n)),s(n[h])||f(n,h,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},6269:e=>{"use strict";e.exports={}},6198:(e,t,r)=>{"use strict";var n=r(8014);e.exports=function(e){return n(e.length)}},283:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),o=r(4901),a=r(9297),s=r(3724),u=r(350).CONFIGURABLE,c=r(3706),l=r(1181),f=l.enforce,p=l.get,m=String,h=Object.defineProperty,d=n("".slice),g=n("".replace),y=n([].join),x=s&&!i((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),v=e.exports=function(e,t,r){"Symbol("===d(m(t),0,7)&&(t="["+g(m(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!a(e,"name")||u&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),x&&r&&a(r,"arity")&&e.length!==r.arity&&h(e,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=f(e);return a(n,"source")||(n.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=v((function(){return o(this)&&p(this).source||c(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},1955:(e,t,r)=>{"use strict";var n,i,o,a,s,u=r(4576),c=r(3389),l=r(6080),f=r(9225).set,p=r(8265),m=r(9544),h=r(4265),d=r(7860),g=r(6193),y=u.MutationObserver||u.WebKitMutationObserver,x=u.document,b=u.process,v=u.Promise,w=c("queueMicrotask");if(!w){var N=new p,E=function(){var e,t;for(g&&(e=b.domain)&&e.exit();t=N.get();)try{t()}catch(e){throw N.head&&n(),e}e&&e.enter()};m||g||d||!y||!x?!h&&v&&v.resolve?((a=v.resolve(void 0)).constructor=v,s=l(a.then,a),n=function(){s(E)}):g?n=function(){b.nextTick(E)}:(f=l(f,u),n=function(){f(E)}):(i=!0,o=x.createTextNode(""),new y(E).observe(o,{characterData:!0}),n=function(){o.data=i=!i}),w=function(e){N.head||n(),N.add(e)}}e.exports=w},6043:(e,t,r)=>{"use strict";var n=r(9306),i=TypeError,o=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw new i("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)};e.exports.f=function(e){return new o(e)}},2360:(e,t,r)=>{"use strict";var n,i=r(8551),o=r(6801),a=r(8727),s=r(421),u=r(397),c=r(4055),l=r(6119),f="prototype",p="script",m=l("IE_PROTO"),h=function(){},d=function(e){return"<"+p+">"+e+"</"+p+">"},g=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;y="undefined"!=typeof document?document.domain&&n?g(n):(t=c("iframe"),r="java"+p+":",t.style.display="none",u.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):g(n);for(var i=a.length;i--;)delete y[f][a[i]];return y()};s[m]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(h[f]=i(e),r=new h,h[f]=null,r[m]=e):r=y(),void 0===t?r:o.f(r,t)}},6801:(e,t,r)=>{"use strict";var n=r(3724),i=r(8686),o=r(4913),a=r(8551),s=r(5397),u=r(1072);t.f=n&&!i?Object.defineProperties:function(e,t){a(e);for(var r,n=s(t),i=u(t),c=i.length,l=0;c>l;)o.f(e,r=i[l++],n[r]);return e}},4913:(e,t,r)=>{"use strict";var n=r(3724),i=r(5917),o=r(8686),a=r(8551),s=r(6969),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",p="configurable",m="writable";t.f=n?o?function(e,t,r){if(a(e),t=s(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&m in r&&!r[m]){var n=l(e,t);n&&n[m]&&(e[t]=r.value,r={configurable:p in r?r[p]:n[p],enumerable:f in r?r[f]:n[f],writable:!1})}return c(e,t,r)}:c:function(e,t,r){if(a(e),t=s(t),a(r),i)try{return c(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new u("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},7347:(e,t,r)=>{"use strict";var n=r(3724),i=r(9565),o=r(8773),a=r(6980),s=r(5397),u=r(6969),c=r(9297),l=r(5917),f=Object.getOwnPropertyDescriptor;t.f=n?f:function(e,t){if(e=s(e),t=u(t),l)try{return f(e,t)}catch(e){}if(c(e,t))return a(!i(o.f,e,t),e[t])}},8480:(e,t,r)=>{"use strict";var n=r(1828),i=r(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},2787:(e,t,r)=>{"use strict";var n=r(9297),i=r(4901),o=r(8981),a=r(6119),s=r(2211),u=a("IE_PROTO"),c=Object,l=c.prototype;e.exports=s?c.getPrototypeOf:function(e){var t=o(e);if(n(t,u))return t[u];var r=t.constructor;return i(r)&&t instanceof r?r.prototype:t instanceof c?l:null}},1625:(e,t,r)=>{"use strict";var n=r(9504);e.exports=n({}.isPrototypeOf)},1828:(e,t,r)=>{"use strict";var n=r(9504),i=r(9297),o=r(5397),a=r(9617).indexOf,s=r(421),u=n([].push);e.exports=function(e,t){var r,n=o(e),c=0,l=[];for(r in n)!i(s,r)&&i(n,r)&&u(l,r);for(;t.length>c;)i(n,r=t[c++])&&(~a(l,r)||u(l,r));return l}},1072:(e,t,r)=>{"use strict";var n=r(1828),i=r(8727);e.exports=Object.keys||function(e){return n(e,i)}},8773:(e,t)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},2967:(e,t,r)=>{"use strict";var n=r(6706),i=r(34),o=r(7750),a=r(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return o(r),a(n),i(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0)},4270:(e,t,r)=>{"use strict";var n=r(9565),i=r(4901),o=r(34),a=TypeError;e.exports=function(e,t){var r,s;if("string"===t&&i(r=e.toString)&&!o(s=n(r,e)))return s;if(i(r=e.valueOf)&&!o(s=n(r,e)))return s;if("string"!==t&&i(r=e.toString)&&!o(s=n(r,e)))return s;throw new a("Can't convert object to primitive value")}},5031:(e,t,r)=>{"use strict";var n=r(7751),i=r(9504),o=r(8480),a=r(3717),s=r(8551),u=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(s(e)),r=a.f;return r?u(t,r(e)):t}},1103:e=>{"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},916:(e,t,r)=>{"use strict";var n=r(4576),i=r(550),o=r(4901),a=r(2796),s=r(3706),u=r(8227),c=r(4215),l=r(6395),f=r(9519),p=i&&i.prototype,m=u("species"),h=!1,d=o(n.PromiseRejectionEvent),g=a("Promise",(function(){var e=s(i),t=e!==String(i);if(!t&&66===f)return!0;if(l&&(!p.catch||!p.finally))return!0;if(!f||f<51||!/native code/.test(e)){var r=new i((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[m]=n,!(h=r.then((function(){}))instanceof n))return!0}return!(t||"BROWSER"!==c&&"DENO"!==c||d)}));e.exports={CONSTRUCTOR:g,REJECTION_EVENT:d,SUBCLASSING:h}},550:(e,t,r)=>{"use strict";var n=r(4576);e.exports=n.Promise},3438:(e,t,r)=>{"use strict";var n=r(8551),i=r(34),o=r(6043);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=o.f(e);return(0,r.resolve)(t),r.promise}},537:(e,t,r)=>{"use strict";var n=r(550),i=r(4428),o=r(916).CONSTRUCTOR;e.exports=o||!i((function(e){n.all(e).then(void 0,(function(){}))}))},1056:(e,t,r)=>{"use strict";var n=r(4913).f;e.exports=function(e,t,r){r in e||n(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})}},8265:e=>{"use strict";var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},e.exports=t},6682:(e,t,r)=>{"use strict";var n=r(9565),i=r(8551),o=r(4901),a=r(2195),s=r(7323),u=TypeError;e.exports=function(e,t){var r=e.exec;if(o(r)){var c=n(r,e,t);return null!==c&&i(c),c}if("RegExp"===a(e))return n(s,e,t);throw new u("RegExp#exec called on incompatible receiver")}},7323:(e,t,r)=>{"use strict";var n,i,o=r(9565),a=r(9504),s=r(655),u=r(7979),c=r(8429),l=r(5745),f=r(2360),p=r(1181).get,m=r(3635),h=r(8814),d=l("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,y=g,x=a("".charAt),b=a("".indexOf),v=a("".replace),w=a("".slice),N=(i=/b*/g,o(g,n=/a/,"a"),o(g,i,"a"),0!==n.lastIndex||0!==i.lastIndex),E=c.BROKEN_CARET,A=void 0!==/()??/.exec("")[1];(N||A||E||m||h)&&(y=function(e){var t,r,n,i,a,c,l,m=this,h=p(m),S=s(e),M=h.raw;if(M)return M.lastIndex=m.lastIndex,t=o(y,M,S),m.lastIndex=M.lastIndex,t;var C=h.groups,T=E&&m.sticky,D=o(u,m),F=m.source,O=0,B=S;if(T&&(D=v(D,"y",""),-1===b(D,"g")&&(D+="g"),B=w(S,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==x(S,m.lastIndex-1))&&(F="(?: "+F+")",B=" "+B,O++),r=new RegExp("^(?:"+F+")",D)),A&&(r=new RegExp("^"+F+"$(?!\\s)",D)),N&&(n=m.lastIndex),i=o(g,T?r:m,B),T?i?(i.input=w(i.input,O),i[0]=w(i[0],O),i.index=m.lastIndex,m.lastIndex+=i[0].length):m.lastIndex=0:N&&i&&(m.lastIndex=m.global?i.index+i[0].length:n),A&&i&&i.length>1&&o(d,i[0],r,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&C)for(i.groups=c=f(null),a=0;a<C.length;a++)c[(l=C[a])[0]]=i[l[1]];return i}),e.exports=y},7979:(e,t,r)=>{"use strict";var n=r(8551);e.exports=function(){var e=n(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},1034:(e,t,r)=>{"use strict";var n=r(9565),i=r(9297),o=r(1625),a=r(7979),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||i(e,"flags")||!o(s,e)?t:n(a,e)}},8429:(e,t,r)=>{"use strict";var n=r(9039),i=r(4576).RegExp,o=n((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||n((function(){return!i("a","y").sticky})),s=o||n((function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},3635:(e,t,r)=>{"use strict";var n=r(9039),i=r(4576).RegExp;e.exports=n((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},8814:(e,t,r)=>{"use strict";var n=r(9039),i=r(4576).RegExp;e.exports=n((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},7750:(e,t,r)=>{"use strict";var n=r(4117),i=TypeError;e.exports=function(e){if(n(e))throw new i("Can't call method on "+e);return e}},3389:(e,t,r)=>{"use strict";var n=r(4576),i=r(3724),o=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!i)return n[e];var t=o(n,e);return t&&t.value}},7633:(e,t,r)=>{"use strict";var n=r(7751),i=r(2106),o=r(8227),a=r(3724),s=o("species");e.exports=function(e){var t=n(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},687:(e,t,r)=>{"use strict";var n=r(4913).f,i=r(9297),o=r(8227)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!i(e,o)&&n(e,o,{configurable:!0,value:t})}},6119:(e,t,r)=>{"use strict";var n=r(5745),i=r(3392),o=n("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},7629:(e,t,r)=>{"use strict";var n=r(6395),i=r(4576),o=r(9433),a="__core-js_shared__",s=e.exports=i[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.39.0",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,r)=>{"use strict";var n=r(7629);e.exports=function(e,t){return n[e]||(n[e]=t||{})}},2293:(e,t,r)=>{"use strict";var n=r(8551),i=r(5548),o=r(4117),a=r(8227)("species");e.exports=function(e,t){var r,s=n(e).constructor;return void 0===s||o(r=n(s)[a])?t:i(r)}},8183:(e,t,r)=>{"use strict";var n=r(9504),i=r(1291),o=r(655),a=r(7750),s=n("".charAt),u=n("".charCodeAt),c=n("".slice),l=function(e){return function(t,r){var n,l,f=o(a(t)),p=i(r),m=f.length;return p<0||p>=m?e?"":void 0:(n=u(f,p))<55296||n>56319||p+1===m||(l=u(f,p+1))<56320||l>57343?e?s(f,p):n:e?c(f,p,p+2):l-56320+(n-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},4495:(e,t,r)=>{"use strict";var n=r(9519),i=r(9039),o=r(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},9225:(e,t,r)=>{"use strict";var n,i,o,a,s=r(4576),u=r(8745),c=r(6080),l=r(4901),f=r(9297),p=r(9039),m=r(397),h=r(7680),d=r(4055),g=r(2812),y=r(9544),x=r(6193),b=s.setImmediate,v=s.clearImmediate,w=s.process,N=s.Dispatch,E=s.Function,A=s.MessageChannel,S=s.String,M=0,C={},T="onreadystatechange";p((function(){n=s.location}));var D=function(e){if(f(C,e)){var t=C[e];delete C[e],t()}},F=function(e){return function(){D(e)}},O=function(e){D(e.data)},B=function(e){s.postMessage(S(e),n.protocol+"//"+n.host)};b&&v||(b=function(e){g(arguments.length,1);var t=l(e)?e:E(e),r=h(arguments,1);return C[++M]=function(){u(t,void 0,r)},i(M),M},v=function(e){delete C[e]},x?i=function(e){w.nextTick(F(e))}:N&&N.now?i=function(e){N.now(F(e))}:A&&!y?(a=(o=new A).port2,o.port1.onmessage=O,i=c(a.postMessage,a)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&n&&"file:"!==n.protocol&&!p(B)?(i=B,s.addEventListener("message",O,!1)):i=T in d("script")?function(e){m.appendChild(d("script"))[T]=function(){m.removeChild(this),D(e)}}:function(e){setTimeout(F(e),0)}),e.exports={set:b,clear:v}},5610:(e,t,r)=>{"use strict";var n=r(1291),i=Math.max,o=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):o(r,t)}},5397:(e,t,r)=>{"use strict";var n=r(7055),i=r(7750);e.exports=function(e){return n(i(e))}},1291:(e,t,r)=>{"use strict";var n=r(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},8014:(e,t,r)=>{"use strict";var n=r(1291),i=Math.min;e.exports=function(e){var t=n(e);return t>0?i(t,9007199254740991):0}},8981:(e,t,r)=>{"use strict";var n=r(7750),i=Object;e.exports=function(e){return i(n(e))}},2777:(e,t,r)=>{"use strict";var n=r(9565),i=r(34),o=r(757),a=r(5966),s=r(4270),u=r(8227),c=TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var r,u=a(e,l);if(u){if(void 0===t&&(t="default"),r=n(u,e,t),!i(r)||o(r))return r;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6969:(e,t,r)=>{"use strict";var n=r(2777),i=r(757);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},2140:(e,t,r)=>{"use strict";var n={};n[r(8227)("toStringTag")]="z",e.exports="[object z]"===String(n)},655:(e,t,r)=>{"use strict";var n=r(6955),i=String;e.exports=function(e){if("Symbol"===n(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,r)=>{"use strict";var n=r(9504),i=0,o=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},7040:(e,t,r)=>{"use strict";var n=r(4495);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,r)=>{"use strict";var n=r(3724),i=r(9039);e.exports=n&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},2812:e=>{"use strict";var t=TypeError;e.exports=function(e,r){if(e<r)throw new t("Not enough arguments");return e}},8622:(e,t,r)=>{"use strict";var n=r(4576),i=r(4901),o=n.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},8227:(e,t,r)=>{"use strict";var n=r(4576),i=r(5745),o=r(9297),a=r(3392),s=r(4495),u=r(7040),c=n.Symbol,l=i("wks"),f=u?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return o(l,e)||(l[e]=s&&o(c,e)?c[e]:f("Symbol."+e)),l[e]}},4423:(e,t,r)=>{"use strict";var n=r(6518),i=r(9617).includes,o=r(9039),a=r(6469);n({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},2712:(e,t,r)=>{"use strict";var n=r(6518),i=r(926).left,o=r(4598),a=r(9519);n({target:"Array",proto:!0,forced:!r(6193)&&a>79&&a<83||!o("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},6910:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),o=r(9306),a=r(8981),s=r(6198),u=r(4606),c=r(655),l=r(9039),f=r(4488),p=r(4598),m=r(3709),h=r(3763),d=r(9519),g=r(3607),y=[],x=i(y.sort),b=i(y.push),v=l((function(){y.sort(void 0)})),w=l((function(){y.sort(null)})),N=p("sort"),E=!l((function(){if(d)return d<70;if(!(m&&m>3)){if(h)return!0;if(g)return g<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)y.push({k:t+n,v:r})}for(y.sort((function(e,t){return t.v-e.v})),n=0;n<y.length;n++)t=y[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));n({target:"Array",proto:!0,forced:v||!w||!N||!E},{sort:function(e){void 0!==e&&o(e);var t=a(this);if(E)return void 0===e?x(t):x(t,e);var r,n,i=[],l=s(t);for(n=0;n<l;n++)n in t&&b(i,t[n]);for(f(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:c(t)>c(r)?1:-1}}(e)),r=s(i),n=0;n<r;)t[n]=i[n++];for(;n<l;)u(t,n++);return t}})},8111:(e,t,r)=>{"use strict";var n=r(6518),i=r(4576),o=r(679),a=r(8551),s=r(4901),u=r(2787),c=r(2106),l=r(4659),f=r(9039),p=r(9297),m=r(8227),h=r(7657).IteratorPrototype,d=r(3724),g=r(6395),y="constructor",x="Iterator",b=m("toStringTag"),v=TypeError,w=i[x],N=g||!s(w)||w.prototype!==h||!f((function(){w({})})),E=function(){if(o(this,h),u(this)===h)throw new v("Abstract class Iterator not directly constructable")},A=function(e,t){d?c(h,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===h)throw new v("You can't redefine this property");p(this,e)?this[e]=t:l(this,e,t)}}):h[e]=t};p(h,b)||A(b,x),!N&&p(h,y)&&h[y]!==Object||A(y,E),E.prototype=h,n({global:!0,constructor:!0,forced:N},{Iterator:E})},1148:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{every:function(e){a(this),o(e);var t=s(this),r=0;return!i(t,(function(t,n){if(!e(t,r++))return n()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:(e,t,r)=>{"use strict";var n=r(6518),i=r(9565),o=r(9306),a=r(8551),s=r(1767),u=r(9462),c=r(6319),l=r(6395),f=u((function(){for(var e,t,r=this.iterator,n=this.predicate,o=this.next;;){if(e=a(i(o,r)),this.done=!!e.done)return;if(t=e.value,c(r,n,[t,this.counter++],!0))return t}}));n({target:"Iterator",proto:!0,real:!0,forced:l},{filter:function(e){return a(this),o(e),new f(s(this),{predicate:e})}})},116:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{find:function(e){a(this),o(e);var t=s(this),r=0;return i(t,(function(t,n){if(e(t,r++))return n(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},7588:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{forEach:function(e){a(this),o(e);var t=s(this),r=0;i(t,(function(t){e(t,r++)}),{IS_RECORD:!0})}})},1701:(e,t,r)=>{"use strict";var n=r(6518),i=r(713);n({target:"Iterator",proto:!0,real:!0,forced:r(6395)},{map:i})},8237:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767),u=TypeError;n({target:"Iterator",proto:!0,real:!0},{reduce:function(e){a(this),o(e);var t=s(this),r=arguments.length<2,n=r?void 0:arguments[1],c=0;if(i(t,(function(t){r?(r=!1,n=t):n=e(n,t,c),c++}),{IS_RECORD:!0}),r)throw new u("Reduce of empty iterator with no initial value");return n}})},3579:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{some:function(e){a(this),o(e);var t=s(this),r=0;return i(t,(function(t,n){if(e(t,r++))return n()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1806:(e,t,r)=>{"use strict";var n=r(6518),i=r(8551),o=r(2652),a=r(1767),s=[].push;n({target:"Iterator",proto:!0,real:!0},{toArray:function(){var e=[];return o(a(i(this)),s,{that:e,IS_RECORD:!0}),e}})},3110:(e,t,r)=>{"use strict";var n=r(6518),i=r(7751),o=r(8745),a=r(9565),s=r(9504),u=r(9039),c=r(4901),l=r(757),f=r(7680),p=r(6933),m=r(4495),h=String,d=i("JSON","stringify"),g=s(/./.exec),y=s("".charAt),x=s("".charCodeAt),b=s("".replace),v=s(1..toString),w=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,A=!m||u((function(){var e=i("Symbol")("stringify detection");return"[null]"!==d([e])||"{}"!==d({a:e})||"{}"!==d(Object(e))})),S=u((function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")})),M=function(e,t){var r=f(arguments),n=p(t);if(c(n)||void 0!==e&&!l(e))return r[1]=function(e,t){if(c(n)&&(t=a(n,this,h(e),t)),!l(t))return t},o(d,null,r)},C=function(e,t,r){var n=y(r,t-1),i=y(r,t+1);return g(N,e)&&!g(E,i)||g(E,e)&&!g(N,n)?"\\u"+v(x(e,0),16):e};d&&n({target:"JSON",stat:!0,arity:3,forced:A||S},{stringify:function(e,t,r){var n=f(arguments),i=o(A?M:d,null,n);return S&&"string"==typeof i?b(i,w,C):i}})},3921:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(4659);n({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,r){o(t,e,r)}),{AS_ENTRIES:!0}),t}})},6499:(e,t,r)=>{"use strict";var n=r(6518),i=r(9565),o=r(9306),a=r(6043),s=r(1103),u=r(2652);n({target:"Promise",stat:!0,forced:r(537)},{all:function(e){var t=this,r=a.f(t),n=r.resolve,c=r.reject,l=s((function(){var r=o(t.resolve),a=[],s=0,l=1;u(e,(function(e){var o=s++,u=!1;l++,i(r,t,e).then((function(e){u||(u=!0,a[o]=e,--l||n(a))}),c)})),--l||n(a)}));return l.error&&c(l.value),r.promise}})},2003:(e,t,r)=>{"use strict";var n=r(6518),i=r(6395),o=r(916).CONSTRUCTOR,a=r(550),s=r(7751),u=r(4901),c=r(6840),l=a&&a.prototype;if(n({target:"Promise",proto:!0,forced:o,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&u(a)){var f=s("Promise").prototype.catch;l.catch!==f&&c(l,"catch",f,{unsafe:!0})}},436:(e,t,r)=>{"use strict";var n,i,o,a=r(6518),s=r(6395),u=r(6193),c=r(4576),l=r(9565),f=r(6840),p=r(2967),m=r(687),h=r(7633),d=r(9306),g=r(4901),y=r(34),x=r(679),b=r(2293),v=r(9225).set,w=r(1955),N=r(3138),E=r(1103),A=r(8265),S=r(1181),M=r(550),C=r(916),T=r(6043),D="Promise",F=C.CONSTRUCTOR,O=C.REJECTION_EVENT,B=C.SUBCLASSING,_=S.getterFor(D),z=S.set,I=M&&M.prototype,k=M,R=I,q=c.TypeError,P=c.document,j=c.process,U=T.f,L=U,$=!!(P&&P.createEvent&&c.dispatchEvent),H="unhandledrejection",G=function(e){var t;return!(!y(e)||!g(t=e.then))&&t},V=function(e,t){var r,n,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,f=e.domain;try{s?(a||(2===t.rejection&&X(t),t.rejection=1),!0===s?r=o:(f&&f.enter(),r=s(o),f&&(f.exit(),i=!0)),r===e.promise?c(new q("Promise-chain cycle")):(n=G(r))?l(n,r,u,c):u(r)):c(o)}catch(e){f&&!i&&f.exit(),c(e)}},W=function(e,t){e.notified||(e.notified=!0,w((function(){for(var r,n=e.reactions;r=n.get();)V(r,e);e.notified=!1,t&&!e.rejection&&Y(e)})))},Z=function(e,t,r){var n,i;$?((n=P.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),c.dispatchEvent(n)):n={promise:t,reason:r},!O&&(i=c["on"+e])?i(n):e===H&&N("Unhandled promise rejection",r)},Y=function(e){l(v,c,(function(){var t,r=e.facade,n=e.value;if(J(e)&&(t=E((function(){u?j.emit("unhandledRejection",n,r):Z(H,r,n)})),e.rejection=u||J(e)?2:1,t.error))throw t.value}))},J=function(e){return 1!==e.rejection&&!e.parent},X=function(e){l(v,c,(function(){var t=e.facade;u?j.emit("rejectionHandled",t):Z("rejectionhandled",t,e.value)}))},Q=function(e,t,r){return function(n){e(t,n,r)}},K=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,W(e,!0))},ee=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new q("Promise can't be resolved itself");var n=G(t);n?w((function(){var r={done:!1};try{l(n,t,Q(ee,r,e),Q(K,r,e))}catch(t){K(r,t,e)}})):(e.value=t,e.state=1,W(e,!1))}catch(t){K({done:!1},t,e)}}};if(F&&(R=(k=function(e){x(this,R),d(e),l(n,this);var t=_(this);try{e(Q(ee,t),Q(K,t))}catch(e){K(t,e)}}).prototype,(n=function(e){z(this,{type:D,done:!1,notified:!1,parent:!1,reactions:new A,rejection:!1,state:0,value:null})}).prototype=f(R,"then",(function(e,t){var r=_(this),n=U(b(this,k));return r.parent=!0,n.ok=!g(e)||e,n.fail=g(t)&&t,n.domain=u?j.domain:void 0,0===r.state?r.reactions.add(n):w((function(){V(n,r)})),n.promise})),i=function(){var e=new n,t=_(e);this.promise=e,this.resolve=Q(ee,t),this.reject=Q(K,t)},T.f=U=function(e){return e===k||void 0===e?new i(e):L(e)},!s&&g(M)&&I!==Object.prototype)){o=I.then,B||f(I,"then",(function(e,t){var r=this;return new k((function(e,t){l(o,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete I.constructor}catch(e){}p&&p(I,R)}a({global:!0,constructor:!0,wrap:!0,forced:F},{Promise:k}),m(k,D,!1,!0),h(D)},3362:(e,t,r)=>{"use strict";r(436),r(6499),r(2003),r(7743),r(1481),r(280)},7743:(e,t,r)=>{"use strict";var n=r(6518),i=r(9565),o=r(9306),a=r(6043),s=r(1103),u=r(2652);n({target:"Promise",stat:!0,forced:r(537)},{race:function(e){var t=this,r=a.f(t),n=r.reject,c=s((function(){var a=o(t.resolve);u(e,(function(e){i(a,t,e).then(r.resolve,n)}))}));return c.error&&n(c.value),r.promise}})},1481:(e,t,r)=>{"use strict";var n=r(6518),i=r(6043);n({target:"Promise",stat:!0,forced:r(916).CONSTRUCTOR},{reject:function(e){var t=i.f(this);return(0,t.reject)(e),t.promise}})},280:(e,t,r)=>{"use strict";var n=r(6518),i=r(7751),o=r(6395),a=r(550),s=r(916).CONSTRUCTOR,u=r(3438),c=i("Promise"),l=o&&!s;n({target:"Promise",stat:!0,forced:o||s},{resolve:function(e){return u(l&&this===c?a:this,e)}})},4864:(e,t,r)=>{"use strict";var n=r(3724),i=r(4576),o=r(9504),a=r(2796),s=r(3167),u=r(6699),c=r(2360),l=r(8480).f,f=r(1625),p=r(788),m=r(655),h=r(1034),d=r(8429),g=r(1056),y=r(6840),x=r(9039),b=r(9297),v=r(1181).enforce,w=r(7633),N=r(8227),E=r(3635),A=r(8814),S=N("match"),M=i.RegExp,C=M.prototype,T=i.SyntaxError,D=o(C.exec),F=o("".charAt),O=o("".replace),B=o("".indexOf),_=o("".slice),z=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,I=/a/g,k=/a/g,R=new M(I)!==I,q=d.MISSED_STICKY,P=d.UNSUPPORTED_Y;if(a("RegExp",n&&(!R||q||E||A||x((function(){return k[S]=!1,M(I)!==I||M(k)===k||"/a/i"!==String(M(I,"i"))}))))){for(var j=function(e,t){var r,n,i,o,a,l,d=f(C,this),g=p(e),y=void 0===t,x=[],w=e;if(!d&&g&&y&&e.constructor===j)return e;if((g||f(C,e))&&(e=e.source,y&&(t=h(w))),e=void 0===e?"":m(e),t=void 0===t?"":m(t),w=e,E&&"dotAll"in I&&(n=!!t&&B(t,"s")>-1)&&(t=O(t,/s/g,"")),r=t,q&&"sticky"in I&&(i=!!t&&B(t,"y")>-1)&&P&&(t=O(t,/y/g,"")),A&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a=c(null),s=!1,u=!1,l=0,f="";n<=r;n++){if("\\"===(t=F(e,n)))t+=F(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:if(i+=t,"?:"===_(e,n+1,n+3))continue;D(z,_(e,n+1))&&(n+=2,u=!0),l++;continue;case">"===t&&u:if(""===f||b(a,f))throw new T("Invalid capture group name");a[f]=!0,o[o.length]=[f,l],u=!1,f="";continue}u?f+=t:i+=t}return[i,o]}(e),e=o[0],x=o[1]),a=s(M(e,t),d?this:C,j),(n||i||x.length)&&(l=v(a),n&&(l.dotAll=!0,l.raw=j(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=F(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+F(e,++n);return i}(e),r)),i&&(l.sticky=!0),x.length&&(l.groups=x)),e!==w)try{u(a,"source",""===w?"(?:)":w)}catch(e){}return a},U=l(M),L=0;U.length>L;)g(j,M,U[L++]);C.constructor=j,j.prototype=C,y(i,"RegExp",j,{constructor:!0})}w("RegExp")},7465:(e,t,r)=>{"use strict";var n=r(3724),i=r(3635),o=r(2195),a=r(2106),s=r(1181).get,u=RegExp.prototype,c=TypeError;n&&i&&a(u,"dotAll",{configurable:!0,get:function(){if(this!==u){if("RegExp"===o(this))return!!s(this).dotAll;throw new c("Incompatible receiver, RegExp required")}}})},7495:(e,t,r)=>{"use strict";var n=r(6518),i=r(7323);n({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},5440:(e,t,r)=>{"use strict";var n=r(8745),i=r(9565),o=r(9504),a=r(9228),s=r(9039),u=r(8551),c=r(4901),l=r(4117),f=r(1291),p=r(8014),m=r(655),h=r(7750),d=r(7829),g=r(5966),y=r(2478),x=r(6682),b=r(8227)("replace"),v=Math.max,w=Math.min,N=o([].concat),E=o([].push),A=o("".indexOf),S=o("".slice),M="$0"==="a".replace(/./,"$0"),C=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(e,t,r){var o=C?"$":"$0";return[function(e,r){var n=h(this),o=l(e)?void 0:g(e,b);return o?i(o,e,n,r):i(t,m(n),e,r)},function(e,i){var a=u(this),s=m(e);if("string"==typeof i&&-1===A(i,o)&&-1===A(i,"$<")){var l=r(t,a,s,i);if(l.done)return l.value}var h=c(i);h||(i=m(i));var g,b=a.global;b&&(g=a.unicode,a.lastIndex=0);for(var M,C=[];null!==(M=x(a,s))&&(E(C,M),b);)""===m(M[0])&&(a.lastIndex=d(s,p(a.lastIndex),g));for(var T,D="",F=0,O=0;O<C.length;O++){for(var B,_=m((M=C[O])[0]),z=v(w(f(M.index),s.length),0),I=[],k=1;k<M.length;k++)E(I,void 0===(T=M[k])?T:String(T));var R=M.groups;if(h){var q=N([_],I,z,s);void 0!==R&&E(q,R),B=m(n(i,void 0,q))}else B=y(_,s,z,I,R,i);z>=F&&(D+=S(s,F,z)+B,F=z+_.length)}return D+S(s,F)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!M||C)},9463:(e,t,r)=>{"use strict";var n=r(6518),i=r(3724),o=r(4576),a=r(9504),s=r(9297),u=r(4901),c=r(1625),l=r(655),f=r(2106),p=r(7740),m=o.Symbol,h=m&&m.prototype;if(i&&u(m)&&(!("description"in h)||void 0!==m().description)){var d={},g=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:l(arguments[0]),t=c(h,this)?new m(e):void 0===e?m():m(e);return""===e&&(d[t]=!0),t};p(g,m),g.prototype=h,h.constructor=g;var y="Symbol(description detection)"===String(m("description detection")),x=a(h.valueOf),b=a(h.toString),v=/^Symbol\((.*)\)[^)]+$/,w=a("".replace),N=a("".slice);f(h,"description",{configurable:!0,get:function(){var e=x(this);if(s(d,e))return"";var t=b(e),r=y?N(t,7,-1):w(t,v,"$1");return""===r?void 0:r}}),n({global:!0,constructor:!0,forced:!0},{Symbol:g})}},8992:(e,t,r)=>{"use strict";r(8111)},3215:(e,t,r)=>{"use strict";r(1148)},4520:(e,t,r)=>{"use strict";r(2489)},2577:(e,t,r)=>{"use strict";r(116)},3949:(e,t,r)=>{"use strict";r(7588)},1454:(e,t,r)=>{"use strict";r(1701)},8872:(e,t,r)=>{"use strict";r(8237)},7550:(e,t,r)=>{"use strict";r(3579)},1795:(e,t,r)=>{"use strict";r(1806)},2369:function(e){e.exports=function(){"use strict";function e(){return!0}function t(){return!1}function r(){}const n="Argument is not a typed-function.";return function i(){function o(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const a=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],s={name:"any",test:e,isAny:!0};let u,c,l=0,f={createCount:0};function p(e){const t=u.get(e);if(t)return t;let r='Unknown type "'+e+'"';const n=e.toLowerCase();let i;for(i of c)if(i.toLowerCase()===n){r+='. Did you mean "'+i+'" ?';break}throw new TypeError(r)}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const r=t?p(t).index:c.length,n=[];for(let t=0;t<e.length;++t){if(!e[t]||"string"!=typeof e[t].name||"function"!=typeof e[t].test)throw new TypeError("Object with properties {name: string, test: function} expected");const i=e[t].name;if(u.has(i))throw new TypeError('Duplicate type name "'+i+'"');n.push(i),u.set(i,{name:i,test:e[t].test,isAny:e[t].isAny,index:r+t,conversionsTo:[]})}const i=c.slice(r);c=c.slice(0,r).concat(n).concat(i);for(let e=r+n.length;e<c.length;++e)u.get(c[e]).index=e}function h(){u=new Map,c=[],l=0,m([s],!1)}function d(e){const t=c.filter((t=>{const r=u.get(t);return!r.isAny&&r.test(e)}));return t.length?t:["any"]}function g(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function y(e,t,r){if(!g(e))throw new TypeError(n);const i=r&&r.exact,o=N(Array.isArray(t)?t.join(","):t),a=x(o);if(!i||a in e.signatures){const t=e._typedFunctionData.signatureMap.get(a);if(t)return t}const s=o.length;let u,c;if(i){let t;for(t in u=[],e.signatures)u.push(e._typedFunctionData.signatureMap.get(t))}else u=e._typedFunctionData.signatures;for(let e=0;e<s;++e){const t=o[e],r=[];let n;for(n of u){const i=M(n.params,e);if(i&&(!t.restParam||i.restParam)){if(!i.hasAny){const e=w(i);if(t.types.some((t=>!e.has(t.name))))continue}r.push(n)}}if(u=r,0===u.length)break}for(c of u)if(c.params.length<=s)return c;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+x(o,", ")+"))")}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(t)}function b(e){const t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map((e=>p(e.trim())));let n=!1,i=t?"...":"";return{types:r.map((function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}function v(e){const t=function(e){if(0===e.length)return[];const t=e.map(p);e.length>1&&t.sort(((e,t)=>e.index-t.index));let r=t[0].conversionsTo;if(1===e.length)return r;r=r.concat([]);const n=new Set(e);for(let e=1;e<t.length;++e){let i;for(i of t[e].conversionsTo)n.has(i.from)||(r.push(i),n.add(i.from))}return r}(e.types.map((e=>e.name)));let r=e.hasAny,n=e.name;const i=t.map((function(e){const t=p(e.from);return r=t.isAny||r,n+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:n,hasAny:r,hasConversion:i.length>0,restParam:e.restParam}}function w(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((t=>e.typeSet.add(t.name)))),e.typeSet}function N(e){const t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const r=e.trim();if(""===r)return t;const n=r.split(",");for(let e=0;e<n.length;++e){const r=b(n[e].trim());if(r.restParam&&e!==n.length-1)throw new SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===r.types.length)return null;t.push(r)}return t}function E(e){const t=H(e);return!!t&&t.restParam}function A(t){if(t&&0!==t.types.length){if(1===t.types.length)return p(t.types[0].name).test;if(2===t.types.length){const e=p(t.types[0].name).test,r=p(t.types[1].name).test;return function(t){return e(t)||r(t)}}{const e=t.types.map((function(e){return p(e.name).test}));return function(t){for(let r=0;r<e.length;r++)if(e[r](t))return!0;return!1}}}return e}function S(e){let t,r,n;if(E(e)){t=$(e).map(A);const r=t.length,n=A(H(e)),i=function(e){for(let t=r;t<e.length;t++)if(!n(e[t]))return!1;return!0};return function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return i(e)&&e.length>=r+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=A(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=A(e[0]),n=A(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(A),function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}function M(e,t){return t<e.length?e[t]:E(e)?H(e):null}function C(e,t){const r=M(e,t);return r?w(r):new Set}function T(e){return null===e.conversion||void 0===e.conversion}function D(e,t){const r=new Set;return e.forEach((e=>{const n=C(e.params,t);let i;for(i of n)r.add(i)})),r.has("any")?["any"]:Array.from(r)}function F(e,t,r){let n,i;const o=e||"unnamed";let a,s=r;for(a=0;a<t.length;a++){const e=[];if(s.forEach((r=>{const n=A(M(r.params,a));(a<r.params.length||E(r.params))&&n(t[a])&&e.push(r)})),0===e.length){if(i=D(s,a),i.length>0){const e=d(t[a]);return n=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+a+")"),n.data={category:"wrongType",fn:o,index:a,actual:e,expected:i},n}}else s=e}const u=s.map((function(e){return E(e.params)?1/0:e.params.length}));if(t.length<Math.min.apply(null,u))return i=D(s,a),n=new TypeError("Too few arguments in function "+o+" (expected: "+i.join(" or ")+", index: "+t.length+")"),n.data={category:"tooFewArgs",fn:o,index:t.length,expected:i},n;const c=Math.max.apply(null,u);if(t.length>c)return n=new TypeError("Too many arguments in function "+o+" (expected: "+c+", actual: "+t.length+")"),n.data={category:"tooManyArgs",fn:o,index:t.length,expectedLength:c},n;const l=[];for(let e=0;e<t.length;++e)l.push(d(t[e]).join("|"));return n=new TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+o+"."),n.data={category:"mismatch",actual:l},n}function O(e){let t=c.length+1;for(let r=0;r<e.types.length;r++)T(e.types[r])&&(t=Math.min(t,e.types[r].typeIndex));return t}function B(e){let t=l+1;for(let r=0;r<e.types.length;r++)T(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function _(e,t){if(e.hasAny){if(!t.hasAny)return 1}else if(t.hasAny)return-1;if(e.restParam){if(!t.restParam)return 1}else if(t.restParam)return-1;if(e.hasConversion){if(!t.hasConversion)return 1}else if(t.hasConversion)return-1;const r=O(e)-O(t);if(r<0)return-1;if(r>0)return 1;const n=B(e)-B(t);return n<0?-1:n>0?1:0}function z(e,t){const r=e.params,n=t.params,i=H(r),o=H(n),a=E(r),s=E(n);if(a&&i.hasAny){if(!s||!o.hasAny)return 1}else if(s&&o.hasAny)return-1;let u,c=0,l=0;for(u of r)u.hasAny&&++c,u.hasConversion&&++l;let f=0,p=0;for(u of n)u.hasAny&&++f,u.hasConversion&&++p;if(c!==f)return c-f;if(a&&i.hasConversion){if(!s||!o.hasConversion)return 1}else if(s&&o.hasConversion)return-1;if(l!==p)return l-p;if(a){if(!s)return 1}else if(s)return-1;const m=(r.length-n.length)*(a?-1:1);if(0!==m)return m;const h=[];let d,g=0;for(let e=0;e<r.length;++e){const t=_(r[e],n[e]);h.push(t),g+=t}if(0!==g)return g;for(d of h)if(0!==d)return d;return 0}function I(e,t){let r=t;if(e.some((e=>e.hasConversion))){const n=E(e),i=e.map(k);r=function(){const e=[],r=n?arguments.length-1:arguments.length;for(let t=0;t<r;t++)e[t]=i[t](arguments[t]);return n&&(e[r]=arguments[r].map(i[r])),t.apply(this,e)}}let n=r;if(E(e)){const t=e.length-1;n=function(){return r.apply(this,G(arguments,0,t).concat([G(arguments,t)]))}}return n}function k(e){let t,r,n,i;const o=[],a=[];switch(e.types.forEach((function(e){e.conversion&&(o.push(p(e.conversion.from).test),a.push(e.conversion.convert))})),a.length){case 0:return function(e){return e};case 1:return t=o[0],n=a[0],function(e){return t(e)?n(e):e};case 2:return t=o[0],r=o[1],n=a[0],i=a[1],function(e){return t(e)?n(e):r(e)?i(e):e};default:return function(e){for(let t=0;t<a.length;t++)if(o[t](e))return a[t](e);return e}}}function R(e){return function e(t,r,n){if(r<t.length){const a=t[r];let s=[];if(a.restParam){const e=a.types.filter(T);e.length<a.types.length&&s.push({types:e,name:"..."+e.map((e=>e.name)).join("|"),hasAny:e.some((e=>e.isAny)),hasConversion:!1,restParam:!0}),s.push(a)}else s=a.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return i=s,o=function(i){return e(t,r+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(o))}var i,o;return[n]}(e,0,[])}function q(e,t){const r=Math.max(e.length,t.length);for(let n=0;n<r;n++){const r=C(e,n),i=C(t,n);let o,a=!1;for(o of i)if(r.has(o)){a=!0;break}if(!a)return!1}const n=e.length,i=t.length,o=E(e),a=E(t);return o?a?n===i:i>=n:a?n>=i:n===i}function P(e,t,r){const n=[];let i;for(i of e){let e=r[i];if("number"!=typeof e)throw new TypeError('No definition for referenced signature "'+i+'"');if(e=t[e],"function"!=typeof e)return!1;n.push(e)}return n}function j(e,t,r){const n=function(e){return e.map((e=>Y(e)?W(e.referToSelf.callback):Z(e)?V(e.referTo.references,e.referTo.callback):e))}(e),i=new Array(n.length).fill(!1);let o=!0;for(;o;){o=!1;let e=!0;for(let a=0;a<n.length;++a){if(i[a])continue;const s=n[a];if(Y(s))n[a]=s.referToSelf.callback(r),n[a].referToSelf=s.referToSelf,i[a]=!0,e=!1;else if(Z(s)){const r=P(s.referTo.references,n,t);r?(n[a]=s.referTo.callback.apply(this,r),n[a].referTo=s.referTo,i[a]=!0,e=!1):o=!0}}if(e&&o)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return n}function U(e,n){if(f.createCount++,0===Object.keys(n).length)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&function(e){const t=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach((r=>{const n=e[r];if(t.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.")}))}(n);const i=[],o=[],a={},s=[];let u;for(u in n){if(!Object.prototype.hasOwnProperty.call(n,u))continue;const e=N(u);if(!e)continue;i.forEach((function(t){if(q(t,e))throw new TypeError('Conflicting signatures "'+x(t)+'" and "'+x(e)+'".')})),i.push(e);const t=o.length;o.push(n[u]);const r=e.map(v);let c;for(c of R(r)){const e=x(c);s.push({params:c,name:e,fn:t}),c.every((e=>!e.hasConversion))&&(a[e]=t)}}s.sort(z);const c=j(o,a,se);let l;for(l in a)Object.prototype.hasOwnProperty.call(a,l)&&(a[l]=c[a[l]]);const p=[],m=new Map;for(l of s)m.has(l.name)||(l.fn=c[l.fn],p.push(l),m.set(l.name,l));const h=p[0]&&p[0].params.length<=2&&!E(p[0].params),d=p[1]&&p[1].params.length<=2&&!E(p[1].params),g=p[2]&&p[2].params.length<=2&&!E(p[2].params),y=p[3]&&p[3].params.length<=2&&!E(p[3].params),b=p[4]&&p[4].params.length<=2&&!E(p[4].params),w=p[5]&&p[5].params.length<=2&&!E(p[5].params),M=h&&d&&g&&y&&b&&w;for(let e=0;e<p.length;++e)p[e].test=S(p[e].params);const C=h?A(p[0].params[0]):t,T=d?A(p[1].params[0]):t,D=g?A(p[2].params[0]):t,F=y?A(p[3].params[0]):t,O=b?A(p[4].params[0]):t,B=w?A(p[5].params[0]):t,_=h?A(p[0].params[1]):t,k=d?A(p[1].params[1]):t,P=g?A(p[2].params[1]):t,U=y?A(p[3].params[1]):t,L=b?A(p[4].params[1]):t,$=w?A(p[5].params[1]):t;for(let e=0;e<p.length;++e)p[e].implementation=I(p[e].params,p[e].fn);const H=h?p[0].implementation:r,G=d?p[1].implementation:r,V=g?p[2].implementation:r,W=y?p[3].implementation:r,Z=b?p[4].implementation:r,Y=w?p[5].implementation:r,J=h?p[0].params.length:-1,X=d?p[1].params.length:-1,Q=g?p[2].params.length:-1,K=y?p[3].params.length:-1,ee=b?p[4].params.length:-1,te=w?p[5].params.length:-1,re=M?6:0,ne=p.length,ie=p.map((e=>e.test)),oe=p.map((e=>e.implementation)),ae=function(){for(let e=re;e<ne;e++)if(ie[e](arguments))return oe[e].apply(this,arguments);return f.onMismatch(e,arguments,p)};function se(e,t){return arguments.length===J&&C(e)&&_(t)?H.apply(this,arguments):arguments.length===X&&T(e)&&k(t)?G.apply(this,arguments):arguments.length===Q&&D(e)&&P(t)?V.apply(this,arguments):arguments.length===K&&F(e)&&U(t)?W.apply(this,arguments):arguments.length===ee&&O(e)&&L(t)?Z.apply(this,arguments):arguments.length===te&&B(e)&&$(t)?Y.apply(this,arguments):ae.apply(this,arguments)}try{Object.defineProperty(se,"name",{value:e})}catch(e){}return se.signatures=a,se._typedFunctionData={signatures:p,signatureMap:m},se}function L(e,t,r){throw F(e,t,r)}function $(e){return G(e,0,e.length-1)}function H(e){return e[e.length-1]}function G(e,t,r){return Array.prototype.slice.call(e,t,r)}function V(e,t){return{referTo:{references:e,callback:t}}}function W(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function Z(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function Y(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function J(e,t){if(!e)return t;if(t&&t!==e){const r=new Error("Function names do not match (expected: "+e+", actual: "+t+")");throw r.data={actual:t,expected:e},r}return e}function X(e){let t;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(g(e[r])||"string"==typeof e[r].signature)&&(t=J(t,e[r].name));return t}function Q(e,t){let r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r in e&&t[r]!==e[r]){const n=new Error('Signature "'+r+'" is defined twice');throw n.data={signature:r,sourceFunction:t[r],destFunction:e[r]},n}e[r]=t[r]}}h(),m(a);const K=f;function ee(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw new SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return f=function(e){const t="string"==typeof e;let r=t?e:"";const n={};for(let e=t?1:0;e<arguments.length;++e){const i=arguments[e];let a,s={};if("function"==typeof i?(a=i.name,"string"==typeof i.signature?s[i.signature]=i:g(i)&&(s=i.signatures)):o(i)&&(s=i,t||(a=X(i))),0===Object.keys(s).length){const t=new TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:i},t}t||(r=J(r,a)),Q(n,s)}return U(r||"",n)},f.create=i,f.createCount=K.createCount,f.onMismatch=L,f.throwMismatchError=L,f.createError=F,f.clear=h,f.clearConversions=function(){let e;for(e of c)u.get(e).conversionsTo=[];l=0},f.addTypes=m,f._findType=p,f.referTo=function(){const e=$(arguments).map((e=>x(N(e)))),t=H(arguments);if("function"!=typeof t)throw new TypeError("Callback function expected as last argument");return V(e,t)},f.referToSelf=W,f.convert=function(e,t){const r=p(t);if(r.test(e))return e;const n=r.conversionsTo;if(0===n.length)throw new Error("There are no conversions to "+t+" defined.");for(let t=0;t<n.length;t++)if(p(n[t].from).test(e))return n[t].convert(e);throw new Error("Cannot convert "+e+" to "+t)},f.findSignature=y,f.find=function(e,t,r){return y(e,t,r).implementation},f.isTypedFunction=g,f.warnAgainstDeprecatedThis=!0,f.addType=function(e,t){let r="any";!1!==t&&u.has("Object")&&(r="Object"),f.addTypes([e],r)},f.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};ee(e);const r=p(e.to),n=r.conversionsTo.find((t=>t.from===e.from));if(n){if(!t||!t.override)throw new Error('There is already a conversion from "'+e.from+'" to "'+r.name+'"');f.removeConversion({from:n.from,to:e.to,convert:n.convert})}r.conversionsTo.push({from:e.from,convert:e.convert,index:l++})},f.addConversions=function(e,t){e.forEach((e=>f.addConversion(e,t)))},f.removeConversion=function(e){ee(e);const t=p(e.to),r=function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r]}(t.conversionsTo,(t=>t.from===e.from));if(!r)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(r.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");const n=t.conversionsTo.indexOf(r);t.conversionsTo.splice(n,1)},f.resolve=function(e,t){if(!g(e))throw new TypeError(n);const r=e._typedFunctionData.signatures;for(let e=0;e<r.length;++e)if(r[e].test(t))return r[e];return null},f}()}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.amdD=function(){throw new Error("define cannot be used indirect")},r.amdO={},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};return(()=>{"use strict";r.d(n,{default:()=>Gy});var e={};r.r(e),r.d(e,{createAbs:()=>xo,createAccessorNode:()=>vp,createAcos:()=>_l,createAcosh:()=>Ql,createAcot:()=>ef,createAcoth:()=>rf,createAcsc:()=>of,createAcsch:()=>sf,createAdd:()=>ip,createAddScalar:()=>Eo,createAnd:()=>Dc,createAndTransform:()=>Iy,createApply:()=>vo,createApplyTransform:()=>ay,createArg:()=>os,createArrayNode:()=>Np,createAsec:()=>cf,createAsech:()=>ff,createAsin:()=>mf,createAsinh:()=>hf,createAssignmentNode:()=>Dp,createAtan:()=>df,createAtan2:()=>yf,createAtanh:()=>bf,createAtomicMass:()=>Rg,createAvogadro:()=>qg,createBellNumbers:()=>pd,createBigNumberClass:()=>Or,createBigint:()=>Ti,createBignumber:()=>_i,createBin:()=>ju,createBitAnd:()=>Xa,createBitAndTransform:()=>Ry,createBitNot:()=>Ka,createBitOr:()=>ts,createBitOrTransform:()=>qy,createBitXor:()=>is,createBlockNode:()=>Op,createBohrMagneton:()=>yg,createBohrRadius:()=>Eg,createBoltzmann:()=>Pg,createBoolean:()=>Bi,createCatalan:()=>hd,createCbrt:()=>Co,createCeil:()=>zo,createChain:()=>Hm,createChainClass:()=>Rm,createClassicalElectronRadius:()=>Ag,createClone:()=>Zn,createColumn:()=>ws,createColumnTransform:()=>sy,createCombinations:()=>Dh,createCombinationsWithRep:()=>Bh,createCompare:()=>Oc,createCompareNatural:()=>Ic,createCompareText:()=>qc,createCompile:()=>lm,createComplex:()=>zi,createComplexClass:()=>jr,createComposition:()=>gd,createConcat:()=>bs,createConcatTransform:()=>Ey,createConditionalNode:()=>_p,createConductanceQuantum:()=>xg,createConj:()=>ss,createConstantNode:()=>Lp,createCorr:()=>Sh,createCos:()=>wf,createCosh:()=>Ef,createCot:()=>Af,createCoth:()=>Mf,createCoulomb:()=>dg,createCount:()=>Es,createCreateUnit:()=>Ol,createCross:()=>Ss,createCsc:()=>Cf,createCsch:()=>Df,createCtranspose:()=>xu,createCube:()=>ko,createCumSum:()=>ph,createCumSumTransform:()=>Fy,createDeepEqual:()=>nl,createDenseMatrixClass:()=>Vn,createDerivative:()=>Fd,createDet:()=>Gm,createDeuteronMass:()=>Fg,createDiag:()=>Cs,createDiff:()=>Hs,createDiffTransform:()=>Sy,createDistance:()=>uh,createDivide:()=>ah,createDivideScalar:()=>Qu,createDot:()=>cp,createDotDivide:()=>fc,createDotMultiply:()=>_a,createDotPow:()=>cc,createE:()=>Yd,createEfimovFactor:()=>kg,createEigs:()=>Ym,createElectricConstant:()=>mg,createElectronMass:()=>Sg,createElementaryCharge:()=>gg,createEqual:()=>jc,createEqualScalar:()=>Si,createEqualText:()=>$c,createErf:()=>Su,createEvaluate:()=>pm,createExp:()=>Ro,createExpm:()=>Xm,createExpm1:()=>Po,createFactorial:()=>Gh,createFalse:()=>$d,createFaraday:()=>jg,createFermiCoupling:()=>Mg,createFft:()=>wu,createFibonacciHeapClass:()=>gl,createFilter:()=>Ts,createFilterTransform:()=>py,createFineStructure:()=>Cg,createFirstRadiation:()=>Ug,createFix:()=>$o,createFlatten:()=>Os,createFloor:()=>Wo,createForEach:()=>_s,createForEachTransform:()=>my,createFormat:()=>Pu,createFraction:()=>Ii,createFractionClass:()=>Xr,createFreqz:()=>kd,createFunctionAssignmentNode:()=>Hp,createFunctionNode:()=>am,createGamma:()=>Uh,createGasConstant:()=>$g,createGcd:()=>ua,createGetMatrixDataType:()=>ks,createGravitationConstant:()=>cg,createGravity:()=>Qg,createHartreeEnergy:()=>Tg,createHasNumericValue:()=>hi,createHelp:()=>Lm,createHelpClass:()=>km,createHex:()=>Lu,createHypot:()=>ap,createI:()=>ng,createIdentity:()=>qs,createIfft:()=>Eu,createIm:()=>us,createImmutableDenseMatrixClass:()=>ml,createIndex:()=>pp,createIndexClass:()=>hl,createIndexNode:()=>Vp,createIndexTransform:()=>hy,createInfinity:()=>Gd,createIntersect:()=>ch,createInv:()=>Vm,createInverseConductanceQuantum:()=>bg,createInvmod:()=>Fa,createIsInteger:()=>ni,createIsNaN:()=>vi,createIsNegative:()=>li,createIsNumeric:()=>pi,createIsPositive:()=>gi,createIsPrime:()=>Yu,createIsZero:()=>xi,createKldivergence:()=>Wh,createKlitzing:()=>Ng,createKron:()=>js,createLN10:()=>Qd,createLN2:()=>Xd,createLOG10E:()=>eg,createLOG2E:()=>Kd,createLarger:()=>Xc,createLargerEq:()=>el,createLcm:()=>la,createLeafCount:()=>xd,createLeftShift:()=>Ac,createLgamma:()=>$h,createLog:()=>nc,createLog10:()=>pa,createLog1p:()=>oc,createLog2:()=>ha,createLoschmidt:()=>Lg,createLsolve:()=>hc,createLsolveAll:()=>xc,createLup:()=>gm,createLusolve:()=>_m,createLyap:()=>oh,createMad:()=>yh,createMagneticConstant:()=>pg,createMagneticFluxQuantum:()=>vg,createMap:()=>Ls,createMapTransform:()=>dy,createMatrix:()=>Ri,createMatrixClass:()=>Kr,createMatrixFromColumns:()=>$i,createMatrixFromFunction:()=>Pi,createMatrixFromRows:()=>Ui,createMax:()=>fl,createMaxTransform:()=>yy,createMean:()=>hh,createMeanTransform:()=>xy,createMedian:()=>gh,createMin:()=>pl,createMinTransform:()=>by,createMod:()=>ea,createMode:()=>zu,createMolarMass:()=>Jg,createMolarMassC12:()=>Xg,createMolarPlanckConstant:()=>Hg,createMolarVolume:()=>Gg,createMultinomial:()=>Yh,createMultiply:()=>ya,createMultiplyScalar:()=>da,createNaN:()=>Vd,createNeutronMass:()=>Og,createNode:()=>hp,createNorm:()=>up,createNot:()=>ds,createNthRoot:()=>ba,createNthRoots:()=>sc,createNuclearMagneton:()=>wg,createNull:()=>Hd,createNumber:()=>Ci,createNumeric:()=>Ju,createObjectNode:()=>Zp,createOct:()=>Uu,createOnes:()=>Gs,createOperatorNode:()=>Xp,createOr:()=>gs,createOrTransform:()=>ky,createParenthesisNode:()=>Kp,createParse:()=>um,createParser:()=>dm,createParserClass:()=>mm,createPartitionSelect:()=>ul,createPermutations:()=>Xh,createPhi:()=>Jd,createPi:()=>Wd,createPickRandom:()=>nd,createPinv:()=>Zm,createPlanckCharge:()=>ry,createPlanckConstant:()=>lg,createPlanckLength:()=>Kg,createPlanckMass:()=>ey,createPlanckTemperature:()=>ny,createPlanckTime:()=>ty,createPolynomialRoot:()=>Im,createPow:()=>Ku,createPrint:()=>Gu,createPrintTransform:()=>zy,createProd:()=>Ru,createProtonMass:()=>Dg,createQr:()=>ym,createQuantileSeq:()=>Nh,createQuantileSeqTransform:()=>Ty,createQuantumOfCirculation:()=>Bg,createRandom:()=>ad,createRandomInt:()=>ud,createRange:()=>Js,createRangeClass:()=>Qr,createRangeNode:()=>tm,createRangeTransform:()=>vy,createRationalize:()=>Bd,createRe:()=>cs,createReducedPlanckConstant:()=>fg,createRelationalNode:()=>nm,createReplacer:()=>qd,createReshape:()=>Qs,createResize:()=>Ks,createResolve:()=>Md,createResultSet:()=>We,createReviver:()=>Rd,createRightArithShift:()=>Mc,createRightLogShift:()=>Tc,createRotate:()=>tu,createRotationMatrix:()=>nu,createRound:()=>rc,createRow:()=>iu,createRowTransform:()=>wy,createRydberg:()=>_g,createSQRT1_2:()=>tg,createSQRT2:()=>rg,createSackurTetrode:()=>Vg,createSchur:()=>nh,createSec:()=>Ff,createSech:()=>Bf,createSecondRadiation:()=>Wg,createSetCartesian:()=>Pf,createSetDifference:()=>Uf,createSetDistinct:()=>$f,createSetIntersect:()=>Gf,createSetIsSubset:()=>Wf,createSetMultiplicity:()=>Yf,createSetPowerset:()=>Xf,createSetSize:()=>Kf,createSetSymDifference:()=>tp,createSetUnion:()=>np,createSign:()=>wa,createSimplify:()=>Nd,createSimplifyConstant:()=>Ed,createSimplifyCore:()=>Sd,createSin:()=>_f,createSinh:()=>If,createSize:()=>au,createSlu:()=>Fm,createSmaller:()=>Gc,createSmallerEq:()=>Zc,createSolveODE:()=>Au,createSort:()=>ll,createSpaClass:()=>yl,createSparse:()=>Dl,createSparseMatrixClass:()=>Mi,createSpeedOfLight:()=>ug,createSplitUnit:()=>Gi,createSqrt:()=>Na,createSqrtm:()=>Km,createSquare:()=>Aa,createSqueeze:()=>uu,createStd:()=>Eh,createStdTransform:()=>My,createStefanBoltzmann:()=>Zg,createStirlingS2:()=>ld,createString:()=>Fi,createSubset:()=>lu,createSubsetTransform:()=>Ny,createSubtract:()=>Ma,createSubtractScalar:()=>So,createSum:()=>lh,createSumTransform:()=>Cy,createSylvester:()=>th,createSymbolNode:()=>im,createSymbolicEqual:()=>Td,createTan:()=>kf,createTanh:()=>Rf,createTau:()=>Zd,createThomsonCrossSection:()=>zg,createTo:()=>Wu,createTrace:()=>lp,createTranspose:()=>gu,createTrue:()=>Ld,createTypeOf:()=>Ni,createTyped:()=>$e,createUnaryMinus:()=>ho,createUnaryPlus:()=>yo,createUnequal:()=>ol,createUnitClass:()=>Sl,createUnitFunction:()=>Cl,createUppercaseE:()=>og,createUppercasePi:()=>ig,createUsolve:()=>gc,createUsolveAll:()=>vc,createVacuumImpedance:()=>hg,createVariance:()=>vh,createVarianceTransform:()=>By,createVersion:()=>ag,createWeakMixingAngle:()=>Ig,createWienDisplacement:()=>Yg,createXgcd:()=>Ta,createXor:()=>ys,createZeros:()=>vu,createZeta:()=>Bu,createZpk2tf:()=>zd}),r(4423),r(7495),r(8992),r(7550);var t=r(2369);function i(e,t){if(a(e,t))return e[t];if("function"==typeof e[t]&&s(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function o(e,t,r){if(a(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function a(e,t){return!(!function(e){return"object"==typeof e&&e&&e.constructor===Object}(e)&&!Array.isArray(e)||!me(u,t)&&(t in Object.prototype||t in Function.prototype))}function s(e,t){return!(null==e||"function"!=typeof e[t]||me(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)||!me(c,t)&&(t in Object.prototype||t in Function.prototype))}r(6910),r(3215),r(4520),r(3949),r(1454),r(4864),r(7465);const u={length:!0,name:!0},c={toString:!0,valueOf:!0,toLocaleString:!0};class l{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter((e=>this.has(e))).values()}get(e){return i(this.wrappedObject,e)}set(e,t){return o(this.wrappedObject,e,t),this}has(e){return a(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){a(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(const e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class f{constructor(e,t,r){this.a=e,this.b=t,this.bKeys=r,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function p(e,t){return{next:()=>{const r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}function m(){return new Map}function h(e){if(!e)return m();if(k(e))return e;if(I(e))return new l(e);throw new Error("createMap can create maps from objects or Maps")}function d(e){return"number"==typeof e}function g(e){return!(!e||"object"!=typeof e||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function y(e){return"bigint"==typeof e}function x(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function b(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function v(e){return e&&!0===e.constructor.prototype.isUnit||!1}function w(e){return"string"==typeof e}const N=Array.isArray;function E(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function A(e){return Array.isArray(e)||E(e)}function S(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function M(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function C(e){return e&&!0===e.constructor.prototype.isRange||!1}function T(e){return e&&!0===e.constructor.prototype.isIndex||!1}function D(e){return"boolean"==typeof e}function F(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function O(e){return e&&!0===e.constructor.prototype.isHelp||!1}function B(e){return"function"==typeof e}function _(e){return e instanceof Date}function z(e){return e instanceof RegExp}function I(e){return!(!e||"object"!=typeof e||e.constructor!==Object||x(e)||b(e))}function k(e){return!!e&&(e instanceof Map||e instanceof l||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function R(e){return k(e)&&k(e.a)&&k(e.b)}function q(e){return k(e)&&I(e.wrappedObject)}function P(e){return null===e}function j(e){return void 0===e}function U(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function G(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function V(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function W(e){return V(e)||K(e)&&1===e.args.length&&V(e.args[0])&&"-+~".includes(e.op)}function Z(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function Y(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function J(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function X(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function Q(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function K(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ee(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function te(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function re(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function ne(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function ie(e){return e&&!0===e.constructor.prototype.isChain||!1}function oe(e){const t=typeof e;return"object"===t?null===e?"null":g(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function ae(e){const t=typeof e;if("number"===t||"bigint"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return ae(e)}));if(e instanceof Date)return new Date(e.valueOf());if(g(e))return e;if(I(e))return function(e,t){const r={};for(const n in e)me(e,n)&&(r[n]=t(e[n]));return r}(e,ae);throw new TypeError(`Cannot clone: unknown type of value (value: ${e})`)}function se(e,t){for(const r in t)me(t,r)&&(e[r]=t[r]);return e}function ue(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(const r in t)if(me(t,r)&&!(r in Object.prototype)&&!(r in Function.prototype))if(t[r]&&t[r].constructor===Object)void 0===e[r]&&(e[r]={}),e[r]&&e[r].constructor===Object?ue(e[r],t[r]):e[r]=t[r];else{if(Array.isArray(t[r]))throw new TypeError("Arrays are not supported by deepExtend");e[r]=t[r]}return e}function ce(e,t){let r,n,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!ce(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!ce(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}return e===t}function le(e){const t={};return fe(e,t),t}function fe(e,t){for(const r in e)if(me(e,r)){const n=e[r];"object"==typeof n&&null!==n?fe(n,t):t[r]=n}}function pe(e,t,r){let n,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(n=r(),i=!1),n},set:function(e){n=e,i=!1},configurable:!0,enumerable:!0})}function me(e,t){return e&&Object.hasOwnProperty.call(e,t)}function he(e,t,r,n){function i(n){const i=function(e,t){const r={};for(let n=0;n<t.length;n++){const i=t[n],o=e[i];void 0!==o&&(r[i]=o)}return r}(n,t.map(ge));return function(e,t,r){if(!t.filter((e=>!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==r[e]))){const n=t.filter((e=>void 0===r[e]));throw new Error(`Cannot create function "${e}", some dependencies are missing: ${n.map((e=>`"${e}"`)).join(", ")}.`)}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function de(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function ge(e){return e&&"?"===e[0]?e.slice(1):e}function ye(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function xe(e,t){return"bigint"!==t.number||/^-?\d+$/.test(e)?t.number:t.numberFallback}r(5440);const be=Math.sign||function(e){return e>0?1:e<0?-1:0},ve=Math.log2||function(e){return Math.log(e)/Math.LN2},we=Math.log10||function(e){return Math.log(e)/Math.LN10},Ne=Math.log1p||function(e){return Math.log(e+1)},Ee=Math.cbrt||function(e){if(0===e)return e;const t=e<0;let r;return t&&(e=-e),isFinite(e)?(r=Math.exp(Math.log(e)/3),r=(e/(r*r)+2*r)/3):r=e,t?-r:r},Ae=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Se(e,t,r){const n={2:"0b",8:"0o",16:"0x"}[t];let i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!ye(r))throw new Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw new Error(`Value must be in range [-2^${r-1}, 2^${r-1}-1]`);if(!ye(e))throw new Error("Value must be an integer");e<0&&(e+=2**r),i=`i${r}`}let o="";return e<0&&(e=-e,o="-"),`${o}${n}${e.toString(t)}${i}`}function Me(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";const{notation:r,precision:n,wordSize:i}=Ce(t);switch(r){case"fixed":return De(e,n);case"exponential":return Fe(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);const r=Oe(Te(e),t),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(d(t))for(;t>i.length||n-o+1>i.length;)i.push(0);else{const e=Math.abs(n-o)-(i.length-1);for(let t=0;t<e;t++)i.push(0)}let a=Math.abs(n-o),s=1;for(;a>0;)s++,a--;const u=i.slice(s).join(""),c=d(t)&&u.length||u.match(/[1-9]/)?"."+u:"",l=i.slice(0,s).join("")+c+"e"+(n>=0?"+":"")+o.toString();return r.sign+l}(e,n);case"bin":return Se(e,2,i);case"oct":return Se(e,8,i);case"hex":return Se(e,16,i);case"auto":return function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);const n=Ue(null==r?void 0:r.lowerExp,-3),i=Ue(null==r?void 0:r.upperExp,5),o=Te(e),a=t?Oe(o,t):o;if(a.exponent<n||a.exponent>=i)return Fe(e,t);{let e=a.coefficients;const r=a.exponent;e.length<t&&(e=e.concat(Be(t-e.length))),e=e.concat(Be(r-e.length+1+(e.length<t?t-e.length:0))),e=Be(-r).concat(e);const n=r>0?r:0;return n<e.length-1&&e.splice(n+1,0,"."),a.sign+e.join("")}}(e,n,t).replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}));default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ce(e){let t,r,n="auto";if(void 0!==e)if(d(e))t=e;else if(g(e))t=e.toNumber();else{if(!I(e))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==e.precision&&(t=je(e.precision,(()=>{throw new Error('Option "precision" must be a number or BigNumber')}))),void 0!==e.wordSize&&(r=je(e.wordSize,(()=>{throw new Error('Option "wordSize" must be a number or BigNumber')}))),e.notation&&(n=e.notation)}return{notation:n,precision:t,wordSize:r}}function Te(e){const t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);const r=t[1],n=t[2];let i=parseFloat(t[4]||"0");const o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;const a=n.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===a.length&&(a.push(0),i++),{sign:r,coefficients:a,exponent:i}}function De(e,t){if(isNaN(e)||!isFinite(e))return String(e);const r=Te(e),n="number"==typeof t?Oe(r,r.exponent+1+t):r;let i=n.coefficients,o=n.exponent+1;const a=o+(t||0);return i.length<a&&(i=i.concat(Be(a-i.length))),o<0&&(i=Be(1-o).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}function Fe(e,t){if(isNaN(e)||!isFinite(e))return String(e);const r=Te(e),n=t?Oe(r,t):r;let i=n.coefficients;const o=n.exponent;i.length<t&&(i=i.concat(Be(t-i.length)));const a=i.shift();return n.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Oe(e,t){const r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;for(;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){let e=t-1;for(n[e]++;10===n[e];)n.pop(),0===e&&(n.unshift(0),r.exponent++,e++),e--,n[e]++}return r}function Be(e){const t=[];for(let r=0;r<e;r++)t.push(0);return t}function _e(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-8,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return!isNaN(e)&&!isNaN(t)&&(isFinite(e)&&isFinite(t)?e===t||Math.abs(e-t)<=Math.max(r*Math.max(Math.abs(e),Math.abs(t)),n):e===t)}Number.EPSILON;const ze=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},Ie=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},ke=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Re=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},qe=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Pe=Math.tanh||function(e){const t=Math.exp(2*e);return(t-1)/(t+1)};function je(e,t){return d(e)?e:g(e)?e.toNumber():void t()}function Ue(e,t){return d(e)?e:g(e)?e.toNumber():t}let Le=function(){return Le=t.create,t};const $e=he("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){let{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e;const o=Le();return o.clear(),o.addTypes([{name:"number",test:d},{name:"Complex",test:x},{name:"BigNumber",test:g},{name:"bigint",test:y},{name:"Fraction",test:b},{name:"Unit",test:v},{name:"identifier",test:e=>w&&/^[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}][0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}]*$/u.test(e)},{name:"string",test:w},{name:"Chain",test:ie},{name:"Array",test:N},{name:"Matrix",test:E},{name:"DenseMatrix",test:S},{name:"SparseMatrix",test:M},{name:"Range",test:C},{name:"Index",test:T},{name:"boolean",test:D},{name:"ResultSet",test:F},{name:"Help",test:O},{name:"function",test:B},{name:"Date",test:_},{name:"RegExp",test:z},{name:"null",test:P},{name:"undefined",test:j},{name:"AccessorNode",test:U},{name:"ArrayNode",test:L},{name:"AssignmentNode",test:$},{name:"BlockNode",test:H},{name:"ConditionalNode",test:G},{name:"ConstantNode",test:V},{name:"FunctionNode",test:Y},{name:"FunctionAssignmentNode",test:Z},{name:"IndexNode",test:J},{name:"Node",test:X},{name:"ObjectNode",test:Q},{name:"OperatorNode",test:K},{name:"ParenthesisNode",test:ee},{name:"RangeNode",test:te},{name:"RelationalNode",test:re},{name:"SymbolNode",test:ne},{name:"Map",test:k},{name:"Object",test:I}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||He(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||Ge(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||Ge(e),new r(e.toNumber(),0)}},{from:"bigint",to:"number",convert:function(e){if(e>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+e+")");return Number(e)}},{from:"bigint",to:"BigNumber",convert:function(e){return t||He(e),new t(e.toString())}},{from:"bigint",to:"Fraction",convert:function(e){return i||Ve(e),new i(e.toString())}},{from:"Fraction",to:"BigNumber",convert:function(e){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||Ge(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||Ve(e);const t=new i(e);if(t.valueOf()!==e)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){const t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||He(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(e){try{return BigInt(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(e){i||Ve(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||Ge(e);try{return new r(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||He(e),new t(+e)}},{from:"boolean",to:"bigint",convert:function(e){return BigInt(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||Ve(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return 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()}}]),o.onMismatch=(e,t,r)=>{const n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&A(t[0])&&r.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=n.data,t}throw n},o.onMismatch=(e,t,r)=>{const n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&A(t[0])&&r.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=n.data,t}throw n},o}));function He(e){throw new Error(`Cannot convert value ${e} into a BigNumber: no class 'BigNumber' provided`)}function Ge(e){throw new Error(`Cannot convert value ${e} into a Complex number: no class 'Complex' provided`)}function Ve(e){throw new Error(`Cannot convert value ${e} into a Fraction, no class 'Fraction' provided.`)}const We=he("ResultSet",[],(()=>{function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e}),{isClass:!0});var Ze,Ye,Je=9e15,Xe=1e9,Qe="0123456789abcdef",Ke="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",et="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",tt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Je,maxE:Je,crypto:!1},rt=!0,nt="[DecimalError] ",it=nt+"Invalid argument: ",ot=nt+"Precision limit exceeded",at=nt+"crypto unavailable",st="[object Decimal]",ut=Math.floor,ct=Math.pow,lt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ft=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,pt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,mt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ht=1e7,dt=Ke.length-1,gt=et.length-1,yt={toStringTag:st};function xt(e){var t,r,n,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(o+=Dt(r)),o+=n;(r=7-(n=(a=e[t])+"").length)&&(o+=Dt(r))}else if(0===a)return"0";for(;a%10==0;)a/=10;return o+a}function bt(e,t,r){if(e!==~~e||e<t||e>r)throw Error(it+e)}function vt(e,t,r,n){var i,o,a,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=ct(10,7-t),s=e[i]%o|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),a=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):a=(r<4&&s+1==o||r>3&&s+1==o/2)&&(e[i+1]/o/100|0)==ct(10,t-2)-1||(s==o/2||0==s)&&!(e[i+1]/o/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),a=(n||r<4)&&9999==s||!n&&r>3&&4999==s):a=((n||r<4)&&s+1==o||!n&&r>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==ct(10,t-3)-1,a}function wt(e,t,r){for(var n,i,o=[0],a=0,s=e.length;a<s;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=Qe.indexOf(e.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}yt.absoluteValue=yt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Et(e)},yt.ceil=function(){return Et(new this.constructor(this),this.e+1,2)},yt.clampedTo=yt.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(it+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},yt.comparedTo=yt.cmp=function(e){var t,r,n,i,o=this,a=o.d,s=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!a||!s)return u&&c?u!==c?u:a===s?0:!a^u<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^u<0?1:-1;for(t=0,r=(n=a.length)<(i=s.length)?n:i;t<r;++t)if(a[t]!==s[t])return a[t]>s[t]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},yt.cosine=yt.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/Pt(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=qt(e,1,t.times(i),new e(1));for(var o=r;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=r,t}(n,jt(n,r)),n.precision=e,n.rounding=t,Et(2==Ye||3==Ye?r.neg():r,e,t,!0)):new n(1):new n(NaN)},yt.cubeRoot=yt.cbrt=function(){var e,t,r,n,i,o,a,s,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(rt=!1,(o=l.s*ct(l.s*l,1/3))&&Math.abs(o)!=1/0?n=new f(o.toString()):(r=xt(l.d),(o=((e=l.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=ct(r,1/3),e=ut((e+1)/3)-(e%3==(e<0?-1:2)),(n=new f(r=o==1/0?"5e"+e:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=l.s),a=(e=f.precision)+3;;)if(c=(u=(s=n).times(s).times(s)).plus(l),n=Nt(c.plus(l).times(s),c.plus(u),a+2,1),xt(s.d).slice(0,a)===(r=xt(n.d)).slice(0,a)){if("9999"!=(r=r.slice(a-3,a+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(Et(n,e+1,1),t=!n.times(n).times(n).eq(l));break}if(!i&&(Et(s,e+1,0),s.times(s).times(s).eq(l))){n=s;break}a+=4,i=1}return rt=!0,Et(n,e,f.rounding,t)},yt.decimalPlaces=yt.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=7*((e=t.length-1)-ut(this.e/7)),e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},yt.dividedBy=yt.div=function(e){return Nt(this,new this.constructor(e))},yt.dividedToIntegerBy=yt.divToInt=function(e){var t=this.constructor;return Et(Nt(this,new t(e),0,1,1),t.precision,t.rounding)},yt.equals=yt.eq=function(e){return 0===this.cmp(e)},yt.floor=function(){return Et(new this.constructor(this),this.e+1,3)},yt.greaterThan=yt.gt=function(e){return this.cmp(e)>0},yt.greaterThanOrEqualTo=yt.gte=function(e){var t=this.cmp(e);return 1==t||0===t},yt.hyperbolicCosine=yt.cosh=function(){var e,t,r,n,i,o=this,a=o.constructor,s=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return s;r=a.precision,n=a.rounding,a.precision=r+Math.max(o.e,o.sd())+4,a.rounding=1,(i=o.d.length)<32?t=(1/Pt(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=qt(a,1,o.times(t),new a(1),!0);for(var u,c=e,l=new a(8);c--;)u=o.times(o),o=s.minus(u.times(l.minus(u.times(l))));return Et(o,a.precision=r,a.rounding=n,!0)},yt.hyperbolicSine=yt.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=qt(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=qt(o,2,i=i.times(1/Pt(5,e)),i,!0);for(var a,s=new o(5),u=new o(16),c=new o(20);e--;)a=i.times(i),i=i.times(s.plus(a.times(u.times(a).plus(c))))}return o.precision=t,o.rounding=r,Et(i,t,r,!0)},yt.hyperbolicTangent=yt.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Nt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},yt.inverseCosine=yt.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,o=r.rounding;return-1!==n?0===n?t.isNeg()?Ct(r,i,o):new r(0):new r(NaN):t.isZero()?Ct(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Ct(r,i+4,o).times(.5),r.precision=i,r.rounding=o,e.minus(t))},yt.inverseHyperbolicCosine=yt.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,rt=!1,r=r.times(r).minus(1).sqrt().plus(r),rt=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},yt.inverseHyperbolicSine=yt.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,rt=!1,r=r.times(r).plus(1).sqrt().plus(r),rt=!0,n.precision=e,n.rounding=t,r.ln())},yt.inverseHyperbolicTangent=yt.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Et(new o(i),e,t,!0):(o.precision=r=n-i.e,i=Nt(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},yt.inverseSine=yt.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==t?0===t?((e=Ct(o,r+4,n).times(.5)).s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))},yt.inverseTangent=yt.atan=function(){var e,t,r,n,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=gt)return(a=Ct(l,f+4,p).times(.25)).s=c.s,a}else{if(!c.s)return new l(NaN);if(f+4<=gt)return(a=Ct(l,f+4,p).times(.5)).s=c.s,a}for(l.precision=s=f+10,l.rounding=1,e=r=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(rt=!1,t=Math.ceil(s/7),n=1,u=c.times(c),a=new l(c),i=c;-1!==e;)if(i=i.times(u),o=a.minus(i.div(n+=2)),i=i.times(u),void 0!==(a=o.plus(i.div(n+=2))).d[t])for(e=t;a.d[e]===o.d[e]&&e--;);return r&&(a=a.times(2<<r-1)),rt=!0,Et(a,l.precision=f,l.rounding=p,!0)},yt.isFinite=function(){return!!this.d},yt.isInteger=yt.isInt=function(){return!!this.d&&ut(this.e/7)>this.d.length-2},yt.isNaN=function(){return!this.s},yt.isNegative=yt.isNeg=function(){return this.s<0},yt.isPositive=yt.isPos=function(){return this.s>0},yt.isZero=function(){return!!this.d&&0===this.d[0]},yt.lessThan=yt.lt=function(e){return this.cmp(e)<0},yt.lessThanOrEqualTo=yt.lte=function(e){return this.cmp(e)<1},yt.logarithm=yt.log=function(e){var t,r,n,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(null==e)e=new l(10),t=!0;else{if(r=(e=new l(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new l(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10==0;)i/=10;o=1!==i}if(rt=!1,a=zt(c,s=f+5),n=t?Mt(l,s+10):zt(e,s),vt((u=Nt(a,n,s,1)).d,i=f,p))do{if(a=zt(c,s+=10),n=t?Mt(l,s+10):zt(e,s),u=Nt(a,n,s,1),!o){+xt(u.d).slice(i+1,i+15)+1==1e14&&(u=Et(u,f+1,0));break}}while(vt(u.d,i+=10,p));return rt=!0,Et(u,f,p)},yt.minus=yt.sub=function(e){var t,r,n,i,o,a,s,u,c,l,f,p,m=this,h=m.constructor;if(e=new h(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new h(e.d||m.s!==e.s?m:NaN):e=new h(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,s=h.precision,u=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(m)}return rt?Et(e,s,u):e}if(r=ut(e.e/7),l=ut(m.e/7),c=c.slice(),o=l-r){for((f=o<0)?(t=c,o=-o,a=p.length):(t=p,r=l,a=c.length),o>(n=Math.max(Math.ceil(s/7),a)+2)&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(a=p.length))&&(a=n),n=0;n<a;n++)if(c[n]!=p[n]){f=c[n]<p[n];break}o=0}for(f&&(t=c,c=p,p=t,e.s=-e.s),a=c.length,n=p.length-a;n>0;--n)c[a++]=0;for(n=p.length;n>o;){if(c[--n]<p[n]){for(i=n;i&&0===c[--i];)c[i]=ht-1;--c[i],c[n]+=ht}c[n]-=p[n]}for(;0===c[--a];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=St(c,r),rt?Et(e,s,u):e):new h(3===u?-0:0)},yt.modulo=yt.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Et(new n(r),n.precision,n.rounding):(rt=!1,9==n.modulo?(t=Nt(r,e.abs(),0,3,1)).s*=e.s:t=Nt(r,e,0,n.modulo,1),t=t.times(e),rt=!0,r.minus(t))},yt.naturalExponential=yt.exp=function(){return _t(this)},yt.naturalLogarithm=yt.ln=function(){return zt(this)},yt.negated=yt.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Et(e)},yt.plus=yt.add=function(e){var t,r,n,i,o,a,s,u,c,l,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new p(e.d||f.s===e.s?f:NaN)):e=new p(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,s=p.precision,u=p.rounding,!c[0]||!l[0])return l[0]||(e=new p(f)),rt?Et(e,s,u):e;if(o=ut(f.e/7),n=ut(e.e/7),c=c.slice(),i=o-n){for(i<0?(r=c,i=-i,a=l.length):(r=l,n=o,a=c.length),i>(a=(o=Math.ceil(s/7))>a?o+1:a+1)&&(i=a,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((a=c.length)-(i=l.length)<0&&(i=a,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/ht|0,c[i]%=ht;for(t&&(c.unshift(t),++n),a=c.length;0==c[--a];)c.pop();return e.d=c,e.e=St(c,n),rt?Et(e,s,u):e},yt.precision=yt.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(it+e);return r.d?(t=Tt(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},yt.round=function(){var e=this,t=e.constructor;return Et(new t(e),e.e+1,t.rounding)},yt.sine=yt.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:qt(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=qt(e,2,t=t.times(1/Pt(5,r)),t);for(var i,o=new e(5),a=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(s))));return t}(n,jt(n,r)),n.precision=e,n.rounding=t,Et(Ye>2?r.neg():r,e,t,!0)):new n(NaN)},yt.squareRoot=yt.sqrt=function(){var e,t,r,n,i,o,a=this,s=a.d,u=a.e,c=a.s,l=a.constructor;if(1!==c||!s||!s[0])return new l(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);for(rt=!1,0==(c=Math.sqrt(+a))||c==1/0?(((t=xt(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=ut((u+1)/2)-(u<0||u%2),n=new l(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new l(c.toString()),r=(u=l.precision)+3;;)if(n=(o=n).plus(Nt(a,o,r+2,1)).times(.5),xt(o.d).slice(0,r)===(t=xt(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Et(n,u+1,1),e=!n.times(n).eq(a));break}if(!i&&(Et(o,u+1,0),o.times(o).eq(a))){n=o;break}r+=4,i=1}return rt=!0,Et(n,u,l.rounding,e)},yt.tangent=yt.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=Nt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Et(2==Ye||4==Ye?r.neg():r,e,t,!0)):new n(NaN)},yt.times=yt.mul=function(e){var t,r,n,i,o,a,s,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(r=ut(l.e/7)+ut(e.e/7),(u=p.length)<(c=m.length)&&(o=p,p=m,m=o,a=u,u=c,c=a),o=[],n=a=u+c;n--;)o.push(0);for(n=c;--n>=0;){for(t=0,i=u+n;i>n;)s=o[i]+m[n]*p[i-n-1]+t,o[i--]=s%ht|0,t=s/ht|0;o[i]=(o[i]+t)%ht|0}for(;!o[--a];)o.pop();return t?++r:o.shift(),e.d=o,e.e=St(o,r),rt?Et(e,f.precision,f.rounding):e},yt.toBinary=function(e,t){return Ut(this,2,e,t)},yt.toDecimalPlaces=yt.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(bt(e,0,Xe),void 0===t?t=n.rounding:bt(t,0,8),Et(r,e+r.e+1,t))},yt.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=At(n,!0):(bt(e,0,Xe),void 0===t?t=i.rounding:bt(t,0,8),r=At(n=Et(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},yt.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return void 0===e?r=At(i):(bt(e,0,Xe),void 0===t?t=o.rounding:bt(t,0,8),r=At(n=Et(new o(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},yt.toFraction=function(e){var t,r,n,i,o,a,s,u,c,l,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=r=new d(1),n=u=new d(0),a=(o=(t=new d(n)).e=Tt(h)-m.e-1)%7,t.d[0]=ct(10,a<0?7+a:a),null==e)e=o>0?t:c;else{if(!(s=new d(e)).isInt()||s.lt(c))throw Error(it+s);e=s.gt(t)?o>0?t:c:s}for(rt=!1,s=new d(xt(h)),l=d.precision,d.precision=o=7*h.length*2;f=Nt(s,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=s.minus(f.times(i)),s=i;return i=Nt(e.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=m.s,p=Nt(c,n,o,1).minus(m).abs().cmp(Nt(u,r,o,1).minus(m).abs())<1?[c,n]:[u,r],d.precision=l,rt=!0,p},yt.toHexadecimal=yt.toHex=function(e,t){return Ut(this,16,e,t)},yt.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:bt(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(rt=!1,r=Nt(r,e,0,t,1).times(e),rt=!0,Et(r)):(e.s=r.s,r=e),r},yt.toNumber=function(){return+this},yt.toOctal=function(e,t){return Ut(this,8,e,t)},yt.toPower=yt.pow=function(e){var t,r,n,i,o,a,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(ct(+s,c));if((s=new u(s)).eq(1))return s;if(n=u.precision,o=u.rounding,e.eq(1))return Et(s,n,o);if((t=ut(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=Ft(u,s,r,n),e.s<0?new u(1).div(i):Et(i,n,o);if((a=s.s)<0){if(t<e.d.length-1)return new u(NaN);if(1&e.d[t]||(a=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=a,s}return(t=0!=(r=ct(+s,c))&&isFinite(r)?new u(r+"").e:ut(c*(Math.log("0."+xt(s.d))/Math.LN10+s.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?a/0:0):(rt=!1,u.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=_t(e.times(zt(s,n+r)),n)).d&&vt((i=Et(i,n+5,1)).d,n,o)&&(t=n+10,+xt((i=Et(_t(e.times(zt(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=Et(i,n+1,0))),i.s=a,rt=!0,u.rounding=o,Et(i,n,o))},yt.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=At(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(bt(e,1,Xe),void 0===t?t=i.rounding:bt(t,0,8),r=At(n=Et(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},yt.toSignificantDigits=yt.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(bt(e,1,Xe),void 0===t?t=r.rounding:bt(t,0,8)),Et(new r(this),e,t)},yt.toString=function(){var e=this,t=e.constructor,r=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},yt.truncated=yt.trunc=function(){return Et(new this.constructor(this),this.e+1,1)},yt.valueOf=yt.toJSON=function(){var e=this,t=e.constructor,r=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var Nt=function(){function e(e,t,r){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*t+i,e[o]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,a,s,u){var c,l,f,p,m,h,d,g,y,x,b,v,w,N,E,A,S,M,C,T,D=n.constructor,F=n.s==i.s?1:-1,O=n.d,B=i.d;if(!(O&&O[0]&&B&&B[0]))return new D(n.s&&i.s&&(O?!B||O[0]!=B[0]:B)?O&&0==O[0]||!B?0*F:F/0:NaN);for(u?(m=1,l=n.e-i.e):(u=ht,m=7,l=ut(n.e/m)-ut(i.e/m)),C=B.length,S=O.length,x=(y=new D(F)).d=[],f=0;B[f]==(O[f]||0);f++);if(B[f]>(O[f]||0)&&l--,null==o?(N=o=D.precision,a=D.rounding):N=s?o+(n.e-i.e)+1:o,N<0)x.push(1),h=!0;else{if(N=N/m+2|0,f=0,1==C){for(p=0,B=B[0],N++;(f<S||p)&&N--;f++)E=p*u+(O[f]||0),x[f]=E/B|0,p=E%B|0;h=p||f<S}else{for((p=u/(B[0]+1)|0)>1&&(B=e(B,p,u),O=e(O,p,u),C=B.length,S=O.length),A=C,v=(b=O.slice(0,C)).length;v<C;)b[v++]=0;(T=B.slice()).unshift(0),M=B[0],B[1]>=u/2&&++M;do{p=0,(c=t(B,b,C,v))<0?(w=b[0],C!=v&&(w=w*u+(b[1]||0)),(p=w/M|0)>1?(p>=u&&(p=u-1),1==(c=t(d=e(B,p,u),b,g=d.length,v=b.length))&&(p--,r(d,C<g?T:B,g,u))):(0==p&&(c=p=1),d=B.slice()),(g=d.length)<v&&d.unshift(0),r(b,d,v,u),-1==c&&(c=t(B,b,C,v=b.length))<1&&(p++,r(b,C<v?T:B,v,u)),v=b.length):0===c&&(p++,b=[0]),x[f++]=p,c&&b[0]?b[v++]=O[A]||0:(b=[O[A]],v=1)}while((A++<S||void 0!==b[0])&&N--);h=void 0!==b[0]}x[0]||x.shift()}if(1==m)y.e=l,Ze=h;else{for(f=1,p=x[0];p>=10;p/=10)f++;y.e=f+l*m-1,Et(y,s?o+y.e+1:o,a,h)}return y}}();function Et(e,t,r,n){var i,o,a,s,u,c,l,f,p,m=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((o=t-i)<0)o+=7,a=t,u=(l=f[p=0])/ct(10,i-a-1)%10|0;else if((p=Math.ceil((o+1)/7))>=(s=f.length)){if(!n)break e;for(;s++<=p;)f.push(0);l=u=0,i=1,a=(o%=7)-7+1}else{for(l=s=f[p],i=1;s>=10;s/=10)i++;u=(a=(o%=7)-7+i)<0?0:l/ct(10,i-a-1)%10|0}if(n=n||t<0||void 0!==f[p+1]||(a<0?l:l%ct(10,i-a-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(o>0?a>0?l/ct(10,i-a):0:f[p-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=ct(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=p,s=1,p--):(f.length=p+1,s=ct(10,7-o),f[p]=a>0?(l/ct(10,i-a)%ct(10,a)|0)*s:0),c)for(;;){if(0==p){for(o=1,a=f[0];a>=10;a/=10)o++;for(a=f[0]+=s,s=1;a>=10;a/=10)s++;o!=s&&(e.e++,f[0]==ht&&(f[0]=1));break}if(f[p]+=s,f[p]!=ht)break;f[p--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return rt&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function At(e,t,r){if(!e.isFinite())return It(e);var n,i=e.e,o=xt(e.d),a=o.length;return t?(r&&(n=r-a)>0?o=o.charAt(0)+"."+o.slice(1)+Dt(n):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Dt(-i-1)+o,r&&(n=r-a)>0&&(o+=Dt(n))):i>=a?(o+=Dt(i+1-a),r&&(n=r-i-1)>0&&(o=o+"."+Dt(n))):((n=i+1)<a&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-a)>0&&(i+1===a&&(o+="."),o+=Dt(n))),o}function St(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function Mt(e,t,r){if(t>dt)throw rt=!0,r&&(e.precision=r),Error(ot);return Et(new e(Ke),t,1,!0)}function Ct(e,t,r){if(t>gt)throw Error(ot);return Et(new e(et),t,r,!0)}function Tt(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function Dt(e){for(var t="";e--;)t+="0";return t}function Ft(e,t,r,n){var i,o=new e(1),a=Math.ceil(n/7+4);for(rt=!1;;){if(r%2&&Lt((o=o.times(t)).d,a)&&(i=!0),0===(r=ut(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}Lt((t=t.times(t)).d,a)}return rt=!0,o}function Ot(e){return 1&e.d[e.d.length-1]}function Bt(e,t,r){for(var n,i=new e(t[0]),o=0;++o<t.length;){if(!(n=new e(t[o])).s){i=n;break}i[r](n)&&(i=n)}return i}function _t(e,t){var r,n,i,o,a,s,u,c=0,l=0,f=0,p=e.constructor,m=p.rounding,h=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(rt=!1,u=h):u=t,s=new p(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=n=Math.log(ct(2,f))/Math.LN10*2+5|0,r=o=a=new p(1),p.precision=u;;){if(o=Et(o.times(e),u,1),r=r.times(++l),xt((s=a.plus(Nt(o,r,u,1))).d).slice(0,u)===xt(a.d).slice(0,u)){for(i=f;i--;)a=Et(a.times(a),u,1);if(null!=t)return p.precision=h,a;if(!(c<3&&vt(a.d,u-n,m,c)))return Et(a,p.precision=h,m,rt=!0);p.precision=u+=10,r=o=s=new p(1),l=0,c++}a=s}}function zt(e,t){var r,n,i,o,a,s,u,c,l,f,p,m=1,h=e,d=h.d,g=h.constructor,y=g.rounding,x=g.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new g(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(null==t?(rt=!1,l=x):l=t,g.precision=l+=10,n=(r=xt(d)).charAt(0),!(Math.abs(o=h.e)<15e14))return c=Mt(g,l+2,x).times(o+""),h=zt(new g(n+"."+r.slice(1)),l-10).plus(c),g.precision=x,null==t?Et(h,x,y,rt=!0):h;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=xt((h=h.times(e)).d)).charAt(0),m++;for(o=h.e,n>1?(h=new g("0."+r),o++):h=new g(n+"."+r.slice(1)),f=h,u=a=h=Nt(h.minus(1),h.plus(1),l,1),p=Et(h.times(h),l,1),i=3;;){if(a=Et(a.times(p),l,1),xt((c=u.plus(Nt(a,new g(i),l,1))).d).slice(0,l)===xt(u.d).slice(0,l)){if(u=u.times(2),0!==o&&(u=u.plus(Mt(g,l+2,x).times(o+""))),u=Nt(u,new g(m),l,1),null!=t)return g.precision=x,u;if(!vt(u.d,l-10,y,s))return Et(u,g.precision=x,y,rt=!0);g.precision=l+=10,c=a=h=Nt(f.minus(1),f.plus(1),l,1),p=Et(h.times(h),l,1),i=s=1}u=c,i+=2}}function It(e){return String(e.s*e.s/0)}function kt(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),rt&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Rt(e,t){var r,n,i,o,a,s,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),mt.test(t))return kt(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ft.test(t))r=16,t=t.toLowerCase();else if(lt.test(t))r=2;else{if(!pt.test(t))throw Error(it+t);r=8}for((o=t.search(/p/i))>0?(u=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),a=(o=t.indexOf("."))>=0,n=e.constructor,a&&(o=(s=(t=t.replace(".","")).length)-o,i=Ft(n,new n(r),o,2*o)),o=l=(c=wt(t,r,ht)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*e.s):(e.e=St(c,l),e.d=c,rt=!1,a&&(e=Nt(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?ct(2,u):Dr.pow(2,u))),rt=!0,e)}function qt(e,t,r,n,i){var o,a,s,u,c=e.precision,l=Math.ceil(c/7);for(rt=!1,u=r.times(r),s=new e(n);;){if(a=Nt(s.times(u),new e(t++*t++),c,1),s=i?n.plus(a):n.minus(a),n=Nt(a.times(u),new e(t++*t++),c,1),void 0!==(a=s.plus(n)).d[l]){for(o=l;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=n,n=a,a=o}return rt=!0,a.d.length=l+1,a}function Pt(e,t){for(var r=e;--t;)r*=e;return r}function jt(e,t){var r,n=t.s<0,i=Ct(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return Ye=n?4:1,t;if((r=t.divToInt(i)).isZero())Ye=n?3:2;else{if((t=t.minus(r.times(i))).lte(o))return Ye=Ot(r)?n?2:3:n?4:1,t;Ye=Ot(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Ut(e,t,r,n){var i,o,a,s,u,c,l,f,p,m=e.constructor,h=void 0!==r;if(h?(bt(r,1,Xe),void 0===n?n=m.rounding:bt(n,0,8)):(r=m.precision,n=m.rounding),e.isFinite()){for(h?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(a=(l=At(e)).indexOf("."))>=0&&(l=l.replace(".",""),(p=new m(1)).e=l.length-a,p.d=wt(At(p),10,i),p.e=p.d.length),o=u=(f=wt(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(a<0?o--:((e=new m(e)).d=f,e.e=o,f=(e=Nt(e,p,r,n,0,i)).d,o=e.e,c=Ze),a=f[r],s=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==a||c)&&(0===n||n===(e.s<0?3:2)):a>s||a===s&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++o,f.unshift(1));for(u=f.length;!f[u-1];--u);for(a=0,l="";a<u;a++)l+=Qe.charAt(f[a]);if(h){if(u>1)if(16==t||8==t){for(a=16==t?4:3,--u;u%a;u++)l+="0";for(u=(f=wt(l,i,t)).length;!f[u-1];--u);for(a=1,l="1.";a<u;a++)l+=Qe.charAt(f[a])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}else l=h?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=It(e);return e.s<0?"-"+l:l}function Lt(e,t){if(e.length>t)return e.length=t,!0}function $t(e){return new this(e).abs()}function Ht(e){return new this(e).acos()}function Gt(e){return new this(e).acosh()}function Vt(e,t){return new this(e).plus(t)}function Wt(e){return new this(e).asin()}function Zt(e){return new this(e).asinh()}function Yt(e){return new this(e).atan()}function Jt(e){return new this(e).atanh()}function Xt(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?Ct(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=Ct(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,r=this.atan(Nt(e,t,o,1)),t=Ct(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Nt(e,t,o,1)):(r=Ct(this,o,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function Qt(e){return new this(e).cbrt()}function Kt(e){return Et(e=new this(e),e.e+1,2)}function er(e,t,r){return new this(e).clamp(t,r)}function tr(e){if(!e||"object"!=typeof e)throw Error(nt+"Object expected");var t,r,n,i=!0===e.defaults,o=["precision",1,Xe,"rounding",0,8,"toExpNeg",-Je,0,"toExpPos",0,Je,"maxE",0,Je,"minE",-Je,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=tt[r]),void 0!==(n=e[r])){if(!(ut(n)===n&&n>=o[t+1]&&n<=o[t+2]))throw Error(it+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=tt[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(it+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(at);this[r]=!0}else this[r]=!1}return this}function rr(e){return new this(e).cos()}function nr(e){return new this(e).cosh()}function ir(e,t){return new this(e).div(t)}function or(e){return new this(e).exp()}function ar(e){return Et(e=new this(e),e.e+1,3)}function sr(){var e,t,r=new this(0);for(rt=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return rt=!0,new this(1/0);r=t}return rt=!0,r.sqrt()}function ur(e){return e instanceof Dr||e&&e.toStringTag===st||!1}function cr(e){return new this(e).ln()}function lr(e,t){return new this(e).log(t)}function fr(e){return new this(e).log(2)}function pr(e){return new this(e).log(10)}function mr(){return Bt(this,arguments,"lt")}function hr(){return Bt(this,arguments,"gt")}function dr(e,t){return new this(e).mod(t)}function gr(e,t){return new this(e).mul(t)}function yr(e,t){return new this(e).pow(t)}function xr(e){var t,r,n,i,o=0,a=new this(1),s=[];if(void 0===e?e=this.precision:bt(e,1,Xe),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(at);for(t=crypto.randomBytes(n*=4);o<n;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(s.push(i%1e7),o+=4);o=n/4}else for(;o<n;)s[o++]=1e7*Math.random()|0;for(e%=7,(n=s[--o])&&e&&(i=ct(10,7-e),s[o]=(n/i|0)*i);0===s[o];o--)s.pop();if(o<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=7)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return a.e=r,a.d=s,a}function br(e){return Et(e=new this(e),e.e+1,this.rounding)}function vr(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function wr(e){return new this(e).sin()}function Nr(e){return new this(e).sinh()}function Er(e){return new this(e).sqrt()}function Ar(e,t){return new this(e).sub(t)}function Sr(){var e=0,t=arguments,r=new this(t[e]);for(rt=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return rt=!0,Et(r,this.precision,this.rounding)}function Mr(e){return new this(e).tan()}function Cr(e){return new this(e).tanh()}function Tr(e){return Et(e=new this(e),e.e+1,1)}yt[Symbol.for("nodejs.util.inspect.custom")]=yt.toString,yt[Symbol.toStringTag]="Decimal";var Dr=yt.constructor=function e(t){var r,n,i;function o(e){var t,r,n,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,ur(e))return i.s=e.s,void(rt?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"==(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(t=0,r=e;r>=10;r/=10)t++;return void(rt?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):kt(i,e.toString())}if("string"!==n)throw Error(it+e);return 45===(r=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===r&&(e=e.slice(1)),i.s=1),mt.test(e)?kt(i,e):Rt(i,e)}if(o.prototype=yt,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=tr,o.clone=e,o.isDecimal=ur,o.abs=$t,o.acos=Ht,o.acosh=Gt,o.add=Vt,o.asin=Wt,o.asinh=Zt,o.atan=Yt,o.atanh=Jt,o.atan2=Xt,o.cbrt=Qt,o.ceil=Kt,o.clamp=er,o.cos=rr,o.cosh=nr,o.div=ir,o.exp=or,o.floor=ar,o.hypot=sr,o.ln=cr,o.log=lr,o.log10=pr,o.log2=fr,o.max=mr,o.min=hr,o.mod=dr,o.mul=gr,o.pow=yr,o.random=xr,o.round=br,o.sign=vr,o.sin=wr,o.sinh=Nr,o.sqrt=Er,o.sub=Ar,o.sum=Sr,o.tan=Mr,o.tanh=Cr,o.trunc=Tr,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return o.config(t),o}(tt);Ke=new Dr(Ke),et=new Dr(et);const Fr=Dr,Or=he("BigNumber",["?on","config"],(e=>{let{on:t,config:r}=e;const n=Fr.clone({precision:r.precision,modulo:Fr.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)},t&&t("config",(function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})})),n}),{isClass:!0}),Br=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},_r=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},zr=function(e,t){return(e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},Ir=function(){throw SyntaxError("Invalid Param")};function kr(e,t){const r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):(e*=.5,t*=.5,.5*Math.log(e*e+t*t)+Math.LN2)}const Rr={re:0,im:0},qr=function(e,t){const r=Rr;if(null==e)r.re=r.im=0;else if(void 0!==t)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return Pr.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return Pr.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else 2===e.length?(r.re=e[0],r.im=e[1]):Ir();break;case"string":r.im=r.re=0;const t=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let n=1,i=0;null===t&&Ir();for(let e=0;e<t.length;e++){const o=t[e];" "===o||"\t"===o||"\n"===o||("+"===o?n++:"-"===o?i++:"i"===o||"I"===o?(n+i===0&&Ir()," "===t[e+1]||isNaN(t[e+1])?r.im+=parseFloat((i%2?"-":"")+"1"):(r.im+=parseFloat((i%2?"-":"")+t[e+1]),e++),n=i=0):((n+i===0||isNaN(o))&&Ir(),"i"===t[e+1]||"I"===t[e+1]?(r.im+=parseFloat((i%2?"-":"")+o),e++):r.re+=parseFloat((i%2?"-":"")+o),n=i=0))}n+i>0&&Ir();break;case"number":r.im=0,r.re=e;break;default:Ir()}return isNaN(r.re)||isNaN(r.im),r};function Pr(e,t){if(!(this instanceof Pr))return new Pr(e,t);const r=qr(e,t);this.re=r.re,this.im=r.im}Pr.prototype={re:0,im:0,sign:function(){const e=zr(this.re,this.im);return new Pr(this.re/e,this.im/e)},add:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pr.NAN:Pr.INFINITY:new Pr(this.re+r.re,this.im+r.im)},sub:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pr.NAN:Pr.INFINITY:new Pr(this.re-r.re,this.im-r.im)},mul:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,a=0===r.re&&0===r.im;return n&&a||i&&o?Pr.NAN:n||i?Pr.INFINITY:0===r.im&&0===this.im?new Pr(this.re*r.re,0):new Pr(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,a=0===r.re&&0===r.im;if(o&&a||n&&i)return Pr.NAN;if(a||n)return Pr.INFINITY;if(o||i)return Pr.ZERO;if(0===r.im)return new Pr(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){const e=r.re/r.im,t=r.re*e+r.im;return new Pr((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{const e=r.im/r.re,t=r.im*e+r.re;return new Pr((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){const r=qr(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return Pr.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new Pr(Math.pow(this.re,r.re),0);if(0===this.re)switch((r.re%4+4)%4){case 0:return new Pr(Math.pow(this.im,r.re),0);case 1:return new Pr(0,Math.pow(this.im,r.re));case 2:return new Pr(-Math.pow(this.im,r.re),0);case 3:return new Pr(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return Pr.ZERO;const i=Math.atan2(this.im,this.re),o=kr(this.re,this.im);let a=Math.exp(r.re*o-r.im*i),s=r.im*o+r.re*i;return new Pr(a*Math.cos(s),a*Math.sin(s))},sqrt:function(){const e=this.re,t=this.im;if(0===t)return e>=0?new Pr(Math.sqrt(e),0):new Pr(0,Math.sqrt(-e));const r=zr(e,t);let n=Math.sqrt(.5*(r+Math.abs(e))),i=Math.abs(t)/(2*n);return e>=0?new Pr(n,t<0?-i:i):new Pr(i,t<0?-n:n)},exp:function(){const e=Math.exp(this.re);return 0===this.im?new Pr(e,0):new Pr(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){const e=this.re,t=this.im;return new Pr(Math.expm1(e)*Math.cos(t)+function(e){const t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;const r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){const e=this.re,t=this.im;return 0===t&&e>0?new Pr(Math.log(e),0):new Pr(kr(e,t),Math.atan2(t,e))},abs:function(){return zr(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){const e=this.re,t=this.im;return new Pr(Math.sin(e)*Br(t),Math.cos(e)*_r(t))},cos:function(){const e=this.re,t=this.im;return new Pr(Math.cos(e)*Br(t),-Math.sin(e)*_r(t))},tan:function(){const e=2*this.re,t=2*this.im,r=Math.cos(e)+Br(t);return new Pr(Math.sin(e)/r,_r(t)/r)},cot:function(){const e=2*this.re,t=2*this.im,r=Math.cos(e)-Br(t);return new Pr(-Math.sin(e)/r,_r(t)/r)},sec:function(){const e=this.re,t=this.im,r=.5*Br(2*t)+.5*Math.cos(2*e);return new Pr(Math.cos(e)*Br(t)/r,Math.sin(e)*_r(t)/r)},csc:function(){const e=this.re,t=this.im,r=.5*Br(2*t)-.5*Math.cos(2*e);return new Pr(Math.sin(e)*Br(t)/r,-Math.cos(e)*_r(t)/r)},asin:function(){const e=this.re,t=this.im,r=new Pr(t*t-e*e+1,-2*e*t).sqrt(),n=new Pr(r.re-t,r.im+e).log();return new Pr(n.im,-n.re)},acos:function(){const e=this.re,t=this.im,r=new Pr(t*t-e*e+1,-2*e*t).sqrt(),n=new Pr(r.re-t,r.im+e).log();return new Pr(Math.PI/2-n.im,n.re)},atan:function(){const e=this.re,t=this.im;if(0===e){if(1===t)return new Pr(0,1/0);if(-1===t)return new Pr(0,-1/0)}const r=e*e+(1-t)*(1-t),n=new Pr((1-t*t-e*e)/r,-2*e/r).log();return new Pr(-.5*n.im,.5*n.re)},acot:function(){const e=this.re,t=this.im;if(0===t)return new Pr(Math.atan2(1,e),0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).atan():new Pr(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new Pr(0,1/0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).acos():new Pr(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new Pr(Math.PI/2,1/0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).asin():new Pr(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){const e=this.re,t=this.im;return new Pr(_r(e)*Math.cos(t),Br(e)*Math.sin(t))},cosh:function(){const e=this.re,t=this.im;return new Pr(Br(e)*Math.cos(t),_r(e)*Math.sin(t))},tanh:function(){const e=2*this.re,t=2*this.im,r=Br(e)+Math.cos(t);return new Pr(_r(e)/r,Math.sin(t)/r)},coth:function(){const e=2*this.re,t=2*this.im,r=Br(e)-Math.cos(t);return new Pr(_r(e)/r,-Math.sin(t)/r)},csch:function(){const e=this.re,t=this.im,r=Math.cos(2*t)-Br(2*e);return new Pr(-2*_r(e)*Math.cos(t)/r,2*Br(e)*Math.sin(t)/r)},sech:function(){const e=this.re,t=this.im,r=Math.cos(2*t)+Br(2*e);return new Pr(2*Br(e)*Math.cos(t)/r,-2*_r(e)*Math.sin(t)/r)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;const t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){const e=this.acos();if(e.im<=0){const t=e.re;e.re=-e.im,e.im=t}else{const t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){const e=this.re,t=this.im,r=e>1&&0===t,n=1-e,i=1+e,o=n*n+t*t,a=0!==o?new Pr((i*n-t*t)/o,(t*n+i*t)/o):new Pr(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=kr(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,r&&(a.im=-a.im),a},acoth:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new Pr(0,Math.PI/2);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).atanh():new Pr(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){const e=this.re,t=this.im;if(0===t)return new Pr(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).asinh():new Pr(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){const e=this.re,t=this.im;if(this.isZero())return Pr.INFINITY;const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).acosh():new Pr(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return Pr.INFINITY;if(this.isInfinite())return Pr.ZERO;const e=this.re,t=this.im,r=e*e+t*t;return new Pr(e/r,-t/r)},conjugate:function(){return new Pr(this.re,-this.im)},neg:function(){return new Pr(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new Pr(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new Pr(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new Pr(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){const r=qr(e,t);return Math.abs(r.re-this.re)<=Pr.EPSILON&&Math.abs(r.im-this.im)<=Pr.EPSILON},clone:function(){return new Pr(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<Pr.EPSILON&&(e=0),Math.abs(t)<Pr.EPSILON&&(t=0),0===t?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},Pr.ZERO=new Pr(0,0),Pr.ONE=new Pr(1,0),Pr.I=new Pr(0,1),Pr.PI=new Pr(Math.PI,0),Pr.E=new Pr(Math.E,0),Pr.INFINITY=new Pr(1/0,1/0),Pr.NAN=new Pr(NaN,NaN),Pr.EPSILON=1e-15;const jr=he("Complex",[],(()=>(Object.defineProperty(Pr,"name",{value:"Complex"}),Pr.prototype.constructor=Pr,Pr.prototype.type="Complex",Pr.prototype.isComplex=!0,Pr.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Pr.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Pr.prototype.format=function(e){let t="",r=this.im,n=this.re;const i=Me(this.re,e),o=Me(this.im,e),a=d(e)?e:e?e.precision:null;if(null!==a){const e=Math.pow(10,-a);Math.abs(n/r)<e&&(n=0),Math.abs(r/n)<e&&(r=0)}return t=0===r?i:0===n?1===r?"i":-1===r?"-i":o+"i":r<0?-1===r?i+" - i":i+" - "+o.substring(1)+"i":1===r?i+" + i":i+" + "+o+"i",t},Pr.fromPolar=function(e){switch(arguments.length){case 1:{const e=arguments[0];if("object"==typeof e)return Pr(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{const e=arguments[0];let t=arguments[1];if(d(e)){if(v(t)&&t.hasBase("ANGLE")&&(t=t.toNumber("rad")),d(t))return new Pr({r:e,phi:t});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Pr.prototype.valueOf=Pr.prototype.toString,Pr.fromJSON=function(e){return new Pr(e)},Pr.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},Pr)),{isClass:!0});var Ur={s:1,n:0,d:1};function Lr(e,t){if(isNaN(e=parseInt(e,10)))throw Yr();return e*t}function $r(e,t){if(0===t)throw Zr();var r=Object.create(Wr.prototype);r.s=e<0?-1:1;var n=Vr(e=e<0?-e:e,t);return r.n=e/n,r.d=t/n,r}function Hr(e){for(var t={},r=e,n=2,i=4;i<=r;){for(;r%n==0;)r/=n,t[n]=(t[n]||0)+1;i+=1+2*n++}return r!==e?r>1&&(t[r]=(t[r]||0)+1):t[e]=(t[e]||0)+1,t}var Gr=function(e,t){var r,n=0,i=1,o=1,a=0,s=0,u=0,c=1,l=1,f=0,p=1,m=1,h=1,d=1e7;if(null==e);else if(void 0!==t){if(o=(n=e)*(i=t),n%1!=0||i%1!=0)throw Jr()}else switch(typeof e){case"object":if("d"in e&&"n"in e)n=e.n,i=e.d,"s"in e&&(n*=e.s);else{if(!(0 in e))throw Yr();n=e[0],1 in e&&(i=e[1])}o=n*i;break;case"number":if(e<0&&(o=e,e=-e),e%1==0)n=e;else if(e>0){for(e>=1&&(e/=l=Math.pow(10,Math.floor(1+Math.log(e)/Math.LN10)));p<=d&&h<=d;){if(e===(r=(f+m)/(p+h))){p+h<=d?(n=f+m,i=p+h):h>p?(n=m,i=h):(n=f,i=p);break}e>r?(f+=m,p+=h):(m+=f,h+=p),p>d?(n=m,i=h):(n=f,i=p)}n*=l}else(isNaN(e)||isNaN(t))&&(i=n=NaN);break;case"string":if(null===(p=e.match(/\d+|./g)))throw Yr();if("-"===p[f]?(o=-1,f++):"+"===p[f]&&f++,p.length===f+1?s=Lr(p[f++],o):"."===p[f+1]||"."===p[f]?("."!==p[f]&&(a=Lr(p[f++],o)),(1+ ++f===p.length||"("===p[f+1]&&")"===p[f+3]||"'"===p[f+1]&&"'"===p[f+3])&&(s=Lr(p[f],o),c=Math.pow(10,p[f].length),f++),("("===p[f]&&")"===p[f+2]||"'"===p[f]&&"'"===p[f+2])&&(u=Lr(p[f+1],o),l=Math.pow(10,p[f+1].length)-1,f+=3)):"/"===p[f+1]||":"===p[f+1]?(s=Lr(p[f],o),c=Lr(p[f+2],1),f+=3):"/"===p[f+3]&&" "===p[f+1]&&(a=Lr(p[f],o),s=Lr(p[f+2],o),c=Lr(p[f+4],1),f+=5),p.length<=f){o=n=u+(i=c*l)*a+l*s;break}default:throw Yr()}if(0===i)throw Zr();Ur.s=o<0?-1:1,Ur.n=Math.abs(n),Ur.d=Math.abs(i)};function Vr(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function Wr(e,t){if(Gr(e,t),!(this instanceof Wr))return $r(Ur.s*Ur.n,Ur.d);e=Vr(Ur.d,Ur.n),this.s=Ur.s,this.n=Ur.n/e,this.d=Ur.d/e}var Zr=function(){return new Error("Division by Zero")},Yr=function(){return new Error("Invalid argument")},Jr=function(){return new Error("Parameters must be integer")};Wr.prototype={s:1,n:0,d:1,abs:function(){return $r(this.n,this.d)},neg:function(){return $r(-this.s*this.n,this.d)},add:function(e,t){return Gr(e,t),$r(this.s*this.n*Ur.d+Ur.s*this.d*Ur.n,this.d*Ur.d)},sub:function(e,t){return Gr(e,t),$r(this.s*this.n*Ur.d-Ur.s*this.d*Ur.n,this.d*Ur.d)},mul:function(e,t){return Gr(e,t),$r(this.s*Ur.s*this.n*Ur.n,this.d*Ur.d)},div:function(e,t){return Gr(e,t),$r(this.s*Ur.s*this.n*Ur.d,this.d*Ur.n)},clone:function(){return $r(this.s*this.n,this.d)},mod:function(e,t){if(isNaN(this.n)||isNaN(this.d))return new Wr(NaN);if(void 0===e)return $r(this.s*this.n%this.d,1);if(Gr(e,t),0===Ur.n&&0===this.d)throw Zr();return $r(this.s*(Ur.d*this.n)%(Ur.n*this.d),Ur.d*this.d)},gcd:function(e,t){return Gr(e,t),$r(Vr(Ur.n,this.n)*Vr(Ur.d,this.d),Ur.d*this.d)},lcm:function(e,t){return Gr(e,t),0===Ur.n&&0===this.n?$r(0,1):$r(Ur.n*this.n,Vr(Ur.n,this.n)*Vr(Ur.d,this.d))},ceil:function(e){return e=Math.pow(10,e||0),isNaN(this.n)||isNaN(this.d)?new Wr(NaN):$r(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 Wr(NaN):$r(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 Wr(NaN):$r(Math.round(e*this.s*this.n/this.d),e)},roundTo:function(e,t){return Gr(e,t),$r(this.s*Math.round(this.n*Ur.d/(this.d*Ur.n))*Ur.n,Ur.d)},inverse:function(){return $r(this.s*this.d,this.n)},pow:function(e,t){if(Gr(e,t),1===Ur.d)return Ur.s<0?$r(Math.pow(this.s*this.d,Ur.n),Math.pow(this.n,Ur.n)):$r(Math.pow(this.s*this.n,Ur.n),Math.pow(this.d,Ur.n));if(this.s<0)return null;var r=Hr(this.n),n=Hr(this.d),i=1,o=1;for(var a in r)if("1"!==a){if("0"===a){i=0;break}if(r[a]*=Ur.n,r[a]%Ur.d!=0)return null;r[a]/=Ur.d,i*=Math.pow(a,r[a])}for(var a in n)if("1"!==a){if(n[a]*=Ur.n,n[a]%Ur.d!=0)return null;n[a]/=Ur.d,o*=Math.pow(a,n[a])}return Ur.s<0?$r(o,i):$r(i,o)},equals:function(e,t){return Gr(e,t),this.s*this.n*Ur.d==Ur.s*Ur.n*this.d},compare:function(e,t){Gr(e,t);var r=this.s*this.n*Ur.d-Ur.s*Ur.n*this.d;return(0<r)-(r<0)},simplify:function(e){if(isNaN(this.n)||isNaN(this.d))return this;e=e||.001;for(var t=this.abs(),r=t.toContinued(),n=1;n<r.length;n++){for(var i=$r(r[n-1],1),o=n-2;o>=0;o--)i=i.inverse().add(r[o]);if(Math.abs(i.sub(t).valueOf())<e)return i.mul(this.s)}return this},divisible:function(e,t){return Gr(e,t),!(!(Ur.n*this.d)||this.n*Ur.d%(Ur.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,r+=" ",n%=i),r+=n,r+="/",r+=i),r},toLatex:function(e){var t,r="",n=this.n,i=this.d;return this.s<0&&(r+="-"),1===i?r+=n:(e&&(t=Math.floor(n/i))>0&&(r+=t,n%=i),r+="\\frac{",r+=n,r+="}{",r+=i,r+="}"),r},toContinued:function(){var e,t=this.n,r=this.d,n=[];if(isNaN(t)||isNaN(r))return n;do{n.push(Math.floor(t/r)),e=t%r,t=r,r=e}while(1!==t);return n},toString:function(e){var t=this.n,r=this.d;if(isNaN(t)||isNaN(r))return"NaN";e=e||15;var n=function(e,t){for(;t%2==0;t/=2);for(;t%5==0;t/=5);if(1===t)return 0;for(var r=10%t,n=1;1!==r;n++)if(r=10*r%t,n>2e3)return 0;return n}(0,r),i=function(e,t,r){for(var n=1,i=function(e,t,r){for(var n=1;t>0;e=e*e%r,t>>=1)1&t&&(n=n*e%r);return n}(10,r,t),o=0;o<300;o++){if(n===i)return o;n=10*n%t,i=10*i%t}return 0}(0,r,n),o=this.s<0?"-":"";if(o+=t/r|0,t%=r,(t*=10)&&(o+="."),n){for(var a=i;a--;)o+=t/r|0,t%=r,t*=10;for(o+="(",a=n;a--;)o+=t/r|0,t%=r,t*=10;o+=")"}else for(a=e;t&&a--;)o+=t/r|0,t%=r,t*=10;return o}};const Xr=he("Fraction",[],(()=>(Object.defineProperty(Wr,"name",{value:"Fraction"}),Wr.prototype.constructor=Wr,Wr.prototype.type="Fraction",Wr.prototype.isFraction=!0,Wr.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},Wr.fromJSON=function(e){return new Wr(e)},Wr)),{isClass:!0});r(3362),r(1795);const Qr=he("Range",[],(()=>{function e(t,r,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");const i=null!=t,o=null!=r,a=null!=n;if(i)if(g(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter start must be a number");if(o)if(g(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter end must be a number");if(a)if(g(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter step must be a number");this.start=i?parseFloat(t):0,this.end=o?parseFloat(r):0,this.step=a?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if("string"!=typeof t)return null;const r=t.split(":").map((function(e){return parseFloat(e)}));if(r.some((function(e){return isNaN(e)})))return null;switch(r.length){case 2:return new e(r[0],r[1]);case 3:return new e(r[0],r[2],r[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){let e=0;const t=this.start,r=this.step,n=this.end-t;return be(r)===be(n)?e=Math.ceil(n/r):0===n&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){const e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){const e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){let t=this.start;const r=this.step,n=this.end;let i=0;if(r>0)for(;t<n;)e(t,[i],this),t+=r,i++;else if(r<0)for(;t>n;)e(t,[i],this),t+=r,i++},e.prototype.map=function(e){const t=[];return this.forEach((function(r,n,i){t[n[0]]=e(r,n,i)})),t},e.prototype.toArray=function(){const e=[];return this.forEach((function(t,r){e[r[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){let t=Me(this.start,e);return 1!==this.step&&(t+=":"+Me(this.step,e)),t+=":"+Me(this.end,e),t},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0}),Kr=he("Matrix",[],(()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e}),{isClass:!0});function en(){return en=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},en.apply(null,arguments)}function tn(e,t,r){const n=new(0,e.constructor)(2);let i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!ye(r))throw new Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw new Error(`Value must be in range [-2^${r-1}, 2^${r-1}-1]`);if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i=`i${r}`}switch(t){case 2:return`${e.toBinary()}${i}`;case 8:return`${e.toOctal()}${i}`;case 16:return`${e.toHexadecimal()}${i}`;default:throw new Error(`Base ${t} not supported `)}}function rn(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function nn(e,t){return d(e)?e:g(e)?e.toNumber():t}function on(e,t){const r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function an(e,t){const r=function(e,t){return"number"==typeof e?Me(e,t):g(e)?function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";const{notation:r,precision:n,wordSize:i}=Ce(t);switch(r){case"fixed":return function(e,t){return e.toFixed(t)}(e,n);case"exponential":return rn(e,n);case"engineering":return function(e,t){const r=e.e,n=r%3==0?r:r<0?r-3-r%3:r-r%3;let i=e.mul(Math.pow(10,-n)).toPrecision(t);return i.includes("e")&&(i=new(0,e.constructor)(i).toFixed()),i+"e"+(r>=0?"+":"")+n.toString()}(e,n);case"bin":return tn(e,2,i);case"oct":return tn(e,8,i);case"hex":return tn(e,16,i);case"auto":{const r=nn(null==t?void 0:t.lowerExp,-3),i=nn(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";let o;const a=e.toSignificantDigits(n),s=a.e;return o=s>=r&&s<i?a.toFixed():rn(e,n),o.replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}))}default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t):function(e){return e&&"object"==typeof e&&"number"==typeof e.s&&"number"==typeof e.n&&"number"==typeof e.d||!1}(e)?t&&"decimal"===t.fraction?e.toString():e.s*e.n+"/"+e.d:Array.isArray(e)?ln(e,t):w(e)?sn(e):"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):"{"+Object.keys(e).map((r=>sn(r)+": "+an(e[r],t))).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function sn(e){const t=String(e);let r="",n=0;for(;n<t.length;){const e=t.charAt(n);r+=e in un?un[e]:e,n++}return'"'+r+'"'}r(2712),r(8872);const un={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function cn(e){let t=String(e);return t=t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t}function ln(e,t){if(Array.isArray(e)){let r="[";const n=e.length;for(let i=0;i<n;i++)0!==i&&(r+=", "),r+=ln(e[i],t);return r+="]",r}return an(e,t)}function fn(e,t){if(!w(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(e)+", index: 0)");if(!w(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(t)+", index: 1)");return e===t?0:e>t?1:-1}function pn(e,t,r){if(!(this instanceof pn))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function mn(e,t,r){if(!(this instanceof mn))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.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 hn(e){const t=[];for(;Array.isArray(e);)t.push(e.length),e=e[0];return t}function dn(e,t,r){let n;const i=e.length;if(i!==t[r])throw new pn(i,t[r]);if(r<t.length-1){const o=r+1;for(n=0;n<i;n++){const r=e[n];if(!Array.isArray(r))throw new pn(t.length-1,t.length,"<");dn(e[n],t,o)}}else for(n=0;n<i;n++)if(Array.isArray(e[n]))throw new pn(t.length+1,t.length,">")}function gn(e,t){if(0===t.length){if(Array.isArray(e))throw new pn(e.length,0)}else dn(e,t,0)}function yn(e,t){const r=e.isMatrix?e._size:hn(e);t._sourceSize.forEach(((e,t)=>{if(null!==e&&e!==r[t])throw new pn(e,r[t])}))}function xn(e,t){if(void 0!==e){if(!d(e)||!ye(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new mn(e,t)}}function bn(e){for(let t=0;t<e._dimensions.length;++t){const r=e._dimensions[t];if(r._data&&N(r._data)){if(0===r._size[0])return!0}else if(r.isRange){if(r.start===r.end)return!0}else if(w(r)&&0===r.length)return!0}return!1}function vn(e,t,r){if(!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");return t.forEach((function(e){if(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+an(t)+")")})),(d(e)||g(e))&&(e=[e]),wn(e,t,0,void 0!==r?r:0),e}function wn(e,t,r,n){let i,o;const a=e.length,s=t[r],u=Math.min(a,s);if(e.length=s,r<t.length-1){const a=r+1;for(i=0;i<u;i++)o=e[i],Array.isArray(o)||(o=[o],e[i]=o),wn(o,t,a,n);for(i=u;i<s;i++)o=[],e[i]=o,wn(o,t,a,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 Nn(e,t){const r=Dn(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new pn(0,n,"!=");const i=An(t=En(t,n));if(n!==i)throw new pn(i,n,"!=");try{return function(e,t){let r,n=e;for(let e=t.length-1;e>0;e--){const i=t[e];r=[];const o=n.length/i;for(let e=0;e<o;e++)r.push(n.slice(e*i,(e+1)*i));n=r}return n}(r,t)}catch(e){if(e instanceof pn)throw new pn(i,n,"!=");throw e}}function En(e,t){const r=An(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(t%r!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);n[i]=-t/r}return n}function An(e){return e.reduce(((e,t)=>e*t),1)}function Sn(e,t){const r=t||hn(e);for(;Array.isArray(e)&&1===e.length;)e=e[0],r.shift();let n=r.length;for(;1===r[n-1];)n--;return n<r.length&&(e=Mn(e,n,0),r.length=n),e}function Mn(e,t,r){let n,i;if(r<t){const o=r+1;for(n=0,i=e.length;n<i;n++)e[n]=Mn(e[n],t,o)}else for(;Array.isArray(e);)e=e[0];return e}function Cn(e,t,r,n){const i=n||hn(e);if(r)for(let t=0;t<r;t++)e=[e],i.unshift(1);for(e=Tn(e,t,0);i.length<t;)i.push(1);return e}function Tn(e,t,r){let n,i;if(Array.isArray(e)){const o=r+1;for(n=0,i=e.length;n<i;n++)e[n]=Tn(e[n],t,o)}else for(let n=r;n<t;n++)e=[e];return e}function Dn(e){if(!Array.isArray(e))return e;const t=[];return e.forEach((function e(r){Array.isArray(r)?r.forEach(e):t.push(r)})),t}function Fn(e,t){return Array.prototype.map.call(e,t)}function On(e,t){Array.prototype.forEach.call(e,t)}function Bn(e,t){if(1!==hn(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(e=>t.test(e)))}function _n(e,t){return Array.prototype.join.call(e,t)}function zn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];let r=0;t[0]={value:e[0],identifier:0};for(let n=1;n<e.length;n++)e[n]===e[n-1]?r++:r=0,t.push({value:e[n],identifier:r});return t}function In(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];for(let r=0;r<e.length;r++)t.push(e[r].value);return t}function kn(e,t){let r,n=0;for(let i=0;i<e.length;i++){const o=e[i],a=Array.isArray(o);if(0===i&&a&&(n=o.length),a&&o.length!==n)return;const s=a?kn(o,t):t(o);if(void 0===r)r=s;else if(r!==s)return"mixed"}return r}function Rn(e,t,r,n){if(n<r){if(e.length!==t.length)throw new pn(e.length,t.length);const i=[];for(let o=0;o<e.length;o++)i[o]=Rn(e[o],t[o],r,n+1);return i}return e.concat(t)}function qn(){const e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce((function(e,r){return Rn(e,r,t,0)}),e[0]);throw new Error("Wrong number of arguments in function concat")}function Pn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=t.map((e=>e.length)),i=Math.max(...n),o=new Array(i).fill(null);for(let e=0;e<t.length;e++){const r=t[e],a=n[e];for(let e=0;e<a;e++){const t=i-a+e;r[e]>o[t]&&(o[t]=r[e])}}for(let e=0;e<t.length;e++)jn(t[e],o);return o}function jn(e,t){const r=t.length,n=e.length;for(let i=0;i<n;i++){const o=r-n+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw new Error(`shape missmatch: missmatch is found in arg with shape (${e}) not possible to broadcast dimension ${n} with size ${e[i]} to size ${t[o]}`)}}function Un(e,t){let r=hn(e);if(ce(r,t))return e;jn(r,t);const n=Pn(r,t),i=n.length,o=[...Array(i-r.length).fill(1),...r];let a=function(e){return en([],e)}(e);r.length<i&&(a=Nn(a,o),r=hn(a));for(let e=0;e<i;e++)r[e]<n[e]&&(s=a,u=n[e],c=e,a=qn(...Array(u).fill(s),c),r=hn(a));var s,u,c;return a}function Ln(e,t){if(!Array.isArray(e))throw new Error("Array expected");const r=hn(e);if(t.length!==r.length)throw new pn(t.length,r.length);for(let e=0;e<t.length;e++)xn(t[e],r[e]);return t.reduce(((e,t)=>e[t]),e)}function $n(e,t,r,n){return Array.isArray(e)?e.map((function(e,i){return $n(e,t.concat(i),r,n)})):n(e,t,r)}function Hn(e,r,n){if(t.isTypedFunction(e)){const i=(r.isMatrix?r.size():hn(r)).map((()=>0)),o=r.isMatrix?r.get(i):Ln(r,i),a=1===Object.keys(e.signatures).length,s=function(e,r,n,i){const o=[r,n,i];for(let r=3;r>0;r--){const n=o.slice(0,r);if(null!==t.resolve(e,n))return r}}(e,o,i,r),u=a?Object.values(e.signatures)[0]:e;return s>=1&&s<=3?function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Gn(u,r.slice(0,s),n,e.name)}:function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Gn(u,r,n,e.name)}}return e}function Gn(e,t,r,n){try{return e(...t)}catch(e){!function(e,t,r,n){var i;if(e instanceof TypeError&&"wrongType"===(null===(i=e.data)||void 0===i?void 0:i.category)){const e=[];throw e.push(`value: ${oe(t[0])}`),t.length>=2&&e.push(`index: ${oe(t[1])}`),t.length>=3&&e.push(`array: ${oe(t[2])}`),new TypeError(`Function ${r} cannot apply callback arguments ${n}(${e.join(", ")}) at index ${JSON.stringify(t[1])}`)}throw new TypeError(`Function ${r} cannot apply callback arguments to function ${n}: ${e.message}`)}(e,t,r,n)}}pn.prototype=new RangeError,pn.prototype.constructor=RangeError,pn.prototype.name="DimensionError",pn.prototype.isDimensionError=!0,mn.prototype=new RangeError,mn.prototype.constructor=RangeError,mn.prototype.name="IndexError",mn.prototype.isIndexError=!0,r(3110);const Vn=he("DenseMatrix",["Matrix"],(e=>{let{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))"DenseMatrix"===e.type?(this._data=ae(e._data),this._size=ae(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,gn(this._data,this._size),this._datatype=t||e.datatype;else if(N(e))this._data=s(e),this._size=hn(this._data),gn(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t}}function n(e,t,r,i){const o=i===r-1,a=t.dimension(i);return o?a.map((function(t){return xn(t,e.length),e[t]})).valueOf():a.map((function(o){return xn(o,e.length),n(e[o],t,r,i+1)})).valueOf()}function i(e,t,r,n,o){const a=o===n-1,s=t.dimension(o);a?s.forEach((function(t,n){xn(t),e[t]=r[n[0]]})):s.forEach((function(a,s){xn(a),i(e[a],t,r[s[0]],n,o+1)}))}function o(e,t,r){if(0===t.length){let t=e._data;for(;N(t);)t=t[0];return t}return e._size=t.slice(0),e._data=vn(e._data,e._size,r),e}function a(e,t,r){const n=e._size.slice(0);let i=!1;for(;n.length<t.length;)n.push(0),i=!0;for(let e=0,r=t.length;e<r;e++)t[e]>n[e]&&(n[e]=t[e],i=!0);i&&o(e,n,r)}function s(e){return E(e)?s(e.valueOf()):N(e)?e.map(s):e}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return kn(this._data,oe)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,o){switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());{const i=t.size();if(i.length!==e._size.length)throw new pn(i.length,e._size.length);const o=t.min(),a=t.max();for(let t=0,r=e._size.length;t<r;t++)xn(o[t],e._size[t]),xn(a[t],e._size[t]);return new r(n(e._data,t,i.length,0),e._datatype)}}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const o=t.size(),s=t.isScalar();let u;if(E(r)?(u=r.size(),r=r.valueOf()):u=hn(r),s){if(0!==u.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(!ce(u,o))try{u=hn(r=0===u.length?Un([r],o):Un(r,o))}catch(e){}if(o.length<e._size.length)throw new pn(o.length,e._size.length,"<");if(u.length<o.length){let e=0,t=0;for(;1===o[e]&&1===u[e];)e++;for(;1===o[e];)t++,e++;r=Cn(r,o.length,t,u)}if(!ce(o,u))throw new pn(o,u,">");a(e,t.max().map((function(e){return e+1})),n);const s=o.length,c=0;i(e._data,t,r,s,c)}return e}(this,e,t,o);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){return Ln(this._data,e)},r.prototype.set=function(e,t,r){if(!N(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new pn(e.length,this._size.length,"<");let n,i,o;const s=e.map((function(e){return e+1}));a(this,s,r);let u=this._data;for(n=0,i=e.length-1;n<i;n++)o=e[n],xn(o,u.length),u=u[o];return o=e[e.length-1],xn(o,u.length),u[o]=t,this},r.prototype.resize=function(e,t,r){if(!A(e))throw new TypeError("Array or Matrix expected");const n=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));return o(r?this.clone():this,n,t)},r.prototype.reshape=function(e,t){const r=t?this.clone():this;r._data=Nn(r._data,e);const n=r._size.reduce(((e,t)=>e*t));return r._size=En(e,n),r},r.prototype.clone=function(){return new r({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype._forEach=function(e){const t=this,r=t.size();if(1===r.length){for(let n=0;n<r[0];n++)e(t._data,n,[n]);return}const n=Array(r.length).fill(0),i=Array(r.length-1),o=i.length-1;i[0]=t._data[0];for(let e=0;e<o;e++)i[e+1]=i[e][0];for(n[o]=-1;;){let a;for(a=o;a>=0;a--){if(n[a]++,n[a]!==r[a]){i[a]=0===a?t._data[n[a]]:i[a-1][n[a]];for(let e=a;e<o;e++)i[e+1]=i[e][0];for(let t=0;t<r[i.length];t++)n[i.length]=t,e(i[o],t,n.slice(0));break}n[a]=0}if(-1===a)break}},r.prototype.map=function(e){const t=this,n=new r(t),i=Hn(e,t._data,"map");return n._forEach((function(e,r,n){e[r]=i(e[r],n,t)})),n},r.prototype.forEach=function(e){const t=this,r=Hn(e,t._data,"map");t._forEach((function(e,n,i){r(e[n],i,t)}))},r.prototype[Symbol.iterator]=function*(){const e=function*(t,r){if(N(t))for(let n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){const e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");const t=this._data;for(const n of t)e.push(new r([n],this._datatype));return e},r.prototype.columns=function(){const e=[],t=this.size();if(2!==t.length)throw new TypeError("Rows can only be returned for a 2D matrix.");const n=this._data;for(let i=0;i<t[1];i++){const t=n.map((e=>[e[i]]));e.push(new r(t,this._datatype))}return e},r.prototype.toArray=function(){return ae(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return an(this._data,e)},r.prototype.toString=function(){return an(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,n=e<0?-e:0,i=this._size[0],o=this._size[1],a=Math.min(i-n,o-t),s=[];for(let e=0;e<a;e++)s[e]=this._data[e+n][e+t];return new r({data:s,size:[a],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),n){if(g(n)&&(n=n.toNumber()),!d(n)||!ye(n))throw new TypeError("The parameter k must be an integer number")}else n=0;const o=n>0?n:0,a=n<0?-n:0,s=e[0],u=e[1],c=Math.min(s-a,u-o);let l;if(N(t)){if(t.length!==c)throw new Error("Invalid value array length");l=function(e){return t[e]}}else if(E(t)){const e=t.size();if(1!==e.length||e[0]!==c)throw new Error("Invalid matrix length");l=function(e){return t.get([e])}}else l=function(){return t};i||(i=g(l(0))?l(0).mul(0):0);let f=[];if(e.length>0){f=vn(f,e,i);for(let e=0;e<c;e++)f[e+a][e+o]=l(e)}return new r({data:f,size:[s,u]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return xn(e,this._size[0]),xn(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){const n=r[e];r[e]=r[t],r[t]=n},r}),{isClass:!0}),Wn="clone",Zn=he(Wn,["typed"],(e=>{let{typed:t}=e;return t(Wn,{any:ae})}));function Yn(e){const t=e.length,r=e[0].length;let n,i;const o=[];for(i=0;i<r;i++){const r=[];for(n=0;n<t;n++)r.push(e[n][i]);o.push(r)}return o}function Jn(e){for(let t=0;t<e.length;t++)if(A(e[t]))return!0;return!1}function Xn(e,t){E(e)&&(e=e.valueOf());for(let r=0,n=e.length;r<n;r++){const n=e[r];Array.isArray(n)?Xn(n,t):t(n)}}function Qn(e,t,r){return e&&"function"==typeof e.map?e.map((function(e){return Qn(e,t,r)})):t(e)}function Kn(e,t,r){const n=Array.isArray(e)?hn(e):e.size();if(t<0||t>=n.length)throw new mn(t,n.length);return E(e)?e.create(ei(e.valueOf(),t,r),e.datatype()):ei(e,t,r)}function ei(e,t,r){let n,i,o,a;if(t<=0){if(Array.isArray(e[0])){for(a=Yn(e),i=[],n=0;n<a.length;n++)i[n]=ei(a[n],t-1,r);return i}for(o=e[0],n=1;n<e.length;n++)o=r(o,e[n]);return o}for(i=[],n=0;n<e.length;n++)i[n]=ei(e[n],t-1,r);return i}function ti(e,t,r,n,i,o,a,s,u,c,l){const f=e._values,p=e._index,m=e._ptr;let h,d,g,y;if(n)for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],r[y]!==o?(r[y]=o,a.push(y),c?(n[y]=u?s(f[h],l):s(l,f[h]),i[y]=o):n[y]=f[h]):(n[y]=u?s(f[h],n[y]):s(n[y],f[h]),i[y]=o);else for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],r[y]!==o?(r[y]=o,a.push(y)):i[y]=o}const ri="isInteger",ni=he(ri,["typed"],(e=>{let{typed:t}=e;return t(ri,{number:ye,BigNumber:function(e){return e.isInt()},bigint:function(e){return!0},Fraction:function(e){return 1===e.d&&isFinite(e.n)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})}));r(2577);const ii="number";function oi(e){return e<0}function ai(e){return e>0}function si(e){return Number.isNaN(e)}function ui(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return!e.isNaN()&&!t.isNaN()&&(e.isFinite()&&t.isFinite()?!!e.eq(t)||e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(r),n)):e.eq(t))}oi.signature=ii,ai.signature=ii,si.signature=ii;const ci="isNegative",li=he(ci,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(ci,{number:e=>!_e(e,0,r.relTol,r.absTol)&&oi(e),BigNumber:e=>!ui(e,new e.constructor(0),r.relTol,r.absTol)&&e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),fi="isNumeric",pi=he(fi,["typed"],(e=>{let{typed:t}=e;return t(fi,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),mi="hasNumericValue",hi=he(mi,["typed","isNumeric"],(e=>{let{typed:t,isNumeric:r}=e;return t(mi,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return r(e)}})})),di="isPositive",gi=he(di,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(di,{number:e=>!_e(e,0,r.relTol,r.absTol)&&ai(e),BigNumber:e=>!(ui(e,new e.constructor(0),r.relTol,r.absTol)||e.isNeg()||e.isZero()||e.isNaN()),bigint:e=>e>0n,Fraction:e=>e.s>0&&e.n>0,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),yi="isZero",xi=he(yi,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return t(yi,{"number | BigNumber | Complex | Fraction":e=>r(e,0),bigint:e=>0n===e,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),bi="isNaN",vi=he(bi,["typed"],(e=>{let{typed:t}=e;return t(bi,{number:si,BigNumber:function(e){return e.isNaN()},bigint:function(e){return!1},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),wi="typeOf",Ni=he(wi,["typed"],(e=>{let{typed:t}=e;return t(wi,{any:oe})})),Ei=he("compareUnits",["typed"],(e=>{let{typed:t}=e;return{"Unit, Unit":t.referToSelf((e=>(r,n)=>{if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)}))}})),Ai="equalScalar",Si=he(Ai,["typed","config"],(e=>{let{typed:t,config:r}=e;const n=Ei({typed:t});return t(Ai,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return _e(e,t,r.relTol,r.absTol)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||ui(e,t,r.relTol,r.absTol)},"bigint, bigint":function(e,t){return e===t},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,r,n){return _e(e.re,t.re,r,n)&&_e(e.im,t.im,r,n)}(e,t,r.relTol,r.absTol)}},n)})),Mi=(he(Ai,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Ai,{"number, number":function(e,t){return _e(e,t,r.relTol,r.absTol)}})})),he("SparseMatrix",["typed","equalScalar","Matrix"],(e=>{let{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?ae(t._values):void 0,e._index=ae(t._index),e._ptr=ae(t._ptr),e._size=ae(t._size),e._datatype=r||t._datatype):o(e,t.valueOf(),r||t._datatype)}(this,e,t);else if(e&&N(e.index)&&N(e.ptr)&&N(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(N(e))o(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function o(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;const o=n.length;let a=0,s=r,u=0;if(w(i)&&(s=t.find(r,[i,i])||r,u=t.convert(0,i)),o>0){let t=0;do{e._ptr.push(e._index.length);for(let r=0;r<o;r++){const i=n[r];if(N(i)){if(0===t&&a<i.length&&(a=i.length),t<i.length){const n=i[t];s(n,u)||(e._values.push(n),e._index.push(r))}}else 0===t&&a<1&&(a=1),s(i,u)||(e._values.push(i),e._index.push(r))}t++}while(t<a)}e._ptr.push(e._index.length),e._size=[o,a]}function a(e,t,r,n){if(r-t==0)return r;for(let i=t;i<r;i++)if(n[i]===e)return i;return t}function s(e,t,r,n,i,o,a){i.splice(e,0,n),o.splice(e,0,t);for(let e=r+1;e<a.length;e++)a[e]++}function u(e,n,i,o){let a=o||0,s=r,u=0;w(e._datatype)&&(s=t.find(r,[e._datatype,e._datatype])||r,u=t.convert(0,e._datatype),a=t.convert(a,e._datatype));const c=!s(a,u),l=e._size[0];let f,p,m,h=e._size[1];if(i>h){for(p=h;p<i;p++)if(e._ptr[p]=e._values.length,c)for(f=0;f<l;f++)e._values.push(a),e._index.push(f);e._ptr[i]=e._values.length}else i<h&&(e._ptr.splice(i+1,h-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(h=i,n>l){if(c){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]+t,m=e._ptr[p+1]+t;let r=0;for(f=l;f<n;f++,r++)e._values.splice(m+r,0,a),e._index.splice(m+r,0,f),t++}e._ptr[h]=e._values.length}}else if(n<l){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]-t;const r=e._ptr[p],i=e._ptr[p+1]-t;for(m=r;m<i;m++)f=e._index[m],f>n-1&&(e._values.splice(m,1),e._index.splice(m,1),t++)}e._ptr[p]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){const o=n[0],a=n[1],s=[];let u,c;for(u=0;u<o;u++)for(s[u]=[],c=0;c<a;c++)s[u][c]=0;for(c=0;c<a;c++){const n=r[c],o=r[c+1];for(let r=n;r<o;r++)u=t[r],s[u][c]=e?i?ae(e[r]):e[r]:1}return s}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return kn(this._values,oe)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){const e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());const r=t.size();if(r.length!==e._size.length)throw new pn(r.length,e._size.length);let n,o,a,s;const u=t.min(),c=t.max();for(n=0,o=e._size.length;n<o;n++)xn(u[n],e._size[n]),xn(c[n],e._size[n]);const l=e._values,f=e._index,p=e._ptr,m=t.dimension(0),h=t.dimension(1),d=[],g=[];m.forEach((function(e,t){g[e]=t[0],d[e]=!0}));const y=l?[]:void 0,x=[],b=[];return h.forEach((function(e){for(b.push(x.length),a=p[e],s=p[e+1];a<s;a++)n=f[a],!0===d[n]&&(x.push(g[n]),y&&y.push(l[a]))})),b.push(x.length),new i({values:y,index:x,ptr:b,size:r,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const i=t.size(),o=t.isScalar();let a;if(E(r)?(a=r.size(),r=r.toArray()):a=hn(r),o){if(0!==a.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==i.length&&2!==i.length)throw new pn(i.length,e._size.length,"<");if(a.length<i.length){let e=0,t=0;for(;1===i[e]&&1===a[e];)e++;for(;1===i[e];)t++,e++;r=Cn(r,i.length,t,a)}if(!ce(i,a))throw new pn(i,a,">");if(1===i.length)t.dimension(0).forEach((function(t,i){xn(t),e.set([t,0],r[i[0]],n)}));else{const i=t.dimension(0),o=t.dimension(1);i.forEach((function(t,i){xn(t),o.forEach((function(o,a){xn(o),e.set([t,o],r[i[0]][a[0]],n)}))}))}}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new pn(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");const t=e[0],r=e[1];xn(t,this._size[0]),xn(r,this._size[1]);const n=a(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new pn(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");const o=e[0],c=e[1];let l=this._size[0],f=this._size[1],p=r,m=0;w(this._datatype)&&(p=t.find(r,[this._datatype,this._datatype])||r,m=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(u(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),xn(o,l),xn(c,f);const h=a(o,this._ptr[c],this._ptr[c+1],this._index);return h<this._ptr[c+1]&&this._index[h]===o?p(n,m)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(let e=t+1;e<i.length;e++)i[e]--}(h,c,this._values,this._index,this._ptr):this._values[h]=n:p(n,m)||s(h,o,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!A(e))throw new TypeError("Array or Matrix expected");const 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(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+an(n)+")")})),u(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!N(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");e.forEach((function(t){if(!d(t)||!ye(t)||t<=-2||0===t)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+an(e)+")")}));const r=this._size[0]*this._size[1];if(r!==(e=En(e,r))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");const n=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return n;const i=[];for(let e=0;e<n._ptr.length;e++)for(let t=0;t<n._ptr[e+1]-n._ptr[e];t++)i.push(e);const o=n._values.slice(),u=n._index.slice();for(let t=0;t<n._index.length;t++){const r=u[t],o=i[t],a=r*n._size[1]+o;i[t]=a%e[1],u[t]=Math.floor(a/e[1])}n._values.length=0,n._index.length=0,n._ptr.length=e[1]+1,n._size=e.slice();for(let e=0;e<n._ptr.length;e++)n._ptr[e]=0;for(let e=0;e<o.length;e++){const t=u[e],r=i[e],c=o[e];s(a(t,n._ptr[r],n._ptr[r+1],n._index),t,r,c,n._values,n._index,n._ptr)}return n},i.prototype.clone=function(){return new i({values:this._values?ae(this._values):void 0,index:ae(this._index),ptr:ae(this._ptr),size:ae(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");const o=this,a=this._size[0],s=this._size[1],u=Hn(e,o,"map");return function(e,n,a,s,c,l,f){const p=[],m=[],h=[];let d=r,g=0;w(e._datatype)&&(d=t.find(r,[e._datatype,e._datatype])||r,g=t.convert(0,e._datatype));const y=function(e,t,r){const n=function(e,t,r){return u(e,[t,r],o)}(e,t,r);d(n,g)||(p.push(n),m.push(t))};for(let t=0;t<=c;t++){h.push(p.length);const r=e._ptr[t],n=e._ptr[t+1];if(f)for(let i=r;i<n;i++){const r=e._index[i];r>=0&&r<=a&&y(e._values[i],r-0,t-0)}else{const i={};for(let t=r;t<n;t++)i[e._index[t]]=e._values[t];for(let e=0;e<=a;e++)y(e in i?i[e]:0,e-0,t-0)}}return h.push(p.length),new i({values:p,index:m,ptr:h,size:[a-0+1,c-0+1]})}(this,0,a-1,0,s-1,0,n)},i.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");const r=this,n=this._size[0],i=this._size[1],o=Hn(e,r,"forEach");for(let e=0;e<i;e++){const i=this._ptr[e],a=this._ptr[e+1];if(t)for(let t=i;t<a;t++){const n=this._index[t];o(this._values[t],[n,e],r)}else{const t={};for(let e=i;e<a;e++)t[this._index[e]]=this._values[e];for(let i=0;i<n;i++)o(i in t?t[i]:0,[i,e],r)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");const e=this._size[1];for(let t=0;t<e;t++){const e=this._ptr[t],r=this._ptr[t+1];for(let n=e;n<r;n++){const e=this._index[n];yield{value:this._values[n],index:[e,t]}}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){const t=this._size[0],r=this._size[1],n=this.density();let i="Sparse Matrix ["+an(t,e)+" x "+an(r,e)+"] density: "+an(n,e)+"\n";for(let t=0;t<r;t++){const r=this._ptr[t],n=this._ptr[t+1];for(let o=r;o<n;o++)i+="\n ("+an(this._index[o],e)+", "+an(t,e)+") ==> "+(this._values?an(this._values[o],e):"X")}return i},i.prototype.toString=function(){return an(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,r=e<0?-e:0,n=this._size[0],o=this._size[1],a=Math.min(n-r,o-t),s=[],u=[],c=[];c[0]=0;for(let e=t;e<o&&s.length<a;e++){const n=this._ptr[e],i=this._ptr[e+1];for(let o=n;o<i;o++){const n=this._index[o];if(n===e-t+r){s.push(this._values[o]),u[s.length-1]=n-r;break}}}return c.push(s.length),new i({values:s,index:u,ptr:c,size:[a,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,o,a,s){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),o){if(g(o)&&(o=o.toNumber()),!d(o)||!ye(o))throw new TypeError("The parameter k must be an integer number")}else o=0;let u=r,c=0;w(s)&&(u=t.find(r,[s,s])||r,c=t.convert(0,s));const l=o>0?o:0,f=o<0?-o:0,p=e[0],m=e[1],h=Math.min(p-f,m-l);let y;if(N(n)){if(n.length!==h)throw new Error("Invalid value array length");y=function(e){return n[e]}}else if(E(n)){const e=n.size();if(1!==e.length||e[0]!==h)throw new Error("Invalid matrix length");y=function(e){return n.get([e])}}else y=function(){return n};const x=[],b=[],v=[];for(let e=0;e<m;e++){v.push(x.length);const t=e-l;if(t>=0&&t<h){const e=y(t);u(e,c)||(b.push(t+f),x.push(e))}}return v.push(x.length),new i({values:x,index:b,ptr:v,size:[p,m]})},i.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return xn(e,this._size[0]),xn(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){const o=n[e],a=n[e+1];for(let e=o;e<a;e++)i(r[e],t[e])},i._swapRows=function(e,t,r,n,i,o){for(let s=0;s<r;s++){const r=o[s],u=o[s+1],c=a(e,r,u,i),l=a(t,r,u,i);if(c<u&&l<u&&i[c]===e&&i[l]===t){if(n){const e=n[c];n[c]=n[l],n[l]=e}}else if(c<u&&i[c]===e&&(l>=u||i[l]!==t)){const e=n?n[c]:void 0;i.splice(l,0,t),n&&n.splice(l,0,e),i.splice(l<=c?c+1:c,1),n&&n.splice(l<=c?c+1:c,1)}else if(l<u&&i[l]===t&&(c>=u||i[c]!==e)){const t=n?n[l]:void 0;i.splice(c,0,e),n&&n.splice(c,0,t),i.splice(c<=l?l+1:l,1),n&&n.splice(c<=l?l+1:l,1)}}},i}),{isClass:!0})),Ci=he("number",["typed"],(e=>{let{typed:t}=e;const r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;const t=function(e){const t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);return t?{input:e,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null}(e);if(t)return function(e){const t=parseInt(e.integerPart,e.radix);let r=0;for(let t=0;t<e.fractionalPart.length;t++)r+=parseInt(e.fractionalPart[t],e.radix)/Math.pow(e.radix,t+1);const n=t+r;if(isNaN(n))throw new SyntaxError('String "'+e.input+'" is not a valid number');return n}(t);let r=0;const n=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);n&&(r=Number(n[2]),e=n[1]);let i=Number(e);if(isNaN(i))throw new SyntaxError('String "'+e+'" is not a valid number');if(n){if(i>2**r-1)throw new SyntaxError(`String "${e}" is out of range`);i>=2**(r-1)&&(i-=2**r)}return i},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf((e=>t=>{const r=t.clone();return r.value=e(t.value),r})),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))});return r.fromJSON=function(e){return parseFloat(e.value)},r})),Ti=he("bigint",["typed"],(e=>{let{typed:t}=e;const r=t("bigint",{"":function(){return 0n},bigint:function(e){return e},number:function(e){return BigInt(e.toFixed())},BigNumber:function(e){return BigInt(e.round().toString())},Fraction:function(e){return BigInt(e.valueOf().toFixed())},"string | boolean":function(e){return BigInt(e)},null:function(e){return 0n},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))});return r.fromJSON=function(e){return BigInt(e.value)},r})),Di="string",Fi=he(Di,["typed"],(e=>{let{typed:t}=e;return t(Di,{"":function(){return""},number:Me,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e))),any:function(e){return String(e)}})})),Oi="boolean",Bi=he(Oi,["typed"],(e=>{let{typed:t}=e;return t(Oi,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){const t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;const r=Number(e);if(""!==e&&!isNaN(r))return!!r;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),_i=he("bignumber",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){const t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){const n=t[2],i=r(t[1]),o=new r(2).pow(Number(n));if(i.gt(o.sub(1)))throw new SyntaxError(`String "${e}" is out of range`);const a=new r(2).pow(Number(n)-1);return i.gte(a)?i.sub(o):i}return new r(e)},BigNumber:function(e){return e},bigint:function(e){return new r(e.toString())},Unit:t.referToSelf((e=>t=>{const r=t.clone();return r.value=e(t.value),r})),Fraction:function(e){return new r(e.n).div(e.d).times(e.s)},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),zi=he("complex",["typed","Complex"],(e=>{let{typed:t,Complex:r}=e;return t("complex",{"":function(){return r.ZERO},number:function(e){return new r(e,0)},"number, number":function(e,t){return new r(e,t)},"BigNumber, BigNumber":function(e,t){return new r(e.toNumber(),t.toNumber())},Fraction:function(e){return new r(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return r(e)},null:function(e){return r(0)},Object:function(e){if("re"in e&&"im"in e)return new r(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new r(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),Ii=he("fraction",["typed","Fraction"],(e=>{let{typed:t,Fraction:r}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},bigint:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf((e=>t=>{const r=t.clone();return r.value=e(t.value),r})),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),ki="matrix",Ri=he(ki,["typed","Matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(ki,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})),qi="matrixFromFunction",Pi=he(qi,["typed","matrix","isZero"],(e=>{let{typed:t,matrix:r,isZero:n}=e;return t(qi,{"Array | Matrix, function, string, string":function(e,t,r,n){return i(e,t,r,n)},"Array | Matrix, function, string":function(e,t,r){return i(e,t,r)},"Matrix, function":function(e,t){return i(e,t,"dense")},"Array, function":function(e,t){return i(e,t,"dense").toArray()},"Array | Matrix, string, function":function(e,t,r){return i(e,r,t)},"Array | Matrix, string, string, function":function(e,t,r,n){return i(e,n,t,r)}});function i(e,t,i,o){let a;return a=void 0!==o?r(i,o):r(i),a.resize(e),a.forEach((function(e,r){const i=t(r);n(i)||a.set(r,i)})),a}})),ji="matrixFromRows",Ui=he(ji,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:r,flatten:n,size:i}=e;return t(ji,{"...Array":function(e){return o(e)},"...Matrix":function(e){return r(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");const t=a(e[0]),r=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));r.push(n(i))}return r}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Li="matrixFromColumns",$i=he(Li,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:r,flatten:n,size:i}=e;return t(Li,{"...Array":function(e){return o(e)},"...Matrix":function(e){return r(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");const t=a(e[0]),r=[];for(let e=0;e<t;e++)r[e]=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));const o=n(i);for(let e=0;e<t;e++)r[e].push(o[e])}return r}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Hi="splitUnit",Gi=he(Hi,["typed"],(e=>{let{typed:t}=e;return t(Hi,{"Unit, Array":function(e,t){return e.splitUnit(t)}})})),Vi="number",Wi="number, number";function Zi(e){return Math.abs(e)}function Yi(e,t){return e+t}function Ji(e,t){return e-t}function Xi(e,t){return e*t}function Qi(e){return-e}function Ki(e){return e}function eo(e){return Ee(e)}function to(e){return e*e*e}function ro(e){return Math.exp(e)}function no(e){return Ae(e)}function io(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;let r;const n=e*t;for(;0!==t;)r=t,t=e%r,e=r;return Math.abs(n/e)}function oo(e){return we(e)}function ao(e){return ve(e)}function so(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const r=t<0;if(r&&(t=-t),0===t)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return r?1/0:0;if(!isFinite(e))return r?0:e;let n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function uo(e){return be(e)}function co(e){return e*e}function lo(e,t){let r,n,i,o,a=0,s=1,u=1,c=0;if(!ye(e)||!ye(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)n=Math.floor(e/t),i=e-n*t,r=a,a=s-n*a,s=r,r=u,u=c-n*u,c=r,e=t,t=i;return o=e<0?[-e,-s,-c]:[e,e?s:0,c],o}function fo(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function po(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ye(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(De(e,t))}Zi.signature=Vi,Yi.signature=Wi,Ji.signature=Wi,Xi.signature=Wi,Qi.signature=Vi,Ki.signature=Vi,eo.signature=Vi,to.signature=Vi,ro.signature=Vi,no.signature=Vi,io.signature=Wi,oo.signature=Vi,ao.signature=Vi,uo.signature=Vi,co.signature=Vi,lo.signature=Wi,fo.signature=Wi;const mo="unaryMinus",ho=he(mo,["typed"],(e=>{let{typed:t}=e;return t(mo,{number:Qi,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:t.referToSelf((e=>r=>{const n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n})),"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0)))})})),go="unaryPlus",yo=he(go,["typed","config","numeric"],(e=>{let{typed:t,config:r,numeric:n}=e;return t(go,{number:Ki,Complex:function(e){return e},BigNumber:function(e){return e},bigint:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0))),boolean:function(e){return n(e?1:0,r.number)},string:function(e){return n(e,xe(e,r))}})})),xo=he("abs",["typed"],(e=>{let{typed:t}=e;return t("abs",{number:Zi,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0)))})})),bo="apply",vo=he(bo,["typed","isInteger"],(e=>{let{typed:t,isInteger:r}=e;return t(bo,{"Array | Matrix, number | BigNumber, function":function(e,t,n){if(!r(t))throw new TypeError("Integer number expected for dimension");const i=Array.isArray(e)?hn(e):e.size();if(t<0||t>=i.length)throw new mn(t,i.length);return E(e)?e.create(wo(e.valueOf(),t,n),e.datatype()):wo(e,t,n)}})}));function wo(e,t,r){let n,i,o;if(t<=0){if(Array.isArray(e[0])){for(o=function(e){const t=e.length,r=e[0].length;let n,i;const o=[];for(i=0;i<r;i++){const r=[];for(n=0;n<t;n++)r.push(e[n][i]);o.push(r)}return o}(e),i=[],n=0;n<o.length;n++)i[n]=wo(o[n],t-1,r);return i}return r(e)}for(i=[],n=0;n<e.length;n++)i[n]=wo(e[n],t-1,r);return i}const No="addScalar",Eo=he(No,["typed"],(e=>{let{typed:t}=e;return t(No,{"number, number":Yi,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"bigint, bigint":function(e,t){return e+t},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf((e=>(r,n)=>{if(null===r.value||void 0===r.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(!r.equalBase(n))throw new Error("Units do not match");const i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))})})),Ao="subtractScalar",So=he(Ao,["typed"],(e=>{let{typed:t}=e;return t(Ao,{"number, number":Ji,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"bigint, bigint":function(e,t){return e-t},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf((e=>(r,n)=>{if(null===r.value||void 0===r.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(!r.equalBase(n))throw new Error("Units do not match");const i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))})})),Mo="cbrt",Co=he(Mo,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],(e=>{let{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:o,Complex:a,BigNumber:s,Fraction:u}=e;return r(Mo,{number:eo,Complex:c,"Complex, boolean":c,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&x(e.value)){let t=e.clone();return t.value=1,t=t.pow(1/3),t.value=c(e.value),t}{const t=n(e.value);let r;t&&(e.value=i(e.value)),r=g(e.value)?new s(1).div(3):b(e.value)?new u(1,3):1/3;const o=e.pow(r);return t&&(o.value=i(o.value)),o}}});function c(e,r){const n=e.arg()/3,i=e.abs(),s=new a(eo(i),0).mul(new a(0,n).exp());if(r){const e=[s,new a(eo(i),0).mul(new a(0,n+2*Math.PI/3).exp()),new a(eo(i),0).mul(new a(0,n-2*Math.PI/3).exp())];return"Array"===t.matrix?e:o(e)}return s}})),To=he("matAlgo11xS0s",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=r,d=0,g=i;"string"==typeof l&&(m=l,h=t.find(r,[m,m]),d=t.convert(0,m),n=t.convert(n,m),g=t.find(i,[m,m]));const y=[],x=[],b=[];for(let e=0;e<p;e++){b[e]=x.length;for(let t=u[e],r=u[e+1],i=t;i<r;i++){const e=s[i],t=o?g(n,a[i]):g(a[i],n);h(t,d)||(x.push(e),y.push(t))}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:m})}})),Do=he("matAlgo12xSfs",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:r}=e;return function(e,n,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,n=t.convert(n,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let r=u[e],n=u[e+1],i=r;i<n;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let r=0;r<f;r++)0===e&&(d[r]=[]),y[r]===t?d[r][e]=o?h(n,g[r]):h(g[r],n):d[r][e]=o?h(n,0):h(0,n)}return new r({data:d,size:[f,p],datatype:m})}})),Fo=he("matAlgo14xDs",["typed"],(e=>{let{typed:t}=e;return function(e,n,i,o){const a=e._data,s=e._size,u=e._datatype;let c,l=i;"string"==typeof u&&(c=u,n=t.convert(n,c),l=t.find(i,[c,c]));const f=s.length>0?r(l,0,s,s[0],a,n,o):[];return e.createDenseMatrix({data:f,size:ae(s),datatype:c})};function r(e,t,n,i,o,a,s){const u=[];if(t===n.length-1)for(let t=0;t<i;t++)u[t]=s?e(a,o[t]):e(o[t],a);else for(let c=0;c<i;c++)u[c]=r(e,t+1,n,n[t+1],o[c],a,s);return u}})),Oo="ceil",Bo=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],_o=he(Oo,["typed","config","round"],(e=>{let{typed:t,config:r,round:n}=e;return t(Oo,{number:function(e){return _e(e,n(e),r.relTol,r.absTol)?n(e):Math.ceil(e)},"number, number":function(e,t){if(_e(e,n(e,t),r.relTol,r.absTol))return n(e,t);{let[r,n]=`${e}e`.split("e");const i=Math.ceil(Number(`${r}e${Number(n)+t}`));return[r,n]=`${i}e`.split("e"),Number(`${r}e${Number(n)-t}`)}}})})),zo=he(Oo,Bo,(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=To({typed:t,equalScalar:o}),c=Do({typed:t,DenseMatrix:s}),l=Fo({typed:t}),f=_o({typed:t,config:r,round:n});return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:function(e){return ui(e,n(e),r.relTol,r.absTol)?n(e):e.ceil()},"BigNumber, BigNumber":function(e,t){return ui(e,n(e,t),r.relTol,r.absTol)?n(e,t):e.toDecimalPlaces(t.toNumber(),Fr.ROUND_CEIL)},Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>Qn(t,(t=>e(t,r)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(i(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>o(t,0)?a(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Io="cube",ko=he(Io,["typed"],(e=>{let{typed:t}=e;return t(Io,{number:to,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},bigint:function(e){return e*e*e},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})})),Ro=he("exp",["typed"],(e=>{let{typed:t}=e;return t("exp",{number:ro,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),qo="expm1",Po=he(qo,["typed","Complex"],(e=>{let{typed:t,Complex:r}=e;return t(qo,{number:no,Complex:function(e){const t=Math.exp(e.re);return new r(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),jo="fix",Uo=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],Lo=he(jo,["typed","ceil","floor"],(e=>{let{typed:t,ceil:r,floor:n}=e;return t(jo,{number:function(e){return e>0?n(e):r(e)},"number, number":function(e,t){return e>0?n(e,t):r(e,t)}})})),$o=he(jo,Uo,(e=>{let{typed:t,Complex:r,matrix:n,ceil:i,floor:o,equalScalar:a,zeros:s,DenseMatrix:u}=e;const c=Do({typed:t,DenseMatrix:u}),l=Fo({typed:t}),f=Lo({typed:t,ceil:i,floor:o});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new r(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,t){return new r(e.re>0?o(e.re,t):i(e.re,t),e.im>0?o(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){const n=t.toNumber();return new r(e.re>0?o(e.re,n):i(e.re,n),e.im>0?o(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):o(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):o(e,t)},Fraction:function(e){return e.s<0?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0?i(e,t):o(e,t)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0))),"Array | Matrix, number | BigNumber":t.referToSelf((e=>(t,r)=>Qn(t,(t=>e(t,r)),!0))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(n(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>a(t,0)?s(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Ho="floor",Go=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Vo=he(Ho,["typed","config","round"],(e=>{let{typed:t,config:r,round:n}=e;return t(Ho,{number:function(e){return _e(e,n(e),r.relTol,r.absTol)?n(e):Math.floor(e)},"number, number":function(e,t){if(_e(e,n(e,t),r.relTol,r.absTol))return n(e,t);{let[r,n]=`${e}e`.split("e");const i=Math.floor(Number(`${r}e${Number(n)+t}`));return[r,n]=`${i}e`.split("e"),Number(`${r}e${Number(n)-t}`)}}})})),Wo=he(Ho,Go,(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=To({typed:t,equalScalar:o}),c=Do({typed:t,DenseMatrix:s}),l=Fo({typed:t}),f=Vo({typed:t,config:r,round:n});return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:function(e){return ui(e,n(e),r.relTol,r.absTol)?n(e):e.floor()},"BigNumber, BigNumber":function(e,t){return ui(e,n(e,t),r.relTol,r.absTol)?n(e,t):e.toDecimalPlaces(t.toNumber(),Fr.ROUND_FLOOR)},Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>Qn(t,(t=>e(t,r)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(i(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>o(t,0)?a(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Zo=he("matAlgo02xDS0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i,o){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=n._values,l=n._index,f=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(s.length!==p.length)throw new pn(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const h=s[0],d=s[1];let g,y=r,x=0,b=i;"string"==typeof u&&u===m&&"mixed"!==u&&(g=u,y=t.find(r,[g,g]),x=t.convert(0,g),b=t.find(i,[g,g]));const v=[],w=[],N=[];for(let e=0;e<d;e++){N[e]=w.length;for(let t=f[e],r=f[e+1],n=t;n<r;n++){const t=l[n],r=o?b(c[n],a[t][e]):b(a[t][e],c[n]);y(r,x)||(w.push(t),v.push(r))}}return N[d]=w.length,n.createSparseMatrix({values:v,index:w,ptr:N,size:[h,d],datatype:u===e._datatype&&m===n._datatype?g:void 0})}})),Yo=he("matAlgo03xDSf",["typed"],(e=>{let{typed:t}=e;return function(e,r,n,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._values,c=r._index,l=r._ptr,f=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(a.length!==f.length)throw new pn(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1];let d,g=0,y=n;"string"==typeof s&&s===p&&"mixed"!==s&&(d=s,g=t.convert(0,d),y=t.find(n,[d,d]));const x=[];for(let e=0;e<m;e++)x[e]=[];const b=[],v=[];for(let e=0;e<h;e++){const t=e+1;for(let r=l[e],n=l[e+1],a=r;a<n;a++){const r=c[a];b[r]=i?y(u[a],o[r][e]):y(o[r][e],u[a]),v[r]=t}for(let r=0;r<m;r++)v[r]===t?x[r][e]=b[r]:x[r][e]=i?y(g,o[r][e]):y(o[r][e],g)}return e.createDenseMatrix({data:x,size:[m,h],datatype:s===e._datatype&&p===r._datatype?d:void 0})}})),Jo=he("matAlgo05xSfSf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new pn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=w?[]:void 0,M=[],C=[];let T,D,F,O;for(D=0;D<g;D++){E[D]=N.length;const e=D+1;for(F=s[D],O=s[D+1];F<O;F++)T=a[F],N.push(T),M[T]=e,A&&(A[T]=o[F]);for(F=p[D],O=p[D+1];F<O;F++)T=f[F],M[T]!==e&&N.push(T),C[T]=e,S&&(S[T]=l[F]);if(w)for(F=E[D];F<N.length;){T=N[F];const t=M[T],r=C[T];if(t===e||r===e){const n=v(t===e?A[T]:b,r===e?S[T]:b);x(n,b)?N.splice(F,1):(w.push(n),F++)}}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),Xo=he("matAlgo13xDD",["typed"],(e=>{let{typed:t}=e;return function(e,n,i){const o=e._data,a=e._size,s=e._datatype,u=n._data,c=n._size,l=n._datatype,f=[];if(a.length!==c.length)throw new pn(a.length,c.length);for(let e=0;e<a.length;e++){if(a[e]!==c[e])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");f[e]=a[e]}let p,m=i;"string"==typeof s&&s===l&&(p=s,m=t.find(i,[p,p]));const h=f.length>0?r(m,0,f,f[0],o,u):[];return e.createDenseMatrix({data:h,size:f,datatype:p})};function r(e,t,n,i,o,a){const s=[];if(t===n.length-1)for(let t=0;t<i;t++)s[t]=e(o[t],a[t]);else for(let u=0;u<i;u++)s[u]=r(e,t+1,n,n[t+1],o[u],a[u]);return s}}));function Qo(e,t){if(ce(e.size(),t.size()))return[e,t];const r=Pn(e.size(),t.size());return[e,t].map((e=>function(e,t){return ce(e.size(),t)?e:e.create(Un(e.valueOf(),t),e.datatype())}(e,r)))}const Ko=he("matrixAlgorithmSuite",["typed","matrix"],(e=>{let{typed:t,matrix:r}=e;const n=Xo({typed:t}),i=Fo({typed:t});return function(e){const o=e.elop,a=e.SD||e.DS;let s;o?(s={"DenseMatrix, DenseMatrix":(e,t)=>n(...Qo(e,t),o),"Array, Array":(e,t)=>n(...Qo(r(e),r(t)),o).valueOf(),"Array, DenseMatrix":(e,t)=>n(...Qo(r(e),t),o),"DenseMatrix, Array":(e,t)=>n(...Qo(e,r(t)),o)},e.SS&&(s["SparseMatrix, SparseMatrix"]=(t,r)=>e.SS(...Qo(t,r),o,!1)),e.DS&&(s["DenseMatrix, SparseMatrix"]=(t,r)=>e.DS(...Qo(t,r),o,!1),s["Array, SparseMatrix"]=(t,n)=>e.DS(...Qo(r(t),n),o,!1)),a&&(s["SparseMatrix, DenseMatrix"]=(e,t)=>a(...Qo(t,e),o,!0),s["SparseMatrix, Array"]=(e,t)=>a(...Qo(r(t),e),o,!0))):(s={"DenseMatrix, DenseMatrix":t.referToSelf((e=>(t,r)=>n(...Qo(t,r),e))),"Array, Array":t.referToSelf((e=>(t,i)=>n(...Qo(r(t),r(i)),e).valueOf())),"Array, DenseMatrix":t.referToSelf((e=>(t,i)=>n(...Qo(r(t),i),e))),"DenseMatrix, Array":t.referToSelf((e=>(t,i)=>n(...Qo(t,r(i)),e)))},e.SS&&(s["SparseMatrix, SparseMatrix"]=t.referToSelf((t=>(r,n)=>e.SS(...Qo(r,n),t,!1)))),e.DS&&(s["DenseMatrix, SparseMatrix"]=t.referToSelf((t=>(r,n)=>e.DS(...Qo(r,n),t,!1))),s["Array, SparseMatrix"]=t.referToSelf((t=>(n,i)=>e.DS(...Qo(r(n),i),t,!1)))),a&&(s["SparseMatrix, DenseMatrix"]=t.referToSelf((e=>(t,r)=>a(...Qo(r,t),e,!0))),s["SparseMatrix, Array"]=t.referToSelf((e=>(t,n)=>a(...Qo(r(n),t),e,!0)))));const u=e.scalar||"any";(e.Ds||e.Ss)&&(o?(s["DenseMatrix,"+u]=(e,t)=>i(e,t,o,!1),s[u+", DenseMatrix"]=(e,t)=>i(t,e,o,!0),s["Array,"+u]=(e,t)=>i(r(e),t,o,!1).valueOf(),s[u+", Array"]=(e,t)=>i(r(t),e,o,!0).valueOf()):(s["DenseMatrix,"+u]=t.referToSelf((e=>(t,r)=>i(t,r,e,!1))),s[u+", DenseMatrix"]=t.referToSelf((e=>(t,r)=>i(r,t,e,!0))),s["Array,"+u]=t.referToSelf((e=>(t,n)=>i(r(t),n,e,!1).valueOf())),s[u+", Array"]=t.referToSelf((e=>(t,n)=>i(r(n),t,e,!0).valueOf()))));const c=void 0!==e.sS?e.sS:e.Ss;return o?(e.Ss&&(s["SparseMatrix,"+u]=(t,r)=>e.Ss(t,r,o,!1)),c&&(s[u+", SparseMatrix"]=(e,t)=>c(t,e,o,!0))):(e.Ss&&(s["SparseMatrix,"+u]=t.referToSelf((t=>(r,n)=>e.Ss(r,n,t,!1)))),c&&(s[u+", SparseMatrix"]=t.referToSelf((e=>(t,r)=>c(r,t,e,!0))))),o&&o.signatures&&se(s,o.signatures),s}})),ea=he("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s,concat:u}=e;const c=Wo({typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}),l=Zo({typed:t,equalScalar:o}),f=Yo({typed:t}),p=Jo({typed:t,equalScalar:o}),m=To({typed:t,equalScalar:o}),h=Do({typed:t,DenseMatrix:s});return t("mod",{"number, number":function(e,t){return 0===t?e:e-t*c(e/t)},"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(c(e.div(t))))},"bigint, bigint":function(e,t){if(0n===t)return e;if(e<0){const r=e%t;return 0n===r?r:r+t}return e%t},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(c(e.div(t))))}},Ko({typed:t,matrix:i,concat:u})({SS:p,DS:f,SD:l,Ss:m,sS:h}))})),ta=he("matAlgo01xDSid",["typed"],(e=>{let{typed:t}=e;return function(e,r,n,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._values,c=r._index,l=r._ptr,f=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(a.length!==f.length)throw new pn(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1],d="string"==typeof s&&"mixed"!==s&&s===p?s:void 0,g=d?t.find(n,[d,d]):n;let y,x;const b=[];for(y=0;y<m;y++)b[y]=[];const v=[],w=[];for(x=0;x<h;x++){const e=x+1;for(let t=l[x],r=l[x+1],n=t;n<r;n++)y=c[n],v[y]=i?g(u[n],o[y][x]):g(o[y][x],u[n]),w[y]=e;for(y=0;y<m;y++)w[y]===e?b[y][x]=v[y]:b[y][x]=o[y][x]}return e.createDenseMatrix({data:b,size:[m,h],datatype:s===e._datatype&&p===r._datatype?d:void 0})}})),ra=he("matAlgo04xSidSid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new pn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=o&&l?[]:void 0,S=o&&l?[]:void 0,M=[],C=[];let T,D,F,O,B;for(D=0;D<g;D++){E[D]=N.length;const e=D+1;for(O=s[D],B=s[D+1],F=O;F<B;F++)T=a[F],N.push(T),M[T]=e,A&&(A[T]=o[F]);for(O=p[D],B=p[D+1],F=O;F<B;F++)if(T=f[F],M[T]===e){if(A){const e=v(A[T],l[F]);x(e,b)?M[T]=null:A[T]=e}}else N.push(T),C[T]=e,S&&(S[T]=l[F]);if(A&&S)for(F=E[D];F<N.length;)T=N[F],M[T]===e?(w[F]=A[T],F++):C[T]===e?(w[F]=S[T],F++):N.splice(F,1)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),na=he("matAlgo10xSids",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:r}=e;return function(e,n,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,n=t.convert(n,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let r=u[e],n=u[e+1],i=r;i<n;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let r=0;r<f;r++)0===e&&(d[r]=[]),y[r]===t?d[r][e]=o?h(n,g[r]):h(g[r],n):d[r][e]=n}return new r({data:d,size:[f,p],datatype:m})}}));function ia(e,t,r,n){if(!(this instanceof ia))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}ia.prototype=new Error,ia.prototype.constructor=Error,ia.prototype.name="ArgumentsError",ia.prototype.isArgumentsError=!0;const oa="number | BigNumber | Fraction | Matrix | Array",aa=`${oa}, ${oa}, ...${oa}`;function sa(e){return!e.some((e=>Array.isArray(e)))}const ua=he("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,config:n,round:i,equalScalar:o,zeros:a,BigNumber:s,DenseMatrix:u,concat:c}=e;const l=ea({typed:t,config:n,round:i,matrix:r,equalScalar:o,zeros:a,DenseMatrix:u,concat:c}),f=ta({typed:t}),p=ra({typed:t,equalScalar:o}),m=na({typed:t,DenseMatrix:u});return t("gcd",{"number, number":function(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function gcd must be integer numbers");let r;for(;0!==t;)r=l(e,t),e=t,t=r;return e<0?-e:e},"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");const r=new s(0);for(;!t.isZero();){const r=l(e,t);e=t,t=r}return e.lt(r)?e.neg():e},"Fraction, Fraction":(e,t)=>e.gcd(t)},Ko({typed:t,matrix:r,concat:c})({SS:p,DS:f,Ss:m}),{[aa]:t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i})),Array:t.referToSelf((e=>t=>{if(1===t.length&&Array.isArray(t[0])&&sa(t[0]))return e(...t[0]);if(sa(t))return e(...t);throw new ia("gcd() supports only 1d matrices!")})),Matrix:t.referToSelf((e=>t=>e(t.toArray())))})})),ca=he("matAlgo06xS0S0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=n._values,c=n._size,l=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==c.length)throw new pn(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");const f=a[0],p=a[1];let m,h=r,d=0,g=i;"string"==typeof s&&s===l&&"mixed"!==s&&(m=s,h=t.find(r,[m,m]),d=t.convert(0,m),g=t.find(i,[m,m]));const y=o&&u?[]:void 0,x=[],b=[],v=y?[]:void 0,w=[],N=[];for(let t=0;t<p;t++){b[t]=x.length;const r=t+1;if(ti(e,t,w,v,N,r,x,g),ti(n,t,w,v,N,r,x,g),v){let e=b[t];for(;e<x.length;){const t=x[e];if(N[t]===r){const r=v[t];h(r,d)?x.splice(e,1):(y.push(r),e++)}else x.splice(e,1)}}else{let e=b[t];for(;e<x.length;)N[x[e]]!==r?x.splice(e,1):e++}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:s===e._datatype&&l===n._datatype?m:void 0})}})),la=he("lcm",["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,concat:i}=e;const o=Zo({typed:t,equalScalar:n}),a=ca({typed:t,equalScalar:n}),s=To({typed:t,equalScalar:n}),u=Ko({typed:t,matrix:r,concat:i}),c="number | BigNumber | Fraction | Matrix | Array",l={};return l[`${c}, ${c}, ...${c}`]=t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i})),t("lcm",{"number, number":io,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(t.isZero())return t;const r=e.times(t);for(;!t.isZero();){const r=t;t=e.mod(r),e=r}return r.div(e).abs()},"Fraction, Fraction":(e,t)=>e.lcm(t)},u({SS:a,DS:o,Ss:s}),l)})),fa="log10",pa=he(fa,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(fa,{number:function(e){return e>=0||r.predictable?oo(e):new n(e,0).log().div(Math.LN10)},Complex:function(e){return new n(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||r.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),ma="log2",ha=he(ma,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(ma,{number:function(e){return e>=0||r.predictable?ao(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||r.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))});function i(e){const t=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),da=he("multiplyScalar",["typed"],(e=>{let{typed:t}=e;return t("multiplyScalar",{"number, number":Xi,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"bigint, bigint":function(e,t){return e*t},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})})),ga="multiply",ya=he(ga,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(e=>{let{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:o,dot:a}=e;const s=To({typed:t,equalScalar:o}),u=Fo({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}const l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._data,c=r._datatype||r.getDataType(),l=a[0],f=a[1];let p,m=n,h=i;s&&c&&s===c&&"string"==typeof s&&"mixed"!==s&&(p=s,m=t.find(n,[p,p]),h=t.find(i,[p,p]));const d=[];for(let e=0;e<l;e++){const t=o[e];let r=h(t[0],u[0]);for(let e=1;e<f;e++)r=m(r,h(t[e],u[e]));d[e]=r}return e.createDenseMatrix({data:d,size:[l],datatype:s===e._datatype&&c===r._datatype?p:void 0})},"SparseMatrix, any":function(e,r){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=r._data,f=r._datatype||r.getDataType(),p=e._size[0],m=r._size[0],h=[],d=[],g=[];let y,x=n,b=i,v=o,w=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.find(i,[y,y]),v=t.find(o,[y,y]),w=t.convert(0,y));const N=[],E=[];g[0]=0;for(let e=0;e<m;e++){const t=l[e];if(!v(t,w))for(let r=u[e],n=u[e+1],i=r;i<n;i++){const e=s[i];E[e]?N[e]=x(N[e],b(t,a[i])):(E[e]=!0,d.push(e),N[e]=b(t,a[i]))}}for(let e=d.length,t=0;t<e;t++){const e=d[t];h[t]=N[e]}return g[1]=d.length,e.createSparseMatrix({values:h,index:d,ptr:g,size:[p,1],datatype:c===e._datatype&&f===r._datatype?y:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,r){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._data,c=r._size,l=r._datatype||r.getDataType(),f=a[0],p=a[1],m=c[1];let h,d=n,g=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&"mixed"!==s&&(h=s,d=t.find(n,[h,h]),g=t.find(i,[h,h]));const y=[];for(let e=0;e<f;e++){const t=o[e];y[e]=[];for(let r=0;r<m;r++){let n=g(t[0],u[0][r]);for(let e=1;e<p;e++)n=d(n,g(t[e],u[e][r]));y[e][r]=n}}return e.createDenseMatrix({data:y,size:[f,m],datatype:s===e._datatype&&l===r._datatype?h:void 0})},"DenseMatrix, SparseMatrix":function(e,r){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=r._values,l=r._index,f=r._ptr,p=r._size,m=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");const h=s[0],d=p[1];let g,y=n,x=i,b=o,v=0;u&&m&&u===m&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(n,[g,g]),x=t.find(i,[g,g]),b=t.find(o,[g,g]),v=t.convert(0,g));const w=[],N=[],E=[],A=r.createSparseMatrix({values:w,index:N,ptr:E,size:[h,d],datatype:u===e._datatype&&m===r._datatype?g:void 0});for(let e=0;e<d;e++){E[e]=N.length;const t=f[e],r=f[e+1];if(r>t){let e=0;for(let n=0;n<h;n++){const i=n+1;let o;for(let s=t;s<r;s++){const t=l[s];e!==i?(o=x(a[n][t],c[s]),e=i):o=y(o,x(a[n][t],c[s]))}e!==i||b(o,v)||(N.push(n),w.push(o))}}}return E[d]=N.length,A},"SparseMatrix, DenseMatrix":function(e,r){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=r._data,f=r._datatype||r.getDataType(),p=e._size[0],m=r._size[0],h=r._size[1];let d,g=n,y=i,x=o,b=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(d=c,g=t.find(n,[d,d]),y=t.find(i,[d,d]),x=t.find(o,[d,d]),b=t.convert(0,d));const v=[],w=[],N=[],E=e.createSparseMatrix({values:v,index:w,ptr:N,size:[p,h],datatype:c===e._datatype&&f===r._datatype?d:void 0}),A=[],S=[];for(let e=0;e<h;e++){N[e]=w.length;const t=e+1;for(let r=0;r<m;r++){const n=l[r][e];if(!x(n,b))for(let e=u[r],i=u[r+1],o=e;o<i;o++){const e=s[o];S[e]!==t?(S[e]=t,w.push(e),A[e]=y(n,a[o])):A[e]=g(A[e],y(n,a[o]))}}for(let t=N[e],r=w.length,n=t;n<r;n++){const e=w[n];v[n]=A[e]}}return N[h]=w.length,E},"SparseMatrix, SparseMatrix":function(e,r){const o=e._values,a=e._index,s=e._ptr,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=r._values,l=r._index,f=r._ptr,p=r._datatype||void 0===r._data?r._datatype:r.getDataType(),m=e._size[0],h=r._size[1],d=o&&c;let g,y=n,x=i;u&&p&&u===p&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(n,[g,g]),x=t.find(i,[g,g]));const b=d?[]:void 0,v=[],w=[],N=e.createSparseMatrix({values:b,index:v,ptr:w,size:[m,h],datatype:u===e._datatype&&p===r._datatype?g:void 0}),E=d?[]:void 0,A=[];let S,M,C,T,D,F,O,B;for(let e=0;e<h;e++){w[e]=v.length;const t=e+1;for(D=f[e],F=f[e+1],T=D;T<F;T++)if(B=l[T],d)for(M=s[B],C=s[B+1],S=M;S<C;S++)O=a[S],A[O]!==t?(A[O]=t,v.push(O),E[O]=x(c[T],o[S])):E[O]=y(E[O],x(c[T],o[S]));else for(M=s[B],C=s[B+1],S=M;S<C;S++)O=a[S],A[O]!==t&&(A[O]=t,v.push(O));if(d)for(let t=w[e],r=v.length,n=t;n<r;n++){const e=v[n];b[n]=E[e]}}return w[h]=v.length,N}});return t(ga,i,{"Array, Array":t.referTo("Matrix, Matrix",(e=>(t,n)=>{c(hn(t),hn(n));const i=e(r(t),r(n));return E(i)?i.valueOf():i})),"Matrix, Matrix":function(e,r){const o=e.size(),s=r.size();return c(o,s),1===o.length?1===s.length?function(e,t,r){if(0===r)throw new Error("Cannot multiply two empty vectors");return a(e,t)}(e,r,o[0]):function(e,r){if("dense"!==r.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,r){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._data,c=r._size,l=r._datatype||r.getDataType(),f=a[0],p=c[1];let m,h=n,d=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(m=s,h=t.find(n,[m,m]),d=t.find(i,[m,m]));const g=[];for(let e=0;e<p;e++){let t=d(o[0],u[0][e]);for(let r=1;r<f;r++)t=h(t,d(o[r],u[r][e]));g[e]=t}return e.createDenseMatrix({data:g,size:[p],datatype:s===e._datatype&&l===r._datatype?m:void 0})}(e,r)}(e,r):1===s.length?l(e,r):f(e,r)},"Matrix, Array":t.referTo("Matrix,Matrix",(e=>(t,n)=>e(t,r(n)))),"Array, Matrix":t.referToSelf((e=>(t,n)=>e(r(t,n.storage()),n))),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return u(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return u(t,e,i,!0)},"Array, any":function(e,t){return u(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i}))})})),xa="nthRoot",ba=he(xa,["typed","matrix","equalScalar","BigNumber","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,BigNumber:i,concat:o}=e;const a=ta({typed:t}),s=Zo({typed:t,equalScalar:n}),u=ca({typed:t,equalScalar:n}),c=To({typed:t,equalScalar:n}),l=Ko({typed:t,matrix:r,concat:o});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(xa,{number:so,"number, number":so,BigNumber:e=>p(e,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:t.referTo("DenseMatrix,number",(e=>t=>e(r(t),2).valueOf())),DenseMatrix:t.referTo("DenseMatrix,number",(e=>t=>e(t,2))),SparseMatrix:t.referTo("SparseMatrix,number",(e=>t=>e(t,2))),"SparseMatrix, SparseMatrix":t.referToSelf((e=>(t,r)=>{if(1===r.density())return u(t,r,e);throw new Error("Root must be non-zero")})),"DenseMatrix, SparseMatrix":t.referToSelf((e=>(t,r)=>{if(1===r.density())return a(t,r,e,!1);throw new Error("Root must be non-zero")})),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",(e=>(t,n)=>e(r(t),n))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>{if(1===r.density())return c(r,t,e,!0);throw new Error("Root must be non-zero")}))},l({scalar:"number | BigNumber",SD:s,Ss:c,sS:!1}));function p(e,t){const r=i.precision,n=i.clone({precision:r+2}),o=new i(0),a=new n(1),s=t.isNegative();if(s&&(t=t.neg()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return s?new n(1/0):0;if(!e.isFinite())return s?o:e;let u=e.abs().pow(a.div(t));return u=e.isNeg()?u.neg():u,new i((s?a.div(u):u).toPrecision(r))}})),va="sign",wa=he(va,["typed","BigNumber","Fraction","complex"],(e=>{let{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t(va,{number:uo,Complex:function(e){return 0===e.im?n(uo(e.re)):e.sign()},BigNumber:function(e){return new r(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return new i(e.s,1)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0))),Unit:t.referToSelf((e=>r=>{if(!r._isDerived()&&0!==r.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return t.find(e,r.valueType())(r.value)}))})})),Na=he("sqrt",["config","typed","Complex"],(e=>{let{config:t,typed:r,Complex:n}=e;return r("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new n(e,0).sqrt()}})),Ea="square",Aa=he(Ea,["typed"],(e=>{let{typed:t}=e;return t(Ea,{number:co,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},bigint:function(e){return e*e},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})})),Sa="subtract",Ma=he(Sa,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:o,DenseMatrix:a,concat:s}=e;const u=ta({typed:t}),c=Yo({typed:t}),l=Jo({typed:t,equalScalar:n}),f=na({typed:t,DenseMatrix:a}),p=Do({typed:t,DenseMatrix:a}),m=Ko({typed:t,matrix:r,concat:s});return t(Sa,{"any, any":i},m({elop:i,SS:l,DS:u,SD:c,Ss:p,sS:f}))})),Ca="xgcd",Ta=he(Ca,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(Ca,{"number, number":function(e,t){const i=lo(e,t);return"Array"===r.matrix?i:n(i)},"BigNumber, BigNumber":function(e,t){let o,a,s;const u=new i(0),c=new i(1);let l,f=u,p=c,m=c,h=u;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)a=e.div(t).floor(),s=e.mod(t),o=f,f=p.minus(a.times(f)),p=o,o=m,m=h.minus(a.times(m)),h=o,e=t,t=s;return l=e.lt(u)?[e.neg(),p.neg(),h.neg()]:[e,e.isZero()?0:p,h],"Array"===r.matrix?l:n(l)}})})),Da="invmod",Fa=he(Da,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(e=>{let{typed:t,config:r,BigNumber:n,xgcd:i,equal:o,smaller:a,mod:s,add:u,isInteger:c}=e;return t(Da,{"number, number":l,"BigNumber, BigNumber":l});function l(e,t){if(!c(e)||!c(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=s(e,t),o(t,0))throw new Error("Divisor must be non zero");let r=i(e,t);r=r.valueOf();let[l,f]=r;return o(l,n(1))?(f=s(f,t),a(f,n(0))&&(f=u(f,t)),f):NaN}})),Oa=he("matAlgo09xS0Sf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new pn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=[];let M,C,T,D,F;for(C=0;C<g;C++){E[C]=N.length;const e=C+1;if(A)for(D=p[C],F=p[C+1],T=D;T<F;T++)M=f[T],S[M]=e,A[M]=l[T];for(D=s[C],F=s[C+1],T=D;T<F;T++)if(M=a[T],A){const t=S[M]===e?A[M]:b,r=v(o[T],t);x(r,b)||(N.push(M),w.push(r))}else N.push(M)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),Ba="dotMultiply",_a=he(Ba,["typed","matrix","equalScalar","multiplyScalar","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,multiplyScalar:i,concat:o}=e;const a=Zo({typed:t,equalScalar:n}),s=Oa({typed:t,equalScalar:n}),u=To({typed:t,equalScalar:n}),c=Ko({typed:t,matrix:r,concat:o});return t(Ba,c({elop:i,SS:s,DS:a,Ss:u}))}));function za(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");const r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return Ra(e,t,(function(e,t){return e&t}))}function Ia(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");const t=e.constructor,r=t.precision;t.config({precision:1e9});const n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function ka(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");const r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);const n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:e.isFinite()&&t.isFinite()?Ra(e,t,(function(e,t){return e|t})):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function Ra(e,t,r){const n=e.constructor;let i,o;const a=+(e.s<0),s=+(t.s<0);if(a){i=qa(Ia(e));for(let e=0;e<i.length;++e)i[e]^=1}else i=qa(e);if(s){o=qa(Ia(t));for(let e=0;e<o.length;++e)o[e]^=1}else o=qa(t);let u,c,l;i.length<=o.length?(u=i,c=o,l=a):(u=o,c=i,l=s);let f=u.length,p=c.length;const m=1^r(a,s);let h=new n(1^m),d=new n(1);const g=new n(2),y=n.precision;for(n.config({precision:1e9});f>0;)r(u[--f],c[--p])===m&&(h=h.plus(d)),d=d.times(g);for(;p>0;)r(l,c[--p])===m&&(h=h.plus(d)),d=d.times(g);return n.config({precision:y}),0===m&&(h.s=-h.s),h}function qa(e){const t=e.d;let r=t[0]+"";for(let e=1;e<t.length;++e){let n=t[e]+"";for(let e=7-n.length;e--;)n="0"+n;r+=n}let n=r.length;for(;"0"===r.charAt(n);)n--;let i=e.e,o=r.slice(0,n+1||1);const a=o.length;if(i>0)if(++i>a)for(i-=a;i--;)o+="0";else i<a&&(o=o.slice(0,i)+"."+o.slice(i));const s=[0];for(let e=0;e<o.length;){let t=s.length;for(;t--;)s[t]*=10;s[0]+=parseInt(o.charAt(e++));for(let e=0;e<s.length;++e)s[e]>1&&(null!==s[e+1]&&void 0!==s[e+1]||(s[e+1]=0),s[e+1]+=s[e]>>1,s[e]&=1)}return s.reverse()}function Pa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");const r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);const n=new r(-1);return e.eq(n)?Ia(t):t.eq(n)?Ia(e):e.isFinite()&&t.isFinite()?Ra(e,t,(function(e,t){return e^t})):e.isFinite()||t.isFinite()?new r(e.isNegative()===t.isNegative()?1/0:-1/0):n}function ja(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");const r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t)):new r(NaN)}function Ua(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");const r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}const La="number, number";function $a(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitAnd");return e&t}function Ha(e){if(!ye(e))throw new Error("Integer expected in function bitNot");return~e}function Ga(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitOr");return e|t}function Va(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitXor");return e^t}function Wa(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function leftShift");return e<<t}function Za(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightArithShift");return e>>t}function Ya(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}$a.signature=La,Ha.signature="number",Ga.signature=La,Va.signature=La,Wa.signature=La,Za.signature=La,Ya.signature=La;const Ja="bitAnd",Xa=he(Ja,["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,concat:i}=e;const o=Zo({typed:t,equalScalar:n}),a=ca({typed:t,equalScalar:n}),s=To({typed:t,equalScalar:n}),u=Ko({typed:t,matrix:r,concat:i});return t(Ja,{"number, number":$a,"BigNumber, BigNumber":za,"bigint, bigint":(e,t)=>e&t},u({SS:a,DS:o,Ss:s}))})),Qa="bitNot",Ka=he(Qa,["typed"],(e=>{let{typed:t}=e;return t(Qa,{number:Ha,BigNumber:Ia,bigint:e=>~e,"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),es="bitOr",ts=he(es,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=ta({typed:t}),s=ra({typed:t,equalScalar:n}),u=na({typed:t,DenseMatrix:i}),c=Ko({typed:t,matrix:r,concat:o});return t(es,{"number, number":Ga,"BigNumber, BigNumber":ka,"bigint, bigint":(e,t)=>e|t},c({SS:s,DS:a,Ss:u}))})),rs=he("matAlgo07xSSf",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:r}=e;return function(e,i,o){const a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=i._size,c=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(a.length!==u.length)throw new pn(a.length,u.length);if(a[0]!==u[0]||a[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+u+")");const l=a[0],f=a[1];let p,m,h,d=0,g=o;"string"==typeof s&&s===c&&"mixed"!==s&&(p=s,d=t.convert(0,p),g=t.find(o,[p,p]));const y=[];for(m=0;m<l;m++)y[m]=[];const x=[],b=[],v=[],w=[];for(h=0;h<f;h++){const t=h+1;for(n(e,h,v,x,t),n(i,h,w,b,t),m=0;m<l;m++){const e=v[m]===t?x[m]:d,r=w[m]===t?b[m]:d;y[m][h]=g(e,r)}}return new r({data:y,size:[l,f],datatype:s===e._datatype&&c===i._datatype?p:void 0})};function n(e,t,r,n,i){const o=e._values,a=e._index,s=e._ptr;for(let e=s[t],u=s[t+1];e<u;e++){const t=a[e];r[t]=i,n[t]=o[e]}}})),ns="bitXor",is=he(ns,["typed","matrix","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,DenseMatrix:n,concat:i}=e;const o=Yo({typed:t}),a=rs({typed:t,DenseMatrix:n}),s=Do({typed:t,DenseMatrix:n}),u=Ko({typed:t,matrix:r,concat:i});return t(ns,{"number, number":Va,"BigNumber, BigNumber":Pa,"bigint, bigint":(e,t)=>e^t},u({SS:a,DS:o,Ss:s}))})),os=he("arg",["typed"],(e=>{let{typed:t}=e;return t("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),as="conj",ss=he(as,["typed"],(e=>{let{typed:t}=e;return t(as,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),us=he("im",["typed"],(e=>{let{typed:t}=e;return t("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),cs=he("re",["typed"],(e=>{let{typed:t}=e;return t("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),ls="number, number";function fs(e){return!e}function ps(e,t){return!(!e&&!t)}function ms(e,t){return!!e!=!!t}function hs(e,t){return!(!e||!t)}fs.signature="number",ps.signature=ls,ms.signature=ls,hs.signature=ls;const ds=he("not",["typed"],(e=>{let{typed:t}=e;return t("not",{"null | undefined":()=>!0,number:fs,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),gs=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=Yo({typed:t}),s=Jo({typed:t,equalScalar:n}),u=Do({typed:t,DenseMatrix:i}),c=Ko({typed:t,matrix:r,concat:o});return t("or",{"number, number":ps,"Complex, Complex":function(e,t){return 0!==e.re||0!==e.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"bigint, bigint":ps,"Unit, Unit":t.referToSelf((e=>(t,r)=>e(t.value||0,r.value||0)))},c({SS:s,DS:a,Ss:u}))})),ys=he("xor",["typed","matrix","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,DenseMatrix:n,concat:i}=e;const o=Yo({typed:t}),a=rs({typed:t,DenseMatrix:n}),s=Do({typed:t,DenseMatrix:n}),u=Ko({typed:t,matrix:r,concat:i});return t("xor",{"number, number":ms,"Complex, Complex":function(e,t){return(0!==e.re||0!==e.im)!=(0!==t.re||0!==t.im)},"bigint, bigint":ms,"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf((e=>(t,r)=>e(t.value||0,r.value||0)))},u({SS:a,DS:o,Ss:s}))})),xs="concat",bs=he(xs,["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:r,isInteger:n}=e;return t(xs,{"...Array | Matrix | number | BigNumber":function(e){let t;const i=e.length;let o,a=-1,s=!1;const u=[];for(t=0;t<i;t++){const r=e[t];if(E(r)&&(s=!0),d(r)||g(r)){if(t!==i-1)throw new Error("Dimension must be specified as last argument");if(o=a,a=r.valueOf(),!n(a))throw new TypeError("Integer number expected for dimension");if(a<0||t>0&&a>o)throw new mn(a,o+1)}else{const e=ae(r).valueOf(),n=hn(e);if(u[t]=e,o=a,a=n.length-1,t>0&&a!==o)throw new pn(o+1,a+1)}}if(0===u.length)throw new SyntaxError("At least one matrix expected");let c=u.shift();for(;u.length;)c=qn(c,u.shift(),a);return s?r(c):c},"...string":function(e){return e.join("")}})})),vs="column",ws=he(vs,["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;return t(vs,{"Matrix, number":o,"Array, number":function(e,t){return o(n(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");xn(t,e.size()[1]);const o=i(0,e.size()[0]),a=new r(o,t),s=e.subset(a);return E(s)?s:n([[s]])}})),Ns="count",Es=he(Ns,["typed","size","prod"],(e=>{let{typed:t,size:r,prod:n}=e;return t(Ns,{string:function(e){return e.length},"Matrix | Array":function(e){return n(r(e))}})})),As="cross",Ss=he(As,["typed","matrix","subtract","multiply"],(e=>{let{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(As,{"Matrix, Matrix":function(e,t){return r(o(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(o(e.toArray(),t))},"Array, Matrix":function(e,t){return r(o(e,t.toArray()))},"Array, Array":o});function o(e,t){const r=Math.max(hn(e).length,hn(t).length);e=Sn(e),t=Sn(t);const o=hn(e),a=hn(t);if(1!==o.length||1!==a.length||3!==o[0]||3!==a[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+a.join(", ")+"])");const s=[n(i(e[1],t[2]),i(e[2],t[1])),n(i(e[2],t[0]),i(e[0],t[2])),n(i(e[0],t[1]),i(e[1],t[0]))];return r>1?[s]:s}})),Ms="diag",Cs=he(Ms,["typed","matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(Ms,{Array:function(e){return o(e,0,hn(e),null)},"Array, number":function(e,t){return o(e,t,hn(e),null)},"Array, BigNumber":function(e,t){return o(e,t.toNumber(),hn(e),null)},"Array, string":function(e,t){return o(e,0,hn(e),t)},"Array, number, string":function(e,t,r){return o(e,t,hn(e),r)},"Array, BigNumber, string":function(e,t,r){return o(e,t.toNumber(),hn(e),r)},Matrix:function(e){return o(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return o(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return o(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return o(e,0,e.size(),t)},"Matrix, number, string":function(e,t,r){return o(e,t,e.size(),r)},"Matrix, BigNumber, string":function(e,t,r){return o(e,t.toNumber(),e.size(),r)}});function o(e,t,o,a){if(!ye(t))throw new TypeError("Second parameter in function diag must be an integer");const s=t>0?t:0,u=t<0?-t:0;switch(o.length){case 1:return function(e,t,r,o,a,s){const u=[o+a,o+s];if(r&&"sparse"!==r&&"dense"!==r)throw new TypeError(`Unknown matrix type ${r}"`);const c="sparse"===r?i.diagonal(u,e,t):n.diagonal(u,e,t);return null!==r?c:c.valueOf()}(e,t,a,o[0],u,s);case 2:return function(e,t,n,i,o,a){if(E(e)){const i=e.diagonal(t);return null!==n?n!==i.storage()?r(i,n):i:i.valueOf()}const s=Math.min(i[0]-o,i[1]-a),u=[];for(let t=0;t<s;t++)u[t]=e[t+o][t+a];return null!==n?r(u):u}(e,t,a,o,u,s)}throw new RangeError("Matrix for function diag must be 2 dimensional")}})),Ts=he("filter",["typed"],(e=>{let{typed:t}=e;return t("filter",{"Array, function":Ds,"Matrix, function":function(e,t){return e.create(Ds(e.valueOf(),t),e.datatype())},"Array, RegExp":Bn,"Matrix, RegExp":function(e,t){return e.create(Bn(e.valueOf(),t),e.datatype())}})}));function Ds(e,t){const r=Hn(t,e,"filter");return function(e){if(1!==hn(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(function(e,t,n){return r(e,[t],n)}))}(e)}const Fs="flatten",Os=he(Fs,["typed"],(e=>{let{typed:t}=e;return t(Fs,{Array:function(e){return Dn(e)},Matrix:function(e){return e.create(Dn(e.toArray()),e.datatype())}})})),Bs="forEach",_s=he(Bs,["typed"],(e=>{let{typed:t}=e;return t(Bs,{"Array, function":zs,"Matrix, function":function(e,t){e.forEach(t)}})}));function zs(e,t){$n(e,[],e,Hn(t,e,Bs))}const Is="getMatrixDataType",ks=he(Is,["typed"],(e=>{let{typed:t}=e;return t(Is,{Array:function(e){return kn(e,oe)},Matrix:function(e){return e.getDataType()}})})),Rs="identity",qs=he(Rs,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:a}=e;return t(Rs,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return u(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return u(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return u(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return u(e,t,r)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return u(e[0],e[0],t);case 2:return u(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function u(e,t,r){const n=g(e)||g(t)?i:null;if(g(e)&&(e=e.toNumber()),g(t)&&(t=t.toNumber()),!ye(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!ye(t)||t<1)throw new Error("Parameters in function identity must be positive integers");const s=n?new i(1):1,u=n?new n(0):0,c=[e,t];if(r){if("sparse"===r)return a.diagonal(c,s,0,u);if("dense"===r)return o.diagonal(c,s,0,u);throw new TypeError(`Unknown matrix type "${r}"`)}const l=vn([],c,u),f=e<t?e:t;for(let e=0;e<f;e++)l[e][e]=s;return l}})),Ps="kron",js=he(Ps,["typed","matrix","multiplyScalar"],(e=>{let{typed:t,matrix:r,multiplyScalar:n}=e;return t(Ps,{"Matrix, Matrix":function(e,t){return r(i(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(i(e.toArray(),t))},"Array, Matrix":function(e,t){return r(i(e,t.toArray()))},"Array, Array":i});function i(e,t){if(1===hn(e).length&&(e=[e]),1===hn(t).length&&(t=[t]),hn(e).length>2||hn(t).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(t.length)+")");const r=[];let i=[];return e.map((function(e){return t.map((function(t){return i=[],r.push(i),e.map((function(e){return t.map((function(t){return i.push(n(e,t))}))}))}))}))&&r}})),Us="map",Ls=he(Us,["typed"],(e=>{let{typed:t}=e;return t(Us,{"Array, function":r,"Matrix, function":function(e,t){return e.map(t)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,n,i)=>function(e,n){if("function"!=typeof n)throw new Error("Last argument must be a callback function");const i=e[0].isMatrix,o=Pn(...e.map((e=>e.isMatrix?e.size():hn(e)))),a=i?(e,t)=>e.get(t):Ln,s=i?e.map((t=>t.isMatrix?t.create(Un(t.toArray(),o),t.datatype()):e[0].create(Un(t.valueOf(),o)))):e.map((e=>e.isMatrix?Un(e.toArray(),o):Un(e,o)));let u;if(t.isTypedFunction(n)){const e=o.map((()=>0)),r=s.map((t=>a(t,e))),i=function(e,r,n,i){return null!==t.resolve(e,[...r,n,...i])?2:null!==t.resolve(e,[...r,n])?1:(t.resolve(e,r),0)}(n,r,e,s);u=l(i)}else{const t=e.length,r=function(e,t){return e.length>t+1?2:e.length===t+1?1:0}(n,t);u=l(r)}const c=(e,t)=>u([e,...s.slice(1).map((e=>a(e,t)))],t);return i?s[0].map(c):r(s[0],c);function l(e){switch(e){case 0:return e=>n(...e);case 1:return(e,t)=>n(...e,t);case 2:return(e,t)=>n(...e,t,...s)}}}([e,n,...i.slice(0,i.length-1)],i[i.length-1])});function r(e,t){return $n(e,[],e,Hn(t,e,Us))}})),$s="diff",Hs=he($s,["typed","matrix","subtract","number"],(e=>{let{typed:t,matrix:r,subtract:n,number:i}=e;return t($s,{"Array | Matrix":function(e){return E(e)?r(a(e.toArray())):a(e)},"Array | Matrix, number":function(e,t){if(!ye(t))throw new RangeError("Dimension must be a whole number");return E(e)?r(o(e.toArray(),t)):o(e,t)},"Array, BigNumber":t.referTo("Array,number",(e=>(t,r)=>e(t,i(r)))),"Matrix, BigNumber":t.referTo("Matrix,number",(e=>(t,r)=>e(t,i(r))))});function o(e,t){if(E(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){const r=[];return e.forEach((e=>{r.push(o(e,t-1))})),r}if(0===t)return a(e);throw RangeError("Cannot have negative dimension")}function a(e){const t=[],r=e.length;for(let n=1;n<r;n++)t.push(s(e[n-1],e[n]));return t}function s(e,t){E(e)&&(e=e.toArray()),E(t)&&(t=t.toArray());const r=Array.isArray(e),i=Array.isArray(t);if(r&&i)return function(e,t){if(e.length!==t.length)throw RangeError("Not all sub-arrays have the same length");const r=[],n=e.length;for(let i=0;i<n;i++)r.push(s(e[i],t[i]));return r}(e,t);if(!r&&!i)return n(t,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}})),Gs=he("ones",["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i}=e;return t("ones",{"":function(){return"Array"===r.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===r.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const r=function(e){let t=!1;return e.forEach((function(e,r,n){g(e)&&(t=!0,n[r]=e.toNumber())})),t}(e),o=r?new i(1):1;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}))}(e),t){const r=n(t);return e.length>0?r.resize(e,o):r}{const t=[];return e.length>0?vn(t,e,o):t}}}));function Vs(){throw new Error('No "bignumber" implementation available')}function Ws(){throw new Error('No "fraction" implementation available')}function Zs(){throw new Error('No "matrix" implementation available')}const Ys="range",Js=he(Ys,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:r,matrix:n,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;return t(Ys,{string:p,"string, boolean":p,"number, number":function(e,t){return f(m(e,t,1,!1))},"number, number, number":function(e,t,r){return f(m(e,t,r,!1))},"number, number, boolean":function(e,t,r){return f(m(e,t,1,r))},"number, number, number, boolean":function(e,t,r,n){return f(m(e,t,r,n))},"BigNumber, BigNumber":function(e,t){return f(m(e,t,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return f(m(e,t,r,!1))},"BigNumber, BigNumber, boolean":function(e,t,r){return f(m(e,t,new(0,e.constructor)(1),r))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return f(m(e,t,r,n))},"Unit, Unit, Unit":function(e,t,r){return f(m(e,t,r,!1))},"Unit, Unit, Unit, boolean":function(e,t,r,n){return f(m(e,t,r,n))}});function f(e){return"Matrix"===r.matrix?n?n(e):Zs():e}function p(e,t){const n=function(e){const t=e.split(":").map((function(e){return Number(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}(e);if(!n)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===r.number?(void 0===i&&Vs(),f(m(i(n.start),i(n.end),i(n.step)))):f(m(n.start,n.end,n.step,t))}function m(e,t,r,n){const i=[],f=l(r)?n?a:o:n?u:s;let p=e;for(;f(p,t);)i.push(p),p=c(p,r);return i}})),Xs="reshape",Qs=he(Xs,["typed","isInteger","matrix"],(e=>{let{typed:t,isInteger:r}=e;return t(Xs,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach((function(e){if(!r(e))throw new TypeError("Invalid size for dimension: "+e)})),Nn(e,t)}})})),Ks=he("resize",["config","matrix"],(e=>{let{config:t,matrix:r}=e;return function(e,n,i){if(2!==arguments.length&&3!==arguments.length)throw new ia("resize",arguments.length,2,3);if(E(n)&&(n=n.valueOf()),g(n[0])&&(n=n.map((function(e){return g(e)?e.toNumber():e}))),E(e))return e.resize(n,i,!0);if("string"==typeof e)return function(e,t,r){if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(1!==t.length)throw new pn(t.length,1);const n=t[0];if("number"!=typeof n||!ye(n))throw new TypeError("Invalid size, must contain positive integers (size: "+an(t)+")");if(e.length>n)return e.substring(0,n);if(e.length<n){let t=e;for(let i=0,o=n-e.length;i<o;i++)t+=r;return t}return e}(e,n,i);const o=!Array.isArray(e)&&"Array"!==t.matrix;if(0===n.length){for(;Array.isArray(e);)e=e[0];return ae(e)}{Array.isArray(e)||(e=[e]);const t=vn(e=ae(e),n,i);return o?r(t):t}}})),eu="rotate",tu=he(eu,["typed","multiply","rotationMatrix"],(e=>{let{typed:t,multiply:r,rotationMatrix:n}=e;return t(eu,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),r(n(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),r(n(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),r(n(t,o),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),r(n(t,o),e)}});function i(e,t){const r=Array.isArray(e)?hn(e):e.size();if(r.length>2)throw new RangeError(`Vector must be of dimensions 1x${t}`);if(2===r.length&&1!==r[1])throw new RangeError(`Vector must be of dimensions 1x${t}`);if(r[0]!==t)throw new RangeError(`Vector must be of dimensions 1x${t}`)}})),ru="rotationMatrix",nu=he(ru,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(e=>{let{typed:t,config:r,multiplyScalar:n,addScalar:i,unaryMinus:o,norm:a,BigNumber:s,matrix:u,DenseMatrix:c,SparseMatrix:l,cos:f,sin:p}=e;return t(ru,{"":function(){return"Matrix"===r.matrix?u([]):[]},string:function(e){return u(e)},"number | BigNumber | Complex | Unit":function(e){return m(e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return m(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){const r=u(t);return h(r),x(e,r,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){h(t);const n=t.storage()||("Matrix"===r.matrix?"dense":void 0);return x(e,t,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,r){const n=u(t);return h(n),x(e,n,r)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,r){return h(t),x(e,t,r)}});function m(e,t){const r=g(e)?new s(-1):-1,i=f(e),o=p(e);return y([[i,n(r,o)],[o,i]],t)}function h(e){const t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function d(e){return e.reduce(((e,t)=>n(e,t)))}function y(e,t){if(t){if("sparse"===t)return new l(e);if("dense"===t)return new c(e);throw new TypeError(`Unknown matrix type "${t}"`)}return e}function x(e,t,r){const n=a(t);if(0===n)throw new RangeError("Rotation around zero vector");const u=g(e)?s:null,c=u?new u(1):1,l=u?new u(-1):-1,m=u?new u(t.get([0])/n):t.get([0])/n,h=u?new u(t.get([1])/n):t.get([1])/n,x=u?new u(t.get([2])/n):t.get([2])/n,b=f(e),v=i(c,o(b)),w=p(e);return y([[i(b,d([m,m,v])),i(d([m,h,v]),d([l,x,w])),i(d([m,x,v]),d([h,w]))],[i(d([m,h,v]),d([x,w])),i(b,d([h,h,v])),i(d([h,x,v]),d([l,m,w]))],[i(d([m,x,v]),d([l,h,w])),i(d([h,x,v]),d([m,w])),i(b,d([x,x,v]))]],r)}})),iu=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;return t("row",{"Matrix, number":o,"Array, number":function(e,t){return o(n(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");xn(t,e.size()[0]);const o=i(0,e.size()[1]),a=new r(t,o),s=e.subset(a);return E(s)?s:n([[s]])}})),ou="size",au=he(ou,["typed","config","?matrix"],(e=>{let{typed:t,config:r,matrix:n}=e;return t(ou,{Matrix:function(e){return e.create(e.size(),"number")},Array:hn,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([],"dense","number"):Zs()}})})),su="squeeze",uu=he(su,["typed"],(e=>{let{typed:t}=e;return t(su,{Array:function(e){return Sn(ae(e))},Matrix:function(e){const t=Sn(e.toArray());return Array.isArray(t)?e.create(t,e.datatype()):t},any:function(e){return ae(e)}})})),cu="subset",lu=he(cu,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:r,zeros:n,add:i}=e;return t(cu,{"Matrix, Index":function(e,t){return bn(t)?r():(yn(e,t),e.subset(t))},"Array, Index":t.referTo("Matrix, Index",(function(e){return function(t,n){const i=e(r(t),n);return n.isScalar()?i:i.valueOf()}})),"Object, Index":mu,"string, Index":fu,"Matrix, Index, any, any":function(e,t,r,o){return bn(t)?e:(yn(e,t),e.clone().subset(t,function(e,t){if("string"==typeof e)throw new Error("can't boradcast a string");if(t._isScalar)return e;const r=t.size();if(!r.every((e=>e>0)))return e;try{return i(e,n(r))}catch(t){return e}}(r,t),o))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,n,i,o){const a=e(r(t),n,i,o);return a.isMatrix?a.valueOf():a}})),"Array, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,n,i){return e(r(t),n,i,void 0).valueOf()}})),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,n){return e(t,r,n,void 0)}})),"string, Index, string":pu,"string, Index, string, string":pu,"Object, Index, any":hu})}));function fu(e,t){if(!T(t))throw new TypeError("Index expected");if(bn(t))return"";if(yn(Array.from(e),t),1!==t.size().length)throw new pn(t.size().length,1);const r=e.length;xn(t.min()[0],r),xn(t.max()[0],r);const n=t.dimension(0);let i="";return n.forEach((function(t){i+=e.charAt(t)})),i}function pu(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(bn(t))return e;if(yn(Array.from(e),t),1!==t.size().length)throw new pn(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";const i=t.dimension(0);if(i.size()[0]!==r.length)throw new pn(i.size()[0],r.length);const o=e.length;xn(t.min()[0]),xn(t.max()[0]);const a=[];for(let t=0;t<o;t++)a[t]=e.charAt(t);if(i.forEach((function(e,t){a[e]=r.charAt(t[0])})),a.length>o)for(let e=o-1,t=a.length;e<t;e++)a[e]||(a[e]=n);return a.join("")}function mu(e,t){if(bn(t))return;if(1!==t.size().length)throw new pn(t.size(),1);const r=t.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");return i(e,r)}function hu(e,t,r){if(bn(t))return e;if(1!==t.size().length)throw new pn(t.size(),1);const n=t.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");const i=ae(e);return o(i,n,r),i}const du="transpose",gu=he(du,["typed","matrix"],(e=>{let{typed:t,matrix:r}=e;return t(du,{Array:e=>n(r(e)).valueOf(),Matrix:n,any:ae});function n(e){const t=e.size();let r;switch(t.length){case 1:r=e.clone();break;case 2:{const n=t[0],i=t[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+an(t)+")");switch(e.storage()){case"dense":r=function(e,t,r){const n=e._data,i=[];let o;for(let e=0;e<r;e++){o=i[e]=[];for(let r=0;r<t;r++)o[r]=ae(n[r][e])}return e.createDenseMatrix({data:i,size:[r,t],datatype:e._datatype})}(e,n,i);break;case"sparse":r=function(e,t,r){const n=e._values,i=e._index,o=e._ptr,a=n?[]:void 0,s=[],u=[],c=[];for(let e=0;e<t;e++)c[e]=0;let l,f,p;for(l=0,f=i.length;l<f;l++)c[i[l]]++;let m=0;for(let e=0;e<t;e++)u.push(m),m+=c[e],c[e]=u[e];for(u.push(m),p=0;p<r;p++)for(let e=o[p],t=o[p+1],r=e;r<t;r++){const e=c[i[r]]++;s[e]=p,n&&(a[e]=ae(n[r]))}return e.createSparseMatrix({values:a,index:s,ptr:u,size:[r,t],datatype:e._datatype})}(e,n,i)}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+an(t)+")")}return r}})),yu="ctranspose",xu=he(yu,["typed","transpose","conj"],(e=>{let{typed:t,transpose:r,conj:n}=e;return t(yu,{any:function(e){return n(r(e))}})})),bu="zeros",vu=he(bu,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(bu,{"":function(){return"Array"===r.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===r.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const r=function(e){let t=!1;return e.forEach((function(e,r,n){g(e)&&(t=!0,n[r]=e.toNumber())})),t}(e),o=r?new i(0):0;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}))}(e),t){const r=n(t);return e.length>0?r.resize(e,o):r}{const t=[];return e.length>0?vn(t,e,o):t}}})),wu=he("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(e=>{let{typed:t,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:o,exp:a,tau:s,i:u,dotDivide:c,conj:l,pow:f,ceil:p,log2:m}=e;return t("fft",{Array:h,Matrix:function(e){return e.create(h(e.valueOf()),e.datatype())}});function h(e){const t=hn(e);return 1===t.length?g(e,t[0]):d(e.map((e=>h(e,t.slice(1)))),0)}function d(e,t){const r=hn(e);if(0!==t)return new Array(r[0]).fill(0).map(((r,n)=>d(e[n],t-1)));if(1===r.length)return g(e);function n(e){const t=hn(e);return new Array(t[1]).fill(0).map(((r,n)=>new Array(t[0]).fill(0).map(((t,r)=>e[r][n]))))}return n(d(n(e),1))}function g(e){const t=e.length;if(1===t)return[e[0]];if(t%2==0){const r=[...g(e.filter(((e,t)=>t%2==0))),...g(e.filter(((e,t)=>t%2==1)))];for(let e=0;e<t/2;e++){const c=r[e],l=i(r[e+t/2],a(i(i(s,u),o(-e,t))));r[e]=n(c,l),r[e+t/2]=n(c,i(-1,l))}return r}return function(e){const t=e.length,r=a(o(i(-1,i(u,s)),t)),n=[];for(let e=1-t;e<t;e++)n.push(f(r,o(f(e,2),2)));const d=f(2,p(m(t+t-1))),y=[...new Array(t).fill(0).map(((r,o)=>i(e[o],n[t-1+o]))),...new Array(d-t).fill(0)],x=[...new Array(t+t-1).fill(0).map(((e,t)=>o(1,n[t]))),...new Array(d-(t+t-1)).fill(0)],b=g(y),v=g(x),w=new Array(d).fill(0).map(((e,t)=>i(b[t],v[t]))),N=c(l(h(l(w))),d),E=[];for(let e=t-1;e<t+t-1;e++)E.push(i(N[e],n[e]));return E}(e)}})),Nu="ifft",Eu=he(Nu,["typed","fft","dotDivide","conj"],(e=>{let{typed:t,fft:r,dotDivide:n,conj:i}=e;return t(Nu,{"Array | Matrix":function(e){const t=E(e)?e.size():hn(e);return n(i(r(i(e))),t.reduce(((e,t)=>e*t),1))}})})),Au=he("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],(e=>{let{typed:t,add:r,subtract:n,multiply:i,divide:o,max:a,map:s,abs:u,isPositive:c,isNegative:l,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:y}=e;function x(e){return function(t,m,d,x){if(2!==m.length||!m.every(E)&&!m.every(v))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');const b=m[0],w=m[1],N=f(w,b),A=x.firstStep;if(void 0!==A&&!c(A))throw new Error('"firstStep" must be positive');const S=x.maxStep;if(void 0!==S&&!c(S))throw new Error('"maxStep" must be positive');const M=x.minStep;if(M&&l(M))throw new Error('"minStep" must be positive or zero');const C=[b,w,A,M,S].filter((e=>void 0!==e));if(!C.every(E)&&!C.every(v))throw new Error('Inconsistent type of "t" dependant variables');const T=x.tol?x.tol:1e-4,D=x.minDelta?x.minDelta:.2,F=x.maxDelta?x.maxDelta:5,O=x.maxIter?x.maxIter:1e4,B=[b,w,...d,S,M].some(g),[_,z,I,k]=B?[h(e.a),h(e.c),h(e.b),h(e.bp)]:[e.a,e.c,e.b,e.bp];let R=A?N?A:y(A):o(n(w,b),1);const q=[b],P=[d],j=n(I,k);let U=0,L=0;const $=function(e){return e?p:f}(N),H=function(e){const t=e?f:p;return function(e,i,o){const a=r(e,o);return t(a,i)?n(i,e):o}}(N);for(;$(q[U],w);){const e=[];R=H(q[U],w,R),e.push(t(q[U],P[U]));for(let n=1;n<z.length;++n)e.push(t(r(q[U],i(z[n],R)),r(P[U],i(R,_[n],e))));const n=a(u(s(i(j,e),(e=>v(e)?e.value:e))));n<T&&T/n>1/4&&(q.push(r(q[U],R)),P.push(r(P[U],i(R,I,e))),U++);let o=.84*(T/n)**.2;if(p(o,D)?o=D:f(o,F)&&(o=F),o=B?h(o):o,R=i(R,o),S&&f(u(R),S)?R=N?S:y(S):M&&p(u(R),M)&&(R=N?M:y(M)),L++,L>O)throw new Error("Maximum number of iterations reached, try changing options")}return{t:q,y:P}}}function b(e,t,r,n){return x({a:[[],[.5],[0,3/4],[2/9,1/3,4/9]],c:[null,.5,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(e,t,r,n)}function w(e,t,r,n){return x({a:[[],[.2],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,.2,.3,.8,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40]})(e,t,r,n)}function N(e,t,r,n){const i=n.method?n.method:"RK45",o={RK23:b,RK45:w};if(i.toUpperCase()in o){const a={...n};return delete a.method,o[i.toUpperCase()](e,t,r,a)}{const e=Object.keys(o).map((e=>`"${e}"`)),t=`${e.slice(0,-1).join(", ")} and ${e.slice(-1)}`;throw new Error(`Unavailable method "${i}". Available methods are ${t}`)}}function E(e){return g(e)||d(e)}function A(e,t,r,n){const i=N(e,t.toArray(),r.toArray(),n);return{t:m(i.t),y:m(i.y)}}return t("solveODE",{"function, Array, Array, Object":N,"function, Matrix, Matrix, Object":A,"function, Array, Array":(e,t,r)=>N(e,t,r,{}),"function, Matrix, Matrix":(e,t,r)=>A(e,t,r,{}),"function, Array, number | BigNumber | Unit":(e,t,r)=>{const n=N(e,t,[r],{});return{t:n.t,y:n.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit":(e,t,r)=>{const n=N(e,t.toArray(),[r],{});return{t:m(n.t),y:m(n.y.map((e=>e[0])))}},"function, Array, number | BigNumber | Unit, Object":(e,t,r,n)=>{const i=N(e,t,[r],n);return{t:i.t,y:i.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit, Object":(e,t,r,n)=>{const i=N(e,t.toArray(),[r],n);return{t:m(i.t),y:m(i.y.map((e=>e[0])))}}})})),Su=he("erf",["typed"],(e=>{let{typed:t}=e;return t("name",{number:function(e){const t=Math.abs(e);return t>=Fu?be(e):t<=Mu?be(e)*function(e){const t=e*e;let r,n=Tu[0][4]*t,i=t;for(r=0;r<3;r+=1)n=(n+Tu[0][r])*t,i=(i+Du[0][r])*t;return e*(n+Tu[0][3])/(i+Du[0][3])}(t):t<=4?be(e)*(1-function(e){let t,r=Tu[1][8]*e,n=e;for(t=0;t<7;t+=1)r=(r+Tu[1][t])*e,n=(n+Du[1][t])*e;const i=(r+Tu[1][7])/(n+Du[1][7]),o=parseInt(16*e)/16,a=(e-o)*(e+o);return Math.exp(-o*o)*Math.exp(-a)*i}(t)):be(e)*(1-function(e){let t,r=1/(e*e),n=Tu[2][5]*r,i=r;for(t=0;t<4;t+=1)n=(n+Tu[2][t])*r,i=(i+Du[2][t])*r;let o=r*(n+Tu[2][4])/(i+Du[2][4]);o=(Cu-o)/e,r=parseInt(16*e)/16;const a=(e-r)*(e+r);return Math.exp(-r*r)*Math.exp(-a)*o}(t))},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),Mu=.46875,Cu=.5641895835477563,Tu=[[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]],Du=[[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]],Fu=Math.pow(2,53),Ou="zeta",Bu=he(Ou,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],(e=>{let{typed:t,config:r,multiply:n,pow:i,divide:o,factorial:a,equal:s,smallerEq:u,isNegative:c,gamma:l,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=e;return t(Ou,{number:e=>y(e,(e=>e),(()=>20)),BigNumber:e=>y(e,(e=>new d(e)),(()=>Math.abs(Math.log10(r.relTol)))),Complex:function(e){return 0===e.re&&0===e.im?new h(-.5):1===e.re?new h(NaN,NaN):e.re===1/0&&0===e.im?new h(1):e.im===1/0||e.re===-1/0?new h(NaN,NaN):x(e,(e=>e),(e=>Math.round(19.5+.9*Math.abs(e.im))),(e=>e.re))}});function y(e,t,r){return s(e,0)?t(-.5):s(e,1)?t(NaN):isFinite(e)?x(e,t,r,(e=>e)):c(e)?t(NaN):t(1)}function x(e,t,r,a){const s=r(e);if(a(e)>-(s-1)/2)return function(e,t,r){const a=o(1,n(b(r(0),t),p(1,i(2,p(1,e)))));let s=r(0);for(let a=r(1);u(a,t);a=m(a,1))s=m(s,o(n((-1)**(a-1),b(a,t)),i(a,e)));return n(a,s)}(e,t(s),t);{let s=n(i(2,e),i(t(g),p(e,1)));return s=n(s,f(n(o(t(g),2),e))),s=n(s,l(p(1,e))),n(s,x(p(1,e),t,r,a))}}function b(e,t){let r=e;for(let s=e;u(s,t);s=m(s,1)){const e=o(n(a(m(t,p(s,1))),i(4,s)),n(a(p(t,s)),a(n(2,s))));r=m(r,e)}return n(t,r)}})),_u="mode",zu=he(_u,["typed","isNaN","isNumeric"],(e=>{let{typed:t,isNaN:r,isNumeric:n}=e;return t(_u,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=Dn(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");const t={};let i=[],o=0;for(let a=0;a<e.length;a++){const s=e[a];if(n(s)&&r(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in t||(t[s]=0),t[s]++,t[s]===o?i.push(s):t[s]>o&&(o=t[s],i=[s])}return i}}));function Iu(e,t,r){let n;return String(e).includes("Unexpected type")?(n=arguments.length>2?" (type: "+oe(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):String(e).includes("complex numbers")?(n=arguments.length>2?" (type: "+oe(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}const ku="prod",Ru=he(ku,["typed","config","multiplyScalar","numeric"],(e=>{let{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(ku,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return o(e)}});function o(e){let t;if(Xn(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Iu(t,"prod",e)}})),"string"==typeof t&&(t=i(t,xe(t,r))),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}})),qu="format",Pu=he(qu,["typed"],(e=>{let{typed:t}=e;return t(qu,{any:an,"any, Object | function | number | BigNumber":an})})),ju=he("bin",["typed","format"],(e=>{let{typed:t,format:r}=e;return t("bin",{"number | BigNumber":function(e){return r(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"bin",wordSize:t})}})})),Uu=he("oct",["typed","format"],(e=>{let{typed:t,format:r}=e;return t("oct",{"number | BigNumber":function(e){return r(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"oct",wordSize:t})}})})),Lu=he("hex",["typed","format"],(e=>{let{typed:t,format:r}=e;return t("hex",{"number | BigNumber":function(e){return r(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"hex",wordSize:t})}})})),$u=/\$([\w.]+)/g,Hu="print",Gu=he(Hu,["typed"],(e=>{let{typed:t}=e;return t(Hu,{"string, Object | Array":Vu,"string, Object | Array, number | Object":Vu})}));function Vu(e,t,r){return e.replace($u,(function(e,n){const i=n.split(".");let o=t[i.shift()];for(void 0!==o&&o.isMatrix&&(o=o.toArray());i.length&&void 0!==o;){const e=i.shift();o=e?o[e]:o+"."}return void 0!==o?w(o)?o:an(o,r):e}))}const Wu=he("to",["typed","matrix","concat"],(e=>{let{typed:t,matrix:r,concat:n}=e;return t("to",{"Unit, Unit | string":(e,t)=>e.to(t)},Ko({typed:t,matrix:r,concat:n})({Ds:!0}))})),Zu="isPrime",Yu=he(Zu,["typed"],(e=>{let{typed:t}=e;return t(Zu,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(let t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;if(e%2n===0n||e%3n===0n)return!1;for(let t=5n;t*t<=e;t+=6n)if(e%t===0n||e%(t+2n)===0n)return!1;return!0},BigNumber:function(e){if(e.lte(3))return e.gt(1);if(e.mod(2).eq(0)||e.mod(3).eq(0))return!1;if(e.lt(Math.pow(2,32))){const t=e.toNumber();for(let e=5;e*e<=t;e+=6)if(t%e==0||t%(e+2)==0)return!1;return!0}function t(e,t,r){let n=1;for(;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(r)):(t=t.sub(1),n=e.mul(n).mod(r));return n}const r=e.constructor.clone({precision:2*e.toFixed(0).length});let n=0,i=(e=new r(e)).sub(1);for(;i.mod(2).eq(0);)i=i.div(2),n+=1;let o=null;if(e.lt("3317044064679887385961981"))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((t=>t<e));else{const t=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));o=[];for(let e=2;e<=t;e+=1)o.push(t)}for(let r=0;r<o.length;r+=1){const a=o[r],s=t(e.sub(e).add(a),i,e);if(!s.eq(1))for(let t=0,r=s;!r.eq(e.sub(1));t+=1,r=r.mul(r).mod(e))if(t===n-1)return!1}return!0},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),Ju=he("numeric",["number","?bignumber","?fraction"],(e=>{let{number:t,bignumber:r,fraction:n}=e;const i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:r?e=>r(e):Vs,bigint:e=>BigInt(e),Fraction:n?e=>n(e):Ws};return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(arguments.length>2?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");const r=oe(e);if(!(r in i))throw new TypeError("Cannot convert "+e+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===r?e:o[t](e)}})),Xu="divideScalar",Qu=he(Xu,["typed","numeric"],(e=>{let{typed:t,numeric:r}=e;return t(Xu,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"bigint, bigint":function(e,t){return e/t},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})})),Ku=he("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(e=>{let{typed:t,config:r,identity:n,multiply:i,matrix:o,inv:a,number:s,fraction:u,Complex:c}=e;return t("pow",{"number, number":l,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||r.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"bigint, bigint":(e,t)=>e**t,"Fraction, Fraction":function(e,t){const n=e.pow(t);if(null!=n)return n;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(e.valueOf(),t.valueOf())},"Array, number":f,"Array, BigNumber":function(e,t){return f(e,t.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,t){return p(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function l(e,t){if(r.predictable&&!ye(t)&&e<0)try{const r=u(t),n=s(r);if((t===n||Math.abs((t-n)/t)<1e-14)&&r.d%2==1)return(r.n%2==0?1:-1)*Math.pow(-e,t)}catch(e){}return r.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:ye(t)||e>=0||r.predictable?fo(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new c(e,0).pow(t,0)}function f(e,t){if(!ye(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");const r=hn(e);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");if(t<0)try{return f(a(e),-t)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+t+")");throw e}let o=n(r[0]).valueOf(),s=e;for(;t>=1;)1&~t||(o=i(s,o)),t>>=1,s=i(s,s);return o}function p(e,t){return o(f(e.valueOf(),t))}})),ec="Number of decimals in function round must be an integer",tc="round",rc=he(tc,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(e=>{let{typed:t,config:r,matrix:n,equalScalar:i,zeros:o,BigNumber:a,DenseMatrix:s}=e;const u=To({typed:t,equalScalar:i}),c=Do({typed:t,DenseMatrix:s}),l=Fo({typed:t});function f(e){return Math.abs(Te(e).exponent)}return t(tc,{number:function(e){const t=po(e,f(r.relTol));return po(_e(e,t,r.relTol,r.absTol)?t:e)},"number, number":function(e,t){const n=f(r.relTol);if(t>=n)return po(e,t);const i=po(e,n);return po(_e(e,i,r.relTol,r.absTol)?i:e,t)},"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ec);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(ec);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ec);const r=t.toNumber();return e.round(r)},BigNumber:function(e){const t=new a(e).toDecimalPlaces(f(r.relTol));return(ui(e,t,r.relTol,r.absTol)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ec);const n=f(r.relTol);if(t>=n)return e.toDecimalPlaces(t.toNumber());const i=e.toDecimalPlaces(n);return(ui(e,i,r.relTol,r.absTol)?i:e).toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(ec);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ec);return e.round(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,r,n){const i=t.toNumeric(n);return n.multiply(e(i,r))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>e(t,r.toNumber(),n))),"Unit, Unit":t.referToSelf((e=>(t,r)=>e(t,0,r))),"Array | Matrix, number, Unit":t.referToSelf((e=>(t,r,n)=>Qn(t,(t=>e(t,r,n)),!0))),"Array | Matrix, BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>e(t,r.toNumber(),n))),"Array | Matrix, Unit":t.referToSelf((e=>(t,r)=>e(t,0,r))),"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e,!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>l(n(t),r,e,!1).valueOf())),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf((e=>(t,r)=>i(t,0)?o(r.size(),r.storage()):c(r,t,e,!0))),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf((e=>(t,r)=>i(t,0)?o(r.size(),r.storage()):l(r,t,e,!0))),"number | Complex | BigNumber | Fraction, Array":t.referToSelf((e=>(t,r)=>l(n(r),t,e,!0).valueOf()))})})),nc=he("log",["config","typed","divideScalar","Complex"],(e=>{let{typed:t,config:r,divideScalar:n,Complex:i}=e;return t("log",{number:function(e){return e>=0||r.predictable?function(e){return Math.log(e)}(e):new i(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||r.predictable?e.ln():new i(e.toNumber(),0).log()},"any, any":t.referToSelf((e=>(t,r)=>n(e(t),e(r))))})})),ic="log1p",oc=he(ic,["typed","config","divideScalar","log","Complex"],(e=>{let{typed:t,config:r,divideScalar:n,log:i,Complex:o}=e;return t(ic,{number:function(e){return e>=-1||r.predictable?Ne(e):a(new o(e,0))},Complex:a,BigNumber:function(e){const t=e.plus(1);return!t.isNegative()||r.predictable?t.ln():a(new o(e.toNumber(),0))},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e))),"any, any":t.referToSelf((e=>(t,r)=>n(e(t),i(r))))});function a(e){const t=e.re+1;return new o(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}})),ac="nthRoots",sc=he(ac,["config","typed","divideScalar","Complex"],(e=>{let{typed:t,config:r,divideScalar:n,Complex:i}=e;const o=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function a(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];const r="number"==typeof e;let n;(r||0===e.re||0===e.im)&&(n=r?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);const a=e.arg(),s=e.abs(),u=[],c=Math.pow(s,1/t);for(let e=0;e<t;e++){const r=(n+4*e)/t;r!==Math.round(r)?u.push(new i({r:c,phi:(a+2*Math.PI*e)/t})):u.push(o[r%4](c))}return u}return t(ac,{Complex:function(e){return a(e,2)},"Complex, number":a})})),uc="dotPow",cc=he(uc,["typed","equalScalar","matrix","pow","DenseMatrix","concat"],(e=>{let{typed:t,equalScalar:r,matrix:n,pow:i,DenseMatrix:o,concat:a}=e;const s=Yo({typed:t}),u=rs({typed:t,DenseMatrix:o}),c=To({typed:t,equalScalar:r}),l=Do({typed:t,DenseMatrix:o}),f=Ko({typed:t,matrix:n,concat:a}),p={};for(const e in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,e)&&(e.includes("Matrix")||e.includes("Array")||(p[e]=i.signatures[e]));const m=t(p);return t(uc,f({elop:m,SS:u,DS:s,Ss:c,sS:l}))})),lc="dotDivide",fc=he(lc,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:o,concat:a}=e;const s=Zo({typed:t,equalScalar:n}),u=Yo({typed:t}),c=rs({typed:t,DenseMatrix:o}),l=To({typed:t,equalScalar:n}),f=Do({typed:t,DenseMatrix:o}),p=Ko({typed:t,matrix:r,concat:a});return t(lc,p({elop:i,SS:c,DS:u,SD:s,Ss:l,sS:f}))}));function pc(e){let{DenseMatrix:t}=e;return function(e,r,n){const i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+an(i)+")");const o=i[0];if(o!==i[1])throw new RangeError("Matrix must be square (size: "+an(i)+")");let a=[];if(E(r)){const e=r.size(),i=r._data;if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[i[e]];return new t({data:a,size:[o,1],datatype:r._datatype})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(S(r)){if(n){a=[];for(let e=0;e<o;e++)a[e]=[i[e][0]];return new t({data:a,size:[o,1],datatype:r._datatype})}return r}if(M(r)){for(let e=0;e<o;e++)a[e]=[0];const e=r._values,n=r._index,i=r._ptr;for(let t=i[1],r=i[0];r<t;r++)a[n[r]][0]=e[r];return new t({data:a,size:[o,1],datatype:r._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(N(r)){const e=hn(r);if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[r[e]];return new t({data:a,size:[o,1]})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[r[e][0]];return new t({data:a,size:[o,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}const mc="lsolve",hc=he(mc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=pc({DenseMatrix:s});return t(mc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=0;e<l;e++){const t=r[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e],d=m[e+1];for(let t=l;t<d;t++){const r=p[t];r===e?s=f[t]:r>e&&(u.push(f[t]),c.push(r))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const g=n(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];r[t]=[o(r[t][0]||0,i(g,u[e]))]}h[e]=[g]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).valueOf()}});function c(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=0;e<l;e++){const t=r[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=n(t,u);for(let t=e+1;t<c;t++)r[t]=[o(r[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),dc="usolve",gc=he(dc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=pc({DenseMatrix:s});return t(dc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=l-1;e>=0;e--){const t=r[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e];for(let t=m[e+1]-1;t>=l;t--){const r=p[t];r===e?s=f[t]:r<e&&(u.push(f[t]),c.push(r))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const d=n(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];r[t]=[o(r[t][0],i(d,u[e]))]}h[e]=[d]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).valueOf()}});function c(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=l-1;e>=0;e--){const t=r[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=n(t,u);for(let t=e-1;t>=0;t--)r[t]=[o(r[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),yc="lsolveAll",xc=he(yc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=pc({DenseMatrix:s});return t(yc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=0;e<l;e++){let t=r.length;for(let s=0;s<t;s++){const u=r[s],c=[],l=[],h=m[e],d=m[e+1];let g=0;for(let t=h;t<d;t++){const r=p[t];r===e?g=f[t]:r>e&&(c.push(f[t]),l.push(r))}if(a(g,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,r=l.length;e<r;e++){const r=l[e];t[r]=o(t[r],c[e])}r.push(t)}}else{if(0===s)return[];r.splice(s,1),s-=1,t-=1}else{u[e]=n(u[e],g);for(let t=0,r=l.length;t<r;t++){const r=l[t];u[r]=o(u[r],i(u[e],c[t]))}}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).map((e=>e.valueOf()))}});function c(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0],f=e._size[1];for(let e=0;e<f;e++){let t=r.length;for(let s=0;s<t;s++){const u=r[s];if(a(c[e][e],0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let r=e+1;r<f;r++)t[r]=o(t[r],c[r][e]);r.push(t)}}else{if(0===s)return[];r.splice(s,1),s-=1,t-=1}else{u[e]=n(u[e],c[e][e]);for(let t=e+1;t<f;t++)u[t]=o(u[t],i(u[e],c[t][e]))}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),bc="usolveAll",vc=he(bc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=pc({DenseMatrix:s});return t(bc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=l-1;e>=0;e--){let t=r.length;for(let s=0;s<t;s++){const u=r[s],c=[],l=[],h=m[e];let d=0;for(let t=m[e+1]-1;t>=h;t--){const r=p[t];r===e?d=f[t]:r<e&&(c.push(f[t]),l.push(r))}if(a(d,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,r=l.length;e<r;e++){const r=l[e];t[r]=o(t[r],c[e])}r.push(t)}}else{if(0===s)return[];r.splice(s,1),s-=1,t-=1}else{u[e]=n(u[e],d);for(let t=0,r=l.length;t<r;t++){const r=l[t];u[r]=o(u[r],i(u[e],c[t]))}}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).map((e=>e.valueOf()))}});function c(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0];for(let t=e._size[1]-1;t>=0;t--){let e=r.length;for(let s=0;s<e;s++){const u=r[s];if(a(c[t][t],0))if(a(u[t],0)){if(0===s){const e=[...u];e[t]=1;for(let r=t-1;r>=0;r--)e[r]=o(e[r],c[r][t]);r.push(e)}}else{if(0===s)return[];r.splice(s,1),s-=1,e-=1}else{u[t]=n(u[t],c[t][t]);for(let e=t-1;e>=0;e--)u[e]=o(u[e],i(u[t],c[e][t]))}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),wc=he("matAlgo08xS0Sid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new pn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!o||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=[],N=[],E=[],A=[],S=[];let M,C,T,D;for(let e=0;e<g;e++){E[e]=N.length;const t=e+1;for(C=s[e],T=s[e+1],M=C;M<T;M++)D=a[M],S[D]=t,A[D]=o[M],N.push(D);for(C=p[e],T=p[e+1],M=C;M<T;M++)D=f[M],S[D]===t&&(A[D]=v(A[D],l[M]));for(M=E[e];M<N.length;){D=N[M];const e=A[D];x(e,b)?N.splice(M,1):(w.push(e),M++)}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),Nc=he("useMatrixForArrayScalar",["typed","matrix"],(e=>{let{typed:t,matrix:r}=e;return{"Array, number":t.referTo("DenseMatrix, number",(e=>(t,n)=>e(r(t),n).valueOf())),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",(e=>(t,n)=>e(r(t),n).valueOf())),"number, Array":t.referTo("number, DenseMatrix",(e=>(t,n)=>e(t,r(n)).valueOf())),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",(e=>(t,n)=>e(t,r(n)).valueOf()))}})),Ec="leftShift",Ac=he(Ec,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:o,concat:a}=e;const s=ta({typed:t}),u=Zo({typed:t,equalScalar:n}),c=wc({typed:t,equalScalar:n}),l=na({typed:t,DenseMatrix:o}),f=To({typed:t,equalScalar:n}),p=Fo({typed:t}),m=Ko({typed:t,matrix:r,concat:a}),h=Nc({typed:t,matrix:r});return t(Ec,{"number, number":Wa,"BigNumber, BigNumber":ja,"bigint, bigint":(e,t)=>e<<t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():f(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():p(t,r,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):l(r,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):p(r,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Sc="rightArithShift",Mc=he(Sc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:o,concat:a}=e;const s=ta({typed:t}),u=Zo({typed:t,equalScalar:n}),c=wc({typed:t,equalScalar:n}),l=na({typed:t,DenseMatrix:o}),f=To({typed:t,equalScalar:n}),p=Fo({typed:t}),m=Ko({typed:t,matrix:r,concat:a}),h=Nc({typed:t,matrix:r});return t(Sc,{"number, number":Za,"BigNumber, BigNumber":Ua,"bigint, bigint":(e,t)=>e>>t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():f(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():p(t,r,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):l(r,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):p(r,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Cc="rightLogShift",Tc=he(Cc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:o,concat:a}=e;const s=ta({typed:t}),u=Zo({typed:t,equalScalar:n}),c=wc({typed:t,equalScalar:n}),l=na({typed:t,DenseMatrix:o}),f=To({typed:t,equalScalar:n}),p=Fo({typed:t}),m=Ko({typed:t,matrix:r,concat:a}),h=Nc({typed:t,matrix:r});return t(Cc,{"number, number":Ya,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():f(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():p(t,r,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):l(r,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):p(r,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Dc=he("and",["typed","matrix","equalScalar","zeros","not","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a}=e;const s=Zo({typed:t,equalScalar:n}),u=ca({typed:t,equalScalar:n}),c=To({typed:t,equalScalar:n}),l=Fo({typed:t}),f=Ko({typed:t,matrix:r,concat:a});return t("and",{"number, number":hs,"Complex, Complex":function(e,t){return!(0===e.re&&0===e.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(e,t){return!(e.isZero()||t.isZero()||e.isNaN()||t.isNaN())},"bigint, bigint":hs,"Unit, Unit":t.referToSelf((e=>(t,r)=>e(t.value||0,r.value||0))),"SparseMatrix, any":t.referToSelf((e=>(t,r)=>o(r)?i(t.size(),t.storage()):c(t,r,e,!1))),"DenseMatrix, any":t.referToSelf((e=>(t,r)=>o(r)?i(t.size(),t.storage()):l(t,r,e,!1))),"any, SparseMatrix":t.referToSelf((e=>(t,r)=>o(t)?i(t.size(),t.storage()):c(r,t,e,!0))),"any, DenseMatrix":t.referToSelf((e=>(t,r)=>o(t)?i(t.size(),t.storage()):l(r,t,e,!0))),"Array, any":t.referToSelf((e=>(t,n)=>e(r(t),n).valueOf())),"any, Array":t.referToSelf((e=>(t,n)=>e(t,r(n)).valueOf()))},f({SS:u,DS:s}))})),Fc="compare",Oc=he(Fc,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],(e=>{let{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:o,Fraction:a,DenseMatrix:s,concat:u}=e;const c=Yo({typed:t}),l=Jo({typed:t,equalScalar:n}),f=Do({typed:t,DenseMatrix:s}),p=Ko({typed:t,matrix:i,concat:u}),m=Ei({typed:t});return t(Fc,Bc({typed:t,config:r}),{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return ui(e,t,r.relTol,r.absTol)?new o(0):new o(e.cmp(t))},"bigint, bigint":function(e,t){return e===t?0n:e>t?1n:-1n},"Fraction, Fraction":function(e,t){return new a(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:l,DS:c,Ss:f}))})),Bc=he(Fc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Fc,{"number, number":function(e,t){return _e(e,t,r.relTol,r.absTol)?0:e>t?1:-1}})}));var _c=r(1880);const zc="compareNatural",Ic=he(zc,["typed","compare"],(e=>{let{typed:t,compare:r}=e;const n=r.signatures["boolean,boolean"];return t(zc,{"any, any":function e(t,a){const s=oe(t),u=oe(a);let c;if(!("number"!==s&&"BigNumber"!==s&&"Fraction"!==s||"number"!==u&&"BigNumber"!==u&&"Fraction"!==u))return c=r(t,a),"0"!==c.toString()?c>0?1:-1:_c(s,u);const l=["Array","DenseMatrix","SparseMatrix"];if(l.includes(s)||l.includes(u))return c=i(e,t,a),0!==c?c:_c(s,u);if(s!==u)return _c(s,u);if("Complex"===s)return function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0}(t,a);if("Unit"===s)return t.equalBase(a)?e(t.value,a.value):o(e,t.formatUnits(),a.formatUnits());if("boolean"===s)return n(t,a);if("string"===s)return _c(t,a);if("Object"===s)return function(e,t,r){const n=Object.keys(t),i=Object.keys(r);n.sort(_c),i.sort(_c);const a=o(e,n,i);if(0!==a)return a;for(let o=0;o<n.length;o++){const a=e(t[n[o]],r[i[o]]);if(0!==a)return a}return 0}(e,t,a);if("null"===s)return 0;if("undefined"===s)return 0;throw new TypeError('Unsupported type of value "'+s+'"')}});function i(e,t,r){return M(t)&&M(r)?o(e,t.toJSON().values,r.toJSON().values):M(t)?i(e,t.toArray(),r):M(r)?i(e,t,r.toArray()):S(t)?i(e,t.toJSON().data,r):S(r)?i(e,t,r.toJSON().data):Array.isArray(t)?Array.isArray(r)?o(e,t,r):i(e,t,[r]):i(e,[t],r)}function o(e,t,r){for(let n=0,i=Math.min(t.length,r.length);n<i;n++){const i=e(t[n],r[n]);if(0!==i)return i}return t.length>r.length?1:t.length<r.length?-1:0}})),kc="compareText",Rc=["typed","matrix","concat"];fn.signature="any, any";const qc=he(kc,Rc,(e=>{let{typed:t,matrix:r,concat:n}=e;const i=Ko({typed:t,matrix:r,concat:n});return t(kc,fn,i({elop:fn,Ds:!0}))})),Pc="equal",jc=he(Pc,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=Yo({typed:t}),s=rs({typed:t,DenseMatrix:i}),u=Do({typed:t,DenseMatrix:i}),c=Ko({typed:t,matrix:r,concat:o});return t(Pc,Uc({typed:t,equalScalar:n}),c({elop:n,SS:s,DS:a,Ss:u}))})),Uc=he(Pc,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return t(Pc,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:r(e,t)}})})),Lc="equalText",$c=he(Lc,["typed","compareText","isZero"],(e=>{let{typed:t,compareText:r,isZero:n}=e;return t(Lc,{"any, any":function(e,t){return n(r(e,t))}})})),Hc="smaller",Gc=he(Hc,["typed","config","matrix","DenseMatrix","concat"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o}=e;const a=Yo({typed:t}),s=rs({typed:t,DenseMatrix:i}),u=Do({typed:t,DenseMatrix:i}),c=Ko({typed:t,matrix:n,concat:o}),l=Ei({typed:t});return t(Hc,Vc({typed:t,config:r}),{"boolean, boolean":(e,t)=>e<t,"BigNumber, BigNumber":function(e,t){return e.lt(t)&&!ui(e,t,r.relTol,r.absTol)},"bigint, bigint":(e,t)=>e<t,"Fraction, Fraction":(e,t)=>-1===e.compare(t),"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:a,Ss:u}))})),Vc=he(Hc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Hc,{"number, number":function(e,t){return e<t&&!_e(e,t,r.relTol,r.absTol)}})})),Wc="smallerEq",Zc=he(Wc,["typed","config","matrix","DenseMatrix","concat"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o}=e;const a=Yo({typed:t}),s=rs({typed:t,DenseMatrix:i}),u=Do({typed:t,DenseMatrix:i}),c=Ko({typed:t,matrix:n,concat:o}),l=Ei({typed:t});return t(Wc,Yc({typed:t,config:r}),{"boolean, boolean":(e,t)=>e<=t,"BigNumber, BigNumber":function(e,t){return e.lte(t)||ui(e,t,r.relTol,r.absTol)},"bigint, bigint":(e,t)=>e<=t,"Fraction, Fraction":(e,t)=>1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:a,Ss:u}))})),Yc=he(Wc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Wc,{"number, number":function(e,t){return e<=t||_e(e,t,r.relTol,r.absTol)}})})),Jc="larger",Xc=he(Jc,["typed","config","matrix","DenseMatrix","concat"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o}=e;const a=Yo({typed:t}),s=rs({typed:t,DenseMatrix:i}),u=Do({typed:t,DenseMatrix:i}),c=Ko({typed:t,matrix:n,concat:o}),l=Ei({typed:t});return t(Jc,Qc({typed:t,config:r}),{"boolean, boolean":(e,t)=>e>t,"BigNumber, BigNumber":function(e,t){return e.gt(t)&&!ui(e,t,r.relTol,r.absTol)},"bigint, bigint":(e,t)=>e>t,"Fraction, Fraction":(e,t)=>1===e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:a,Ss:u}))})),Qc=he(Jc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Jc,{"number, number":function(e,t){return e>t&&!_e(e,t,r.relTol,r.absTol)}})})),Kc="largerEq",el=he(Kc,["typed","config","matrix","DenseMatrix","concat"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o}=e;const a=Yo({typed:t}),s=rs({typed:t,DenseMatrix:i}),u=Do({typed:t,DenseMatrix:i}),c=Ko({typed:t,matrix:n,concat:o}),l=Ei({typed:t});return t(Kc,tl({typed:t,config:r}),{"boolean, boolean":(e,t)=>e>=t,"BigNumber, BigNumber":function(e,t){return e.gte(t)||ui(e,t,r.relTol,r.absTol)},"bigint, bigint":function(e,t){return e>=t},"Fraction, Fraction":(e,t)=>-1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},l,c({SS:s,DS:a,Ss:u}))})),tl=he(Kc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Kc,{"number, number":function(e,t){return e>=t||_e(e,t,r.relTol,r.absTol)}})})),rl="deepEqual",nl=he(rl,["typed","equal"],(e=>{let{typed:t,equal:r}=e;return t(rl,{"any, any":function(e,t){return n(e.valueOf(),t.valueOf())}});function n(e,t){if(Array.isArray(e)){if(Array.isArray(t)){const r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(!n(e[i],t[i]))return!1;return!0}return!1}return!Array.isArray(t)&&r(e,t)}})),il="unequal",ol=he(il,["typed","config","equalScalar","matrix","DenseMatrix","concat"],(e=>{let{typed:t,config:r,equalScalar:n,matrix:i,DenseMatrix:o,concat:a}=e;const s=Yo({typed:t}),u=rs({typed:t,DenseMatrix:o}),c=Do({typed:t,DenseMatrix:o}),l=Ko({typed:t,matrix:i,concat:a});return t(il,al({typed:t,equalScalar:n}),l({elop:function(e,t){return!n(e,t)},SS:u,DS:s,Ss:c}))})),al=he(il,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return t(il,{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:!r(e,t)}})})),sl="partitionSelect",ul=he(sl,["typed","isNumeric","isNaN","compare"],(e=>{let{typed:t,isNumeric:r,isNaN:n,compare:i}=e;const o=i,a=(e,t)=>-i(e,t);return t(sl,{"Array | Matrix, number":function(e,t){return s(e,t,o)},"Array | Matrix, number, string":function(e,t,r){if("asc"===r)return s(e,t,o);if("desc"===r)return s(e,t,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(e,t,r){if(!ye(t)||t<0)throw new Error("k must be a non-negative integer");if(E(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),t,r)}if(Array.isArray(e))return u(e,t,r)}function u(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(let t=0;t<e.length;t++)if(r(e[t])&&n(e[t]))return e[t];let o=0,a=e.length-1;for(;o<a;){let r=o,n=a;const s=e[Math.floor(Math.random()*(a-o+1))+o];for(;r<n;)if(i(e[r],s)>=0){const t=e[n];e[n]=e[r],e[r]=t,--n}else++r;i(e[r],s)>0&&--r,t<=r?a=r:o=r+1}return e[t]}})),cl="sort",ll=he(cl,["typed","matrix","compare","compareNatural"],(e=>{let{typed:t,matrix:r,compare:n,compareNatural:i}=e;const o=n,a=(e,t)=>-n(e,t);return t(cl,{Array:function(e){return u(e),e.sort(o)},Matrix:function(e){return c(e),r(e.toArray().sort(o),e.storage())},"Array, function":function(e,t){return u(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),r(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return u(e),e.sort(s(t))},"Matrix, string":function(e,t){return c(e),r(e.toArray().sort(s(t)),e.storage())}});function s(e){if("asc"===e)return o;if("desc"===e)return a;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==hn(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),fl=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:r,numeric:n,larger:i}=e;return t("max",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return Kn(e,t.valueOf(),o)},"...":function(e){if(Jn(e))throw new TypeError("Scalar values expected in function max");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Iu(e,"max",t)}}function a(e){let t;if(Xn(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Iu(t,"max",e)}})),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=n(t,xe(t,r))),t}})),pl=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:r,numeric:n,smaller:i}=e;return t("min",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return Kn(e,t.valueOf(),o)},"...":function(e){if(Jn(e))throw new TypeError("Scalar values expected in function min");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Iu(e,"min",t)}}function a(e){let t;if(Xn(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Iu(t,"min",e)}})),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=n(t,xe(t,r))),t}})),ml=he("ImmutableDenseMatrix",["smaller","DenseMatrix"],(e=>{let{smaller:t,DenseMatrix:r}=e;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e)||N(e)){const n=new r(e,t);this._data=n._data,this._size=n._size,this._datatype=n._datatype,this._min=null,this._max=null}else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=void 0!==e.min?e.min:null,this._max=void 0!==e.max?e.max:null;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:{const t=r.prototype.subset.call(this,e);return E(t)?new n({data:t._data,size:t._size,datatype:t._datatype}):t}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:ae(this._data),size:ae(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){let e=null;this.forEach((function(r){(null===e||t(r,e))&&(e=r)})),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){let e=null;this.forEach((function(r){(null===e||t(e,r))&&(e=r)})),this._max=null!==e?e:void 0}return this._max},n}),{isClass:!0}),hl=he("Index",["ImmutableDenseMatrix","getMatrixDataType"],(e=>{let{ImmutableDenseMatrix:t,getMatrixDataType:r}=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(let e=0,t=arguments.length;e<t;e++){const t=arguments[e],n=N(t),o=E(t);let a=null;if(C(t))this._dimensions.push(t),this._isScalar=!1;else if(n||o){let e;"boolean"===r(t)?(n&&(e=i(dl(t).valueOf())),o&&(e=i(dl(t._data).valueOf())),a=t.valueOf().length):e=i(t.valueOf()),this._dimensions.push(e);const s=e.size();1===s.length&&1===s[0]&&null===a||(this._isScalar=!1)}else if("number"==typeof t)this._dimensions.push(i([t]));else{if("string"!=typeof t)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(t)}this._sourceSize.push(a)}}function i(e){for(let t=0,r=e.length;t<r;t++)if("number"!=typeof e[t]||!ye(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new t(e)}return n.prototype.type="Index",n.prototype.isIndex=!0,n.prototype.clone=function(){const e=new n;return e._dimensions=ae(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},n.create=function(e){const t=new n;return n.apply(t,e),t},n.prototype.size=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e[t]="string"==typeof r?1:r.size()[0]}return e},n.prototype.max=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e[t]="string"==typeof r?r:r.max()}return e},n.prototype.min=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e[t]="string"==typeof r?r:r.min()}return e},n.prototype.forEach=function(e){for(let t=0,r=this._dimensions.length;t<r;t++)e(this._dimensions[t],t,this)},n.prototype.dimension=function(e){return"number"!=typeof e?null:this._dimensions[e]||null},n.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e.push("string"==typeof r?r:r.toArray())}return e},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];"string"==typeof r?e.push(JSON.stringify(r)):e.push(r.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 dl(e){const t=[];return e.forEach(((e,r)=>{e&&t.push(r)})),t}const gl=he("FibonacciHeap",["smaller","larger"],(e=>{let{smaller:t,larger:r}=e;const 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 o(e,t,r){t.left.right=t.right,t.right.left=t.left,r.degree--,r.child===t&&(r.child=t.right),0===r.degree&&(r.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function a(e,t){const r=t.parent;r&&(t.mark?(o(e,t,r),a(r)):t.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,r){const n={key:e,value:r,degree:0};if(this._minimum){const r=this._minimum;n.left=r,n.right=r.right,r.right=n,n.right.left=n,t(e,r.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(){const e=this._minimum;if(null===e)return e;let i=this._minimum,o=e.degree,a=e.child;for(;o>0;){const e=a.right;a.left.right=a.right,a.right.left=a.left,a.left=i,a.right=i.right,i.right=a,a.right.left=a,a.parent=null,a=e,o--}return e.left.right=e.right,e.right.left=e.left,e===e.right?i=null:(i=e.right,i=function(e,i){const o=Math.floor(Math.log(i)*n)+1,a=new Array(o);let u,c=0,l=e;if(l)for(c++,l=l.right;l!==e;)c++,l=l.right;for(;c>0;){let e=l.degree;const t=l.right;for(;u=a[e],u;){if(r(l.key,u.key)){const e=u;u=l,l=e}s(u,l),a[e]=null,e++}a[e]=l,l=t,c--}e=null;for(let r=0;r<o;r++)u=a[r],u&&(e?(u.left.right=u.right,u.right.left=u.left,u.left=e,u.right=e.right,e.right=u,u.right.left=u,t(u.key,e.key)&&(e=u)):e=u);return e}(i,this._size)),this._size--,this._minimum=i,e},i.prototype.remove=function(e){this._minimum=function(e,r){r.key=-1;const n=r.parent;return n&&t(r.key,n.key)&&(o(e,r,n),a(e,n)),t(r.key,e.key)&&(e=r),e}(this._minimum,e),this.extractMinimum()};const s=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1};return i}),{isClass:!0}),yl=he("Spa",["addScalar","equalScalar","FibonacciHeap"],(e=>{let{addScalar:t,equalScalar:r,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,t){if(this._values[e])this._values[e].value=t;else{const r=this._heap.insert(e,t);this._values[e]=r}},i.prototype.get=function(e){const t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,r){let n=this._values[e];n?n.value=t(n.value,r):(n=this._heap.insert(e,r),this._values[e]=n)},i.prototype.forEach=function(e,t,n){const i=this._heap,o=this._values,a=[];let s=i.extractMinimum();for(s&&a.push(s);s&&s.key<=t;)s.key>=e&&(r(s.value,0)||n(s.key,s.value,this)),s=i.extractMinimum(),s&&a.push(s);for(let e=0;e<a.length;e++){const t=a[e];s=i.insert(t.key,t.value),o[s.key]=s}},i.prototype.swap=function(e,t){let r=this._values[e],n=this._values[t];if(!r&&n)r=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=r,this._values[t]=void 0;else if(r&&!n)n=this._heap.insert(t,r.value),this._heap.remove(r),this._values[t]=n,this._values[e]=void 0;else if(r&&n){const e=r.value;r.value=n.value,n.value=e}},i}),{isClass:!0});function xl(e){let t=0,r=1,n=Object.create(null),i=Object.create(null),o=0;const a=function(e){const a=i[e];if(a&&(delete n[a],delete i[e],--t,r===a)){if(!t)return o=0,void(r=1);for(;!Object.prototype.hasOwnProperty.call(n,++r););}};return e=Math.abs(e),{hit:function(s){const u=i[s],c=++o;if(n[c]=s,i[s]=c,!u){if(++t,t<=e)return;return s=n[r],a(s),s}if(delete n[u],r===u)for(;!Object.prototype.hasOwnProperty.call(n,++r););},delete:a,clear:function(){t=o=0,r=1,n=Object.create(null),i=Object.create(null)}}}function bl(e){let{hasher:t,limit:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r=null==r?Number.POSITIVE_INFINITY:r,t=null==t?JSON.stringify:t,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:xl(r||Number.POSITIVE_INFINITY)});const i=[];for(let e=0;e<arguments.length;e++)i[e]=arguments[e];const o=t(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);const a=e.apply(e,i);return n.cache.values.set(o,a),n.cache.values.delete(n.cache.lru.hit(o)),a}}const vl=bl((function(e){return new e(1).exp()}),{hasher:Al}),wl=bl((function(e){return new e(1).plus(new e(5).sqrt()).div(2)}),{hasher:Al}),Nl=bl((function(e){return e.acos(-1)}),{hasher:Al}),El=bl((function(e){return Nl(e).times(2)}),{hasher:Al});function Al(e){return e[0].precision}const Sl=he("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],(e=>{let{on:t,config:r,addScalar:n,subtractScalar:i,multiplyScalar:o,divideScalar:a,pow:s,abs:u,fix:c,round:l,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:y}=e;const b=h;function w(e,t){if(!(this instanceof w))throw new Error("Constructor must be called with the new operator");if(null!=e&&!p(e)&&!x(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===t)this.units=[],this.dimensions=I.map((e=>0));else if("string"==typeof t){const e=w.parse(t);this.units=e.units,this.dimensions=e.dimensions}else{if(!v(t)||null!==t.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map((e=>en({},e)))}this.value=this._normalize(e)}let N,E,A;function S(){for(;" "===A||"\t"===A;)C()}function M(e){return e>="0"&&e<="9"}function C(){E++,A=N.charAt(E)}function T(e){E=e,A=N.charAt(E)}function D(){let e="";const t=E;if("+"===A?C():"-"===A&&(e+=A,C()),!function(e){return e>="0"&&e<="9"||"."===e}(A))return T(t),null;if("."===A){if(e+=A,C(),!M(A))return T(t),null}else{for(;M(A);)e+=A,C();"."===A&&(e+=A,C())}for(;M(A);)e+=A,C();if("E"===A||"e"===A){let t="";const r=E;if(t+=A,C(),"+"!==A&&"-"!==A||(t+=A,C()),!M(A))return T(r),e;for(e+=t;M(A);)e+=A,C()}return e}function F(){let e="";for(;M(A)||w.isValidAlpha(A);)e+=A,C();const t=e.charAt(0);return w.isValidAlpha(t)?e:null}function O(e){return A===e?(C(),e):null}Object.defineProperty(w,"name",{value:"Unit"}),w.prototype.constructor=w,w.prototype.type="Unit",w.prototype.isUnit=!0,w.parse=function(e,t){if(t=t||{},N=e,E=-1,A="","string"!=typeof N)throw new TypeError("Invalid argument in Unit.parse, string expected");const n=new w;n.units=[];let i=1,o=!1;C(),S();const a=D();let s=null;if(a){if("BigNumber"===r.number)s=new g(a);else if("Fraction"===r.number)try{s=new y(a)}catch(e){s=parseFloat(a)}else s=parseFloat(a);S(),O("*")?(i=1,o=!0):O("/")&&(i=-1,o=!0)}const u=[];let c=1;for(;;){for(S();"("===A;)u.push(i),c*=i,i=1,C(),S();let t;if(!A)break;{const e=A;if(t=F(),null===t)throw new SyntaxError('Unexpected "'+e+'" in "'+N+'" at index '+E.toString())}const r=B(t);if(null===r)throw new SyntaxError('Unit "'+t+'" not found.');let a=i*c;if(S(),O("^")){S();const t=D();if(null===t)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');a*=t}n.units.push({unit:r.unit,prefix:r.prefix,power:a});for(let e=0;e<I.length;e++)n.dimensions[e]+=(r.unit.dimensions[e]||0)*a;for(S();")"===A;){if(0===u.length)throw new SyntaxError('Unmatched ")" in "'+N+'" at index '+E.toString());c/=u.pop(),C(),S()}if(o=!1,O("*")?(i=1,o=!0):O("/")?(i=-1,o=!0):i=1,r.unit.base){const e=r.unit.base.key;U.auto[e]={unit:r.unit,prefix:r.prefix}}}if(S(),A)throw new SyntaxError('Could not parse: "'+e+'"');if(o)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==u.length)throw new SyntaxError('Unmatched "(" in "'+N+'"');if(0===n.units.length&&!t.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return n.value=void 0!==s?n._normalize(s):null,n},w.prototype.clone=function(){const e=new w;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=ae(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(let t=0;t<this.units.length;t++){e.units[t]={};for(const r in this.units[t])me(this.units[t],r)&&(e.units[t][r]=this.units[t][r])}return e},w.prototype.valueType=function(){return oe(this.value)},w.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},w.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;let t=e;const r=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const n=r(this.units[e].unit.value),i=r(this.units[e].prefix.value),a=r(this.units[e].power);t=o(t,s(o(n,i),a))}return t},w.prototype._denormalize=function(e,t){if(null==e||0===this.units.length)return e;let r=e;const n=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const t=n(this.units[e].unit.value),i=n(this.units[e].prefix.value),u=n(this.units[e].power);r=a(r,s(o(t,i),u))}return r};const B=bl((e=>{if(me(q,e)){const t=q[e];return{unit:t,prefix:t.prefixes[""]}}for(const t in q)if(me(q,t)&&on(e,t)){const r=q[t],n=e.length-t.length,i=e.substring(0,n),o=me(r.prefixes,i)?r.prefixes[i]:void 0;if(void 0!==o)return{unit:r,prefix:o}}return null}),{hasher:e=>e[0],limit:100});function _(e){return e.equalBase(k.NONE)&&null!==e.value&&!r.predictable?e.value:e}w.isValuelessUnit=function(e){return null!==B(e)},w.prototype.hasBase=function(e){if("string"==typeof e&&(e=k[e]),!e)return!1;for(let t=0;t<I.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equalBase=function(e){for(let t=0;t<I.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equals=function(e){return this.equalBase(e)&&f(this.value,e.value)},w.prototype.multiply=function(e){const t=this.clone(),r=v(e)?e:new w(e);for(let e=0;e<I.length;e++)t.dimensions[e]=(this.dimensions[e]||0)+(r.dimensions[e]||0);for(let e=0;e<r.units.length;e++){const n={...r.units[e]};t.units.push(n)}if(null!==this.value||null!==r.value){const e=null===this.value?this._normalize(1):this.value,n=null===r.value?r._normalize(1):r.value;t.value=o(e,n)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.divideInto=function(e){return new w(e).divide(this)},w.prototype.divide=function(e){const t=this.clone(),r=v(e)?e:new w(e);for(let e=0;e<I.length;e++)t.dimensions[e]=(this.dimensions[e]||0)-(r.dimensions[e]||0);for(let e=0;e<r.units.length;e++){const n={...r.units[e],power:-r.units[e].power};t.units.push(n)}if(null!==this.value||null!==r.value){const e=null===this.value?this._normalize(1):this.value,n=null===r.value?r._normalize(1):r.value;t.value=a(e,n)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.pow=function(e){const t=this.clone();for(let r=0;r<I.length;r++)t.dimensions[r]=(this.dimensions[r]||0)*e;for(let r=0;r<t.units.length;r++)t.units[r].power*=e;return null!==t.value?t.value=s(t.value,e):t.value=null,t.skipAutomaticSimplification=!1,_(t)},w.prototype.abs=function(){const e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units.length||0===e.units[0].unit.offset)e.value=u(e.value);else{const t=e._numberConverter(),r=t(e.units[0].unit.value),a=t(e.units[0].unit.offset),s=o(r,a);e.value=i(u(n(e.value,s)),s)}for(const t in e.units)"VA"!==e.units[t].unit.name&&"VAR"!==e.units[t].unit.name||(e.units[t].unit=q.W);return e},w.prototype.to=function(e){const t=null===this.value?this._normalize(1):this.value;let r;if("string"==typeof e)r=w.parse(e);else{if(!v(e))throw new Error("String or Unit expected as parameter");r=e.clone()}if(!this.equalBase(r))throw new Error(`Units do not match ('${r.toString()}' != '${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=ae(t);else{const e=w._getNumberConverter(oe(t)),a=this.units[0].unit.value,s=this.units[0].unit.offset,u=o(a,s),c=r.units[0].unit.value,l=r.units[0].unit.offset,f=o(c,l);r.value=n(t,e(i(u,f)))}return r.fixPrefix=!0,r.skipAutomaticSimplification=!0,r},w.prototype.toNumber=function(e){return b(this.toNumeric(e))},w.prototype.toNumeric=function(e){let t;return t=e?this.to(e):this.clone(),t._isDerived()||0===t.units.length?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},w.prototype.toString=function(){return this.format()},w.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},w.fromJSON=function(e){var t;const r=new w(e.value,null!==(t=e.unit)&&void 0!==t?t:void 0);return r.fixPrefix=e.fixPrefix||!1,r},w.prototype.valueOf=w.prototype.toString,w.prototype.simplify=function(){const e=this.clone(),t=[];let r;for(const t in L)if(me(L,t)&&e.hasBase(k[t])){r=t;break}if("NONE"===r)e.units=[];else{let n;if(r&&me(L,r)&&(n=L[r]),n)e.units=[{unit:n.unit,prefix:n.prefix,power:1}];else{let r=!1;for(let n=0;n<I.length;n++){const i=I[n];Math.abs(e.dimensions[n]||0)>1e-12&&(me(L,i)?t.push({unit:L[i].unit,prefix:L[i].prefix,power:e.dimensions[n]||0}):r=!0)}t.length<e.units.length&&!r&&(e.units=t)}}return e},w.prototype.toSI=function(){const e=this.clone(),t=[];for(let r=0;r<I.length;r++){const n=I[r];if(Math.abs(e.dimensions[r]||0)>1e-12){if(!me(U.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:U.si[n].unit,prefix:U.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value?(e.value=null,this.to(e)):e},w.prototype.formatUnits=function(){let e="",t="",r=0,n=0;for(let t=0;t<this.units.length;t++)this.units[t].power>0?(r++,e+=" "+this.units[t].prefix.name+this.units[t].unit.name,Math.abs(this.units[t].power-1)>1e-15&&(e+="^"+this.units[t].power)):this.units[t].power<0&&n++;if(n>0)for(let e=0;e<this.units.length;e++)this.units[e].power<0&&(r>0?(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,Math.abs(this.units[e].power+1)>1e-15&&(t+="^"+-this.units[e].power)):(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,t+="^"+this.units[e].power));e=e.substr(1),t=t.substr(1),r>1&&n>0&&(e="("+e+")"),n>1&&r>0&&(t="("+t+")");let i=e;return r>0&&n>0&&(i+=" / "),i+=t,i},w.prototype.format=function(e){const t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify();let r=!1;void 0!==t.value&&null!==t.value&&x(t.value)&&(r=Math.abs(t.value.re)<1e-14);for(const e in t.units)me(t.units,e)&&t.units[e].unit&&("VA"===t.units[e].unit.name&&r?t.units[e].unit=q.VAR:"VAR"!==t.units[e].unit.name||r||(t.units[e].unit=q.VA));1!==t.units.length||t.fixPrefix||Math.abs(t.units[0].power-Math.round(t.units[0].power))<1e-14&&(t.units[0].prefix=t._bestPrefix());const n=t._denormalize(t.value);let i=null!==t.value?m(n,e||{}):"";const o=t.formatUnits();return t.value&&x(t.value)&&(i="("+i+")"),o.length>0&&i.length>0&&(i+=" "),i+=o,i},w.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");const e=null!==this.value?u(this.value):0,t=u(this.units[0].unit.value);let r=this.units[0].prefix;if(0===e)return r;const n=this.units[0].power;let i=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return r;i=Math.abs(i);const o=this.units[0].unit.prefixes;for(const a in o)if(me(o,a)){const s=o[a];if(s.scientific){const o=Math.abs(Math.log(e/Math.pow(s.value*t,n))/Math.LN10-1.2);(o<i||o===i&&s.name.length<r.name.length)&&(r=s,i=o)}}return r},w.prototype.splitUnit=function(e){let t=this.clone();const r=[];for(let n=0;n<e.length&&(t=t.to(e[n]),n!==e.length-1);n++){const o=t.toNumeric(),a=l(o);let s;s=f(a,o)?a:c(t.toNumeric());const u=new w(s,e[n].toString());r.push(u),t=i(t,u)}let o=0;for(let e=0;e<r.length;e++)o=n(o,r[e].value);return f(o,this.value)&&(t.value=0),r.push(t),r};const 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=en({},z.SHORT,z.LONG),z.BINARY_SHORT=en({},z.BINARY_SHORT_SI,z.BINARY_SHORT_IEC),z.BINARY_LONG=en({},z.BINARY_LONG_SI,z.BINARY_LONG_IEC);const I=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],k={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(const e in k)me(k,e)&&(k[e].key=e);const R={name:"",base:{},value:1,offset:0,dimensions:I.map((e=>0))},q={meter:{name:"meter",base:k.LENGTH,prefixes:z.LONG,value:1,offset:0},inch:{name:"inch",base:k.LENGTH,prefixes:z.NONE,value:.0254,offset:0},foot:{name:"foot",base:k.LENGTH,prefixes:z.NONE,value:.3048,offset:0},yard:{name:"yard",base:k.LENGTH,prefixes:z.NONE,value:.9144,offset:0},mile:{name:"mile",base:k.LENGTH,prefixes:z.NONE,value:1609.344,offset:0},link:{name:"link",base:k.LENGTH,prefixes:z.NONE,value:.201168,offset:0},rod:{name:"rod",base:k.LENGTH,prefixes:z.NONE,value:5.0292,offset:0},chain:{name:"chain",base:k.LENGTH,prefixes:z.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:k.LENGTH,prefixes:z.NONE,value:1e-10,offset:0},m:{name:"m",base:k.LENGTH,prefixes:z.SHORT,value:1,offset:0},in:{name:"in",base:k.LENGTH,prefixes:z.NONE,value:.0254,offset:0},ft:{name:"ft",base:k.LENGTH,prefixes:z.NONE,value:.3048,offset:0},yd:{name:"yd",base:k.LENGTH,prefixes:z.NONE,value:.9144,offset:0},mi:{name:"mi",base:k.LENGTH,prefixes:z.NONE,value:1609.344,offset:0},li:{name:"li",base:k.LENGTH,prefixes:z.NONE,value:.201168,offset:0},rd:{name:"rd",base:k.LENGTH,prefixes:z.NONE,value:5.02921,offset:0},ch:{name:"ch",base:k.LENGTH,prefixes:z.NONE,value:20.1168,offset:0},mil:{name:"mil",base:k.LENGTH,prefixes:z.NONE,value:254e-7,offset:0},m2:{name:"m2",base:k.SURFACE,prefixes:z.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:k.SURFACE,prefixes:z.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:k.SURFACE,prefixes:z.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:k.SURFACE,prefixes:z.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:k.SURFACE,prefixes:z.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:k.SURFACE,prefixes:z.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:k.SURFACE,prefixes:z.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:k.SURFACE,prefixes:z.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:k.SURFACE,prefixes:z.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:k.SURFACE,prefixes:z.NONE,value:1e4,offset:0},m3:{name:"m3",base:k.VOLUME,prefixes:z.CUBIC,value:1,offset:0},L:{name:"L",base:k.VOLUME,prefixes:z.SHORT,value:.001,offset:0},l:{name:"l",base:k.VOLUME,prefixes:z.SHORT,value:.001,offset:0},litre:{name:"litre",base:k.VOLUME,prefixes:z.LONG,value:.001,offset:0},cuin:{name:"cuin",base:k.VOLUME,prefixes:z.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:k.VOLUME,prefixes:z.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:k.VOLUME,prefixes:z.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:k.VOLUME,prefixes:z.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:k.VOLUME,prefixes:z.NONE,value:15e-6,offset:0},drop:{name:"drop",base:k.VOLUME,prefixes:z.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:k.VOLUME,prefixes:z.NONE,value:5e-8,offset:0},minim:{name:"minim",base:k.VOLUME,prefixes:z.NONE,value:6.1611519921875e-8,offset:0},fluiddram:{name:"fluiddram",base:k.VOLUME,prefixes:z.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:k.VOLUME,prefixes:z.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:k.VOLUME,prefixes:z.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:k.VOLUME,prefixes:z.NONE,value:1e-6,offset:0},cup:{name:"cup",base:k.VOLUME,prefixes:z.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:k.VOLUME,prefixes:z.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:k.VOLUME,prefixes:z.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:k.VOLUME,prefixes:z.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:k.VOLUME,prefixes:z.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:k.VOLUME,prefixes:z.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:k.VOLUME,prefixes:z.NONE,value:.238480942392,offset:0},g:{name:"g",base:k.MASS,prefixes:z.SHORT,value:.001,offset:0},gram:{name:"gram",base:k.MASS,prefixes:z.LONG,value:.001,offset:0},ton:{name:"ton",base:k.MASS,prefixes:z.SHORT,value:907.18474,offset:0},t:{name:"t",base:k.MASS,prefixes:z.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:k.MASS,prefixes:z.LONG,value:1e3,offset:0},grain:{name:"grain",base:k.MASS,prefixes:z.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:k.MASS,prefixes:z.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:k.MASS,prefixes:z.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:k.MASS,prefixes:z.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:k.MASS,prefixes:z.NONE,value:45.359237,offset:0},stick:{name:"stick",base:k.MASS,prefixes:z.NONE,value:.115,offset:0},stone:{name:"stone",base:k.MASS,prefixes:z.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:k.MASS,prefixes:z.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:k.MASS,prefixes:z.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:k.MASS,prefixes:z.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:k.MASS,prefixes:z.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:k.MASS,prefixes:z.NONE,value:45.359237,offset:0},s:{name:"s",base:k.TIME,prefixes:z.SHORT,value:1,offset:0},min:{name:"min",base:k.TIME,prefixes:z.NONE,value:60,offset:0},h:{name:"h",base:k.TIME,prefixes:z.NONE,value:3600,offset:0},second:{name:"second",base:k.TIME,prefixes:z.LONG,value:1,offset:0},sec:{name:"sec",base:k.TIME,prefixes:z.LONG,value:1,offset:0},minute:{name:"minute",base:k.TIME,prefixes:z.NONE,value:60,offset:0},hour:{name:"hour",base:k.TIME,prefixes:z.NONE,value:3600,offset:0},day:{name:"day",base:k.TIME,prefixes:z.NONE,value:86400,offset:0},week:{name:"week",base:k.TIME,prefixes:z.NONE,value:604800,offset:0},month:{name:"month",base:k.TIME,prefixes:z.NONE,value:2629800,offset:0},year:{name:"year",base:k.TIME,prefixes:z.NONE,value:31557600,offset:0},decade:{name:"decade",base:k.TIME,prefixes:z.NONE,value:315576e3,offset:0},century:{name:"century",base:k.TIME,prefixes:z.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:k.TIME,prefixes:z.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:k.FREQUENCY,prefixes:z.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:k.FREQUENCY,prefixes:z.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:k.ANGLE,prefixes:z.SHORT,value:1,offset:0},radian:{name:"radian",base:k.ANGLE,prefixes:z.LONG,value:1,offset:0},deg:{name:"deg",base:k.ANGLE,prefixes:z.SHORT,value:null,offset:0},degree:{name:"degree",base:k.ANGLE,prefixes:z.LONG,value:null,offset:0},grad:{name:"grad",base:k.ANGLE,prefixes:z.SHORT,value:null,offset:0},gradian:{name:"gradian",base:k.ANGLE,prefixes:z.LONG,value:null,offset:0},cycle:{name:"cycle",base:k.ANGLE,prefixes:z.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:k.ANGLE,prefixes:z.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:k.ANGLE,prefixes:z.NONE,value:null,offset:0},A:{name:"A",base:k.CURRENT,prefixes:z.SHORT,value:1,offset:0},ampere:{name:"ampere",base:k.CURRENT,prefixes:z.LONG,value:1,offset:0},K:{name:"K",base:k.TEMPERATURE,prefixes:z.SHORT,value:1,offset:0},degC:{name:"degC",base:k.TEMPERATURE,prefixes:z.SHORT,value:1,offset:273.15},degF:{name:"degF",base:k.TEMPERATURE,prefixes:z.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:k.TEMPERATURE,prefixes:z.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:k.TEMPERATURE,prefixes:z.LONG,value:1,offset:0},celsius:{name:"celsius",base:k.TEMPERATURE,prefixes:z.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:k.TEMPERATURE,prefixes:z.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:k.TEMPERATURE,prefixes:z.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:k.AMOUNT_OF_SUBSTANCE,prefixes:z.SHORT,value:1,offset:0},mole:{name:"mole",base:k.AMOUNT_OF_SUBSTANCE,prefixes:z.LONG,value:1,offset:0},cd:{name:"cd",base:k.LUMINOUS_INTENSITY,prefixes:z.SHORT,value:1,offset:0},candela:{name:"candela",base:k.LUMINOUS_INTENSITY,prefixes:z.LONG,value:1,offset:0},N:{name:"N",base:k.FORCE,prefixes:z.SHORT,value:1,offset:0},newton:{name:"newton",base:k.FORCE,prefixes:z.LONG,value:1,offset:0},dyn:{name:"dyn",base:k.FORCE,prefixes:z.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:k.FORCE,prefixes:z.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:k.FORCE,prefixes:z.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:k.FORCE,prefixes:z.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:k.FORCE,prefixes:z.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:k.FORCE,prefixes:z.NONE,value:9.80665,offset:0},J:{name:"J",base:k.ENERGY,prefixes:z.SHORT,value:1,offset:0},joule:{name:"joule",base:k.ENERGY,prefixes:z.LONG,value:1,offset:0},erg:{name:"erg",base:k.ENERGY,prefixes:z.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:k.ENERGY,prefixes:z.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:k.ENERGY,prefixes:z.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:k.ENERGY,prefixes:z.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:k.ENERGY,prefixes:z.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:k.POWER,prefixes:z.SHORT,value:1,offset:0},watt:{name:"watt",base:k.POWER,prefixes:z.LONG,value:1,offset:0},hp:{name:"hp",base:k.POWER,prefixes:z.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:k.POWER,prefixes:z.SHORT,value:d.I,offset:0},VA:{name:"VA",base:k.POWER,prefixes:z.SHORT,value:1,offset:0},Pa:{name:"Pa",base:k.PRESSURE,prefixes:z.SHORT,value:1,offset:0},psi:{name:"psi",base:k.PRESSURE,prefixes:z.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:k.PRESSURE,prefixes:z.NONE,value:101325,offset:0},bar:{name:"bar",base:k.PRESSURE,prefixes:z.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:k.PRESSURE,prefixes:z.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:k.PRESSURE,prefixes:z.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:k.PRESSURE,prefixes:z.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:k.PRESSURE,prefixes:z.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:k.ELECTRIC_CHARGE,prefixes:z.LONG,value:1,offset:0},C:{name:"C",base:k.ELECTRIC_CHARGE,prefixes:z.SHORT,value:1,offset:0},farad:{name:"farad",base:k.ELECTRIC_CAPACITANCE,prefixes:z.LONG,value:1,offset:0},F:{name:"F",base:k.ELECTRIC_CAPACITANCE,prefixes:z.SHORT,value:1,offset:0},volt:{name:"volt",base:k.ELECTRIC_POTENTIAL,prefixes:z.LONG,value:1,offset:0},V:{name:"V",base:k.ELECTRIC_POTENTIAL,prefixes:z.SHORT,value:1,offset:0},ohm:{name:"ohm",base:k.ELECTRIC_RESISTANCE,prefixes:z.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:k.ELECTRIC_INDUCTANCE,prefixes:z.LONG,value:1,offset:0},H:{name:"H",base:k.ELECTRIC_INDUCTANCE,prefixes:z.SHORT,value:1,offset:0},siemens:{name:"siemens",base:k.ELECTRIC_CONDUCTANCE,prefixes:z.LONG,value:1,offset:0},S:{name:"S",base:k.ELECTRIC_CONDUCTANCE,prefixes:z.SHORT,value:1,offset:0},weber:{name:"weber",base:k.MAGNETIC_FLUX,prefixes:z.LONG,value:1,offset:0},Wb:{name:"Wb",base:k.MAGNETIC_FLUX,prefixes:z.SHORT,value:1,offset:0},tesla:{name:"tesla",base:k.MAGNETIC_FLUX_DENSITY,prefixes:z.LONG,value:1,offset:0},T:{name:"T",base:k.MAGNETIC_FLUX_DENSITY,prefixes:z.SHORT,value:1,offset:0},b:{name:"b",base:k.BIT,prefixes:z.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:k.BIT,prefixes:z.BINARY_LONG,value:1,offset:0},B:{name:"B",base:k.BIT,prefixes:z.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:k.BIT,prefixes:z.BINARY_LONG,value:8,offset:0}},P={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fldr:"fluiddram",fluiddrams:"fluiddram",floz:"fluidounce",fluidounces:"fluidounce",gi:"gill",gills:"gill",cp:"cup",cups:"cup",pt:"pint",pints:"pint",qt:"quart",quarts:"quart",gal:"gallon",gallons:"gallon",bbl:"beerbarrel",beerbarrels:"beerbarrel",obl:"oilbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function j(e){if("BigNumber"===e.number){const e=Nl(g);q.rad.value=new g(1),q.deg.value=e.div(180),q.grad.value=e.div(200),q.cycle.value=e.times(2),q.arcsec.value=e.div(648e3),q.arcmin.value=e.div(10800)}else q.rad.value=1,q.deg.value=Math.PI/180,q.grad.value=Math.PI/200,q.cycle.value=2*Math.PI,q.arcsec.value=Math.PI/648e3,q.arcmin.value=Math.PI/10800;q.radian.value=q.rad.value,q.degree.value=q.deg.value,q.gradian.value=q.grad.value}j(r),t&&t("config",(function(e,t){e.number!==t.number&&j(e)}));const U={si:{NONE:{unit:R,prefix:z.NONE[""]},LENGTH:{unit:q.m,prefix:z.SHORT[""]},MASS:{unit:q.g,prefix:z.SHORT.k},TIME:{unit:q.s,prefix:z.SHORT[""]},CURRENT:{unit:q.A,prefix:z.SHORT[""]},TEMPERATURE:{unit:q.K,prefix:z.SHORT[""]},LUMINOUS_INTENSITY:{unit:q.cd,prefix:z.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:q.mol,prefix:z.SHORT[""]},ANGLE:{unit:q.rad,prefix:z.SHORT[""]},BIT:{unit:q.bits,prefix:z.SHORT[""]},FORCE:{unit:q.N,prefix:z.SHORT[""]},ENERGY:{unit:q.J,prefix:z.SHORT[""]},POWER:{unit:q.W,prefix:z.SHORT[""]},PRESSURE:{unit:q.Pa,prefix:z.SHORT[""]},ELECTRIC_CHARGE:{unit:q.C,prefix:z.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:q.F,prefix:z.SHORT[""]},ELECTRIC_POTENTIAL:{unit:q.V,prefix:z.SHORT[""]},ELECTRIC_RESISTANCE:{unit:q.ohm,prefix:z.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:q.H,prefix:z.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:q.S,prefix:z.SHORT[""]},MAGNETIC_FLUX:{unit:q.Wb,prefix:z.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:q.T,prefix:z.SHORT[""]},FREQUENCY:{unit:q.Hz,prefix:z.SHORT[""]}}};U.cgs=JSON.parse(JSON.stringify(U.si)),U.cgs.LENGTH={unit:q.m,prefix:z.SHORT.c},U.cgs.MASS={unit:q.g,prefix:z.SHORT[""]},U.cgs.FORCE={unit:q.dyn,prefix:z.SHORT[""]},U.cgs.ENERGY={unit:q.erg,prefix:z.NONE[""]},U.us=JSON.parse(JSON.stringify(U.si)),U.us.LENGTH={unit:q.ft,prefix:z.NONE[""]},U.us.MASS={unit:q.lbm,prefix:z.NONE[""]},U.us.TEMPERATURE={unit:q.degF,prefix:z.NONE[""]},U.us.FORCE={unit:q.lbf,prefix:z.NONE[""]},U.us.ENERGY={unit:q.BTU,prefix:z.BTU[""]},U.us.POWER={unit:q.hp,prefix:z.NONE[""]},U.us.PRESSURE={unit:q.psi,prefix:z.NONE[""]},U.auto=JSON.parse(JSON.stringify(U.si));let L=U.auto;w.setUnitSystem=function(e){if(!me(U,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(U).join(", "));L=U[e]},w.getUnitSystem=function(){for(const e in U)if(me(U,e)&&U[e]===L)return e},w.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new g(e.n).div(e.d).times(e.s):new g(e+"")},Fraction:function(e){return new y(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?h(e):e}},w.prototype._numberConverter=function(){const e=w.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},w._getNumberConverter=function(e){if(!w.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return w.typeConverters[e]};for(const e in q)if(me(q,e)){const t=q[e];t.dimensions=t.base.dimensions}for(const e in P)if(me(P,e)){const t=q[P[e]],r={};for(const e in t)me(t,e)&&(r[e]=t[e]);r.name=e,q[e]=r}return w.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},w.createUnit=function(e,t){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(const t in e)if(me(e,t)&&w.deleteUnit(t),e[t].aliases)for(let r=0;r<e[t].aliases.length;r++)w.deleteUnit(e[t].aliases[r]);let r;for(const t in e)me(e,t)&&(r=w.createUnitSingle(t,e[t]));return r},w.createUnitSingle=function(e,t){if(null==t&&(t={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(me(q,e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(let t=0;t<e.length;t++){if(A=e.charAt(t),0===t&&!w.isValidAlpha(A))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!w.isValidAlpha(A)&&!M(A))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);let r,n,i,o=null,a=[],s=0;if(t&&"Unit"===t.type)o=t.clone();else if("string"==typeof t)""!==t&&(r=t);else{if("object"!=typeof t)throw new TypeError('Cannot create unit "'+e+'" from "'+t.toString()+'": expecting "string" or "Unit" or "Object"');r=t.definition,n=t.prefixes,s=t.offset,i=t.baseName,t.aliases&&(a=t.aliases.valueOf())}if(a)for(let e=0;e<a.length;e++)if(me(q,a[e]))throw new Error('Cannot create alias "'+a[e]+'": a unit with that name already exists');if(r&&"string"==typeof r&&!o)try{o=w.parse(r,{allowNoUnits:!0})}catch(t){throw t.message='Could not create unit "'+e+'" from "'+r+'": '+t.message,t}else r&&"Unit"===r.type&&(o=r.clone());a=a||[],s=s||0,n=n&&n.toUpperCase&&z[n.toUpperCase()]||z.NONE;let u={};if(o){u={name:e,value:o.value,dimensions:o.dimensions.slice(0),prefixes:n,offset:s};let t=!1;for(const e in k)if(me(k,e)){let r=!0;for(let t=0;t<I.length;t++)if(Math.abs((u.dimensions[t]||0)-(k[e].dimensions[t]||0))>1e-12){r=!1;break}if(r){t=!0,u.base=k[e];break}}if(!t){i=i||e+"_STUFF";const t={dimensions:o.dimensions.slice(0)};t.key=i,k[i]=t,L[i]={unit:u,prefix:z.NONE[""]},u.base=k[i]}}else{if(i=i||e+"_STUFF",I.indexOf(i)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');I.push(i);for(const e in k)me(k,e)&&(k[e].dimensions[I.length-1]=0);const t={dimensions:[]};for(let e=0;e<I.length;e++)t.dimensions[e]=0;t.dimensions[I.length-1]=1,t.key=i,k[i]=t,u={name:e,value:1,dimensions:k[i].dimensions.slice(0),prefixes:n,offset:s,base:k[i]},L[i]={unit:u,prefix:z.NONE[""]}}w.UNITS[e]=u;for(let e=0;e<a.length;e++){const t=a[e],r={};for(const e in u)me(u,e)&&(r[e]=u[e]);r.name=t,w.UNITS[t]=r}return delete B.cache,new w(null,e)},w.deleteUnit=function(e){delete w.UNITS[e],delete B.cache},w.PREFIXES=z,w.BASE_DIMENSIONS=I,w.BASE_UNITS=k,w.UNIT_SYSTEMS=U,w.UNITS=q,w}),{isClass:!0}),Ml="unit",Cl=he(Ml,["typed","Unit"],(e=>{let{typed:t,Unit:r}=e;return t(Ml,{Unit:function(e){return e.clone()},string:function(e){return r.isValuelessUnit(e)?new r(null,e):r.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new r(e,t)},"number | BigNumber | Fraction":function(e){return new r(e)},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),Tl="sparse",Dl=he(Tl,["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:r}=e;return t(Tl,{"":function(){return new r([])},string:function(e){return new r([],e)},"Array | Matrix":function(e){return new r(e)},"Array | Matrix, string":function(e,t){return new r(e,t)}})})),Fl="createUnit",Ol=he(Fl,["typed","Unit"],(e=>{let{typed:t,Unit:r}=e;return t(Fl,{"Object, Object":function(e,t){return r.createUnit(e,t)},Object:function(e){return r.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,n){const i={};return i[e]=t,r.createUnit(i,n)},"string, Unit | string | Object":function(e,t){const n={};return n[e]=t,r.createUnit(n,{})},string:function(e){const t={};return t[e]={},r.createUnit(t,{})}})})),Bl="acos",_l=he(Bl,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(Bl,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),zl="number";function Il(e){return ze(e)}function kl(e){return Math.atan(1/e)}function Rl(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function ql(e){return Math.asin(1/e)}function Pl(e){const t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function jl(e){return Math.acos(1/e)}function Ul(e){const t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}function Ll(e){return Ie(e)}function $l(e){return ke(e)}function Hl(e){return 1/Math.tan(e)}function Gl(e){const t=Math.exp(2*e);return(t+1)/(t-1)}function Vl(e){return 1/Math.sin(e)}function Wl(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*be(e)}function Zl(e){return 1/Math.cos(e)}function Yl(e){return 2/(Math.exp(e)+Math.exp(-e))}function Jl(e){return qe(e)}Il.signature=zl,kl.signature=zl,Rl.signature=zl,ql.signature=zl,Pl.signature=zl,jl.signature=zl,Ul.signature=zl,Ll.signature=zl,$l.signature=zl,Hl.signature=zl,Gl.signature=zl,Vl.signature=zl,Wl.signature=zl,Zl.signature=zl,Yl.signature=zl,Jl.signature=zl;const Xl="acosh",Ql=he(Xl,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(Xl,{number:function(e){return e>=1||r.predictable?Il(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()}})})),Kl="acot",ef=he(Kl,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(Kl,{number:kl,Complex:function(e){return e.acot()},BigNumber:function(e){return new r(1).div(e).atan()}})})),tf="acoth",rf=he(tf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(tf,{number:function(e){return e>=1||e<=-1||r.predictable?Rl(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),nf="acsc",of=he(nf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(nf,{number:function(e){return e<=-1||e>=1||r.predictable?ql(e):new n(e,0).acsc()},Complex:function(e){return e.acsc()},BigNumber:function(e){return new i(1).div(e).asin()}})})),af="acsch",sf=he(af,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(af,{number:Pl,Complex:function(e){return e.acsch()},BigNumber:function(e){return new r(1).div(e).asinh()}})})),uf="asec",cf=he(uf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(uf,{number:function(e){return e<=-1||e>=1||r.predictable?jl(e):new n(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new i(1).div(e).acos()}})})),lf="asech",ff=he(lf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(lf,{number:function(e){if(e<=1&&e>=-1||r.predictable){const t=1/e;if(t>0||r.predictable)return Ul(e);const i=Math.sqrt(t*t-1);return new n(Math.log(i-t),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),pf="asin",mf=he(pf,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(pf,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),hf=he("asinh",["typed"],(e=>{let{typed:t}=e;return t("asinh",{number:Ll,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),df=he("atan",["typed"],(e=>{let{typed:t}=e;return t("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),gf="atan2",yf=he(gf,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:o,concat:a}=e;const s=Zo({typed:t,equalScalar:n}),u=Yo({typed:t}),c=Oa({typed:t,equalScalar:n}),l=To({typed:t,equalScalar:n}),f=Do({typed:t,DenseMatrix:o}),p=Ko({typed:t,matrix:r,concat:a});return t(gf,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,t)=>i.atan2(e,t)},p({scalar:"number | BigNumber",SS:c,DS:u,SD:s,Ss:l,sS:f}))})),xf="atanh",bf=he(xf,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(xf,{number:function(e){return e<=1&&e>=-1||r.predictable?$l(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),vf=he("trigUnit",["typed"],(e=>{let{typed:t}=e;return{Unit:t.referToSelf((e=>r=>{if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(e,r.valueType())(r.value)}))}})),wf=he("cos",["typed"],(e=>{let{typed:t}=e;const r=vf({typed:t});return t("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},r)})),Nf="cosh",Ef=he(Nf,["typed"],(e=>{let{typed:t}=e;return t(Nf,{number:Re,"Complex | BigNumber":e=>e.cosh()})})),Af=he("cot",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("cot",{number:Hl,Complex:e=>e.cot(),BigNumber:e=>new r(1).div(e.tan())},vf({typed:t}))})),Sf="coth",Mf=he(Sf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(Sf,{number:Gl,Complex:e=>e.coth(),BigNumber:e=>new r(1).div(e.tanh())})})),Cf=he("csc",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("csc",{number:Vl,Complex:e=>e.csc(),BigNumber:e=>new r(1).div(e.sin())},vf({typed:t}))})),Tf="csch",Df=he(Tf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(Tf,{number:Wl,Complex:e=>e.csch(),BigNumber:e=>new r(1).div(e.sinh())})})),Ff=he("sec",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("sec",{number:Zl,Complex:e=>e.sec(),BigNumber:e=>new r(1).div(e.cos())},vf({typed:t}))})),Of="sech",Bf=he(Of,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(Of,{number:Yl,Complex:e=>e.sech(),BigNumber:e=>new r(1).div(e.cosh())})})),_f=he("sin",["typed"],(e=>{let{typed:t}=e;const r=vf({typed:t});return t("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},r)})),zf="sinh",If=he(zf,["typed"],(e=>{let{typed:t}=e;return t(zf,{number:Jl,"Complex | BigNumber":e=>e.sinh()})})),kf=he("tan",["typed"],(e=>{let{typed:t}=e;const r=vf({typed:t});return t("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},r)})),Rf=he("tanh",["typed"],(e=>{let{typed:t}=e;return t("tanh",{number:Pe,"Complex | BigNumber":e=>e.tanh()})})),qf="setCartesian",Pf=he(qf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(qf,{"Array | Matrix, Array | Matrix":function(e,t){let s=[];if(0!==n(r(e),new o(0))&&0!==n(r(t),new o(0))){const r=Dn(Array.isArray(e)?e:e.toArray()).sort(i),n=Dn(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(let e=0;e<r.length;e++)for(let t=0;t<n.length;t++)s.push([r[e],n[t]])}return Array.isArray(e)&&Array.isArray(t)?s:new a(s)}})})),jf="setDifference",Uf=he(jf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(jf,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===n(r(e),new o(0)))s=[];else{if(0===n(r(t),new o(0)))return Dn(e.toArray());{const r=zn(Dn(Array.isArray(e)?e:e.toArray()).sort(i)),n=zn(Dn(Array.isArray(t)?t:t.toArray()).sort(i));let o;s=[];for(let e=0;e<r.length;e++){o=!1;for(let t=0;t<n.length;t++)if(0===i(r[e].value,n[t].value)&&r[e].identifier===n[t].identifier){o=!0;break}o||s.push(r[e])}}}return Array.isArray(e)&&Array.isArray(t)?In(s):new a(In(s))}})})),Lf="setDistinct",$f=he(Lf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Lf,{"Array | Matrix":function(e){let t;if(0===n(r(e),new o(0)))t=[];else{const r=Dn(Array.isArray(e)?e:e.toArray()).sort(i);t=[],t.push(r[0]);for(let e=1;e<r.length;e++)0!==i(r[e],r[e-1])&&t.push(r[e])}return Array.isArray(e)?t:new a(t)}})})),Hf="setIntersect",Gf=he(Hf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Hf,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===n(r(e),new o(0))||0===n(r(t),new o(0)))s=[];else{const r=zn(Dn(Array.isArray(e)?e:e.toArray()).sort(i)),n=zn(Dn(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(let e=0;e<r.length;e++)for(let t=0;t<n.length;t++)if(0===i(r[e].value,n[t].value)&&r[e].identifier===n[t].identifier){s.push(r[e]);break}}return Array.isArray(e)&&Array.isArray(t)?In(s):new a(In(s))}})})),Vf="setIsSubset",Wf=he(Vf,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o}=e;return t(Vf,{"Array | Matrix, Array | Matrix":function(e,t){if(0===n(r(e),new o(0)))return!0;if(0===n(r(t),new o(0)))return!1;const a=zn(Dn(Array.isArray(e)?e:e.toArray()).sort(i)),s=zn(Dn(Array.isArray(t)?t:t.toArray()).sort(i));let u;for(let e=0;e<a.length;e++){u=!1;for(let t=0;t<s.length;t++)if(0===i(a[e].value,s[t].value)&&a[e].identifier===s[t].identifier){u=!0;break}if(!1===u)return!1}return!0}})})),Zf="setMultiplicity",Yf=he(Zf,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o}=e;return t(Zf,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===n(r(t),new o(0)))return 0;const a=Dn(Array.isArray(t)?t:t.toArray());let s=0;for(let t=0;t<a.length;t++)0===i(a[t],e)&&s++;return s}})})),Jf="setPowerset",Xf=he(Jf,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o}=e;return t(Jf,{"Array | Matrix":function(e){if(0===n(r(e),new o(0)))return[];const t=Dn(Array.isArray(e)?e:e.toArray()).sort(i),s=[];let u=0;for(;u.toString(2).length<=t.length;)s.push(a(t,u.toString(2).split("").reverse())),u++;return function(e){let t=[];for(let r=e.length-1;r>0;r--)for(let n=0;n<r;n++)e[n].length>e[n+1].length&&(t=e[n],e[n]=e[n+1],e[n+1]=t);return e}(s)}});function a(e,t){const r=[];for(let n=0;n<t.length;n++)"1"===t[n]&&r.push(e[n]);return r}})),Qf="setSize",Kf=he(Qf,["typed","compareNatural"],(e=>{let{typed:t,compareNatural:r}=e;return t(Qf,{"Array | Matrix":function(e){return Array.isArray(e)?Dn(e).length:Dn(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return Array.isArray(e)?Dn(e).length:Dn(e.toArray()).length;{const t=Dn(Array.isArray(e)?e:e.toArray()).sort(r);let n=1;for(let e=1;e<t.length;e++)0!==r(t[e],t[e-1])&&n++;return n}}})})),ep="setSymDifference",tp=he(ep,["typed","size","concat","subset","setDifference","Index"],(e=>{let{typed:t,size:r,concat:n,subset:i,setDifference:o,Index:a}=e;return t(ep,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new a(0)))return Dn(t);if(0===i(r(t),new a(0)))return Dn(e);const s=Dn(e),u=Dn(t);return n(o(s,u),o(u,s))}})})),rp="setUnion",np=he(rp,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],(e=>{let{typed:t,size:r,concat:n,subset:i,setIntersect:o,setSymDifference:a,Index:s}=e;return t(rp,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new s(0)))return Dn(t);if(0===i(r(t),new s(0)))return Dn(e);const u=Dn(e),c=Dn(t);return n(a(u,c),o(u,c))}})})),ip=he("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],(e=>{let{typed:t,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:o,SparseMatrix:a,concat:s}=e;const u=ta({typed:t}),c=ra({typed:t,equalScalar:i}),l=na({typed:t,DenseMatrix:o}),f=Ko({typed:t,matrix:r,concat:s});return t("add",{"any, any":n,"any, any, ...any":t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i}))},f({elop:n,DS:u,SS:c,Ss:l}))})),op="hypot",ap=he(op,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],(e=>{let{typed:t,abs:r,addScalar:n,divideScalar:i,multiplyScalar:o,sqrt:a,smaller:s,isPositive:u}=e;return t(op,{"... number | BigNumber":c,Array:c,Matrix:e=>c(Dn(e.toArray()))});function c(e){let t=0,c=0;for(let a=0;a<e.length;a++){if(x(e[a]))throw new TypeError("Unexpected type of argument to hypot");const l=r(e[a]);s(c,l)?(t=o(t,o(i(c,l),i(c,l))),t=n(t,1),c=l):t=n(t,u(l)?o(i(l,c),i(l,c)):l)}return o(c,a(t))}})),sp="norm",up=he(sp,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],(e=>{let{typed:t,abs:r,add:n,pow:i,conj:o,sqrt:a,multiply:s,equalScalar:u,larger:c,smaller:l,matrix:f,ctranspose:p,eigs:m}=e;return t(sp,{number:Math.abs,Complex:function(e){return e.abs()},BigNumber:function(e){return e.abs()},boolean:function(e){return Math.abs(e)},Array:function(e){return h(f(e),2)},Matrix:function(e){return h(e,2)},"Array, number | BigNumber | string":function(e,t){return h(f(e),t)},"Matrix, number | BigNumber | string":function(e,t){return h(e,t)}});function h(e,t){const f=e.size();if(1===f.length)return function(e,t){if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){let t=0;return e.forEach((function(e){const n=r(e);c(n,t)&&(t=n)}),!0),t}(e);if(t===Number.NEGATIVE_INFINITY||"-inf"===t)return function(e){let t;return e.forEach((function(e){const n=r(e);t&&!l(n,t)||(t=n)}),!0),t||0}(e);if("fro"===t)return h(e,2);if("number"==typeof t&&!isNaN(t)){if(!u(t,0)){let o=0;return e.forEach((function(e){o=n(i(r(e),t),o)}),!0),i(o,1/t)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}(e,t);if(2===f.length){if(f[0]&&f[1])return function(e,t){if(1===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[1],s=n(t[a]||0,r(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[0],s=n(t[a]||0,r(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if("fro"===t)return function(e){let t=0;return e.forEach((function(e,r){t=n(t,s(e,o(e)))})),r(a(t))}(e);if(2===t)return function(e){const t=e.size();if(t[0]!==t[1])throw new RangeError("Invalid matrix dimensions");const n=p(e),i=s(n,e),o=m(i).values.toArray(),u=o[o.length-1];return r(a(u))}(e);throw new Error("Unsupported parameter value "+t)}(e,t);throw new RangeError("Invalid matrix dimensions")}}})),cp=he("dot",["typed","addScalar","multiplyScalar","conj","size"],(e=>{let{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){const u=a(e,o),c=E(e)?e._data:e,l=E(e)?e._datatype||e.getDataType():void 0,f=E(o)?o._data:o,p=E(o)?o._datatype||o.getDataType():void 0,m=2===s(e).length,h=2===s(o).length;let d=r,g=n;if(l&&p&&l===p&&"string"==typeof l&&"mixed"!==l){const e=l;d=t.find(r,[e,e]),g=t.find(n,[e,e])}if(!m&&!h){let e=g(i(c[0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t]));return e}if(!m&&h){let e=g(i(c[0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t][0]));return e}if(m&&!h){let e=g(i(c[0][0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t]));return e}if(m&&h){let e=g(i(c[0][0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t][0]));return e}},"SparseMatrix, SparseMatrix":function(e,t){a(e,t);const i=e._index,o=e._values,s=t._index,u=t._values;let c=0;const l=r,f=n;let p=0,m=0;for(;p<i.length&&m<s.length;){const e=i[p],t=s[m];e<t?p++:e>t?m++:e===t&&(c=l(c,f(o[p],u[m])),p++,m++)}return c}});function a(e,t){const r=s(e),n=s(t);let i,o;if(1===r.length)i=r[0];else{if(2!==r.length||1!==r[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+r.join(", ")+")");i=r[0]}if(1===n.length)o=n[0];else{if(2!==n.length||1!==n[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+n.join(", ")+")");o=n[0]}if(i!==o)throw new RangeError("Vectors must have equal length ("+i+" != "+o+")");if(0===i)throw new RangeError("Cannot calculate the dot product of empty vectors");return i}function s(e){return E(e)?e.size():o(e)}})),lp=he("trace",["typed","matrix","add"],(e=>{let{typed:t,matrix:r,add:n}=e;return t("trace",{Array:function(e){return i(r(e))},SparseMatrix:function(e){const t=e._values,r=e._index,i=e._ptr,o=e._size,a=o[0],s=o[1];if(a===s){let e=0;if(t.length>0)for(let o=0;o<s;o++){const a=i[o],s=i[o+1];for(let i=a;i<s;i++){const a=r[i];if(a===o){e=n(e,t[i]);break}if(a>o)break}}return e}throw new RangeError("Matrix must be square (size: "+an(o)+")")},DenseMatrix:i,any:ae});function i(e){const t=e._size,r=e._data;switch(t.length){case 1:if(1===t[0])return ae(r[0]);throw new RangeError("Matrix must be square (size: "+an(t)+")");case 2:{const e=t[0];if(e===t[1]){let t=0;for(let i=0;i<e;i++)t=n(t,r[i][i]);return t}throw new RangeError("Matrix must be square (size: "+an(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+an(t)+")")}}})),fp="index",pp=he(fp,["typed","Index"],(e=>{let{typed:t,Index:r}=e;return t(fp,{"...number | string | BigNumber | Range | Array | Matrix":function(e){const t=e.map((function(e){return g(e)?e.toNumber():N(e)||E(e)?e.map((function(e){return g(e)?e.toNumber():e})):e})),n=new r;return r.apply(n,t),n}})})),mp=new Set(["end"]),hp=he("Node",["mathWithTransform"],(e=>{let{mathWithTransform:t}=e;return class{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){const e=this._compile(t,{}),r={};return{evaluate:function(t){const n=h(t);return function(e){for(const t of[...mp])if(e.has(t))throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(n),e(n,r,null)}}}_compile(e,t){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw new Error("Cannot run forEach on a Node interface")}map(e){throw new Error("Cannot run map on a Node interface")}_ifNode(e){if(!X(e))throw new TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),function e(t,r){t.forEach((function(t,n,i){r(t,n,i),e(t,r)}))}(this,e)}transform(e){return function t(r,n,i){const o=e(r,n,i);return o!==r?o:r.map(t)}(this,null,null)}filter(e){const t=[];return this.traverse((function(r,n,i){e(r,n,i)&&t.push(r)})),t}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map((function(e){return e.cloneDeep()}))}equals(e){return!!e&&this.type===e.type&&ce(this,e)}toString(e){const t=this._getCustomString(e);return void 0!==t?t:this._toString(e)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){const t=this._getCustomString(e);return void 0!==t?t:this._toHTML(e)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(e){const t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)}_toTex(e){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(e){if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}}),{isClass:!0,isNode:!0});function dp(e){return dp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dp(e)}function gp(e,t,r){return(t=function(e){var t=function(e){if("object"!=dp(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=dp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==dp(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function yp(e){return e&&e.isIndexError?new mn(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function xp(e){let{subset:t}=e;return function(e,r){try{if(Array.isArray(e))return t(e,r);if(e&&"function"==typeof e.subset)return e.subset(r);if("string"==typeof e)return t(e,r);if("object"==typeof e){if(!r.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return i(e,r.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw yp(e)}}}const bp="AccessorNode",vp=he(bp,["subset","Node"],(e=>{let{subset:t,Node:r}=e;const n=xp({subset:t});function o(e){return!(U(e)||L(e)||V(e)||Y(e)||Q(e)||ee(e)||ne(e))}class a extends r{constructor(e,t){if(super(),!X(e))throw new TypeError('Node expected for parameter "object"');if(!J(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=t}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return bp}get isAccessorNode(){return!0}_compile(e,t){const r=this.object._compile(e,t),o=this.index._compile(e,t);if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,n,o){return i(r(t,n,o),e)}}return function(e,t,i){const a=r(e,t,i),s=o(e,t,a);return n(a,s)}}forEach(e){e(this.object,"object",this),e(this.index,"index",this)}map(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(e){let t=this.object.toString(e);return o(this.object)&&(t="("+t+")"),t+this.index.toString(e)}_toHTML(e){let t=this.object.toHTML(e);return o(this.object)&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+this.index.toHTML(e)}_toTex(e){let t=this.object.toTex(e);return o(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)}toJSON(){return{mathjs:bp,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return gp(a,"name",bp),a}),{isClass:!0,isNode:!0}),wp="ArrayNode",Np=he(wp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(X))throw new TypeError("Array containing Nodes expected")}get type(){return wp}get isArrayNode(){return!0}_compile(e,t){const r=Fn(this.items,(function(r){return r._compile(e,t)}));if("Array"!==e.config.matrix){const t=e.matrix;return function(e,n,i){return t(Fn(r,(function(t){return t(e,n,i)})))}}return function(e,t,n){return Fn(r,(function(r){return r(e,t,n)}))}}forEach(e){for(let t=0;t<this.items.length;t++)e(this.items[t],"items["+t+"]",this)}map(e){const t=[];for(let r=0;r<this.items.length;r++)t[r]=this._ifNode(e(this.items[r],"items["+r+"]",this));return new r(t)}clone(){return new r(this.items.slice(0))}_toString(e){return"["+this.items.map((function(t){return t.toString(e)})).join(", ")+"]"}toJSON(){return{mathjs:wp,items:this.items}}static fromJSON(e){return new r(e.items)}_toHTML(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map((function(t){return t.toHTML(e)})).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){return function t(r,n){const i=r.some(L)&&!r.every(L),o=n||i,a=o?"&":"\\\\",s=r.map((function(r){return r.items?t(r.items,!n):r.toTex(e)})).join(a);return i||!o||o&&!n?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return gp(r,"name",wp),r}),{isClass:!0,isNode:!0}),Ep=[{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 Ap(e,t){if(!t||"auto"!==t)return e;let r=e;for(;ee(r);)r=r.content;return r}function Sp(e,t,r,n){let i=e;"keep"!==t&&(i=e.getContent());const o=i.getIdentifier();let a=null;for(let e=0;e<Ep.length;e++)if(o in Ep[e]){a=e;break}if("OperatorNode:multiply"===o&&i.implicit&&"show"!==r){const e=Ap(i.args[0],t);V(e)&&n&&"OperatorNode:divide"===n.getIdentifier()&&W(Ap(n.args[0],t))||"OperatorNode:divide"===e.getIdentifier()&&W(Ap(e.args[0],t))&&V(Ap(e.args[1]))||(a+=1)}return a}function Mp(e,t){let r=e;"keep"!==t&&(r=e.getContent());const n=r.getIdentifier(),i=Sp(r,t);if(null===i)return null;const o=Ep[i][n];if(me(o,"associativity")){if("left"===o.associativity)return"left";if("right"===o.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+o.associativity+"'.")}return null}function Cp(e,t,r){const n="keep"!==r?e.getContent():e,i="keep"!==r?e.getContent():t,o=n.getIdentifier(),a=i.getIdentifier(),s=Sp(n,r);if(null===s)return null;const u=Ep[s][o];if(me(u,"associativeWith")&&u.associativeWith instanceof Array){for(let e=0;e<u.associativeWith.length;e++)if(u.associativeWith[e]===a)return!0;return!1}return null}const Tp="AssignmentNode",Dp=he(Tp,["subset","?matrix","Node"],(e=>{let{subset:t,matrix:r,Node:n}=e;const a=xp({subset:t}),s=function(e){let{subset:t,matrix:r}=e;return function(e,n,i){try{if(Array.isArray(e))return r(e).subset(n,i).valueOf().forEach(((t,r)=>{e[r]=t})),e;if(e&&"function"==typeof e.subset)return e.subset(n,i);if("string"==typeof e)return t(e,n,i);if("object"==typeof e){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return o(e,n.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw yp(e)}}}({subset:t,matrix:r});function u(e,t,r){t||(t="keep");const n=Sp(e,t,r),i=Sp(e.value,t,r);return"all"===t||null!==i&&i<=n}class c extends n{constructor(e,t,r){if(super(),this.object=e,this.index=r?t:null,this.value=r||t,!ne(e)&&!U(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(ne(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!J(this.index))throw new TypeError('IndexNode expected as "index"');if(!X(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Tp}get isAssignmentNode(){return!0}_compile(e,t){const r=this.object._compile(e,t),n=this.index?this.index._compile(e,t):null,u=this.value._compile(e,t),c=this.object.name;if(this.index){if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,n,i){const a=r(t,n,i),s=u(t,n,i);return o(a,e,s),s}}if(ne(this.object))return function(e,t,i){const o=r(e,t,i),a=u(e,t,i),l=n(e,t,o);return e.set(c,s(o,l,a)),a};{const r=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){const e=this.object.index.getObjectProperty();return function(t,a,c){const l=r(t,a,c),f=i(l,e),p=n(t,a,f),m=u(t,a,c);return o(l,e,s(f,p,m)),m}}{const i=this.object.index._compile(e,t);return function(e,t,o){const c=r(e,t,o),l=i(e,t,c),f=a(c,l),p=n(e,t,f),m=u(e,t,o);return s(c,l,s(f,p,m)),m}}}}if(!ne(this.object))throw new TypeError("SymbolNode expected as object");return function(e,t,r){const n=u(e,t,r);return e.set(c,n),n}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){const t=this._ifNode(e(this.object,"object",this)),r=this.index?this._ifNode(e(this.index,"index",this)):null,n=this._ifNode(e(this.value,"value",this));return new c(t,r,n)}clone(){return new c(this.object,this.index,this.value)}_toString(e){const t=this.object.toString(e),r=this.index?this.index.toString(e):"";let n=this.value.toString(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(n="("+n+")"),t+r+" = "+n}toJSON(){return{mathjs:Tp,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new c(e.object,e.index,e.value)}_toHTML(e){const t=this.object.toHTML(e),r=this.index?this.index.toHTML(e):"";let n=this.value.toHTML(e);return u(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>'),t+r+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n}_toTex(e){const t=this.object.toTex(e),r=this.index?this.index.toTex(e):"";let n=this.value.toTex(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(n=`\\left(${n}\\right)`),t+r+"="+n}}return gp(c,"name",Tp),c}),{isClass:!0,isNode:!0}),Fp="BlockNode",Op=he(Fp,["ResultSet","Node"],(e=>{let{ResultSet:t,Node:r}=e;class n extends r{constructor(e){if(super(),!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){const t=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!X(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:r}}))}get type(){return Fp}get isBlockNode(){return!0}_compile(e,r){const n=Fn(this.blocks,(function(t){return{evaluate:t.node._compile(e,r),visible:t.visible}}));return function(e,r,i){const o=[];return On(n,(function(t){const n=t.evaluate(e,r,i);t.visible&&o.push(n)})),new t(o)}}forEach(e){for(let t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)}map(e){const t=[];for(let r=0;r<this.blocks.length;r++){const n=this.blocks[r],i=this._ifNode(e(n.node,"blocks["+r+"].node",this));t[r]={node:i,visible:n.visible}}return new n(t)}clone(){const e=this.blocks.map((function(e){return{node:e.node,visible:e.visible}}));return new n(e)}_toString(e){return this.blocks.map((function(t){return t.node.toString(e)+(t.visible?"":";")})).join("\n")}toJSON(){return{mathjs:Fp,blocks:this.blocks}}static fromJSON(e){return new n(e.blocks)}_toHTML(e){return this.blocks.map((function(t){return t.node.toHTML(e)+(t.visible?"":'<span class="math-separator">;</span>')})).join('<span class="math-separator"><br /></span>')}_toTex(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")}}return gp(n,"name",Fp),n}),{isClass:!0,isNode:!0}),Bp="ConditionalNode",_p=he(Bp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e,t,r){if(super(),!X(e))throw new TypeError("Parameter condition must be a Node");if(!X(t))throw new TypeError("Parameter trueExpr must be a Node");if(!X(r))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=r}get type(){return Bp}get isConditionalNode(){return!0}_compile(e,t){const r=this.condition._compile(e,t),n=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,o){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(g(e))return!e.isZero();if(x(e))return!(!e.re&&!e.im);if(v(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+oe(e)+'"')}(r(e,t,o))?n(e,t,o):i(e,t,o)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new r(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new r(this.condition,this.trueExpr,this.falseExpr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Sp(this,t,e&&e.implicit);let n=this.condition.toString(e);const i=Sp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n="("+n+")");let o=this.trueExpr.toString(e);const a=Sp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=r)&&(o="("+o+")");let s=this.falseExpr.toString(e);const u=Sp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(s="("+s+")"),n+" ? "+o+" : "+s}toJSON(){return{mathjs:Bp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new r(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Sp(this,t,e&&e.implicit);let n=this.condition.toHTML(e);const i=Sp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');let o=this.trueExpr.toHTML(e);const a=Sp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=r)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>');let s=this.falseExpr.toHTML(e);const u=Sp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(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>'+o+'<span class="math-operator math-conditional-operator">:</span>'+s}_toTex(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return gp(r,"name",Bp),r}),{isClass:!0,isNode:!0});var zp=r(3144);const Ip={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{?}"},kp={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"},Rp={abs:{1:"\\left|${args[0]}\\right|"},add:{2:`\\left(\${args[0]}${kp.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]}${kp.dotDivide}\${args[1]}\\right)`},dotMultiply:{2:`\\left(\${args[0]}${kp.dotMultiply}\${args[1]}\\right)`},dotPow:{2:`\\left(\${args[0]}${kp.dotPow}\${args[1]}\\right)`},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:`\\left(e${kp.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]}${kp.mod}\${args[1]}\\right)`},multiply:{2:`\\left(\${args[0]}${kp.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)${kp.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]}${kp.subtract}\${args[1]}\\right)`},unaryMinus:{1:`${kp.unaryMinus}\\left(\${args[0]}\\right)`},unaryPlus:{1:`${kp.unaryPlus}\\left(\${args[0]}\\right)`},bitAnd:{2:`\\left(\${args[0]}${kp.bitAnd}\${args[1]}\\right)`},bitNot:{1:kp.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:`\\left(\${args[0]}${kp.bitOr}\${args[1]}\\right)`},bitXor:{2:`\\left(\${args[0]}${kp.bitXor}\${args[1]}\\right)`},leftShift:{2:`\\left(\${args[0]}${kp.leftShift}\${args[1]}\\right)`},rightArithShift:{2:`\\left(\${args[0]}${kp.rightArithShift}\${args[1]}\\right)`},rightLogShift:{2:`\\left(\${args[0]}${kp.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]}${kp.and}\${args[1]}\\right)`},not:{1:kp.not+"\\left(${args[0]}\\right)"},or:{2:`\\left(\${args[0]}${kp.or}\${args[1]}\\right)`},xor:{2:`\\left(\${args[0]}${kp.xor}\${args[1]}\\right)`},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:`\\left(\${args[0]}\\right)${kp.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]}}${kp.pow}{\\frac{1}{2}}`},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:`\\left(\${args[0]}\\right)${kp.transpose}`},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:`\\left(\${args[0]}\\right)${kp.factorial}`},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:`\\left(\${args[0]}${kp.equal}\${args[1]}\\right)`},larger:{2:`\\left(\${args[0]}${kp.larger}\${args[1]}\\right)`},largerEq:{2:`\\left(\${args[0]}${kp.largerEq}\${args[1]}\\right)`},smaller:{2:`\\left(\${args[0]}${kp.smaller}\${args[1]}\\right)`},smallerEq:{2:`\\left(\${args[0]}${kp.smallerEq}\${args[1]}\\right)`},unequal:{2:`\\left(\${args[0]}${kp.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]}${kp.to}\${args[1]}\\right)`},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:`\\left(\\left(\${args[0]}\\right)+${Ip.i}\\cdot\\left(\${args[1]}\\right)\\right)`},matrix:{0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},sparse:{0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},unit:{1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"}},qp={deg:"^\\circ"};function Pp(e){return zp(e,{preserveFormatting:!0})}function jp(e,t){return(t=void 0!==t&&t)?me(qp,e)?qp[e]:"\\mathrm{"+Pp(e)+"}":me(Ip,e)?Ip[e]:Pp(e)}const Up="ConstantNode",Lp=he(Up,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){super(),this.value=e}get type(){return Up}get isConstantNode(){return!0}_compile(e,t){const r=this.value;return function(){return r}}forEach(e){}map(e){return this.clone()}clone(){return new r(this.value)}_toString(e){return an(this.value,e)}_toHTML(e){const t=this._toString(e);switch(oe(this.value)){case"number":case"bigint":case"BigNumber":case"Fraction":return'<span class="math-number">'+t+"</span>";case"string":return'<span class="math-string">'+t+"</span>";case"boolean":return'<span class="math-boolean">'+t+"</span>";case"null":return'<span class="math-null-symbol">'+t+"</span>";case"undefined":return'<span class="math-undefined">'+t+"</span>";default:return'<span class="math-symbol">'+t+"</span>"}}toJSON(){return{mathjs:Up,value:this.value}}static fromJSON(e){return new r(e.value)}_toTex(e){const t=this._toString(e),r=oe(this.value);switch(r){case"string":return"\\mathtt{"+Pp(t)+"}";case"number":case"BigNumber":{if(!("BigNumber"===r?this.value.isFinite():isFinite(this.value)))return this.value.valueOf()<0?"-\\infty":"\\infty";const e=t.toLowerCase().indexOf("e");return-1!==e?t.substring(0,e)+"\\cdot10^{"+t.substring(e+1)+"}":t}case"bigint":return t.toString();case"Fraction":return this.value.toLatex();default:return t}}}return gp(r,"name",Up),r}),{isClass:!0,isNode:!0}),$p="FunctionAssignmentNode",Hp=he($p,["typed","Node"],(e=>{let{typed:t,Node:r}=e;function n(e,t,r){const n=Sp(e,t,r),i=Sp(e.expr,t,r);return"all"===t||null!==i&&i<=n}class i extends r{constructor(e,t,r){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!X(r))throw new TypeError('Node expected for parameter "expr"');if(mp.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');const n=new Set;for(const e of t){const t="string"==typeof e?e:e.name;if(n.has(t))throw new Error(`Duplicate parameter name "${t}"`);n.add(t)}this.name=e,this.params=t.map((function(e){return e&&e.name||e})),this.types=t.map((function(e){return e&&e.type||"any"})),this.expr=r}get type(){return $p}get isFunctionAssignmentNode(){return!0}_compile(e,r){const n=Object.create(r);On(this.params,(function(e){n[e]=!0}));const i=this.expr._compile(e,n),o=this.name,a=this.params,s=_n(this.types,","),u=o+"("+_n(this.params,", ")+")";return function(e,r,n){const c={};c[s]=function(){const t=Object.create(r);for(let e=0;e<a.length;e++)t[a[e]]=arguments[e];return i(e,t,n)};const l=t(o,c);return l.syntax=u,e.set(o,l),l}}forEach(e){e(this.expr,"expr",this)}map(e){const t=this._ifNode(e(this.expr,"expr",this));return new i(this.name,this.params.slice(0),t)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let r=this.expr.toString(e);return n(this,t,e&&e.implicit)&&(r="("+r+")"),this.name+"("+this.params.join(", ")+") = "+r}toJSON(){const e=this.types;return{mathjs:$p,name:this.name,params:this.params.map((function(t,r){return{name:t,type:e[r]}})),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=[];for(let e=0;e<this.params.length;e++)r.push('<span class="math-symbol math-parameter">'+cn(this.params[e])+"</span>");let i=this.expr.toHTML(e);return n(this,t,e&&e.implicit)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+cn(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+i}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let r=this.expr.toTex(e);return n(this,t,e&&e.implicit)&&(r=`\\left(${r}\\right)`),"\\mathrm{"+this.name+"}\\left("+this.params.map(jp).join(",")+"\\right)="+r}}return gp(i,"name",$p),i}),{isClass:!0,isNode:!0}),Gp="IndexNode",Vp=he(Gp,["Node","size"],(e=>{let{Node:t,size:r}=e;class n extends t{constructor(e,t){if(super(),this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(X))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return Gp}get isIndexNode(){return!0}_compile(e,t){const n=Fn(this.dimensions,(function(n,i){if(n.filter((e=>e.isSymbolNode&&"end"===e.name)).length>0){const o=Object.create(t);o.end=!0;const a=n._compile(e,o);return function(e,t,n){if(!E(n)&&!N(n)&&!w(n))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+oe(n));const o=r(n).valueOf(),s=Object.create(t);return s.end=o[i],a(e,s,n)}}return n._compile(e,t)})),o=i(e,"index");return function(e,t,r){const i=Fn(n,(function(n){return n(e,t,r)}));return o(...i)}}forEach(e){for(let t=0;t<this.dimensions.length;t++)e(this.dimensions[t],"dimensions["+t+"]",this)}map(e){const t=[];for(let r=0;r<this.dimensions.length;r++)t[r]=this._ifNode(e(this.dimensions[r],"dimensions["+r+"]",this));return new n(t,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&V(this.dimensions[0])&&"string"==typeof this.dimensions[0].value}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:Gp,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new n(e.dimensions,e.dotNotation)}_toHTML(e){const t=[];for(let e=0;e<this.dimensions.length;e++)t[e]=this.dimensions[e].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+cn(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){const t=this.dimensions.map((function(t){return t.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"}}return gp(n,"name",Gp),n}),{isClass:!0,isNode:!0}),Wp="ObjectNode",Zp=he(Wp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every((function(t){return X(e[t])}))))throw new TypeError("Object containing Nodes expected")}get type(){return Wp}get isObjectNode(){return!0}_compile(e,t){const r={};for(const n in this.properties)if(me(this.properties,n)){const o=sn(n),a=JSON.parse(o),s=i(this.properties,n);r[a]=s._compile(e,t)}return function(e,t,n){const i={};for(const o in r)me(r,o)&&(i[o]=r[o](e,t,n));return i}}forEach(e){for(const t in this.properties)me(this.properties,t)&&e(this.properties[t],"properties["+sn(t)+"]",this)}map(e){const t={};for(const r in this.properties)me(this.properties,r)&&(t[r]=this._ifNode(e(this.properties[r],"properties["+sn(r)+"]",this)));return new r(t)}clone(){const e={};for(const t in this.properties)me(this.properties,t)&&(e[t]=this.properties[t]);return new r(e)}_toString(e){const t=[];for(const r in this.properties)me(this.properties,r)&&t.push(sn(r)+": "+this.properties[r].toString(e));return"{"+t.join(", ")+"}"}toJSON(){return{mathjs:Wp,properties:this.properties}}static fromJSON(e){return new r(e.properties)}_toHTML(e){const t=[];for(const r in this.properties)me(this.properties,r)&&t.push('<span class="math-symbol math-property">'+cn(r)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[r].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(e){const t=[];for(const r in this.properties)me(this.properties,r)&&t.push("\\mathbf{"+r+":} & "+this.properties[r].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"}}return gp(r,"name",Wp),r}),{isClass:!0,isNode:!0});function Yp(e,t){return new f(e,new l(t),new Set(Object.keys(t)))}const Jp="OperatorNode",Xp=he(Jp,["Node"],(e=>{let{Node:t}=e;function r(e,t){let n=e;if("auto"===t)for(;ee(n);)n=n.content;return!!V(n)||!!K(n)&&r(n.args[0],t)}function n(e,t,n,i,o){const a=Sp(e,t,n),s=Mp(e,t);if("all"===t||i.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return i.map((function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}}));let u;switch(i.length){case 0:u=[];break;case 1:{const r=Sp(i[0],t,n,e);if(o&&null!==r){let n,o;if("keep"===t?(n=i[0].getIdentifier(),o=e.getIdentifier()):(n=i[0].getContent().getIdentifier(),o=e.getContent().getIdentifier()),!1===Ep[a][o].latexLeftParens){u=[!1];break}if(!1===Ep[r][n].latexParens){u=[!1];break}}if(null===r){u=[!1];break}if(r<=a){u=[!0];break}u=[!1]}break;case 2:{let r;const c=Sp(i[0],t,n,e),l=Cp(e,i[0],t);let f;r=null!==c&&(c===a&&"right"===s&&!l||c<a);const p=Sp(i[1],t,n,e),m=Cp(e,i[1],t);if(f=null!==p&&(p===a&&"left"===s&&!m||p<a),o){let n,i,o;"keep"===t?(n=e.getIdentifier(),i=e.args[0].getIdentifier(),o=e.args[1].getIdentifier()):(n=e.getContent().getIdentifier(),i=e.args[0].getContent().getIdentifier(),o=e.args[1].getContent().getIdentifier()),null!==c&&(!1===Ep[a][n].latexLeftParens&&(r=!1),!1===Ep[c][i].latexParens&&(r=!1)),null!==p&&(!1===Ep[a][n].latexRightParens&&(f=!1),!1===Ep[p][o].latexParens&&(f=!1))}u=[r,f]}break;default:"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()||(u=i.map((function(r){const i=Sp(r,t,n,e),o=Cp(e,r,t),u=Mp(r,t);return null!==i&&(a===i&&s===u&&!o||i<a)})))}if(i.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==t&&"hide"===n)for(let e=1;e<u.length;++e)!r(i[e],t)||u[e-1]||"keep"===t&&ee(i[e-1])||(u[e]=!0);return u}class o extends t{constructor(e,t,r,n,i){if(super(),"string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof t)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(r)||!r.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===n,this.isPercentage=!0===i,this.op=e,this.fn=t,this.args=r||[]}get type(){return Jp}get isOperatorNode(){return!0}_compile(e,t){if("string"!=typeof this.fn||!s(e,this.fn))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');const r=i(e,this.fn),n=Fn(this.args,(function(r){return r._compile(e,t)}));if("function"==typeof r&&!0===r.rawArgs){const t=this.args;return function(n,i,o){return r(t,e,Yp(n,i))}}if(1===n.length){const e=n[0];return function(t,n,i){return r(e(t,n,i))}}if(2===n.length){const e=n[0],t=n[1];return function(n,i,o){return r(e(n,i,o),t(n,i,o))}}return function(e,t,i){return r.apply(null,Fn(n,(function(r){return r(e,t,i)})))}}forEach(e){for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=[];for(let r=0;r<this.args.length;r++)t[r]=this._ifNode(e(this.args[r],"args["+r+"]",this));return new o(this.op,this.fn,t,this.implicit,this.isPercentage)}clone(){return new o(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return 1===this.args.length}isBinary(){return 2===this.args.length}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,o=n(this,t,r,i,!1);if(1===i.length){const r=Mp(this,t);let n=i[0].toString(e);o[0]&&(n="("+n+")");const a=/[a-zA-Z]+/.test(this.op);return"right"===r?this.op+(a?" ":"")+n:"left"===r?n+(a?" ":"")+this.op:n+this.op}if(2===i.length){let t=i[0].toString(e),n=i[1].toString(e);return o[0]&&(t="("+t+")"),o[1]&&(n="("+n+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t+" "+n:t+" "+this.op+" "+n}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,r){return t=t.toString(e),o[r]&&(t="("+t+")"),t}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t.join(" "):t.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:Jp,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new o(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,o=n(this,t,r,i,!1);if(1===i.length){const r=Mp(this,t);let n=i[0].toHTML(e);return o[0]&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===r?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+cn(this.op)+"</span>"+n:n+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+cn(this.op)+"</span>"}if(2===i.length){let t=i[0].toHTML(e),n=i[1].toHTML(e);return o[0]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+n:t+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+cn(this.op)+"</span>"+n}{const t=i.map((function(t,r){return t=t.toHTML(e),o[r]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):t.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+cn(this.op)+"</span>"):'<span class="math-function">'+cn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,o=n(this,t,r,i,!0);let a=kp[this.fn];if(a=void 0===a?this.op:a,1===i.length){const r=Mp(this,t);let n=i[0].toTex(e);return o[0]&&(n=`\\left(${n}\\right)`),"right"===r?a+n:n+a}if(2===i.length){const n=i[0];let s=n.toTex(e);o[0]&&(s=`\\left(${s}\\right)`);let u,c=i[1].toTex(e);switch(o[1]&&(c=`\\left(${c}\\right)`),u="keep"===t?n.getIdentifier():n.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return a+"{"+s+"}{"+c+"}";case"OperatorNode:pow":switch(s="{"+s+"}",c="{"+c+"}",u){case"ConditionalNode":case"OperatorNode:divide":s=`\\left(${s}\\right)`}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===r)return s+"~"+c}return s+a+c}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,r){return t=t.toTex(e),o[r]&&(t=`\\left(${t}\\right)`),t}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===r?t.join("~"):t.join(a)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(t){return t.toTex(e)})).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return gp(o,"name",Jp),o}),{isClass:!0,isNode:!0}),Qp="ParenthesisNode",Kp=he(Qp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){if(super(),!X(e))throw new TypeError('Node expected for parameter "content"');this.content=e}get type(){return Qp}get isParenthesisNode(){return!0}_compile(e,t){return this.content._compile(e,t)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){const t=e(this.content,"content",this);return new r(t)}clone(){return new r(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:Qp,content:this.content}}static fromJSON(e){return new r(e.content)}_toHTML(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(e)}_toTex(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?`\\left(${this.content.toTex(e)}\\right)`:this.content.toTex(e)}}return gp(r,"name",Qp),r}),{isClass:!0,isNode:!0}),em="RangeNode",tm=he(em,["Node"],(e=>{let{Node:t}=e;function r(e,t,r){const n=Sp(e,t,r),i={},o=Sp(e.start,t,r);if(i.start=null!==o&&o<=n||"all"===t,e.step){const o=Sp(e.step,t,r);i.step=null!==o&&o<=n||"all"===t}const a=Sp(e.end,t,r);return i.end=null!==a&&a<=n||"all"===t,i}class n extends t{constructor(e,t,r){if(super(),!X(e))throw new TypeError("Node expected");if(!X(t))throw new TypeError("Node expected");if(r&&!X(r))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=r||null}get type(){return em}get isRangeNode(){return!0}needsEnd(){return this.filter((function(e){return ne(e)&&"end"===e.name})).length>0}_compile(e,t){const r=e.range,n=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){const o=this.step._compile(e,t);return function(e,t,a){return r(n(e,t,a),i(e,t,a),o(e,t,a))}}return function(e,t,o){return r(n(e,t,o),i(e,t,o))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new 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){const t=r(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let n,i=this.start.toString(e);if(t.start&&(i="("+i+")"),n=i,this.step){let r=this.step.toString(e);t.step&&(r="("+r+")"),n+=":"+r}let o=this.end.toString(e);return t.end&&(o="("+o+")"),n+=":"+o,n}toJSON(){return{mathjs:em,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new n(e.start,e.end,e.step)}_toHTML(e){const t=r(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let n,i=this.start.toHTML(e);if(t.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n=i,this.step){let r=this.step.toHTML(e);t.step&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+='<span class="math-operator math-range-operator">:</span>'+r}let o=this.end.toHTML(e);return t.end&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+='<span class="math-operator math-range-operator">:</span>'+o,n}_toTex(e){const t=r(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let n=this.start.toTex(e);if(t.start&&(n=`\\left(${n}\\right)`),this.step){let r=this.step.toTex(e);t.step&&(r=`\\left(${r}\\right)`),n+=":"+r}let i=this.end.toTex(e);return t.end&&(i=`\\left(${i}\\right)`),n+=":"+i,n}}return gp(n,"name",em),n}),{isClass:!0,isNode:!0}),rm="RelationalNode",nm=he(rm,["Node"],(e=>{let{Node:t}=e;const r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends t{constructor(e,t){if(super(),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(t))throw new TypeError("Parameter params must be an array");if(e.length!==t.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=t}get type(){return rm}get isRelationalNode(){return!0}_compile(e,t){const r=this,n=this.params.map((r=>r._compile(e,t)));return function(t,o,a){let s,u=n[0](t,o,a);for(let c=0;c<r.conditionals.length;c++)if(s=u,u=n[c+1](t,o,a),!i(e,r.conditionals[c])(s,u))return!1;return!0}}forEach(e){this.params.forEach(((t,r)=>e(t,"params["+r+"]",this)),this)}map(e){return new n(this.conditionals.slice(),this.params.map(((t,r)=>this._ifNode(e(t,"params["+r+"]",this))),this))}clone(){return new n(this.conditionals,this.params)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Sp(this,t,e&&e.implicit),i=this.params.map((function(r,i){const o=Sp(r,t,e&&e.implicit);return"all"===t||null!==o&&o<=n?"("+r.toString(e)+")":r.toString(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+=" "+r[this.conditionals[e]],o+=" "+i[e+1];return o}toJSON(){return{mathjs:rm,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new n(e.conditionals,e.params)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Sp(this,t,e&&e.implicit),i=this.params.map((function(r,i){const o=Sp(r,t,e&&e.implicit);return"all"===t||null!==o&&o<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+r.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':r.toHTML(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+cn(r[this.conditionals[e]])+"</span>"+i[e+1];return o}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Sp(this,t,e&&e.implicit),n=this.params.map((function(n,i){const o=Sp(n,t,e&&e.implicit);return"all"===t||null!==o&&o<=r?"\\left("+n.toTex(e)+"\right)":n.toTex(e)}));let i=n[0];for(let e=0;e<this.conditionals.length;e++)i+=kp[this.conditionals[e]]+n[e+1];return i}}return gp(n,"name",rm),n}),{isClass:!0,isNode:!0}),im=he("SymbolNode",["math","?Unit","Node"],(e=>{let{math:t,Unit:r,Node:n}=e;function o(e){return!!r&&r.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,t){const n=this.name;if(!0===t[n])return function(e,t,r){return i(t,n)};if(n in e)return function(t,r,o){return t.has(n)?t.get(n):i(e,n)};{const e=o(n);return function(t,i,o){return t.has(n)?t.get(n):e?new r(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){const t=cn(this.name);return"true"===t||"false"===t?'<span class="math-symbol math-boolean">'+t+"</span>":"i"===t?'<span class="math-symbol math-imaginary-symbol">'+t+"</span>":"Infinity"===t?'<span class="math-symbol math-infinity-symbol">'+t+"</span>":"NaN"===t?'<span class="math-symbol math-nan-symbol">'+t+"</span>":"null"===t?'<span class="math-symbol math-null-symbol">'+t+"</span>":"undefined"===t?'<span class="math-symbol math-undefined-symbol">'+t+"</span>":'<span class="math-symbol">'+t+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){let r=!1;void 0===t[this.name]&&o(this.name)&&(r=!0);const n=jp(this.name,r);return"\\"===n[0]?n:" "+n}}return a}),{isClass:!0,isNode:!0}),om="FunctionNode",am=he(om,["math","Node","SymbolNode"],(e=>{var t;let{math:r,Node:n,SymbolNode:o}=e;const a=e=>an(e,{truncate:78});function u(e,t,r){let n="";const i=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi;let o,a=0;for(;null!==(o=i.exec(e));)if(n+=e.substring(a,o.index),a=o.index,"$$"===o[0])n+="$",a++;else{a+=o[0].length;const e=t[o[1]];if(!e)throw new ReferenceError("Template: Property "+o[1]+" does not exist.");if(void 0===o[2])switch(typeof e){case"string":n+=e;break;case"object":if(X(e))n+=e.toTex(r);else{if(!Array.isArray(e))throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes");n+=e.map((function(e,t){if(X(e))return e.toTex(r);throw new TypeError("Template: "+o[1]+"["+t+"] is not a Node.")})).join(",")}break;default:throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes")}else{if(!X(e[o[2]]&&e[o[2]]))throw new TypeError("Template: "+o[1]+"["+o[2]+"] is not a Node.");n+=e[o[2]].toTex(r)}}return n+=e.slice(a),n}class c extends n{constructor(e,t){if(super(),"string"==typeof e&&(e=new o(e)),!X(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[]}get name(){return this.fn.name||""}get type(){return om}get isFunctionNode(){return!0}_compile(e,t){const r=this.args.map((r=>r._compile(e,t)));if(!ne(this.fn)){if(U(this.fn)&&J(this.fn.index)&&this.fn.index.isObjectProperty()){const n=this.fn.object._compile(e,t),i=this.fn.index.getObjectProperty(),o=this.args;return function(t,a,u){const c=n(t,a,u),l=function(e,t){if(!s(e,t))throw new Error('No access to method "'+t+'"');return e[t]}(c,i);if(null!=l&&l.rawArgs)return l(o,e,Yp(t,a));{const e=r.map((e=>e(t,a,u)));return l.apply(c,e)}}}{const n=this.fn.toString(),i=this.fn._compile(e,t),o=this.args;return function(t,s,u){const c=i(t,s,u);if("function"!=typeof c)throw new TypeError(`Expression '${n}' did not evaluate to a function; value is:\n ${a(c)}`);if(c.rawArgs)return c(o,e,Yp(t,s));{const e=r.map((e=>e(t,s,u)));return c.apply(c,e)}}}}{const n=this.fn.name;if(t[n]){const t=this.args;return function(o,s,u){const c=i(s,n);if("function"!=typeof c)throw new TypeError(`Argument '${n}' was not a function; received: ${a(c)}`);if(c.rawArgs)return c(t,e,Yp(o,s));{const e=r.map((e=>e(o,s,u)));return c.apply(c,e)}}}{const t=n in e?i(e,n):void 0,o="function"==typeof t&&!0===t.rawArgs,s=t=>{let r;if(t.has(n))r=t.get(n);else{if(!(n in e))return c.onUndefinedFunction(n);r=i(e,n)}if("function"==typeof r)return r;throw new TypeError(`'${n}' is not a function; its value is:\n ${a(r)}`)};if(o){const t=this.args;return function(n,i,o){const a=s(n);return!0===a.rawArgs?a(t,e,Yp(n,i)):a(...r.map((e=>e(n,i,o))))}}switch(r.length){case 0:return function(e,t,r){return s(e)()};case 1:return function(e,t,n){return s(e)((0,r[0])(e,t,n))};case 2:return function(e,t,n){const i=s(e),o=r[0],a=r[1];return i(o(e,t,n),a(e,t,n))};default:return function(e,t,n){return s(e)(...r.map((r=>r(e,t,n))))}}}}}forEach(e){e(this.fn,"fn",this);for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=this._ifNode(e(this.fn,"fn",this)),r=[];for(let t=0;t<this.args.length;t++)r[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new c(t,r)}clone(){return new c(this.fn,this.args.slice(0))}toString(e){let t;const r=this.fn.toString(e);return e&&"object"==typeof e.handler&&me(e.handler,r)&&(t=e.handler[r](this,e)),void 0!==t?t:super.toString(e)}_toString(e){const t=this.args.map((function(t){return t.toString(e)}));return(Z(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+t.join(", ")+")"}toJSON(){return{mathjs:om,fn:this.fn,args:this.args}}_toHTML(e){const t=this.args.map((function(t){return t.toHTML(e)}));return'<span class="math-function">'+cn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(e){let t;return e&&"object"==typeof e.handler&&me(e.handler,this.name)&&(t=e.handler[this.name](this,e)),void 0!==t?t:super.toTex(e)}_toTex(e){const t=this.args.map((function(t){return t.toTex(e)}));let n,i;switch(Rp[this.name]&&(n=Rp[this.name]),!r[this.name]||"function"!=typeof r[this.name].toTex&&"object"!=typeof r[this.name].toTex&&"string"!=typeof r[this.name].toTex||(n=r[this.name].toTex),typeof n){case"function":i=n(this,e);break;case"string":i=u(n,this,e);break;case"object":switch(typeof n[t.length]){case"function":i=n[t.length](this,e);break;case"string":i=u(n[t.length],this,e)}}return void 0!==i?i:u("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return t=c,gp(c,"name",om),gp(c,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),gp(c,"fromJSON",(function(e){return new t(e.fn,e.args)})),c}),{isClass:!0,isNode:!0}),sm="parse",um=he(sm,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(e=>{let{typed:t,numeric:r,config:n,AccessorNode:i,ArrayNode:o,AssignmentNode:a,BlockNode:s,ConditionalNode:u,ConstantNode:c,FunctionAssignmentNode:l,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:y,SymbolNode:x}=e;const b=t(sm,{string:function(e){return k(e,{})},"Array | Matrix":function(e){return v(e,{})},"string, Object":function(e,t){return k(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":v});function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=void 0!==t.nodes?t.nodes:{};return Qn(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return k(e,r)}))}const w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},N={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function C(e,t){return e.expression.substr(e.index,t)}function T(e){return C(e,1)}function D(e){e.index++}function F(e){return e.expression.charAt(e.index-1)}function O(e){return e.expression.charAt(e.index+1)}function B(e){for(e.tokenType=w.NULL,e.token="",e.comment="";;){if("#"===T(e))for(;"\n"!==T(e)&&""!==T(e);)e.comment+=T(e),D(e);if(!b.isWhitespace(T(e),e.nestingLevel))break;D(e)}if(""===T(e))return void(e.tokenType=w.DELIMITER);if("\n"===T(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=T(e),void D(e);const t=T(e),r=C(e,2),n=C(e,3);if(3===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,D(e),D(e),void D(e);if(2===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,D(e),void D(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void D(e);if(b.isDigitDot(t)){e.tokenType=w.NUMBER;const t=C(e,2);if("0b"===t||"0o"===t||"0x"===t){for(e.token+=T(e),D(e),e.token+=T(e),D(e);b.isHexDigit(T(e));)e.token+=T(e),D(e);if("."===T(e))for(e.token+=".",D(e);b.isHexDigit(T(e));)e.token+=T(e),D(e);else if("i"===T(e))for(e.token+="i",D(e);b.isDigit(T(e));)e.token+=T(e),D(e);return}if("."===T(e)){if(e.token+=T(e),D(e),!b.isDigit(T(e)))return void(e.tokenType=w.DELIMITER)}else{for(;b.isDigit(T(e));)e.token+=T(e),D(e);b.isDecimalMark(T(e),O(e))&&(e.token+=T(e),D(e))}for(;b.isDigit(T(e));)e.token+=T(e),D(e);if("E"===T(e)||"e"===T(e))if(b.isDigit(O(e))||"-"===O(e)||"+"===O(e)){if(e.token+=T(e),D(e),"+"!==T(e)&&"-"!==T(e)||(e.token+=T(e),D(e)),!b.isDigit(T(e)))throw ce(e,'Digit expected, got "'+T(e)+'"');for(;b.isDigit(T(e));)e.token+=T(e),D(e);if(b.isDecimalMark(T(e),O(e)))throw ce(e,'Digit expected, got "'+T(e)+'"')}else if("."===O(e))throw D(e),ce(e,'Digit expected, got "'+T(e)+'"')}else{if(!b.isAlpha(T(e),F(e),O(e))){for(e.tokenType=w.UNKNOWN;""!==T(e);)e.token+=T(e),D(e);throw ce(e,'Syntax error in part "'+e.token+'"')}for(;b.isAlpha(T(e),F(e),O(e))||b.isDigit(T(e));)e.token+=T(e),D(e);me(E,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}function _(e){do{B(e)}while("\n"===e.token)}function z(e){e.nestingLevel++}function I(e){e.nestingLevel--}function k(e,t){const r={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};en(r,{expression:e,extraNodes:t}),B(r);const n=function(e){let t;const r=[];let n;for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment));"\n"===e.token||";"===e.token;)0===r.length&&t&&(n=";"!==e.token,r.push({node:t,visible:n})),B(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment),n=";"!==e.token,r.push({node:t,visible:n}));return r.length>0?new s(r):(t||(t=new c(void 0),e.comment&&(t.comment=e.comment)),t)}(r);if(""!==r.token)throw r.tokenType===w.DELIMITER?le(r,"Unexpected operator "+r.token):ce(r,'Unexpected part "'+r.token+'"');return n}function R(e){let t,r,n,i;const o=function(e){let t=function(e){let t=q(e);for(;"or"===e.token;)_(e),t=new h("or","or",[t,q(e)]);return t}(e);for(;"?"===e.token;){const r=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,_(e);const n=t,i=R(e);if(":"!==e.token)throw ce(e,"False part of conditional expression expected");e.conditionalLevel=null,_(e);const o=R(e);t=new u(n,i,o),e.conditionalLevel=r}return t}(e);if("="===e.token){if(ne(o))return t=o.name,_(e),n=R(e),new a(new x(t),n);if(U(o))return _(e),n=R(e),new a(o.object,o.index,n);if(Y(o)&&ne(o.fn)&&(i=!0,r=[],t=o.name,o.args.forEach((function(e,t){ne(e)?r[t]=e.name:i=!1})),i))return _(e),n=R(e),new l(t,r,n);throw ce(e,"Invalid left hand side of assignment operator =")}return o}function q(e){let t=P(e);for(;"xor"===e.token;)_(e),t=new h("xor","xor",[t,P(e)]);return t}function P(e){let t=j(e);for(;"and"===e.token;)_(e),t=new h("and","and",[t,j(e)]);return t}function j(e){let t=L(e);for(;"|"===e.token;)_(e),t=new h("|","bitOr",[t,L(e)]);return t}function L(e){let t=$(e);for(;"^|"===e.token;)_(e),t=new h("^|","bitXor",[t,$(e)]);return t}function $(e){let t=H(e);for(;"&"===e.token;)_(e),t=new h("&","bitAnd",[t,H(e)]);return t}function H(e){const t=[G(e)],r=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};for(;me(n,e.token);){const i={name:e.token,fn:n[e.token]};r.push(i),_(e),t.push(G(e))}return 1===t.length?t[0]:2===t.length?new h(r[0].name,r[0].fn,t):new y(r.map((e=>e.fn)),t)}function G(e){let t,r,n,i;t=Z(e);const o={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};for(;me(o,e.token);)r=e.token,n=o[r],_(e),i=[t,Z(e)],t=new h(r,n,i);return t}function Z(e){let t,r,n,i;t=J(e);const o={to:"to",in:"to"};for(;me(o,e.token);)r=e.token,n=o[r],_(e),"in"===r&&""===e.token?t=new h("*","multiply",[t,new x("in")],!0):(i=[t,J(e)],t=new h(r,n,i));return t}function J(e){let t;const r=[];if(t=":"===e.token?new c(1):X(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(r.push(t);":"===e.token&&r.length<3;)_(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?r.push(new x("end")):r.push(X(e));t=3===r.length?new g(r[0],r[2],r[1]):new g(r[0],r[1])}return t}function X(e){let t,r,n,i;t=Q(e);const o={"+":"add","-":"subtract"};for(;me(o,e.token);){r=e.token,n=o[r],_(e);const a=Q(e);i=a.isPercentage?[t,new h("*","multiply",[t,a])]:[t,a],t=new h(r,n,i)}return t}function Q(e){let t,r,n,i;t=ee(e),r=t;const o={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide"};for(;me(o,e.token);)n=e.token,i=o[n],_(e),r=ee(e),t=new h(n,i,[t,r]);return t}function ee(e){let t,r;for(t=te(e),r=t;e.tokenType===w.SYMBOL||"in"===e.token&&V(t)||"in"===e.token&&K(t)&&"unaryMinus"===t.fn&&V(t.args[0])||!(e.tokenType!==w.NUMBER||V(r)||K(r)&&"!"!==r.op)||"("===e.token;)r=te(e),t=new h("*","multiply",[t,r],!0);return t}function te(e){let t=re(e),r=t;const n=[];for(;"/"===e.token&&W(r);){if(n.push(en({},e)),_(e),e.tokenType!==w.NUMBER){en(e,n.pop());break}if(n.push(en({},e)),_(e),e.tokenType!==w.SYMBOL&&"("!==e.token&&"in"!==e.token){n.pop(),en(e,n.pop());break}en(e,n.pop()),n.pop(),r=re(e),t=new h("/","divide",[t,r])}return t}function re(e){let t,r,n,i;t=ie(e);const o={"%":"mod",mod:"mod"};for(;me(o,e.token);)r=e.token,n=o[r],_(e),"%"===r&&e.tokenType===w.DELIMITER&&"("!==e.token?t=new h("/","divide",[t,new c(100)],!1,!0):(i=[t,ie(e)],t=new h(r,n,i));return t}function ie(e){let t,i,a;const s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return me(s,e.token)?(a=s[e.token],t=e.token,_(e),i=[ie(e)],new h(t,a,i)):function(e){let t,i,a,s;return t=function(e){let t,i,a,s;t=function(e){let t=[];if(e.tokenType===w.SYMBOL&&me(e.extraNodes,e.token)){const r=e.extraNodes[e.token];if(B(e),"("===e.token){if(t=[],z(e),B(e),")"!==e.token)for(t.push(R(e));","===e.token;)B(e),t.push(R(e));if(")"!==e.token)throw ce(e,"Parenthesis ) expected");I(e),B(e)}return new r(t)}return function(e){let t,i;return e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E?(i=e.token,B(e),t=me(A,i)?new c(A[i]):S.includes(i)?new c(r(i,"number")):new x(i),t=oe(e,t),t):function(e){let t,i;return'"'===e.token||"'"===e.token?(i=ae(e,e.token),t=new c(i),t=oe(e,t),t):function(e){let t,i,a,s;if("["===e.token){if(z(e),B(e),"]"!==e.token){const r=se(e);if(";"===e.token){for(a=1,i=[r];";"===e.token;)B(e),"]"!==e.token&&(i[a]=se(e),a++);if("]"!==e.token)throw ce(e,"End of matrix ] expected");I(e),B(e),s=i[0].items.length;for(let t=1;t<a;t++)if(i[t].items.length!==s)throw le(e,"Column dimensions mismatch ("+i[t].items.length+" !== "+s+")");t=new o(i)}else{if("]"!==e.token)throw ce(e,"End of matrix ] expected");I(e),B(e),t=r}}else I(e),B(e),t=new o([]);return oe(e,t)}return function(e){if("{"===e.token){let t;z(e);const r={};do{if(B(e),"}"!==e.token){if('"'===e.token||"'"===e.token)t=ae(e,e.token);else{if(!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ce(e,"Symbol or string expected as object key");t=e.token,B(e)}if(":"!==e.token)throw ce(e,"Colon : expected after object key");B(e),r[t]=R(e)}}while(","===e.token);if("}"!==e.token)throw ce(e,"Comma , or bracket } expected after object value");I(e),B(e);let n=new m(r);return n=oe(e,n),n}return function(e){let t;if(e.tokenType===w.NUMBER){t=e.token,B(e);const i=xe(t,n),o=r(t,i);return new c(o)}return function(e){let t;if("("===e.token){if(z(e),B(e),t=R(e),")"!==e.token)throw ce(e,"Parenthesis ) expected");return I(e),B(e),t=new d(t),t=oe(e,t),t}return function(e){throw""===e.token?ce(e,"Unexpected end of expression"):ce(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e);const u={"!":"factorial","'":"ctranspose"};for(;me(u,e.token);)i=e.token,a=u[i],B(e),s=[t],t=new h(i,a,s),t=oe(e,t);return t}(e),("^"===e.token||".^"===e.token)&&(i=e.token,a="^"===i?"pow":"dotPow",_(e),s=[t,ie(e)],t=new h(i,a,s)),t}(e)}function oe(e,t,r){let n;for(;("("===e.token||"["===e.token||"."===e.token)&&(!r||r.includes(e.token));)if(n=[],"("===e.token){if(!ne(t)&&!U(t))return t;if(z(e),B(e),")"!==e.token)for(n.push(R(e));","===e.token;)B(e),n.push(R(e));if(")"!==e.token)throw ce(e,"Parenthesis ) expected");I(e),B(e),t=new f(t,n)}else if("["===e.token){if(z(e),B(e),"]"!==e.token)for(n.push(R(e));","===e.token;)B(e),n.push(R(e));if("]"!==e.token)throw ce(e,"Parenthesis ] expected");I(e),B(e),t=new i(t,new p(n))}else{if(B(e),!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ce(e,"Property name expected after dot");n.push(new c(e.token)),B(e),t=new i(t,new p(n,!0))}return t}function ae(e,t){let r="";for(;""!==T(e)&&T(e)!==t;)if("\\"===T(e)){D(e);const t=T(e),n=M[t];if(void 0!==n)r+=n,e.index+=1;else{if("u"!==t)throw ce(e,`Bad escape character \\${t}`);{const t=e.expression.slice(e.index+1,e.index+5);if(!/^[0-9A-Fa-f]{4}$/.test(t))throw ce(e,`Invalid unicode character \\u${t}`);r+=String.fromCharCode(parseInt(t,16)),e.index+=5}}}else r+=T(e),D(e);if(B(e),e.token!==t)throw ce(e,`End of string ${t} expected`);return B(e),r}function se(e){const t=[R(e)];let r=1;for(;","===e.token;)B(e),"]"!==e.token&&";"!==e.token&&(t[r]=R(e),r++);return new o(t)}function ue(e){return e.index-e.token.length+1}function ce(e,t){const r=ue(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}function le(e,t){const r=ue(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}return b.isAlpha=function(e,t,r){return b.isValidLatinOrGreek(e)||b.isValidMathSymbol(e,r)||b.isValidMathSymbol(t,e)},b.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},b.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(t)},b.isWhitespace=function(e,t){return" "===e||"\t"===e||"\n"===e&&t>0},b.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},b.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},b.isDigit=function(e){return e>="0"&&e<="9"},b.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},t.addConversion({from:"string",to:"Node",convert:b}),b})),cm="compile",lm=he(cm,["typed","parse"],(e=>{let{typed:t,parse:r}=e;return t(cm,{string:function(e){return r(e).compile()},"Array | Matrix":function(e){return Qn(e,(function(e){return r(e).compile()}))}})})),fm="evaluate",pm=he(fm,["typed","parse"],(e=>{let{typed:t,parse:r}=e;return t(fm,{string:function(e){const t=m();return r(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return r(e).compile().evaluate(t)},"Array | Matrix":function(e){const t=m();return Qn(e,(function(e){return r(e).compile().evaluate(t)}))},"Array | Matrix, Map | Object":function(e,t){return Qn(e,(function(e){return r(e).compile().evaluate(t)}))}})})),mm=he("Parser",["evaluate","parse"],(e=>{let{evaluate:t,parse:r}=e;function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:m(),writable:!1})}return n.prototype.type="Parser",n.prototype.isParser=!0,n.prototype.evaluate=function(e){return t(e,this.scope)},n.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},n.prototype.getAll=function(){return function(e){if(e instanceof l)return e.wrappedObject;const t={};for(const r of e.keys())o(t,r,e.get(r));return t}(this.scope)},n.prototype.getAllAsMap=function(){return this.scope},n.prototype.set=function(e,t){if(!function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){const n=e.charAt(t-1),i=e.charAt(t),o=e.charAt(t+1);if(!(r.isAlpha(i,n,o)||t>0&&r.isDigit(i)))return!1}return!0}(e))throw new Error(`Invalid variable name: '${e}'. Variable names must follow the specified rules.`);return this.scope.set(e,t),t},n.prototype.remove=function(e){this.scope.delete(e)},n.prototype.clear=function(){this.scope.clear()},n}),{isClass:!0}),hm="parser",dm=he(hm,["typed","Parser"],(e=>{let{typed:t,Parser:r}=e;return t(hm,{"":function(){return new r}})})),gm=he("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(e=>{let{typed:t,matrix:r,abs:n,addScalar:i,divideScalar:o,multiplyScalar:a,subtractScalar:s,larger:u,equalScalar:c,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return t("lup",{DenseMatrix:function(e){return h(e)},SparseMatrix:function(e){return function(e){const t=e._size[0],r=e._size[1],i=Math.min(t,r),s=e._values,f=e._index,h=e._ptr,d=[],g=[],y=[],x=[t,i],b=[],v=[],w=[],N=[i,r];let E,A,S;const M=[],C=[];for(E=0;E<t;E++)M[E]=E,C[E]=E;const T=function(e,t){const r=C[e],n=C[t];M[r]=t,M[n]=e,C[e]=n,C[t]=r};for(A=0;A<r;A++){const e=new m;A<t&&(y.push(d.length),d.push(1),g.push(A)),w.push(b.length);const r=h[A],i=h[A+1];for(S=r;S<i;S++)E=f[S],e.set(M[E],s[S]);A>0&&e.forEach(0,A-1,(function(t,r){p._forEachRow(t,d,g,y,(function(n,i){n>t&&e.accumulate(n,l(a(i,r)))}))}));let C=A,D=e.get(A),F=n(D);e.forEach(A+1,t-1,(function(e,t){const r=n(t);u(r,F)&&(C=e,F=r,D=t)})),A!==C&&(p._swapRows(A,C,x[1],d,g,y),p._swapRows(A,C,N[1],b,v,w),e.swap(A,C),T(A,C)),e.forEach(0,t-1,(function(e,t){e<=A?(b.push(t),v.push(e)):(t=o(t,D),c(t,0)||(d.push(t),g.push(e)))}))}return w.push(b.length),y.push(d.length),{L:new p({values:d,index:g,ptr:y,size:x}),U:new p({values:b,index:v,ptr:w,size:N}),p:M,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){const t=h(r(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function h(e){const t=e._size[0],r=e._size[1];let l=Math.min(t,r);const p=ae(e._data),m=[],h=[t,l],d=[],g=[l,r];let y,x,b;const v=[];for(y=0;y<t;y++)v[y]=y;for(x=0;x<r;x++){if(x>0)for(y=0;y<t;y++){const e=Math.min(y,x);let t=0;for(b=0;b<e;b++)t=i(t,a(p[y][b],p[b][x]));p[y][x]=s(p[y][x],t)}let e=x,r=0,l=0;for(y=x;y<t;y++){const t=p[y][x],i=n(t);u(i,r)&&(e=y,r=i,l=t)}if(x!==e&&(v[x]=[v[e],v[e]=v[x]][0],f._swapRows(x,e,p)),x<t)for(y=x+1;y<t;y++){const e=p[y][x];c(e,0)||(p[y][x]=o(p[y][x],l))}}for(x=0;x<r;x++)for(y=0;y<t;y++)0===x&&(y<r&&(d[y]=[]),m[y]=[]),y<x?(y<r&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=0)):y!==x?(y<r&&(d[y][x]=0),x<t&&(m[y][x]=p[y][x])):(y<r&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=1));const w=new f({data:m,size:h}),N=new f({data:d,size:g}),E=[];for(y=0,l=v.length;y<l;y++)E[v[y]]=y;return{L:w,U:N,p:E,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}})),ym=he("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],(e=>{let{typed:t,matrix:r,zeros:n,identity:i,isZero:o,equal:a,sign:s,sqrt:u,conj:c,unaryMinus:l,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=e;return en(t("qr",{DenseMatrix:function(e){return y(e)},SparseMatrix:function(e){return function(){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){const t=y(r(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:g});function g(e){const t=e._size[0],r=e._size[1],d=i([t],"dense"),g=d._data,y=e.clone(),x=y._data;let b,v,w;const N=n([t],"");for(w=0;w<Math.min(r,t);++w){const e=x[w][w],n=l(a(e,0)?1:s(e)),i=c(n);let d=0;for(b=w;b<t;b++)d=f(d,m(x[b][w],c(x[b][w])));const y=m(n,u(d));if(!o(y)){const n=h(e,y);for(N[w]=1,b=w+1;b<t;b++)N[b]=p(x[b][w],n);const o=l(c(p(n,y)));let a;for(v=w;v<r;v++){for(a=0,b=w;b<t;b++)a=f(a,m(c(N[b]),x[b][v]));for(a=m(a,o),b=w;b<t;b++)x[b][v]=m(h(x[b][v],m(N[b],a)),i)}for(b=0;b<t;b++){for(a=0,v=w;v<t;v++)a=f(a,m(g[b][v],N[v]));for(a=m(a,o),v=w;v<t;++v)g[b][v]=p(h(g[b][v],m(a,c(N[v]))),i)}}}return{Q:d,R:y,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function y(e){const t=g(e),r=t.R._data;if(e._data.length>0){const e="Complex"===r[0][0].type?d(0):0;for(let t=0;t<r.length;++t)for(let n=0;n<t&&n<(r[0]||[]).length;++n)r[t][n]=e}return t}}));function xm(e,t,r,n,i,o,a){let s=0;for(r[a]=e;s>=0;){const e=r[a+s],u=r[n+e];-1===u?(s--,o[t++]=e):(r[n+e]=r[i+u],++s,r[a+s]=u)}return t}function bm(e){return-e-2}const vm=he("csAmd",["add","multiply","transpose"],(e=>{let{add:t,multiply:r,transpose:n}=e;return function(e,a){if(!a||e<=0||e>3)return null;const s=a._size,u=s[0],c=s[1];let l=0,f=Math.max(16,10*Math.sqrt(c));f=Math.min(c-2,f);const p=function(e,i,o,a,s){const u=n(i);if(1===e&&a===o)return t(i,u);if(2===e){const e=u._index,t=u._ptr;let a=0;for(let r=0;r<o;r++){let n=t[r];if(t[r]=a,!(t[r+1]-n>s))for(const i=t[r+1];n<i;n++)e[a++]=e[n]}return t[o]=a,i=n(u),r(u,i)}return r(u,i)}(e,a,u,c,f);!function(e,t){const r=e._values,n=e._index,i=e._ptr,o=e._size[1];let a=0;for(let e=0;e<o;e++){let o=i[e];for(i[e]=a;o<i[e+1];o++)t(n[o],e,r?r[o]:1,null)&&(n[a]=n[o],r&&(r[a]=r[o]),a++)}i[o]=a,n.splice(a,n.length-a),r&&r.splice(a,r.length-a)}(p,o);const m=p._index,h=p._ptr;let d=h[c];const g=[],y=[],x=c+1,b=2*(c+1),v=3*(c+1),w=4*(c+1),N=5*(c+1),E=6*(c+1),A=7*(c+1),S=g;let M,C,T,D,F,O,B,_,z,I,k,R,q,P,j,U,L=function(e,t,r,n,o,a,s,u,c,l,f,p){for(let n=0;n<e;n++)r[0+n]=t[n+1]-t[n];r[0+e]=0;for(let t=0;t<=e;t++)r[o+t]=-1,a[t]=-1,r[s+t]=-1,r[u+t]=-1,r[c+t]=1,r[l+t]=1,r[f+t]=0,r[p+t]=r[0+t];const m=i(0,0,r,l,e);return r[f+e]=-2,t[e]=-1,r[l+e]=0,m}(c,h,y,0,v,S,b,A,x,E,w,N),$=function(e,t,r,n,i,o,a,s,u,c,l){let f=0;for(let p=0;p<e;p++){const m=r[n+p];if(0===m)r[i+p]=-2,f++,t[p]=-1,r[o+p]=0;else if(m>a)r[s+p]=0,r[i+p]=-1,f++,t[p]=bm(e),r[s+e]++;else{const e=r[u+m];-1!==e&&(c[e]=p),r[l+p]=r[u+m],r[u+m]=p}}return f}(c,h,y,N,w,E,f,x,v,S,b),H=0;for(;$<c;){for(T=-1;H<c&&-1===(T=y[v+H]);H++);-1!==y[b+T]&&(S[y[b+T]]=-1),y[v+H]=y[b+T];const e=y[w+T];let t=y[x+T];$+=t;let r=0;y[x+T]=-t;let n=h[T];const o=0===e?n:d;let a=o;for(D=1;D<=e+1;D++){for(D>e?(O=T,B=n,_=y[0+T]-e):(O=m[n++],B=h[O],_=y[0+O]),F=1;F<=_;F++)M=m[B++],(z=y[x+M])<=0||(r+=z,y[x+M]=-z,m[a++]=M,-1!==y[b+M]&&(S[y[b+M]]=S[M]),-1!==S[M]?y[b+S[M]]=y[b+M]:y[v+y[N+M]]=y[b+M]);O!==T&&(h[O]=bm(T),y[E+O]=0)}for(0!==e&&(d=a),y[N+T]=r,h[T]=o,y[0+T]=a-o,y[w+T]=-2,L=i(L,l,y,E,c),I=o;I<a;I++){if(M=m[I],(k=y[w+M])<=0)continue;z=-y[x+M];const e=L-z;for(n=h[M],R=h[M]+k-1;n<=R;n++)O=m[n],y[E+O]>=L?y[E+O]-=z:0!==y[E+O]&&(y[E+O]=y[N+O]+e)}for(I=o;I<a;I++){for(M=m[I],R=h[M],q=R+y[w+M]-1,P=R,j=0,U=0,n=R;n<=q;n++)if(O=m[n],0!==y[E+O]){const e=y[E+O]-L;e>0?(U+=e,m[P++]=O,j+=O):(h[O]=bm(T),y[E+O]=0)}y[w+M]=P-R+1;const e=P,i=R+y[0+M];for(n=q+1;n<i;n++){C=m[n];const e=y[x+C];e<=0||(U+=e,m[P++]=C,j+=C)}0===U?(h[M]=bm(T),z=-y[x+M],r-=z,t+=z,$+=z,y[x+M]=0,y[w+M]=-1):(y[N+M]=Math.min(y[N+M],U),m[P]=m[e],m[e]=m[R],m[R]=T,y[0+M]=P-R+1,j=(j<0?-j:j)%c,y[b+M]=y[A+j],y[A+j]=M,S[M]=j)}for(y[N+T]=r,l=Math.max(l,r),L=i(L+l,l,y,E,c),I=o;I<a;I++)if(M=m[I],!(y[x+M]>=0))for(j=S[M],M=y[A+j],y[A+j]=-1;-1!==M&&-1!==y[b+M];M=y[b+M],L++){for(_=y[0+M],k=y[w+M],n=h[M]+1;n<=h[M]+_-1;n++)y[E+m[n]]=L;let e=M;for(C=y[b+M];-1!==C;){let t=y[0+C]===_&&y[w+C]===k;for(n=h[C]+1;t&&n<=h[C]+_-1;n++)y[E+m[n]]!==L&&(t=0);t?(h[C]=bm(M),y[x+M]+=y[x+C],y[x+C]=0,y[w+C]=-1,C=y[b+C],y[b+e]=C):(e=C,C=y[b+C])}}for(n=o,I=o;I<a;I++)M=m[I],(z=-y[x+M])<=0||(y[x+M]=z,U=y[N+M]+r-z,U=Math.min(U,c-$-z),-1!==y[v+U]&&(S[y[v+U]]=M),y[b+M]=y[v+U],S[M]=-1,y[v+U]=M,H=Math.min(H,U),y[N+M]=U,m[n++]=M);y[x+T]=t,0==(y[0+T]=n-o)&&(h[T]=-1,y[E+T]=0),0!==e&&(d=n)}for(M=0;M<c;M++)h[M]=bm(h[M]);for(C=0;C<=c;C++)y[v+C]=-1;for(C=c;C>=0;C--)y[x+C]>0||(y[b+C]=y[v+h[C]],y[v+h[C]]=C);for(O=c;O>=0;O--)y[x+O]<=0||-1!==h[O]&&(y[b+O]=y[v+h[O]],y[v+h[O]]=O);for(T=0,M=0;M<=c;M++)-1===h[M]&&(T=xm(M,T,y,v,b,g,E));return g.splice(g.length-1,1),g};function i(e,t,r,n,i){if(e<2||e+t<0){for(let e=0;e<i;e++)0!==r[n+e]&&(r[n+e]=1);e=2}return e}function o(e,t){return e!==t}}));function wm(e,t,r,n,i,o,a){let s,u,c,l=0;if(e<=t||r[n+t]<=r[i+e])return-1;r[i+e]=r[n+t];const f=r[o+e];if(r[o+e]=t,-1===f)l=1,c=e;else{for(l=2,c=f;c!==r[a+c];c=r[a+c]);for(s=f;s!==c;s=u)u=r[a+s],r[a+s]=c}return{jleaf:l,q:c}}const Nm=he("csCounts",["transpose"],(e=>{let{transpose:t}=e;return function(e,r,n,i){if(!e||!r||!n)return null;const o=e._size,a=o[0],s=o[1];let u,c,l,f,p,m,h;const d=4*s+(i?s+a+1:0),g=[],y=s,x=2*s,b=3*s,v=4*s,w=5*s+1;for(l=0;l<d;l++)g[l]=-1;const N=[],E=t(e),A=E._index,S=E._ptr;for(l=0;l<s;l++)for(c=n[l],N[c]=-1===g[b+c]?1:0;-1!==c&&-1===g[b+c];c=r[c])g[b+c]=l;if(i){for(l=0;l<s;l++)g[n[l]]=l;for(u=0;u<a;u++){for(l=s,m=S[u],h=S[u+1],p=m;p<h;p++)l=Math.min(l,g[A[p]]);g[w+u]=g[v+l],g[v+l]=u}}for(u=0;u<s;u++)g[0+u]=u;for(l=0;l<s;l++){for(c=n[l],-1!==r[c]&&N[r[c]]--,f=i?g[v+l]:c;-1!==f;f=i?g[w+f]:-1)for(p=S[f];p<S[f+1];p++){u=A[p];const e=wm(u,c,g,b,y,x,0);e.jleaf>=1&&N[c]++,2===e.jleaf&&N[e.q]--}-1!==r[c]&&(g[0+c]=r[c])}for(c=0;c<s;c++)-1!==r[c]&&(N[r[c]]+=N[c]);return N}})),Em=he("csSqr",["add","multiply","transpose"],(e=>{let{add:t,multiply:r,transpose:n}=e;const i=vm({add:t,multiply:r,transpose:n}),o=Nm({transpose:n});return function(e,t,r){const n=t._ptr,a=t._size[1];let s;const u={};if(u.q=i(e,t),e&&!u.q)return null;if(r){const r=e?function(e,t,r){const n=e._values,i=e._index,o=e._ptr,a=e._size,s=e._datatype,u=a[0],c=a[1],l=null,f=[],p=[];let m=0;for(let e=0;e<c;e++){p[e]=m;const t=r?r[e]:e;for(let e=o[t],r=o[t+1],a=e;a<r;a++){const e=i[a];f[m]=e,l&&(l[m]=n[a]),m++}}return p[c]=m,e.createSparseMatrix({values:l,index:f,ptr:p,size:[u,c],datatype:s})}(t,0,u.q):t;u.parent=function(e){if(!e)return null;const t=e._index,r=e._ptr,n=e._size,i=n[0],o=n[1],a=[],s=[],u=o;let c,l;for(c=0;c<i;c++)s[u+c]=-1;for(let e=0;e<o;e++){a[e]=-1,s[0+e]=-1;for(let n=r[e],i=r[e+1],o=n;o<i;o++){const r=t[o];for(c=s[u+r];-1!==c&&c<e;c=l)l=s[0+c],s[0+c]=e,-1===l&&(a[c]=e);s[u+r]=e}}return a}(r);const n=function(e,t){if(!e)return null;let r,n=0;const i=[],o=[],a=t,s=2*t;for(r=0;r<t;r++)o[0+r]=-1;for(r=t-1;r>=0;r--)-1!==e[r]&&(o[a+r]=o[0+e[r]],o[0+e[r]]=r);for(r=0;r<t;r++)-1===e[r]&&(n=xm(r,n,o,0,a,i,s));return i}(u.parent,a);if(u.cp=o(r,u.parent,n,1),r&&u.parent&&u.cp&&function(e,t){const r=e._ptr,n=e._index,i=e._size,o=i[0],a=i[1];t.pinv=[],t.leftmost=[];const s=t.parent,u=t.pinv,c=t.leftmost,l=[],f=o,p=o+a,m=o+2*a;let h,d,g,y,x;for(d=0;d<a;d++)l[f+d]=-1,l[p+d]=-1,l[m+d]=0;for(h=0;h<o;h++)c[h]=-1;for(d=a-1;d>=0;d--)for(y=r[d],x=r[d+1],g=y;g<x;g++)c[n[g]]=d;for(h=o-1;h>=0;h--)u[h]=-1,d=c[h],-1!==d&&(0==l[m+d]++&&(l[p+d]=h),l[0+h]=l[f+d],l[f+d]=h);for(t.lnz=0,t.m2=o,d=0;d<a;d++){if(h=l[f+d],t.lnz++,h<0&&(h=t.m2++),u[h]=d,--m[d]<=0)continue;t.lnz+=l[m+d];const e=s[d];-1!==e&&(0===l[m+e]&&(l[p+e]=l[p+d]),l[0+l[p+d]]=l[f+e],l[f+e]=l[0+h],l[m+e]+=l[m+d])}for(h=0;h<o;h++)u[h]<0&&(u[h]=d++);return!0}(r,u))for(u.unz=0,s=0;s<a;s++)u.unz+=u.cp[s]}else u.unz=4*n[a]+a,u.lnz=u.unz;return u}}));function Am(e,t){return e[t]<0}function Sm(e,t){e[t]=bm(e[t])}function Mm(e){return e<0?bm(e):e}function Cm(e,t,r,n,i){const o=t._index,a=t._ptr,s=t._size[1];let u,c,l,f=0;for(n[0]=e;f>=0;){e=n[f];const t=i?i[e]:e;Am(a,e)||(Sm(a,e),n[s+f]=t<0?0:Mm(a[t]));let p=1;for(c=n[s+f],l=t<0?0:Mm(a[t+1]);c<l;c++)if(u=o[c],!Am(a,u)){n[s+f]=c,n[++f]=u,p=0;break}p&&(f--,n[--r]=e)}return r}const Tm=he("csSpsolve",["divideScalar","multiply","subtract"],(e=>{let{divideScalar:t,multiply:r,subtract:n}=e;return function(e,i,o,a,s,u,c){const l=e._values,f=e._index,p=e._ptr,m=e._size[1],h=i._values,d=i._index,g=i._ptr;let y,x,b,v;const w=function(e,t,r,n,i){const o=e._ptr,a=e._size,s=t._index,u=t._ptr,c=a[1];let l,f,p,m=c;for(f=u[r],p=u[r+1],l=f;l<p;l++){const t=s[l];Am(o,t)||(m=Cm(t,e,m,n,i))}for(l=m;l<c;l++)Sm(o,n[l]);return m}(e,i,o,a,u);for(y=w;y<m;y++)s[a[y]]=0;for(x=g[o],b=g[o+1],y=x;y<b;y++)s[d[y]]=h[y];for(let e=w;e<m;e++){const i=a[e],o=u?u[i]:i;if(!(o<0))for(x=p[o],b=p[o+1],s[i]=t(s[i],l[c?x:b-1]),y=c?x+1:x,v=c?b:b-1;y<v;y++){const e=f[y];s[e]=n(s[e],r(l[y],s[i]))}}return w}})),Dm=he("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],(e=>{let{abs:t,divideScalar:r,multiply:n,subtract:i,larger:o,largerEq:a,SparseMatrix:s}=e;const u=Tm({divideScalar:r,multiply:n,subtract:i});return function(e,i,c){if(!e)return null;const l=e._size[1];let f,p=100,m=100;i&&(f=i.q,p=i.lnz||p,m=i.unz||m);const h=[],d=[],g=[],y=new s({values:h,index:d,ptr:g,size:[l,l]}),x=[],b=[],v=[],w=new s({values:x,index:b,ptr:v,size:[l,l]}),N=[];let E,A;const S=[],M=[];for(E=0;E<l;E++)S[E]=0,N[E]=-1,g[E+1]=0;p=0,m=0;for(let i=0;i<l;i++){g[i]=p,v[i]=m;const s=f?f[i]:i,w=u(y,e,s,M,S,N,1);let C=-1,T=-1;for(A=w;A<l;A++)if(E=M[A],N[E]<0){const e=t(S[E]);o(e,T)&&(T=e,C=E)}else b[m]=N[E],x[m++]=S[E];if(-1===C||T<=0)return null;N[s]<0&&a(t(S[s]),n(T,c))&&(C=s);const D=S[C];for(b[m]=i,x[m++]=D,N[C]=i,d[p]=C,h[p++]=1,A=w;A<l;A++)E=M[A],N[E]<0&&(d[p]=E,h[p++]=r(S[E],D)),S[E]=0}for(g[l]=p,v[l]=m,A=0;A<p;A++)d[A]=N[d[A]];return h.splice(p,h.length-p),d.splice(p,d.length-p),x.splice(m,x.length-m),b.splice(m,b.length-m),{L:y,U:w,pinv:N}}})),Fm=he("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],(e=>{let{typed:t,abs:r,add:n,multiply:i,transpose:o,divideScalar:a,subtract:s,larger:u,largerEq:c,SparseMatrix:l}=e;const f=Em({add:n,multiply:i,transpose:o}),p=Dm({abs:r,divideScalar:a,multiply:i,subtract:s,larger:u,largerEq:c,SparseMatrix:l});return t("slu",{"SparseMatrix, number, number":function(e,t,r){if(!ye(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||r>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");const n=f(t,e,!1),i=p(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function Om(e,t){let r;const n=t.length,i=[];if(e)for(r=0;r<n;r++)i[e[r]]=t[r];else for(r=0;r<n;r++)i[r]=t[r];return i}const Bm="lusolve",_m=he(Bm,["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],(e=>{let{typed:t,matrix:r,lup:n,slu:i,usolve:o,lsolve:a,DenseMatrix:s}=e;const u=pc({DenseMatrix:s});return t(Bm,{"Array, Array | Matrix":function(e,t){e=r(e);const i=n(e);return l(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){const r=n(e);return l(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){const r=n(e);return l(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,r,n){const o=i(e,r,n);return l(o.L,o.U,o.p,o.q,t)},"Object, Array | Matrix":function(e,t){return l(e.L,e.U,e.p,e.q,t)}});function c(e){if(E(e))return e;if(N(e))return r(e);throw new TypeError("Invalid Matrix LU decomposition")}function l(e,t,r,n,i){e=c(e),t=c(t),r&&((i=u(e,i,!0))._data=Om(r,i._data));const s=a(e,i),l=o(t,s);return n&&(l._data=Om(n,l._data)),l}})),zm="polynomialRoot",Im=he(zm,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],(e=>{let{typed:t,isZero:r,equalScalar:n,add:i,subtract:o,multiply:a,divide:s,sqrt:u,unaryMinus:c,cbrt:l,typeOf:f,im:p,re:m}=e;return t(zm,{"number|Complex, ...number|Complex":(e,t)=>{const h=[e,...t];for(;h.length>0&&r(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError(`Polynomial [${e}, ${t}] must have a non-zero non-constant coefficient`);switch(h.length){case 2:return[c(s(h[0],h[1]))];case 3:{const[e,t,r]=h,i=a(2,r),l=a(t,t),f=a(4,r,e);if(n(l,f))return[s(c(t),i)];const p=u(o(l,f));return[s(o(p,t),i),s(o(c(p),t),i)]}case 4:{const[e,t,r,d]=h,g=c(a(3,d)),y=a(r,r),x=a(3,d,t),b=i(a(2,r,r,r),a(27,d,d,e)),v=a(9,d,r,t);if(n(y,x)&&n(b,v))return[s(r,g)];const w=o(y,x),N=o(b,v),E=i(a(18,d,r,t,e),a(r,r,t,t)),A=i(a(4,r,r,r,e),a(4,d,t,t,t),a(27,d,d,e,e));if(n(E,A))return[s(o(a(4,d,r,t),i(a(9,d,d,e),a(r,r,r))),a(d,w)),s(o(a(9,d,e),a(r,t)),a(2,w))];let S;return S=n(y,x)?N:s(i(N,u(o(a(N,N),a(4,w,w,w)))),2),l(S,!0).toArray().map((e=>s(i(r,e,s(w,e)),g))).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 ${h}`)}}})}));r(9463);const km=he("Help",["evaluate"],(e=>{let{evaluate:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){const e=this.doc||{};let r="\n";if(e.name&&(r+="Name: "+e.name+"\n\n"),e.category&&(r+="Category: "+e.category+"\n\n"),e.description&&(r+="Description:\n "+e.description+"\n\n"),e.syntax&&(r+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){r+="Examples:\n";let n=!1;const i=t("config()"),o={config:e=>(n=!0,t("config(newConfig)",{newConfig:e}))};for(let n=0;n<e.examples.length;n++){const i=e.examples[n];let a;r+=" "+i+"\n";try{a=t(i,o)}catch(e){a=e}void 0===a||O(a)||(r+=" "+an(a,{precision:14})+"\n")}r+="\n",n&&t("config(originalConfig)",{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(r+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(r+="See also: "+e.seealso.join(", ")+"\n"),r},r.prototype.toJSON=function(){const e=ae(this.doc);return e.mathjs="Help",e},r.fromJSON=function(e){const t={};return Object.keys(e).filter((e=>"mathjs"!==e)).forEach((r=>{t[r]=e[r]})),new r(t)},r.prototype.valueOf=r.prototype.toString,r}),{isClass:!0}),Rm=he("Chain",["?on","math","typed"],(e=>{let{on:t,math:r,typed:n}=e;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");ie(e)?this.value=e.value:this.value=e}function o(e,t){pe(i.prototype,e,(function(){const e=t();if("function"==typeof e)return a(e)}))}function a(e){return function(){if(0===arguments.length)return new i(e(this.value));const t=[this.value];for(let e=0;e<arguments.length;e++)t[e+1]=arguments[e];if(n.isTypedFunction(e)){const r=n.resolve(e,t);if(1===r.params.length)throw new Error("chain function "+e.name+" cannot match rest parameter between chain value and additional arguments.");return new i(r.implementation.apply(e,t))}return new i(e.apply(e,t))}}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return an(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(e){return new i(e.value)},i.createProxy=function(e,t){if("string"==typeof e)r=e,"function"==typeof(n=t)&&(i.prototype[r]=a(n));else for(const t in e)me(e,t)&&void 0===s[t]&&o(t,(()=>e[t]));var r,n};const s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),t&&t("import",(function(e,t,r){r||o(e,t)})),i}),{isClass:!0}),qm={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]},Pm={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"]},jm={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","bigint","complex","fraction","index","matrix","string","unit"]},bigint:{name:"bigint",category:"Construction",syntax:["bigint(x)"],description:"Create a bigint, an integer with an arbitrary number of digits, from a number or string.",examples:["123123123123123123 # a large number will lose digits",'bigint("123123123123123123")','bignumber(["1", "3", "5"])'],seealso:["boolean","bignumber","number","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","bigint","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:qm,E:qm,false:{name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]},i:{name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]},Infinity:{name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]},LN2:{name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]},LN10:{name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]},LOG2E:{name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]},LOG10E:{name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]},NaN:{name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]},null:{name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]},pi:Pm,PI:Pm,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Bohr magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Bohr radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},lsolveAll:{name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},leafCount:{name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},polynomialRoot:{name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},resolve:{name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},simplifyConstant:{name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCore:{name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},symbolicEqual:{name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},usolveAll:{name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],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 hypotenuse of a list with values.",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>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 indicate the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dot:{name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},getMatrixDataType:{name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},identity:{name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},filter:{name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},flatten:{name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]},forEach:{name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},inv:{name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},pinv:{name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore–Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},eigs:{name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the Kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},matrixFromFunction:{name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},matrixFromRows:{name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},matrixFromColumns:{name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)","map(x, y, ..., callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.",examples:["map([1, 2, 3], square)","map([1, 2], [3, 4], f(a,b) = a + b)"],seealso:["filter","forEach"]},ones:{name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},partitionSelect:{name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},range:{name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},resize:{name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},reshape:{name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},rotate:{name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},rotationMatrix:{name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},row:{name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},size:{name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},sort:{name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},squeeze:{name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},subset:{name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},trace:{name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},transpose:{name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},zeros:{name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},fft:{name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifft:{name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},sylvester:{name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},schur:{name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},lyap:{name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},solveODE:{name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},combinations:{name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},combinationsWithRep:{name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},factorial:{name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},gamma:{name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},kldivergence:{name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},lgamma:{name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},multinomial:{name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},permutations:{name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},pickRandom:{name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},random:{name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},randomInt:{name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},compare:{name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},compareNatural:{name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},compareText:{name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},deepEqual:{name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},equal:{name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},equalText:{name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},larger:{name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},largerEq:{name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},smaller:{name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},smallerEq:{name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},unequal:{name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},setCartesian:{name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},setDifference:{name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},setDistinct:{name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},setIntersect:{name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},setIsSubset:{name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},setMultiplicity:{name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},setPowerset:{name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},setSize:{name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},setSymDifference:{name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},setUnion:{name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},zpk2tf:{name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},freqz:{name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},erf:{name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},zeta:{name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},cumsum:{name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},std:{name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},sum:{name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},variance:{name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]},corr:{name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},acsc:{name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},acsch:{name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},asec:{name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},asech:{name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asin:{name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},asinh:{name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},atan:{name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},atanh:{name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},atan2:{name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},cos:{name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},cosh:{name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cot:{name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},coth:{name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},csc:{name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},csch:{name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]},sec:{name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},sech:{name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},sin:{name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},sinh:{name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tan:{name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},tanh:{name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},to:{name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},clone:{name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},format:{name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},bin:{name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},oct:{name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},hex:{name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isNaN:{name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isInteger:{name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isNegative:{name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},isNumeric:{name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},hasNumericValue:{name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},isPositive:{name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isPrime:{name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isZero:{name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},print:{name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOf:{name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "bigint")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","bigint","fraction","bignumber","string","format"]}},Um="help",Lm=he(Um,["typed","mathWithTransform","Help"],(e=>{let{typed:t,mathWithTransform:r,Help:n}=e;return t(Um,{any:function(e){let t,o=e;if("string"!=typeof e)for(t in r)if(me(r,t)&&e===r[t]){o=t;break}const a=i(jm,o);if(!a){const e="function"==typeof o?o.name:o;throw new Error('No documentation found on "'+e+'"')}return new n(a)}})})),$m="chain",Hm=he($m,["typed","Chain"],(e=>{let{typed:t,Chain:r}=e;return t($m,{"":function(){return new r},any:function(e){return new r(e)}})})),Gm=he("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],(e=>{let{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:o,isZero:a,unaryMinus:s}=e;return t("det",{any:function(e){return ae(e)},"Array | Matrix":function(e){let t;switch(t=E(e)?e.size():Array.isArray(e)?(e=r(e)).size():[],t.length){case 0:return ae(e);case 1:if(1===t[0])return ae(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+an(t)+")");case 2:{const r=t[0],u=t[1];if(r===u)return function(e,t){if(1===t)return ae(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));{let r=!1;const u=new Array(t).fill(0).map(((e,t)=>t));for(let s=0;s<t;s++){let c=u[s];if(a(e[c][s])){let n;for(n=s+1;n<t;n++)if(!a(e[u[n]][s])){c=u[n],u[n]=u[s],u[s]=c,r=!r;break}if(n===t)return e[c][s]}const l=e[c][s],f=0===s?1:e[u[s-1]][s-1];for(let r=s+1;r<t;r++){const a=u[r];for(let r=s+1;r<t;r++)e[a][r]=o(n(i(e[a][r],l),i(e[a][s],e[c][r])),f)}}const c=e[u[t-1]][t-1];return r?s(c):c}}(e.clone().valueOf(),r);if(0===u)return 1;throw new RangeError("Matrix must be square (size: "+an(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+an(t)+")")}}})})),Vm=he("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],(e=>{let{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:o,unaryMinus:a,det:s,identity:u,abs:c}=e;return t("inv",{"Array | Matrix":function(e){const t=E(e)?e.size():hn(e);switch(t.length){case 1:if(1===t[0])return E(e)?r([n(1,e.valueOf()[0])]):[n(1,e[0])];throw new RangeError("Matrix must be square (size: "+an(t)+")");case 2:{const n=t[0],i=t[1];if(n===i)return E(e)?r(l(e.valueOf(),n,i),e.storage()):l(e,n,i);throw new RangeError("Matrix must be square (size: "+an(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+an(t)+")")}},any:function(e){return n(1,e)}});function l(e,t,r){let l,f,p,m,h;if(1===t){if(m=e[0][0],0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,m)]]}if(2===t){const t=s(e);if(0===t)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],t),n(a(e[0][1]),t)],[n(a(e[1][0]),t),n(e[0][0],t)]]}{const s=e.concat();for(l=0;l<t;l++)s[l]=s[l].concat();const m=u(t).valueOf();for(let e=0;e<r;e++){let u=c(s[e][e]),d=e;for(l=e+1;l<t;)c(s[l][e])>u&&(u=c(s[l][e]),d=l),l++;if(0===u)throw Error("Cannot calculate inverse, determinant is zero");l=d,l!==e&&(h=s[e],s[e]=s[l],s[l]=h,h=m[e],m[e]=m[l],m[l]=h);const g=s[e],y=m[e];for(l=0;l<t;l++){const t=s[l],u=m[l];if(l!==e){if(0!==t[e]){for(p=n(a(t[e]),g[e]),f=e;f<r;f++)t[f]=i(t[f],o(p,g[f]));for(f=0;f<r;f++)u[f]=i(u[f],o(p,y[f]))}}else{for(p=g[e],f=e;f<r;f++)t[f]=n(t[f],p);for(f=0;f<r;f++)u[f]=n(u[f],p)}}}return m}}})),Wm="pinv",Zm=he(Wm,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],(e=>{let{typed:t,matrix:r,inv:n,deepEqual:i,equal:o,dotDivide:a,dot:s,ctranspose:u,divideScalar:c,multiply:l,add:f,Complex:p}=e;return t(Wm,{"Array | Matrix":function(e){const t=E(e)?e.size():hn(e);switch(t.length){case 1:return d(e)?u(e):1===t[0]?n(e):a(u(e),s(e,e));case 2:{if(d(e))return u(e);const i=t[0],o=t[1];if(i===o)try{return n(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return E(e)?r(m(e.valueOf(),i,o),e.storage()):m(e,i,o)}default:throw new RangeError("Matrix must be two dimensional (size: "+an(t)+")")}},any:function(e){return o(e,0)?ae(e):c(1,e)}});function m(e,t,r){const{C:i,F:o}=function(e,t,r){const n=function(e,t,r){const n=ae(e);let i=0;for(let e=0;e<t;e++){if(r<=i)return n;let o=e;for(;h(n[o][i]);)if(o++,t===o&&(o=e,i++,r===i))return n;[n[o],n[e]]=[n[e],n[o]];let s=n[e][i];for(let t=0;t<r;t++)n[e][t]=a(n[e][t],s);for(let o=0;o<t;o++)if(o!==e){s=n[o][i];for(let t=0;t<r;t++)n[o][t]=f(n[o][t],l(-1,l(s,n[e][t])))}i++}return n}(e,t,r);return{C:e.map(((e,r)=>e.filter(((e,r)=>r<t&&!h(s(n[r],n[r])))))),F:n.filter(((e,t)=>!h(s(n[t],n[t]))))}}(e,t,r),c=l(n(l(u(i),i)),u(i)),p=l(u(o),n(l(o,u(o))));return l(p,c)}function h(e){return o(f(e,p(1,1)),f(0,p(1,1)))}function d(e){return i(f(e,p(1,1)),f(l(e,0),p(1,1)))}}));const Ym=he("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],(e=>{let{config:t,typed:r,matrix:n,addScalar:i,subtract:o,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:y,add:v,larger:w,column:N,flatten:E,number:A,complex:S,sqrt:M,diag:C,size:T,reshape:D,qr:F,usolve:O,usolveAll:B,im:_,re:z,smaller:I,matrixFromColumns:k,dot:R}=e;const q=function(e){let{config:t,addScalar:r,subtract:n,abs:i,atan:o,cos:a,sin:s,multiplyScalar:u,inv:c,bignumber:l,multiply:f,add:p}=e;function m(e,r,n){const i=r-e;return Math.abs(i)<=t.relTol?Math.PI/4:.5*Math.atan(2*n/(r-e))}function h(e,r,a){const s=n(r,e);return i(s)<=t.relTol?l(-1).acos().div(4):u(.5,o(f(2,a,c(s))))}function d(e,t,r,n){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=Array(i).fill(0),u=Array(i).fill(0);for(let t=0;t<i;t++)s[t]=o*e[t][r]-a*e[t][n],u[t]=a*e[t][r]+o*e[t][n];for(let t=0;t<i;t++)e[t][r]=s[t],e[t][n]=u[t];return e}function g(e,t,i,o){const c=e.length,f=a(t),p=s(t),m=Array(c).fill(l(0)),h=Array(c).fill(l(0));for(let t=0;t<c;t++)m[t]=n(u(f,e[t][i]),u(p,e[t][o])),h[t]=r(u(p,e[t][i]),u(f,e[t][o]));for(let t=0;t<c;t++)e[t][i]=m[t],e[t][o]=h[t];return e}function y(e,t,i,o){const c=e.length,m=l(a(t)),h=l(s(t)),d=u(m,m),g=u(h,h),y=Array(c).fill(l(0)),x=Array(c).fill(l(0)),b=f(l(2),m,h,e[i][o]),v=r(n(u(d,e[i][i]),b),u(g,e[o][o])),w=p(u(g,e[i][i]),b,u(d,e[o][o]));for(let t=0;t<c;t++)y[t]=n(u(m,e[i][t]),u(h,e[o][t])),x[t]=r(u(h,e[i][t]),u(m,e[o][t]));e[i][i]=v,e[o][o]=w,e[i][o]=l(0),e[o][i]=l(0);for(let t=0;t<c;t++)t!==i&&t!==o&&(e[i][t]=y[t],e[t][i]=y[t],e[o][t]=x[t],e[t][o]=x[t]);return e}function x(e,t,r,n){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=o*o,u=a*a,c=Array(i).fill(0),l=Array(i).fill(0),f=s*e[r][r]-2*o*a*e[r][n]+u*e[n][n],p=u*e[r][r]+2*o*a*e[r][n]+s*e[n][n];for(let t=0;t<i;t++)c[t]=o*e[r][t]-a*e[n][t],l[t]=a*e[r][t]+o*e[n][t];e[r][r]=f,e[n][n]=p,e[r][n]=0,e[n][r]=0;for(let t=0;t<i;t++)t!==r&&t!==n&&(e[r][t]=c[t],e[t][r]=c[t],e[n][t]=l[t],e[t][n]=l[t]);return e}function b(e){const t=e.length;let r=0,n=[0,1];for(let i=0;i<t;i++)for(let o=i+1;o<t;o++)Math.abs(r)<Math.abs(e[i][o])&&(r=Math.abs(e[i][o]),n=[i,o]);return[n,r]}function v(e){const t=e.length;let r=0,n=[0,1];for(let o=0;o<t;o++)for(let a=o+1;a<t;a++)i(r)<i(e[o][a])&&(r=i(e[o][a]),n=[o,a]);return[n,r]}function w(e,t,r){const n=e.length,o=Array(n);let a;if(r){a=Array(n);for(let e=0;e<n;e++)a[e]=Array(n)}for(let s=0;s<n;s++){let u=0,c=e[0];for(let t=0;t<e.length;t++)i(e[t])<i(c)&&(u=t,c=e[u]);if(o[s]=e.splice(u,1)[0],r)for(let e=0;e<n;e++)a[s][e]=t[e][u],t[e].splice(u,1)}if(!r)return{values:o};const s=a.map(((e,t)=>({value:o[t],vector:e})));return{values:o,eigenvectors:s}}return function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.relTol,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if("number"===o)return function(e,t,r){const n=e.length,i=Math.abs(t/n);let o,a;if(r){a=new Array(n);for(let e=0;e<n;e++)a[e]=Array(n).fill(0),a[e][e]=1}let s=b(e);for(;Math.abs(s[1])>=Math.abs(i);){const t=s[0][0],n=s[0][1];o=m(e[t][t],e[n][n],e[t][n]),e=x(e,o,t,n),r&&(a=d(a,o,t,n)),s=b(e)}const u=Array(n).fill(0);for(let t=0;t<n;t++)u[t]=e[t][t];return w(ae(u),a,r)}(e,n,a);if("BigNumber"===o)return function(e,t,r){const n=e.length,o=i(t/n);let a,s;if(r){s=new Array(n);for(let e=0;e<n;e++)s[e]=Array(n).fill(0),s[e][e]=1}let u=v(e);for(;i(u[1])>=i(o);){const t=u[0][0],n=u[0][1];a=h(e[t][t],e[n][n],e[t][n]),e=y(e,a,t,n),r&&(s=g(s,a,t,n)),u=v(e)}const c=Array(n).fill(0);for(let t=0;t<n;t++)c[t]=e[t][t];return w(ae(c),s,r)}(e,n,a);throw TypeError("Unsupported data type: "+o)}}({config:t,addScalar:i,subtract:o,column:N,flatten:E,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,inv:m,bignumber:h,complex:S,multiply:y,add:v}),P=function(e){let{addScalar:t,subtract:r,flatten:n,multiply:i,multiplyScalar:o,divideScalar:a,sqrt:s,abs:u,bignumber:c,diag:l,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:g,equal:y,complex:x,larger:b,smaller:v,matrixFromColumns:w,dot:N}=e;function E(e,n,i,a){const u=t(e,a),c=r(o(e,a),o(n,i)),l=o(u,.5),f=o(s(r(o(u,u),o(4,c))),.5);return[t(l,f),r(l,f)]}function A(e,t,n,i,o,a,s,l){const f="BigNumber"===l,p="Complex"===l,m=f?c(0):p?x(0):0,h=f?c(1):p?x(1):1;if(v(u(n),s))return[[h,m],[m,h]];if(b(u(r(o,a)),s))return[[r(o,i),r(a,i)],[n,n]];const d=r(e,o),g=r(i,o);return v(u(t),s)&&v(u(g),s)?[[d,h],[n,m]]:[[t,m],[g,h]]}function S(e,t){for(let r=0;r<e.length;r++)e[r].push(...Array(t-e[r].length).fill(0));for(let r=e.length;r<t;r++)e.push(Array(t).fill(0)),e[r][r]=1;return e}function M(e,t,r){for(let n=0;n<e.length;n++)if(r(e[n],t))return n;return-1}function C(e,t,r,n,i){const o="BigNumber"===i?c(1e3):1e3;let a,s=0;for(;s<5;++s){a=T(t,r,i);try{a=d(e,a)}catch(e){continue}if(b(F(a),o))break}if(s>=5)return null;for(s=0;;){const t=d(e,a);if(v(F(D(a,[t])),n))break;if(++s>=10)return null;a=O(t)}return a}function T(e,t,r){const n="BigNumber"===r,i="Complex"===r;let o=Array(e).fill(0).map((e=>2*Math.random()-1));return n&&(o=o.map((e=>c(e)))),i&&(o=o.map((e=>x(e)))),o=D(o,t),O(o,r)}function D(e,t){const n=f(e);for(let o of t)o=p(o,n),e=r(e,i(a(N(o,e),N(o,o)),o));return e}function F(e){return u(s(N(e,e)))}function O(e,t){const r="Complex"===t,n="BigNumber"===t?c(1):r?x(1):1;return i(a(n,F(e)),e)}return function(e,s,f,p){let d=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const w=function(e,r,n,i,s){const f="BigNumber"===i,p="Complex"===i,m=f?c(0):0,h=f?c(1):p?x(1):1,d=f?c(1):1,g=f?c(10):2,w=o(g,g);let N;s&&(N=Array(r).fill(h));let E=!1;for(;!E;){E=!0;for(let n=0;n<r;n++){let i=m,c=m;for(let o=0;o<r;o++)n!==o&&(i=t(i,u(e[o][n])),c=t(c,u(e[n][o])));if(!y(i,0)&&!y(c,0)){let u=d,l=i;const f=a(c,g),p=o(c,g);for(;v(l,f);)l=o(l,w),u=o(u,g);for(;b(l,p);)l=a(l,w),u=a(u,g);if(v(a(t(l,c),u),o(t(i,c),.95))){E=!1;const t=a(1,u);for(let i=0;i<r;i++)n!==i&&(e[n][i]=o(e[n][i],t),e[i][n]=o(e[i][n],u));s&&(N[n]=o(N[n],t))}}}}return s?l(N):null}(e,s,0,p,d);!function(e,n,i,s,l,f){const p="BigNumber"===s,m="Complex"===s,h=p?c(0):m?x(0):0;p&&(i=c(i));for(let s=0;s<n-2;s++){let c=0,p=h;for(let t=s+1;t<n;t++){const r=e[t][s];v(u(p),u(r))&&(p=r,c=t)}if(!v(u(p),i)){if(c!==s+1){const t=e[c];e[c]=e[s+1],e[s+1]=t;for(let t=0;t<n;t++){const r=e[t][c];e[t][c]=e[t][s+1],e[t][s+1]=r}if(l){const e=f[c];f[c]=f[s+1],f[s+1]=e}}for(let i=s+2;i<n;i++){const u=a(e[i][s],p);if(0!==u){for(let t=0;t<n;t++)e[i][t]=r(e[i][t],o(u,e[s+1][t]));for(let r=0;r<n;r++)e[r][s+1]=t(e[r][s+1],o(u,e[r][i]));if(l)for(let e=0;e<n;e++)f[i][e]=r(f[i][e],o(u,f[s+1][e]))}}}}}(e,s,f,p,d,w);const{values:N,C:T}=function(e,n,o,a,s){const f="BigNumber"===a,p="Complex"===a,m=f?c(1):p?x(1):1;f&&(o=c(o));let d=ae(e);const g=[];let y=n;const b=[];let w=s?l(Array(n).fill(m)):void 0,N=s?l(Array(y).fill(m)):void 0,M=0;for(;M<=100;){M+=1;const e=d[y-1][y-1];for(let t=0;t<y;t++)d[t][t]=r(d[t][t],e);const{Q:c,R:f}=h(d);d=i(f,c);for(let r=0;r<y;r++)d[r][r]=t(d[r][r],e);if(s&&(N=i(N,c)),1===y||v(u(d[y-1][y-2]),o)){M=0,g.push(d[y-1][y-1]),s&&(b.unshift([[1]]),S(N,n),w=i(w,N),y>1&&(N=l(Array(y-1).fill(m)))),y-=1,d.pop();for(let e=0;e<y;e++)d[e].pop()}else if(2===y||v(u(d[y-2][y-3]),o)){M=0;const e=E(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1]);g.push(...e),s&&(b.unshift(A(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1],e[0],e[1],o,a)),S(N,n),w=i(w,N),y>2&&(N=l(Array(y-2).fill(m)))),y-=2,d.pop(),d.pop();for(let e=0;e<y;e++)d[e].pop(),d[e].pop()}if(0===y)break}if(g.sort(((e,t)=>+r(u(e),u(t)))),M>100){const e=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw e.values=g,e.vectors=[],e}const C=s?i(w,function(e,t){const r=[];for(let e=0;e<t;e++)r[e]=Array(t).fill(0);let n=0;for(const t of e){const e=t.length;for(let i=0;i<e;i++)for(let o=0;o<e;o++)r[n+i][n+o]=t[i][o];n+=e}return r}(b,n)):void 0;return{values:g,C}}(e,s,f,p,d);if(d){const t=function(e,t,o,a,s,u,f){const p=m(o),h=i(p,e,o),d="BigNumber"===f,b="Complex"===f,v=d?c(0):b?x(0):0,w=d?c(1):b?x(1):1,N=[],E=[];for(const e of s){const t=M(N,e,y);-1===t?(N.push(e),E.push(1)):E[t]+=1}const A=[],S=N.length,T=Array(t).fill(v),D=l(Array(t).fill(w));for(let e=0;e<S;e++){const s=N[e],c=r(h,i(s,D));let l=g(c,T);for(l.shift();l.length<E[e];){const e=C(c,t,l,u,f);if(null===e)break;l.push(e)}const p=i(m(a),o);l=l.map((e=>i(p,e))),A.push(...l.map((e=>({value:s,vector:n(e)}))))}return A}(e,s,T,w,N,f,p);return{values:N,eigenvectors:t}}return{values:N}}}({config:t,addScalar:i,subtract:o,multiply:y,multiplyScalar:f,flatten:E,divideScalar:p,sqrt:M,abs:s,bignumber:h,diag:C,size:T,reshape:D,qr:F,inv:m,usolve:O,usolveAll:B,equal:a,complex:S,larger:w,smaller:I,matrixFromColumns:k,dot:R});return r("eigs",{Array:function(e){return j(n(e))},"Array, number|BigNumber":function(e,t){return j(n(e),{precision:t})},"Array, Object":(e,t)=>j(n(e),t),Matrix:function(e){return j(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return j(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){const r={matricize:!0};return en(r,t),j(e,r)}});function j(e){var r;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=!("eigenvectors"in i)||i.eigenvectors,u=function(e,t,r){const n=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw new RangeError(`Matrix must be square (size: ${an(i)})`);const a=i[0];if(function(e,t,r){for(let n=0;n<t;n++)for(let i=0;i<t;i++)if(w(h(s(_(e[n][i]))),r))return!1;return!0}(n,a,t)&&(function(e,t){for(let r=0;r<t;r++)for(let n=0;n<t;n++)e[r][n]=z(e[r][n])}(n,a),function(e,t,r){for(let n=0;n<t;n++)for(let i=n;i<t;i++)if(w(h(s(o(e[n][i],e[i][n]))),r))return!1;return!0}(n,a,t))){const i=U(e,n,a);return q(n,a,t,i,r)}const u=U(e,n,a);return P(n,a,t,u,r)}(e,null!==(r=i.precision)&&void 0!==r?r:t.relTol,a);return i.matricize&&(u.values=n(u.values),a&&(u.eigenvectors=u.eigenvectors.map((e=>{let{value:t,vector:r}=e;return{value:t,vector:n(r)}})))),a&&Object.defineProperty(u,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),u}function U(e,t,r){const n=e.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;let i=!1,o=!1,a=!1;for(let e=0;e<r;e++)for(let n=0;n<r;n++){const r=t[e][n];if(d(r)||b(r))i=!0;else if(g(r))o=!0;else{if(!x(r))throw TypeError("Unsupported type in Matrix: "+oe(r));a=!0}}if(o&&a&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),a){for(let e=0;e<r;e++)for(let n=0;n<r;n++)t[e][n]=S(t[e][n]);return"Complex"}if(o){for(let e=0;e<r;e++)for(let n=0;n<r;n++)t[e][n]=h(t[e][n]);return"BigNumber"}if(i){for(let e=0;e<r;e++)for(let n=0;n<r;n++)t[e][n]=A(t[e][n]);return"number"}throw TypeError("Matrix contains unsupported types only.")}})),Jm="expm",Xm=he(Jm,["typed","abs","add","identity","inv","multiply"],(e=>{let{typed:t,abs:r,add:n,identity:i,inv:o,multiply:a}=e;return t(Jm,{Matrix:function(e){const t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+an(t)+")");const u=t[0],c=function(e){const t=e.size()[0];let n=0;for(let i=0;i<t;i++){let o=0;for(let n=0;n<t;n++)o+=r(e.get([i,n]));n=Math.max(o,n)}return n}(e),l=function(e){for(let t=0;t<30;t++)for(let r=0;r<=t;r++){const n=t-r;if(s(e,r,n)<1e-15)return{q:r,j:n}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(c),f=l.q,p=l.j,m=a(e,Math.pow(2,-p));let h=i(u),d=i(u),g=1,y=m,x=-1;for(let e=1;e<=f;e++)e>1&&(y=a(y,m),x=-x),g=g*(f-e+1)/((2*f-e+1)*e),h=n(h,a(g,y)),d=n(d,a(g*x,y));let b=a(o(d),h);for(let e=0;e<p;e++)b=a(b,b);return M(e)?e.createSparseMatrix(b):b}});function s(e,t,r){let n=1;for(let e=2;e<=t;e++)n*=e;let i=n;for(let e=t+1;e<=2*t;e++)i*=e;const o=i*(2*t+1);return 8*Math.pow(e/Math.pow(2,r),2*t)*n*n/(i*o)}})),Qm="sqrtm",Km=he(Qm,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],(e=>{let{typed:t,abs:r,add:n,multiply:i,map:o,sqrt:a,subtract:s,inv:u,size:c,max:l,identity:f}=e;const p=1e-6;function m(e){let t,o=0,a=e,m=f(c(e));do{const e=a;if(a=i(.5,n(e,u(m))),m=i(.5,n(m,u(e))),t=l(r(s(a,e))),t>p&&++o>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>p);return a}return t(Qm,{"Array | Matrix":function(e){const t=E(e)?e.size():hn(e);switch(t.length){case 1:if(1===t[0])return o(e,a);throw new RangeError("Matrix must be square (size: "+an(t)+")");case 2:if(t[0]===t[1])return m(e);throw new RangeError("Matrix must be square (size: "+an(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+an(t)+")")}}})})),eh="sylvester",th=he(eh,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(e=>{let{typed:t,schur:r,matrixFromColumns:n,matrix:i,multiply:o,range:a,concat:s,transpose:u,index:c,subset:l,add:f,subtract:p,identity:m,lusolve:h,abs:d}=e;return t(eh,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,t,r){return g(i(e),t,r)},"Array, Array, Matrix":function(e,t,r){return g(i(e),i(t),r)},"Array, Matrix, Array":function(e,t,r){return g(i(e),t,i(r))},"Matrix, Array, Matrix":function(e,t,r){return g(e,i(t),r)},"Matrix, Array, Array":function(e,t,r){return g(e,i(t),i(r))},"Matrix, Matrix, Array":function(e,t,r){return g(e,t,i(r))},"Array, Array, Array":function(e,t,r){return g(i(e),i(t),i(r)).toArray()}});function g(e,t,g){const y=t.size()[0],x=e.size()[0],b=r(e),v=b.T,w=b.U,N=r(o(-1,t)),E=N.T,A=N.U,S=o(o(u(w),g),A),M=a(0,x),C=[],T=(e,t)=>s(e,t,1),D=(e,t)=>s(e,t,0);for(let e=0;e<y;e++)if(e<y-1&&d(l(E,c(e+1,e)))>1e-5){let t=D(l(S,c(M,e)),l(S,c(M,e+1)));for(let r=0;r<e;r++)t=f(t,D(o(C[r],l(E,c(r,e))),o(C[r],l(E,c(r,e+1)))));const r=o(m(x),o(-1,l(E,c(e,e)))),n=o(m(x),o(-1,l(E,c(e+1,e)))),i=o(m(x),o(-1,l(E,c(e,e+1)))),s=o(m(x),o(-1,l(E,c(e+1,e+1)))),u=D(T(f(v,r),n),T(i,f(v,s))),p=h(u,t);C[e]=p.subset(c(a(0,x),0)),C[e+1]=p.subset(c(a(x,2*x),0)),e++}else{let t=l(S,c(M,e));for(let r=0;r<e;r++)t=f(t,o(C[r],l(E,c(r,e))));const r=l(E,c(e,e)),n=p(v,o(r,m(x)));C[e]=h(n,t)}const F=i(n(...C));return o(w,o(F,u(A)))}})),rh="schur",nh=he(rh,["typed","matrix","identity","multiply","qr","norm","subtract"],(e=>{let{typed:t,matrix:r,identity:n,multiply:i,qr:o,norm:a,subtract:s}=e;return t(rh,{Array:function(e){const t=u(r(e));return{U:t.U.valueOf(),T:t.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){const t=e.size()[0];let r,u=e,c=n(t),l=0;do{r=u;const e=o(u),t=e.Q,n=e.R;if(u=i(n,t),c=i(c,t),l++>100)break}while(a(s(u,r))>1e-4);return{U:c,T:u}}})),ih="lyap",oh=he(ih,["typed","matrix","sylvester","multiply","transpose"],(e=>{let{typed:t,matrix:r,sylvester:n,multiply:i,transpose:o}=e;return t(ih,{"Matrix, Matrix":function(e,t){return n(e,o(e),i(-1,t))},"Array, Matrix":function(e,t){return n(r(e),o(r(e)),i(-1,t))},"Matrix, Array":function(e,t){return n(e,o(r(e)),r(i(-1,t)))},"Array, Array":function(e,t){return n(r(e),o(r(e)),r(i(-1,t))).toArray()}})})),ah=he("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(e=>{let{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:o,inv:a}=e;const s=To({typed:t,equalScalar:i}),u=Fo({typed:t});return t("divide",se({"Array | Matrix, Array | Matrix":function(e,t){return n(e,a(t))},"DenseMatrix, any":function(e,t){return u(e,t,o,!1)},"SparseMatrix, any":function(e,t){return s(e,t,o,!1)},"Array, any":function(e,t){return u(r(e),t,o,!1).valueOf()},"any, Array | Matrix":function(e,t){return n(e,a(t))}},o.signatures))})),sh="distance",uh=he(sh,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(e=>{let{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:o,deepEqual:a,sqrt:s,abs:u}=e;return t(sh,{"Array, Array, Array":function(e,t,r){if(2===e.length&&2===t.length&&2===r.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!l(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(a(t,r))throw new TypeError("LinePoint1 should not be same with LinePoint2");const o=n(r[1],t[1]),s=n(t[0],r[0]),u=n(i(r[0],t[1]),i(t[0],r[1]));return d(e[0],e[1],o,s,u)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,r){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(r).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!l(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(a(h(t),h(r)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in r&&"lineTwoPtY"in r){const o=n(r.lineTwoPtY,t.lineOnePtY),a=n(t.lineOnePtX,r.lineTwoPtX),s=n(i(r.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,r.lineTwoPtY));return d(e.pointX,e.pointY,o,a,s)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return d(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!f(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(e.length===t.length&&e.length>0){if(!p(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return x(e,t)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,t){if(2===Object.keys(e).length&&3===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in t&&"yCoeffLine"in t&&"constant"in t)return d(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return y(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in t&&"pointTwoY"in t)return x([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in t&&"pointTwoY"in t&&"pointTwoZ"in t)return x([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&c(e[0][0])&&c(e[0][1])){if(e.some((e=>2!==e.length||!c(e[0])||!c(e[1]))))return!1}else{if(!(3===e[0].length&&c(e[0][0])&&c(e[0][1])&&c(e[0][2])))return!1;if(e.some((e=>3!==e.length||!c(e[0])||!c(e[1])||!c(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){const t=[];let r=[],n=[];for(let i=0;i<e.length-1;i++)for(let o=i+1;o<e.length;o++)2===e[0].length?(r=[e[i][0],e[i][1]],n=[e[o][0],e[o][1]]):3===e[0].length&&(r=[e[i][0],e[i][1],e[i][2]],n=[e[o][0],e[o][1],e[o][2]]),t.push(x(r,n));return t}(e)}});function c(e){return"number"==typeof e||g(e)}function l(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])}function f(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])}function p(e){return Array.isArray(e)||(e=h(e)),e.every(c)}function m(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])&&c(e[3])&&c(e[4])&&c(e[5])}function h(e){const t=Object.keys(e),r=[];for(let n=0;n<t.length;n++)r.push(e[t[n]]);return r}function d(e,t,n,a,c){const l=u(r(r(i(n,e),i(a,t)),c)),f=s(r(i(n,n),i(a,a)));return o(l,f)}function y(e,t,a,u,c,l,f,p,m){let h=[n(i(n(c,t),m),i(n(l,a),p)),n(i(n(l,a),f),i(n(u,e),m)),n(i(n(u,e),p),i(n(c,t),f))];h=s(r(r(i(h[0],h[0]),i(h[1],h[1])),i(h[2],h[2])));const d=s(r(r(i(f,f),i(p,p)),i(m,m)));return o(h,d)}function x(e,t){const o=e.length;let a=0,u=0;for(let s=0;s<o;s++)u=n(e[s],t[s]),a=r(i(u,u),a);return s(a)}})),ch=he("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],(e=>{let{typed:t,config:r,abs:n,add:i,addScalar:o,matrix:a,multiply:s,multiplyScalar:u,divideScalar:c,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=e;return t("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(e,t,r){const n=g(e.valueOf(),t.valueOf(),r.valueOf());return null===n?null:a(n)},"Matrix, Matrix, Matrix, Matrix":function(e,t,r,n){const i=y(e.valueOf(),t.valueOf(),r.valueOf(),n.valueOf());return null===i?null:a(i)}});function g(e,t,r){if(e=x(e),t=x(t),r=x(r),!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&d(e[0])&&d(e[1])&&d(e[2])&&d(e[3])}(r))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,r,n,i,a,s,f,p,m){const h=u(e,s),d=u(n,s),g=u(t,f),y=u(i,f),x=u(r,p),b=u(a,p),v=l(l(l(m,h),g),x),w=l(l(l(o(o(d,y),b),h),g),x),N=c(v,w);return[o(e,u(N,l(n,e))),o(t,u(N,l(i,t))),o(r,u(N,l(a,r)))]}(e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2],r[3])}function y(e,t,a,m){if(e=x(e),t=x(t),a=x(a),m=x(m),2===e.length){if(!b(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(a))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,a,p){const m=e,d=a,g=l(m,t),y=l(d,p),x=l(u(g[0],y[1]),u(y[0],g[1]));if(h(x))return null;if(f(n(x),r.relTol))return null;const b=u(y[0],m[1]),v=u(y[1],m[0]),w=u(y[0],d[1]),N=u(y[1],d[0]),E=c(o(l(l(b,v),w),N),x);return i(s(g,E),m)}(e,t,a,m)}if(3===e.length){if(!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!v(a))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!v(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,r,n,i,a,s,f,m,d,g,y){const x=w(e,s,d,s,t,f,g,f,r,m,y,m),b=w(d,s,n,e,g,f,i,t,y,m,a,r),v=w(e,s,n,e,t,f,i,t,r,m,a,r),N=w(d,s,d,s,g,f,g,f,y,m,y,m),E=w(n,e,n,e,i,t,i,t,a,r,a,r),A=l(u(x,b),u(v,N)),S=l(u(E,N),u(b,b));if(h(S))return null;const M=c(A,S),C=c(o(x,u(M,b)),N),T=o(e,u(M,l(n,e))),D=o(t,u(M,l(i,t))),F=o(r,u(M,l(a,r))),O=o(s,u(C,l(d,s))),B=o(f,u(C,l(g,f))),_=o(m,u(C,l(y,m)));return p(T,O)&&p(D,B)&&p(F,_)?[T,D,F]:null}(e[0],e[1],e[2],t[0],t[1],t[2],a[0],a[1],a[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function x(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every((e=>Array.isArray(e)&&1===e.length))?m(e):e}function b(e){return 2===e.length&&d(e[0])&&d(e[1])}function v(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,t,r,n,i,a,s,c,f,p,m,h){const d=u(l(e,t),l(r,n)),g=u(l(i,a),l(s,c)),y=u(l(f,p),l(m,h));return o(o(d,g),y)}})),lh=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:r,add:n,numeric:i}=e;return t("sum",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){try{return Kn(e,t,n)}catch(e){throw Iu(e,"sum")}},"...":function(e){if(Jn(e))throw new TypeError("Scalar values expected in function sum");return o(e)}});function o(e){let t;return Xn(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Iu(t,"sum",e)}})),void 0===t&&(t=i(0,r.number)),"string"==typeof t&&(t=i(t,xe(t,r))),t}})),fh="cumsum",ph=he(fh,["typed","add","unaryPlus"],(e=>{let{typed:t,add:r,unaryPlus:n}=e;return t(fh,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":a,"Matrix, number | BigNumber":function(e,t){return e.create(a(e.valueOf(),t),e.datatype())},"...":function(e){if(Jn(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return o(e)}catch(e){throw Iu(e,fh)}}function o(e){if(0===e.length)return[];const t=[n(e[0])];for(let n=1;n<e.length;++n)t.push(r(t[n-1],e[n]));return t}function a(e,t){const r=hn(e);if(t<0||t>=r.length)throw new mn(t,r.length);try{return s(e,t)}catch(e){throw Iu(e,fh)}}function s(e,t){let r,n,i;if(t<=0){const a=e[0][0];if(Array.isArray(a)){for(i=Yn(e),n=[],r=0;r<i.length;r++)n[r]=s(i[r],t-1);return n}return o(e)}for(n=[],r=0;r<e.length;r++)n[r]=s(e[r],t-1);return n}})),mh="mean",hh=he(mh,["typed","add","divide"],(e=>{let{typed:t,add:r,divide:n}=e;return t(mh,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){try{const i=Kn(e,t,r),o=Array.isArray(e)?hn(e):e.size();return n(i,o[t])}catch(e){throw Iu(e,"mean")}},"...":function(e){if(Jn(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){let t,i=0;if(Xn(e,(function(e){try{t=void 0===t?e:r(t,e),i++}catch(t){throw Iu(t,"mean",e)}})),0===i)throw new Error("Cannot calculate the mean of an empty array");return n(t,i)}})),dh="median",gh=he(dh,["typed","add","divide","compare","partitionSelect"],(e=>{let{typed:t,add:r,divide:n,compare:i,partitionSelect:o}=e;function a(e){try{const t=(e=Dn(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){const r=t/2-1,n=o(e,r+1);let a=e[r];for(let t=0;t<r;++t)i(e[t],a)>0&&(a=e[t]);return u(a,n)}{const r=o(e,(t-1)/2);return s(r)}}catch(e){throw Iu(e,"median")}}const s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),u=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return n(r(e,t),2)}});return t(dh,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(Jn(e))throw new TypeError("Scalar values expected in function median");return a(e)}})})),yh=he("mad",["typed","abs","map","median","subtract"],(e=>{let{typed:t,abs:r,map:n,median:i,subtract:o}=e;return t("mad",{"Array | Matrix":a,"...":function(e){return a(e)}});function a(e){if(0===(e=Dn(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{const t=i(e);return i(n(e,(function(e){return r(o(e,t))})))}catch(e){throw e instanceof TypeError&&e.message.includes("median")?new TypeError(e.message.replace("median","mad")):Iu(e,"mad")}}})),xh="unbiased",bh="variance",vh=he(bh,["typed","add","subtract","multiply","divide","apply","isNaN"],(e=>{let{typed:t,add:r,subtract:n,multiply:i,divide:o,apply:a,isNaN:s}=e;return t(bh,{"Array | Matrix":function(e){return u(e,xh)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(e,t){return c(e,t,xh)},"Array | Matrix, number | BigNumber, string":c,"...":function(e){return u(e,xh)}});function u(e,t){let a,u=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(Xn(e,(function(e){try{a=void 0===a?e:r(a,e),u++}catch(t){throw Iu(t,"variance",e)}})),0===u)throw new Error("Cannot calculate variance of an empty array");const c=o(a,u);if(a=void 0,Xn(e,(function(e){const t=n(e,c);a=void 0===a?i(t,t):r(a,i(t,t))})),s(a))return a;switch(t){case"uncorrected":return o(a,u);case"biased":return o(a,u+1);case"unbiased":{const e=g(a)?a.mul(0):0;return 1===u?e:o(a,u-1)}default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function c(e,t,r){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return a(e,t,(e=>u(e,r)))}catch(e){throw Iu(e,"variance")}}})),wh="quantileSeq",Nh=he(wh,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],(e=>{let{typed:t,bignumber:r,add:n,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p}=e;const m=vo({typed:t,isInteger:c});return t(wh,{"Array | Matrix, number | BigNumber":(e,t)=>g(e,t,!1),"Array | Matrix, number | BigNumber, number":(e,t,r)=>h(e,t,!1,r,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(e,t,r,n)=>h(e,t,r,n,g),"Array | Matrix, Array | Matrix":(e,t)=>y(e,t,!1),"Array | Matrix, Array | Matrix, number":(e,t,r)=>h(e,t,!1,r,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(e,t,r,n)=>h(e,t,r,n,y)});function h(e,t,r,n,i){return m(e,n,(e=>i(e,t,r)))}function g(e,t,i){let a;const s=e.valueOf();if(l(t,0))throw new Error("N/prob must be non-negative");if(f(t,1))return d(t)?x(s,t,i):r(x(s,t,i));if(p(t,1)){if(!c(t))throw new Error("N must be a positive integer");if(p(t,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");const e=n(t,1);a=[];for(let r=0;l(r,t);r++){const t=o(r+1,e);a.push(x(s,t,i))}return d(t)?a:r(a)}}function y(e,t,r){const n=e.valueOf(),i=t.valueOf(),o=[];for(let e=0;e<i.length;++e)o.push(x(n,i[e],r));return o}function x(e,t,r){const o=Dn(e),l=o.length;if(0===l)throw new Error("Cannot calculate quantile of an empty sequence");const f=d(t)?t*(l-1):t.times(l-1),p=d(t)?Math.floor(f):f.floor().toNumber(),m=d(t)?f%1:f.minus(p);if(c(f))return r?o[f]:s(o,d(t)?f:f.valueOf());let h,g;if(r)h=o[p],g=o[p+1];else{g=s(o,p+1),h=o[p];for(let e=0;e<p;++e)u(o[e],h)>0&&(h=o[e])}return n(a(h,i(1,m)),a(g,m))}})),Eh=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:r,sqrt:n,variance:i}=e;return t("std",{"Array | Matrix":o,"Array | Matrix, string":o,"Array | Matrix, number | BigNumber":o,"Array | Matrix, number | BigNumber, string":o,"...":function(e){return o(e)}});function o(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{const e=i.apply(null,arguments);return A(e)?r(e,n):n(e)}catch(e){throw e instanceof TypeError&&e.message.includes(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),Ah="corr",Sh=he(Ah,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],(e=>{let{typed:t,matrix:r,sqrt:n,sum:i,add:o,subtract:a,multiply:s,pow:u,divide:c}=e;return t(Ah,{"Array, Array":function(e,t){return l(e,t)},"Matrix, Matrix":function(e,t){const n=l(e.toArray(),t.toArray());return Array.isArray(n)?r(n):n}});function l(e,t){const r=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(let n=0;n<e.length;n++){if(e[n].length!==t[n].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");r.push(f(e[n],t[n]))}return r}if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(e,t)}function f(e,t){const r=e.length,l=i(e),f=i(t),p=e.reduce(((e,r,n)=>o(e,s(r,t[n]))),0),m=i(e.map((e=>u(e,2)))),h=i(t.map((e=>u(e,2)))),d=a(s(r,p),s(l,f)),g=n(s(a(s(r,m),u(l,2)),a(s(r,h),u(f,2))));return c(d,g)}}));function Mh(e,t){if(t<e)return 1;if(t===e)return t;const r=t+e>>1;return Mh(e,r)*Mh(r+1,t)}function Ch(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");const r=e-t;let n=1,i=2;const o=t<r?t:r;for(let a=t<r?r+1:t+1;a<=e;++a)for(n*=a;i<=o&&n%i==0;)n/=i,++i;return i<=o&&(n/=Mh(i,o)),n}Ch.signature="number, number";const Th="combinations",Dh=he(Th,["typed"],(e=>{let{typed:t}=e;return t(Th,{"number, number":Ch,"BigNumber, BigNumber":function(e,t){const r=e.constructor;let n,i;const o=e.minus(t),a=new r(1);if(!Fh(e)||!Fh(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(e))throw new TypeError("k must be less than n in function combinations");if(n=a,t.lt(o))for(i=a;i.lte(o);i=i.plus(a))n=n.times(t.plus(i)).dividedBy(i);else for(i=a;i.lte(t);i=i.plus(a))n=n.times(o.plus(i)).dividedBy(i);return n}})}));function Fh(e){return e.isInteger()&&e.gte(0)}const Oh="combinationsWithRep",Bh=he(Oh,["typed"],(e=>{let{typed:t}=e;return t(Oh,{"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return t<e-1?Mh(e,e+t-1)/Mh(1,t):Mh(t+1,e+t-1)/Mh(1,e-1)},"BigNumber, BigNumber":function(e,t){let r,n;const i=new(0,e.constructor)(1),o=e.minus(i);if(!_h(e)||!_h(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(r=i,t.lt(o))for(n=i;n.lte(o);n=n.plus(i))r=r.times(t.plus(n)).dividedBy(n);else for(n=i;n.lte(t);n=n.plus(i))r=r.times(o.plus(n)).dividedBy(n);return r}})}));function _h(e){return e.isInteger()&&e.gte(0)}function zh(e){let t;if(ye(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:Mh(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*zh(1-e));if(e>=171.35)return 1/0;if(e>85){const t=e*e,r=t*e,n=r*e,i=n*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*r)-571/(2488320*n)+163879/(209018880*i)+5246819/(75246796800*i*e))}--e,t=kh[0];for(let r=1;r<kh.length;++r)t+=kh[r]/(e+r);const r=e+Ih+.5;return Math.sqrt(2*Math.PI)*Math.pow(r,e+.5)*Math.exp(-r)*t}zh.signature="number";const Ih=4.7421875,kh=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],Rh=.9189385332046728,qh=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Ph(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))-Ph(1-e);const t=5+(e-=1)+.5;let r=qh[0];for(let t=6;t>=1;t--)r+=qh[t]/(e+t);return Rh+(e+.5)*Math.log(t)-t+Math.log(r)}Ph.signature="number";const jh="gamma",Uh=he(jh,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(e=>{let{typed:t,config:r,multiplyScalar:n,pow:i,BigNumber:o,Complex:a}=e;return t(jh,{number:zh,Complex:function e(t){if(0===t.im)return zh(t.re);if(t.re<.5){const r=new a(1-t.re,-t.im),n=new a(Math.PI*t.re,Math.PI*t.im);return new a(Math.PI).div(n.sin()).div(e(r))}t=new a(t.re-1,t.im);let r=new a(kh[0],0);for(let e=1;e<kh.length;++e){const n=new a(kh[e],0);r=r.add(n.div(t.add(e)))}const n=new a(t.re+Ih+.5,t.im),i=Math.sqrt(2*Math.PI),o=n.pow(t.add(.5)),s=n.neg().exp();return r.mul(i).mul(o).mul(s)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new o(1/0):s(e.minus(1));if(!e.isFinite())return new o(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(e){if(e<8)return new o([1,1,2,6,24,120,720,5040][e]);const t=r.precision+(0|Math.log(e.toNumber())),n=o.clone({precision:t});if(e%2==1)return e.times(s(new o(e-1)));let i=e,a=new n(e),u=e.toNumber();for(;i>2;)i-=2,u+=i,a=a.times(u);return new o(a.toPrecision(o.precision))}})),Lh="lgamma",$h=he(Lh,["Complex","typed"],(e=>{let{Complex:t,typed:r}=e;const n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(Lh,{number:Ph,Complex:function e(r){if(r.isNaN())return new t(NaN,NaN);if(0===r.im)return new t(Ph(r.re),0);if(r.re>=7||Math.abs(r.im)>=7)return i(r);if(r.re<=.1){const i=(n=6.283185307179586,(!0^((a=r.im)>0||!(a<0)&&1/a==1/0)?-n:n)*Math.floor(.5*r.re+.25)),o=r.mul(Math.PI).sin().log(),s=e(new t(1-r.re,-r.im));return new t(1.1447298858494002,i).sub(o).sub(s)}return r.im>=0?o(r):o(r.conjugate()).conjugate();var n,a},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){const r=e.sub(.5).mul(e.log()).sub(e).add(Rh),i=new t(1,0).div(e),o=i.div(e);let a=n[0],s=n[1];const u=2*o.re,c=o.re*o.re+o.im*o.im;for(let e=2;e<8;e++){const t=s;s=-c*a+n[e],a=u*a+t}const l=i.mul(o.mul(a).add(s));return r.add(l)}function o(e){let r=0,n=0,o=e;for(e=e.add(1);e.re<=7;){o=o.mul(e);const t=o.im<0?1:0;0!==t&&0===n&&r++,n=t,e=e.add(1)}return i(e).sub(o.log()).sub(new t(0,2*r*Math.PI*1))}})),Hh="factorial",Gh=he(Hh,["typed","gamma"],(e=>{let{typed:t,gamma:r}=e;return t(Hh,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":t.referToSelf((e=>t=>Qn(t,e)))})})),Vh="kldivergence",Wh=he(Vh,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(e=>{let{typed:t,matrix:r,divide:n,sum:i,multiply:o,map:a,dotDivide:s,log:u,isNumeric:c}=e;return t(Vh,{"Array, Array":function(e,t){return l(r(e),r(t))},"Matrix, Array":function(e,t){return l(e,r(t))},"Array, Matrix":function(e,t){return l(r(e),t)},"Matrix, Matrix":function(e,t){return l(e,t)}});function l(e,t){const r=t.size().length,l=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(l>1)throw new Error("second object must be one dimensional");if(r!==l)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(t))throw new Error("Sum of elements in second object must be non zero");const f=n(e,i(e)),p=n(t,i(t)),m=i(o(f,a(s(f,p),(e=>u(e)))));return c(m)?m:Number.NaN}})),Zh="multinomial",Yh=he(Zh,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(e=>{let{typed:t,add:r,divide:n,multiply:i,factorial:o,isInteger:a,isPositive:s}=e;return t(Zh,{"Array | Matrix":function(e){let t=0,u=1;return Xn(e,(function(e){if(!a(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=r(t,e),u=i(u,o(e))})),n(o(t),u)}})})),Jh="permutations",Xh=he(Jh,["typed","factorial"],(e=>{let{typed:t,factorial:r}=e;return t(Jh,{"number | BigNumber":r,"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");return Mh(e-t+1,e)},"BigNumber, BigNumber":function(e,t){let r,n;if(!Qh(e)||!Qh(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})}));function Qh(e){return e.isInteger()&&e.gte(0)}var Kh=r(7391);const ed=Kh(Date.now());function td(e){let t;var r;return t=null===(r=e)?ed:Kh(String(r)),function(){return t()}}const rd="pickRandom",nd=he(rd,["typed","config","?on"],(e=>{let{typed:t,config:r,on:n}=e,i=td(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=td(e.randomSeed))})),t(rd,{"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,t){return o(e,t)},"Array | Matrix, number":function(e,t){return o(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return o(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,r){return o(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return o(e,{number:t,weights:r})}});function o(e,t){let{number:r,weights:n,elementWise:o=!0}=t;const a=void 0===r;a&&(r=1);const s=E(e)?e.create:E(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===o&&(e=Dn(e),n=Dn(n));let u=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(let e=0,t=n.length;e<t;e++){if(!d(n[e])||n[e]<0)throw new Error("Weights must be an array of positive numbers");u+=n[e]}}const c=e.length,l=[];let f;for(;l.length<r;){if(void 0===n)f=e[Math.floor(i()*c)];else{let t=i()*u;for(let r=0,i=e.length;r<i;r++)if(t-=n[r],t<0){f=e[r];break}}l.push(f)}return a?l[0]:s?s(l):l}}));function id(e,t){const r=[];if((e=e.slice(0)).length>1)for(let n=0,i=e.shift();n<i;n++)r.push(id(e,t));else for(let n=0,i=e.shift();n<i;n++)r.push(t());return r}const od="random",ad=he(od,["typed","config","?on"],(e=>{let{typed:t,config:r,on:n}=e,i=td(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=td(e.randomSeed))})),t(od,{"":()=>a(0,1),number:e=>a(0,e),"number, number":(e,t)=>a(e,t),"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,r)=>o(e,t,r)});function o(e,t,r){const n=id(e.valueOf(),(()=>a(t,r)));return E(e)?e.create(n,"number"):n}function a(e,t){return e+i()*(t-e)}})),sd="randomInt",ud=he(sd,["typed","config","?on"],(e=>{let{typed:t,config:r,on:n}=e,i=td(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=td(e.randomSeed))})),t(sd,{"":()=>a(0,1),number:e=>a(0,e),"number, number":(e,t)=>a(e,t),"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,r)=>o(e,t,r)});function o(e,t,r){const n=id(e.valueOf(),(()=>a(t,r)));return E(e)?e.create(n,"number"):n}function a(e,t){return Math.floor(e+i()*(t-e))}})),cd="stirlingS2",ld=he(cd,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],(e=>{let{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:o,pow:a,factorial:s,combinations:u,isNegative:c,isInteger:l,number:f,bignumber:p,larger:m}=e;const h=[],g=[];return t(cd,{"number | BigNumber, number | BigNumber":function(e,t){if(!l(e)||c(e)||!l(t)||c(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");const n=!(d(e)&&d(t)),o=n?g:h,a=n?p:f,s=f(e),u=f(t);if(o[s]&&o[s].length>u)return o[s][u];for(let e=0;e<=s;++e){if(o[e]||(o[e]=[a(0===e?1:0)]),0===e)continue;const t=o[e],n=o[e-1];for(let o=t.length;o<=e&&o<=u;++o)t[o]=o===e?1:r(i(a(o),n[o]),n[o-1])}return o[s][u]}})})),fd="bellNumbers",pd=he(fd,["typed","addScalar","isNegative","isInteger","stirlingS2"],(e=>{let{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:o}=e;return t(fd,{"number | BigNumber":function(e){if(!i(e)||n(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");let t=0;for(let n=0;n<=e;n++)t=r(t,o(e,n));return t}})})),md="catalan",hd=he(md,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(e=>{let{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:o,isNegative:a,isInteger:s}=e;return t(md,{"number | BigNumber":function(e){if(!s(e)||a(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(o(i(e,2),e),r(e,1))}})})),dd="composition",gd=he(dd,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(e=>{let{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:o,isInteger:a,larger:s}=e;return t(dd,{"number | BigNumber, number | BigNumber":function(e,t){if(!(a(e)&&i(e)&&a(t)&&i(t)))throw new TypeError("Positive integer value expected in function composition");if(s(t,e))throw new TypeError("k must be less than or equal to n in function composition");return n(r(e,-1),r(t,-1))}})})),yd="leafCount",xd=he(yd,["parse","typed"],(e=>{let{parse:t,typed:r}=e;function n(e){let t=0;return e.forEach((e=>{t+=n(e)})),t||1}return r(yd,{Node:function(e){return n(e)}})}));function bd(e){return V(e)||K(e)&&e.isUnary()&&V(e.args[0])}function vd(e){return!!V(e)||!(!Y(e)&&!K(e)||!e.args.every(vd))||!(!ee(e)||!vd(e.content))}const wd=he("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],(e=>{let{FunctionNode:t,OperatorNode:r,SymbolNode:n}=e;const i=!0,o=!1,a="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:o,total:i,commutative:o,associative:o},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:o,total:i,commutative:o,associative:o},paren:{trivial:i,total:i,commutative:i,associative:o},defaultF:{trivial:o,total:i,commutative:o,associative:o}};function u(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,n=a;if("string"==typeof e?n=e:K(e)?n=e.fn.toString():Y(e)?n=e.name:ee(e)&&(n="paren"),me(r,n)){const e=r[n];if(me(e,t))return e[t];if(me(s,n))return s[n][t]}if(me(r,a)){const e=r[a];return me(e,t)?e[t]:s[a][t]}if(me(s,n)){const e=s[n];if(me(e,t))return e[t]}return s[a][t]}function c(e){return u(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)}function l(e,t){let r;const n=[],i=function(e){for(let t=0;t<e.args.length;t++){const o=e.args[t];K(o)&&r===o.op?i(o):n.push(o)}};return c(e,t)?(r=e.op,i(e),n):e.args}function f(e){return K(e)?function(t){try{return new r(e.op,e.fn,t,e.implicit)}catch(e){return console.error(e),[]}}:function(r){return new t(new n(e.name),r)}}return{createMakeNodeFunction:f,hasProperty:u,isCommutative:function(e){return u(e,"commutative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)},isAssociative:c,mergeContext:function(e,t){const r={...e};for(const n in t)me(e,n)?r[n]={...t[n],...e[n]}:r[n]=t[n];return r},flatten:function e(t,r){if(!t.args||0===t.args.length)return t;t.args=l(t,r);for(let n=0;n<t.args.length;n++)e(t.args[n],r)},allChildren:l,unflattenr:function e(t,r){if(!t.args||0===t.args.length)return;const n=f(t),i=t.args.length;for(let n=0;n<i;n++)e(t.args[n],r);if(i>2&&c(t,r)){let e=t.args.pop();for(;t.args.length>0;)e=n([t.args.pop(),e]);t.args=e.args}},unflattenl:function e(t,r){if(!t.args||0===t.args.length)return;const n=f(t),i=t.args.length;for(let n=0;n<i;n++)e(t.args[n],r);if(i>2&&c(t,r)){let e=t.args.shift();for(;t.args.length>0;)e=n([e,t.args.shift()]);t.args=e.args}},defaultContext:s,realContext:{divide:{total:o},log:{total:o}},positiveContext:{subtract:{total:o},abs:{trivial:i},log:{total:i}}}})),Nd=he("simplify",["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,parse:r,equal:n,resolve:i,simplifyConstant:o,simplifyCore:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:d,ParenthesisNode:g,SymbolNode:y}=e;const{hasProperty:x,isCommutative:b,isAssociative:v,mergeContext:w,flatten:N,unflattenr:E,unflattenl:A,createMakeNodeFunction:S,defaultContext:M,realContext:C,positiveContext:T}=wd({FunctionNode:l,OperatorNode:d,SymbolNode:y});t.addConversion({from:"Object",to:"Map",convert:h});const D=t("simplify",{Node:I,"Node, Map":(e,t)=>I(e,!1,t),"Node, Map, Object":(e,t,r)=>I(e,!1,t,r),"Node, Array":I,"Node, Array, Map":I,"Node, Array, Map, Object":I});function F(e){return e.transform((function(e){return ee(e)?F(e.content):e}))}t.removeConversion({from:"Object",to:"Map",convert:h}),D.defaultContext=M,D.realContext=C,D.positiveContext=T;const O={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};function B(e,t){const n={};if(e.s){const t=e.s.split("->");if(2!==t.length)throw SyntaxError("Could not parse rule: "+e.s);n.l=t[0],n.r=t[1]}else n.l=e.l,n.r=e.r;n.l=F(r(n.l)),n.r=F(r(n.r));for(const t of["imposeContext","repeat","assuming"])t in e&&(n[t]=e[t]);if(e.evaluate&&(n.evaluate=r(e.evaluate)),v(n.l,t)){const e=!b(n.l,t);let r;e&&(r=z());const i=S(n.l),o=z();n.expanded={},n.expanded.l=i([n.l,o]),N(n.expanded.l,t),E(n.expanded.l,t),n.expanded.r=i([n.r,o]),e&&(n.expandedNC1={},n.expandedNC1.l=i([r,n.l]),n.expandedNC1.r=i([r,n.r]),n.expandedNC2={},n.expandedNC2.l=i([r,n.expanded.l]),n.expandedNC2.r=i([r,n.expanded.r]))}return n}D.rules=[a,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},o,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},o,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];let _=0;function z(){return new y("_p"+_++)}function I(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m(),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=n.consoleDebug;t=function(e,t){const r=[];for(let n=0;n<e.length;n++){let i,o=e[n];const a=typeof o;switch(a){case"string":o={s:o};case"object":i=B(o,t);break;case"function":i=o;break;default:throw TypeError("Unsupported type of rule: "+a)}r.push(i)}return r}(t||D.rules,n.context);let a=i(e,r);a=F(a);const s={};let u=a.toString({parenthesis:"all"});for(;!s[u];){s[u]=!0,_=0;let e=u;o&&console.log("Working on: ",u);for(let r=0;r<t.length;r++){let i="";if("function"==typeof t[r]?(a=t[r](a,n),o&&(i=t[r].name)):(N(a,n.context),a=R(a,t[r],n.context),o&&(i=`${t[r].l.toString()} -> ${t[r].r.toString()}`)),o){const t=a.toString({parenthesis:"all"});t!==e&&(console.log("Applying",i,"produced",t),e=t)}A(a,n.context)}u=a.toString({parenthesis:"all"})}return a}function k(e,t,r){let n=e;if(e)for(let i=0;i<e.length;++i){const o=R(e[i],t,r);o!==e[i]&&(n===e&&(n=e.slice()),n[i]=o)}return n}function R(e,t,r){if(t.assuming)for(const n in t.assuming)for(const i in t.assuming[n])if(x(n,i,r)!==t.assuming[n][i])return e;const n=w(t.imposeContext,r);let i=e;if(i instanceof d||i instanceof l){const e=k(i.args,t,r);e!==i.args&&(i=i.clone(),i.args=e)}else if(i instanceof g){if(i.content){const e=R(i.content,t,r);e!==i.content&&(i=new g(e))}}else if(i instanceof u){const e=k(i.items,t,r);e!==i.items&&(i=new u(e))}else if(i instanceof s){let e=i.object;i.object&&(e=R(i.object,t,r));let n=i.index;i.index&&(n=R(i.index,t,r)),e===i.object&&n===i.index||(i=new s(e,n))}else if(i instanceof f){const e=k(i.dimensions,t,r);e!==i.dimensions&&(i=new f(e))}else if(i instanceof p){let e=!1;const n={};for(const o in i.properties)n[o]=R(i.properties[o],t,r),n[o]!==i.properties[o]&&(e=!0);e&&(i=new p(n))}let o=t.r,a=j(t.l,i,n)[0];if(!a&&t.expanded&&(o=t.expanded.r,a=j(t.expanded.l,i,n)[0]),!a&&t.expandedNC1&&(o=t.expandedNC1.r,a=j(t.expandedNC1.l,i,n)[0],a||(o=t.expandedNC2.r,a=j(t.expandedNC2.l,i,n)[0])),a){const e=i.implicit;i=o.clone(),e&&"implicit"in o&&(i.implicit=!0),i=i.transform((function(e){return e.isSymbolNode&&me(a.placeholders,e.name)?a.placeholders[e.name].clone():e}))}return t.repeat&&i!==e&&(i=R(i,t,r)),i}function q(e,t){const r={placeholders:{}};if(!e.placeholders&&!t.placeholders)return r;if(!e.placeholders)return t;if(!t.placeholders)return e;for(const n in e.placeholders)if(me(e.placeholders,n)&&(r.placeholders[n]=e.placeholders[n],me(t.placeholders,n)&&!U(e.placeholders[n],t.placeholders[n])))return null;for(const e in t.placeholders)me(t.placeholders,e)&&(r.placeholders[e]=t.placeholders[e]);return r}function P(e,t){const r=[];if(0===e.length||0===t.length)return r;let n;for(let i=0;i<e.length;i++)for(let o=0;o<t.length;o++)n=q(e[i],t[o]),n&&r.push(n);return r}function j(e,t,r,i){let o=[{placeholders:{}}];if(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l){if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof l&&e.name!==t.name)return[];if(!(1===t.args.length&&1===e.args.length||!v(t,r)&&t.args.length===e.args.length||i)){if(t.args.length>=2&&2===e.args.length){const n=function(e,t){const r=[];let n,i;const o=S(e);if(b(e,t))for(let t=0;t<e.args.length;t++)i=e.args.slice(0),i.splice(t,1),n=1===i.length?i[0]:o(i),r.push(o([e.args[t],n]));else for(let t=1;t<e.args.length;t++){let a=e.args[0];t>1&&(a=o(e.args.slice(0,t))),i=e.args.slice(t),n=1===i.length?i[0]:o(i),r.push(o([a,n]))}return r}(t,r);let i=[];for(let t=0;t<n.length;t++){const o=j(e,n[t],r,!0);i=i.concat(o)}return i}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}{let n=[];for(let i=0;i<e.args.length;i++){const o=j(e.args[i],t.args[i],r);if(0===o.length)break;n.push(o)}if(n.length!==e.args.length){if(!b(t,r)||1===e.args.length)return[];if(e.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");const i=j(e.args[0],t.args[1],r);if(0===i.length)return[];const o=j(e.args[1],t.args[0],r);if(0===o.length)return[];n=[i,o]}o=function(e){if(0===e.length)return e;const t=e.reduce(P),r=[],n={};for(let e=0;e<t.length;e++){const i=JSON.stringify(t[e]);n[i]||(n[i]=!0,r.push(t[e]))}return r}(n)}}else if(e instanceof y){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(O[e.name]){if(e.name!==t.name)return[]}else switch(e.name[1]>="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":o[0].placeholders[e.name]=t;break;case"c":case"cl":if(!V(t))return[];o[0].placeholders[e.name]=t;break;case"v":if(V(t))return[];o[0].placeholders[e.name]=t;break;case"vl":if(!ne(t))return[];o[0].placeholders[e.name]=t;break;case"cd":if(!bd(t))return[];o[0].placeholders[e.name]=t;break;case"vd":if(bd(t))return[];o[0].placeholders[e.name]=t;break;case"ce":if(!vd(t))return[];o[0].placeholders[e.name]=t;break;case"ve":if(vd(t))return[];o[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof c))return[];if(!n(e.value,t.value))return[]}return o}function U(e,t){if(e instanceof c&&t instanceof c){if(!n(e.value,t.value))return!1}else if(e instanceof y&&t instanceof y){if(e.name!==t.name)return!1}else{if(!(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l))return!1;if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof l&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(let r=0;r<e.args.length;r++)if(!U(e.args[r],t.args[r]))return!1}return!0}return D})),Ed=he("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],(e=>{let{typed:t,config:r,mathWithTransform:n,matrix:i,fraction:o,bignumber:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=e;const{isCommutative:d,isAssociative:g,allChildren:y,createMakeNodeFunction:x}=wd({FunctionNode:l,OperatorNode:m,SymbolNode:h}),v=t("simplifyConstant",{Node:e=>S(F(e,{})),"Node, Object":function(e,t){return S(F(e,t))}});function w(e){return b(e)?e.valueOf():e instanceof Array?e.map(w):E(e)?i(w(e.valueOf())):e}function N(e,t,r){try{return n[e].apply(null,t)}catch(i){return t=t.map(w),C(n[e].apply(null,t),r)}}const A=t({Fraction:function(e){let t;const r=e.s*e.n;return t=r<0?new m("-","unaryMinus",[new c(-r)]):new c(r),1===e.d?t:new m("/","divide",[t,new c(e.d)])},number:function(e){return e<0?T(new c(-e)):new c(e)},BigNumber:function(e){return e<0?T(new c(-e)):new c(e)},bigint:function(e){return e<0n?T(new c(-e)):new c(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new c(e)},Matrix:function(e){return new u(e.valueOf().map((e=>A(e))))}});function S(e){return X(e)?e:A(e)}function M(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&o){const r=o(e),n=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(r.valueOf()===e&&r.n<n&&r.d<n)return r}return e}const C=t({"string, Object":function(e,t){const n=xe(e,r);return"BigNumber"===n?(void 0===a&&Vs(),a(e)):"bigint"===n?BigInt(e):"Fraction"===n?(void 0===o&&Ws(),o(e)):M(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return M(e,t)},"bigint, Object":function(e,t){return e},"Complex, Object":function(e,t){return 0!==e.im?e:M(e.re,t)},"Matrix, Object":function(e,t){return i(M(e.valueOf()))},"Array, Object":function(e,t){return e.map(M)}});function T(e){return new m("-","unaryMinus",[e])}function D(e,t,r,n){const i=t.shift(),o=t.reduce(((t,i)=>{if(!X(i)){const r=t.pop();if(X(r))return[r,i];try{return t.push(N(e,[r,i],n)),t}catch(e){t.push(r)}}t.push(S(t.pop()));const o=1===t.length?t[0]:r(t);return[r([o,S(i)])]}),[i]);return 1===o.length?o[0]:r([o[0],A(o[1])])}function F(e,t){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":case"bigint":return C(e.value,t);case"string":return e.value;default:if(!isNaN(e.value))return C(e.value,t)}return e;case"FunctionNode":if(n[e.name]&&n[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){const r=e.args.map((e=>F(e,t)));if(!r.some(X))try{return N(e.name,r,t)}catch(e){}if("size"===e.name&&1===r.length&&L(r[0])){const e=[];let t=r[0];for(;L(t);)e.push(t.items.length),t=t.items[0];return i(e)}return new l(e.name,r.map(S))}case"OperatorNode":{const r=e.fn.toString();let n,i;const o=x(e);if(K(e)&&e.isUnary())n=[F(e.args[0],t)],i=X(n[0])?o(n):N(r,n,t);else if(g(e,t.context))if(n=y(e,t.context),n=n.map((e=>F(e,t))),d(r,t.context)){const e=[],a=[];for(let t=0;t<n.length;t++)X(n[t])?a.push(n[t]):e.push(n[t]);e.length>1?(i=D(r,e,o,t),a.unshift(i),i=D(r,a,o,t)):i=D(r,n,o,t)}else i=D(r,n,o,t);else n=e.args.map((e=>F(e,t))),i=D(r,n,o,t);return i}case"ParenthesisNode":return F(e.content,t);case"AccessorNode":return function(e,t,r){if(!J(t))return new s(S(e),S(t));if(L(e)||E(e)){const n=Array.from(t.dimensions);for(;n.length>0;)if(V(n[0])&&"string"!=typeof n[0].value){const t=C(n.shift().value,r);L(e)?e=e.items[t-1]:(e=e.valueOf()[t-1])instanceof Array&&(e=i(e))}else{if(!(n.length>1&&V(n[1])&&"string"!=typeof n[1].value))break;{const t=C(n[1].value,r),o=[],a=L(e)?e.items:e.valueOf();for(const r of a)if(L(r))o.push(r.items[t-1]);else{if(!E(e))break;o.push(r[t-1])}if(o.length!==a.length)break;e=L(e)?new u(o):i(o),n.splice(1,1)}}return n.length===t.dimensions.length?new s(S(e),t):n.length>0?(t=new f(n),new s(S(e),t)):e}if(Q(e)&&1===t.dimensions.length&&V(t.dimensions[0])){const r=t.dimensions[0].value;return r in e.properties?e.properties[r]:new c}return new s(S(e),t)}(F(e.object,t),F(e.index,t),t);case"ArrayNode":{const r=e.items.map((e=>F(e,t)));return r.some(X)?new u(r.map(S)):i(r)}case"IndexNode":return new f(e.dimensions.map((e=>v(e,t))));case"ObjectNode":{const r={};for(const n in e.properties)r[n]=v(e.properties[n],t);return new p(r)}default:throw new Error(`Unimplemented node type in simplifyConstant: ${e.type}`)}}return v})),Ad="simplifyCore",Sd=he(Ad,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,parse:r,equal:n,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,AccessorNode:l,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:y,SymbolNode:x}=e;const b=new p(0),v=new p(1),w=new p(!0),N=new p(!1);function E(e){return K(e)&&["and","not","or"].includes(e.op)}const{hasProperty:A,isCommutative:S}=wd({FunctionNode:m,OperatorNode:g,SymbolNode:x});function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t?t.context:void 0;if(A(e,"trivial",r)){if(Y(e)&&1===e.args.length)return M(e.args[0],t);let r=!1,n=0;if(e.forEach((e=>{++n,1===n&&(r=M(e,t))})),1===n)return r}let o=e;if(Y(o)){const e=function(e){const t="OperatorNode:"+e;for(const e of Ep)if(t in e)return e[t].op;return null}(o.name);if(!e)return new m(M(o.fn),o.args.map((e=>M(e,t))));if(o.args.length>2&&A(o,"associative",r))for(;o.args.length>2;){const t=o.args.pop(),r=o.args.pop();o.args.push(new g(e,o.name,[t,r]))}o=new g(e,o.name,o.args)}if(K(o)&&o.isUnary()){const e=M(o.args[0],t);if("~"===o.op&&K(e)&&e.isUnary()&&"~"===e.op)return e.args[0];if("not"===o.op&&K(e)&&e.isUnary()&&"not"===e.op&&E(e.args[0]))return e.args[0];let r=!0;if("-"===o.op&&K(e)&&(e.isBinary()&&"subtract"===e.fn&&(o=new g("-","subtract",[e.args[1],e.args[0]]),r=!1),e.isUnary()&&"-"===e.op))return e.args[0];if(r)return new g(o.op,o.fn,[e])}if(K(o)&&o.isBinary()){const e=M(o.args[0],t);let a=M(o.args[1],t);if("+"===o.op){if(V(e)&&i(e.value))return a;if(V(a)&&i(a.value))return e;K(a)&&a.isUnary()&&"-"===a.op&&(a=a.args[0],o=new g("-","subtract",[e,a]))}if("-"===o.op)return K(a)&&a.isUnary()&&"-"===a.op?M(new g("+","add",[e,a.args[0]]),t):V(e)&&i(e.value)?M(new g("-","unaryMinus",[a])):V(a)&&i(a.value)?e:new g(o.op,o.fn,[e,a]);if("*"===o.op){if(V(e)){if(i(e.value))return b;if(n(e.value,1))return a}if(V(a)){if(i(a.value))return b;if(n(a.value,1))return e;if(S(o,r))return new g(o.op,o.fn,[a,e],o.implicit)}return new g(o.op,o.fn,[e,a],o.implicit)}if("/"===o.op)return V(e)&&i(e.value)?b:V(a)&&n(a.value,1)?e:new g(o.op,o.fn,[e,a]);if("^"===o.op&&V(a)){if(i(a.value))return v;if(n(a.value,1))return e}if("and"===o.op){if(V(e)){if(!e.value)return N;if(E(a))return a;if(V(a))return a.value?w:N}if(V(a)){if(!a.value)return N;if(E(e))return e}}if("or"===o.op){if(V(e)){if(e.value)return w;if(E(a))return a}if(V(a)){if(a.value)return w;if(E(e))return e}}return new g(o.op,o.fn,[e,a])}if(K(o))return new g(o.op,o.fn,o.args.map((e=>M(e,t))));if(L(o))return new f(o.items.map((e=>M(e,t))));if(U(o))return new l(M(o.object,t),M(o.index,t));if(J(o))return new h(o.dimensions.map((e=>M(e,t))));if(Q(o)){const e={};for(const r in o.properties)e[r]=M(o.properties[r],t);return new d(e)}return o}return t(Ad,{Node:M,"Node,Object":M})})),Md=he("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(e=>{let{typed:t,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:o,ParenthesisNode:a}=e;function s(e,t){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(ne(e)){if(u.has(e.name)){const e=Array.from(u).join(", ");throw new ReferenceError(`recursive loop of variable definitions among {${e}}`)}const i=t.get(e.name);if(X(i)){const r=new Set(u);return r.add(e.name),s(i,t,r)}return"number"==typeof i?r(String(i)):void 0!==i?new n(i):e}if(K(e)){const r=e.args.map((function(e){return s(e,t,u)}));return new o(e.op,e.fn,r,e.implicit)}if(ee(e))return new a(s(e.content,t,u));if(Y(e)){const r=e.args.map((function(e){return s(e,t,u)}));return new i(e.name,r)}return e.map((e=>s(e,t,u)))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,t)=>s(e,h(t)),"Array | Matrix":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array | Matrix, null | undefined":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array, Object":t.referTo("Array,Map",(e=>(t,r)=>e(t,h(r)))),"Matrix, Object":t.referTo("Matrix,Map",(e=>(t,r)=>e(t,h(r)))),"Array | Matrix, Map":t.referToSelf((e=>(t,r)=>t.map((t=>e(t,r)))))})})),Cd="symbolicEqual",Td=he(Cd,["parse","simplify","typed","OperatorNode"],(e=>{let{parse:t,simplify:r,typed:n,OperatorNode:i}=e;function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new i("-","subtract",[e,t]),a=r(o,{},n);return V(a)&&!a.value}return n(Cd,{"Node, Node":o,"Node, Node, Object":o})})),Dd="derivative",Fd=he(Dd,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,config:r,parse:n,simplify:i,equal:o,isZero:a,numeric:s,ConstantNode:u,FunctionNode:c,OperatorNode:l,ParenthesisNode:f,SymbolNode:p}=e;function m(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0};const n={};y(n,e,t.name);const o=x(e,n);return r.simplify?i(o):o}function h(e){const t=n(e);if(!t.isSymbolNode)throw new TypeError(`Invalid variable. Cannot parse ${JSON.stringify(e)} into a variable in function derivative`);return t}const d=t(Dd,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m,"Node, string":(e,t)=>m(e,h(t)),"Node, string, Object":(e,t,r)=>m(e,h(t),r)});d._simplify=!0,d.toTex=function(e){return g.apply(null,e.args)};const g=t("_derivTex",{"Node, SymbolNode":function(e,t){return V(e)&&"string"===oe(e.value)?g(n(e.value).toString(),t.toString(),1):g(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===oe(t.value))return g(e,n(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,r){return g(e.toString(),t.name,r.value)},"string, string, number":function(e,t,r){let n;return n=1===r?"{d\\over d"+t+"}":"{d^{"+r+"}\\over d"+t+"^{"+r+"}}",n+`\\left[${e}\\right]`}}),y=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0,!0},"Object, SymbolNode, string":function(e,t,r){return t.name!==r&&(e[t]=!0,!0)},"Object, ParenthesisNode, string":function(e,t,r){return y(e,t.content,r)},"Object, FunctionAssignmentNode, string":function(e,t,r){return t.params.includes(r)?y(e,t.expr,r):(e[t]=!0,!0)},"Object, FunctionNode | OperatorNode, string":function(e,t,r){if(t.args.length>0){let n=y(e,t.args[0],r);for(let i=1;i<t.args.length;++i)n=y(e,t.args[i],r)&&n;if(n)return e[t]=!0,!0}return!1}}),x=t("_derivative",{"ConstantNode, Object":function(e){return b(0)},"SymbolNode, Object":function(e,t){return void 0!==t[e]?b(0):b(1)},"ParenthesisNode, Object":function(e,t){return new f(x(e.content,t))},"FunctionAssignmentNode, Object":function(e,t){return void 0!==t[e]?b(0):x(e.expr,t)},"FunctionNode, Object":function(e,t){if(void 0!==t[e])return b(0);const r=e.args[0];let n,i,o,a,s=!1,u=!1;switch(e.name){case"cbrt":s=!0,i=new l("*","multiply",[b(3),new l("^","pow",[r,new l("/","divide",[b(2),b(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,i=new l("*","multiply",[b(2),new c("sqrt",[r])]);else if(2===e.args.length)return n=new l("/","divide",[b(1),e.args[1]]),t[n]=t[e.args[1]],x(new l("^","pow",[r,n]),t);break;case"log10":n=b(10);case"log":if(n||1!==e.args.length){if(1===e.args.length&&n||2===e.args.length&&void 0!==t[e.args[1]])i=new l("*","multiply",[r.clone(),new c("log",[n||e.args[1]])]),s=!0;else if(2===e.args.length)return x(new l("/","divide",[new c("log",[r]),new c("log",[e.args[1]])]),t)}else i=r.clone(),s=!0;break;case"pow":if(2===e.args.length)return t[n]=t[e.args[1]],x(new l("^","pow",[r,e.args[1]]),t);break;case"exp":i=new c("exp",[r.clone()]);break;case"sin":i=new c("cos",[r.clone()]);break;case"cos":i=new l("-","unaryMinus",[new c("sin",[r.clone()])]);break;case"tan":i=new l("^","pow",[new c("sec",[r.clone()]),b(2)]);break;case"sec":i=new l("*","multiply",[e,new c("tan",[r.clone()])]);break;case"csc":u=!0,i=new l("*","multiply",[e,new c("cot",[r.clone()])]);break;case"cot":u=!0,i=new l("^","pow",[new c("csc",[r.clone()]),b(2)]);break;case"asin":s=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])])]);break;case"acos":s=!0,u=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])])]);break;case"atan":s=!0,i=new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)]);break;case"asec":s=!0,i=new l("*","multiply",[new c("abs",[r.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[r.clone(),b(2)]),b(1)])])]);break;case"acsc":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[r.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[r.clone(),b(2)]),b(1)])])]);break;case"acot":s=!0,u=!0,i=new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)]);break;case"sinh":i=new c("cosh",[r.clone()]);break;case"cosh":i=new c("sinh",[r.clone()]);break;case"tanh":i=new l("^","pow",[new c("sech",[r.clone()]),b(2)]);break;case"sech":u=!0,i=new l("*","multiply",[e,new c("tanh",[r.clone()])]);break;case"csch":u=!0,i=new l("*","multiply",[e,new c("coth",[r.clone()])]);break;case"coth":u=!0,i=new l("^","pow",[new c("csch",[r.clone()]),b(2)]);break;case"asinh":s=!0,i=new c("sqrt",[new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)])]);break;case"acosh":s=!0,i=new c("sqrt",[new l("-","subtract",[new l("^","pow",[r.clone(),b(2)]),b(1)])]);break;case"atanh":s=!0,i=new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])]);break;case"asech":s=!0,u=!0,i=new l("*","multiply",[r.clone(),new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])])])]);break;case"acsch":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[r.clone()]),new c("sqrt",[new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)])])]);break;case"acoth":s=!0,u=!0,i=new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])]);break;case"abs":i=new l("/","divide",[new c(new p("abs"),[r.clone()]),r.clone()]);break;default:throw new Error('Cannot process function "'+e.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}s?(o="/",a="divide"):(o="*",a="multiply");let f=x(r,t);return u&&(f=new l("-","unaryMinus",[f])),new l(o,a,[f,i])},"OperatorNode, Object":function(e,t){if(void 0!==t[e])return b(0);if("+"===e.op)return new l(e.op,e.fn,e.args.map((function(e){return x(e,t)})));if("-"===e.op){if(e.isUnary())return new l(e.op,e.fn,[x(e.args[0],t)]);if(e.isBinary())return new l(e.op,e.fn,[x(e.args[0],t),x(e.args[1],t)])}if("*"===e.op){const r=e.args.filter((function(e){return void 0!==t[e]}));if(r.length>0){const n=e.args.filter((function(e){return void 0===t[e]})),i=1===n.length?n[0]:new l("*","multiply",n),o=r.concat(x(i,t));return new l("*","multiply",o)}return new l("+","add",e.args.map((function(r){return new l("*","multiply",e.args.map((function(e){return e===r?x(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){const r=e.args[0],n=e.args[1];return void 0!==t[n]?new l("/","divide",[x(r,t),n]):void 0!==t[r]?new l("*","multiply",[new l("-","unaryMinus",[r]),new l("/","divide",[x(n,t),new l("^","pow",[n.clone(),b(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[x(r,t),n.clone()]),new l("*","multiply",[r.clone(),x(n,t)])]),new l("^","pow",[n.clone(),b(2)])])}if("^"===e.op&&e.isBinary()){const r=e.args[0],n=e.args[1];if(void 0!==t[r])return V(r)&&(a(r.value)||o(r.value,1))?b(0):new l("*","multiply",[e,new l("*","multiply",[new c("log",[r.clone()]),x(n.clone(),t)])]);if(void 0!==t[n]){if(V(n)){if(a(n.value))return b(0);if(o(n.value,1))return x(r,t)}const e=new l("^","pow",[r.clone(),new l("-","subtract",[n,b(1)])]);return new l("*","multiply",[n.clone(),new l("*","multiply",[x(r,t),e])])}return new l("*","multiply",[new l("^","pow",[r.clone(),n.clone()]),new l("+","add",[new l("*","multiply",[x(r,t),new l("/","divide",[n.clone(),r.clone()])]),new l("*","multiply",[x(n,t),new c("log",[r.clone()])])])])}throw new Error('Cannot process operator "'+e.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function b(e,t){return new u(s(e,t||xe(String(e),r)))}return d})),Od="rationalize",Bd=he(Od,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],(e=>{let{config:t,typed:r,equal:n,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,parse:l,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:x,ArrayNode:b,ConstantNode:v,FunctionNode:w,IndexNode:N,ObjectNode:E,OperatorNode:A,SymbolNode:S,ParenthesisNode:M}=e;function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=function(){const e=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],t=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],r=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],n={};return n.firstRules=e.concat(t,r),n.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],n.sucDivRules=r,n.firstRulesAgain=e.concat(t),n.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))"}],n}(),i=function(e,t,r,n){const i=[],o=m(e,n,t,{exactFractions:!1}),a="+-*"+((r=!!r)?"/":"");!function e(t){const r=t.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!ye(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(!a.includes(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(let r=0;r<t.args.length;r++)e(t.args[r])}else if("SymbolNode"===r){const e=t.name;-1===i.indexOf(e)&&i.push(e)}else if("ParenthesisNode"===r)e(t.content);else if("ConstantNode"!==r)throw new Error("type "+r+" is not allowed in polynomial expression")}(o);const s={};return s.expression=o,s.variables=i,s}(e,t,!0,n.firstRules),o=i.variables.length,a={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,o>=1){let t,r;e=T(e);let i,o=!0,u=!1;for(e=m(e,n.firstRules,{},a);r=o?n.distrDivRules:n.sucDivRules,o=!o,i=(e=m(e,r,{},s)).toString(),i!==t;)u=!0,t=i;u&&(e=m(e,n.firstRulesAgain,{},a)),e=m(e,n.finalRules,{},a)}const u=[],c={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===o&&(e.args[0]=D(e.args[0],u),e.args[1]=D(e.args[1])),r&&(c.numerator=e.args[0],c.denominator=e.args[1])):(1===o&&(e=D(e,u)),r&&(c.numerator=e,c.denominator=null)),r?(c.coefficients=u,c.variables=i.variables,c.expression=e,c):e}return r(Od,{Node:C,"Node, boolean":(e,t)=>C(e,{},t),"Node, Object":C,"Node, Object, boolean":C});function T(e,t,r){const n=e.type,i=arguments.length>1;if("OperatorNode"===n&&e.isBinary()){let n,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(n=parseFloat(e.args[1].value),o=n>=2&&ye(n))),o){if(n>2){const t=e.args[0],r=new A("^","pow",[e.args[0].cloneDeep(),new v(n-1)]);e=new A("*","multiply",[t,r])}else e=new A("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===r?t.content=e:t.args[r]=e)}}if("ParenthesisNode"===n)T(e.content,e,"content");else if("ConstantNode"!==n&&"SymbolNode"!==n)for(let t=0;t<e.args.length;t++)T(e.args[t],e,t);if(!i)return e}function D(e,t){void 0===t&&(t=[]),t[0]=0;let r=0,n="";!function e(i,o,a){const s=i.type;if("FunctionNode"===s)throw new Error("There is an unsolved function call");if("OperatorNode"===s){if(!"+-*^".includes(i.op))throw new Error("Operator "+i.op+" invalid");if(null!==o){if(("unaryMinus"===i.fn||"pow"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn&&"multiply"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"multiply"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"unaryMinus"===i.fn)&&0!==a.noFil)throw new Error("Invalid "+i.op+" placing")}"^"!==i.op&&"*"!==i.op||(a.fire=i.op);for(let t=0;t<i.args.length;t++)"unaryMinus"===i.fn&&(a.oper="-"),"+"!==i.op&&"subtract"!==i.fn||(a.fire="",a.cte=1,a.oper=0===t?"+":i.op),a.noFil=t,e(i.args[t],i,a)}else if("SymbolNode"===s){if(i.name!==n&&""!==n)throw new Error("There is more than one variable");if(n=i.name,null===o)return void(t[1]=1);if("^"===o.op&&0!==a.noFil)throw new Error("In power the variable should be the first parameter");if("*"===o.op&&1!==a.noFil)throw new Error("In multiply the variable should be the second parameter");""!==a.fire&&"*"!==a.fire||(r<1&&(t[1]=0),t[1]+=a.cte*("+"===a.oper?1:-1),r=Math.max(1,r))}else{if("ConstantNode"!==s)throw new Error("Type "+s+" is not allowed");{const e=parseFloat(i.value);if(null===o)return void(t[0]=e);if("^"===o.op){if(1!==a.noFil)throw new Error("Constant cannot be powered");if(!ye(e)||e<=0)throw new Error("Non-integer exponent is not allowed");for(let n=r+1;n<e;n++)t[n]=0;return e>r&&(t[e]=0),t[e]+=a.cte*("+"===a.oper?1:-1),void(r=Math.max(e,r))}a.cte=e,""===a.fire&&(t[0]+=a.cte*("+"===a.oper?1:-1))}}}(e,null,{cte:1,oper:"+",fire:""}),r=t.length-1;let i,o=!0;for(let e=r;e>=0;e--){if(0===t[e])continue;let r=new v(o?t[e]:Math.abs(t[e]));const a=t[e]<0?"-":"+";if(e>0){let i=new S(n);if(e>1){const t=new v(e);i=new A("^","pow",[i,t])}r=-1===t[e]&&o?new A("-","unaryMinus",[i]):1===Math.abs(t[e])?i:new A("*","multiply",[r,i])}i=o?r:"+"===a?new A("+","add",[i,r]):new A("-","subtract",[i,r]),o=!1}return o?new v(0):i}})),_d="zpk2tf",zd=he(_d,["typed","add","multiply","Complex","number"],(e=>{let{typed:t,add:r,multiply:n,Complex:i,number:o}=e;return t(_d,{"Array,Array,number":function(e,t,r){return a(e,t,r)},"Array,Array":function(e,t){return a(e,t,1)},"Matrix,Matrix,number":function(e,t,r){return a(e.valueOf(),t.valueOf(),r)},"Matrix,Matrix":function(e,t){return a(e.valueOf(),t.valueOf(),1)}});function a(e,t,r){e.some((e=>"BigNumber"===e.type))&&(e=e.map((e=>o(e)))),t.some((e=>"BigNumber"===e.type))&&(t=t.map((e=>o(e))));let a=[i(1,0)],u=[i(1,0)];for(let t=0;t<e.length;t++){let r=e[t];"number"==typeof r&&(r=i(r,0)),a=s(a,[i(1,0),i(-r.re,-r.im)])}for(let e=0;e<t.length;e++){let r=t[e];"number"==typeof r&&(r=i(r,0)),u=s(u,[i(1,0),i(-r.re,-r.im)])}for(let e=0;e<a.length;e++)a[e]=n(a[e],r);return[a,u]}function s(e,t){const o=[];for(let a=0;a<e.length+t.length-1;a++){o[a]=i(0,0);for(let i=0;i<e.length;i++)a-i>=0&&a-i<t.length&&(o[a]=r(o[a],n(e[i],t[a-i])))}return o}})),Id="freqz",kd=he(Id,["typed","add","multiply","Complex","divide","matrix"],(e=>{let{typed:t,add:r,multiply:n,Complex:i,divide:o,matrix:a}=e;return t(Id,{"Array, Array":function(e,t){return s(e,t,u(512))},"Array, Array, Array":function(e,t,r){return s(e,t,r)},"Array, Array, number":function(e,t,r){if(r<0)throw new Error("w must be a positive number");return s(e,t,u(r))},"Matrix, Matrix":function(e,t){const r=u(512),{w:n,h:i}=s(e.valueOf(),t.valueOf(),r);return{w:a(n),h:a(i)}},"Matrix, Matrix, Matrix":function(e,t,r){const{h:n}=s(e.valueOf(),t.valueOf(),r.valueOf());return{h:a(n),w:a(r)}},"Matrix, Matrix, number":function(e,t,r){if(r<0)throw new Error("w must be a positive number");const n=u(r),{h:i}=s(e.valueOf(),t.valueOf(),n);return{h:a(i),w:a(n)}}});function s(e,t,a){const s=[],u=[];for(let o=0;o<a.length;o++){let c=i(0,0),l=i(0,0);for(let t=0;t<e.length;t++)c=r(c,n(e[t],i(Math.cos(-t*a[o]),Math.sin(-t*a[o]))));for(let e=0;e<t.length;e++)l=r(l,n(t[e],i(Math.cos(-e*a[o]),Math.sin(-e*a[o]))));s.push(c),u.push(l)}const c=[];for(let e=0;e<s.length;e++)c.push(o(s[e],u[e]));return{h:c,w:a}}function u(e){const t=[];for(let r=0;r<e;r++)t.push(r/e*Math.PI);return t}})),Rd=he("reviver",["classes"],(e=>{let{classes:t}=e;return function(e,r){const n=t[r&&r.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(r):r}})),qd=he("replacer",[],(()=>function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?"bigint"==typeof t?{mathjs:"bigint",value:String(t)}:t:{mathjs:"number",value:String(t)}})),Pd=Math.PI,jd=2*Math.PI,Ud=Math.E,Ld=he("true",[],(()=>!0)),$d=he("false",[],(()=>!1)),Hd=he("null",[],(()=>null)),Gd=sg("Infinity",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1/0):1/0})),Vd=sg("NaN",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(NaN):NaN})),Wd=sg("pi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?Nl(r):Pd})),Zd=sg("tau",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?El(r):jd})),Yd=sg("e",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?vl(r):Ud})),Jd=sg("phi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?wl(r):1.618033988749895})),Xd=sg("LN2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(2).ln():Math.LN2})),Qd=sg("LN10",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(10).ln():Math.LN10})),Kd=sg("LOG2E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1).div(new r(2).ln()):Math.LOG2E})),eg=sg("LOG10E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1).div(new r(10).ln()):Math.LOG10E})),tg=sg("SQRT1_2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r("0.5").sqrt():Math.SQRT1_2})),rg=sg("SQRT2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(2).sqrt():Math.SQRT2})),ng=sg("i",["Complex"],(e=>{let{Complex:t}=e;return t.I})),ig=he("PI",["pi"],(e=>{let{pi:t}=e;return t})),og=he("E",["e"],(e=>{let{e:t}=e;return t})),ag=he("version",[],(()=>"13.2.2"));function sg(e,t,r){return he(e,t,r,{recreateOnConfigChange:!0})}const ug=iy("speedOfLight","299792458","m s^-1"),cg=iy("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),lg=iy("planckConstant","6.62607015e-34","J s"),fg=iy("reducedPlanckConstant","1.0545718176461565e-34","J s"),pg=iy("magneticConstant","1.25663706212e-6","N A^-2"),mg=iy("electricConstant","8.8541878128e-12","F m^-1"),hg=iy("vacuumImpedance","376.730313667","ohm"),dg=iy("coulomb","8.987551792261171e9","N m^2 C^-2"),gg=iy("elementaryCharge","1.602176634e-19","C"),yg=iy("bohrMagneton","9.2740100783e-24","J T^-1"),xg=iy("conductanceQuantum","7.748091729863649e-5","S"),bg=iy("inverseConductanceQuantum","12906.403729652257","ohm"),vg=iy("magneticFluxQuantum","2.0678338484619295e-15","Wb"),wg=iy("nuclearMagneton","5.0507837461e-27","J T^-1"),Ng=iy("klitzing","25812.807459304513","ohm"),Eg=iy("bohrRadius","5.29177210903e-11","m"),Ag=iy("classicalElectronRadius","2.8179403262e-15","m"),Sg=iy("electronMass","9.1093837015e-31","kg"),Mg=iy("fermiCoupling","1.1663787e-5","GeV^-2"),Cg=oy("fineStructure",.0072973525693),Tg=iy("hartreeEnergy","4.3597447222071e-18","J"),Dg=iy("protonMass","1.67262192369e-27","kg"),Fg=iy("deuteronMass","3.3435830926e-27","kg"),Og=iy("neutronMass","1.6749271613e-27","kg"),Bg=iy("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),_g=iy("rydberg","10973731.568160","m^-1"),zg=iy("thomsonCrossSection","6.6524587321e-29","m^2"),Ig=oy("weakMixingAngle",.2229),kg=oy("efimovFactor",22.7),Rg=iy("atomicMass","1.66053906660e-27","kg"),qg=iy("avogadro","6.02214076e23","mol^-1"),Pg=iy("boltzmann","1.380649e-23","J K^-1"),jg=iy("faraday","96485.33212331001","C mol^-1"),Ug=iy("firstRadiation","3.7417718521927573e-16","W m^2"),Lg=iy("loschmidt","2.686780111798444e25","m^-3"),$g=iy("gasConstant","8.31446261815324","J K^-1 mol^-1"),Hg=iy("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),Gg=iy("molarVolume","0.022413969545014137","m^3 mol^-1"),Vg=oy("sackurTetrode",-1.16487052358),Wg=iy("secondRadiation","0.014387768775039337","m K"),Zg=iy("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),Yg=iy("wienDisplacement","2.897771955e-3","m K"),Jg=iy("molarMass","0.99999999965e-3","kg mol^-1"),Xg=iy("molarMassC12","11.9999999958e-3","kg mol^-1"),Qg=iy("gravity","9.80665","m s^-2"),Kg=iy("planckLength","1.616255e-35","m"),ey=iy("planckMass","2.176435e-8","kg"),ty=iy("planckTime","5.391245e-44","s"),ry=iy("planckCharge","1.87554603778e-18","C"),ny=iy("planckTemperature","1.416785e+32","K");function iy(e,t,r){return he(e,["config","Unit","BigNumber"],(e=>{let{config:n,Unit:i,BigNumber:o}=e;const a=new i("BigNumber"===n.number?new o(t):parseFloat(t),r);return a.fixPrefix=!0,a}))}function oy(e,t){return he(e,["config","BigNumber"],(e=>{let{config:r,BigNumber:n}=e;return"BigNumber"===r.number?new n(t):t}))}const ay=he("apply",["typed","isInteger"],(e=>{let{typed:t,isInteger:r}=e;const n=vo({typed:t,isInteger:r});return t("apply",{"...any":function(e){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1));try{return n.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),sy=he("column",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;const o=ws({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(e){const t=e.length-1,r=e[t];d(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0});function uy(e,t,r){const n=e.filter((function(e){return ne(e)&&!(e.name in t)&&!r.has(e.name)}))[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');const i=n.name,o=new Map,a=new f(r,o,new Set([i])),s=e.compile();return function(e){return o.set(i,e),s.evaluate(a)}}r(3921);const cy=he("transformCallback",["typed"],(e=>{let{typed:t}=e;return function(e,n){return t.isTypedFunction(e)?r(e,n):ly(e,e.length,n)};function r(e,n){const i=Object.fromEntries(Object.entries(e.signatures).map((e=>{let[i,o]=e;const a=i.split(",").length;return t.isTypedFunction(o)?[i,r(o,n)]:[i,ly(o,a,n)]})));return"string"==typeof e.name?t(e.name,i):t(i)}}));function ly(e,t,r){return t===r?e:t===r+1?function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];const o=n.slice(0,r),a=fy(n[r]);return e(...o,a)}:t>r+1?function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];const o=n.slice(0,r),a=fy(n[r]),s=n.slice(r+1);return e(...o,a,...s)}:e}function fy(e){return e.map((e=>e+1))}const py=he("filter",["typed"],(e=>{let{typed:t}=e;function r(e,r,i){const o=Ts({typed:t}),a=cy({typed:t});if(0===e.length)return o();let s=e[0];if(1===e.length)return o(s);const u=e.length-1;let c=e[u];return s&&(s=n(s,i)),c&&(c=ne(c)||Z(c)?n(c,i):uy(c,r,i)),o(s,a(c,u))}function n(e,t){return e.compile().evaluate(t)}return r.rawArgs=!0,r}),{isTransformFunction:!0}),my=he("forEach",["typed"],(e=>{let{typed:t}=e;const r=_s({typed:t}),n=cy({typed:t});function i(e,t,i){if(0===e.length)return r();let a=e[0];if(1===e.length)return r(a);const s=e.length-1;let u=e[s];return a&&(a=o(a,i)),u&&(u=ne(u)||Z(u)?o(u,i):uy(u,t,i)),r(a,n(u,s))}function o(e,t){return e.compile().evaluate(t)}return i.rawArgs=!0,i}),{isTransformFunction:!0}),hy=he("index",["Index","getMatrixDataType"],(e=>{let{Index:t,getMatrixDataType:r}=e;return function(){const e=[];for(let t=0,n=arguments.length;t<n;t++){let n=arguments[t];if(C(n))n.start--,n.end-=n.step>0?0:2;else if(n&&!0===n.isSet)n=n.map((function(e){return e-1}));else if(N(n)||E(n))"boolean"!==r(n)&&(n=n.map((function(e){return e-1})));else if(d(n))n--;else if(g(n))n=n.toNumber()-1;else if("string"!=typeof n)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[t]=n}const n=new t;return t.apply(n,e),n}}),{isTransformFunction:!0}),dy=he("map",["typed"],(e=>{let{typed:t}=e;const r=Ls({typed:t}),n=cy({typed:t});function i(e,t,i){if(0===e.length)return r();if(1===e.length)return r(e[0]);const o=e.length-1;let a=e.slice(0,o),s=e[o];return a=a.map((e=>u(e,i))),s&&(s=ne(s)||Z(s)?u(s,i):uy(s,t,i)),r(...a,n(s,o));function u(e,t){return e.compile().evaluate(t)}}return i.rawArgs=!0,i}),{isTransformFunction:!0});function gy(e){if(2===e.length&&A(e[0])){const r=(e=e.slice())[1];(d(t=r)||g(t))&&(e[1]=function(e){return d(e)?e-1:g(e)?e.minus(1):e}(r))}var t;return e}const yy=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:r,numeric:n,larger:i}=e;const o=fl({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(e){e=gy(e);try{return o.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),xy=he("mean",["typed","add","divide"],(e=>{let{typed:t,add:r,divide:n}=e;const i=hh({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){e=gy(e);try{return i.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),by=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:r,numeric:n,smaller:i}=e;const o=pl({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(e){e=gy(e);try{return o.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),vy=he("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:r,matrix:n,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;const f=Js({typed:t,config:r,matrix:n,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),f.apply(null,e)}})}),{isTransformFunction:!0}),wy=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;const o=iu({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(e){const t=e.length-1,r=e[t];d(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),Ny=he("subset",["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:r,zeros:n,add:i}=e;const o=lu({typed:t,matrix:r,zeros:n,add:i});return t("subset",{"...any":function(e){try{return o.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),Ey=he("concat",["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:r,isInteger:n}=e;const i=bs({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){const t=e.length-1,r=e[t];d(r)?e[t]=r-1:g(r)&&(e[t]=r.minus(1));try{return i.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),Ay="diff",Sy=he(Ay,["typed","matrix","subtract","number","bignumber"],(e=>{let{typed:t,matrix:r,subtract:n,number:i,bignumber:o}=e;const a=Hs({typed:t,matrix:r,subtract:n,number:i,bignumber:o});return t(Ay,{"...any":function(e){e=gy(e);try{return a.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),My=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:r,sqrt:n,variance:i}=e;const o=Eh({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(e){e=gy(e);try{return o.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),Cy=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:r,add:n,numeric:i}=e;const o=lh({typed:t,config:r,add:n,numeric:i});return t("sum",{"...any":function(e){e=gy(e);try{return o.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),Ty=he("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],(e=>{let{typed:t,bignumber:r,add:n,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p}=e;const m=Nh({typed:t,bignumber:r,add:n,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p});return t("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(e,t,r)=>m(e,t,h(r)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(e,t,r,n)=>m(e,t,r,h(n)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(e,t,r)=>m(e,t,h(r)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(e,t,r,n)=>m(e,t,r,h(n))});function h(e){return gy([[],e])[1]}}),{isTransformFunction:!0}),Dy="cumsum",Fy=he(Dy,["typed","add","unaryPlus"],(e=>{let{typed:t,add:r,unaryPlus:n}=e;const i=ph({typed:t,add:r,unaryPlus:n});return t(Dy,{"...any":function(e){if(2===e.length&&A(e[0])){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),Oy="variance",By=he(Oy,["typed","add","subtract","multiply","divide","apply","isNaN"],(e=>{let{typed:t,add:r,subtract:n,multiply:i,divide:o,apply:a,isNaN:s}=e;const u=vh({typed:t,add:r,subtract:n,multiply:i,divide:o,apply:a,isNaN:s});return t(Oy,{"...any":function(e){e=gy(e);try{return u.apply(null,e)}catch(e){throw yp(e)}}})}),{isTransformFunction:!0}),_y="print",zy=he(_y,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:r,zeros:n,add:i}=e;const o=Gu({typed:t,matrix:r,zeros:n,add:i});return t(_y,{"string, Object | Array":function(e,t){return o(a(e),t)},"string, Object | Array, number | Object":function(e,t,r){return o(a(e),t,r)}});function a(e){return e.replace($u,(e=>"$"+e.slice(1).split(".").map((function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e})).join(".")))}}),{isTransformFunction:!0}),Iy=he("and",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a}=e;const s=Dc({typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a});function u(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)&&!s(n,!0))return!1;const i=e[1].compile().evaluate(r);return s(n,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),ky=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=gs({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o});function s(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)&&a(n,!1))return!0;const i=e[1].compile().evaluate(r);return a(n,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0}),Ry=he("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a}=e;const s=Xa({typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a});function u(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)){if(isNaN(n))return NaN;if(0===n||!1===n)return 0}const i=e[1].compile().evaluate(r);return s(n,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),qy=he("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=ts({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o});function s(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)){if(isNaN(n))return NaN;if(-1===n)return-1;if(!0===n)return 1}const i=e[1].compile().evaluate(r);return a(n,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0});var Py=r(1504);const jy={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null},Uy=["Matrix","Array"],Ly=["number","BigNumber","Fraction"];function $y(e,t){function r(n){if(n){if(void 0!==n.epsilon){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');const e=ae(n);return e.relTol=n.epsilon,e.absTol=.001*n.epsilon,delete e.epsilon,r(e)}const i=ae(e);Hy(n,"matrix",Uy),Hy(n,"number",Ly),ue(e,n);const o=ae(e),a=ae(n);return t("config",o,i,a),o}return ae(e)}return r.MATRIX_OPTIONS=Uy,r.NUMBER_OPTIONS=Ly,Object.keys(jy).forEach((t=>{Object.defineProperty(r,t,{get:()=>e[t],enumerable:!0,configurable:!0})})),r}function Hy(e,t,r){void 0===e[t]||r.includes(e[t])||console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map((e=>JSON.stringify(e))).join(", ")+".")}const Gy=function e(r,n){const i=en({},jy,n);if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");const o=function(e){const t=new Py;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}({isNumber:d,isComplex:x,isBigNumber:g,isBigInt:y,isFraction:b,isUnit:v,isString:w,isArray:N,isMatrix:E,isCollection:A,isDenseMatrix:S,isSparseMatrix:M,isRange:C,isIndex:T,isBoolean:D,isResultSet:F,isHelp:O,isFunction:B,isDate:_,isRegExp:z,isObject:I,isMap:k,isPartitionedMap:R,isObjectWrappingMap:q,isNull:P,isUndefined:j,isAccessorNode:U,isArrayNode:L,isAssignmentNode:$,isBlockNode:H,isConditionalNode:G,isConstantNode:V,isFunctionAssignmentNode:Z,isFunctionNode:Y,isIndexNode:J,isNode:X,isObjectNode:Q,isOperatorNode:K,isParenthesisNode:ee,isRangeNode:te,isRelationalNode:re,isSymbolNode:ne,isChain:ie});o.config=$y(i,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};const a={};function s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.typed.apply(o.typed,t)}s.isTypedFunction=t.isTypedFunction;const u=function(e,t,r,n){function i(t,i,a){var s;if(a.wrap&&"function"==typeof i&&(i=function(e){const t=function(){const t=[];for(let e=0,r=arguments.length;e<r;e++){const r=arguments[e];t[e]=r&&r.valueOf()}return e.apply(r,t)};return e.transform&&(t.transform=e.transform),t}(i)),"function"==typeof(s=i)&&"string"==typeof s.signature&&(i=e(t,{[i.signature]:i})),e.isTypedFunction(r[t])&&e.isTypedFunction(i))return i=a.override?e(t,i.signatures):e(r[t],i),r[t]=i,delete n[t],o(t,i),void r.emit("import",t,(function(){return i}));if(void 0===r[t]||a.override)return r[t]=i,delete n[t],o(t,i),void r.emit("import",t,(function(){return i}));if(!a.silent)throw new Error('Cannot import "'+t+'": already exists')}function o(e,t){t&&"function"==typeof t.transform?(r.expression.transform[e]=t.transform,u(e)&&(r.expression.mathWithTransform[e]=t.transform)):(delete r.expression.transform[e],u(e)&&(r.expression.mathWithTransform[e]=t))}function a(e){delete r.expression.transform[e],u(e)?r.expression.mathWithTransform[e]=r[e]:delete r.expression.mathWithTransform[e]}function s(t,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(o.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(o));const s=l(t)?r.expression.transform:r,u=o in r.expression.transform,f=me(s,o)?s[o]:void 0,p=function(){const n={};t.dependencies.map(ge).forEach((e=>{if(e.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=r:"mathWithTransform"===e?n.mathWithTransform=r.expression.mathWithTransform:"classes"===e?n.classes=r:n[e]=r[e]}));const a=t(n);if(a&&"function"==typeof a.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"');if(void 0===f||i.override)return a;if(e.isTypedFunction(f)&&e.isTypedFunction(a))return e(f,a);if(i.silent)return f;throw new Error('Cannot import "'+o+'": already exists')};t.meta&&!1===t.meta.lazy?(s[o]=p(),f&&u?a(o):(l(t)||c(t))&&pe(r.expression.mathWithTransform,o,(()=>s[o]))):(pe(s,o,p),f&&u?a(o):(l(t)||c(t))&&pe(r.expression.mathWithTransform,o,(()=>s[o]))),n[o]=t,r.emit("import",o,p)}function u(e){return!me(f,e)}function c(e){return!(e.fn.includes(".")||me(f,e.fn)||e.meta&&e.meta.isClass)}function l(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}const f={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){const r=arguments.length;if(1!==r&&2!==r)throw new ia("import",r,1,2);t||(t={});const n={};!function e(r,n,i){if(Array.isArray(n))n.forEach((t=>e(r,t)));else if("object"==typeof n)for(const t in n)me(n,t)&&e(r,n[t],t);else if(de(n)||void 0!==i){const e=de(n)?l(n)?n.fn+".transform":n.fn:i;if(me(r,e)&&r[e]!==n&&!t.silent)throw new Error('Cannot import "'+e+'" twice');r[e]=n}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}(n,e);for(const e in n)if(me(n,e)){const r=n[e];if(de(r))s(r,t);else if("function"==typeof(o=r)||"number"==typeof o||"string"==typeof o||"boolean"==typeof o||null===o||v(o)||x(o)||g(o)||b(o)||E(o)||Array.isArray(o))i(e,r,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}var o}}(s,0,o,a);return o.import=u,o.on("config",(()=>{Object.values(a).forEach((e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&u(e,{override:!0})}))})),o.create=e.bind(null,r),o.factory=he,o.import(Object.values(le(r))),o.ArgumentsError=ia,o.DimensionError=pn,o.IndexError=mn,o}(e)})(),n.default})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.math=t():e.math=t()}(this,(()=>(()=>{var e={3144:e=>{"use strict";var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},n={"–":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},i=function(e,r){return t({},e,r)};e.exports=function(e){for(var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.preserveFormatting,s=void 0!==a&&a,u=o.escapeMapFn,c=void 0===u?i:u,l=String(e),f="",p=c(t({},r),s?t({},n):{}),m=Object.keys(p),h=function(){var e=!1;m.forEach((function(t,r){e||l.length>=t.length&&l.slice(0,t.length)===t&&(f+=p[m[r]],l=l.slice(t.length,l.length),e=!0)})),e||(f+=l.slice(0,1),l=l.slice(1,l.length))};l;)h();return f}},1880:e=>{e.exports=function e(t,r){"use strict";var n,i,o=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,a=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,u=/^0x[0-9a-f]+$/i,c=/^0/,l=function(t){return e.insensitive&&(""+t).toLowerCase()||""+t},f=l(t).replace(a,"")||"",p=l(r).replace(a,"")||"",m=f.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),d=parseInt(f.match(u),16)||1!==m.length&&f.match(s)&&Date.parse(f),g=parseInt(p.match(u),16)||d&&p.match(s)&&Date.parse(p)||null;if(g){if(d<g)return-1;if(d>g)return 1}for(var y=0,x=Math.max(m.length,h.length);y<x;y++){if(n=!(m[y]||"").match(c)&&parseFloat(m[y])||m[y]||0,i=!(h[y]||"").match(c)&&parseFloat(h[y])||h[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}},7391:(e,t,r)=>{var n=r(7180),i=r(3181),o=r(3031),a=r(9067),s=r(6833),u=r(6098),c=r(4801);c.alea=n,c.xor128=i,c.xorwow=o,c.xorshift7=a,c.xor4096=s,c.tychei=u,e.exports=c},7180:function(e,t,r){var n;!function(e,i){function o(e){var t,r=this,n=(t=4022871197,function(e){e=String(e);for(var r=0;r<e.length;r++){var n=.02519603282416938*(t+=e.charCodeAt(r));n-=t=n>>>0,t=(n*=t)>>>0,t+=4294967296*(n-=t)}return 2.3283064365386963e-10*(t>>>0)});r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function a(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function s(e,t){var r=new o(e),n=t&&t.state,i=r.next;return i.int32=function(){return 4294967296*r.next()|0},i.double=function(){return i()+11102230246251565e-32*(2097152*i()|0)},i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.alea=s}(0,e=r.nmd(e),r.amdD)},6098:function(e,t,r){var n;!function(e,i){function o(e){var t=this,r="";t.next=function(){var e=t.b,r=t.c,n=t.d,i=t.a;return e=e<<25^e>>>7^r,r=r-n|0,n=n<<24^n>>>8^i,i=i-e|0,t.b=e=e<<20^e>>>12^r,t.c=r=r-n|0,t.d=n<<16^r>>>16^i,t.a=i-e|0},t.a=0,t.b=0,t.c=-1640531527,t.d=1367130551,e===Math.floor(e)?(t.a=e/4294967296|0,t.b=0|e):r+=e;for(var n=0;n<r.length+20;n++)t.b^=0|r.charCodeAt(n),t.next()}function a(e,t){return t.a=e.a,t.b=e.b,t.c=e.c,t.d=e.d,t}function s(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.tychei=s}(0,e=r.nmd(e),r.amdD)},3181:function(e,t,r){var n;!function(e,i){function o(e){var t=this,r="";t.x=0,t.y=0,t.z=0,t.w=0,t.next=function(){var e=t.x^t.x<<11;return t.x=t.y,t.y=t.z,t.z=t.w,t.w^=t.w>>>19^e^e>>>8},e===(0|e)?t.x=e:r+=e;for(var n=0;n<r.length+64;n++)t.x^=0|r.charCodeAt(n),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t}function s(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor128=s}(0,e=r.nmd(e),r.amdD)},6833:function(e,t,r){var n;!function(e,i){function o(e){var t=this;t.next=function(){var e,r,n=t.w,i=t.X,o=t.i;return t.w=n=n+1640531527|0,r=i[o+34&127],e=i[o=o+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=i[o]=r^e,t.i=o,r+(n^n>>>16)|0},function(e,t){var r,n,i,o,a,s=[],u=128;for(t===(0|t)?(n=t,t=null):(t+="\0",n=0,u=Math.max(u,t.length)),i=0,o=-32;o<u;++o)t&&(n^=t.charCodeAt((o+32)%t.length)),0===o&&(a=n),n^=n<<10,n^=n>>>15,n^=n<<4,n^=n>>>13,o>=0&&(a=a+1640531527|0,i=0==(r=s[127&o]^=n+a)?i+1:0);for(i>=128&&(s[127&(t&&t.length||0)]=-1),i=127,o=512;o>0;--o)n=s[i+34&127],r=s[i=i+1&127],n^=n<<13,r^=r<<17,n^=n>>>15,r^=r>>>12,s[i]=n^r;e.w=a,e.X=s,e.i=i}(t,e)}function a(e,t){return t.i=e.i,t.w=e.w,t.X=e.X.slice(),t}function s(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.X&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xor4096=s}(0,e=r.nmd(e),r.amdD)},9067:function(e,t,r){var n;!function(e,i){function o(e){var t=this;t.next=function(){var e,r,n=t.x,i=t.i;return e=n[i],r=(e^=e>>>7)^e<<24,r^=(e=n[i+1&7])^e>>>10,r^=(e=n[i+3&7])^e>>>3,r^=(e=n[i+4&7])^e<<7,e=n[i+7&7],r^=(e^=e<<13)^e<<9,n[i]=r,t.i=i+1&7,r},function(e,t){var r,n=[];if(t===(0|t))n[0]=t;else for(t=""+t,r=0;r<t.length;++r)n[7&r]=n[7&r]<<15^t.charCodeAt(r)+n[r+1&7]<<13;for(;n.length<8;)n.push(0);for(r=0;r<8&&0===n[r];++r);for(8==r?n[7]=-1:n[r],e.x=n,e.i=0,r=256;r>0;--r)e.next()}(t,e)}function a(e,t){return t.x=e.x.slice(),t.i=e.i,t}function s(e,t){null==e&&(e=+new Date);var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&(n.x&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorshift7=s}(0,e=r.nmd(e),r.amdD)},3031:function(e,t,r){var n;!function(e,i){function o(e){var t=this,r="";t.next=function(){var e=t.x^t.x>>>2;return t.x=t.y,t.y=t.z,t.z=t.w,t.w=t.v,(t.d=t.d+362437|0)+(t.v=t.v^t.v<<4^e^e<<1)|0},t.x=0,t.y=0,t.z=0,t.w=0,t.v=0,e===(0|e)?t.x=e:r+=e;for(var n=0;n<r.length+64;n++)t.x^=0|r.charCodeAt(n),n==r.length&&(t.d=t.x<<10^t.x>>>4),t.next()}function a(e,t){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=e.w,t.v=e.v,t.d=e.d,t}function s(e,t){var r=new o(e),n=t&&t.state,i=function(){return(r.next()>>>0)/4294967296};return i.double=function(){do{var e=((r.next()>>>11)+(r.next()>>>0)/4294967296)/(1<<21)}while(0===e);return e},i.int32=r.next,i.quick=i,n&&("object"==typeof n&&a(n,r),i.state=function(){return a(r,{})}),i}i&&i.exports?i.exports=s:r.amdD&&r.amdO?void 0===(n=function(){return s}.call(t,r,t,i))||(i.exports=n):this.xorwow=s}(0,e=r.nmd(e),r.amdD)},4801:function(e,t,r){var n;!function(i,o,a){var s,u=256,c=a.pow(u,6),l=a.pow(2,52),f=2*l,p=255;function m(e,t,r){var n=[],p=y(g((t=1==t?{entropy:!0}:t||{}).entropy?[e,x(o)]:null==e?function(){try{var e;return s&&(e=s.randomBytes)?e=e(u):(e=new Uint8Array(u),(i.crypto||i.msCrypto).getRandomValues(e)),x(e)}catch(e){var t=i.navigator,r=t&&t.plugins;return[+new Date,i,r,i.screen,x(o)]}}():e,3),n),m=new h(n),b=function(){for(var e=m.g(6),t=c,r=0;e<l;)e=(e+r)*u,t*=u,r=m.g(1);for(;e>=f;)e/=2,t/=2,r>>>=1;return(e+r)/t};return b.int32=function(){return 0|m.g(4)},b.quick=function(){return m.g(4)/4294967296},b.double=b,y(x(m.S),o),(t.pass||r||function(e,t,r,n){return n&&(n.S&&d(n,m),e.state=function(){return d(m,{})}),r?(a.random=e,t):e})(b,p,"global"in t?t.global:this==a,t.state)}function h(e){var t,r=e.length,n=this,i=0,o=n.i=n.j=0,a=n.S=[];for(r||(e=[r++]);i<u;)a[i]=i++;for(i=0;i<u;i++)a[i]=a[o=p&o+e[i%r]+(t=a[i])],a[o]=t;(n.g=function(e){for(var t,r=0,i=n.i,o=n.j,a=n.S;e--;)t=a[i=p&i+1],r=r*u+a[p&(a[i]=a[o=p&o+t])+(a[o]=t)];return n.i=i,n.j=o,r})(u)}function d(e,t){return t.i=e.i,t.j=e.j,t.S=e.S.slice(),t}function g(e,t){var r,n=[],i=typeof e;if(t&&"object"==i)for(r in e)try{n.push(g(e[r],t-1))}catch(e){}return n.length?n:"string"==i?e:e+"\0"}function y(e,t){for(var r,n=e+"",i=0;i<n.length;)t[p&i]=p&(r^=19*t[p&i])+n.charCodeAt(i++);return x(t)}function x(e){return String.fromCharCode.apply(0,e)}if(y(a.random(),o),e.exports){e.exports=m;try{s=r(1234)}catch(e){}}else void 0===(n=function(){return m}.call(t,r,t,e))||(e.exports=n)}("undefined"!=typeof self?self:this,[],Math)},1504:e=>{function t(){}t.prototype={on:function(e,t,r){var n=this.e||(this.e={});return(n[e]||(n[e]=[])).push({fn:t,ctx:r}),this},once:function(e,t,r){var n=this;function i(){n.off(e,i),t.apply(r,arguments)}return i._=t,this.on(e,i,r)},emit:function(e){for(var t=[].slice.call(arguments,1),r=((this.e||(this.e={}))[e]||[]).slice(),n=0,i=r.length;n<i;n++)r[n].fn.apply(r[n].ctx,t);return this},off:function(e,t){var r=this.e||(this.e={}),n=r[e],i=[];if(n&&t)for(var o=0,a=n.length;o<a;o++)n[o].fn!==t&&n[o].fn._!==t&&i.push(n[o]);return i.length?r[e]=i:delete r[e],this}},e.exports=t,e.exports.TinyEmitter=t},1234:()=>{},9306:(e,t,r)=>{"use strict";var n=r(4901),i=r(6823),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a function")}},5548:(e,t,r)=>{"use strict";var n=r(3517),i=r(6823),o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not a constructor")}},3506:(e,t,r)=>{"use strict";var n=r(3925),i=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o("Can't set "+i(e)+" as a prototype")}},6469:(e,t,r)=>{"use strict";var n=r(8227),i=r(2360),o=r(4913).f,a=n("unscopables"),s=Array.prototype;void 0===s[a]&&o(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},7829:(e,t,r)=>{"use strict";var n=r(8183).charAt;e.exports=function(e,t,r){return t+(r?n(e,t).length:1)}},679:(e,t,r)=>{"use strict";var n=r(1625),i=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw new i("Incorrect invocation")}},8551:(e,t,r)=>{"use strict";var n=r(34),i=String,o=TypeError;e.exports=function(e){if(n(e))return e;throw new o(i(e)+" is not an object")}},9617:(e,t,r)=>{"use strict";var n=r(5397),i=r(5610),o=r(6198),a=function(e){return function(t,r,a){var s=n(t),u=o(s);if(0===u)return!e&&-1;var c,l=i(a,u);if(e&&r!=r){for(;u>l;)if((c=s[l++])!=c)return!0}else for(;u>l;l++)if((e||l in s)&&s[l]===r)return e||l||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},4598:(e,t,r)=>{"use strict";var n=r(9039);e.exports=function(e,t){var r=[][e];return!!r&&n((function(){r.call(null,t||function(){return 1},1)}))}},926:(e,t,r)=>{"use strict";var n=r(9306),i=r(8981),o=r(7055),a=r(6198),s=TypeError,u="Reduce of empty array with no initial value",c=function(e){return function(t,r,c,l){var f=i(t),p=o(f),m=a(f);if(n(r),0===m&&c<2)throw new s(u);var h=e?m-1:0,d=e?-1:1;if(c<2)for(;;){if(h in p){l=p[h],h+=d;break}if(h+=d,e?h<0:m<=h)throw new s(u)}for(;e?h>=0:m>h;h+=d)h in p&&(l=r(l,p[h],h,f));return l}};e.exports={left:c(!1),right:c(!0)}},7680:(e,t,r)=>{"use strict";var n=r(9504);e.exports=n([].slice)},4488:(e,t,r)=>{"use strict";var n=r(7680),i=Math.floor,o=function(e,t){var r=e.length;if(r<8)for(var a,s,u=1;u<r;){for(s=u,a=e[u];s&&t(e[s-1],a)>0;)e[s]=e[--s];s!==u++&&(e[s]=a)}else for(var c=i(r/2),l=o(n(e,0,c),t),f=o(n(e,c),t),p=l.length,m=f.length,h=0,d=0;h<p||d<m;)e[h+d]=h<p&&d<m?t(l[h],f[d])<=0?l[h++]:f[d++]:h<p?l[h++]:f[d++];return e};e.exports=o},6319:(e,t,r)=>{"use strict";var n=r(8551),i=r(9539);e.exports=function(e,t,r,o){try{return o?t(n(r)[0],r[1]):t(r)}catch(t){i(e,"throw",t)}}},4428:(e,t,r)=>{"use strict";var n=r(8227)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){try{if(!t&&!i)return!1}catch(e){return!1}var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},2195:(e,t,r)=>{"use strict";var n=r(9504),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},6955:(e,t,r)=>{"use strict";var n=r(2140),i=r(4901),o=r(2195),a=r(8227)("toStringTag"),s=Object,u="Arguments"===o(function(){return arguments}());e.exports=n?o:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=s(e),a))?r:u?o(t):"Object"===(n=o(t))&&i(t.callee)?"Arguments":n}},7740:(e,t,r)=>{"use strict";var n=r(9297),i=r(5031),o=r(7347),a=r(4913);e.exports=function(e,t,r){for(var s=i(t),u=a.f,c=o.f,l=0;l<s.length;l++){var f=s[l];n(e,f)||r&&n(r,f)||u(e,f,c(t,f))}}},2211:(e,t,r)=>{"use strict";var n=r(9039);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},2529:e=>{"use strict";e.exports=function(e,t){return{value:e,done:t}}},6699:(e,t,r)=>{"use strict";var n=r(3724),i=r(4913),o=r(6980);e.exports=n?function(e,t,r){return i.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},6980:e=>{"use strict";e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},4659:(e,t,r)=>{"use strict";var n=r(3724),i=r(4913),o=r(6980);e.exports=function(e,t,r){n?i.f(e,t,o(0,r)):e[t]=r}},2106:(e,t,r)=>{"use strict";var n=r(283),i=r(4913);e.exports=function(e,t,r){return r.get&&n(r.get,t,{getter:!0}),r.set&&n(r.set,t,{setter:!0}),i.f(e,t,r)}},6840:(e,t,r)=>{"use strict";var n=r(4901),i=r(4913),o=r(283),a=r(9433);e.exports=function(e,t,r,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:t;if(n(r)&&o(r,c,s),s.global)u?e[t]=r:a(t,r);else{try{s.unsafe?e[t]&&(u=!0):delete e[t]}catch(e){}u?e[t]=r:i.f(e,t,{value:r,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return e}},6279:(e,t,r)=>{"use strict";var n=r(6840);e.exports=function(e,t,r){for(var i in t)n(e,i,t[i],r);return e}},9433:(e,t,r)=>{"use strict";var n=r(4576),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},4606:(e,t,r)=>{"use strict";var n=r(6823),i=TypeError;e.exports=function(e,t){if(!delete e[t])throw new i("Cannot delete property "+n(t)+" of "+n(e))}},3724:(e,t,r)=>{"use strict";var n=r(9039);e.exports=!n((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},4055:(e,t,r)=>{"use strict";var n=r(4576),i=r(34),o=n.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},8727:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3709:(e,t,r)=>{"use strict";var n=r(2839).match(/firefox\/(\d+)/i);e.exports=!!n&&+n[1]},3763:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/MSIE|Trident/.test(n)},4265:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/ipad|iphone|ipod/i.test(n)&&"undefined"!=typeof Pebble},9544:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)},6193:(e,t,r)=>{"use strict";var n=r(4215);e.exports="NODE"===n},7860:(e,t,r)=>{"use strict";var n=r(2839);e.exports=/web0s(?!.*chrome)/i.test(n)},2839:(e,t,r)=>{"use strict";var n=r(4576).navigator,i=n&&n.userAgent;e.exports=i?String(i):""},9519:(e,t,r)=>{"use strict";var n,i,o=r(4576),a=r(2839),s=o.process,u=o.Deno,c=s&&s.versions||u&&u.version,l=c&&c.v8;l&&(i=(n=l.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},3607:(e,t,r)=>{"use strict";var n=r(2839).match(/AppleWebKit\/(\d+)\./);e.exports=!!n&&+n[1]},4215:(e,t,r)=>{"use strict";var n=r(4576),i=r(2839),o=r(2195),a=function(e){return i.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":n.Bun&&"string"==typeof Bun.version?"BUN":n.Deno&&"object"==typeof Deno.version?"DENO":"process"===o(n.process)?"NODE":n.window&&n.document?"BROWSER":"REST"},6518:(e,t,r)=>{"use strict";var n=r(4576),i=r(7347).f,o=r(6699),a=r(6840),s=r(9433),u=r(7740),c=r(2796);e.exports=function(e,t){var r,l,f,p,m,h=e.target,d=e.global,g=e.stat;if(r=d?n:g?n[h]||s(h,{}):n[h]&&n[h].prototype)for(l in t){if(p=t[l],f=e.dontCallGetSet?(m=i(r,l))&&m.value:r[l],!c(d?l:h+(g?".":"#")+l,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;u(p,f)}(e.sham||f&&f.sham)&&o(p,"sham",!0),a(r,l,p,e)}}},9039:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},9228:(e,t,r)=>{"use strict";r(7495);var n=r(9565),i=r(6840),o=r(7323),a=r(9039),s=r(8227),u=r(6699),c=s("species"),l=RegExp.prototype;e.exports=function(e,t,r,f){var p=s(e),m=!a((function(){var t={};return t[p]=function(){return 7},7!==""[e](t)})),h=m&&!a((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[c]=function(){return r},r.flags="",r[p]=/./[p]),r.exec=function(){return t=!0,null},r[p](""),!t}));if(!m||!h||r){var d=/./[p],g=t(p,""[e],(function(e,t,r,i,a){var s=t.exec;return s===o||s===l.exec?m&&!a?{done:!0,value:n(d,t,r,i)}:{done:!0,value:n(e,r,t,i)}:{done:!1}}));i(String.prototype,e,g[0]),i(l,p,g[1])}f&&u(l[p],"sham",!0)}},8745:(e,t,r)=>{"use strict";var n=r(616),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==typeof Reflect&&Reflect.apply||(n?a.bind(o):function(){return a.apply(o,arguments)})},6080:(e,t,r)=>{"use strict";var n=r(7476),i=r(9306),o=r(616),a=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},616:(e,t,r)=>{"use strict";var n=r(9039);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},9565:(e,t,r)=>{"use strict";var n=r(616),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},350:(e,t,r)=>{"use strict";var n=r(3724),i=r(9297),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=i(o,"name"),u=s&&"something"===function(){}.name,c=s&&(!n||n&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},6706:(e,t,r)=>{"use strict";var n=r(9504),i=r(9306);e.exports=function(e,t,r){try{return n(i(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}}},7476:(e,t,r)=>{"use strict";var n=r(2195),i=r(9504);e.exports=function(e){if("Function"===n(e))return i(e)}},9504:(e,t,r)=>{"use strict";var n=r(616),i=Function.prototype,o=i.call,a=n&&i.bind.bind(o,o);e.exports=n?a:function(e){return function(){return o.apply(e,arguments)}}},7751:(e,t,r)=>{"use strict";var n=r(4576),i=r(4901);e.exports=function(e,t){return arguments.length<2?(r=n[e],i(r)?r:void 0):n[e]&&n[e][t];var r}},1767:e=>{"use strict";e.exports=function(e){return{iterator:e,next:e.next,done:!1}}},851:(e,t,r)=>{"use strict";var n=r(6955),i=r(5966),o=r(4117),a=r(6269),s=r(8227)("iterator");e.exports=function(e){if(!o(e))return i(e,s)||i(e,"@@iterator")||a[n(e)]}},81:(e,t,r)=>{"use strict";var n=r(9565),i=r(9306),o=r(8551),a=r(6823),s=r(851),u=TypeError;e.exports=function(e,t){var r=arguments.length<2?s(e):t;if(i(r))return o(n(r,e));throw new u(a(e)+" is not iterable")}},6933:(e,t,r)=>{"use strict";var n=r(9504),i=r(4376),o=r(4901),a=r(2195),s=r(655),u=n([].push);e.exports=function(e){if(o(e))return e;if(i(e)){for(var t=e.length,r=[],n=0;n<t;n++){var c=e[n];"string"==typeof c?u(r,c):"number"!=typeof c&&"Number"!==a(c)&&"String"!==a(c)||u(r,s(c))}var l=r.length,f=!0;return function(e,t){if(f)return f=!1,t;if(i(this))return t;for(var n=0;n<l;n++)if(r[n]===e)return t}}}},5966:(e,t,r)=>{"use strict";var n=r(9306),i=r(4117);e.exports=function(e,t){var r=e[t];return i(r)?void 0:n(r)}},2478:(e,t,r)=>{"use strict";var n=r(9504),i=r(8981),o=Math.floor,a=n("".charAt),s=n("".replace),u=n("".slice),c=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,l=/\$([$&'`]|\d{1,2})/g;e.exports=function(e,t,r,n,f,p){var m=r+e.length,h=n.length,d=l;return void 0!==f&&(f=i(f),d=c),s(p,d,(function(i,s){var c;switch(a(s,0)){case"$":return"$";case"&":return e;case"`":return u(t,0,r);case"'":return u(t,m);case"<":c=f[u(s,1,-1)];break;default:var l=+s;if(0===l)return i;if(l>h){var p=o(l/10);return 0===p?i:p<=h?void 0===n[p-1]?a(s,1):n[p-1]+a(s,1):i}c=n[l-1]}return void 0===c?"":c}))}},4576:function(e){"use strict";var t=function(e){return e&&e.Math===Math&&e};e.exports=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof global&&global)||t("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297:(e,t,r)=>{"use strict";var n=r(9504),i=r(8981),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},421:e=>{"use strict";e.exports={}},3138:e=>{"use strict";e.exports=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}}},397:(e,t,r)=>{"use strict";var n=r(7751);e.exports=n("document","documentElement")},5917:(e,t,r)=>{"use strict";var n=r(3724),i=r(9039),o=r(4055);e.exports=!n&&!i((function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7055:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),o=r(2195),a=Object,s=n("".split);e.exports=i((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"===o(e)?s(e,""):a(e)}:a},3167:(e,t,r)=>{"use strict";var n=r(4901),i=r(34),o=r(2967);e.exports=function(e,t,r){var a,s;return o&&n(a=t.constructor)&&a!==r&&i(s=a.prototype)&&s!==r.prototype&&o(e,s),e}},3706:(e,t,r)=>{"use strict";var n=r(9504),i=r(4901),o=r(7629),a=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},1181:(e,t,r)=>{"use strict";var n,i,o,a=r(8622),s=r(4576),u=r(34),c=r(6699),l=r(9297),f=r(7629),p=r(6119),m=r(421),h="Object already initialized",d=s.TypeError,g=s.WeakMap;if(a||f.state){var y=f.state||(f.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,n=function(e,t){if(y.has(e))throw new d(h);return t.facade=e,y.set(e,t),t},i=function(e){return y.get(e)||{}},o=function(e){return y.has(e)}}else{var x=p("state");m[x]=!0,n=function(e,t){if(l(e,x))throw new d(h);return t.facade=e,c(e,x,t),t},i=function(e){return l(e,x)?e[x]:{}},o=function(e){return l(e,x)}}e.exports={set:n,get:i,has:o,enforce:function(e){return o(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=i(t)).type!==e)throw new d("Incompatible receiver, "+e+" required");return r}}}},4209:(e,t,r)=>{"use strict";var n=r(8227),i=r(6269),o=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},4376:(e,t,r)=>{"use strict";var n=r(2195);e.exports=Array.isArray||function(e){return"Array"===n(e)}},4901:e=>{"use strict";var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},3517:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),o=r(4901),a=r(6955),s=r(7751),u=r(3706),c=function(){},l=s("Reflect","construct"),f=/^\s*(?:class|function)\b/,p=n(f.exec),m=!f.test(c),h=function(e){if(!o(e))return!1;try{return l(c,[],e),!0}catch(e){return!1}},d=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return m||!!p(f,u(e))}catch(e){return!0}};d.sham=!0,e.exports=!l||i((function(){var e;return h(h.call)||!h(Object)||!h((function(){e=!0}))||e}))?d:h},2796:(e,t,r)=>{"use strict";var n=r(9039),i=r(4901),o=/#|\.prototype\./,a=function(e,t){var r=u[s(e)];return r===l||r!==c&&(i(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",l=a.POLYFILL="P";e.exports=a},4117:e=>{"use strict";e.exports=function(e){return null==e}},34:(e,t,r)=>{"use strict";var n=r(4901);e.exports=function(e){return"object"==typeof e?null!==e:n(e)}},3925:(e,t,r)=>{"use strict";var n=r(34);e.exports=function(e){return n(e)||null===e}},6395:e=>{"use strict";e.exports=!1},788:(e,t,r)=>{"use strict";var n=r(34),i=r(2195),o=r(8227)("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[o])?!!t:"RegExp"===i(e))}},757:(e,t,r)=>{"use strict";var n=r(7751),i=r(4901),o=r(1625),a=r(7040),s=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return i(t)&&o(t.prototype,s(e))}},2652:(e,t,r)=>{"use strict";var n=r(6080),i=r(9565),o=r(8551),a=r(6823),s=r(4209),u=r(6198),c=r(1625),l=r(81),f=r(851),p=r(9539),m=TypeError,h=function(e,t){this.stopped=e,this.result=t},d=h.prototype;e.exports=function(e,t,r){var g,y,x,b,v,w,N,E=r&&r.that,A=!(!r||!r.AS_ENTRIES),S=!(!r||!r.IS_RECORD),M=!(!r||!r.IS_ITERATOR),C=!(!r||!r.INTERRUPTED),T=n(t,E),D=function(e){return g&&p(g,"normal",e),new h(!0,e)},B=function(e){return A?(o(e),C?T(e[0],e[1],D):T(e[0],e[1])):C?T(e,D):T(e)};if(S)g=e.iterator;else if(M)g=e;else{if(!(y=f(e)))throw new m(a(e)+" is not iterable");if(s(y)){for(x=0,b=u(e);b>x;x++)if((v=B(e[x]))&&c(d,v))return v;return new h(!1)}g=l(e,y)}for(w=S?e.next:g.next;!(N=i(w,g)).done;){try{v=B(N.value)}catch(e){p(g,"throw",e)}if("object"==typeof v&&v&&c(d,v))return v}return new h(!1)}},9539:(e,t,r)=>{"use strict";var n=r(9565),i=r(8551),o=r(5966);e.exports=function(e,t,r){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw r;return r}a=n(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw r;if(s)throw a;return i(a),r}},9462:(e,t,r)=>{"use strict";var n=r(9565),i=r(2360),o=r(6699),a=r(6279),s=r(8227),u=r(1181),c=r(5966),l=r(7657).IteratorPrototype,f=r(2529),p=r(9539),m=s("toStringTag"),h="IteratorHelper",d="WrapForValidIterator",g=u.set,y=function(e){var t=u.getterFor(e?d:h);return a(i(l),{next:function(){var r=t(this);if(e)return r.nextHandler();try{var n=r.done?void 0:r.nextHandler();return f(n,r.done)}catch(e){throw r.done=!0,e}},return:function(){var r=t(this),i=r.iterator;if(r.done=!0,e){var o=c(i,"return");return o?n(o,i):f(void 0,!0)}if(r.inner)try{p(r.inner.iterator,"normal")}catch(e){return p(i,"throw",e)}return i&&p(i,"normal"),f(void 0,!0)}})},x=y(!0),b=y(!1);o(b,m,"Iterator Helper"),e.exports=function(e,t){var r=function(r,n){n?(n.iterator=r.iterator,n.next=r.next):n=r,n.type=t?d:h,n.nextHandler=e,n.counter=0,n.done=!1,g(this,n)};return r.prototype=t?x:b,r}},713:(e,t,r)=>{"use strict";var n=r(9565),i=r(9306),o=r(8551),a=r(1767),s=r(9462),u=r(6319),c=s((function(){var e=this.iterator,t=o(n(this.next,e));if(!(this.done=!!t.done))return u(e,this.mapper,[t.value,this.counter++],!0)}));e.exports=function(e){return o(this),i(e),new c(a(this),{mapper:e})}},7657:(e,t,r)=>{"use strict";var n,i,o,a=r(9039),s=r(4901),u=r(34),c=r(2360),l=r(2787),f=r(6840),p=r(8227),m=r(6395),h=p("iterator"),d=!1;[].keys&&("next"in(o=[].keys())?(i=l(l(o)))!==Object.prototype&&(n=i):d=!0),!u(n)||a((function(){var e={};return n[h].call(e)!==e}))?n={}:m&&(n=c(n)),s(n[h])||f(n,h,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:d}},6269:e=>{"use strict";e.exports={}},6198:(e,t,r)=>{"use strict";var n=r(8014);e.exports=function(e){return n(e.length)}},283:(e,t,r)=>{"use strict";var n=r(9504),i=r(9039),o=r(4901),a=r(9297),s=r(3724),u=r(350).CONFIGURABLE,c=r(3706),l=r(1181),f=l.enforce,p=l.get,m=String,h=Object.defineProperty,d=n("".slice),g=n("".replace),y=n([].join),x=s&&!i((function(){return 8!==h((function(){}),"length",{value:8}).length})),b=String(String).split("String"),v=e.exports=function(e,t,r){"Symbol("===d(m(t),0,7)&&(t="["+g(m(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!a(e,"name")||u&&e.name!==t)&&(s?h(e,"name",{value:t,configurable:!0}):e.name=t),x&&r&&a(r,"arity")&&e.length!==r.arity&&h(e,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?s&&h(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=f(e);return a(n,"source")||(n.source=y(b,"string"==typeof t?t:"")),e};Function.prototype.toString=v((function(){return o(this)&&p(this).source||c(this)}),"toString")},741:e=>{"use strict";var t=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var n=+e;return(n>0?r:t)(n)}},1955:(e,t,r)=>{"use strict";var n,i,o,a,s,u=r(4576),c=r(3389),l=r(6080),f=r(9225).set,p=r(8265),m=r(9544),h=r(4265),d=r(7860),g=r(6193),y=u.MutationObserver||u.WebKitMutationObserver,x=u.document,b=u.process,v=u.Promise,w=c("queueMicrotask");if(!w){var N=new p,E=function(){var e,t;for(g&&(e=b.domain)&&e.exit();t=N.get();)try{t()}catch(e){throw N.head&&n(),e}e&&e.enter()};m||g||d||!y||!x?!h&&v&&v.resolve?((a=v.resolve(void 0)).constructor=v,s=l(a.then,a),n=function(){s(E)}):g?n=function(){b.nextTick(E)}:(f=l(f,u),n=function(){f(E)}):(i=!0,o=x.createTextNode(""),new y(E).observe(o,{characterData:!0}),n=function(){o.data=i=!i}),w=function(e){N.head||n(),N.add(e)}}e.exports=w},6043:(e,t,r)=>{"use strict";var n=r(9306),i=TypeError,o=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw new i("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)};e.exports.f=function(e){return new o(e)}},2360:(e,t,r)=>{"use strict";var n,i=r(8551),o=r(6801),a=r(8727),s=r(421),u=r(397),c=r(4055),l=r(6119),f="prototype",p="script",m=l("IE_PROTO"),h=function(){},d=function(e){return"<"+p+">"+e+"</"+p+">"},g=function(e){e.write(d("")),e.close();var t=e.parentWindow.Object;return e=null,t},y=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;y="undefined"!=typeof document?document.domain&&n?g(n):(t=c("iframe"),r="java"+p+":",t.style.display="none",u.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(d("document.F=Object")),e.close(),e.F):g(n);for(var i=a.length;i--;)delete y[f][a[i]];return y()};s[m]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(h[f]=i(e),r=new h,h[f]=null,r[m]=e):r=y(),void 0===t?r:o.f(r,t)}},6801:(e,t,r)=>{"use strict";var n=r(3724),i=r(8686),o=r(4913),a=r(8551),s=r(5397),u=r(1072);t.f=n&&!i?Object.defineProperties:function(e,t){a(e);for(var r,n=s(t),i=u(t),c=i.length,l=0;c>l;)o.f(e,r=i[l++],n[r]);return e}},4913:(e,t,r)=>{"use strict";var n=r(3724),i=r(5917),o=r(8686),a=r(8551),s=r(6969),u=TypeError,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,f="enumerable",p="configurable",m="writable";t.f=n?o?function(e,t,r){if(a(e),t=s(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&m in r&&!r[m]){var n=l(e,t);n&&n[m]&&(e[t]=r.value,r={configurable:p in r?r[p]:n[p],enumerable:f in r?r[f]:n[f],writable:!1})}return c(e,t,r)}:c:function(e,t,r){if(a(e),t=s(t),a(r),i)try{return c(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new u("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},7347:(e,t,r)=>{"use strict";var n=r(3724),i=r(9565),o=r(8773),a=r(6980),s=r(5397),u=r(6969),c=r(9297),l=r(5917),f=Object.getOwnPropertyDescriptor;t.f=n?f:function(e,t){if(e=s(e),t=u(t),l)try{return f(e,t)}catch(e){}if(c(e,t))return a(!i(o.f,e,t),e[t])}},8480:(e,t,r)=>{"use strict";var n=r(1828),i=r(8727).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},3717:(e,t)=>{"use strict";t.f=Object.getOwnPropertySymbols},2787:(e,t,r)=>{"use strict";var n=r(9297),i=r(4901),o=r(8981),a=r(6119),s=r(2211),u=a("IE_PROTO"),c=Object,l=c.prototype;e.exports=s?c.getPrototypeOf:function(e){var t=o(e);if(n(t,u))return t[u];var r=t.constructor;return i(r)&&t instanceof r?r.prototype:t instanceof c?l:null}},1625:(e,t,r)=>{"use strict";var n=r(9504);e.exports=n({}.isPrototypeOf)},1828:(e,t,r)=>{"use strict";var n=r(9504),i=r(9297),o=r(5397),a=r(9617).indexOf,s=r(421),u=n([].push);e.exports=function(e,t){var r,n=o(e),c=0,l=[];for(r in n)!i(s,r)&&i(n,r)&&u(l,r);for(;t.length>c;)i(n,r=t[c++])&&(~a(l,r)||u(l,r));return l}},1072:(e,t,r)=>{"use strict";var n=r(1828),i=r(8727);e.exports=Object.keys||function(e){return n(e,i)}},8773:(e,t)=>{"use strict";var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},2967:(e,t,r)=>{"use strict";var n=r(6706),i=r(34),o=r(7750),a=r(3506);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return o(r),a(n),i(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0)},4270:(e,t,r)=>{"use strict";var n=r(9565),i=r(4901),o=r(34),a=TypeError;e.exports=function(e,t){var r,s;if("string"===t&&i(r=e.toString)&&!o(s=n(r,e)))return s;if(i(r=e.valueOf)&&!o(s=n(r,e)))return s;if("string"!==t&&i(r=e.toString)&&!o(s=n(r,e)))return s;throw new a("Can't convert object to primitive value")}},5031:(e,t,r)=>{"use strict";var n=r(7751),i=r(9504),o=r(8480),a=r(3717),s=r(8551),u=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(s(e)),r=a.f;return r?u(t,r(e)):t}},1103:e=>{"use strict";e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},916:(e,t,r)=>{"use strict";var n=r(4576),i=r(550),o=r(4901),a=r(2796),s=r(3706),u=r(8227),c=r(4215),l=r(6395),f=r(9519),p=i&&i.prototype,m=u("species"),h=!1,d=o(n.PromiseRejectionEvent),g=a("Promise",(function(){var e=s(i),t=e!==String(i);if(!t&&66===f)return!0;if(l&&(!p.catch||!p.finally))return!0;if(!f||f<51||!/native code/.test(e)){var r=new i((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[m]=n,!(h=r.then((function(){}))instanceof n))return!0}return!(t||"BROWSER"!==c&&"DENO"!==c||d)}));e.exports={CONSTRUCTOR:g,REJECTION_EVENT:d,SUBCLASSING:h}},550:(e,t,r)=>{"use strict";var n=r(4576);e.exports=n.Promise},3438:(e,t,r)=>{"use strict";var n=r(8551),i=r(34),o=r(6043);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=o.f(e);return(0,r.resolve)(t),r.promise}},537:(e,t,r)=>{"use strict";var n=r(550),i=r(4428),o=r(916).CONSTRUCTOR;e.exports=o||!i((function(e){n.all(e).then(void 0,(function(){}))}))},1056:(e,t,r)=>{"use strict";var n=r(4913).f;e.exports=function(e,t,r){r in e||n(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})}},8265:e=>{"use strict";var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}},e.exports=t},6682:(e,t,r)=>{"use strict";var n=r(9565),i=r(8551),o=r(4901),a=r(2195),s=r(7323),u=TypeError;e.exports=function(e,t){var r=e.exec;if(o(r)){var c=n(r,e,t);return null!==c&&i(c),c}if("RegExp"===a(e))return n(s,e,t);throw new u("RegExp#exec called on incompatible receiver")}},7323:(e,t,r)=>{"use strict";var n,i,o=r(9565),a=r(9504),s=r(655),u=r(7979),c=r(8429),l=r(5745),f=r(2360),p=r(1181).get,m=r(3635),h=r(8814),d=l("native-string-replace",String.prototype.replace),g=RegExp.prototype.exec,y=g,x=a("".charAt),b=a("".indexOf),v=a("".replace),w=a("".slice),N=(i=/b*/g,o(g,n=/a/,"a"),o(g,i,"a"),0!==n.lastIndex||0!==i.lastIndex),E=c.BROKEN_CARET,A=void 0!==/()??/.exec("")[1];(N||A||E||m||h)&&(y=function(e){var t,r,n,i,a,c,l,m=this,h=p(m),S=s(e),M=h.raw;if(M)return M.lastIndex=m.lastIndex,t=o(y,M,S),m.lastIndex=M.lastIndex,t;var C=h.groups,T=E&&m.sticky,D=o(u,m),B=m.source,F=0,O=S;if(T&&(D=v(D,"y",""),-1===b(D,"g")&&(D+="g"),O=w(S,m.lastIndex),m.lastIndex>0&&(!m.multiline||m.multiline&&"\n"!==x(S,m.lastIndex-1))&&(B="(?: "+B+")",O=" "+O,F++),r=new RegExp("^(?:"+B+")",D)),A&&(r=new RegExp("^"+B+"$(?!\\s)",D)),N&&(n=m.lastIndex),i=o(g,T?r:m,O),T?i?(i.input=w(i.input,F),i[0]=w(i[0],F),i.index=m.lastIndex,m.lastIndex+=i[0].length):m.lastIndex=0:N&&i&&(m.lastIndex=m.global?i.index+i[0].length:n),A&&i&&i.length>1&&o(d,i[0],r,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&C)for(i.groups=c=f(null),a=0;a<C.length;a++)c[(l=C[a])[0]]=i[l[1]];return i}),e.exports=y},7979:(e,t,r)=>{"use strict";var n=r(8551);e.exports=function(){var e=n(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t}},1034:(e,t,r)=>{"use strict";var n=r(9565),i=r(9297),o=r(1625),a=r(7979),s=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in s||i(e,"flags")||!o(s,e)?t:n(a,e)}},8429:(e,t,r)=>{"use strict";var n=r(9039),i=r(4576).RegExp,o=n((function(){var e=i("a","y");return e.lastIndex=2,null!==e.exec("abcd")})),a=o||n((function(){return!i("a","y").sticky})),s=o||n((function(){var e=i("^r","gy");return e.lastIndex=2,null!==e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},3635:(e,t,r)=>{"use strict";var n=r(9039),i=r(4576).RegExp;e.exports=n((function(){var e=i(".","s");return!(e.dotAll&&e.test("\n")&&"s"===e.flags)}))},8814:(e,t,r)=>{"use strict";var n=r(9039),i=r(4576).RegExp;e.exports=n((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},7750:(e,t,r)=>{"use strict";var n=r(4117),i=TypeError;e.exports=function(e){if(n(e))throw new i("Can't call method on "+e);return e}},3389:(e,t,r)=>{"use strict";var n=r(4576),i=r(3724),o=Object.getOwnPropertyDescriptor;e.exports=function(e){if(!i)return n[e];var t=o(n,e);return t&&t.value}},7633:(e,t,r)=>{"use strict";var n=r(7751),i=r(2106),o=r(8227),a=r(3724),s=o("species");e.exports=function(e){var t=n(e);a&&t&&!t[s]&&i(t,s,{configurable:!0,get:function(){return this}})}},687:(e,t,r)=>{"use strict";var n=r(4913).f,i=r(9297),o=r(8227)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!i(e,o)&&n(e,o,{configurable:!0,value:t})}},6119:(e,t,r)=>{"use strict";var n=r(5745),i=r(3392),o=n("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},7629:(e,t,r)=>{"use strict";var n=r(6395),i=r(4576),o=r(9433),a="__core-js_shared__",s=e.exports=i[a]||o(a,{});(s.versions||(s.versions=[])).push({version:"3.39.0",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(e,t,r)=>{"use strict";var n=r(7629);e.exports=function(e,t){return n[e]||(n[e]=t||{})}},2293:(e,t,r)=>{"use strict";var n=r(8551),i=r(5548),o=r(4117),a=r(8227)("species");e.exports=function(e,t){var r,s=n(e).constructor;return void 0===s||o(r=n(s)[a])?t:i(r)}},8183:(e,t,r)=>{"use strict";var n=r(9504),i=r(1291),o=r(655),a=r(7750),s=n("".charAt),u=n("".charCodeAt),c=n("".slice),l=function(e){return function(t,r){var n,l,f=o(a(t)),p=i(r),m=f.length;return p<0||p>=m?e?"":void 0:(n=u(f,p))<55296||n>56319||p+1===m||(l=u(f,p+1))<56320||l>57343?e?s(f,p):n:e?c(f,p,p+2):l-56320+(n-55296<<10)+65536}};e.exports={codeAt:l(!1),charAt:l(!0)}},4495:(e,t,r)=>{"use strict";var n=r(9519),i=r(9039),o=r(4576).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},9225:(e,t,r)=>{"use strict";var n,i,o,a,s=r(4576),u=r(8745),c=r(6080),l=r(4901),f=r(9297),p=r(9039),m=r(397),h=r(7680),d=r(4055),g=r(2812),y=r(9544),x=r(6193),b=s.setImmediate,v=s.clearImmediate,w=s.process,N=s.Dispatch,E=s.Function,A=s.MessageChannel,S=s.String,M=0,C={},T="onreadystatechange";p((function(){n=s.location}));var D=function(e){if(f(C,e)){var t=C[e];delete C[e],t()}},B=function(e){return function(){D(e)}},F=function(e){D(e.data)},O=function(e){s.postMessage(S(e),n.protocol+"//"+n.host)};b&&v||(b=function(e){g(arguments.length,1);var t=l(e)?e:E(e),r=h(arguments,1);return C[++M]=function(){u(t,void 0,r)},i(M),M},v=function(e){delete C[e]},x?i=function(e){w.nextTick(B(e))}:N&&N.now?i=function(e){N.now(B(e))}:A&&!y?(a=(o=new A).port2,o.port1.onmessage=F,i=c(a.postMessage,a)):s.addEventListener&&l(s.postMessage)&&!s.importScripts&&n&&"file:"!==n.protocol&&!p(O)?(i=O,s.addEventListener("message",F,!1)):i=T in d("script")?function(e){m.appendChild(d("script"))[T]=function(){m.removeChild(this),D(e)}}:function(e){setTimeout(B(e),0)}),e.exports={set:b,clear:v}},5610:(e,t,r)=>{"use strict";var n=r(1291),i=Math.max,o=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):o(r,t)}},5397:(e,t,r)=>{"use strict";var n=r(7055),i=r(7750);e.exports=function(e){return n(i(e))}},1291:(e,t,r)=>{"use strict";var n=r(741);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},8014:(e,t,r)=>{"use strict";var n=r(1291),i=Math.min;e.exports=function(e){var t=n(e);return t>0?i(t,9007199254740991):0}},8981:(e,t,r)=>{"use strict";var n=r(7750),i=Object;e.exports=function(e){return i(n(e))}},2777:(e,t,r)=>{"use strict";var n=r(9565),i=r(34),o=r(757),a=r(5966),s=r(4270),u=r(8227),c=TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!i(e)||o(e))return e;var r,u=a(e,l);if(u){if(void 0===t&&(t="default"),r=n(u,e,t),!i(r)||o(r))return r;throw new c("Can't convert object to primitive value")}return void 0===t&&(t="number"),s(e,t)}},6969:(e,t,r)=>{"use strict";var n=r(2777),i=r(757);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},2140:(e,t,r)=>{"use strict";var n={};n[r(8227)("toStringTag")]="z",e.exports="[object z]"===String(n)},655:(e,t,r)=>{"use strict";var n=r(6955),i=String;e.exports=function(e){if("Symbol"===n(e))throw new TypeError("Cannot convert a Symbol value to a string");return i(e)}},6823:e=>{"use strict";var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},3392:(e,t,r)=>{"use strict";var n=r(9504),i=0,o=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},7040:(e,t,r)=>{"use strict";var n=r(4495);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686:(e,t,r)=>{"use strict";var n=r(3724),i=r(9039);e.exports=n&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},2812:e=>{"use strict";var t=TypeError;e.exports=function(e,r){if(e<r)throw new t("Not enough arguments");return e}},8622:(e,t,r)=>{"use strict";var n=r(4576),i=r(4901),o=n.WeakMap;e.exports=i(o)&&/native code/.test(String(o))},8227:(e,t,r)=>{"use strict";var n=r(4576),i=r(5745),o=r(9297),a=r(3392),s=r(4495),u=r(7040),c=n.Symbol,l=i("wks"),f=u?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){return o(l,e)||(l[e]=s&&o(c,e)?c[e]:f("Symbol."+e)),l[e]}},4423:(e,t,r)=>{"use strict";var n=r(6518),i=r(9617).includes,o=r(9039),a=r(6469);n({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},2712:(e,t,r)=>{"use strict";var n=r(6518),i=r(926).left,o=r(4598),a=r(9519);n({target:"Array",proto:!0,forced:!r(6193)&&a>79&&a<83||!o("reduce")},{reduce:function(e){var t=arguments.length;return i(this,e,t,t>1?arguments[1]:void 0)}})},6910:(e,t,r)=>{"use strict";var n=r(6518),i=r(9504),o=r(9306),a=r(8981),s=r(6198),u=r(4606),c=r(655),l=r(9039),f=r(4488),p=r(4598),m=r(3709),h=r(3763),d=r(9519),g=r(3607),y=[],x=i(y.sort),b=i(y.push),v=l((function(){y.sort(void 0)})),w=l((function(){y.sort(null)})),N=p("sort"),E=!l((function(){if(d)return d<70;if(!(m&&m>3)){if(h)return!0;if(g)return g<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)y.push({k:t+n,v:r})}for(y.sort((function(e,t){return t.v-e.v})),n=0;n<y.length;n++)t=y[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));n({target:"Array",proto:!0,forced:v||!w||!N||!E},{sort:function(e){void 0!==e&&o(e);var t=a(this);if(E)return void 0===e?x(t):x(t,e);var r,n,i=[],l=s(t);for(n=0;n<l;n++)n in t&&b(i,t[n]);for(f(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:c(t)>c(r)?1:-1}}(e)),r=s(i),n=0;n<r;)t[n]=i[n++];for(;n<l;)u(t,n++);return t}})},8111:(e,t,r)=>{"use strict";var n=r(6518),i=r(4576),o=r(679),a=r(8551),s=r(4901),u=r(2787),c=r(2106),l=r(4659),f=r(9039),p=r(9297),m=r(8227),h=r(7657).IteratorPrototype,d=r(3724),g=r(6395),y="constructor",x="Iterator",b=m("toStringTag"),v=TypeError,w=i[x],N=g||!s(w)||w.prototype!==h||!f((function(){w({})})),E=function(){if(o(this,h),u(this)===h)throw new v("Abstract class Iterator not directly constructable")},A=function(e,t){d?c(h,e,{configurable:!0,get:function(){return t},set:function(t){if(a(this),this===h)throw new v("You can't redefine this property");p(this,e)?this[e]=t:l(this,e,t)}}):h[e]=t};p(h,b)||A(b,x),!N&&p(h,y)&&h[y]!==Object||A(y,E),E.prototype=h,n({global:!0,constructor:!0,forced:N},{Iterator:E})},1148:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{every:function(e){a(this),o(e);var t=s(this),r=0;return!i(t,(function(t,n){if(!e(t,r++))return n()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:(e,t,r)=>{"use strict";var n=r(6518),i=r(9565),o=r(9306),a=r(8551),s=r(1767),u=r(9462),c=r(6319),l=r(6395),f=u((function(){for(var e,t,r=this.iterator,n=this.predicate,o=this.next;;){if(e=a(i(o,r)),this.done=!!e.done)return;if(t=e.value,c(r,n,[t,this.counter++],!0))return t}}));n({target:"Iterator",proto:!0,real:!0,forced:l},{filter:function(e){return a(this),o(e),new f(s(this),{predicate:e})}})},116:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{find:function(e){a(this),o(e);var t=s(this),r=0;return i(t,(function(t,n){if(e(t,r++))return n(t)}),{IS_RECORD:!0,INTERRUPTED:!0}).result}})},7588:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{forEach:function(e){a(this),o(e);var t=s(this),r=0;i(t,(function(t){e(t,r++)}),{IS_RECORD:!0})}})},1701:(e,t,r)=>{"use strict";var n=r(6518),i=r(713);n({target:"Iterator",proto:!0,real:!0,forced:r(6395)},{map:i})},8237:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767),u=TypeError;n({target:"Iterator",proto:!0,real:!0},{reduce:function(e){a(this),o(e);var t=s(this),r=arguments.length<2,n=r?void 0:arguments[1],c=0;if(i(t,(function(t){r?(r=!1,n=t):n=e(n,t,c),c++}),{IS_RECORD:!0}),r)throw new u("Reduce of empty iterator with no initial value");return n}})},3579:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(9306),a=r(8551),s=r(1767);n({target:"Iterator",proto:!0,real:!0},{some:function(e){a(this),o(e);var t=s(this),r=0;return i(t,(function(t,n){if(e(t,r++))return n()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1806:(e,t,r)=>{"use strict";var n=r(6518),i=r(8551),o=r(2652),a=r(1767),s=[].push;n({target:"Iterator",proto:!0,real:!0},{toArray:function(){var e=[];return o(a(i(this)),s,{that:e,IS_RECORD:!0}),e}})},3110:(e,t,r)=>{"use strict";var n=r(6518),i=r(7751),o=r(8745),a=r(9565),s=r(9504),u=r(9039),c=r(4901),l=r(757),f=r(7680),p=r(6933),m=r(4495),h=String,d=i("JSON","stringify"),g=s(/./.exec),y=s("".charAt),x=s("".charCodeAt),b=s("".replace),v=s(1..toString),w=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,E=/^[\uDC00-\uDFFF]$/,A=!m||u((function(){var e=i("Symbol")("stringify detection");return"[null]"!==d([e])||"{}"!==d({a:e})||"{}"!==d(Object(e))})),S=u((function(){return'"\\udf06\\ud834"'!==d("\udf06\ud834")||'"\\udead"'!==d("\udead")})),M=function(e,t){var r=f(arguments),n=p(t);if(c(n)||void 0!==e&&!l(e))return r[1]=function(e,t){if(c(n)&&(t=a(n,this,h(e),t)),!l(t))return t},o(d,null,r)},C=function(e,t,r){var n=y(r,t-1),i=y(r,t+1);return g(N,e)&&!g(E,i)||g(E,e)&&!g(N,n)?"\\u"+v(x(e,0),16):e};d&&n({target:"JSON",stat:!0,arity:3,forced:A||S},{stringify:function(e,t,r){var n=f(arguments),i=o(A?M:d,null,n);return S&&"string"==typeof i?b(i,w,C):i}})},3921:(e,t,r)=>{"use strict";var n=r(6518),i=r(2652),o=r(4659);n({target:"Object",stat:!0},{fromEntries:function(e){var t={};return i(e,(function(e,r){o(t,e,r)}),{AS_ENTRIES:!0}),t}})},6499:(e,t,r)=>{"use strict";var n=r(6518),i=r(9565),o=r(9306),a=r(6043),s=r(1103),u=r(2652);n({target:"Promise",stat:!0,forced:r(537)},{all:function(e){var t=this,r=a.f(t),n=r.resolve,c=r.reject,l=s((function(){var r=o(t.resolve),a=[],s=0,l=1;u(e,(function(e){var o=s++,u=!1;l++,i(r,t,e).then((function(e){u||(u=!0,a[o]=e,--l||n(a))}),c)})),--l||n(a)}));return l.error&&c(l.value),r.promise}})},2003:(e,t,r)=>{"use strict";var n=r(6518),i=r(6395),o=r(916).CONSTRUCTOR,a=r(550),s=r(7751),u=r(4901),c=r(6840),l=a&&a.prototype;if(n({target:"Promise",proto:!0,forced:o,real:!0},{catch:function(e){return this.then(void 0,e)}}),!i&&u(a)){var f=s("Promise").prototype.catch;l.catch!==f&&c(l,"catch",f,{unsafe:!0})}},436:(e,t,r)=>{"use strict";var n,i,o,a=r(6518),s=r(6395),u=r(6193),c=r(4576),l=r(9565),f=r(6840),p=r(2967),m=r(687),h=r(7633),d=r(9306),g=r(4901),y=r(34),x=r(679),b=r(2293),v=r(9225).set,w=r(1955),N=r(3138),E=r(1103),A=r(8265),S=r(1181),M=r(550),C=r(916),T=r(6043),D="Promise",B=C.CONSTRUCTOR,F=C.REJECTION_EVENT,O=C.SUBCLASSING,_=S.getterFor(D),I=S.set,z=M&&M.prototype,k=M,R=z,q=c.TypeError,P=c.document,j=c.process,U=T.f,L=U,$=!!(P&&P.createEvent&&c.dispatchEvent),H="unhandledrejection",G=function(e){var t;return!(!y(e)||!g(t=e.then))&&t},V=function(e,t){var r,n,i,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,f=e.domain;try{s?(a||(2===t.rejection&&X(t),t.rejection=1),!0===s?r=o:(f&&f.enter(),r=s(o),f&&(f.exit(),i=!0)),r===e.promise?c(new q("Promise-chain cycle")):(n=G(r))?l(n,r,u,c):u(r)):c(o)}catch(e){f&&!i&&f.exit(),c(e)}},W=function(e,t){e.notified||(e.notified=!0,w((function(){for(var r,n=e.reactions;r=n.get();)V(r,e);e.notified=!1,t&&!e.rejection&&Y(e)})))},Z=function(e,t,r){var n,i;$?((n=P.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),c.dispatchEvent(n)):n={promise:t,reason:r},!F&&(i=c["on"+e])?i(n):e===H&&N("Unhandled promise rejection",r)},Y=function(e){l(v,c,(function(){var t,r=e.facade,n=e.value;if(J(e)&&(t=E((function(){u?j.emit("unhandledRejection",n,r):Z(H,r,n)})),e.rejection=u||J(e)?2:1,t.error))throw t.value}))},J=function(e){return 1!==e.rejection&&!e.parent},X=function(e){l(v,c,(function(){var t=e.facade;u?j.emit("rejectionHandled",t):Z("rejectionhandled",t,e.value)}))},Q=function(e,t,r){return function(n){e(t,n,r)}},K=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,W(e,!0))},ee=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new q("Promise can't be resolved itself");var n=G(t);n?w((function(){var r={done:!1};try{l(n,t,Q(ee,r,e),Q(K,r,e))}catch(t){K(r,t,e)}})):(e.value=t,e.state=1,W(e,!1))}catch(t){K({done:!1},t,e)}}};if(B&&(R=(k=function(e){x(this,R),d(e),l(n,this);var t=_(this);try{e(Q(ee,t),Q(K,t))}catch(e){K(t,e)}}).prototype,(n=function(e){I(this,{type:D,done:!1,notified:!1,parent:!1,reactions:new A,rejection:!1,state:0,value:null})}).prototype=f(R,"then",(function(e,t){var r=_(this),n=U(b(this,k));return r.parent=!0,n.ok=!g(e)||e,n.fail=g(t)&&t,n.domain=u?j.domain:void 0,0===r.state?r.reactions.add(n):w((function(){V(n,r)})),n.promise})),i=function(){var e=new n,t=_(e);this.promise=e,this.resolve=Q(ee,t),this.reject=Q(K,t)},T.f=U=function(e){return e===k||void 0===e?new i(e):L(e)},!s&&g(M)&&z!==Object.prototype)){o=z.then,O||f(z,"then",(function(e,t){var r=this;return new k((function(e,t){l(o,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete z.constructor}catch(e){}p&&p(z,R)}a({global:!0,constructor:!0,wrap:!0,forced:B},{Promise:k}),m(k,D,!1,!0),h(D)},3362:(e,t,r)=>{"use strict";r(436),r(6499),r(2003),r(7743),r(1481),r(280)},7743:(e,t,r)=>{"use strict";var n=r(6518),i=r(9565),o=r(9306),a=r(6043),s=r(1103),u=r(2652);n({target:"Promise",stat:!0,forced:r(537)},{race:function(e){var t=this,r=a.f(t),n=r.reject,c=s((function(){var a=o(t.resolve);u(e,(function(e){i(a,t,e).then(r.resolve,n)}))}));return c.error&&n(c.value),r.promise}})},1481:(e,t,r)=>{"use strict";var n=r(6518),i=r(6043);n({target:"Promise",stat:!0,forced:r(916).CONSTRUCTOR},{reject:function(e){var t=i.f(this);return(0,t.reject)(e),t.promise}})},280:(e,t,r)=>{"use strict";var n=r(6518),i=r(7751),o=r(6395),a=r(550),s=r(916).CONSTRUCTOR,u=r(3438),c=i("Promise"),l=o&&!s;n({target:"Promise",stat:!0,forced:o||s},{resolve:function(e){return u(l&&this===c?a:this,e)}})},4864:(e,t,r)=>{"use strict";var n=r(3724),i=r(4576),o=r(9504),a=r(2796),s=r(3167),u=r(6699),c=r(2360),l=r(8480).f,f=r(1625),p=r(788),m=r(655),h=r(1034),d=r(8429),g=r(1056),y=r(6840),x=r(9039),b=r(9297),v=r(1181).enforce,w=r(7633),N=r(8227),E=r(3635),A=r(8814),S=N("match"),M=i.RegExp,C=M.prototype,T=i.SyntaxError,D=o(C.exec),B=o("".charAt),F=o("".replace),O=o("".indexOf),_=o("".slice),I=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,z=/a/g,k=/a/g,R=new M(z)!==z,q=d.MISSED_STICKY,P=d.UNSUPPORTED_Y;if(a("RegExp",n&&(!R||q||E||A||x((function(){return k[S]=!1,M(z)!==z||M(k)===k||"/a/i"!==String(M(z,"i"))}))))){for(var j=function(e,t){var r,n,i,o,a,l,d=f(C,this),g=p(e),y=void 0===t,x=[],w=e;if(!d&&g&&y&&e.constructor===j)return e;if((g||f(C,e))&&(e=e.source,y&&(t=h(w))),e=void 0===e?"":m(e),t=void 0===t?"":m(t),w=e,E&&"dotAll"in z&&(n=!!t&&O(t,"s")>-1)&&(t=F(t,/s/g,"")),r=t,q&&"sticky"in z&&(i=!!t&&O(t,"y")>-1)&&P&&(t=F(t,/y/g,"")),A&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a=c(null),s=!1,u=!1,l=0,f="";n<=r;n++){if("\\"===(t=B(e,n)))t+=B(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:if(i+=t,"?:"===_(e,n+1,n+3))continue;D(I,_(e,n+1))&&(n+=2,u=!0),l++;continue;case">"===t&&u:if(""===f||b(a,f))throw new T("Invalid capture group name");a[f]=!0,o[o.length]=[f,l],u=!1,f="";continue}u?f+=t:i+=t}return[i,o]}(e),e=o[0],x=o[1]),a=s(M(e,t),d?this:C,j),(n||i||x.length)&&(l=v(a),n&&(l.dotAll=!0,l.raw=j(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=B(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+B(e,++n);return i}(e),r)),i&&(l.sticky=!0),x.length&&(l.groups=x)),e!==w)try{u(a,"source",""===w?"(?:)":w)}catch(e){}return a},U=l(M),L=0;U.length>L;)g(j,M,U[L++]);C.constructor=j,j.prototype=C,y(i,"RegExp",j,{constructor:!0})}w("RegExp")},7465:(e,t,r)=>{"use strict";var n=r(3724),i=r(3635),o=r(2195),a=r(2106),s=r(1181).get,u=RegExp.prototype,c=TypeError;n&&i&&a(u,"dotAll",{configurable:!0,get:function(){if(this!==u){if("RegExp"===o(this))return!!s(this).dotAll;throw new c("Incompatible receiver, RegExp required")}}})},7495:(e,t,r)=>{"use strict";var n=r(6518),i=r(7323);n({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},5440:(e,t,r)=>{"use strict";var n=r(8745),i=r(9565),o=r(9504),a=r(9228),s=r(9039),u=r(8551),c=r(4901),l=r(4117),f=r(1291),p=r(8014),m=r(655),h=r(7750),d=r(7829),g=r(5966),y=r(2478),x=r(6682),b=r(8227)("replace"),v=Math.max,w=Math.min,N=o([].concat),E=o([].push),A=o("".indexOf),S=o("".slice),M="$0"==="a".replace(/./,"$0"),C=!!/./[b]&&""===/./[b]("a","$0");a("replace",(function(e,t,r){var o=C?"$":"$0";return[function(e,r){var n=h(this),o=l(e)?void 0:g(e,b);return o?i(o,e,n,r):i(t,m(n),e,r)},function(e,i){var a=u(this),s=m(e);if("string"==typeof i&&-1===A(i,o)&&-1===A(i,"$<")){var l=r(t,a,s,i);if(l.done)return l.value}var h=c(i);h||(i=m(i));var g,b=a.global;b&&(g=a.unicode,a.lastIndex=0);for(var M,C=[];null!==(M=x(a,s))&&(E(C,M),b);)""===m(M[0])&&(a.lastIndex=d(s,p(a.lastIndex),g));for(var T,D="",B=0,F=0;F<C.length;F++){for(var O,_=m((M=C[F])[0]),I=v(w(f(M.index),s.length),0),z=[],k=1;k<M.length;k++)E(z,void 0===(T=M[k])?T:String(T));var R=M.groups;if(h){var q=N([_],z,I,s);void 0!==R&&E(q,R),O=m(n(i,void 0,q))}else O=y(_,s,I,z,R,i);I>=B&&(D+=S(s,B,I)+O,B=I+_.length)}return D+S(s,B)}]}),!!s((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!M||C)},9463:(e,t,r)=>{"use strict";var n=r(6518),i=r(3724),o=r(4576),a=r(9504),s=r(9297),u=r(4901),c=r(1625),l=r(655),f=r(2106),p=r(7740),m=o.Symbol,h=m&&m.prototype;if(i&&u(m)&&(!("description"in h)||void 0!==m().description)){var d={},g=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:l(arguments[0]),t=c(h,this)?new m(e):void 0===e?m():m(e);return""===e&&(d[t]=!0),t};p(g,m),g.prototype=h,h.constructor=g;var y="Symbol(description detection)"===String(m("description detection")),x=a(h.valueOf),b=a(h.toString),v=/^Symbol\((.*)\)[^)]+$/,w=a("".replace),N=a("".slice);f(h,"description",{configurable:!0,get:function(){var e=x(this);if(s(d,e))return"";var t=b(e),r=y?N(t,7,-1):w(t,v,"$1");return""===r?void 0:r}}),n({global:!0,constructor:!0,forced:!0},{Symbol:g})}},8992:(e,t,r)=>{"use strict";r(8111)},3215:(e,t,r)=>{"use strict";r(1148)},4520:(e,t,r)=>{"use strict";r(2489)},2577:(e,t,r)=>{"use strict";r(116)},3949:(e,t,r)=>{"use strict";r(7588)},1454:(e,t,r)=>{"use strict";r(1701)},8872:(e,t,r)=>{"use strict";r(8237)},7550:(e,t,r)=>{"use strict";r(3579)},1795:(e,t,r)=>{"use strict";r(1806)},2369:function(e){e.exports=function(){"use strict";function e(){return!0}function t(){return!1}function r(){}const n="Argument is not a typed-function.";return function i(){function o(e){return"object"==typeof e&&null!==e&&e.constructor===Object}const a=[{name:"number",test:function(e){return"number"==typeof e}},{name:"string",test:function(e){return"string"==typeof e}},{name:"boolean",test:function(e){return"boolean"==typeof e}},{name:"Function",test:function(e){return"function"==typeof e}},{name:"Array",test:Array.isArray},{name:"Date",test:function(e){return e instanceof Date}},{name:"RegExp",test:function(e){return e instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(e){return null===e}},{name:"undefined",test:function(e){return void 0===e}}],s={name:"any",test:e,isAny:!0};let u,c,l=0,f={createCount:0};function p(e){const t=u.get(e);if(t)return t;let r='Unknown type "'+e+'"';const n=e.toLowerCase();let i;for(i of c)if(i.toLowerCase()===n){r+='. Did you mean "'+i+'" ?';break}throw new TypeError(r)}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any";const r=t?p(t).index:c.length,n=[];for(let t=0;t<e.length;++t){if(!e[t]||"string"!=typeof e[t].name||"function"!=typeof e[t].test)throw new TypeError("Object with properties {name: string, test: function} expected");const i=e[t].name;if(u.has(i))throw new TypeError('Duplicate type name "'+i+'"');n.push(i),u.set(i,{name:i,test:e[t].test,isAny:e[t].isAny,index:r+t,conversionsTo:[]})}const i=c.slice(r);c=c.slice(0,r).concat(n).concat(i);for(let e=r+n.length;e<c.length;++e)u.get(c[e]).index=e}function h(){u=new Map,c=[],l=0,m([s],!1)}function d(e){const t=c.filter((t=>{const r=u.get(t);return!r.isAny&&r.test(e)}));return t.length?t:["any"]}function g(e){return e&&"function"==typeof e&&"_typedFunctionData"in e}function y(e,t,r){if(!g(e))throw new TypeError(n);const i=r&&r.exact,o=N(Array.isArray(t)?t.join(","):t),a=x(o);if(!i||a in e.signatures){const t=e._typedFunctionData.signatureMap.get(a);if(t)return t}const s=o.length;let u,c;if(i){let t;for(t in u=[],e.signatures)u.push(e._typedFunctionData.signatureMap.get(t))}else u=e._typedFunctionData.signatures;for(let e=0;e<s;++e){const t=o[e],r=[];let n;for(n of u){const i=M(n.params,e);if(i&&(!t.restParam||i.restParam)){if(!i.hasAny){const e=w(i);if(t.types.some((t=>!e.has(t.name))))continue}r.push(n)}}if(u=r,0===u.length)break}for(c of u)if(c.params.length<=s)return c;throw new TypeError("Signature not found (signature: "+(e.name||"unnamed")+"("+x(o,", ")+"))")}function x(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return e.map((e=>e.name)).join(t)}function b(e){const t=0===e.indexOf("..."),r=(t?e.length>3?e.slice(3):"any":e).split("|").map((e=>p(e.trim())));let n=!1,i=t?"...":"";return{types:r.map((function(e){return n=e.isAny||n,i+=e.name+"|",{name:e.name,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:null,conversionIndex:-1}})),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:t}}function v(e){const t=function(e){if(0===e.length)return[];const t=e.map(p);e.length>1&&t.sort(((e,t)=>e.index-t.index));let r=t[0].conversionsTo;if(1===e.length)return r;r=r.concat([]);const n=new Set(e);for(let e=1;e<t.length;++e){let i;for(i of t[e].conversionsTo)n.has(i.from)||(r.push(i),n.add(i.from))}return r}(e.types.map((e=>e.name)));let r=e.hasAny,n=e.name;const i=t.map((function(e){const t=p(e.from);return r=t.isAny||r,n+="|"+e.from,{name:e.from,typeIndex:t.index,test:t.test,isAny:t.isAny,conversion:e,conversionIndex:e.index}}));return{types:e.types.concat(i),name:n,hasAny:r,hasConversion:i.length>0,restParam:e.restParam}}function w(e){return e.typeSet||(e.typeSet=new Set,e.types.forEach((t=>e.typeSet.add(t.name)))),e.typeSet}function N(e){const t=[];if("string"!=typeof e)throw new TypeError("Signatures must be strings");const r=e.trim();if(""===r)return t;const n=r.split(",");for(let e=0;e<n.length;++e){const r=b(n[e].trim());if(r.restParam&&e!==n.length-1)throw new SyntaxError('Unexpected rest parameter "'+n[e]+'": only allowed for the last parameter');if(0===r.types.length)return null;t.push(r)}return t}function E(e){const t=H(e);return!!t&&t.restParam}function A(t){if(t&&0!==t.types.length){if(1===t.types.length)return p(t.types[0].name).test;if(2===t.types.length){const e=p(t.types[0].name).test,r=p(t.types[1].name).test;return function(t){return e(t)||r(t)}}{const e=t.types.map((function(e){return p(e.name).test}));return function(t){for(let r=0;r<e.length;r++)if(e[r](t))return!0;return!1}}}return e}function S(e){let t,r,n;if(E(e)){t=$(e).map(A);const r=t.length,n=A(H(e)),i=function(e){for(let t=r;t<e.length;t++)if(!n(e[t]))return!1;return!0};return function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return i(e)&&e.length>=r+1}}return 0===e.length?function(e){return 0===e.length}:1===e.length?(r=A(e[0]),function(e){return r(e[0])&&1===e.length}):2===e.length?(r=A(e[0]),n=A(e[1]),function(e){return r(e[0])&&n(e[1])&&2===e.length}):(t=e.map(A),function(e){for(let r=0;r<t.length;r++)if(!t[r](e[r]))return!1;return e.length===t.length})}function M(e,t){return t<e.length?e[t]:E(e)?H(e):null}function C(e,t){const r=M(e,t);return r?w(r):new Set}function T(e){return null===e.conversion||void 0===e.conversion}function D(e,t){const r=new Set;return e.forEach((e=>{const n=C(e.params,t);let i;for(i of n)r.add(i)})),r.has("any")?["any"]:Array.from(r)}function B(e,t,r){let n,i;const o=e||"unnamed";let a,s=r;for(a=0;a<t.length;a++){const e=[];if(s.forEach((r=>{const n=A(M(r.params,a));(a<r.params.length||E(r.params))&&n(t[a])&&e.push(r)})),0===e.length){if(i=D(s,a),i.length>0){const e=d(t[a]);return n=new TypeError("Unexpected type of argument in function "+o+" (expected: "+i.join(" or ")+", actual: "+e.join(" | ")+", index: "+a+")"),n.data={category:"wrongType",fn:o,index:a,actual:e,expected:i},n}}else s=e}const u=s.map((function(e){return E(e.params)?1/0:e.params.length}));if(t.length<Math.min.apply(null,u))return i=D(s,a),n=new TypeError("Too few arguments in function "+o+" (expected: "+i.join(" or ")+", index: "+t.length+")"),n.data={category:"tooFewArgs",fn:o,index:t.length,expected:i},n;const c=Math.max.apply(null,u);if(t.length>c)return n=new TypeError("Too many arguments in function "+o+" (expected: "+c+", actual: "+t.length+")"),n.data={category:"tooManyArgs",fn:o,index:t.length,expectedLength:c},n;const l=[];for(let e=0;e<t.length;++e)l.push(d(t[e]).join("|"));return n=new TypeError('Arguments of type "'+l.join(", ")+'" do not match any of the defined signatures of function '+o+"."),n.data={category:"mismatch",actual:l},n}function F(e){let t=c.length+1;for(let r=0;r<e.types.length;r++)T(e.types[r])&&(t=Math.min(t,e.types[r].typeIndex));return t}function O(e){let t=l+1;for(let r=0;r<e.types.length;r++)T(e.types[r])||(t=Math.min(t,e.types[r].conversionIndex));return t}function _(e,t){if(e.hasAny){if(!t.hasAny)return 1}else if(t.hasAny)return-1;if(e.restParam){if(!t.restParam)return 1}else if(t.restParam)return-1;if(e.hasConversion){if(!t.hasConversion)return 1}else if(t.hasConversion)return-1;const r=F(e)-F(t);if(r<0)return-1;if(r>0)return 1;const n=O(e)-O(t);return n<0?-1:n>0?1:0}function I(e,t){const r=e.params,n=t.params,i=H(r),o=H(n),a=E(r),s=E(n);if(a&&i.hasAny){if(!s||!o.hasAny)return 1}else if(s&&o.hasAny)return-1;let u,c=0,l=0;for(u of r)u.hasAny&&++c,u.hasConversion&&++l;let f=0,p=0;for(u of n)u.hasAny&&++f,u.hasConversion&&++p;if(c!==f)return c-f;if(a&&i.hasConversion){if(!s||!o.hasConversion)return 1}else if(s&&o.hasConversion)return-1;if(l!==p)return l-p;if(a){if(!s)return 1}else if(s)return-1;const m=(r.length-n.length)*(a?-1:1);if(0!==m)return m;const h=[];let d,g=0;for(let e=0;e<r.length;++e){const t=_(r[e],n[e]);h.push(t),g+=t}if(0!==g)return g;for(d of h)if(0!==d)return d;return 0}function z(e,t){let r=t;if(e.some((e=>e.hasConversion))){const n=E(e),i=e.map(k);r=function(){const e=[],r=n?arguments.length-1:arguments.length;for(let t=0;t<r;t++)e[t]=i[t](arguments[t]);return n&&(e[r]=arguments[r].map(i[r])),t.apply(this,e)}}let n=r;if(E(e)){const t=e.length-1;n=function(){return r.apply(this,G(arguments,0,t).concat([G(arguments,t)]))}}return n}function k(e){let t,r,n,i;const o=[],a=[];switch(e.types.forEach((function(e){e.conversion&&(o.push(p(e.conversion.from).test),a.push(e.conversion.convert))})),a.length){case 0:return function(e){return e};case 1:return t=o[0],n=a[0],function(e){return t(e)?n(e):e};case 2:return t=o[0],r=o[1],n=a[0],i=a[1],function(e){return t(e)?n(e):r(e)?i(e):e};default:return function(e){for(let t=0;t<a.length;t++)if(o[t](e))return a[t](e);return e}}}function R(e){return function e(t,r,n){if(r<t.length){const a=t[r];let s=[];if(a.restParam){const e=a.types.filter(T);e.length<a.types.length&&s.push({types:e,name:"..."+e.map((e=>e.name)).join("|"),hasAny:e.some((e=>e.isAny)),hasConversion:!1,restParam:!0}),s.push(a)}else s=a.types.map((function(e){return{types:[e],name:e.name,hasAny:e.isAny,hasConversion:e.conversion,restParam:!1}}));return i=s,o=function(i){return e(t,r+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(o))}var i,o;return[n]}(e,0,[])}function q(e,t){const r=Math.max(e.length,t.length);for(let n=0;n<r;n++){const r=C(e,n),i=C(t,n);let o,a=!1;for(o of i)if(r.has(o)){a=!0;break}if(!a)return!1}const n=e.length,i=t.length,o=E(e),a=E(t);return o?a?n===i:i>=n:a?n>=i:n===i}function P(e,t,r){const n=[];let i;for(i of e){let e=r[i];if("number"!=typeof e)throw new TypeError('No definition for referenced signature "'+i+'"');if(e=t[e],"function"!=typeof e)return!1;n.push(e)}return n}function j(e,t,r){const n=function(e){return e.map((e=>Y(e)?W(e.referToSelf.callback):Z(e)?V(e.referTo.references,e.referTo.callback):e))}(e),i=new Array(n.length).fill(!1);let o=!0;for(;o;){o=!1;let e=!0;for(let a=0;a<n.length;++a){if(i[a])continue;const s=n[a];if(Y(s))n[a]=s.referToSelf.callback(r),n[a].referToSelf=s.referToSelf,i[a]=!0,e=!1;else if(Z(s)){const r=P(s.referTo.references,n,t);r?(n[a]=s.referTo.callback.apply(this,r),n[a].referTo=s.referTo,i[a]=!0,e=!1):o=!0}}if(e&&o)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return n}function U(e,n){if(f.createCount++,0===Object.keys(n).length)throw new SyntaxError("No signatures provided");f.warnAgainstDeprecatedThis&&function(e){const t=/\bthis(\(|\.signatures\b)/;Object.keys(e).forEach((r=>{const n=e[r];if(t.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.")}))}(n);const i=[],o=[],a={},s=[];let u;for(u in n){if(!Object.prototype.hasOwnProperty.call(n,u))continue;const e=N(u);if(!e)continue;i.forEach((function(t){if(q(t,e))throw new TypeError('Conflicting signatures "'+x(t)+'" and "'+x(e)+'".')})),i.push(e);const t=o.length;o.push(n[u]);const r=e.map(v);let c;for(c of R(r)){const e=x(c);s.push({params:c,name:e,fn:t}),c.every((e=>!e.hasConversion))&&(a[e]=t)}}s.sort(I);const c=j(o,a,se);let l;for(l in a)Object.prototype.hasOwnProperty.call(a,l)&&(a[l]=c[a[l]]);const p=[],m=new Map;for(l of s)m.has(l.name)||(l.fn=c[l.fn],p.push(l),m.set(l.name,l));const h=p[0]&&p[0].params.length<=2&&!E(p[0].params),d=p[1]&&p[1].params.length<=2&&!E(p[1].params),g=p[2]&&p[2].params.length<=2&&!E(p[2].params),y=p[3]&&p[3].params.length<=2&&!E(p[3].params),b=p[4]&&p[4].params.length<=2&&!E(p[4].params),w=p[5]&&p[5].params.length<=2&&!E(p[5].params),M=h&&d&&g&&y&&b&&w;for(let e=0;e<p.length;++e)p[e].test=S(p[e].params);const C=h?A(p[0].params[0]):t,T=d?A(p[1].params[0]):t,D=g?A(p[2].params[0]):t,B=y?A(p[3].params[0]):t,F=b?A(p[4].params[0]):t,O=w?A(p[5].params[0]):t,_=h?A(p[0].params[1]):t,k=d?A(p[1].params[1]):t,P=g?A(p[2].params[1]):t,U=y?A(p[3].params[1]):t,L=b?A(p[4].params[1]):t,$=w?A(p[5].params[1]):t;for(let e=0;e<p.length;++e)p[e].implementation=z(p[e].params,p[e].fn);const H=h?p[0].implementation:r,G=d?p[1].implementation:r,V=g?p[2].implementation:r,W=y?p[3].implementation:r,Z=b?p[4].implementation:r,Y=w?p[5].implementation:r,J=h?p[0].params.length:-1,X=d?p[1].params.length:-1,Q=g?p[2].params.length:-1,K=y?p[3].params.length:-1,ee=b?p[4].params.length:-1,te=w?p[5].params.length:-1,re=M?6:0,ne=p.length,ie=p.map((e=>e.test)),oe=p.map((e=>e.implementation)),ae=function(){for(let e=re;e<ne;e++)if(ie[e](arguments))return oe[e].apply(this,arguments);return f.onMismatch(e,arguments,p)};function se(e,t){return arguments.length===J&&C(e)&&_(t)?H.apply(this,arguments):arguments.length===X&&T(e)&&k(t)?G.apply(this,arguments):arguments.length===Q&&D(e)&&P(t)?V.apply(this,arguments):arguments.length===K&&B(e)&&U(t)?W.apply(this,arguments):arguments.length===ee&&F(e)&&L(t)?Z.apply(this,arguments):arguments.length===te&&O(e)&&$(t)?Y.apply(this,arguments):ae.apply(this,arguments)}try{Object.defineProperty(se,"name",{value:e})}catch(e){}return se.signatures=a,se._typedFunctionData={signatures:p,signatureMap:m},se}function L(e,t,r){throw B(e,t,r)}function $(e){return G(e,0,e.length-1)}function H(e){return e[e.length-1]}function G(e,t,r){return Array.prototype.slice.call(e,t,r)}function V(e,t){return{referTo:{references:e,callback:t}}}function W(e){if("function"!=typeof e)throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:e}}}function Z(e){return e&&"object"==typeof e.referTo&&Array.isArray(e.referTo.references)&&"function"==typeof e.referTo.callback}function Y(e){return e&&"object"==typeof e.referToSelf&&"function"==typeof e.referToSelf.callback}function J(e,t){if(!e)return t;if(t&&t!==e){const r=new Error("Function names do not match (expected: "+e+", actual: "+t+")");throw r.data={actual:t,expected:e},r}return e}function X(e){let t;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(g(e[r])||"string"==typeof e[r].signature)&&(t=J(t,e[r].name));return t}function Q(e,t){let r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(r in e&&t[r]!==e[r]){const n=new Error('Signature "'+r+'" is defined twice');throw n.data={signature:r,sourceFunction:t[r],destFunction:e[r]},n}e[r]=t[r]}}h(),m(a);const K=f;function ee(e){if(!e||"string"!=typeof e.from||"string"!=typeof e.to||"function"!=typeof e.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(e.to===e.from)throw new SyntaxError('Illegal to define conversion from "'+e.from+'" to itself.')}return f=function(e){const t="string"==typeof e;let r=t?e:"";const n={};for(let e=t?1:0;e<arguments.length;++e){const i=arguments[e];let a,s={};if("function"==typeof i?(a=i.name,"string"==typeof i.signature?s[i.signature]=i:g(i)&&(s=i.signatures)):o(i)&&(s=i,t||(a=X(i))),0===Object.keys(s).length){const t=new TypeError("Argument to 'typed' at index "+e+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw t.data={index:e,argument:i},t}t||(r=J(r,a)),Q(n,s)}return U(r||"",n)},f.create=i,f.createCount=K.createCount,f.onMismatch=L,f.throwMismatchError=L,f.createError=B,f.clear=h,f.clearConversions=function(){let e;for(e of c)u.get(e).conversionsTo=[];l=0},f.addTypes=m,f._findType=p,f.referTo=function(){const e=$(arguments).map((e=>x(N(e)))),t=H(arguments);if("function"!=typeof t)throw new TypeError("Callback function expected as last argument");return V(e,t)},f.referToSelf=W,f.convert=function(e,t){const r=p(t);if(r.test(e))return e;const n=r.conversionsTo;if(0===n.length)throw new Error("There are no conversions to "+t+" defined.");for(let t=0;t<n.length;t++)if(p(n[t].from).test(e))return n[t].convert(e);throw new Error("Cannot convert "+e+" to "+t)},f.findSignature=y,f.find=function(e,t,r){return y(e,t,r).implementation},f.isTypedFunction=g,f.warnAgainstDeprecatedThis=!0,f.addType=function(e,t){let r="any";!1!==t&&u.has("Object")&&(r="Object"),f.addTypes([e],r)},f.addConversion=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{override:!1};ee(e);const r=p(e.to),n=r.conversionsTo.find((t=>t.from===e.from));if(n){if(!t||!t.override)throw new Error('There is already a conversion from "'+e.from+'" to "'+r.name+'"');f.removeConversion({from:n.from,to:e.to,convert:n.convert})}r.conversionsTo.push({from:e.from,convert:e.convert,index:l++})},f.addConversions=function(e,t){e.forEach((e=>f.addConversion(e,t)))},f.removeConversion=function(e){ee(e);const t=p(e.to),r=function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return e[r]}(t.conversionsTo,(t=>t.from===e.from));if(!r)throw new Error("Attempt to remove nonexistent conversion from "+e.from+" to "+e.to);if(r.convert!==e.convert)throw new Error("Conversion to remove does not match existing conversion");const n=t.conversionsTo.indexOf(r);t.conversionsTo.splice(n,1)},f.resolve=function(e,t){if(!g(e))throw new TypeError(n);const r=e._typedFunctionData.signatures;for(let e=0;e<r.length;++e)if(r[e].test(t))return r[e];return null},f}()}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}r.amdD=function(){throw new Error("define cannot be used indirect")},r.amdO={},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};return(()=>{"use strict";r.d(n,{default:()=>Xy});var e={};r.r(e),r.d(e,{createAbs:()=>Ao,createAccessorNode:()=>Mp,createAcos:()=>Pl,createAcosh:()=>of,createAcot:()=>sf,createAcoth:()=>cf,createAcsc:()=>ff,createAcsch:()=>mf,createAdd:()=>lp,createAddScalar:()=>Do,createAnd:()=>zc,createAndTransform:()=>Uy,createApply:()=>Mo,createApplyTransform:()=>py,createArg:()=>fs,createArrayNode:()=>Tp,createAsec:()=>df,createAsech:()=>yf,createAsin:()=>bf,createAsinh:()=>vf,createAssignmentNode:()=>zp,createAtan:()=>wf,createAtan2:()=>Ef,createAtanh:()=>Sf,createAtomicMass:()=>$g,createAvogadro:()=>Hg,createBellNumbers:()=>xd,createBigNumberClass:()=>Fr,createBigint:()=>Ii,createBignumber:()=>Pi,createBin:()=>Vu,createBitAnd:()=>ns,createBitAndTransform:()=>$y,createBitNot:()=>os,createBitOr:()=>ss,createBitOrTransform:()=>Hy,createBitXor:()=>ls,createBlockNode:()=>Rp,createBohrMagneton:()=>Eg,createBohrRadius:()=>Dg,createBoltzmann:()=>Gg,createBoolean:()=>qi,createCatalan:()=>vd,createCbrt:()=>_o,createCeil:()=>jo,createChain:()=>Jm,createChainClass:()=>$m,createClassicalElectronRadius:()=>Bg,createClone:()=>ei,createColumn:()=>Cs,createColumnTransform:()=>my,createCombinations:()=>zh,createCombinationsWithRep:()=>qh,createCompare:()=>Rc,createCompareNatural:()=>Uc,createCompareText:()=>Hc,createCompile:()=>gm,createComplex:()=>ji,createComplexClass:()=>jr,createComposition:()=>Nd,createConcat:()=>Ss,createConcatTransform:()=>Dy,createConditionalNode:()=>Pp,createConductanceQuantum:()=>Ag,createConj:()=>ms,createConstantNode:()=>Zp,createCorr:()=>Fh,createCos:()=>Cf,createCosh:()=>Df,createCot:()=>Bf,createCoth:()=>Of,createCoulomb:()=>wg,createCount:()=>Ds,createCreateUnit:()=>Rl,createCross:()=>Fs,createCsc:()=>_f,createCsch:()=>zf,createCtranspose:()=>Au,createCube:()=>Lo,createCumSum:()=>xh,createCumSumTransform:()=>ky,createDeepEqual:()=>cl,createDenseMatrixClass:()=>Qn,createDerivative:()=>kd,createDet:()=>Xm,createDeuteronMass:()=>kg,createDiag:()=>_s,createDiff:()=>Js,createDiffTransform:()=>Fy,createDistance:()=>hh,createDivide:()=>ph,createDivideScalar:()=>ic,createDot:()=>dp,createDotDivide:()=>yc,createDotMultiply:()=>Pa,createDotPow:()=>dc,createE:()=>tg,createEfimovFactor:()=>Lg,createEigs:()=>th,createElectricConstant:()=>bg,createElectronMass:()=>Fg,createElementaryCharge:()=>Ng,createEqual:()=>Vc,createEqualScalar:()=>Fi,createEqualText:()=>Yc,createErf:()=>Fu,createEvaluate:()=>xm,createExp:()=>$o,createExpm:()=>nh,createExpm1:()=>Go,createFactorial:()=>Xh,createFalse:()=>Yd,createFaraday:()=>Vg,createFermiCoupling:()=>Og,createFft:()=>Cu,createFibonacciHeapClass:()=>Nl,createFilter:()=>Is,createFilterTransform:()=>xy,createFineStructure:()=>_g,createFirstRadiation:()=>Wg,createFix:()=>Yo,createFlatten:()=>Rs,createFloor:()=>Ko,createForEach:()=>Ps,createForEachTransform:()=>by,createFormat:()=>Gu,createFraction:()=>Ui,createFractionClass:()=>nn,createFreqz:()=>Ld,createFunctionAssignmentNode:()=>Jp,createFunctionNode:()=>pm,createGamma:()=>Wh,createGasConstant:()=>Yg,createGcd:()=>ha,createGetMatrixDataType:()=>Ls,createGravitationConstant:()=>dg,createGravity:()=>iy,createHartreeEnergy:()=>Ig,createHasNumericValue:()=>vi,createHelp:()=>Zm,createHelpClass:()=>Lm,createHex:()=>Zu,createHypot:()=>pp,createI:()=>cg,createIdentity:()=>Hs,createIfft:()=>Du,createIm:()=>hs,createImmutableDenseMatrixClass:()=>bl,createIndex:()=>xp,createIndexClass:()=>vl,createIndexNode:()=>Qp,createIndexTransform:()=>vy,createInfinity:()=>Xd,createIntersect:()=>dh,createInv:()=>Qm,createInverseConductanceQuantum:()=>Sg,createInvmod:()=>ka,createIsInteger:()=>ci,createIsNaN:()=>Mi,createIsNegative:()=>gi,createIsNumeric:()=>xi,createIsPositive:()=>Ni,createIsPrime:()=>tc,createIsZero:()=>Ai,createKldivergence:()=>Kh,createKlitzing:()=>Tg,createKron:()=>Vs,createLN10:()=>ig,createLN2:()=>ng,createLOG10E:()=>ag,createLOG2E:()=>og,createLarger:()=>nl,createLargerEq:()=>al,createLcm:()=>ga,createLeafCount:()=>Ad,createLeftShift:()=>Bc,createLgamma:()=>Yh,createLog:()=>cc,createLog10:()=>xa,createLog1p:()=>fc,createLog2:()=>va,createLoschmidt:()=>Zg,createLsolve:()=>vc,createLsolveAll:()=>Ac,createLup:()=>Nm,createLusolve:()=>Pm,createLyap:()=>fh,createMad:()=>Eh,createMagneticConstant:()=>xg,createMagneticFluxQuantum:()=>Mg,createMap:()=>Zs,createMapTransform:()=>wy,createMatrix:()=>$i,createMatrixClass:()=>an,createMatrixFromColumns:()=>Yi,createMatrixFromFunction:()=>Gi,createMatrixFromRows:()=>Wi,createMax:()=>yl,createMaxTransform:()=>Ey,createMean:()=>vh,createMeanTransform:()=>Ay,createMedian:()=>Nh,createMin:()=>xl,createMinTransform:()=>Sy,createMod:()=>aa,createMode:()=>ju,createMolarMass:()=>ry,createMolarMassC12:()=>ny,createMolarPlanckConstant:()=>Jg,createMolarVolume:()=>Xg,createMultinomial:()=>td,createMultiply:()=>Ea,createMultiplyScalar:()=>wa,createNaN:()=>Qd,createNeutronMass:()=>Rg,createNode:()=>vp,createNorm:()=>hp,createNot:()=>ws,createNthRoot:()=>Sa,createNthRoots:()=>mc,createNuclearMagneton:()=>Cg,createNull:()=>Jd,createNumber:()=>_i,createNumeric:()=>rc,createObjectNode:()=>em,createOct:()=>Wu,createOnes:()=>Xs,createOperatorNode:()=>nm,createOr:()=>Ns,createOrTransform:()=>Ly,createParenthesisNode:()=>om,createParse:()=>hm,createParser:()=>wm,createParserClass:()=>bm,createPartitionSelect:()=>hl,createPermutations:()=>nd,createPhi:()=>rg,createPi:()=>Kd,createPickRandom:()=>cd,createPinv:()=>eh,createPlanckCharge:()=>uy,createPlanckConstant:()=>gg,createPlanckLength:()=>oy,createPlanckMass:()=>ay,createPlanckTemperature:()=>cy,createPlanckTime:()=>sy,createPolynomialRoot:()=>Um,createPow:()=>oc,createPrint:()=>Xu,createPrintTransform:()=>jy,createProd:()=>$u,createProtonMass:()=>zg,createQr:()=>Em,createQuantileSeq:()=>Th,createQuantileSeqTransform:()=>Iy,createQuantumOfCirculation:()=>qg,createRandom:()=>pd,createRandomInt:()=>hd,createRange:()=>ru,createRangeClass:()=>on,createRangeNode:()=>sm,createRangeTransform:()=>My,createRationalize:()=>qd,createRe:()=>ds,createReducedPlanckConstant:()=>yg,createRelationalNode:()=>cm,createReplacer:()=>Hd,createReshape:()=>iu,createResize:()=>ou,createResolve:()=>Od,createResultSet:()=>We,createReviver:()=>$d,createRightArithShift:()=>Oc,createRightLogShift:()=>Ic,createRotate:()=>su,createRotationMatrix:()=>cu,createRound:()=>uc,createRow:()=>lu,createRowTransform:()=>Cy,createRydberg:()=>Pg,createSQRT1_2:()=>sg,createSQRT2:()=>ug,createSackurTetrode:()=>Qg,createSchur:()=>ch,createSec:()=>kf,createSech:()=>qf,createSecondRadiation:()=>Kg,createSetCartesian:()=>Gf,createSetDifference:()=>Wf,createSetDistinct:()=>Yf,createSetIntersect:()=>Xf,createSetIsSubset:()=>Kf,createSetMultiplicity:()=>tp,createSetPowerset:()=>np,createSetSize:()=>op,createSetSymDifference:()=>sp,createSetUnion:()=>cp,createSign:()=>Ca,createSimplify:()=>Td,createSimplifyConstant:()=>Dd,createSimplifyCore:()=>Fd,createSin:()=>Pf,createSinh:()=>Uf,createSize:()=>pu,createSlu:()=>km,createSmaller:()=>Xc,createSmallerEq:()=>el,createSolveODE:()=>Bu,createSort:()=>gl,createSpaClass:()=>El,createSparse:()=>zl,createSparseMatrixClass:()=>Oi,createSpeedOfLight:()=>hg,createSplitUnit:()=>Xi,createSqrt:()=>Ta,createSqrtm:()=>oh,createSquare:()=>Ba,createSqueeze:()=>hu,createStd:()=>Dh,createStdTransform:()=>Oy,createStefanBoltzmann:()=>ey,createStirlingS2:()=>gd,createString:()=>ki,createSubset:()=>gu,createSubsetTransform:()=>Ty,createSubtract:()=>Oa,createSubtractScalar:()=>Fo,createSum:()=>gh,createSumTransform:()=>_y,createSylvester:()=>sh,createSymbolNode:()=>lm,createSymbolicEqual:()=>Id,createTan:()=>Lf,createTanh:()=>$f,createTau:()=>eg,createThomsonCrossSection:()=>jg,createTo:()=>Ku,createTrace:()=>gp,createTranspose:()=>Nu,createTrue:()=>Zd,createTypeOf:()=>Ti,createTyped:()=>$e,createUnaryMinus:()=>wo,createUnaryPlus:()=>Eo,createUnequal:()=>fl,createUnitClass:()=>Fl,createUnitFunction:()=>_l,createUppercaseE:()=>fg,createUppercasePi:()=>lg,createUsolve:()=>Nc,createUsolveAll:()=>Mc,createVacuumImpedance:()=>vg,createVariance:()=>Mh,createVarianceTransform:()=>qy,createVersion:()=>pg,createWeakMixingAngle:()=>Ug,createWienDisplacement:()=>ty,createXgcd:()=>Ia,createXor:()=>Es,createZeros:()=>Mu,createZeta:()=>qu,createZpk2tf:()=>jd}),r(4423),r(7495),r(8992),r(7550);var t=r(2369);function i(e,t){if(a(e,t))return e[t];if("function"==typeof e[t]&&s(e,t))throw new Error('Cannot access method "'+t+'" as a property');throw new Error('No access to property "'+t+'"')}function o(e,t,r){if(a(e,t))return e[t]=r,r;throw new Error('No access to property "'+t+'"')}function a(e,t){return!(!function(e){return"object"==typeof e&&e&&e.constructor===Object}(e)&&!Array.isArray(e)||!me(u,t)&&(t in Object.prototype||t in Function.prototype))}function s(e,t){return!(null==e||"function"!=typeof e[t]||me(e,t)&&Object.getPrototypeOf&&t in Object.getPrototypeOf(e)||!me(c,t)&&(t in Object.prototype||t in Function.prototype))}r(6910),r(3215),r(4520),r(3949),r(1454),r(4864),r(7465);const u={length:!0,name:!0},c={toString:!0,valueOf:!0,toLocaleString:!0};class l{constructor(e){this.wrappedObject=e,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).filter((e=>this.has(e))).values()}get(e){return i(this.wrappedObject,e)}set(e,t){return o(this.wrappedObject,e,t),this}has(e){return a(this.wrappedObject,e)&&e in this.wrappedObject}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){a(this.wrappedObject,e)&&delete this.wrappedObject[e]}clear(){for(const e of this.keys())this.delete(e)}get size(){return Object.keys(this.wrappedObject).length}}class f{constructor(e,t,r){this.a=e,this.b=t,this.bKeys=r,this[Symbol.iterator]=this.entries}get(e){return this.bKeys.has(e)?this.b.get(e):this.a.get(e)}set(e,t){return this.bKeys.has(e)?this.b.set(e,t):this.a.set(e,t),this}has(e){return this.b.has(e)||this.a.has(e)}keys(){return new Set([...this.a.keys(),...this.b.keys()])[Symbol.iterator]()}entries(){return p(this.keys(),(e=>[e,this.get(e)]))}forEach(e){for(const t of this.keys())e(this.get(t),t,this)}delete(e){return this.bKeys.has(e)?this.b.delete(e):this.a.delete(e)}clear(){this.a.clear(),this.b.clear()}get size(){return[...this.keys()].length}}function p(e,t){return{next:()=>{const r=e.next();return r.done?r:{value:t(r.value),done:!1}}}}function m(){return new Map}function h(e){if(!e)return m();if(k(e))return e;if(z(e))return new l(e);throw new Error("createMap can create maps from objects or Maps")}function d(e){return"number"==typeof e}function g(e){return!(!e||"object"!=typeof e||"function"!=typeof e.constructor)&&(!0===e.isBigNumber&&"object"==typeof e.constructor.prototype&&!0===e.constructor.prototype.isBigNumber||"function"==typeof e.constructor.isDecimal&&!0===e.constructor.isDecimal(e))}function y(e){return"bigint"==typeof e}function x(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isComplex||!1}function b(e){return e&&"object"==typeof e&&!0===Object.getPrototypeOf(e).isFraction||!1}function v(e){return e&&!0===e.constructor.prototype.isUnit||!1}function w(e){return"string"==typeof e}const N=Array.isArray;function E(e){return e&&!0===e.constructor.prototype.isMatrix||!1}function A(e){return Array.isArray(e)||E(e)}function S(e){return e&&e.isDenseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function M(e){return e&&e.isSparseMatrix&&!0===e.constructor.prototype.isMatrix||!1}function C(e){return e&&!0===e.constructor.prototype.isRange||!1}function T(e){return e&&!0===e.constructor.prototype.isIndex||!1}function D(e){return"boolean"==typeof e}function B(e){return e&&!0===e.constructor.prototype.isResultSet||!1}function F(e){return e&&!0===e.constructor.prototype.isHelp||!1}function O(e){return"function"==typeof e}function _(e){return e instanceof Date}function I(e){return e instanceof RegExp}function z(e){return!(!e||"object"!=typeof e||e.constructor!==Object||x(e)||b(e))}function k(e){return!!e&&(e instanceof Map||e instanceof l||"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.keys&&"function"==typeof e.has)}function R(e){return k(e)&&k(e.a)&&k(e.b)}function q(e){return k(e)&&z(e.wrappedObject)}function P(e){return null===e}function j(e){return void 0===e}function U(e){return e&&!0===e.isAccessorNode&&!0===e.constructor.prototype.isNode||!1}function L(e){return e&&!0===e.isArrayNode&&!0===e.constructor.prototype.isNode||!1}function $(e){return e&&!0===e.isAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function H(e){return e&&!0===e.isBlockNode&&!0===e.constructor.prototype.isNode||!1}function G(e){return e&&!0===e.isConditionalNode&&!0===e.constructor.prototype.isNode||!1}function V(e){return e&&!0===e.isConstantNode&&!0===e.constructor.prototype.isNode||!1}function W(e){return V(e)||K(e)&&1===e.args.length&&V(e.args[0])&&"-+~".includes(e.op)}function Z(e){return e&&!0===e.isFunctionAssignmentNode&&!0===e.constructor.prototype.isNode||!1}function Y(e){return e&&!0===e.isFunctionNode&&!0===e.constructor.prototype.isNode||!1}function J(e){return e&&!0===e.isIndexNode&&!0===e.constructor.prototype.isNode||!1}function X(e){return e&&!0===e.isNode&&!0===e.constructor.prototype.isNode||!1}function Q(e){return e&&!0===e.isObjectNode&&!0===e.constructor.prototype.isNode||!1}function K(e){return e&&!0===e.isOperatorNode&&!0===e.constructor.prototype.isNode||!1}function ee(e){return e&&!0===e.isParenthesisNode&&!0===e.constructor.prototype.isNode||!1}function te(e){return e&&!0===e.isRangeNode&&!0===e.constructor.prototype.isNode||!1}function re(e){return e&&!0===e.isRelationalNode&&!0===e.constructor.prototype.isNode||!1}function ne(e){return e&&!0===e.isSymbolNode&&!0===e.constructor.prototype.isNode||!1}function ie(e){return e&&!0===e.constructor.prototype.isChain||!1}function oe(e){const t=typeof e;return"object"===t?null===e?"null":g(e)?"BigNumber":e.constructor&&e.constructor.name?e.constructor.name:"Object":t}function ae(e){const t=typeof e;if("number"===t||"bigint"===t||"string"===t||"boolean"===t||null==e)return e;if("function"==typeof e.clone)return e.clone();if(Array.isArray(e))return e.map((function(e){return ae(e)}));if(e instanceof Date)return new Date(e.valueOf());if(g(e))return e;if(z(e))return function(e,t){const r={};for(const n in e)me(e,n)&&(r[n]=t(e[n]));return r}(e,ae);if("function"===t)return e;throw new TypeError(`Cannot clone: unknown type of value (value: ${e})`)}function se(e,t){for(const r in t)me(t,r)&&(e[r]=t[r]);return e}function ue(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(const r in t)if(me(t,r)&&!(r in Object.prototype)&&!(r in Function.prototype))if(t[r]&&t[r].constructor===Object)void 0===e[r]&&(e[r]={}),e[r]&&e[r].constructor===Object?ue(e[r],t[r]):e[r]=t[r];else{if(Array.isArray(t[r]))throw new TypeError("Arrays are not supported by deepExtend");e[r]=t[r]}return e}function ce(e,t){let r,n,i;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(n=0,i=e.length;n<i;n++)if(!ce(e[n],t[n]))return!1;return!0}if("function"==typeof e)return e===t;if(e instanceof Object){if(Array.isArray(t)||!(t instanceof Object))return!1;for(r in e)if(!(r in t)||!ce(e[r],t[r]))return!1;for(r in t)if(!(r in e))return!1;return!0}return e===t}function le(e){const t={};return fe(e,t),t}function fe(e,t){for(const r in e)if(me(e,r)){const n=e[r];"object"==typeof n&&null!==n?fe(n,t):t[r]=n}}function pe(e,t,r){let n,i=!0;Object.defineProperty(e,t,{get:function(){return i&&(n=r(),i=!1),n},set:function(e){n=e,i=!1},configurable:!0,enumerable:!0})}function me(e,t){return e&&Object.hasOwnProperty.call(e,t)}function he(e,t,r,n){function i(n){const i=function(e,t){const r={};for(let n=0;n<t.length;n++){const i=t[n],o=e[i];void 0!==o&&(r[i]=o)}return r}(n,t.map(ge));return function(e,t,r){if(!t.filter((e=>!function(e){return e&&"?"===e[0]}(e))).every((e=>void 0!==r[e]))){const n=t.filter((e=>void 0===r[e]));throw new Error(`Cannot create function "${e}", some dependencies are missing: ${n.map((e=>`"${e}"`)).join(", ")}.`)}}(e,t,n),r(i)}return i.isFactory=!0,i.fn=e,i.dependencies=t.slice().sort(),n&&(i.meta=n),i}function de(e){return"function"==typeof e&&"string"==typeof e.fn&&Array.isArray(e.dependencies)}function ge(e){return e&&"?"===e[0]?e.slice(1):e}function ye(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)}function xe(e,t){return"bigint"!==t.number||/^-?\d+$/.test(e)?t.number:t.numberFallback}r(5440);const be=Math.sign||function(e){return e>0?1:e<0?-1:0},ve=Math.log2||function(e){return Math.log(e)/Math.LN2},we=Math.log10||function(e){return Math.log(e)/Math.LN10},Ne=Math.log1p||function(e){return Math.log(e+1)},Ee=Math.cbrt||function(e){if(0===e)return e;const t=e<0;let r;return t&&(e=-e),isFinite(e)?(r=Math.exp(Math.log(e)/3),r=(e/(r*r)+2*r)/3):r=e,t?-r:r},Ae=Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6};function Se(e,t,r){const n={2:"0b",8:"0o",16:"0x"}[t];let i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!ye(r))throw new Error("size must be an integer");if(e>2**(r-1)-1||e<-(2**(r-1)))throw new Error(`Value must be in range [-2^${r-1}, 2^${r-1}-1]`);if(!ye(e))throw new Error("Value must be an integer");e<0&&(e+=2**r),i=`i${r}`}let o="";return e<0&&(e=-e,o="-"),`${o}${n}${e.toString(t)}${i}`}function Me(e,t){if("function"==typeof t)return t(e);if(e===1/0)return"Infinity";if(e===-1/0)return"-Infinity";if(isNaN(e))return"NaN";const{notation:r,precision:n,wordSize:i}=Ce(t);switch(r){case"fixed":return De(e,n);case"exponential":return Be(e,n);case"engineering":return function(e,t){if(isNaN(e)||!isFinite(e))return String(e);const r=Fe(Te(e),t),n=r.exponent,i=r.coefficients,o=n%3==0?n:n<0?n-3-n%3:n-n%3;if(d(t))for(;t>i.length||n-o+1>i.length;)i.push(0);else{const e=Math.abs(n-o)-(i.length-1);for(let t=0;t<e;t++)i.push(0)}let a=Math.abs(n-o),s=1;for(;a>0;)s++,a--;const u=i.slice(s).join(""),c=d(t)&&u.length||u.match(/[1-9]/)?"."+u:"",l=i.slice(0,s).join("")+c+"e"+(n>=0?"+":"")+o.toString();return r.sign+l}(e,n);case"bin":return Se(e,2,i);case"oct":return Se(e,8,i);case"hex":return Se(e,16,i);case"auto":return function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);const n=Ue(null==r?void 0:r.lowerExp,-3),i=Ue(null==r?void 0:r.upperExp,5),o=Te(e),a=t?Fe(o,t):o;if(a.exponent<n||a.exponent>=i)return Be(e,t);{let e=a.coefficients;const r=a.exponent;e.length<t&&(e=e.concat(Oe(t-e.length))),e=e.concat(Oe(r-e.length+1+(e.length<t?t-e.length:0))),e=Oe(-r).concat(e);const n=r>0?r:0;return n<e.length-1&&e.splice(n+1,0,"."),a.sign+e.join("")}}(e,n,t).replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}));default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function Ce(e){let t,r,n="auto";if(void 0!==e)if(d(e))t=e;else if(g(e))t=e.toNumber();else{if(!z(e))throw new Error("Unsupported type of options, number, BigNumber, or object expected");void 0!==e.precision&&(t=je(e.precision,(()=>{throw new Error('Option "precision" must be a number or BigNumber')}))),void 0!==e.wordSize&&(r=je(e.wordSize,(()=>{throw new Error('Option "wordSize" must be a number or BigNumber')}))),e.notation&&(n=e.notation)}return{notation:n,precision:t,wordSize:r}}function Te(e){const t=String(e).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!t)throw new SyntaxError("Invalid number "+e);const r=t[1],n=t[2];let i=parseFloat(t[4]||"0");const o=n.indexOf(".");i+=-1!==o?o-1:n.length-1;const a=n.replace(".","").replace(/^0*/,(function(e){return i-=e.length,""})).replace(/0*$/,"").split("").map((function(e){return parseInt(e)}));return 0===a.length&&(a.push(0),i++),{sign:r,coefficients:a,exponent:i}}function De(e,t){if(isNaN(e)||!isFinite(e))return String(e);const r=Te(e),n="number"==typeof t?Fe(r,r.exponent+1+t):r;let i=n.coefficients,o=n.exponent+1;const a=o+(t||0);return i.length<a&&(i=i.concat(Oe(a-i.length))),o<0&&(i=Oe(1-o).concat(i),o=1),o<i.length&&i.splice(o,0,0===o?"0.":"."),n.sign+i.join("")}function Be(e,t){if(isNaN(e)||!isFinite(e))return String(e);const r=Te(e),n=t?Fe(r,t):r;let i=n.coefficients;const o=n.exponent;i.length<t&&(i=i.concat(Oe(t-i.length)));const a=i.shift();return n.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(o>=0?"+":"")+o}function Fe(e,t){const r={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},n=r.coefficients;for(;t<=0;)n.unshift(0),r.exponent++,t++;if(n.length>t&&n.splice(t,n.length-t)[0]>=5){let e=t-1;for(n[e]++;10===n[e];)n.pop(),0===e&&(n.unshift(0),r.exponent++,e++),e--,n[e]++}return r}function Oe(e){const t=[];for(let r=0;r<e;r++)t.push(0);return t}function _e(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-8,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return!isNaN(e)&&!isNaN(t)&&(isFinite(e)&&isFinite(t)?e===t||Math.abs(e-t)<=Math.max(r*Math.max(Math.abs(e),Math.abs(t)),n):e===t)}Number.EPSILON;const Ie=Math.acosh||function(e){return Math.log(Math.sqrt(e*e-1)+e)},ze=Math.asinh||function(e){return Math.log(Math.sqrt(e*e+1)+e)},ke=Math.atanh||function(e){return Math.log((1+e)/(1-e))/2},Re=Math.cosh||function(e){return(Math.exp(e)+Math.exp(-e))/2},qe=Math.sinh||function(e){return(Math.exp(e)-Math.exp(-e))/2},Pe=Math.tanh||function(e){const t=Math.exp(2*e);return(t-1)/(t+1)};function je(e,t){return d(e)?e:g(e)?e.toNumber():void t()}function Ue(e,t){return d(e)?e:g(e)?e.toNumber():t}let Le=function(){return Le=t.create,t};const $e=he("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],(function(e){let{BigNumber:t,Complex:r,DenseMatrix:n,Fraction:i}=e;const o=Le();return o.clear(),o.addTypes([{name:"number",test:d},{name:"Complex",test:x},{name:"BigNumber",test:g},{name:"bigint",test:y},{name:"Fraction",test:b},{name:"Unit",test:v},{name:"identifier",test:e=>w&&/^[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}][0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C8A\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CD\uA7D0\uA7D1\uA7D3\uA7D5-\uA7DC\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u{10000}-\u{1000B}\u{1000D}-\u{10026}\u{10028}-\u{1003A}\u{1003C}\u{1003D}\u{1003F}-\u{1004D}\u{10050}-\u{1005D}\u{10080}-\u{100FA}\u{10280}-\u{1029C}\u{102A0}-\u{102D0}\u{10300}-\u{1031F}\u{1032D}-\u{10340}\u{10342}-\u{10349}\u{10350}-\u{10375}\u{10380}-\u{1039D}\u{103A0}-\u{103C3}\u{103C8}-\u{103CF}\u{10400}-\u{1049D}\u{104B0}-\u{104D3}\u{104D8}-\u{104FB}\u{10500}-\u{10527}\u{10530}-\u{10563}\u{10570}-\u{1057A}\u{1057C}-\u{1058A}\u{1058C}-\u{10592}\u{10594}\u{10595}\u{10597}-\u{105A1}\u{105A3}-\u{105B1}\u{105B3}-\u{105B9}\u{105BB}\u{105BC}\u{105C0}-\u{105F3}\u{10600}-\u{10736}\u{10740}-\u{10755}\u{10760}-\u{10767}\u{10780}-\u{10785}\u{10787}-\u{107B0}\u{107B2}-\u{107BA}\u{10800}-\u{10805}\u{10808}\u{1080A}-\u{10835}\u{10837}\u{10838}\u{1083C}\u{1083F}-\u{10855}\u{10860}-\u{10876}\u{10880}-\u{1089E}\u{108E0}-\u{108F2}\u{108F4}\u{108F5}\u{10900}-\u{10915}\u{10920}-\u{10939}\u{10980}-\u{109B7}\u{109BE}\u{109BF}\u{10A00}\u{10A10}-\u{10A13}\u{10A15}-\u{10A17}\u{10A19}-\u{10A35}\u{10A60}-\u{10A7C}\u{10A80}-\u{10A9C}\u{10AC0}-\u{10AC7}\u{10AC9}-\u{10AE4}\u{10B00}-\u{10B35}\u{10B40}-\u{10B55}\u{10B60}-\u{10B72}\u{10B80}-\u{10B91}\u{10C00}-\u{10C48}\u{10C80}-\u{10CB2}\u{10CC0}-\u{10CF2}\u{10D00}-\u{10D23}\u{10D4A}-\u{10D65}\u{10D6F}-\u{10D85}\u{10E80}-\u{10EA9}\u{10EB0}\u{10EB1}\u{10EC2}-\u{10EC4}\u{10F00}-\u{10F1C}\u{10F27}\u{10F30}-\u{10F45}\u{10F70}-\u{10F81}\u{10FB0}-\u{10FC4}\u{10FE0}-\u{10FF6}\u{11003}-\u{11037}\u{11071}\u{11072}\u{11075}\u{11083}-\u{110AF}\u{110D0}-\u{110E8}\u{11103}-\u{11126}\u{11144}\u{11147}\u{11150}-\u{11172}\u{11176}\u{11183}-\u{111B2}\u{111C1}-\u{111C4}\u{111DA}\u{111DC}\u{11200}-\u{11211}\u{11213}-\u{1122B}\u{1123F}\u{11240}\u{11280}-\u{11286}\u{11288}\u{1128A}-\u{1128D}\u{1128F}-\u{1129D}\u{1129F}-\u{112A8}\u{112B0}-\u{112DE}\u{11305}-\u{1130C}\u{1130F}\u{11310}\u{11313}-\u{11328}\u{1132A}-\u{11330}\u{11332}\u{11333}\u{11335}-\u{11339}\u{1133D}\u{11350}\u{1135D}-\u{11361}\u{11380}-\u{11389}\u{1138B}\u{1138E}\u{11390}-\u{113B5}\u{113B7}\u{113D1}\u{113D3}\u{11400}-\u{11434}\u{11447}-\u{1144A}\u{1145F}-\u{11461}\u{11480}-\u{114AF}\u{114C4}\u{114C5}\u{114C7}\u{11580}-\u{115AE}\u{115D8}-\u{115DB}\u{11600}-\u{1162F}\u{11644}\u{11680}-\u{116AA}\u{116B8}\u{11700}-\u{1171A}\u{11740}-\u{11746}\u{11800}-\u{1182B}\u{118A0}-\u{118DF}\u{118FF}-\u{11906}\u{11909}\u{1190C}-\u{11913}\u{11915}\u{11916}\u{11918}-\u{1192F}\u{1193F}\u{11941}\u{119A0}-\u{119A7}\u{119AA}-\u{119D0}\u{119E1}\u{119E3}\u{11A00}\u{11A0B}-\u{11A32}\u{11A3A}\u{11A50}\u{11A5C}-\u{11A89}\u{11A9D}\u{11AB0}-\u{11AF8}\u{11BC0}-\u{11BE0}\u{11C00}-\u{11C08}\u{11C0A}-\u{11C2E}\u{11C40}\u{11C72}-\u{11C8F}\u{11D00}-\u{11D06}\u{11D08}\u{11D09}\u{11D0B}-\u{11D30}\u{11D46}\u{11D60}-\u{11D65}\u{11D67}\u{11D68}\u{11D6A}-\u{11D89}\u{11D98}\u{11EE0}-\u{11EF2}\u{11F02}\u{11F04}-\u{11F10}\u{11F12}-\u{11F33}\u{11FB0}\u{12000}-\u{12399}\u{12480}-\u{12543}\u{12F90}-\u{12FF0}\u{13000}-\u{1342F}\u{13441}-\u{13446}\u{13460}-\u{143FA}\u{14400}-\u{14646}\u{16100}-\u{1611D}\u{16800}-\u{16A38}\u{16A40}-\u{16A5E}\u{16A70}-\u{16ABE}\u{16AD0}-\u{16AED}\u{16B00}-\u{16B2F}\u{16B40}-\u{16B43}\u{16B63}-\u{16B77}\u{16B7D}-\u{16B8F}\u{16D40}-\u{16D6C}\u{16E40}-\u{16E7F}\u{16F00}-\u{16F4A}\u{16F50}\u{16F93}-\u{16F9F}\u{16FE0}\u{16FE1}\u{16FE3}\u{17000}-\u{187F7}\u{18800}-\u{18CD5}\u{18CFF}-\u{18D08}\u{1AFF0}-\u{1AFF3}\u{1AFF5}-\u{1AFFB}\u{1AFFD}\u{1AFFE}\u{1B000}-\u{1B122}\u{1B132}\u{1B150}-\u{1B152}\u{1B155}\u{1B164}-\u{1B167}\u{1B170}-\u{1B2FB}\u{1BC00}-\u{1BC6A}\u{1BC70}-\u{1BC7C}\u{1BC80}-\u{1BC88}\u{1BC90}-\u{1BC99}\u{1D400}-\u{1D454}\u{1D456}-\u{1D49C}\u{1D49E}\u{1D49F}\u{1D4A2}\u{1D4A5}\u{1D4A6}\u{1D4A9}-\u{1D4AC}\u{1D4AE}-\u{1D4B9}\u{1D4BB}\u{1D4BD}-\u{1D4C3}\u{1D4C5}-\u{1D505}\u{1D507}-\u{1D50A}\u{1D50D}-\u{1D514}\u{1D516}-\u{1D51C}\u{1D51E}-\u{1D539}\u{1D53B}-\u{1D53E}\u{1D540}-\u{1D544}\u{1D546}\u{1D54A}-\u{1D550}\u{1D552}-\u{1D6A5}\u{1D6A8}-\u{1D6C0}\u{1D6C2}-\u{1D6DA}\u{1D6DC}-\u{1D6FA}\u{1D6FC}-\u{1D714}\u{1D716}-\u{1D734}\u{1D736}-\u{1D74E}\u{1D750}-\u{1D76E}\u{1D770}-\u{1D788}\u{1D78A}-\u{1D7A8}\u{1D7AA}-\u{1D7C2}\u{1D7C4}-\u{1D7CB}\u{1DF00}-\u{1DF1E}\u{1DF25}-\u{1DF2A}\u{1E030}-\u{1E06D}\u{1E100}-\u{1E12C}\u{1E137}-\u{1E13D}\u{1E14E}\u{1E290}-\u{1E2AD}\u{1E2C0}-\u{1E2EB}\u{1E4D0}-\u{1E4EB}\u{1E5D0}-\u{1E5ED}\u{1E5F0}\u{1E7E0}-\u{1E7E6}\u{1E7E8}-\u{1E7EB}\u{1E7ED}\u{1E7EE}\u{1E7F0}-\u{1E7FE}\u{1E800}-\u{1E8C4}\u{1E900}-\u{1E943}\u{1E94B}\u{1EE00}-\u{1EE03}\u{1EE05}-\u{1EE1F}\u{1EE21}\u{1EE22}\u{1EE24}\u{1EE27}\u{1EE29}-\u{1EE32}\u{1EE34}-\u{1EE37}\u{1EE39}\u{1EE3B}\u{1EE42}\u{1EE47}\u{1EE49}\u{1EE4B}\u{1EE4D}-\u{1EE4F}\u{1EE51}\u{1EE52}\u{1EE54}\u{1EE57}\u{1EE59}\u{1EE5B}\u{1EE5D}\u{1EE5F}\u{1EE61}\u{1EE62}\u{1EE64}\u{1EE67}-\u{1EE6A}\u{1EE6C}-\u{1EE72}\u{1EE74}-\u{1EE77}\u{1EE79}-\u{1EE7C}\u{1EE7E}\u{1EE80}-\u{1EE89}\u{1EE8B}-\u{1EE9B}\u{1EEA1}-\u{1EEA3}\u{1EEA5}-\u{1EEA9}\u{1EEAB}-\u{1EEBB}\u{20000}-\u{2A6DF}\u{2A700}-\u{2B739}\u{2B740}-\u{2B81D}\u{2B820}-\u{2CEA1}\u{2CEB0}-\u{2EBE0}\u{2EBF0}-\u{2EE5D}\u{2F800}-\u{2FA1D}\u{30000}-\u{3134A}\u{31350}-\u{323AF}]*$/u.test(e)},{name:"string",test:w},{name:"Chain",test:ie},{name:"Array",test:N},{name:"Matrix",test:E},{name:"DenseMatrix",test:S},{name:"SparseMatrix",test:M},{name:"Range",test:C},{name:"Index",test:T},{name:"boolean",test:D},{name:"ResultSet",test:B},{name:"Help",test:F},{name:"function",test:O},{name:"Date",test:_},{name:"RegExp",test:I},{name:"null",test:P},{name:"undefined",test:j},{name:"AccessorNode",test:U},{name:"ArrayNode",test:L},{name:"AssignmentNode",test:$},{name:"BlockNode",test:H},{name:"ConditionalNode",test:G},{name:"ConstantNode",test:V},{name:"FunctionNode",test:Y},{name:"FunctionAssignmentNode",test:Z},{name:"IndexNode",test:J},{name:"Node",test:X},{name:"ObjectNode",test:Q},{name:"OperatorNode",test:K},{name:"ParenthesisNode",test:ee},{name:"RangeNode",test:te},{name:"RelationalNode",test:re},{name:"SymbolNode",test:ne},{name:"Map",test:k},{name:"Object",test:z}]),o.addConversions([{from:"number",to:"BigNumber",convert:function(e){if(t||He(e),e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+e+"). Use function bignumber(x) to convert to BigNumber.");return new t(e)}},{from:"number",to:"Complex",convert:function(e){return r||Ge(e),new r(e,0)}},{from:"BigNumber",to:"Complex",convert:function(e){return r||Ge(e),new r(e.toNumber(),0)}},{from:"bigint",to:"number",convert:function(e){if(e>Number.MAX_SAFE_INTEGER)throw new TypeError("Cannot implicitly convert bigint to number: value exceeds the max safe integer value (value: "+e+")");return Number(e)}},{from:"bigint",to:"BigNumber",convert:function(e){return t||He(e),new t(e.toString())}},{from:"bigint",to:"Fraction",convert:function(e){return i||Ve(e),new i(e)}},{from:"Fraction",to:"BigNumber",convert:function(e){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(e){return r||Ge(e),new r(e.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(e){i||Ve(e);const t=new i(e);if(t.valueOf()!==e)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+e+"). Use function fraction(x) to convert to Fraction.");return t}},{from:"string",to:"number",convert:function(e){const t=Number(e);if(isNaN(t))throw new Error('Cannot convert "'+e+'" to a number');return t}},{from:"string",to:"BigNumber",convert:function(e){t||He(e);try{return new t(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigNumber')}}},{from:"string",to:"bigint",convert:function(e){try{return BigInt(e)}catch(t){throw new Error('Cannot convert "'+e+'" to BigInt')}}},{from:"string",to:"Fraction",convert:function(e){i||Ve(e);try{return new i(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(e){r||Ge(e);try{return new r(e)}catch(t){throw new Error('Cannot convert "'+e+'" to Complex')}}},{from:"boolean",to:"number",convert:function(e){return+e}},{from:"boolean",to:"BigNumber",convert:function(e){return t||He(e),new t(+e)}},{from:"boolean",to:"bigint",convert:function(e){return BigInt(+e)}},{from:"boolean",to:"Fraction",convert:function(e){return i||Ve(e),new i(+e)}},{from:"boolean",to:"string",convert:function(e){return String(e)}},{from:"Array",to:"Matrix",convert:function(e){return 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()}}]),o.onMismatch=(e,t,r)=>{const n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&A(t[0])&&r.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=n.data,t}throw n},o.onMismatch=(e,t,r)=>{const n=o.createError(e,t,r);if(["wrongType","mismatch"].includes(n.data.category)&&1===t.length&&A(t[0])&&r.some((e=>!e.params.includes(",")))){const t=new TypeError(`Function '${e}' doesn't apply to matrices. To call it elementwise on a matrix 'M', try 'map(M, ${e})'.`);throw t.data=n.data,t}throw n},o}));function He(e){throw new Error(`Cannot convert value ${e} into a BigNumber: no class 'BigNumber' provided`)}function Ge(e){throw new Error(`Cannot convert value ${e} into a Complex number: no class 'Complex' provided`)}function Ve(e){throw new Error(`Cannot convert value ${e} into a Fraction, no class 'Fraction' provided.`)}const We=he("ResultSet",[],(()=>{function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return e.prototype.type="ResultSet",e.prototype.isResultSet=!0,e.prototype.valueOf=function(){return this.entries},e.prototype.toString=function(){return"["+this.entries.map(String).join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},e.fromJSON=function(t){return new e(t.entries)},e}),{isClass:!0});var Ze,Ye,Je=9e15,Xe=1e9,Qe="0123456789abcdef",Ke="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",et="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",tt={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-Je,maxE:Je,crypto:!1},rt=!0,nt="[DecimalError] ",it=nt+"Invalid argument: ",ot=nt+"Precision limit exceeded",at=nt+"crypto unavailable",st="[object Decimal]",ut=Math.floor,ct=Math.pow,lt=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,ft=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,pt=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,mt=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,ht=1e7,dt=Ke.length-1,gt=et.length-1,yt={toStringTag:st};function xt(e){var t,r,n,i=e.length-1,o="",a=e[0];if(i>0){for(o+=a,t=1;t<i;t++)(r=7-(n=e[t]+"").length)&&(o+=Dt(r)),o+=n;(r=7-(n=(a=e[t])+"").length)&&(o+=Dt(r))}else if(0===a)return"0";for(;a%10==0;)a/=10;return o+a}function bt(e,t,r){if(e!==~~e||e<t||e>r)throw Error(it+e)}function vt(e,t,r,n){var i,o,a,s;for(o=e[0];o>=10;o/=10)--t;return--t<0?(t+=7,i=0):(i=Math.ceil((t+1)/7),t%=7),o=ct(10,7-t),s=e[i]%o|0,null==n?t<3?(0==t?s=s/100|0:1==t&&(s=s/10|0),a=r<4&&99999==s||r>3&&49999==s||5e4==s||0==s):a=(r<4&&s+1==o||r>3&&s+1==o/2)&&(e[i+1]/o/100|0)==ct(10,t-2)-1||(s==o/2||0==s)&&!(e[i+1]/o/100|0):t<4?(0==t?s=s/1e3|0:1==t?s=s/100|0:2==t&&(s=s/10|0),a=(n||r<4)&&9999==s||!n&&r>3&&4999==s):a=((n||r<4)&&s+1==o||!n&&r>3&&s+1==o/2)&&(e[i+1]/o/1e3|0)==ct(10,t-3)-1,a}function wt(e,t,r){for(var n,i,o=[0],a=0,s=e.length;a<s;){for(i=o.length;i--;)o[i]*=t;for(o[0]+=Qe.indexOf(e.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(void 0===o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}yt.absoluteValue=yt.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),Et(e)},yt.ceil=function(){return Et(new this.constructor(this),this.e+1,2)},yt.clampedTo=yt.clamp=function(e,t){var r=this,n=r.constructor;if(e=new n(e),t=new n(t),!e.s||!t.s)return new n(NaN);if(e.gt(t))throw Error(it+t);return r.cmp(e)<0?e:r.cmp(t)>0?t:new n(r)},yt.comparedTo=yt.cmp=function(e){var t,r,n,i,o=this,a=o.d,s=(e=new o.constructor(e)).d,u=o.s,c=e.s;if(!a||!s)return u&&c?u!==c?u:a===s?0:!a^u<0?1:-1:NaN;if(!a[0]||!s[0])return a[0]?u:s[0]?-c:0;if(u!==c)return u;if(o.e!==e.e)return o.e>e.e^u<0?1:-1;for(t=0,r=(n=a.length)<(i=s.length)?n:i;t<r;++t)if(a[t]!==s[t])return a[t]>s[t]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},yt.cosine=yt.cos=function(){var e,t,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n,i;if(t.isZero())return t;(n=t.d.length)<32?i=(1/Pt(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10"),e.precision+=r,t=qt(e,1,t.times(i),new e(1));for(var o=r;o--;){var a=t.times(t);t=a.times(a).minus(a).times(8).plus(1)}return e.precision-=r,t}(n,jt(n,r)),n.precision=e,n.rounding=t,Et(2==Ye||3==Ye?r.neg():r,e,t,!0)):new n(1):new n(NaN)},yt.cubeRoot=yt.cbrt=function(){var e,t,r,n,i,o,a,s,u,c,l=this,f=l.constructor;if(!l.isFinite()||l.isZero())return new f(l);for(rt=!1,(o=l.s*ct(l.s*l,1/3))&&Math.abs(o)!=1/0?n=new f(o.toString()):(r=xt(l.d),(o=((e=l.e)-r.length+1)%3)&&(r+=1==o||-2==o?"0":"00"),o=ct(r,1/3),e=ut((e+1)/3)-(e%3==(e<0?-1:2)),(n=new f(r=o==1/0?"5e"+e:(r=o.toExponential()).slice(0,r.indexOf("e")+1)+e)).s=l.s),a=(e=f.precision)+3;;)if(c=(u=(s=n).times(s).times(s)).plus(l),n=Nt(c.plus(l).times(s),c.plus(u),a+2,1),xt(s.d).slice(0,a)===(r=xt(n.d)).slice(0,a)){if("9999"!=(r=r.slice(a-3,a+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(Et(n,e+1,1),t=!n.times(n).times(n).eq(l));break}if(!i&&(Et(s,e+1,0),s.times(s).times(s).eq(l))){n=s;break}a+=4,i=1}return rt=!0,Et(n,e,f.rounding,t)},yt.decimalPlaces=yt.dp=function(){var e,t=this.d,r=NaN;if(t){if(r=7*((e=t.length-1)-ut(this.e/7)),e=t[e])for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r},yt.dividedBy=yt.div=function(e){return Nt(this,new this.constructor(e))},yt.dividedToIntegerBy=yt.divToInt=function(e){var t=this.constructor;return Et(Nt(this,new t(e),0,1,1),t.precision,t.rounding)},yt.equals=yt.eq=function(e){return 0===this.cmp(e)},yt.floor=function(){return Et(new this.constructor(this),this.e+1,3)},yt.greaterThan=yt.gt=function(e){return this.cmp(e)>0},yt.greaterThanOrEqualTo=yt.gte=function(e){var t=this.cmp(e);return 1==t||0===t},yt.hyperbolicCosine=yt.cosh=function(){var e,t,r,n,i,o=this,a=o.constructor,s=new a(1);if(!o.isFinite())return new a(o.s?1/0:NaN);if(o.isZero())return s;r=a.precision,n=a.rounding,a.precision=r+Math.max(o.e,o.sd())+4,a.rounding=1,(i=o.d.length)<32?t=(1/Pt(4,e=Math.ceil(i/3))).toString():(e=16,t="2.3283064365386962890625e-10"),o=qt(a,1,o.times(t),new a(1),!0);for(var u,c=e,l=new a(8);c--;)u=o.times(o),o=s.minus(u.times(l.minus(u.times(l))));return Et(o,a.precision=r,a.rounding=n,!0)},yt.hyperbolicSine=yt.sinh=function(){var e,t,r,n,i=this,o=i.constructor;if(!i.isFinite()||i.isZero())return new o(i);if(t=o.precision,r=o.rounding,o.precision=t+Math.max(i.e,i.sd())+4,o.rounding=1,(n=i.d.length)<3)i=qt(o,2,i,i,!0);else{e=(e=1.4*Math.sqrt(n))>16?16:0|e,i=qt(o,2,i=i.times(1/Pt(5,e)),i,!0);for(var a,s=new o(5),u=new o(16),c=new o(20);e--;)a=i.times(i),i=i.times(s.plus(a.times(u.times(a).plus(c))))}return o.precision=t,o.rounding=r,Et(i,t,r,!0)},yt.hyperbolicTangent=yt.tanh=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+7,n.rounding=1,Nt(r.sinh(),r.cosh(),n.precision=e,n.rounding=t)):new n(r.s)},yt.inverseCosine=yt.acos=function(){var e,t=this,r=t.constructor,n=t.abs().cmp(1),i=r.precision,o=r.rounding;return-1!==n?0===n?t.isNeg()?Ct(r,i,o):new r(0):new r(NaN):t.isZero()?Ct(r,i+4,o).times(.5):(r.precision=i+6,r.rounding=1,t=t.asin(),e=Ct(r,i+4,o).times(.5),r.precision=i,r.rounding=o,e.minus(t))},yt.inverseHyperbolicCosine=yt.acosh=function(){var e,t,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,t=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,rt=!1,r=r.times(r).minus(1).sqrt().plus(r),rt=!0,n.precision=e,n.rounding=t,r.ln()):new n(r)},yt.inverseHyperbolicSine=yt.asinh=function(){var e,t,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,rt=!1,r=r.times(r).plus(1).sqrt().plus(r),rt=!0,n.precision=e,n.rounding=t,r.ln())},yt.inverseHyperbolicTangent=yt.atanh=function(){var e,t,r,n,i=this,o=i.constructor;return i.isFinite()?i.e>=0?new o(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(e=o.precision,t=o.rounding,n=i.sd(),Math.max(n,e)<2*-i.e-1?Et(new o(i),e,t,!0):(o.precision=r=n-i.e,i=Nt(i.plus(1),new o(1).minus(i),r+e,1),o.precision=e+4,o.rounding=1,i=i.ln(),o.precision=e,o.rounding=t,i.times(.5))):new o(NaN)},yt.inverseSine=yt.asin=function(){var e,t,r,n,i=this,o=i.constructor;return i.isZero()?new o(i):(t=i.abs().cmp(1),r=o.precision,n=o.rounding,-1!==t?0===t?((e=Ct(o,r+4,n).times(.5)).s=i.s,e):new o(NaN):(o.precision=r+6,o.rounding=1,i=i.div(new o(1).minus(i.times(i)).sqrt().plus(1)).atan(),o.precision=r,o.rounding=n,i.times(2)))},yt.inverseTangent=yt.atan=function(){var e,t,r,n,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(c.isFinite()){if(c.isZero())return new l(c);if(c.abs().eq(1)&&f+4<=gt)return(a=Ct(l,f+4,p).times(.25)).s=c.s,a}else{if(!c.s)return new l(NaN);if(f+4<=gt)return(a=Ct(l,f+4,p).times(.5)).s=c.s,a}for(l.precision=s=f+10,l.rounding=1,e=r=Math.min(28,s/7+2|0);e;--e)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(rt=!1,t=Math.ceil(s/7),n=1,u=c.times(c),a=new l(c),i=c;-1!==e;)if(i=i.times(u),o=a.minus(i.div(n+=2)),i=i.times(u),void 0!==(a=o.plus(i.div(n+=2))).d[t])for(e=t;a.d[e]===o.d[e]&&e--;);return r&&(a=a.times(2<<r-1)),rt=!0,Et(a,l.precision=f,l.rounding=p,!0)},yt.isFinite=function(){return!!this.d},yt.isInteger=yt.isInt=function(){return!!this.d&&ut(this.e/7)>this.d.length-2},yt.isNaN=function(){return!this.s},yt.isNegative=yt.isNeg=function(){return this.s<0},yt.isPositive=yt.isPos=function(){return this.s>0},yt.isZero=function(){return!!this.d&&0===this.d[0]},yt.lessThan=yt.lt=function(e){return this.cmp(e)<0},yt.lessThanOrEqualTo=yt.lte=function(e){return this.cmp(e)<1},yt.logarithm=yt.log=function(e){var t,r,n,i,o,a,s,u,c=this,l=c.constructor,f=l.precision,p=l.rounding;if(null==e)e=new l(10),t=!0;else{if(r=(e=new l(e)).d,e.s<0||!r||!r[0]||e.eq(1))return new l(NaN);t=e.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new l(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(t)if(r.length>1)o=!0;else{for(i=r[0];i%10==0;)i/=10;o=1!==i}if(rt=!1,a=It(c,s=f+5),n=t?Mt(l,s+10):It(e,s),vt((u=Nt(a,n,s,1)).d,i=f,p))do{if(a=It(c,s+=10),n=t?Mt(l,s+10):It(e,s),u=Nt(a,n,s,1),!o){+xt(u.d).slice(i+1,i+15)+1==1e14&&(u=Et(u,f+1,0));break}}while(vt(u.d,i+=10,p));return rt=!0,Et(u,f,p)},yt.minus=yt.sub=function(e){var t,r,n,i,o,a,s,u,c,l,f,p,m=this,h=m.constructor;if(e=new h(e),!m.d||!e.d)return m.s&&e.s?m.d?e.s=-e.s:e=new h(e.d||m.s!==e.s?m:NaN):e=new h(NaN),e;if(m.s!=e.s)return e.s=-e.s,m.plus(e);if(c=m.d,p=e.d,s=h.precision,u=h.rounding,!c[0]||!p[0]){if(p[0])e.s=-e.s;else{if(!c[0])return new h(3===u?-0:0);e=new h(m)}return rt?Et(e,s,u):e}if(r=ut(e.e/7),l=ut(m.e/7),c=c.slice(),o=l-r){for((f=o<0)?(t=c,o=-o,a=p.length):(t=p,r=l,a=c.length),o>(n=Math.max(Math.ceil(s/7),a)+2)&&(o=n,t.length=1),t.reverse(),n=o;n--;)t.push(0);t.reverse()}else{for((f=(n=c.length)<(a=p.length))&&(a=n),n=0;n<a;n++)if(c[n]!=p[n]){f=c[n]<p[n];break}o=0}for(f&&(t=c,c=p,p=t,e.s=-e.s),a=c.length,n=p.length-a;n>0;--n)c[a++]=0;for(n=p.length;n>o;){if(c[--n]<p[n]){for(i=n;i&&0===c[--i];)c[i]=ht-1;--c[i],c[n]+=ht}c[n]-=p[n]}for(;0===c[--a];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(e.d=c,e.e=St(c,r),rt?Et(e,s,u):e):new h(3===u?-0:0)},yt.modulo=yt.mod=function(e){var t,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?Et(new n(r),n.precision,n.rounding):(rt=!1,9==n.modulo?(t=Nt(r,e.abs(),0,3,1)).s*=e.s:t=Nt(r,e,0,n.modulo,1),t=t.times(e),rt=!0,r.minus(t))},yt.naturalExponential=yt.exp=function(){return _t(this)},yt.naturalLogarithm=yt.ln=function(){return It(this)},yt.negated=yt.neg=function(){var e=new this.constructor(this);return e.s=-e.s,Et(e)},yt.plus=yt.add=function(e){var t,r,n,i,o,a,s,u,c,l,f=this,p=f.constructor;if(e=new p(e),!f.d||!e.d)return f.s&&e.s?f.d||(e=new p(e.d||f.s===e.s?f:NaN)):e=new p(NaN),e;if(f.s!=e.s)return e.s=-e.s,f.minus(e);if(c=f.d,l=e.d,s=p.precision,u=p.rounding,!c[0]||!l[0])return l[0]||(e=new p(f)),rt?Et(e,s,u):e;if(o=ut(f.e/7),n=ut(e.e/7),c=c.slice(),i=o-n){for(i<0?(r=c,i=-i,a=l.length):(r=l,n=o,a=c.length),i>(a=(o=Math.ceil(s/7))>a?o+1:a+1)&&(i=a,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((a=c.length)-(i=l.length)<0&&(i=a,r=l,l=c,c=r),t=0;i;)t=(c[--i]=c[i]+l[i]+t)/ht|0,c[i]%=ht;for(t&&(c.unshift(t),++n),a=c.length;0==c[--a];)c.pop();return e.d=c,e.e=St(c,n),rt?Et(e,s,u):e},yt.precision=yt.sd=function(e){var t,r=this;if(void 0!==e&&e!==!!e&&1!==e&&0!==e)throw Error(it+e);return r.d?(t=Tt(r.d),e&&r.e+1>t&&(t=r.e+1)):t=NaN,t},yt.round=function(){var e=this,t=e.constructor;return Et(new t(e),e.e+1,t.rounding)},yt.sine=yt.sin=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(e,t){var r,n=t.d.length;if(n<3)return t.isZero()?t:qt(e,2,t,t);r=(r=1.4*Math.sqrt(n))>16?16:0|r,t=qt(e,2,t=t.times(1/Pt(5,r)),t);for(var i,o=new e(5),a=new e(16),s=new e(20);r--;)i=t.times(t),t=t.times(o.plus(i.times(a.times(i).minus(s))));return t}(n,jt(n,r)),n.precision=e,n.rounding=t,Et(Ye>2?r.neg():r,e,t,!0)):new n(NaN)},yt.squareRoot=yt.sqrt=function(){var e,t,r,n,i,o,a=this,s=a.d,u=a.e,c=a.s,l=a.constructor;if(1!==c||!s||!s[0])return new l(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);for(rt=!1,0==(c=Math.sqrt(+a))||c==1/0?(((t=xt(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(t),u=ut((u+1)/2)-(u<0||u%2),n=new l(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new l(c.toString()),r=(u=l.precision)+3;;)if(n=(o=n).plus(Nt(a,o,r+2,1)).times(.5),xt(o.d).slice(0,r)===(t=xt(n.d)).slice(0,r)){if("9999"!=(t=t.slice(r-3,r+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(Et(n,u+1,1),e=!n.times(n).eq(a));break}if(!i&&(Et(o,u+1,0),o.times(o).eq(a))){n=o;break}r+=4,i=1}return rt=!0,Et(n,u,l.rounding,e)},yt.tangent=yt.tan=function(){var e,t,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,t=n.rounding,n.precision=e+10,n.rounding=1,(r=r.sin()).s=1,r=Nt(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=t,Et(2==Ye||4==Ye?r.neg():r,e,t,!0)):new n(NaN)},yt.times=yt.mul=function(e){var t,r,n,i,o,a,s,u,c,l=this,f=l.constructor,p=l.d,m=(e=new f(e)).d;if(e.s*=l.s,!(p&&p[0]&&m&&m[0]))return new f(!e.s||p&&!p[0]&&!m||m&&!m[0]&&!p?NaN:p&&m?0*e.s:e.s/0);for(r=ut(l.e/7)+ut(e.e/7),(u=p.length)<(c=m.length)&&(o=p,p=m,m=o,a=u,u=c,c=a),o=[],n=a=u+c;n--;)o.push(0);for(n=c;--n>=0;){for(t=0,i=u+n;i>n;)s=o[i]+m[n]*p[i-n-1]+t,o[i--]=s%ht|0,t=s/ht|0;o[i]=(o[i]+t)%ht|0}for(;!o[--a];)o.pop();return t?++r:o.shift(),e.d=o,e.e=St(o,r),rt?Et(e,f.precision,f.rounding):e},yt.toBinary=function(e,t){return Ut(this,2,e,t)},yt.toDecimalPlaces=yt.toDP=function(e,t){var r=this,n=r.constructor;return r=new n(r),void 0===e?r:(bt(e,0,Xe),void 0===t?t=n.rounding:bt(t,0,8),Et(r,e+r.e+1,t))},yt.toExponential=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=At(n,!0):(bt(e,0,Xe),void 0===t?t=i.rounding:bt(t,0,8),r=At(n=Et(new i(n),e+1,t),!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r},yt.toFixed=function(e,t){var r,n,i=this,o=i.constructor;return void 0===e?r=At(i):(bt(e,0,Xe),void 0===t?t=o.rounding:bt(t,0,8),r=At(n=Et(new o(i),e+i.e+1,t),!1,e+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},yt.toFraction=function(e){var t,r,n,i,o,a,s,u,c,l,f,p,m=this,h=m.d,d=m.constructor;if(!h)return new d(m);if(c=r=new d(1),n=u=new d(0),a=(o=(t=new d(n)).e=Tt(h)-m.e-1)%7,t.d[0]=ct(10,a<0?7+a:a),null==e)e=o>0?t:c;else{if(!(s=new d(e)).isInt()||s.lt(c))throw Error(it+s);e=s.gt(t)?o>0?t:c:s}for(rt=!1,s=new d(xt(h)),l=d.precision,d.precision=o=7*h.length*2;f=Nt(s,t,0,1,1),1!=(i=r.plus(f.times(n))).cmp(e);)r=n,n=i,i=c,c=u.plus(f.times(i)),u=i,i=t,t=s.minus(f.times(i)),s=i;return i=Nt(e.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=m.s,p=Nt(c,n,o,1).minus(m).abs().cmp(Nt(u,r,o,1).minus(m).abs())<1?[c,n]:[u,r],d.precision=l,rt=!0,p},yt.toHexadecimal=yt.toHex=function(e,t){return Ut(this,16,e,t)},yt.toNearest=function(e,t){var r=this,n=r.constructor;if(r=new n(r),null==e){if(!r.d)return r;e=new n(1),t=n.rounding}else{if(e=new n(e),void 0===t?t=n.rounding:bt(t,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(rt=!1,r=Nt(r,e,0,t,1).times(e),rt=!0,Et(r)):(e.s=r.s,r=e),r},yt.toNumber=function(){return+this},yt.toOctal=function(e,t){return Ut(this,8,e,t)},yt.toPower=yt.pow=function(e){var t,r,n,i,o,a,s=this,u=s.constructor,c=+(e=new u(e));if(!(s.d&&e.d&&s.d[0]&&e.d[0]))return new u(ct(+s,c));if((s=new u(s)).eq(1))return s;if(n=u.precision,o=u.rounding,e.eq(1))return Et(s,n,o);if((t=ut(e.e/7))>=e.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=Bt(u,s,r,n),e.s<0?new u(1).div(i):Et(i,n,o);if((a=s.s)<0){if(t<e.d.length-1)return new u(NaN);if(1&e.d[t]||(a=1),0==s.e&&1==s.d[0]&&1==s.d.length)return s.s=a,s}return(t=0!=(r=ct(+s,c))&&isFinite(r)?new u(r+"").e:ut(c*(Math.log("0."+xt(s.d))/Math.LN10+s.e+1)))>u.maxE+1||t<u.minE-1?new u(t>0?a/0:0):(rt=!1,u.rounding=s.s=1,r=Math.min(12,(t+"").length),(i=_t(e.times(It(s,n+r)),n)).d&&vt((i=Et(i,n+5,1)).d,n,o)&&(t=n+10,+xt((i=Et(_t(e.times(It(s,t+r)),t),t+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=Et(i,n+1,0))),i.s=a,rt=!0,u.rounding=o,Et(i,n,o))},yt.toPrecision=function(e,t){var r,n=this,i=n.constructor;return void 0===e?r=At(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(bt(e,1,Xe),void 0===t?t=i.rounding:bt(t,0,8),r=At(n=Et(new i(n),e,t),e<=n.e||n.e<=i.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r},yt.toSignificantDigits=yt.toSD=function(e,t){var r=this.constructor;return void 0===e?(e=r.precision,t=r.rounding):(bt(e,1,Xe),void 0===t?t=r.rounding:bt(t,0,8)),Et(new r(this),e,t)},yt.toString=function(){var e=this,t=e.constructor,r=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r},yt.truncated=yt.trunc=function(){return Et(new this.constructor(this),this.e+1,1)},yt.valueOf=yt.toJSON=function(){var e=this,t=e.constructor,r=At(e,e.e<=t.toExpNeg||e.e>=t.toExpPos);return e.isNeg()?"-"+r:r};var Nt=function(){function e(e,t,r){var n,i=0,o=e.length;for(e=e.slice();o--;)n=e[o]*t+i,e[o]=n%r|0,i=n/r|0;return i&&e.unshift(i),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;)e.shift()}return function(n,i,o,a,s,u){var c,l,f,p,m,h,d,g,y,x,b,v,w,N,E,A,S,M,C,T,D=n.constructor,B=n.s==i.s?1:-1,F=n.d,O=i.d;if(!(F&&F[0]&&O&&O[0]))return new D(n.s&&i.s&&(F?!O||F[0]!=O[0]:O)?F&&0==F[0]||!O?0*B:B/0:NaN);for(u?(m=1,l=n.e-i.e):(u=ht,m=7,l=ut(n.e/m)-ut(i.e/m)),C=O.length,S=F.length,x=(y=new D(B)).d=[],f=0;O[f]==(F[f]||0);f++);if(O[f]>(F[f]||0)&&l--,null==o?(N=o=D.precision,a=D.rounding):N=s?o+(n.e-i.e)+1:o,N<0)x.push(1),h=!0;else{if(N=N/m+2|0,f=0,1==C){for(p=0,O=O[0],N++;(f<S||p)&&N--;f++)E=p*u+(F[f]||0),x[f]=E/O|0,p=E%O|0;h=p||f<S}else{for((p=u/(O[0]+1)|0)>1&&(O=e(O,p,u),F=e(F,p,u),C=O.length,S=F.length),A=C,v=(b=F.slice(0,C)).length;v<C;)b[v++]=0;(T=O.slice()).unshift(0),M=O[0],O[1]>=u/2&&++M;do{p=0,(c=t(O,b,C,v))<0?(w=b[0],C!=v&&(w=w*u+(b[1]||0)),(p=w/M|0)>1?(p>=u&&(p=u-1),1==(c=t(d=e(O,p,u),b,g=d.length,v=b.length))&&(p--,r(d,C<g?T:O,g,u))):(0==p&&(c=p=1),d=O.slice()),(g=d.length)<v&&d.unshift(0),r(b,d,v,u),-1==c&&(c=t(O,b,C,v=b.length))<1&&(p++,r(b,C<v?T:O,v,u)),v=b.length):0===c&&(p++,b=[0]),x[f++]=p,c&&b[0]?b[v++]=F[A]||0:(b=[F[A]],v=1)}while((A++<S||void 0!==b[0])&&N--);h=void 0!==b[0]}x[0]||x.shift()}if(1==m)y.e=l,Ze=h;else{for(f=1,p=x[0];p>=10;p/=10)f++;y.e=f+l*m-1,Et(y,s?o+y.e+1:o,a,h)}return y}}();function Et(e,t,r,n){var i,o,a,s,u,c,l,f,p,m=e.constructor;e:if(null!=t){if(!(f=e.d))return e;for(i=1,s=f[0];s>=10;s/=10)i++;if((o=t-i)<0)o+=7,a=t,u=(l=f[p=0])/ct(10,i-a-1)%10|0;else if((p=Math.ceil((o+1)/7))>=(s=f.length)){if(!n)break e;for(;s++<=p;)f.push(0);l=u=0,i=1,a=(o%=7)-7+1}else{for(l=s=f[p],i=1;s>=10;s/=10)i++;u=(a=(o%=7)-7+i)<0?0:l/ct(10,i-a-1)%10|0}if(n=n||t<0||void 0!==f[p+1]||(a<0?l:l%ct(10,i-a-1)),c=r<4?(u||n)&&(0==r||r==(e.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(o>0?a>0?l/ct(10,i-a):0:f[p-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,c?(t-=e.e+1,f[0]=ct(10,(7-t%7)%7),e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=p,s=1,p--):(f.length=p+1,s=ct(10,7-o),f[p]=a>0?(l/ct(10,i-a)%ct(10,a)|0)*s:0),c)for(;;){if(0==p){for(o=1,a=f[0];a>=10;a/=10)o++;for(a=f[0]+=s,s=1;a>=10;a/=10)s++;o!=s&&(e.e++,f[0]==ht&&(f[0]=1));break}if(f[p]+=s,f[p]!=ht)break;f[p--]=0,s=1}for(o=f.length;0===f[--o];)f.pop()}return rt&&(e.e>m.maxE?(e.d=null,e.e=NaN):e.e<m.minE&&(e.e=0,e.d=[0])),e}function At(e,t,r){if(!e.isFinite())return zt(e);var n,i=e.e,o=xt(e.d),a=o.length;return t?(r&&(n=r-a)>0?o=o.charAt(0)+"."+o.slice(1)+Dt(n):a>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(e.e<0?"e":"e+")+e.e):i<0?(o="0."+Dt(-i-1)+o,r&&(n=r-a)>0&&(o+=Dt(n))):i>=a?(o+=Dt(i+1-a),r&&(n=r-i-1)>0&&(o=o+"."+Dt(n))):((n=i+1)<a&&(o=o.slice(0,n)+"."+o.slice(n)),r&&(n=r-a)>0&&(i+1===a&&(o+="."),o+=Dt(n))),o}function St(e,t){var r=e[0];for(t*=7;r>=10;r/=10)t++;return t}function Mt(e,t,r){if(t>dt)throw rt=!0,r&&(e.precision=r),Error(ot);return Et(new e(Ke),t,1,!0)}function Ct(e,t,r){if(t>gt)throw Error(ot);return Et(new e(et),t,r,!0)}function Tt(e){var t=e.length-1,r=7*t+1;if(t=e[t]){for(;t%10==0;t/=10)r--;for(t=e[0];t>=10;t/=10)r++}return r}function Dt(e){for(var t="";e--;)t+="0";return t}function Bt(e,t,r,n){var i,o=new e(1),a=Math.ceil(n/7+4);for(rt=!1;;){if(r%2&&Lt((o=o.times(t)).d,a)&&(i=!0),0===(r=ut(r/2))){r=o.d.length-1,i&&0===o.d[r]&&++o.d[r];break}Lt((t=t.times(t)).d,a)}return rt=!0,o}function Ft(e){return 1&e.d[e.d.length-1]}function Ot(e,t,r){for(var n,i=new e(t[0]),o=0;++o<t.length;){if(!(n=new e(t[o])).s){i=n;break}i[r](n)&&(i=n)}return i}function _t(e,t){var r,n,i,o,a,s,u,c=0,l=0,f=0,p=e.constructor,m=p.rounding,h=p.precision;if(!e.d||!e.d[0]||e.e>17)return new p(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(null==t?(rt=!1,u=h):u=t,s=new p(.03125);e.e>-2;)e=e.times(s),f+=5;for(u+=n=Math.log(ct(2,f))/Math.LN10*2+5|0,r=o=a=new p(1),p.precision=u;;){if(o=Et(o.times(e),u,1),r=r.times(++l),xt((s=a.plus(Nt(o,r,u,1))).d).slice(0,u)===xt(a.d).slice(0,u)){for(i=f;i--;)a=Et(a.times(a),u,1);if(null!=t)return p.precision=h,a;if(!(c<3&&vt(a.d,u-n,m,c)))return Et(a,p.precision=h,m,rt=!0);p.precision=u+=10,r=o=s=new p(1),l=0,c++}a=s}}function It(e,t){var r,n,i,o,a,s,u,c,l,f,p,m=1,h=e,d=h.d,g=h.constructor,y=g.rounding,x=g.precision;if(h.s<0||!d||!d[0]||!h.e&&1==d[0]&&1==d.length)return new g(d&&!d[0]?-1/0:1!=h.s?NaN:d?0:h);if(null==t?(rt=!1,l=x):l=t,g.precision=l+=10,n=(r=xt(d)).charAt(0),!(Math.abs(o=h.e)<15e14))return c=Mt(g,l+2,x).times(o+""),h=It(new g(n+"."+r.slice(1)),l-10).plus(c),g.precision=x,null==t?Et(h,x,y,rt=!0):h;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=xt((h=h.times(e)).d)).charAt(0),m++;for(o=h.e,n>1?(h=new g("0."+r),o++):h=new g(n+"."+r.slice(1)),f=h,u=a=h=Nt(h.minus(1),h.plus(1),l,1),p=Et(h.times(h),l,1),i=3;;){if(a=Et(a.times(p),l,1),xt((c=u.plus(Nt(a,new g(i),l,1))).d).slice(0,l)===xt(u.d).slice(0,l)){if(u=u.times(2),0!==o&&(u=u.plus(Mt(g,l+2,x).times(o+""))),u=Nt(u,new g(m),l,1),null!=t)return g.precision=x,u;if(!vt(u.d,l-10,y,s))return Et(u,g.precision=x,y,rt=!0);g.precision=l+=10,c=a=h=Nt(f.minus(1),f.plus(1),l,1),p=Et(h.times(h),l,1),i=s=1}u=c,i+=2}}function zt(e){return String(e.s*e.s/0)}function kt(e,t){var r,n,i;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;48===t.charCodeAt(n);n++);for(i=t.length;48===t.charCodeAt(i-1);--i);if(t=t.slice(n,i)){if(i-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&e.d.push(+t.slice(0,n)),i-=7;n<i;)e.d.push(+t.slice(n,n+=7));n=7-(t=t.slice(n)).length}else n-=i;for(;n--;)t+="0";e.d.push(+t),rt&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function Rt(e,t){var r,n,i,o,a,s,u,c,l;if(t.indexOf("_")>-1){if(t=t.replace(/(\d)_(?=\d)/g,"$1"),mt.test(t))return kt(e,t)}else if("Infinity"===t||"NaN"===t)return+t||(e.s=NaN),e.e=NaN,e.d=null,e;if(ft.test(t))r=16,t=t.toLowerCase();else if(lt.test(t))r=2;else{if(!pt.test(t))throw Error(it+t);r=8}for((o=t.search(/p/i))>0?(u=+t.slice(o+1),t=t.substring(2,o)):t=t.slice(2),a=(o=t.indexOf("."))>=0,n=e.constructor,a&&(o=(s=(t=t.replace(".","")).length)-o,i=Bt(n,new n(r),o,2*o)),o=l=(c=wt(t,r,ht)).length-1;0===c[o];--o)c.pop();return o<0?new n(0*e.s):(e.e=St(c,l),e.d=c,rt=!1,a&&(e=Nt(e,i,4*s)),u&&(e=e.times(Math.abs(u)<54?ct(2,u):Dr.pow(2,u))),rt=!0,e)}function qt(e,t,r,n,i){var o,a,s,u,c=e.precision,l=Math.ceil(c/7);for(rt=!1,u=r.times(r),s=new e(n);;){if(a=Nt(s.times(u),new e(t++*t++),c,1),s=i?n.plus(a):n.minus(a),n=Nt(a.times(u),new e(t++*t++),c,1),void 0!==(a=s.plus(n)).d[l]){for(o=l;a.d[o]===s.d[o]&&o--;);if(-1==o)break}o=s,s=n,n=a,a=o}return rt=!0,a.d.length=l+1,a}function Pt(e,t){for(var r=e;--t;)r*=e;return r}function jt(e,t){var r,n=t.s<0,i=Ct(e,e.precision,1),o=i.times(.5);if((t=t.abs()).lte(o))return Ye=n?4:1,t;if((r=t.divToInt(i)).isZero())Ye=n?3:2;else{if((t=t.minus(r.times(i))).lte(o))return Ye=Ft(r)?n?2:3:n?4:1,t;Ye=Ft(r)?n?1:4:n?3:2}return t.minus(i).abs()}function Ut(e,t,r,n){var i,o,a,s,u,c,l,f,p,m=e.constructor,h=void 0!==r;if(h?(bt(r,1,Xe),void 0===n?n=m.rounding:bt(n,0,8)):(r=m.precision,n=m.rounding),e.isFinite()){for(h?(i=2,16==t?r=4*r-3:8==t&&(r=3*r-2)):i=t,(a=(l=At(e)).indexOf("."))>=0&&(l=l.replace(".",""),(p=new m(1)).e=l.length-a,p.d=wt(At(p),10,i),p.e=p.d.length),o=u=(f=wt(l,10,i)).length;0==f[--u];)f.pop();if(f[0]){if(a<0?o--:((e=new m(e)).d=f,e.e=o,f=(e=Nt(e,p,r,n,0,i)).d,o=e.e,c=Ze),a=f[r],s=i/2,c=c||void 0!==f[r+1],c=n<4?(void 0!==a||c)&&(0===n||n===(e.s<0?3:2)):a>s||a===s&&(4===n||c||6===n&&1&f[r-1]||n===(e.s<0?8:7)),f.length=r,c)for(;++f[--r]>i-1;)f[r]=0,r||(++o,f.unshift(1));for(u=f.length;!f[u-1];--u);for(a=0,l="";a<u;a++)l+=Qe.charAt(f[a]);if(h){if(u>1)if(16==t||8==t){for(a=16==t?4:3,--u;u%a;u++)l+="0";for(u=(f=wt(l,i,t)).length;!f[u-1];--u);for(a=1,l="1.";a<u;a++)l+=Qe.charAt(f[a])}else l=l.charAt(0)+"."+l.slice(1);l=l+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)l="0"+l;l="0."+l}else if(++o>u)for(o-=u;o--;)l+="0";else o<u&&(l=l.slice(0,o)+"."+l.slice(o))}else l=h?"0p+0":"0";l=(16==t?"0x":2==t?"0b":8==t?"0o":"")+l}else l=zt(e);return e.s<0?"-"+l:l}function Lt(e,t){if(e.length>t)return e.length=t,!0}function $t(e){return new this(e).abs()}function Ht(e){return new this(e).acos()}function Gt(e){return new this(e).acosh()}function Vt(e,t){return new this(e).plus(t)}function Wt(e){return new this(e).asin()}function Zt(e){return new this(e).asinh()}function Yt(e){return new this(e).atan()}function Jt(e){return new this(e).atanh()}function Xt(e,t){e=new this(e),t=new this(t);var r,n=this.precision,i=this.rounding,o=n+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(r=t.s<0?Ct(this,n,i):new this(0)).s=e.s:!e.d||t.isZero()?(r=Ct(this,o,1).times(.5)).s=e.s:t.s<0?(this.precision=o,this.rounding=1,r=this.atan(Nt(e,t,o,1)),t=Ct(this,o,1),this.precision=n,this.rounding=i,r=e.s<0?r.minus(t):r.plus(t)):r=this.atan(Nt(e,t,o,1)):(r=Ct(this,o,1).times(t.s>0?.25:.75)).s=e.s:r=new this(NaN),r}function Qt(e){return new this(e).cbrt()}function Kt(e){return Et(e=new this(e),e.e+1,2)}function er(e,t,r){return new this(e).clamp(t,r)}function tr(e){if(!e||"object"!=typeof e)throw Error(nt+"Object expected");var t,r,n,i=!0===e.defaults,o=["precision",1,Xe,"rounding",0,8,"toExpNeg",-Je,0,"toExpPos",0,Je,"maxE",0,Je,"minE",-Je,0,"modulo",0,9];for(t=0;t<o.length;t+=3)if(r=o[t],i&&(this[r]=tt[r]),void 0!==(n=e[r])){if(!(ut(n)===n&&n>=o[t+1]&&n<=o[t+2]))throw Error(it+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=tt[r]),void 0!==(n=e[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(it+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(at);this[r]=!0}else this[r]=!1}return this}function rr(e){return new this(e).cos()}function nr(e){return new this(e).cosh()}function ir(e,t){return new this(e).div(t)}function or(e){return new this(e).exp()}function ar(e){return Et(e=new this(e),e.e+1,3)}function sr(){var e,t,r=new this(0);for(rt=!1,e=0;e<arguments.length;)if((t=new this(arguments[e++])).d)r.d&&(r=r.plus(t.times(t)));else{if(t.s)return rt=!0,new this(1/0);r=t}return rt=!0,r.sqrt()}function ur(e){return e instanceof Dr||e&&e.toStringTag===st||!1}function cr(e){return new this(e).ln()}function lr(e,t){return new this(e).log(t)}function fr(e){return new this(e).log(2)}function pr(e){return new this(e).log(10)}function mr(){return Ot(this,arguments,"lt")}function hr(){return Ot(this,arguments,"gt")}function dr(e,t){return new this(e).mod(t)}function gr(e,t){return new this(e).mul(t)}function yr(e,t){return new this(e).pow(t)}function xr(e){var t,r,n,i,o=0,a=new this(1),s=[];if(void 0===e?e=this.precision:bt(e,1,Xe),n=Math.ceil(e/7),this.crypto)if(crypto.getRandomValues)for(t=crypto.getRandomValues(new Uint32Array(n));o<n;)(i=t[o])>=429e7?t[o]=crypto.getRandomValues(new Uint32Array(1))[0]:s[o++]=i%1e7;else{if(!crypto.randomBytes)throw Error(at);for(t=crypto.randomBytes(n*=4);o<n;)(i=t[o]+(t[o+1]<<8)+(t[o+2]<<16)+((127&t[o+3])<<24))>=214e7?crypto.randomBytes(4).copy(t,o):(s.push(i%1e7),o+=4);o=n/4}else for(;o<n;)s[o++]=1e7*Math.random()|0;for(e%=7,(n=s[--o])&&e&&(i=ct(10,7-e),s[o]=(n/i|0)*i);0===s[o];o--)s.pop();if(o<0)r=0,s=[0];else{for(r=-1;0===s[0];r-=7)s.shift();for(n=1,i=s[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return a.e=r,a.d=s,a}function br(e){return Et(e=new this(e),e.e+1,this.rounding)}function vr(e){return(e=new this(e)).d?e.d[0]?e.s:0*e.s:e.s||NaN}function wr(e){return new this(e).sin()}function Nr(e){return new this(e).sinh()}function Er(e){return new this(e).sqrt()}function Ar(e,t){return new this(e).sub(t)}function Sr(){var e=0,t=arguments,r=new this(t[e]);for(rt=!1;r.s&&++e<t.length;)r=r.plus(t[e]);return rt=!0,Et(r,this.precision,this.rounding)}function Mr(e){return new this(e).tan()}function Cr(e){return new this(e).tanh()}function Tr(e){return Et(e=new this(e),e.e+1,1)}yt[Symbol.for("nodejs.util.inspect.custom")]=yt.toString,yt[Symbol.toStringTag]="Decimal";var Dr=yt.constructor=function e(t){var r,n,i;function o(e){var t,r,n,i=this;if(!(i instanceof o))return new o(e);if(i.constructor=o,ur(e))return i.s=e.s,void(rt?!e.d||e.e>o.maxE?(i.e=NaN,i.d=null):e.e<o.minE?(i.e=0,i.d=[0]):(i.e=e.e,i.d=e.d.slice()):(i.e=e.e,i.d=e.d?e.d.slice():e.d));if("number"==(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(t=0,r=e;r>=10;r/=10)t++;return void(rt?t>o.maxE?(i.e=NaN,i.d=null):t<o.minE?(i.e=0,i.d=[0]):(i.e=t,i.d=[e]):(i.e=t,i.d=[e]))}return 0*e!=0?(e||(i.s=NaN),i.e=NaN,void(i.d=null)):kt(i,e.toString())}if("string"!==n)throw Error(it+e);return 45===(r=e.charCodeAt(0))?(e=e.slice(1),i.s=-1):(43===r&&(e=e.slice(1)),i.s=1),mt.test(e)?kt(i,e):Rt(i,e)}if(o.prototype=yt,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.EUCLID=9,o.config=o.set=tr,o.clone=e,o.isDecimal=ur,o.abs=$t,o.acos=Ht,o.acosh=Gt,o.add=Vt,o.asin=Wt,o.asinh=Zt,o.atan=Yt,o.atanh=Jt,o.atan2=Xt,o.cbrt=Qt,o.ceil=Kt,o.clamp=er,o.cos=rr,o.cosh=nr,o.div=ir,o.exp=or,o.floor=ar,o.hypot=sr,o.ln=cr,o.log=lr,o.log10=pr,o.log2=fr,o.max=mr,o.min=hr,o.mod=dr,o.mul=gr,o.pow=yr,o.random=xr,o.round=br,o.sign=vr,o.sin=wr,o.sinh=Nr,o.sqrt=Er,o.sub=Ar,o.sum=Sr,o.tan=Mr,o.tanh=Cr,o.trunc=Tr,void 0===t&&(t={}),t&&!0!==t.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)t.hasOwnProperty(n=i[r++])||(t[n]=this[n]);return o.config(t),o}(tt);Ke=new Dr(Ke),et=new Dr(et);const Br=Dr,Fr=he("BigNumber",["?on","config"],(e=>{let{on:t,config:r}=e;const n=Br.clone({precision:r.precision,modulo:Br.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)},t&&t("config",(function(e,t){e.precision!==t.precision&&n.config({precision:e.precision})})),n}),{isClass:!0}),Or=Math.cosh||function(e){return Math.abs(e)<1e-9?1-e:.5*(Math.exp(e)+Math.exp(-e))},_r=Math.sinh||function(e){return Math.abs(e)<1e-9?e:.5*(Math.exp(e)-Math.exp(-e))},Ir=function(e,t){return(e=Math.abs(e))<(t=Math.abs(t))&&([e,t]=[t,e]),e<1e8?Math.sqrt(e*e+t*t):(t/=e,e*Math.sqrt(1+t*t))},zr=function(){throw SyntaxError("Invalid Param")};function kr(e,t){const r=Math.abs(e),n=Math.abs(t);return 0===e?Math.log(n):0===t?Math.log(r):r<3e3&&n<3e3?.5*Math.log(e*e+t*t):(e*=.5,t*=.5,.5*Math.log(e*e+t*t)+Math.LN2)}const Rr={re:0,im:0},qr=function(e,t){const r=Rr;if(null==e)r.re=r.im=0;else if(void 0!==t)r.re=e,r.im=t;else switch(typeof e){case"object":if("im"in e&&"re"in e)r.re=e.re,r.im=e.im;else if("abs"in e&&"arg"in e){if(!isFinite(e.abs)&&isFinite(e.arg))return Pr.INFINITY;r.re=e.abs*Math.cos(e.arg),r.im=e.abs*Math.sin(e.arg)}else if("r"in e&&"phi"in e){if(!isFinite(e.r)&&isFinite(e.phi))return Pr.INFINITY;r.re=e.r*Math.cos(e.phi),r.im=e.r*Math.sin(e.phi)}else 2===e.length?(r.re=e[0],r.im=e[1]):zr();break;case"string":r.im=r.re=0;const t=e.replace(/_/g,"").match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g);let n=1,i=0;null===t&&zr();for(let e=0;e<t.length;e++){const o=t[e];" "===o||"\t"===o||"\n"===o||("+"===o?n++:"-"===o?i++:"i"===o||"I"===o?(n+i===0&&zr()," "===t[e+1]||isNaN(t[e+1])?r.im+=parseFloat((i%2?"-":"")+"1"):(r.im+=parseFloat((i%2?"-":"")+t[e+1]),e++),n=i=0):((n+i===0||isNaN(o))&&zr(),"i"===t[e+1]||"I"===t[e+1]?(r.im+=parseFloat((i%2?"-":"")+o),e++):r.re+=parseFloat((i%2?"-":"")+o),n=i=0))}n+i>0&&zr();break;case"number":r.im=0,r.re=e;break;default:zr()}return isNaN(r.re)||isNaN(r.im),r};function Pr(e,t){if(!(this instanceof Pr))return new Pr(e,t);const r=qr(e,t);this.re=r.re,this.im=r.im}Pr.prototype={re:0,im:0,sign:function(){const e=Ir(this.re,this.im);return new Pr(this.re/e,this.im/e)},add:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pr.NAN:Pr.INFINITY:new Pr(this.re+r.re,this.im+r.im)},sub:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im));return n||i?n&&i?Pr.NAN:Pr.INFINITY:new Pr(this.re-r.re,this.im-r.im)},mul:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,a=0===r.re&&0===r.im;return n&&a||i&&o?Pr.NAN:n||i?Pr.INFINITY:0===r.im&&0===this.im?new Pr(this.re*r.re,0):new Pr(this.re*r.re-this.im*r.im,this.re*r.im+this.im*r.re)},div:function(e,t){const r=qr(e,t),n=this.isInfinite(),i=!(isFinite(r.re)&&isFinite(r.im)),o=0===this.re&&0===this.im,a=0===r.re&&0===r.im;if(o&&a||n&&i)return Pr.NAN;if(a||n)return Pr.INFINITY;if(o||i)return Pr.ZERO;if(0===r.im)return new Pr(this.re/r.re,this.im/r.re);if(Math.abs(r.re)<Math.abs(r.im)){const e=r.re/r.im,t=r.re*e+r.im;return new Pr((this.re*e+this.im)/t,(this.im*e-this.re)/t)}{const e=r.im/r.re,t=r.im*e+r.re;return new Pr((this.re+this.im*e)/t,(this.im-this.re*e)/t)}},pow:function(e,t){const r=qr(e,t),n=0===this.re&&0===this.im;if(0===r.re&&0===r.im)return Pr.ONE;if(0===r.im){if(0===this.im&&this.re>0)return new Pr(Math.pow(this.re,r.re),0);if(0===this.re)switch((r.re%4+4)%4){case 0:return new Pr(Math.pow(this.im,r.re),0);case 1:return new Pr(0,Math.pow(this.im,r.re));case 2:return new Pr(-Math.pow(this.im,r.re),0);case 3:return new Pr(0,-Math.pow(this.im,r.re))}}if(n&&r.re>0)return Pr.ZERO;const i=Math.atan2(this.im,this.re),o=kr(this.re,this.im);let a=Math.exp(r.re*o-r.im*i),s=r.im*o+r.re*i;return new Pr(a*Math.cos(s),a*Math.sin(s))},sqrt:function(){const e=this.re,t=this.im;if(0===t)return e>=0?new Pr(Math.sqrt(e),0):new Pr(0,Math.sqrt(-e));const r=Ir(e,t);let n=Math.sqrt(.5*(r+Math.abs(e))),i=Math.abs(t)/(2*n);return e>=0?new Pr(n,t<0?-i:i):new Pr(i,t<0?-n:n)},exp:function(){const e=Math.exp(this.re);return 0===this.im?new Pr(e,0):new Pr(e*Math.cos(this.im),e*Math.sin(this.im))},expm1:function(){const e=this.re,t=this.im;return new Pr(Math.expm1(e)*Math.cos(t)+function(e){const t=Math.PI/4;if(-t>e||e>t)return Math.cos(e)-1;const r=e*e;return r*(r*(r*(r*(r*(r*(r*(r/20922789888e3-1/87178291200)+1/479001600)-1/3628800)+1/40320)-1/720)+1/24)-.5)}(t),Math.exp(e)*Math.sin(t))},log:function(){const e=this.re,t=this.im;return 0===t&&e>0?new Pr(Math.log(e),0):new Pr(kr(e,t),Math.atan2(t,e))},abs:function(){return Ir(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){const e=this.re,t=this.im;return new Pr(Math.sin(e)*Or(t),Math.cos(e)*_r(t))},cos:function(){const e=this.re,t=this.im;return new Pr(Math.cos(e)*Or(t),-Math.sin(e)*_r(t))},tan:function(){const e=2*this.re,t=2*this.im,r=Math.cos(e)+Or(t);return new Pr(Math.sin(e)/r,_r(t)/r)},cot:function(){const e=2*this.re,t=2*this.im,r=Math.cos(e)-Or(t);return new Pr(-Math.sin(e)/r,_r(t)/r)},sec:function(){const e=this.re,t=this.im,r=.5*Or(2*t)+.5*Math.cos(2*e);return new Pr(Math.cos(e)*Or(t)/r,Math.sin(e)*_r(t)/r)},csc:function(){const e=this.re,t=this.im,r=.5*Or(2*t)-.5*Math.cos(2*e);return new Pr(Math.sin(e)*Or(t)/r,-Math.cos(e)*_r(t)/r)},asin:function(){const e=this.re,t=this.im,r=new Pr(t*t-e*e+1,-2*e*t).sqrt(),n=new Pr(r.re-t,r.im+e).log();return new Pr(n.im,-n.re)},acos:function(){const e=this.re,t=this.im,r=new Pr(t*t-e*e+1,-2*e*t).sqrt(),n=new Pr(r.re-t,r.im+e).log();return new Pr(Math.PI/2-n.im,n.re)},atan:function(){const e=this.re,t=this.im;if(0===e){if(1===t)return new Pr(0,1/0);if(-1===t)return new Pr(0,-1/0)}const r=e*e+(1-t)*(1-t),n=new Pr((1-t*t-e*e)/r,-2*e/r).log();return new Pr(-.5*n.im,.5*n.re)},acot:function(){const e=this.re,t=this.im;if(0===t)return new Pr(Math.atan2(1,e),0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).atan():new Pr(0!==e?e/0:0,0!==t?-t/0:0).atan()},asec:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new Pr(0,1/0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).acos():new Pr(0!==e?e/0:0,0!==t?-t/0:0).acos()},acsc:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new Pr(Math.PI/2,1/0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).asin():new Pr(0!==e?e/0:0,0!==t?-t/0:0).asin()},sinh:function(){const e=this.re,t=this.im;return new Pr(_r(e)*Math.cos(t),Or(e)*Math.sin(t))},cosh:function(){const e=this.re,t=this.im;return new Pr(Or(e)*Math.cos(t),_r(e)*Math.sin(t))},tanh:function(){const e=2*this.re,t=2*this.im,r=Or(e)+Math.cos(t);return new Pr(_r(e)/r,Math.sin(t)/r)},coth:function(){const e=2*this.re,t=2*this.im,r=Or(e)-Math.cos(t);return new Pr(_r(e)/r,-Math.sin(t)/r)},csch:function(){const e=this.re,t=this.im,r=Math.cos(2*t)-Or(2*e);return new Pr(-2*_r(e)*Math.cos(t)/r,2*Or(e)*Math.sin(t)/r)},sech:function(){const e=this.re,t=this.im,r=Math.cos(2*t)+Or(2*e);return new Pr(2*Or(e)*Math.cos(t)/r,-2*_r(e)*Math.sin(t)/r)},asinh:function(){let e=this.im;this.im=-this.re,this.re=e;const t=this.asin();return this.re=-this.im,this.im=e,e=t.re,t.re=-t.im,t.im=e,t},acosh:function(){const e=this.acos();if(e.im<=0){const t=e.re;e.re=-e.im,e.im=t}else{const t=e.im;e.im=-e.re,e.re=t}return e},atanh:function(){const e=this.re,t=this.im,r=e>1&&0===t,n=1-e,i=1+e,o=n*n+t*t,a=0!==o?new Pr((i*n-t*t)/o,(t*n+i*t)/o):new Pr(-1!==e?e/0:0,0!==t?t/0:0),s=a.re;return a.re=kr(a.re,a.im)/2,a.im=Math.atan2(a.im,s)/2,r&&(a.im=-a.im),a},acoth:function(){const e=this.re,t=this.im;if(0===e&&0===t)return new Pr(0,Math.PI/2);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).atanh():new Pr(0!==e?e/0:0,0!==t?-t/0:0).atanh()},acsch:function(){const e=this.re,t=this.im;if(0===t)return new Pr(0!==e?Math.log(e+Math.sqrt(e*e+1)):1/0,0);const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).asinh():new Pr(0!==e?e/0:0,0!==t?-t/0:0).asinh()},asech:function(){const e=this.re,t=this.im;if(this.isZero())return Pr.INFINITY;const r=e*e+t*t;return 0!==r?new Pr(e/r,-t/r).acosh():new Pr(0!==e?e/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return Pr.INFINITY;if(this.isInfinite())return Pr.ZERO;const e=this.re,t=this.im,r=e*e+t*t;return new Pr(e/r,-t/r)},conjugate:function(){return new Pr(this.re,-this.im)},neg:function(){return new Pr(-this.re,-this.im)},ceil:function(e){return e=Math.pow(10,e||0),new Pr(Math.ceil(this.re*e)/e,Math.ceil(this.im*e)/e)},floor:function(e){return e=Math.pow(10,e||0),new Pr(Math.floor(this.re*e)/e,Math.floor(this.im*e)/e)},round:function(e){return e=Math.pow(10,e||0),new Pr(Math.round(this.re*e)/e,Math.round(this.im*e)/e)},equals:function(e,t){const r=qr(e,t);return Math.abs(r.re-this.re)<=Pr.EPSILON&&Math.abs(r.im-this.im)<=Pr.EPSILON},clone:function(){return new Pr(this.re,this.im)},toString:function(){let e=this.re,t=this.im,r="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(e)<Pr.EPSILON&&(e=0),Math.abs(t)<Pr.EPSILON&&(t=0),0===t?r+e:(0!==e?(r+=e,r+=" ",t<0?(t=-t,r+="-"):r+="+",r+=" "):t<0&&(t=-t,r+="-"),1!==t&&(r+=t),r+"i"))},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!this.isFinite()}},Pr.ZERO=new Pr(0,0),Pr.ONE=new Pr(1,0),Pr.I=new Pr(0,1),Pr.PI=new Pr(Math.PI,0),Pr.E=new Pr(Math.E,0),Pr.INFINITY=new Pr(1/0,1/0),Pr.NAN=new Pr(NaN,NaN),Pr.EPSILON=1e-15;const jr=he("Complex",[],(()=>(Object.defineProperty(Pr,"name",{value:"Complex"}),Pr.prototype.constructor=Pr,Pr.prototype.type="Complex",Pr.prototype.isComplex=!0,Pr.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},Pr.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},Pr.prototype.format=function(e){let t="",r=this.im,n=this.re;const i=Me(this.re,e),o=Me(this.im,e),a=d(e)?e:e?e.precision:null;if(null!==a){const e=Math.pow(10,-a);Math.abs(n/r)<e&&(n=0),Math.abs(r/n)<e&&(r=0)}return t=0===r?i:0===n?1===r?"i":-1===r?"-i":o+"i":r<0?-1===r?i+" - i":i+" - "+o.substring(1)+"i":1===r?i+" + i":i+" + "+o+"i",t},Pr.fromPolar=function(e){switch(arguments.length){case 1:{const e=arguments[0];if("object"==typeof e)return Pr(e);throw new TypeError("Input has to be an object with r and phi keys.")}case 2:{const e=arguments[0];let t=arguments[1];if(d(e)){if(v(t)&&t.hasBase("ANGLE")&&(t=t.toNumber("rad")),d(t))return new Pr({r:e,phi:t});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.")}default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},Pr.prototype.valueOf=Pr.prototype.toString,Pr.fromJSON=function(e){return new Pr(e)},Pr.compare=function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0},Pr)),{isClass:!0});"undefined"==typeof BigInt&&(BigInt=function(e){if(isNaN(e))throw new Error("");return e});const Ur=BigInt(0),Lr=BigInt(1),$r=BigInt(2),Hr=BigInt(5),Gr=BigInt(10),Vr={s:Lr,n:Ur,d:Lr};function Wr(e,t){try{e=BigInt(e)}catch(e){throw tn()}return e*t}function Zr(e){return"bigint"==typeof e?e:Math.floor(e)}function Yr(e,t){if(t===Ur)throw en();const r=Object.create(Kr.prototype);r.s=e<Ur?-Lr:Lr;const n=Qr(e=e<Ur?-e:e,t);return r.n=e/n,r.d=t/n,r}function Jr(e){const t={};let r=e,n=$r,i=Hr-Lr;for(;i<=r;){for(;r%n===Ur;)r/=n,t[n]=(t[n]||Ur)+Lr;i+=Lr+$r*n++}return r!==e?r>1&&(t[r]=(t[r]||Ur)+Lr):t[e]=(t[e]||Ur)+Lr,t}const Xr=function(e,t){let r=Ur,n=Lr,i=Lr;if(null==e);else if(void 0!==t){if("bigint"==typeof e)r=e;else{if(isNaN(e))throw tn();if(e%1!=0)throw rn();r=BigInt(e)}if("bigint"==typeof t)n=t;else{if(isNaN(t))throw tn();if(t%1!=0)throw rn();n=BigInt(t)}i=r*n}else if("object"==typeof e){if("d"in e&&"n"in e)r=BigInt(e.n),n=BigInt(e.d),"s"in e&&(r*=BigInt(e.s));else if(0 in e)r=BigInt(e[0]),1 in e&&(n=BigInt(e[1]));else{if("bigint"!=typeof e)throw tn();r=e}i=r*n}else if("number"==typeof e){if(isNaN(e))throw tn();if(e<0&&(i=-Lr,e=-e),e%1==0)r=BigInt(e);else if(e>0){let t=1,i=0,o=1,a=1,s=1,u=1e7;for(e>=1&&(t=10**Math.floor(1+Math.log10(e)),e/=t);o<=u&&s<=u;){let t=(i+a)/(o+s);if(e===t){o+s<=u?(r=i+a,n=o+s):s>o?(r=a,n=s):(r=i,n=o);break}e>t?(i+=a,o+=s):(a+=i,s+=o),o>u?(r=a,n=s):(r=i,n=o)}r=BigInt(r)*BigInt(t),n=BigInt(n)}}else if("string"==typeof e){let t=0,o=Ur,a=Ur,s=Ur,u=Lr,c=Lr,l=e.replace(/_/g,"").match(/\d+|./g);if(null===l)throw tn();if("-"===l[t]?(i=-Lr,t++):"+"===l[t]&&t++,l.length===t+1?a=Wr(l[t++],i):"."===l[t+1]||"."===l[t]?("."!==l[t]&&(o=Wr(l[t++],i)),t++,(t+1===l.length||"("===l[t+1]&&")"===l[t+3]||"'"===l[t+1]&&"'"===l[t+3])&&(a=Wr(l[t],i),u=Gr**BigInt(l[t].length),t++),("("===l[t]&&")"===l[t+2]||"'"===l[t]&&"'"===l[t+2])&&(s=Wr(l[t+1],i),c=Gr**BigInt(l[t+1].length)-Lr,t+=3)):"/"===l[t+1]||":"===l[t+1]?(a=Wr(l[t],i),u=Wr(l[t+2],Lr),t+=3):"/"===l[t+3]&&" "===l[t+1]&&(o=Wr(l[t],i),a=Wr(l[t+2],i),u=Wr(l[t+4],Lr),t+=5),!(l.length<=t))throw tn();n=u*c,i=r=s+n*o+c*a}else{if("bigint"!=typeof e)throw tn();r=e,i=e,n=Lr}if(n===Ur)throw en();Vr.s=i<Ur?-Lr:Lr,Vr.n=r<Ur?-r:r,Vr.d=n<Ur?-n:n};function Qr(e,t){if(!e)return t;if(!t)return e;for(;;){if(!(e%=t))return t;if(!(t%=e))return e}}function Kr(e,t){if(Xr(e,t),!(this instanceof Kr))return Yr(Vr.s*Vr.n,Vr.d);e=Qr(Vr.d,Vr.n),this.s=Vr.s,this.n=Vr.n/e,this.d=Vr.d/e}var en=function(){return new Error("Division by Zero")},tn=function(){return new Error("Invalid argument")},rn=function(){return new Error("Parameters must be integer")};Kr.prototype={s:Lr,n:Ur,d:Lr,abs:function(){return Yr(this.n,this.d)},neg:function(){return Yr(-this.s*this.n,this.d)},add:function(e,t){return Xr(e,t),Yr(this.s*this.n*Vr.d+Vr.s*this.d*Vr.n,this.d*Vr.d)},sub:function(e,t){return Xr(e,t),Yr(this.s*this.n*Vr.d-Vr.s*this.d*Vr.n,this.d*Vr.d)},mul:function(e,t){return Xr(e,t),Yr(this.s*Vr.s*this.n*Vr.n,this.d*Vr.d)},div:function(e,t){return Xr(e,t),Yr(this.s*Vr.s*this.n*Vr.d,this.d*Vr.n)},clone:function(){return Yr(this.s*this.n,this.d)},mod:function(e,t){if(void 0===e)return Yr(this.s*this.n%this.d,Lr);if(Xr(e,t),Ur===Vr.n*this.d)throw en();return Yr(this.s*(Vr.d*this.n)%(Vr.n*this.d),Vr.d*this.d)},gcd:function(e,t){return Xr(e,t),Yr(Qr(Vr.n,this.n)*Qr(Vr.d,this.d),Vr.d*this.d)},lcm:function(e,t){return Xr(e,t),Vr.n===Ur&&this.n===Ur?Yr(Ur,Lr):Yr(Vr.n*this.n,Qr(Vr.n,this.n)*Qr(Vr.d,this.d))},inverse:function(){return Yr(this.s*this.d,this.n)},pow:function(e,t){if(Xr(e,t),Vr.d===Lr)return Vr.s<Ur?Yr((this.s*this.d)**Vr.n,this.n**Vr.n):Yr((this.s*this.n)**Vr.n,this.d**Vr.n);if(this.s<Ur)return null;let r=Jr(this.n),n=Jr(this.d),i=Lr,o=Lr;for(let e in r)if("1"!==e){if("0"===e){i=Ur;break}if(r[e]*=Vr.n,r[e]%Vr.d!==Ur)return null;r[e]/=Vr.d,i*=BigInt(e)**r[e]}for(let e in n)if("1"!==e){if(n[e]*=Vr.n,n[e]%Vr.d!==Ur)return null;n[e]/=Vr.d,o*=BigInt(e)**n[e]}return Vr.s<Ur?Yr(o,i):Yr(i,o)},log:function(e,t){if(Xr(e,t),this.s<=Ur||Vr.s<=Ur)return null;const r={},n=Jr(Vr.n),i=Jr(Vr.d),o=Jr(this.n),a=Jr(this.d);for(const e in i)n[e]=(n[e]||Ur)-i[e];for(const e in a)o[e]=(o[e]||Ur)-a[e];for(const e in n)"1"!==e&&(r[e]=!0);for(const e in o)"1"!==e&&(r[e]=!0);let s=null,u=null;for(const e in r){const t=n[e]||Ur,r=o[e]||Ur;if(t===Ur){if(r!==Ur)return null;continue}let i=r,a=t;const c=Qr(i,a);if(i/=c,a/=c,null===s&&null===u)s=i,u=a;else if(i*u!=s*a)return null}return null!==s&&null!==u?Yr(s,u):null},equals:function(e,t){return Xr(e,t),this.s*this.n*Vr.d==Vr.s*Vr.n*this.d},lt:function(e,t){return Xr(e,t),this.s*this.n*Vr.d<Vr.s*Vr.n*this.d},lte:function(e,t){return Xr(e,t),this.s*this.n*Vr.d<=Vr.s*Vr.n*this.d},gt:function(e,t){return Xr(e,t),this.s*this.n*Vr.d>Vr.s*Vr.n*this.d},gte:function(e,t){return Xr(e,t),this.s*this.n*Vr.d>=Vr.s*Vr.n*this.d},compare:function(e,t){Xr(e,t);let r=this.s*this.n*Vr.d-Vr.s*Vr.n*this.d;return(Ur<r)-(r<Ur)},ceil:function(e){return e=Gr**BigInt(e||0),Yr(Zr(this.s*e*this.n/this.d)+(e*this.n%this.d>Ur&&this.s>=Ur?Lr:Ur),e)},floor:function(e){return e=Gr**BigInt(e||0),Yr(Zr(this.s*e*this.n/this.d)-(e*this.n%this.d>Ur&&this.s<Ur?Lr:Ur),e)},round:function(e){return e=Gr**BigInt(e||0),Yr(Zr(this.s*e*this.n/this.d)+this.s*((this.s>=Ur?Lr:Ur)+$r*(e*this.n%this.d)>this.d?Lr:Ur),e)},roundTo:function(e,t){Xr(e,t);const r=this.n*Vr.d,n=this.d*Vr.n,i=r%n;let o=Zr(r/n);return i+i>=n&&o++,Yr(this.s*o*Vr.n,Vr.d)},divisible:function(e,t){return Xr(e,t),!(!(Vr.n*this.d)||this.n*Vr.d%(Vr.n*this.d))},valueOf:function(){return Number(this.s*this.n)/Number(this.d)},toString:function(e){let t=this.n,r=this.d;e=e||15;let n=function(e,t){for(;t%$r===Ur;t/=$r);for(;t%Hr===Ur;t/=Hr);if(t===Lr)return Ur;let r=Gr%t,n=1;for(;r!==Lr;n++)if(r=r*Gr%t,n>2e3)return Ur;return BigInt(n)}(0,r),i=function(e,t,r){let n=Lr,i=function(e,t,r){let n=Lr;for(;t>Ur;e=e*e%r,t>>=Lr)t&Lr&&(n=n*e%r);return n}(Gr,r,t);for(let e=0;e<300;e++){if(n===i)return BigInt(e);n=n*Gr%t,i=i*Gr%t}return 0}(0,r,n),o=this.s<Ur?"-":"";if(o+=Zr(t/r),t%=r,t*=Gr,t&&(o+="."),n){for(let e=i;e--;)o+=Zr(t/r),t%=r,t*=Gr;o+="(";for(let e=n;e--;)o+=Zr(t/r),t%=r,t*=Gr;o+=")"}else for(let n=e;t&&n--;)o+=Zr(t/r),t%=r,t*=Gr;return o},toFraction:function(e){let t=this.n,r=this.d,n=this.s<Ur?"-":"";if(r===Lr)n+=t;else{let i=Zr(t/r);e&&i>Ur&&(n+=i,n+=" ",t%=r),n+=t,n+="/",n+=r}return n},toLatex:function(e){let t=this.n,r=this.d,n=this.s<Ur?"-":"";if(r===Lr)n+=t;else{let i=Zr(t/r);e&&i>Ur&&(n+=i,t%=r),n+="\\frac{",n+=t,n+="}{",n+=r,n+="}"}return n},toContinued:function(){let e=this.n,t=this.d,r=[];do{r.push(Zr(e/t));let n=e%t;e=t,t=n}while(e!==Lr);return r},simplify:function(e){const t=BigInt(1/(e||.001)|0),r=this.abs(),n=r.toContinued();for(let e=1;e<n.length;e++){let i=Yr(n[e-1],Lr);for(let t=e-2;t>=0;t--)i=i.inverse().add(n[t]);let o=i.sub(r);if(o.n*t<o.d)return i.mul(this.s)}return this}};const nn=he("Fraction",[],(()=>(Object.defineProperty(Kr,"name",{value:"Fraction"}),Kr.prototype.constructor=Kr,Kr.prototype.type="Fraction",Kr.prototype.isFraction=!0,Kr.prototype.toJSON=function(){return{mathjs:"Fraction",n:String(this.s*this.n),d:String(this.d)}},Kr.fromJSON=function(e){return new Kr(e)},Kr)),{isClass:!0});r(3362),r(1795);const on=he("Range",[],(()=>{function e(t,r,n){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");const i=null!=t,o=null!=r,a=null!=n;if(i)if(g(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter start must be a number");if(o)if(g(r))r=r.toNumber();else if("number"!=typeof r)throw new TypeError("Parameter end must be a number");if(a)if(g(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter step must be a number");this.start=i?parseFloat(t):0,this.end=o?parseFloat(r):0,this.step=a?parseFloat(n):1}return e.prototype.type="Range",e.prototype.isRange=!0,e.parse=function(t){if("string"!=typeof t)return null;const r=t.split(":").map((function(e){return parseFloat(e)}));if(r.some((function(e){return isNaN(e)})))return null;switch(r.length){case 2:return new e(r[0],r[1]);case 3:return new e(r[0],r[2],r[1]);default:return null}},e.prototype.clone=function(){return new e(this.start,this.end,this.step)},e.prototype.size=function(){let e=0;const t=this.start,r=this.step,n=this.end-t;return be(r)===be(n)?e=Math.ceil(n/r):0===n&&(e=0),isNaN(e)&&(e=0),[e]},e.prototype.min=function(){const e=this.size()[0];return e>0?this.step>0?this.start:this.start+(e-1)*this.step:void 0},e.prototype.max=function(){const e=this.size()[0];return e>0?this.step>0?this.start+(e-1)*this.step:this.start:void 0},e.prototype.forEach=function(e){let t=this.start;const r=this.step,n=this.end;let i=0;if(r>0)for(;t<n;)e(t,[i],this),t+=r,i++;else if(r<0)for(;t>n;)e(t,[i],this),t+=r,i++},e.prototype.map=function(e){const t=[];return this.forEach((function(r,n,i){t[n[0]]=e(r,n,i)})),t},e.prototype.toArray=function(){const e=[];return this.forEach((function(t,r){e[r[0]]=t})),e},e.prototype.valueOf=function(){return this.toArray()},e.prototype.format=function(e){let t=Me(this.start,e);return 1!==this.step&&(t+=":"+Me(this.step,e)),t+=":"+Me(this.end,e),t},e.prototype.toString=function(){return this.format()},e.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},e.fromJSON=function(t){return new e(t.start,t.end,t.step)},e}),{isClass:!0}),an=he("Matrix",[],(()=>{function e(){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator")}return e.prototype.type="Matrix",e.prototype.isMatrix=!0,e.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},e.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},e.prototype.create=function(e,t){throw new Error("Cannot invoke create on a Matrix interface")},e.prototype.subset=function(e,t,r){throw new Error("Cannot invoke subset on a Matrix interface")},e.prototype.get=function(e){throw new Error("Cannot invoke get on a Matrix interface")},e.prototype.set=function(e,t,r){throw new Error("Cannot invoke set on a Matrix interface")},e.prototype.resize=function(e,t){throw new Error("Cannot invoke resize on a Matrix interface")},e.prototype.reshape=function(e,t){throw new Error("Cannot invoke reshape on a Matrix interface")},e.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},e.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},e.prototype.map=function(e,t){throw new Error("Cannot invoke map on a Matrix interface")},e.prototype.forEach=function(e){throw new Error("Cannot invoke forEach on a Matrix interface")},e.prototype[Symbol.iterator]=function(){throw new Error("Cannot iterate a Matrix interface")},e.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},e.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},e.prototype.format=function(e){throw new Error("Cannot invoke format on a Matrix interface")},e.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},e}),{isClass:!0});function sn(){return sn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},sn.apply(null,arguments)}function un(e,t,r){const n=new(0,e.constructor)(2);let i="";if(r){if(r<1)throw new Error("size must be in greater than 0");if(!ye(r))throw new Error("size must be an integer");if(e.greaterThan(n.pow(r-1).sub(1))||e.lessThan(n.pow(r-1).mul(-1)))throw new Error(`Value must be in range [-2^${r-1}, 2^${r-1}-1]`);if(!e.isInteger())throw new Error("Value must be an integer");e.lessThan(0)&&(e=e.add(n.pow(r))),i=`i${r}`}switch(t){case 2:return`${e.toBinary()}${i}`;case 8:return`${e.toOctal()}${i}`;case 16:return`${e.toHexadecimal()}${i}`;default:throw new Error(`Base ${t} not supported `)}}function cn(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function ln(e,t){return d(e)?e:g(e)?e.toNumber():t}function fn(e,t){const r=e.length-t.length,n=e.length;return e.substring(r,n)===t}function pn(e,t){const r=function(e,t){return"number"==typeof e?Me(e,t):g(e)?function(e,t){if("function"==typeof t)return t(e);if(!e.isFinite())return e.isNaN()?"NaN":e.gt(0)?"Infinity":"-Infinity";const{notation:r,precision:n,wordSize:i}=Ce(t);switch(r){case"fixed":return function(e,t){return e.toFixed(t)}(e,n);case"exponential":return cn(e,n);case"engineering":return function(e,t){const r=e.e,n=r%3==0?r:r<0?r-3-r%3:r-r%3;let i=e.mul(Math.pow(10,-n)).toPrecision(t);return i.includes("e")&&(i=new(0,e.constructor)(i).toFixed()),i+"e"+(r>=0?"+":"")+n.toString()}(e,n);case"bin":return un(e,2,i);case"oct":return un(e,8,i);case"hex":return un(e,16,i);case"auto":{const r=ln(null==t?void 0:t.lowerExp,-3),i=ln(null==t?void 0:t.upperExp,5);if(e.isZero())return"0";let o;const a=e.toSignificantDigits(n),s=a.e;return o=s>=r&&s<i?a.toFixed():cn(e,n),o.replace(/((\.\d*?)(0+))($|e)/,(function(){const e=arguments[2],t=arguments[4];return"."!==e?e+t:t}))}default:throw new Error('Unknown notation "'+r+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(e,t):function(e){return e&&"object"==typeof e&&"bigint"==typeof e.s&&"bigint"==typeof e.n&&"bigint"==typeof e.d||!1}(e)?t&&"decimal"===t.fraction?e.toString():`${e.s*e.n}/${e.d}`:Array.isArray(e)?gn(e,t):w(e)?mn(e):"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):"{"+Object.keys(e).map((r=>mn(r)+": "+pn(e[r],t))).join(", ")+"}":String(e)}(e,t);return t&&"object"==typeof t&&"truncate"in t&&r.length>t.truncate?r.substring(0,t.truncate-3)+"...":r}function mn(e){const t=String(e);let r="",n=0;for(;n<t.length;){const e=t.charAt(n);r+=e in hn?hn[e]:e,n++}return'"'+r+'"'}r(2712),r(8872);const hn={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function dn(e){let t=String(e);return t=t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),t}function gn(e,t){if(Array.isArray(e)){let r="[";const n=e.length;for(let i=0;i<n;i++)0!==i&&(r+=", "),r+=gn(e[i],t);return r+="]",r}return pn(e,t)}function yn(e,t){if(!w(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(e)+", index: 0)");if(!w(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+oe(t)+", index: 1)");return e===t?0:e>t?1:-1}function xn(e,t,r){if(!(this instanceof xn))throw new SyntaxError("Constructor must be called with the new operator");this.actual=e,this.expected=t,this.relation=r,this.message="Dimension mismatch ("+(Array.isArray(e)?"["+e.join(", ")+"]":e)+" "+(this.relation||"!=")+" "+(Array.isArray(t)?"["+t.join(", ")+"]":t)+")",this.stack=(new Error).stack}function bn(e,t,r){if(!(this instanceof bn))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=t):(this.min=t,this.max=r),void 0!==this.min&&this.index<this.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 vn(e){const t=[];for(;Array.isArray(e);)t.push(e.length),e=e[0];return t}function wn(e,t,r){let n;const i=e.length;if(i!==t[r])throw new xn(i,t[r]);if(r<t.length-1){const o=r+1;for(n=0;n<i;n++){const r=e[n];if(!Array.isArray(r))throw new xn(t.length-1,t.length,"<");wn(e[n],t,o)}}else for(n=0;n<i;n++)if(Array.isArray(e[n]))throw new xn(t.length+1,t.length,">")}function Nn(e,t){if(0===t.length){if(Array.isArray(e))throw new xn(e.length,0)}else wn(e,t,0)}function En(e,t){const r=e.isMatrix?e._size:vn(e);t._sourceSize.forEach(((e,t)=>{if(null!==e&&e!==r[t])throw new xn(e,r[t])}))}function An(e,t){if(void 0!==e){if(!d(e)||!ye(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new bn(e,t)}}function Sn(e){for(let t=0;t<e._dimensions.length;++t){const r=e._dimensions[t];if(r._data&&N(r._data)){if(0===r._size[0])return!0}else if(r.isRange){if(r.start===r.end)return!0}else if(w(r)&&0===r.length)return!0}return!1}function Mn(e,t,r){if(!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new Error("Resizing to scalar is not supported");return t.forEach((function(e){if(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+pn(t)+")")})),(d(e)||g(e))&&(e=[e]),Cn(e,t,0,void 0!==r?r:0),e}function Cn(e,t,r,n){let i,o;const a=e.length,s=t[r],u=Math.min(a,s);if(e.length=s,r<t.length-1){const a=r+1;for(i=0;i<u;i++)o=e[i],Array.isArray(o)||(o=[o],e[i]=o),Cn(o,t,a,n);for(i=u;i<s;i++)o=[],e[i]=o,Cn(o,t,a,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 Tn(e,t){const r=zn(e),n=r.length;if(!Array.isArray(e)||!Array.isArray(t))throw new TypeError("Array expected");if(0===t.length)throw new xn(0,n,"!=");const i=Bn(t=Dn(t,n));if(n!==i)throw new xn(i,n,"!=");try{return function(e,t){let r,n=e;for(let e=t.length-1;e>0;e--){const i=t[e];r=[];const o=n.length/i;for(let e=0;e<o;e++)r.push(n.slice(e*i,(e+1)*i));n=r}return n}(r,t)}catch(e){if(e instanceof xn)throw new xn(i,n,"!=");throw e}}function Dn(e,t){const r=Bn(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(t%r!=0)throw new Error("Could not replace wildcard, since "+t+" is no multiple of "+-r);n[i]=-t/r}return n}function Bn(e){return e.reduce(((e,t)=>e*t),1)}function Fn(e,t){const r=t||vn(e);for(;Array.isArray(e)&&1===e.length;)e=e[0],r.shift();let n=r.length;for(;1===r[n-1];)n--;return n<r.length&&(e=On(e,n,0),r.length=n),e}function On(e,t,r){let n,i;if(r<t){const o=r+1;for(n=0,i=e.length;n<i;n++)e[n]=On(e[n],t,o)}else for(;Array.isArray(e);)e=e[0];return e}function _n(e,t,r,n){const i=n||vn(e);if(r)for(let t=0;t<r;t++)e=[e],i.unshift(1);for(e=In(e,t,0);i.length<t;)i.push(1);return e}function In(e,t,r){let n,i;if(Array.isArray(e)){const o=r+1;for(n=0,i=e.length;n<i;n++)e[n]=In(e[n],t,o)}else for(let n=r;n<t;n++)e=[e];return e}function zn(e){if(!Array.isArray(e))return e;const t=[];return e.forEach((function e(r){Array.isArray(r)?r.forEach(e):t.push(r)})),t}function kn(e,t){return Array.prototype.map.call(e,t)}function Rn(e,t){Array.prototype.forEach.call(e,t)}function qn(e,t){if(1!==vn(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(e=>t.test(e)))}function Pn(e,t){return Array.prototype.join.call(e,t)}function jn(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];let r=0;t[0]={value:e[0],identifier:0};for(let n=1;n<e.length;n++)e[n]===e[n-1]?r++:r=0,t.push({value:e[n],identifier:r});return t}function Un(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;const t=[];for(let r=0;r<e.length;r++)t.push(e[r].value);return t}function Ln(e,t){let r,n=0;for(let i=0;i<e.length;i++){const o=e[i],a=Array.isArray(o);if(0===i&&a&&(n=o.length),a&&o.length!==n)return;const s=a?Ln(o,t):t(o);if(void 0===r)r=s;else if(r!==s)return"mixed"}return r}function $n(e,t,r,n){if(n<r){if(e.length!==t.length)throw new xn(e.length,t.length);const i=[];for(let o=0;o<e.length;o++)i[o]=$n(e[o],t[o],r,n+1);return i}return e.concat(t)}function Hn(){const e=Array.prototype.slice.call(arguments,0,-1),t=Array.prototype.slice.call(arguments,-1);if(1===e.length)return e[0];if(e.length>1)return e.slice(1).reduce((function(e,r){return $n(e,r,t,0)}),e[0]);throw new Error("Wrong number of arguments in function concat")}function Gn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=t.map((e=>e.length)),i=Math.max(...n),o=new Array(i).fill(null);for(let e=0;e<t.length;e++){const r=t[e],a=n[e];for(let e=0;e<a;e++){const t=i-a+e;r[e]>o[t]&&(o[t]=r[e])}}for(let e=0;e<t.length;e++)Vn(t[e],o);return o}function Vn(e,t){const r=t.length,n=e.length;for(let i=0;i<n;i++){const o=r-n+i;if(e[i]<t[o]&&e[i]>1||e[i]>t[o])throw new Error(`shape missmatch: missmatch is found in arg with shape (${e}) not possible to broadcast dimension ${n} with size ${e[i]} to size ${t[o]}`)}}function Wn(e,t){let r=vn(e);if(ce(r,t))return e;Vn(r,t);const n=Gn(r,t),i=n.length,o=[...Array(i-r.length).fill(1),...r];let a=function(e){return sn([],e)}(e);r.length<i&&(a=Tn(a,o),r=vn(a));for(let e=0;e<i;e++)r[e]<n[e]&&(s=a,u=n[e],c=e,a=Hn(...Array(u).fill(s),c),r=vn(a));var s,u,c;return a}function Zn(e,t){if(!Array.isArray(e))throw new Error("Array expected");const r=vn(e);if(t.length!==r.length)throw new xn(t.length,r.length);for(let e=0;e<t.length;e++)An(t[e],r[e]);return t.reduce(((e,t)=>e[t]),e)}function Yn(e,t,r,n){return Array.isArray(e)?e.map((function(e,i){return Yn(e,t.concat(i),r,n)})):n(e,t,r)}function Jn(e,r,n){if(t.isTypedFunction(e)){const i=(r.isMatrix?r.size():vn(r)).map((()=>0)),o=r.isMatrix?r.get(i):Zn(r,i),a=1===Object.keys(e.signatures).length,s=function(e,r,n,i){const o=[r,n,i];for(let r=3;r>0;r--){const n=o.slice(0,r);if(null!==t.resolve(e,n))return r}}(e,o,i,r),u=a?Object.values(e.signatures)[0]:e;return s>=1&&s<=3?function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Xn(u,r.slice(0,s),n,e.name)}:function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return Xn(u,r,n,e.name)}}return e}function Xn(e,t,r,n){try{return e(...t)}catch(e){!function(e,t,r,n){var i;if(e instanceof TypeError&&"wrongType"===(null===(i=e.data)||void 0===i?void 0:i.category)){const e=[];throw e.push(`value: ${oe(t[0])}`),t.length>=2&&e.push(`index: ${oe(t[1])}`),t.length>=3&&e.push(`array: ${oe(t[2])}`),new TypeError(`Function ${r} cannot apply callback arguments ${n}(${e.join(", ")}) at index ${JSON.stringify(t[1])}`)}throw new TypeError(`Function ${r} cannot apply callback arguments to function ${n}: ${e.message}`)}(e,t,r,n)}}xn.prototype=new RangeError,xn.prototype.constructor=RangeError,xn.prototype.name="DimensionError",xn.prototype.isDimensionError=!0,bn.prototype=new RangeError,bn.prototype.constructor=RangeError,bn.prototype.name="IndexError",bn.prototype.isIndexError=!0,r(3110);const Qn=he("DenseMatrix",["Matrix"],(e=>{let{Matrix:t}=e;function r(e,t){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))"DenseMatrix"===e.type?(this._data=ae(e._data),this._size=ae(e._size),this._datatype=t||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=t||e._datatype);else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,Nn(this._data,this._size),this._datatype=t||e.datatype;else if(N(e))this._data=s(e),this._size=vn(this._data),Nn(this._data,this._size),this._datatype=t;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t}}function n(e,t,r,i){const o=i===r-1,a=t.dimension(i);return o?a.map((function(t){return An(t,e.length),e[t]})).valueOf():a.map((function(o){return An(o,e.length),n(e[o],t,r,i+1)})).valueOf()}function i(e,t,r,n,o){const a=o===n-1,s=t.dimension(o);a?s.forEach((function(t,n){An(t),e[t]=r[n[0]]})):s.forEach((function(a,s){An(a),i(e[a],t,r[s[0]],n,o+1)}))}function o(e,t,r){if(0===t.length){let t=e._data;for(;N(t);)t=t[0];return t}return e._size=t.slice(0),e._data=Mn(e._data,e._size,r),e}function a(e,t,r){const n=e._size.slice(0);let i=!1;for(;n.length<t.length;)n.push(0),i=!0;for(let e=0,r=t.length;e<r;e++)t[e]>n[e]&&(n[e]=t[e],i=!0);i&&o(e,n,r)}function s(e){return E(e)?s(e.valueOf()):N(e)?e.map(s):e}return r.prototype=new t,r.prototype.createDenseMatrix=function(e,t){return new r(e,t)},Object.defineProperty(r,"name",{value:"DenseMatrix"}),r.prototype.constructor=r,r.prototype.type="DenseMatrix",r.prototype.isDenseMatrix=!0,r.prototype.getDataType=function(){return Ln(this._data,oe)},r.prototype.storage=function(){return"dense"},r.prototype.datatype=function(){return this._datatype},r.prototype.create=function(e,t){return new r(e,t)},r.prototype.subset=function(e,t,o){switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());{const i=t.size();if(i.length!==e._size.length)throw new xn(i.length,e._size.length);const o=t.min(),a=t.max();for(let t=0,r=e._size.length;t<r;t++)An(o[t],e._size[t]),An(a[t],e._size[t]);return new r(n(e._data,t,i.length,0),e._datatype)}}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const o=t.size(),s=t.isScalar();let u;if(E(r)?(u=r.size(),r=r.valueOf()):u=vn(r),s){if(0!==u.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(!ce(u,o))try{u=vn(r=0===u.length?Wn([r],o):Wn(r,o))}catch(e){}if(o.length<e._size.length)throw new xn(o.length,e._size.length,"<");if(u.length<o.length){let e=0,t=0;for(;1===o[e]&&1===u[e];)e++;for(;1===o[e];)t++,e++;r=_n(r,o.length,t,u)}if(!ce(o,u))throw new xn(o,u,">");a(e,t.max().map((function(e){return e+1})),n);const s=o.length,c=0;i(e._data,t,r,s,c)}return e}(this,e,t,o);default:throw new SyntaxError("Wrong number of arguments")}},r.prototype.get=function(e){return Zn(this._data,e)},r.prototype.set=function(e,t,r){if(!N(e))throw new TypeError("Array expected");if(e.length<this._size.length)throw new xn(e.length,this._size.length,"<");let n,i,o;const s=e.map((function(e){return e+1}));a(this,s,r);let u=this._data;for(n=0,i=e.length-1;n<i;n++)o=e[n],An(o,u.length),u=u[o];return o=e[e.length-1],An(o,u.length),u[o]=t,this},r.prototype.resize=function(e,t,r){if(!A(e))throw new TypeError("Array or Matrix expected");const n=e.valueOf().map((e=>Array.isArray(e)&&1===e.length?e[0]:e));return o(r?this.clone():this,n,t)},r.prototype.reshape=function(e,t){const r=t?this.clone():this;r._data=Tn(r._data,e);const n=r._size.reduce(((e,t)=>e*t));return r._size=Dn(e,n),r},r.prototype.clone=function(){return new r({data:ae(this._data),size:ae(this._size),datatype:this._datatype})},r.prototype.size=function(){return this._size.slice(0)},r.prototype._forEach=function(e){const t=this,r=t.size();if(1===r.length){for(let n=0;n<r[0];n++)e(t._data,n,[n]);return}const n=Array(r.length).fill(0),i=Array(r.length-1),o=i.length-1;i[0]=t._data[0];for(let e=0;e<o;e++)i[e+1]=i[e][0];for(n[o]=-1;;){let a;for(a=o;a>=0;a--){if(n[a]++,n[a]!==r[a]){i[a]=0===a?t._data[n[a]]:i[a-1][n[a]];for(let e=a;e<o;e++)i[e+1]=i[e][0];for(let t=0;t<r[i.length];t++)n[i.length]=t,e(i[o],t,n.slice(0));break}n[a]=0}if(-1===a)break}},r.prototype.map=function(e){const t=this,n=new r(t),i=Jn(e,t._data,"map");return n._forEach((function(e,r,n){e[r]=i(e[r],n,t)})),n},r.prototype.forEach=function(e){const t=this,r=Jn(e,t._data,"map");t._forEach((function(e,n,i){r(e[n],i,t)}))},r.prototype[Symbol.iterator]=function*(){const e=function*(t,r){if(N(t))for(let n=0;n<t.length;n++)yield*e(t[n],r.concat(n));else yield{value:t,index:r}};yield*e(this._data,[])},r.prototype.rows=function(){const e=[];if(2!==this.size().length)throw new TypeError("Rows can only be returned for a 2D matrix.");const t=this._data;for(const n of t)e.push(new r([n],this._datatype));return e},r.prototype.columns=function(){const e=[],t=this.size();if(2!==t.length)throw new TypeError("Rows can only be returned for a 2D matrix.");const n=this._data;for(let i=0;i<t[1];i++){const t=n.map((e=>[e[i]]));e.push(new r(t,this._datatype))}return e},r.prototype.toArray=function(){return ae(this._data)},r.prototype.valueOf=function(){return this._data},r.prototype.format=function(e){return pn(this._data,e)},r.prototype.toString=function(){return pn(this._data)},r.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},r.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,n=e<0?-e:0,i=this._size[0],o=this._size[1],a=Math.min(i-n,o-t),s=[];for(let e=0;e<a;e++)s[e]=this._data[e+n][e+t];return new r({data:s,size:[a],datatype:this._datatype})},r.diagonal=function(e,t,n,i){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),n){if(g(n)&&(n=n.toNumber()),!d(n)||!ye(n))throw new TypeError("The parameter k must be an integer number")}else n=0;const o=n>0?n:0,a=n<0?-n:0,s=e[0],u=e[1],c=Math.min(s-a,u-o);let l;if(N(t)){if(t.length!==c)throw new Error("Invalid value array length");l=function(e){return t[e]}}else if(E(t)){const e=t.size();if(1!==e.length||e[0]!==c)throw new Error("Invalid matrix length");l=function(e){return t.get([e])}}else l=function(){return t};i||(i=g(l(0))?l(0).mul(0):0);let f=[];if(e.length>0){f=Mn(f,e,i);for(let e=0;e<c;e++)f[e+a][e+o]=l(e)}return new r({data:f,size:[s,u]})},r.fromJSON=function(e){return new r(e)},r.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return An(e,this._size[0]),An(t,this._size[0]),r._swapRows(e,t,this._data),this},r._swapRows=function(e,t,r){const n=r[e];r[e]=r[t],r[t]=n},r}),{isClass:!0}),Kn="clone",ei=he(Kn,["typed"],(e=>{let{typed:t}=e;return t(Kn,{any:ae})}));function ti(e){const t=e.length,r=e[0].length;let n,i;const o=[];for(i=0;i<r;i++){const r=[];for(n=0;n<t;n++)r.push(e[n][i]);o.push(r)}return o}function ri(e){for(let t=0;t<e.length;t++)if(A(e[t]))return!0;return!1}function ni(e,t){E(e)&&(e=e.valueOf());for(let r=0,n=e.length;r<n;r++){const n=e[r];Array.isArray(n)?ni(n,t):t(n)}}function ii(e,t,r){return e&&"function"==typeof e.map?e.map((function(e){return ii(e,t,r)})):t(e)}function oi(e,t,r){const n=Array.isArray(e)?vn(e):e.size();if(t<0||t>=n.length)throw new bn(t,n.length);return E(e)?e.create(ai(e.valueOf(),t,r),e.datatype()):ai(e,t,r)}function ai(e,t,r){let n,i,o,a;if(t<=0){if(Array.isArray(e[0])){for(a=ti(e),i=[],n=0;n<a.length;n++)i[n]=ai(a[n],t-1,r);return i}for(o=e[0],n=1;n<e.length;n++)o=r(o,e[n]);return o}for(i=[],n=0;n<e.length;n++)i[n]=ai(e[n],t-1,r);return i}function si(e,t,r,n,i,o,a,s,u,c,l){const f=e._values,p=e._index,m=e._ptr;let h,d,g,y;if(n)for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],r[y]!==o?(r[y]=o,a.push(y),c?(n[y]=u?s(f[h],l):s(l,f[h]),i[y]=o):n[y]=f[h]):(n[y]=u?s(f[h],n[y]):s(n[y],f[h]),i[y]=o);else for(d=m[t],g=m[t+1],h=d;h<g;h++)y=p[h],r[y]!==o?(r[y]=o,a.push(y)):i[y]=o}const ui="isInteger",ci=he(ui,["typed"],(e=>{let{typed:t}=e;return t(ui,{number:ye,BigNumber:function(e){return e.isInt()},bigint:function(e){return!0},Fraction:function(e){return 1n===e.d},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})}));r(2577);const li="number";function fi(e){return e<0}function pi(e){return e>0}function mi(e){return Number.isNaN(e)}function hi(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e-9,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(r<=0)throw new Error("Relative tolerance must be greater than 0");if(n<0)throw new Error("Absolute tolerance must be at least 0");return!e.isNaN()&&!t.isNaN()&&(e.isFinite()&&t.isFinite()?!!e.eq(t)||e.minus(t).abs().lte(e.constructor.max(e.constructor.max(e.abs(),t.abs()).mul(r),n)):e.eq(t))}fi.signature=li,pi.signature=li,mi.signature=li;const di="isNegative",gi=he(di,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(di,{number:e=>!_e(e,0,r.relTol,r.absTol)&&fi(e),BigNumber:e=>!hi(e,new e.constructor(0),r.relTol,r.absTol)&&e.isNeg()&&!e.isZero()&&!e.isNaN(),bigint:e=>e<0n,Fraction:e=>e.s<0n,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),yi="isNumeric",xi=he(yi,["typed"],(e=>{let{typed:t}=e;return t(yi,{"number | BigNumber | bigint | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),bi="hasNumericValue",vi=he(bi,["typed","isNumeric"],(e=>{let{typed:t,isNumeric:r}=e;return t(bi,{boolean:()=>!0,string:function(e){return e.trim().length>0&&!isNaN(Number(e))},any:function(e){return r(e)}})})),wi="isPositive",Ni=he(wi,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(wi,{number:e=>!_e(e,0,r.relTol,r.absTol)&&pi(e),BigNumber:e=>!(hi(e,new e.constructor(0),r.relTol,r.absTol)||e.isNeg()||e.isZero()||e.isNaN()),bigint:e=>e>0n,Fraction:e=>e.s>0n&&e.n>0n,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ei="isZero",Ai=he(Ei,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return t(Ei,{"number | BigNumber | Complex | Fraction":e=>r(e,0),bigint:e=>0n===e,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Si="isNaN",Mi=he(Si,["typed"],(e=>{let{typed:t}=e;return t(Si,{number:mi,BigNumber:function(e){return e.isNaN()},bigint:function(e){return!1},Fraction:function(e){return!1},Complex:function(e){return e.isNaN()},Unit:function(e){return Number.isNaN(e.value)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ci="typeOf",Ti=he(Ci,["typed"],(e=>{let{typed:t}=e;return t(Ci,{any:oe})})),Di=he("compareUnits",["typed"],(e=>{let{typed:t}=e;return{"Unit, Unit":t.referToSelf((e=>(r,n)=>{if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return t.find(e,[r.valueType(),n.valueType()])(r.value,n.value)}))}})),Bi="equalScalar",Fi=he(Bi,["typed","config"],(e=>{let{typed:t,config:r}=e;const n=Di({typed:t});return t(Bi,{"boolean, boolean":function(e,t){return e===t},"number, number":function(e,t){return _e(e,t,r.relTol,r.absTol)},"BigNumber, BigNumber":function(e,t){return e.eq(t)||hi(e,t,r.relTol,r.absTol)},"bigint, bigint":function(e,t){return e===t},"Fraction, Fraction":function(e,t){return e.equals(t)},"Complex, Complex":function(e,t){return function(e,t,r,n){return _e(e.re,t.re,r,n)&&_e(e.im,t.im,r,n)}(e,t,r.relTol,r.absTol)}},n)})),Oi=(he(Bi,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Bi,{"number, number":function(e,t){return _e(e,t,r.relTol,r.absTol)}})})),he("SparseMatrix",["typed","equalScalar","Matrix"],(e=>{let{typed:t,equalScalar:r,Matrix:n}=e;function i(e,t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?ae(t._values):void 0,e._index=ae(t._index),e._ptr=ae(t._ptr),e._size=ae(t._size),e._datatype=r||t._datatype):o(e,t.valueOf(),r||t._datatype)}(this,e,t);else if(e&&N(e.index)&&N(e.ptr)&&N(e.size))this._values=e.values,this._index=e.index,this._ptr=e.ptr,this._size=e.size,this._datatype=t||e.datatype;else if(N(e))o(this,e,t);else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=t}}function o(e,n,i){e._values=[],e._index=[],e._ptr=[],e._datatype=i;const o=n.length;let a=0,s=r,u=0;if(w(i)&&(s=t.find(r,[i,i])||r,u=t.convert(0,i)),o>0){let t=0;do{e._ptr.push(e._index.length);for(let r=0;r<o;r++){const i=n[r];if(N(i)){if(0===t&&a<i.length&&(a=i.length),t<i.length){const n=i[t];s(n,u)||(e._values.push(n),e._index.push(r))}}else 0===t&&a<1&&(a=1),s(i,u)||(e._values.push(i),e._index.push(r))}t++}while(t<a)}e._ptr.push(e._index.length),e._size=[o,a]}function a(e,t,r,n){if(r-t==0)return r;for(let i=t;i<r;i++)if(n[i]===e)return i;return t}function s(e,t,r,n,i,o,a){i.splice(e,0,n),o.splice(e,0,t);for(let e=r+1;e<a.length;e++)a[e]++}function u(e,n,i,o){let a=o||0,s=r,u=0;w(e._datatype)&&(s=t.find(r,[e._datatype,e._datatype])||r,u=t.convert(0,e._datatype),a=t.convert(a,e._datatype));const c=!s(a,u),l=e._size[0];let f,p,m,h=e._size[1];if(i>h){for(p=h;p<i;p++)if(e._ptr[p]=e._values.length,c)for(f=0;f<l;f++)e._values.push(a),e._index.push(f);e._ptr[i]=e._values.length}else i<h&&(e._ptr.splice(i+1,h-i),e._values.splice(e._ptr[i],e._values.length),e._index.splice(e._ptr[i],e._index.length));if(h=i,n>l){if(c){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]+t,m=e._ptr[p+1]+t;let r=0;for(f=l;f<n;f++,r++)e._values.splice(m+r,0,a),e._index.splice(m+r,0,f),t++}e._ptr[h]=e._values.length}}else if(n<l){let t=0;for(p=0;p<h;p++){e._ptr[p]=e._ptr[p]-t;const r=e._ptr[p],i=e._ptr[p+1]-t;for(m=r;m<i;m++)f=e._index[m],f>n-1&&(e._values.splice(m,1),e._index.splice(m,1),t++)}e._ptr[p]=e._values.length}return e._size[0]=n,e._size[1]=i,e}function c(e,t,r,n,i){const o=n[0],a=n[1],s=[];let u,c;for(u=0;u<o;u++)for(s[u]=[],c=0;c<a;c++)s[u][c]=0;for(c=0;c<a;c++){const n=r[c],o=r[c+1];for(let r=n;r<o;r++)u=t[r],s[u][c]=e?i?ae(e[r]):e[r]:1}return s}return i.prototype=new n,i.prototype.createSparseMatrix=function(e,t){return new i(e,t)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return Ln(this._values,oe)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(e,t){return new i(e,t)},i.prototype.density=function(){const e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},i.prototype.subset=function(e,t,r){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,t){if(!T(t))throw new TypeError("Invalid index");if(t.isScalar())return e.get(t.min());const r=t.size();if(r.length!==e._size.length)throw new xn(r.length,e._size.length);let n,o,a,s;const u=t.min(),c=t.max();for(n=0,o=e._size.length;n<o;n++)An(u[n],e._size[n]),An(c[n],e._size[n]);const l=e._values,f=e._index,p=e._ptr,m=t.dimension(0),h=t.dimension(1),d=[],g=[];m.forEach((function(e,t){g[e]=t[0],d[e]=!0}));const y=l?[]:void 0,x=[],b=[];return h.forEach((function(e){for(b.push(x.length),a=p[e],s=p[e+1];a<s;a++)n=f[a],!0===d[n]&&(x.push(g[n]),y&&y.push(l[a]))})),b.push(x.length),new i({values:y,index:x,ptr:b,size:r,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Invalid index");const i=t.size(),o=t.isScalar();let a;if(E(r)?(a=r.size(),r=r.toArray()):a=vn(r),o){if(0!==a.length)throw new TypeError("Scalar expected");e.set(t.min(),r,n)}else{if(1!==i.length&&2!==i.length)throw new xn(i.length,e._size.length,"<");if(a.length<i.length){let e=0,t=0;for(;1===i[e]&&1===a[e];)e++;for(;1===i[e];)t++,e++;r=_n(r,i.length,t,a)}if(!ce(i,a))throw new xn(i,a,">");if(1===i.length)t.dimension(0).forEach((function(t,i){An(t),e.set([t,0],r[i[0]],n)}));else{const i=t.dimension(0),o=t.dimension(1);i.forEach((function(t,i){An(t),o.forEach((function(o,a){An(o),e.set([t,o],r[i[0]][a[0]],n)}))}))}}return e}(this,e,t,r);default:throw new SyntaxError("Wrong number of arguments")}},i.prototype.get=function(e){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new xn(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");const t=e[0],r=e[1];An(t,this._size[0]),An(r,this._size[1]);const n=a(t,this._ptr[r],this._ptr[r+1],this._index);return n<this._ptr[r+1]&&this._index[n]===t?this._values[n]:0},i.prototype.set=function(e,n,i){if(!N(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new xn(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");const o=e[0],c=e[1];let l=this._size[0],f=this._size[1],p=r,m=0;w(this._datatype)&&(p=t.find(r,[this._datatype,this._datatype])||r,m=t.convert(0,this._datatype)),(o>l-1||c>f-1)&&(u(this,Math.max(o+1,l),Math.max(c+1,f),i),l=this._size[0],f=this._size[1]),An(o,l),An(c,f);const h=a(o,this._ptr[c],this._ptr[c+1],this._index);return h<this._ptr[c+1]&&this._index[h]===o?p(n,m)?function(e,t,r,n,i){r.splice(e,1),n.splice(e,1);for(let e=t+1;e<i.length;e++)i[e]--}(h,c,this._values,this._index,this._ptr):this._values[h]=n:p(n,m)||s(h,o,c,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(e,t,r){if(!A(e))throw new TypeError("Array or Matrix expected");const 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(!d(e)||!ye(e)||e<0)throw new TypeError("Invalid size, must contain positive integers (size: "+pn(n)+")")})),u(r?this.clone():this,n[0],n[1],t)},i.prototype.reshape=function(e,t){if(!N(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");e.forEach((function(t){if(!d(t)||!ye(t)||t<=-2||0===t)throw new TypeError("Invalid size, must contain positive integers or -1 (size: "+pn(e)+")")}));const r=this._size[0]*this._size[1];if(r!==(e=Dn(e,r))[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");const n=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return n;const i=[];for(let e=0;e<n._ptr.length;e++)for(let t=0;t<n._ptr[e+1]-n._ptr[e];t++)i.push(e);const o=n._values.slice(),u=n._index.slice();for(let t=0;t<n._index.length;t++){const r=u[t],o=i[t],a=r*n._size[1]+o;i[t]=a%e[1],u[t]=Math.floor(a/e[1])}n._values.length=0,n._index.length=0,n._ptr.length=e[1]+1,n._size=e.slice();for(let e=0;e<n._ptr.length;e++)n._ptr[e]=0;for(let e=0;e<o.length;e++){const t=u[e],r=i[e],c=o[e];s(a(t,n._ptr[r],n._ptr[r+1],n._index),t,r,c,n._values,n._index,n._ptr)}return n},i.prototype.clone=function(){return new i({values:this._values?ae(this._values):void 0,index:ae(this._index),ptr:ae(this._ptr),size:ae(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(e,n){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");const o=this,a=this._size[0],s=this._size[1],u=Jn(e,o,"map");return function(e,n,a,s,c,l,f){const p=[],m=[],h=[];let d=r,g=0;w(e._datatype)&&(d=t.find(r,[e._datatype,e._datatype])||r,g=t.convert(0,e._datatype));const y=function(e,t,r){const n=function(e,t,r){return u(e,[t,r],o)}(e,t,r);d(n,g)||(p.push(n),m.push(t))};for(let t=0;t<=c;t++){h.push(p.length);const r=e._ptr[t],n=e._ptr[t+1];if(f)for(let i=r;i<n;i++){const r=e._index[i];r>=0&&r<=a&&y(e._values[i],r-0,t-0)}else{const i={};for(let t=r;t<n;t++)i[e._index[t]]=e._values[t];for(let e=0;e<=a;e++)y(e in i?i[e]:0,e-0,t-0)}}return h.push(p.length),new i({values:p,index:m,ptr:h,size:[a-0+1,c-0+1]})}(this,0,a-1,0,s-1,0,n)},i.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");const r=this,n=this._size[0],i=this._size[1],o=Jn(e,r,"forEach");for(let e=0;e<i;e++){const i=this._ptr[e],a=this._ptr[e+1];if(t)for(let t=i;t<a;t++){const n=this._index[t];o(this._values[t],[n,e],r)}else{const t={};for(let e=i;e<a;e++)t[this._index[e]]=this._values[e];for(let i=0;i<n;i++)o(i in t?t[i]:0,[i,e],r)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw new Error("Cannot iterate a Pattern only matrix");const e=this._size[1];for(let t=0;t<e;t++){const e=this._ptr[t],r=this._ptr[t+1];for(let n=e;n<r;n++){const e=this._index[n];yield{value:this._values[n],index:[e,t]}}}},i.prototype.toArray=function(){return c(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return c(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(e){const t=this._size[0],r=this._size[1],n=this.density();let i="Sparse Matrix ["+pn(t,e)+" x "+pn(r,e)+"] density: "+pn(n,e)+"\n";for(let t=0;t<r;t++){const r=this._ptr[t],n=this._ptr[t+1];for(let o=r;o<n;o++)i+="\n ("+pn(this._index[o],e)+", "+pn(t,e)+") ==> "+(this._values?pn(this._values[o],e):"X")}return i},i.prototype.toString=function(){return pn(this.toArray())},i.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},i.prototype.diagonal=function(e){if(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e))throw new TypeError("The parameter k must be an integer number")}else e=0;const t=e>0?e:0,r=e<0?-e:0,n=this._size[0],o=this._size[1],a=Math.min(n-r,o-t),s=[],u=[],c=[];c[0]=0;for(let e=t;e<o&&s.length<a;e++){const n=this._ptr[e],i=this._ptr[e+1];for(let o=n;o<i;o++){const n=this._index[o];if(n===e-t+r){s.push(this._values[o]),u[s.length-1]=n-r;break}}}return c.push(s.length),new i({values:s,index:u,ptr:c,size:[a,1]})},i.fromJSON=function(e){return new i(e)},i.diagonal=function(e,n,o,a,s){if(!N(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map((function(e){if(g(e)&&(e=e.toNumber()),!d(e)||!ye(e)||e<1)throw new Error("Size values must be positive integers");return e})),o){if(g(o)&&(o=o.toNumber()),!d(o)||!ye(o))throw new TypeError("The parameter k must be an integer number")}else o=0;let u=r,c=0;w(s)&&(u=t.find(r,[s,s])||r,c=t.convert(0,s));const l=o>0?o:0,f=o<0?-o:0,p=e[0],m=e[1],h=Math.min(p-f,m-l);let y;if(N(n)){if(n.length!==h)throw new Error("Invalid value array length");y=function(e){return n[e]}}else if(E(n)){const e=n.size();if(1!==e.length||e[0]!==h)throw new Error("Invalid matrix length");y=function(e){return n.get([e])}}else y=function(){return n};const x=[],b=[],v=[];for(let e=0;e<m;e++){v.push(x.length);const t=e-l;if(t>=0&&t<h){const e=y(t);u(e,c)||(b.push(t+f),x.push(e))}}return v.push(x.length),new i({values:x,index:b,ptr:v,size:[p,m]})},i.prototype.swapRows=function(e,t){if(!(d(e)&&ye(e)&&d(t)&&ye(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return An(e,this._size[0]),An(t,this._size[0]),i._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},i._forEachRow=function(e,t,r,n,i){const o=n[e],a=n[e+1];for(let e=o;e<a;e++)i(r[e],t[e])},i._swapRows=function(e,t,r,n,i,o){for(let s=0;s<r;s++){const r=o[s],u=o[s+1],c=a(e,r,u,i),l=a(t,r,u,i);if(c<u&&l<u&&i[c]===e&&i[l]===t){if(n){const e=n[c];n[c]=n[l],n[l]=e}}else if(c<u&&i[c]===e&&(l>=u||i[l]!==t)){const e=n?n[c]:void 0;i.splice(l,0,t),n&&n.splice(l,0,e),i.splice(l<=c?c+1:c,1),n&&n.splice(l<=c?c+1:c,1)}else if(l<u&&i[l]===t&&(c>=u||i[c]!==e)){const t=n?n[l]:void 0;i.splice(c,0,e),n&&n.splice(c,0,t),i.splice(c<=l?l+1:l,1),n&&n.splice(c<=l?l+1:l,1)}}},i}),{isClass:!0})),_i=he("number",["typed"],(e=>{let{typed:t}=e;const r=t("number",{"":function(){return 0},number:function(e){return e},string:function(e){if("NaN"===e)return NaN;const t=function(e){const t=e.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);return t?{input:e,radix:{"0b":2,"0o":8,"0x":16}[t[1]],integerPart:t[2],fractionalPart:t[3]}:null}(e);if(t)return function(e){const t=parseInt(e.integerPart,e.radix);let r=0;for(let t=0;t<e.fractionalPart.length;t++)r+=parseInt(e.fractionalPart[t],e.radix)/Math.pow(e.radix,t+1);const n=t+r;if(isNaN(n))throw new SyntaxError('String "'+e.input+'" is not a valid number');return n}(t);let r=0;const n=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);n&&(r=Number(n[2]),e=n[1]);let i=Number(e);if(isNaN(i))throw new SyntaxError('String "'+e+'" is not a valid number');if(n){if(i>2**r-1)throw new SyntaxError(`String "${e}" is out of range`);i>=2**(r-1)&&(i-=2**r)}return i},BigNumber:function(e){return e.toNumber()},bigint:function(e){return Number(e)},Fraction:function(e){return e.valueOf()},Unit:t.referToSelf((e=>t=>{const r=t.clone();return r.value=e(t.value),r})),null:function(e){return 0},"Unit, string | Unit":function(e,t){return e.toNumber(t)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))});return r.fromJSON=function(e){return parseFloat(e.value)},r})),Ii=he("bigint",["typed"],(e=>{let{typed:t}=e;const r=t("bigint",{"":function(){return 0n},bigint:function(e){return e},number:function(e){return BigInt(e.toFixed())},BigNumber:function(e){return BigInt(e.round().toString())},Fraction:function(e){return BigInt(e.valueOf().toFixed())},"string | boolean":function(e){return BigInt(e)},null:function(e){return 0n},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))});return r.fromJSON=function(e){return BigInt(e.value)},r})),zi="string",ki=he(zi,["typed"],(e=>{let{typed:t}=e;return t(zi,{"":function(){return""},number:Me,null:function(e){return"null"},boolean:function(e){return e+""},string:function(e){return e},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e))),any:function(e){return String(e)}})})),Ri="boolean",qi=he(Ri,["typed"],(e=>{let{typed:t}=e;return t(Ri,{"":function(){return!1},boolean:function(e){return e},number:function(e){return!!e},null:function(e){return!1},BigNumber:function(e){return!e.isZero()},string:function(e){const t=e.toLowerCase();if("true"===t)return!0;if("false"===t)return!1;const r=Number(e);if(""!==e&&!isNaN(r))return!!r;throw new Error('Cannot convert "'+e+'" to a boolean')},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Pi=he("bignumber",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("bignumber",{"":function(){return new r(0)},number:function(e){return new r(e+"")},string:function(e){const t=e.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(t){const n=t[2],i=r(t[1]),o=new r(2).pow(Number(n));if(i.gt(o.sub(1)))throw new SyntaxError(`String "${e}" is out of range`);const a=new r(2).pow(Number(n)-1);return i.gte(a)?i.sub(o):i}return new r(e)},BigNumber:function(e){return e},bigint:function(e){return new r(e.toString())},Unit:t.referToSelf((e=>t=>{const r=t.clone();return r.value=e(t.value),r})),Fraction:function(e){return new r(String(e.n)).div(String(e.d)).times(String(e.s))},null:function(e){return new r(0)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ji=he("complex",["typed","Complex"],(e=>{let{typed:t,Complex:r}=e;return t("complex",{"":function(){return r.ZERO},number:function(e){return new r(e,0)},"number, number":function(e,t){return new r(e,t)},"BigNumber, BigNumber":function(e,t){return new r(e.toNumber(),t.toNumber())},Fraction:function(e){return new r(e.valueOf(),0)},Complex:function(e){return e.clone()},string:function(e){return r(e)},null:function(e){return r(0)},Object:function(e){if("re"in e&&"im"in e)return new r(e.re,e.im);if("r"in e&&"phi"in e||"abs"in e&&"arg"in e)return new r(e);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ui=he("fraction",["typed","Fraction"],(e=>{let{typed:t,Fraction:r}=e;return t("fraction",{number:function(e){if(!isFinite(e)||isNaN(e))throw new Error(e+" cannot be represented as a fraction");return new r(e)},string:function(e){return new r(e)},"number, number":function(e,t){return new r(e,t)},"bigint, bigint":function(e,t){return new r(e,t)},null:function(e){return new r(0)},BigNumber:function(e){return new r(e.toString())},bigint:function(e){return new r(e.toString())},Fraction:function(e){return e},Unit:t.referToSelf((e=>t=>{const r=t.clone();return r.value=e(t.value),r})),Object:function(e){return new r(e)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Li="matrix",$i=he(Li,["typed","Matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,Matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(Li,{"":function(){return o([])},string:function(e){return o([],e)},"string, string":function(e,t){return o([],e,t)},Array:function(e){return o(e)},Matrix:function(e){return o(e,e.storage())},"Array | Matrix, string":o,"Array | Matrix, string, string":o});function o(e,t,r){if("dense"===t||"default"===t||void 0===t)return new n(e,r);if("sparse"===t)return new i(e,r);throw new TypeError("Unknown matrix type "+JSON.stringify(t)+".")}})),Hi="matrixFromFunction",Gi=he(Hi,["typed","matrix","isZero"],(e=>{let{typed:t,matrix:r,isZero:n}=e;return t(Hi,{"Array | Matrix, function, string, string":function(e,t,r,n){return i(e,t,r,n)},"Array | Matrix, function, string":function(e,t,r){return i(e,t,r)},"Matrix, function":function(e,t){return i(e,t,"dense")},"Array, function":function(e,t){return i(e,t,"dense").toArray()},"Array | Matrix, string, function":function(e,t,r){return i(e,r,t)},"Array | Matrix, string, string, function":function(e,t,r,n){return i(e,n,t,r)}});function i(e,t,i,o){let a;return a=void 0!==o?r(i,o):r(i),a.resize(e),a.forEach((function(e,r){const i=t(r);n(i)||a.set(r,i)})),a}})),Vi="matrixFromRows",Wi=he(Vi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:r,flatten:n,size:i}=e;return t(Vi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return r(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one row is needed to construct a matrix.");const t=a(e[0]),r=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));r.push(n(i))}return r}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Zi="matrixFromColumns",Yi=he(Zi,["typed","matrix","flatten","size"],(e=>{let{typed:t,matrix:r,flatten:n,size:i}=e;return t(Zi,{"...Array":function(e){return o(e)},"...Matrix":function(e){return r(o(e.map((e=>e.toArray()))))}});function o(e){if(0===e.length)throw new TypeError("At least one column is needed to construct a matrix.");const t=a(e[0]),r=[];for(let e=0;e<t;e++)r[e]=[];for(const i of e){const e=a(i);if(e!==t)throw new TypeError("The vectors had different length: "+(0|t)+" ≠ "+(0|e));const o=n(i);for(let e=0;e<t;e++)r[e].push(o[e])}return r}function a(e){const t=i(e);if(1===t.length)return t[0];if(2===t.length){if(1===t[0])return t[1];if(1===t[1])return t[0];throw new TypeError("At least one of the arguments is not a vector.")}throw new TypeError("Only one- or two-dimensional vectors are supported.")}})),Ji="splitUnit",Xi=he(Ji,["typed"],(e=>{let{typed:t}=e;return t(Ji,{"Unit, Array":function(e,t){return e.splitUnit(t)}})})),Qi="number",Ki="number, number";function eo(e){return Math.abs(e)}function to(e,t){return e+t}function ro(e,t){return e-t}function no(e,t){return e*t}function io(e){return-e}function oo(e){return e}function ao(e){return Ee(e)}function so(e){return e*e*e}function uo(e){return Math.exp(e)}function co(e){return Ae(e)}function lo(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;let r;const n=e*t;for(;0!==t;)r=t,t=e%r,e=r;return Math.abs(n/e)}function fo(e){return we(e)}function po(e){return ve(e)}function mo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const r=t<0;if(r&&(t=-t),0===t)throw new Error("Root must be non-zero");if(e<0&&Math.abs(t)%2!=1)throw new Error("Root must be odd when a is negative.");if(0===e)return r?1/0:0;if(!isFinite(e))return r?0:e;let n=Math.pow(Math.abs(e),1/t);return n=e<0?-n:n,r?1/n:n}function ho(e){return be(e)}function go(e){return e*e}function yo(e,t){let r,n,i,o,a=0,s=1,u=1,c=0;if(!ye(e)||!ye(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)n=Math.floor(e/t),i=e-n*t,r=a,a=s-n*a,s=r,r=u,u=c-n*u,c=r,e=t,t=i;return o=e<0?[-e,-s,-c]:[e,e?s:0,c],o}function xo(e,t){return e*e<1&&t===1/0||e*e>1&&t===-1/0?0:Math.pow(e,t)}function bo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!ye(t)||t<0||t>15)throw new Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(De(e,t))}eo.signature=Qi,to.signature=Ki,ro.signature=Ki,no.signature=Ki,io.signature=Qi,oo.signature=Qi,ao.signature=Qi,so.signature=Qi,uo.signature=Qi,co.signature=Qi,lo.signature=Ki,fo.signature=Qi,po.signature=Qi,ho.signature=Qi,go.signature=Qi,yo.signature=Ki,xo.signature=Ki;const vo="unaryMinus",wo=he(vo,["typed"],(e=>{let{typed:t}=e;return t(vo,{number:io,"Complex | BigNumber | Fraction":e=>e.neg(),bigint:e=>-e,Unit:t.referToSelf((e=>r=>{const n=r.clone();return n.value=t.find(e,n.valueType())(r.value),n})),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0)))})})),No="unaryPlus",Eo=he(No,["typed","config","numeric"],(e=>{let{typed:t,config:r,numeric:n}=e;return t(No,{number:oo,Complex:function(e){return e},BigNumber:function(e){return e},bigint:function(e){return e},Fraction:function(e){return e},Unit:function(e){return e.clone()},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),boolean:function(e){return n(e?1:0,r.number)},string:function(e){return n(e,xe(e,r))}})})),Ao=he("abs",["typed"],(e=>{let{typed:t}=e;return t("abs",{number:eo,"Complex | BigNumber | Fraction | Unit":e=>e.abs(),bigint:e=>e<0n?-e:e,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0)))})})),So="apply",Mo=he(So,["typed","isInteger"],(e=>{let{typed:t,isInteger:r}=e;return t(So,{"Array | Matrix, number | BigNumber, function":function(e,t,n){if(!r(t))throw new TypeError("Integer number expected for dimension");const i=Array.isArray(e)?vn(e):e.size();if(t<0||t>=i.length)throw new bn(t,i.length);return E(e)?e.create(Co(e.valueOf(),t,n),e.datatype()):Co(e,t,n)}})}));function Co(e,t,r){let n,i,o;if(t<=0){if(Array.isArray(e[0])){for(o=function(e){const t=e.length,r=e[0].length;let n,i;const o=[];for(i=0;i<r;i++){const r=[];for(n=0;n<t;n++)r.push(e[n][i]);o.push(r)}return o}(e),i=[],n=0;n<o.length;n++)i[n]=Co(o[n],t-1,r);return i}return r(e)}for(i=[],n=0;n<e.length;n++)i[n]=Co(e[n],t-1,r);return i}const To="addScalar",Do=he(To,["typed"],(e=>{let{typed:t}=e;return t(To,{"number, number":to,"Complex, Complex":function(e,t){return e.add(t)},"BigNumber, BigNumber":function(e,t){return e.plus(t)},"bigint, bigint":function(e,t){return e+t},"Fraction, Fraction":function(e,t){return e.add(t)},"Unit, Unit":t.referToSelf((e=>(r,n)=>{if(null===r.value||void 0===r.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(!r.equalBase(n))throw new Error("Units do not match");const i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))})})),Bo="subtractScalar",Fo=he(Bo,["typed"],(e=>{let{typed:t}=e;return t(Bo,{"number, number":ro,"Complex, Complex":function(e,t){return e.sub(t)},"BigNumber, BigNumber":function(e,t){return e.minus(t)},"bigint, bigint":function(e,t){return e-t},"Fraction, Fraction":function(e,t){return e.sub(t)},"Unit, Unit":t.referToSelf((e=>(r,n)=>{if(null===r.value||void 0===r.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(!r.equalBase(n))throw new Error("Units do not match");const i=r.clone();return i.value=t.find(e,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i}))})})),Oo="cbrt",_o=he(Oo,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],(e=>{let{config:t,typed:r,isNegative:n,unaryMinus:i,matrix:o,Complex:a,BigNumber:s,Fraction:u}=e;return r(Oo,{number:ao,Complex:c,"Complex, boolean":c,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&x(e.value)){let t=e.clone();return t.value=1,t=t.pow(1/3),t.value=c(e.value),t}{const t=n(e.value);let r;t&&(e.value=i(e.value)),r=g(e.value)?new s(1).div(3):b(e.value)?new u(1,3):1/3;const o=e.pow(r);return t&&(o.value=i(o.value)),o}}});function c(e,r){const n=e.arg()/3,i=e.abs(),s=new a(ao(i),0).mul(new a(0,n).exp());if(r){const e=[s,new a(ao(i),0).mul(new a(0,n+2*Math.PI/3).exp()),new a(ao(i),0).mul(new a(0,n-2*Math.PI/3).exp())];return"Array"===t.matrix?e:o(e)}return s}})),Io=he("matAlgo11xS0s",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=r,d=0,g=i;"string"==typeof l&&(m=l,h=t.find(r,[m,m]),d=t.convert(0,m),n=t.convert(n,m),g=t.find(i,[m,m]));const y=[],x=[],b=[];for(let e=0;e<p;e++){b[e]=x.length;for(let t=u[e],r=u[e+1],i=t;i<r;i++){const e=s[i],t=o?g(n,a[i]):g(a[i],n);h(t,d)||(x.push(e),y.push(t))}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:m})}})),zo=he("matAlgo12xSfs",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:r}=e;return function(e,n,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,n=t.convert(n,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let r=u[e],n=u[e+1],i=r;i<n;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let r=0;r<f;r++)0===e&&(d[r]=[]),y[r]===t?d[r][e]=o?h(n,g[r]):h(g[r],n):d[r][e]=o?h(n,0):h(0,n)}return new r({data:d,size:[f,p],datatype:m})}})),ko=he("matAlgo14xDs",["typed"],(e=>{let{typed:t}=e;return function(e,n,i,o){const a=e._data,s=e._size,u=e._datatype;let c,l=i;"string"==typeof u&&(c=u,n=t.convert(n,c),l=t.find(i,[c,c]));const f=s.length>0?r(l,0,s,s[0],a,n,o):[];return e.createDenseMatrix({data:f,size:ae(s),datatype:c})};function r(e,t,n,i,o,a,s){const u=[];if(t===n.length-1)for(let t=0;t<i;t++)u[t]=s?e(a,o[t]):e(o[t],a);else for(let c=0;c<i;c++)u[c]=r(e,t+1,n,n[t+1],o[c],a,s);return u}})),Ro="ceil",qo=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Po=he(Ro,["typed","config","round"],(e=>{let{typed:t,config:r,round:n}=e;return t(Ro,{number:function(e){return _e(e,n(e),r.relTol,r.absTol)?n(e):Math.ceil(e)},"number, number":function(e,t){if(_e(e,n(e,t),r.relTol,r.absTol))return n(e,t);{let[r,n]=`${e}e`.split("e");const i=Math.ceil(Number(`${r}e${Number(n)+t}`));return[r,n]=`${i}e`.split("e"),Number(`${r}e${Number(n)-t}`)}}})})),jo=he(Ro,qo,(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=Io({typed:t,equalScalar:o}),c=zo({typed:t,DenseMatrix:s}),l=ko({typed:t}),f=Po({typed:t,config:r,round:n});return t("ceil",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.ceil()},"Complex, number":function(e,t){return e.ceil(t)},"Complex, BigNumber":function(e,t){return e.ceil(t.toNumber())},BigNumber:function(e){return hi(e,n(e),r.relTol,r.absTol)?n(e):e.ceil()},"BigNumber, BigNumber":function(e,t){return hi(e,n(e,t),r.relTol,r.absTol)?n(e,t):e.toDecimalPlaces(t.toNumber(),Br.ROUND_CEIL)},Fraction:function(e){return e.ceil()},"Fraction, number":function(e,t){return e.ceil(t)},"Fraction, BigNumber":function(e,t){return e.ceil(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,r,n){const i=t.toNumeric(n);return n.multiply(e(i,r))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>e(t,r.toNumber(),n))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>ii(t,(t=>e(t,r,n)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,r)=>e(t,0,r))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>ii(t,(t=>e(t,r)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(i(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>o(t,0)?a(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Uo="cube",Lo=he(Uo,["typed"],(e=>{let{typed:t}=e;return t(Uo,{number:so,Complex:function(e){return e.mul(e).mul(e)},BigNumber:function(e){return e.times(e).times(e)},bigint:function(e){return e*e*e},Fraction:function(e){return e.pow(3)},Unit:function(e){return e.pow(3)}})})),$o=he("exp",["typed"],(e=>{let{typed:t}=e;return t("exp",{number:uo,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()}})})),Ho="expm1",Go=he(Ho,["typed","Complex"],(e=>{let{typed:t,Complex:r}=e;return t(Ho,{number:co,Complex:function(e){const t=Math.exp(e.re);return new r(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)}})})),Vo="fix",Wo=["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],Zo=he(Vo,["typed","ceil","floor"],(e=>{let{typed:t,ceil:r,floor:n}=e;return t(Vo,{number:function(e){return e>0?n(e):r(e)},"number, number":function(e,t){return e>0?n(e,t):r(e,t)}})})),Yo=he(Vo,Wo,(e=>{let{typed:t,Complex:r,matrix:n,ceil:i,floor:o,equalScalar:a,zeros:s,DenseMatrix:u}=e;const c=zo({typed:t,DenseMatrix:u}),l=ko({typed:t}),f=Zo({typed:t,ceil:i,floor:o});return t("fix",{number:f.signatures.number,"number, number | BigNumber":f.signatures["number,number"],Complex:function(e){return new r(e.re>0?Math.floor(e.re):Math.ceil(e.re),e.im>0?Math.floor(e.im):Math.ceil(e.im))},"Complex, number":function(e,t){return new r(e.re>0?o(e.re,t):i(e.re,t),e.im>0?o(e.im,t):i(e.im,t))},"Complex, BigNumber":function(e,t){const n=t.toNumber();return new r(e.re>0?o(e.re,n):i(e.re,n),e.im>0?o(e.im,n):i(e.im,n))},BigNumber:function(e){return e.isNegative()?i(e):o(e)},"BigNumber, number | BigNumber":function(e,t){return e.isNegative()?i(e,t):o(e,t)},Fraction:function(e){return e.s<0n?e.ceil():e.floor()},"Fraction, number | BigNumber":function(e,t){return e.s<0n?i(e,t):o(e,t)},"Unit, number, Unit":t.referToSelf((e=>function(t,r,n){const i=t.toNumeric(n);return n.multiply(e(i,r))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>e(t,r.toNumber(),n))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>ii(t,(t=>e(t,r,n)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,r)=>e(t,0,r))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array | Matrix, number | BigNumber":t.referToSelf((e=>(t,r)=>ii(t,(t=>e(t,r)),!0))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(n(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>a(t,0)?s(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),Jo="floor",Xo=["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],Qo=he(Jo,["typed","config","round"],(e=>{let{typed:t,config:r,round:n}=e;return t(Jo,{number:function(e){return _e(e,n(e),r.relTol,r.absTol)?n(e):Math.floor(e)},"number, number":function(e,t){if(_e(e,n(e,t),r.relTol,r.absTol))return n(e,t);{let[r,n]=`${e}e`.split("e");const i=Math.floor(Number(`${r}e${Number(n)+t}`));return[r,n]=`${i}e`.split("e"),Number(`${r}e${Number(n)-t}`)}}})})),Ko=he(Jo,Xo,(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}=e;const u=Io({typed:t,equalScalar:o}),c=zo({typed:t,DenseMatrix:s}),l=ko({typed:t}),f=Qo({typed:t,config:r,round:n});return t("floor",{number:f.signatures.number,"number,number":f.signatures["number,number"],Complex:function(e){return e.floor()},"Complex, number":function(e,t){return e.floor(t)},"Complex, BigNumber":function(e,t){return e.floor(t.toNumber())},BigNumber:function(e){return hi(e,n(e),r.relTol,r.absTol)?n(e):e.floor()},"BigNumber, BigNumber":function(e,t){return hi(e,n(e,t),r.relTol,r.absTol)?n(e,t):e.toDecimalPlaces(t.toNumber(),Br.ROUND_FLOOR)},Fraction:function(e){return e.floor()},"Fraction, number":function(e,t){return e.floor(t)},"Fraction, BigNumber":function(e,t){return e.floor(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,r,n){const i=t.toNumeric(n);return n.multiply(e(i,r))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>e(t,r.toNumber(),n))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>ii(t,(t=>e(t,r,n)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,r)=>e(t,0,r))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>ii(t,(t=>e(t,r)),!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"number | Complex | Fraction | BigNumber, Array":t.referToSelf((e=>(t,r)=>l(i(r),t,e,!0).valueOf())),"number | Complex | Fraction | BigNumber, Matrix":t.referToSelf((e=>(t,r)=>o(t,0)?a(r.size(),r.storage()):"dense"===r.storage()?l(r,t,e,!0):c(r,t,e,!0)))})})),ea=he("matAlgo02xDS0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i,o){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=n._values,l=n._index,f=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(s.length!==p.length)throw new xn(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const h=s[0],d=s[1];let g,y=r,x=0,b=i;"string"==typeof u&&u===m&&"mixed"!==u&&(g=u,y=t.find(r,[g,g]),x=t.convert(0,g),b=t.find(i,[g,g]));const v=[],w=[],N=[];for(let e=0;e<d;e++){N[e]=w.length;for(let t=f[e],r=f[e+1],n=t;n<r;n++){const t=l[n],r=o?b(c[n],a[t][e]):b(a[t][e],c[n]);y(r,x)||(w.push(t),v.push(r))}}return N[d]=w.length,n.createSparseMatrix({values:v,index:w,ptr:N,size:[h,d],datatype:u===e._datatype&&m===n._datatype?g:void 0})}})),ta=he("matAlgo03xDSf",["typed"],(e=>{let{typed:t}=e;return function(e,r,n,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._values,c=r._index,l=r._ptr,f=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(a.length!==f.length)throw new xn(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1];let d,g=0,y=n;"string"==typeof s&&s===p&&"mixed"!==s&&(d=s,g=t.convert(0,d),y=t.find(n,[d,d]));const x=[];for(let e=0;e<m;e++)x[e]=[];const b=[],v=[];for(let e=0;e<h;e++){const t=e+1;for(let r=l[e],n=l[e+1],a=r;a<n;a++){const r=c[a];b[r]=i?y(u[a],o[r][e]):y(o[r][e],u[a]),v[r]=t}for(let r=0;r<m;r++)v[r]===t?x[r][e]=b[r]:x[r][e]=i?y(g,o[r][e]):y(o[r][e],g)}return e.createDenseMatrix({data:x,size:[m,h],datatype:s===e._datatype&&p===r._datatype?d:void 0})}})),ra=he("matAlgo05xSfSf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new xn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=w?[]:void 0,M=[],C=[];let T,D,B,F;for(D=0;D<g;D++){E[D]=N.length;const e=D+1;for(B=s[D],F=s[D+1];B<F;B++)T=a[B],N.push(T),M[T]=e,A&&(A[T]=o[B]);for(B=p[D],F=p[D+1];B<F;B++)T=f[B],M[T]!==e&&N.push(T),C[T]=e,S&&(S[T]=l[B]);if(w)for(B=E[D];B<N.length;){T=N[B];const t=M[T],r=C[T];if(t===e||r===e){const n=v(t===e?A[T]:b,r===e?S[T]:b);x(n,b)?N.splice(B,1):(w.push(n),B++)}}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),na=he("matAlgo13xDD",["typed"],(e=>{let{typed:t}=e;return function(e,n,i){const o=e._data,a=e._size,s=e._datatype,u=n._data,c=n._size,l=n._datatype,f=[];if(a.length!==c.length)throw new xn(a.length,c.length);for(let e=0;e<a.length;e++){if(a[e]!==c[e])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");f[e]=a[e]}let p,m=i;"string"==typeof s&&s===l&&(p=s,m=t.find(i,[p,p]));const h=f.length>0?r(m,0,f,f[0],o,u):[];return e.createDenseMatrix({data:h,size:f,datatype:p})};function r(e,t,n,i,o,a){const s=[];if(t===n.length-1)for(let t=0;t<i;t++)s[t]=e(o[t],a[t]);else for(let u=0;u<i;u++)s[u]=r(e,t+1,n,n[t+1],o[u],a[u]);return s}}));function ia(e,t){if(ce(e.size(),t.size()))return[e,t];const r=Gn(e.size(),t.size());return[e,t].map((e=>function(e,t){return ce(e.size(),t)?e:e.create(Wn(e.valueOf(),t),e.datatype())}(e,r)))}const oa=he("matrixAlgorithmSuite",["typed","matrix"],(e=>{let{typed:t,matrix:r}=e;const n=na({typed:t}),i=ko({typed:t});return function(e){const o=e.elop,a=e.SD||e.DS;let s;o?(s={"DenseMatrix, DenseMatrix":(e,t)=>n(...ia(e,t),o),"Array, Array":(e,t)=>n(...ia(r(e),r(t)),o).valueOf(),"Array, DenseMatrix":(e,t)=>n(...ia(r(e),t),o),"DenseMatrix, Array":(e,t)=>n(...ia(e,r(t)),o)},e.SS&&(s["SparseMatrix, SparseMatrix"]=(t,r)=>e.SS(...ia(t,r),o,!1)),e.DS&&(s["DenseMatrix, SparseMatrix"]=(t,r)=>e.DS(...ia(t,r),o,!1),s["Array, SparseMatrix"]=(t,n)=>e.DS(...ia(r(t),n),o,!1)),a&&(s["SparseMatrix, DenseMatrix"]=(e,t)=>a(...ia(t,e),o,!0),s["SparseMatrix, Array"]=(e,t)=>a(...ia(r(t),e),o,!0))):(s={"DenseMatrix, DenseMatrix":t.referToSelf((e=>(t,r)=>n(...ia(t,r),e))),"Array, Array":t.referToSelf((e=>(t,i)=>n(...ia(r(t),r(i)),e).valueOf())),"Array, DenseMatrix":t.referToSelf((e=>(t,i)=>n(...ia(r(t),i),e))),"DenseMatrix, Array":t.referToSelf((e=>(t,i)=>n(...ia(t,r(i)),e)))},e.SS&&(s["SparseMatrix, SparseMatrix"]=t.referToSelf((t=>(r,n)=>e.SS(...ia(r,n),t,!1)))),e.DS&&(s["DenseMatrix, SparseMatrix"]=t.referToSelf((t=>(r,n)=>e.DS(...ia(r,n),t,!1))),s["Array, SparseMatrix"]=t.referToSelf((t=>(n,i)=>e.DS(...ia(r(n),i),t,!1)))),a&&(s["SparseMatrix, DenseMatrix"]=t.referToSelf((e=>(t,r)=>a(...ia(r,t),e,!0))),s["SparseMatrix, Array"]=t.referToSelf((e=>(t,n)=>a(...ia(r(n),t),e,!0)))));const u=e.scalar||"any";(e.Ds||e.Ss)&&(o?(s["DenseMatrix,"+u]=(e,t)=>i(e,t,o,!1),s[u+", DenseMatrix"]=(e,t)=>i(t,e,o,!0),s["Array,"+u]=(e,t)=>i(r(e),t,o,!1).valueOf(),s[u+", Array"]=(e,t)=>i(r(t),e,o,!0).valueOf()):(s["DenseMatrix,"+u]=t.referToSelf((e=>(t,r)=>i(t,r,e,!1))),s[u+", DenseMatrix"]=t.referToSelf((e=>(t,r)=>i(r,t,e,!0))),s["Array,"+u]=t.referToSelf((e=>(t,n)=>i(r(t),n,e,!1).valueOf())),s[u+", Array"]=t.referToSelf((e=>(t,n)=>i(r(n),t,e,!0).valueOf()))));const c=void 0!==e.sS?e.sS:e.Ss;return o?(e.Ss&&(s["SparseMatrix,"+u]=(t,r)=>e.Ss(t,r,o,!1)),c&&(s[u+", SparseMatrix"]=(e,t)=>c(t,e,o,!0))):(e.Ss&&(s["SparseMatrix,"+u]=t.referToSelf((t=>(r,n)=>e.Ss(r,n,t,!1)))),c&&(s[u+", SparseMatrix"]=t.referToSelf((e=>(t,r)=>c(r,t,e,!0))))),o&&o.signatures&&se(s,o.signatures),s}})),aa=he("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s,concat:u}=e;const c=Ko({typed:t,config:r,round:n,matrix:i,equalScalar:o,zeros:a,DenseMatrix:s}),l=ea({typed:t,equalScalar:o}),f=ta({typed:t}),p=ra({typed:t,equalScalar:o}),m=Io({typed:t,equalScalar:o}),h=zo({typed:t,DenseMatrix:s});return t("mod",{"number, number":function(e,t){return 0===t?e:e-t*c(e/t)},"BigNumber, BigNumber":function(e,t){return t.isZero()?e:e.sub(t.mul(c(e.div(t))))},"bigint, bigint":function(e,t){if(0n===t)return e;if(e<0){const r=e%t;return 0n===r?r:r+t}return e%t},"Fraction, Fraction":function(e,t){return t.equals(0)?e:e.sub(t.mul(c(e.div(t))))}},oa({typed:t,matrix:i,concat:u})({SS:p,DS:f,SD:l,Ss:m,sS:h}))})),sa=he("matAlgo01xDSid",["typed"],(e=>{let{typed:t}=e;return function(e,r,n,i){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._values,c=r._index,l=r._ptr,f=r._size,p=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(a.length!==f.length)throw new xn(a.length,f.length);if(a[0]!==f[0]||a[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");if(!u)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");const m=a[0],h=a[1],d="string"==typeof s&&"mixed"!==s&&s===p?s:void 0,g=d?t.find(n,[d,d]):n;let y,x;const b=[];for(y=0;y<m;y++)b[y]=[];const v=[],w=[];for(x=0;x<h;x++){const e=x+1;for(let t=l[x],r=l[x+1],n=t;n<r;n++)y=c[n],v[y]=i?g(u[n],o[y][x]):g(o[y][x],u[n]),w[y]=e;for(y=0;y<m;y++)w[y]===e?b[y][x]=v[y]:b[y][x]=o[y][x]}return e.createDenseMatrix({data:b,size:[m,h],datatype:s===e._datatype&&p===r._datatype?d:void 0})}})),ua=he("matAlgo04xSidSid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new xn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=o&&l?[]:void 0,S=o&&l?[]:void 0,M=[],C=[];let T,D,B,F,O;for(D=0;D<g;D++){E[D]=N.length;const e=D+1;for(F=s[D],O=s[D+1],B=F;B<O;B++)T=a[B],N.push(T),M[T]=e,A&&(A[T]=o[B]);for(F=p[D],O=p[D+1],B=F;B<O;B++)if(T=f[B],M[T]===e){if(A){const e=v(A[T],l[B]);x(e,b)?M[T]=null:A[T]=e}}else N.push(T),C[T]=e,S&&(S[T]=l[B]);if(A&&S)for(B=E[D];B<N.length;)T=N[B],M[T]===e?(w[B]=A[T],B++):C[T]===e?(w[B]=S[T],B++):N.splice(B,1)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),ca=he("matAlgo10xSids",["typed","DenseMatrix"],(e=>{let{typed:t,DenseMatrix:r}=e;return function(e,n,i,o){const a=e._values,s=e._index,u=e._ptr,c=e._size,l=e._datatype;if(!a)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");const f=c[0],p=c[1];let m,h=i;"string"==typeof l&&(m=l,n=t.convert(n,m),h=t.find(i,[m,m]));const d=[],g=[],y=[];for(let e=0;e<p;e++){const t=e+1;for(let r=u[e],n=u[e+1],i=r;i<n;i++){const e=s[i];g[e]=a[i],y[e]=t}for(let r=0;r<f;r++)0===e&&(d[r]=[]),y[r]===t?d[r][e]=o?h(n,g[r]):h(g[r],n):d[r][e]=n}return new r({data:d,size:[f,p],datatype:m})}}));function la(e,t,r,n){if(!(this instanceof la))throw new SyntaxError("Constructor must be called with the new operator");this.fn=e,this.count=t,this.min=r,this.max=n,this.message="Wrong number of arguments in function "+e+" ("+t+" provided, "+r+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}la.prototype=new Error,la.prototype.constructor=Error,la.prototype.name="ArgumentsError",la.prototype.isArgumentsError=!0;const fa="number | BigNumber | Fraction | Matrix | Array",pa=`${fa}, ${fa}, ...${fa}`;function ma(e){return!e.some((e=>Array.isArray(e)))}const ha=he("gcd",["typed","config","round","matrix","equalScalar","zeros","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,config:n,round:i,equalScalar:o,zeros:a,BigNumber:s,DenseMatrix:u,concat:c}=e;const l=aa({typed:t,config:n,round:i,matrix:r,equalScalar:o,zeros:a,DenseMatrix:u,concat:c}),f=sa({typed:t}),p=ua({typed:t,equalScalar:o}),m=ca({typed:t,DenseMatrix:u});return t("gcd",{"number, number":function(e,t){if(!ye(e)||!ye(t))throw new Error("Parameters in function gcd must be integer numbers");let r;for(;0!==t;)r=l(e,t),e=t,t=r;return e<0?-e:e},"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");const r=new s(0);for(;!t.isZero();){const r=l(e,t);e=t,t=r}return e.lt(r)?e.neg():e},"Fraction, Fraction":(e,t)=>e.gcd(t)},oa({typed:t,matrix:r,concat:c})({SS:p,DS:f,Ss:m}),{[pa]:t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i})),Array:t.referToSelf((e=>t=>{if(1===t.length&&Array.isArray(t[0])&&ma(t[0]))return e(...t[0]);if(ma(t))return e(...t);throw new la("gcd() supports only 1d matrices!")})),Matrix:t.referToSelf((e=>t=>e(t.toArray())))})})),da=he("matAlgo06xS0S0",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=n._values,c=n._size,l=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(a.length!==c.length)throw new xn(a.length,c.length);if(a[0]!==c[0]||a[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+c+")");const f=a[0],p=a[1];let m,h=r,d=0,g=i;"string"==typeof s&&s===l&&"mixed"!==s&&(m=s,h=t.find(r,[m,m]),d=t.convert(0,m),g=t.find(i,[m,m]));const y=o&&u?[]:void 0,x=[],b=[],v=y?[]:void 0,w=[],N=[];for(let t=0;t<p;t++){b[t]=x.length;const r=t+1;if(si(e,t,w,v,N,r,x,g),si(n,t,w,v,N,r,x,g),v){let e=b[t];for(;e<x.length;){const t=x[e];if(N[t]===r){const r=v[t];h(r,d)?x.splice(e,1):(y.push(r),e++)}else x.splice(e,1)}}else{let e=b[t];for(;e<x.length;)N[x[e]]!==r?x.splice(e,1):e++}}return b[p]=x.length,e.createSparseMatrix({values:y,index:x,ptr:b,size:[f,p],datatype:s===e._datatype&&l===n._datatype?m:void 0})}})),ga=he("lcm",["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,concat:i}=e;const o=ea({typed:t,equalScalar:n}),a=da({typed:t,equalScalar:n}),s=Io({typed:t,equalScalar:n}),u=oa({typed:t,matrix:r,concat:i}),c="number | BigNumber | Fraction | Matrix | Array",l={};return l[`${c}, ${c}, ...${c}`]=t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i})),t("lcm",{"number, number":lo,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero())return e;if(t.isZero())return t;const r=e.times(t);for(;!t.isZero();){const r=t;t=e.mod(r),e=r}return r.div(e).abs()},"Fraction, Fraction":(e,t)=>e.lcm(t)},u({SS:a,DS:o,Ss:s}),l)})),ya="log10",xa=he(ya,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(ya,{number:function(e){return e>=0||r.predictable?fo(e):new n(e,0).log().div(Math.LN10)},Complex:function(e){return new n(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||r.predictable?e.log():new n(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ba="log2",va=he(ba,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(ba,{number:function(e){return e>=0||r.predictable?po(e):i(new n(e,0))},Complex:i,BigNumber:function(e){return!e.isNegative()||r.predictable?e.log(2):i(new n(e.toNumber(),0))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))});function i(e){const t=Math.sqrt(e.re*e.re+e.im*e.im);return new n(Math.log2?Math.log2(t):Math.log(t)/Math.LN2,Math.atan2(e.im,e.re)/Math.LN2)}})),wa=he("multiplyScalar",["typed"],(e=>{let{typed:t}=e;return t("multiplyScalar",{"number, number":no,"Complex, Complex":function(e,t){return e.mul(t)},"BigNumber, BigNumber":function(e,t){return e.times(t)},"bigint, bigint":function(e,t){return e*t},"Fraction, Fraction":function(e,t){return e.mul(t)},"number | Fraction | BigNumber | Complex, Unit":(e,t)=>t.multiply(e),"Unit, number | Fraction | BigNumber | Complex | Unit":(e,t)=>e.multiply(t)})})),Na="multiply",Ea=he(Na,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],(e=>{let{typed:t,matrix:r,addScalar:n,multiplyScalar:i,equalScalar:o,dot:a}=e;const s=Io({typed:t,equalScalar:o}),u=ko({typed:t});function c(e,t){switch(e.length){case 1:switch(t.length){case 1:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(e[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+e[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+e[1]+") must match Vector length ("+t[0]+")");break;case 2:if(e[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+e[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+e.length+" dimensions)")}}const l=t("_multiplyMatrixVector",{"DenseMatrix, any":function(e,r){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._data,c=r._datatype||r.getDataType(),l=a[0],f=a[1];let p,m=n,h=i;s&&c&&s===c&&"string"==typeof s&&"mixed"!==s&&(p=s,m=t.find(n,[p,p]),h=t.find(i,[p,p]));const d=[];for(let e=0;e<l;e++){const t=o[e];let r=h(t[0],u[0]);for(let e=1;e<f;e++)r=m(r,h(t[e],u[e]));d[e]=r}return e.createDenseMatrix({data:d,size:[l],datatype:s===e._datatype&&c===r._datatype?p:void 0})},"SparseMatrix, any":function(e,r){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=r._data,f=r._datatype||r.getDataType(),p=e._size[0],m=r._size[0],h=[],d=[],g=[];let y,x=n,b=i,v=o,w=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(y=c,x=t.find(n,[y,y]),b=t.find(i,[y,y]),v=t.find(o,[y,y]),w=t.convert(0,y));const N=[],E=[];g[0]=0;for(let e=0;e<m;e++){const t=l[e];if(!v(t,w))for(let r=u[e],n=u[e+1],i=r;i<n;i++){const e=s[i];E[e]?N[e]=x(N[e],b(t,a[i])):(E[e]=!0,d.push(e),N[e]=b(t,a[i]))}}for(let e=d.length,t=0;t<e;t++){const e=d[t];h[t]=N[e]}return g[1]=d.length,e.createSparseMatrix({values:h,index:d,ptr:g,size:[p,1],datatype:c===e._datatype&&f===r._datatype?y:void 0})}}),f=t("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(e,r){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._data,c=r._size,l=r._datatype||r.getDataType(),f=a[0],p=a[1],m=c[1];let h,d=n,g=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&"mixed"!==s&&(h=s,d=t.find(n,[h,h]),g=t.find(i,[h,h]));const y=[];for(let e=0;e<f;e++){const t=o[e];y[e]=[];for(let r=0;r<m;r++){let n=g(t[0],u[0][r]);for(let e=1;e<p;e++)n=d(n,g(t[e],u[e][r]));y[e][r]=n}}return e.createDenseMatrix({data:y,size:[f,m],datatype:s===e._datatype&&l===r._datatype?h:void 0})},"DenseMatrix, SparseMatrix":function(e,r){const a=e._data,s=e._size,u=e._datatype||e.getDataType(),c=r._values,l=r._index,f=r._ptr,p=r._size,m=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!c)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");const h=s[0],d=p[1];let g,y=n,x=i,b=o,v=0;u&&m&&u===m&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(n,[g,g]),x=t.find(i,[g,g]),b=t.find(o,[g,g]),v=t.convert(0,g));const w=[],N=[],E=[],A=r.createSparseMatrix({values:w,index:N,ptr:E,size:[h,d],datatype:u===e._datatype&&m===r._datatype?g:void 0});for(let e=0;e<d;e++){E[e]=N.length;const t=f[e],r=f[e+1];if(r>t){let e=0;for(let n=0;n<h;n++){const i=n+1;let o;for(let s=t;s<r;s++){const t=l[s];e!==i?(o=x(a[n][t],c[s]),e=i):o=y(o,x(a[n][t],c[s]))}e!==i||b(o,v)||(N.push(n),w.push(o))}}}return E[d]=N.length,A},"SparseMatrix, DenseMatrix":function(e,r){const a=e._values,s=e._index,u=e._ptr,c=e._datatype||void 0===e._data?e._datatype:e.getDataType();if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");const l=r._data,f=r._datatype||r.getDataType(),p=e._size[0],m=r._size[0],h=r._size[1];let d,g=n,y=i,x=o,b=0;c&&f&&c===f&&"string"==typeof c&&"mixed"!==c&&(d=c,g=t.find(n,[d,d]),y=t.find(i,[d,d]),x=t.find(o,[d,d]),b=t.convert(0,d));const v=[],w=[],N=[],E=e.createSparseMatrix({values:v,index:w,ptr:N,size:[p,h],datatype:c===e._datatype&&f===r._datatype?d:void 0}),A=[],S=[];for(let e=0;e<h;e++){N[e]=w.length;const t=e+1;for(let r=0;r<m;r++){const n=l[r][e];if(!x(n,b))for(let e=u[r],i=u[r+1],o=e;o<i;o++){const e=s[o];S[e]!==t?(S[e]=t,w.push(e),A[e]=y(n,a[o])):A[e]=g(A[e],y(n,a[o]))}}for(let t=N[e],r=w.length,n=t;n<r;n++){const e=w[n];v[n]=A[e]}}return N[h]=w.length,E},"SparseMatrix, SparseMatrix":function(e,r){const o=e._values,a=e._index,s=e._ptr,u=e._datatype||void 0===e._data?e._datatype:e.getDataType(),c=r._values,l=r._index,f=r._ptr,p=r._datatype||void 0===r._data?r._datatype:r.getDataType(),m=e._size[0],h=r._size[1],d=o&&c;let g,y=n,x=i;u&&p&&u===p&&"string"==typeof u&&"mixed"!==u&&(g=u,y=t.find(n,[g,g]),x=t.find(i,[g,g]));const b=d?[]:void 0,v=[],w=[],N=e.createSparseMatrix({values:b,index:v,ptr:w,size:[m,h],datatype:u===e._datatype&&p===r._datatype?g:void 0}),E=d?[]:void 0,A=[];let S,M,C,T,D,B,F,O;for(let e=0;e<h;e++){w[e]=v.length;const t=e+1;for(D=f[e],B=f[e+1],T=D;T<B;T++)if(O=l[T],d)for(M=s[O],C=s[O+1],S=M;S<C;S++)F=a[S],A[F]!==t?(A[F]=t,v.push(F),E[F]=x(c[T],o[S])):E[F]=y(E[F],x(c[T],o[S]));else for(M=s[O],C=s[O+1],S=M;S<C;S++)F=a[S],A[F]!==t&&(A[F]=t,v.push(F));if(d)for(let t=w[e],r=v.length,n=t;n<r;n++){const e=v[n];b[n]=E[e]}}return w[h]=v.length,N}});return t(Na,i,{"Array, Array":t.referTo("Matrix, Matrix",(e=>(t,n)=>{c(vn(t),vn(n));const i=e(r(t),r(n));return E(i)?i.valueOf():i})),"Matrix, Matrix":function(e,r){const o=e.size(),s=r.size();return c(o,s),1===o.length?1===s.length?function(e,t,r){if(0===r)throw new Error("Cannot multiply two empty vectors");return a(e,t)}(e,r,o[0]):function(e,r){if("dense"!==r.storage())throw new Error("Support for SparseMatrix not implemented");return function(e,r){const o=e._data,a=e._size,s=e._datatype||e.getDataType(),u=r._data,c=r._size,l=r._datatype||r.getDataType(),f=a[0],p=c[1];let m,h=n,d=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(m=s,h=t.find(n,[m,m]),d=t.find(i,[m,m]));const g=[];for(let e=0;e<p;e++){let t=d(o[0],u[0][e]);for(let r=1;r<f;r++)t=h(t,d(o[r],u[r][e]));g[e]=t}return e.createDenseMatrix({data:g,size:[p],datatype:s===e._datatype&&l===r._datatype?m:void 0})}(e,r)}(e,r):1===s.length?l(e,r):f(e,r)},"Matrix, Array":t.referTo("Matrix,Matrix",(e=>(t,n)=>e(t,r(n)))),"Array, Matrix":t.referToSelf((e=>(t,n)=>e(r(t,n.storage()),n))),"SparseMatrix, any":function(e,t){return s(e,t,i,!1)},"DenseMatrix, any":function(e,t){return u(e,t,i,!1)},"any, SparseMatrix":function(e,t){return s(t,e,i,!0)},"any, DenseMatrix":function(e,t){return u(t,e,i,!0)},"Array, any":function(e,t){return u(r(e),t,i,!1).valueOf()},"any, Array":function(e,t){return u(r(t),e,i,!0).valueOf()},"any, any":i,"any, any, ...any":t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i}))})})),Aa="nthRoot",Sa=he(Aa,["typed","matrix","equalScalar","BigNumber","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,BigNumber:i,concat:o}=e;const a=sa({typed:t}),s=ea({typed:t,equalScalar:n}),u=da({typed:t,equalScalar:n}),c=Io({typed:t,equalScalar:n}),l=oa({typed:t,matrix:r,concat:o});function f(){throw new Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return t(Aa,{number:mo,"number, number":mo,BigNumber:e=>p(e,new i(2)),"BigNumber, BigNumber":p,Complex:f,"Complex, number":f,Array:t.referTo("DenseMatrix,number",(e=>t=>e(r(t),2).valueOf())),DenseMatrix:t.referTo("DenseMatrix,number",(e=>t=>e(t,2))),SparseMatrix:t.referTo("SparseMatrix,number",(e=>t=>e(t,2))),"SparseMatrix, SparseMatrix":t.referToSelf((e=>(t,r)=>{if(1===r.density())return u(t,r,e);throw new Error("Root must be non-zero")})),"DenseMatrix, SparseMatrix":t.referToSelf((e=>(t,r)=>{if(1===r.density())return a(t,r,e,!1);throw new Error("Root must be non-zero")})),"Array, SparseMatrix":t.referTo("DenseMatrix,SparseMatrix",(e=>(t,n)=>e(r(t),n))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>{if(1===r.density())return c(r,t,e,!0);throw new Error("Root must be non-zero")}))},l({scalar:"number | BigNumber",SD:s,Ss:c,sS:!1}));function p(e,t){const r=i.precision,n=i.clone({precision:r+2}),o=new i(0),a=new n(1),s=t.isNegative();if(s&&(t=t.neg()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return s?new n(1/0):0;if(!e.isFinite())return s?o:e;let u=e.abs().pow(a.div(t));return u=e.isNeg()?u.neg():u,new i((s?a.div(u):u).toPrecision(r))}})),Ma="sign",Ca=he(Ma,["typed","BigNumber","Fraction","complex"],(e=>{let{typed:t,BigNumber:r,complex:n,Fraction:i}=e;return t(Ma,{number:ho,Complex:function(e){return 0===e.im?n(ho(e.re)):e.sign()},BigNumber:function(e){return new r(e.cmp(0))},bigint:function(e){return e>0n?1n:e<0n?-1n:0n},Fraction:function(e){return new i(e.s)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),Unit:t.referToSelf((e=>r=>{if(!r._isDerived()&&0!==r.units[0].unit.offset)throw new TypeError("sign is ambiguous for units with offset");return t.find(e,r.valueType())(r.value)}))})})),Ta=he("sqrt",["config","typed","Complex"],(e=>{let{config:t,typed:r,Complex:n}=e;return r("sqrt",{number:i,Complex:function(e){return e.sqrt()},BigNumber:function(e){return!e.isNegative()||t.predictable?e.sqrt():i(e.toNumber())},Unit:function(e){return e.pow(.5)}});function i(e){return isNaN(e)?NaN:e>=0||t.predictable?Math.sqrt(e):new n(e,0).sqrt()}})),Da="square",Ba=he(Da,["typed"],(e=>{let{typed:t}=e;return t(Da,{number:go,Complex:function(e){return e.mul(e)},BigNumber:function(e){return e.times(e)},bigint:function(e){return e*e},Fraction:function(e){return e.mul(e)},Unit:function(e){return e.pow(2)}})})),Fa="subtract",Oa=he(Fa,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,subtractScalar:i,unaryMinus:o,DenseMatrix:a,concat:s}=e;const u=sa({typed:t}),c=ta({typed:t}),l=ra({typed:t,equalScalar:n}),f=ca({typed:t,DenseMatrix:a}),p=zo({typed:t,DenseMatrix:a}),m=oa({typed:t,matrix:r,concat:s});return t(Fa,{"any, any":i},m({elop:i,SS:l,DS:u,SD:c,Ss:p,sS:f}))})),_a="xgcd",Ia=he(_a,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(_a,{"number, number":function(e,t){const i=yo(e,t);return"Array"===r.matrix?i:n(i)},"BigNumber, BigNumber":function(e,t){let o,a,s;const u=new i(0),c=new i(1);let l,f=u,p=c,m=c,h=u;if(!e.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)a=e.div(t).floor(),s=e.mod(t),o=f,f=p.minus(a.times(f)),p=o,o=m,m=h.minus(a.times(m)),h=o,e=t,t=s;return l=e.lt(u)?[e.neg(),p.neg(),h.neg()]:[e,e.isZero()?0:p,h],"Array"===r.matrix?l:n(l)}})})),za="invmod",ka=he(za,["typed","config","BigNumber","xgcd","equal","smaller","mod","add","isInteger"],(e=>{let{typed:t,config:r,BigNumber:n,xgcd:i,equal:o,smaller:a,mod:s,add:u,isInteger:c}=e;return t(za,{"number, number":l,"BigNumber, BigNumber":l});function l(e,t){if(!c(e)||!c(t))throw new Error("Parameters in function invmod must be integer numbers");if(e=s(e,t),o(t,0))throw new Error("Divisor must be non zero");let r=i(e,t);r=r.valueOf();let[l,f]=r;return o(l,n(1))?(f=s(f,t),a(f,n(0))&&(f=u(f,t)),f):NaN}})),Ra=he("matAlgo09xS0Sf",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new xn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=o&&l?[]:void 0,N=[],E=[],A=w?[]:void 0,S=[];let M,C,T,D,B;for(C=0;C<g;C++){E[C]=N.length;const e=C+1;if(A)for(D=p[C],B=p[C+1],T=D;T<B;T++)M=f[T],S[M]=e,A[M]=l[T];for(D=s[C],B=s[C+1],T=D;T<B;T++)if(M=a[T],A){const t=S[M]===e?A[M]:b,r=v(o[T],t);x(r,b)||(N.push(M),w.push(r))}else N.push(M)}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),qa="dotMultiply",Pa=he(qa,["typed","matrix","equalScalar","multiplyScalar","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,multiplyScalar:i,concat:o}=e;const a=ea({typed:t,equalScalar:n}),s=Ra({typed:t,equalScalar:n}),u=Io({typed:t,equalScalar:n}),c=oa({typed:t,matrix:r,concat:o});return t(qa,c({elop:i,SS:s,DS:a,Ss:u}))}));function ja(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");const r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new r(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new r(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new r(0):e}return $a(e,t,(function(e,t){return e&t}))}function Ua(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");const t=e.constructor,r=t.precision;t.config({precision:1e9});const n=e.plus(new t(1));return n.s=-n.s||null,t.config({precision:r}),n}function La(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");const r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);const n=new r(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:e.isFinite()&&t.isFinite()?$a(e,t,(function(e,t){return e|t})):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e}function $a(e,t,r){const n=e.constructor;let i,o;const a=+(e.s<0),s=+(t.s<0);if(a){i=Ha(Ua(e));for(let e=0;e<i.length;++e)i[e]^=1}else i=Ha(e);if(s){o=Ha(Ua(t));for(let e=0;e<o.length;++e)o[e]^=1}else o=Ha(t);let u,c,l;i.length<=o.length?(u=i,c=o,l=a):(u=o,c=i,l=s);let f=u.length,p=c.length;const m=1^r(a,s);let h=new n(1^m),d=new n(1);const g=new n(2),y=n.precision;for(n.config({precision:1e9});f>0;)r(u[--f],c[--p])===m&&(h=h.plus(d)),d=d.times(g);for(;p>0;)r(l,c[--p])===m&&(h=h.plus(d)),d=d.times(g);return n.config({precision:y}),0===m&&(h.s=-h.s),h}function Ha(e){const t=e.d;let r=t[0]+"";for(let e=1;e<t.length;++e){let n=t[e]+"";for(let e=7-n.length;e--;)n="0"+n;r+=n}let n=r.length;for(;"0"===r.charAt(n);)n--;let i=e.e,o=r.slice(0,n+1||1);const a=o.length;if(i>0)if(++i>a)for(i-=a;i--;)o+="0";else i<a&&(o=o.slice(0,i)+"."+o.slice(i));const s=[0];for(let e=0;e<o.length;){let t=s.length;for(;t--;)s[t]*=10;s[0]+=parseInt(o.charAt(e++));for(let e=0;e<s.length;++e)s[e]>1&&(null!==s[e+1]&&void 0!==s[e+1]||(s[e+1]=0),s[e+1]+=s[e]>>1,s[e]&=1)}return s.reverse()}function Ga(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");const r=e.constructor;if(e.isNaN()||t.isNaN())return new r(NaN);if(e.isZero())return t;if(t.isZero())return e;if(e.eq(t))return new r(0);const n=new r(-1);return e.eq(n)?Ua(t):t.eq(n)?Ua(e):e.isFinite()&&t.isFinite()?$a(e,t,(function(e,t){return e^t})):e.isFinite()||t.isFinite()?new r(e.isNegative()===t.isNegative()?1/0:-1/0):n}function Va(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function leftShift");const r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:e.isFinite()||t.isFinite()?t.lt(55)?e.times(Math.pow(2,t.toNumber())+""):e.times(new r(2).pow(t)):new r(NaN)}function Wa(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function rightArithShift");const r=e.constructor;return e.isNaN()||t.isNaN()||t.isNegative()&&!t.isZero()?new r(NaN):e.isZero()||t.isZero()?e:t.isFinite()?t.lt(55)?e.div(Math.pow(2,t.toNumber())+"").floor():e.div(new r(2).pow(t)).floor():e.isNegative()?new r(-1):e.isFinite()?new r(0):new r(NaN)}const Za="number, number";function Ya(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitAnd");return e&t}function Ja(e){if(!ye(e))throw new Error("Integer expected in function bitNot");return~e}function Xa(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitOr");return e|t}function Qa(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function bitXor");return e^t}function Ka(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function leftShift");return e<<t}function es(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightArithShift");return e>>t}function ts(e,t){if(!ye(e)||!ye(t))throw new Error("Integers expected in function rightLogShift");return e>>>t}Ya.signature=Za,Ja.signature="number",Xa.signature=Za,Qa.signature=Za,Ka.signature=Za,es.signature=Za,ts.signature=Za;const rs="bitAnd",ns=he(rs,["typed","matrix","equalScalar","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,concat:i}=e;const o=ea({typed:t,equalScalar:n}),a=da({typed:t,equalScalar:n}),s=Io({typed:t,equalScalar:n}),u=oa({typed:t,matrix:r,concat:i});return t(rs,{"number, number":Ya,"BigNumber, BigNumber":ja,"bigint, bigint":(e,t)=>e&t},u({SS:a,DS:o,Ss:s}))})),is="bitNot",os=he(is,["typed"],(e=>{let{typed:t}=e;return t(is,{number:Ja,BigNumber:Ua,bigint:e=>~e,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),as="bitOr",ss=he(as,["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=sa({typed:t}),s=ua({typed:t,equalScalar:n}),u=ca({typed:t,DenseMatrix:i}),c=oa({typed:t,matrix:r,concat:o});return t(as,{"number, number":Xa,"BigNumber, BigNumber":La,"bigint, bigint":(e,t)=>e|t},c({SS:s,DS:a,Ss:u}))})),us=he("matAlgo07xSSf",["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:r}=e;return function(e,i,o){const a=e._size,s=e._datatype||void 0===e._data?e._datatype:e.getDataType(),u=i._size,c=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(a.length!==u.length)throw new xn(a.length,u.length);if(a[0]!==u[0]||a[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+u+")");const l=a[0],f=a[1];let p,m=0,h=o;"string"==typeof s&&s===c&&"mixed"!==s&&(p=s,m=t.convert(0,p),h=t.find(o,[p,p]));const d=[],g=[],y=new Array(f+1).fill(0),x=[],b=[],v=[],w=[];for(let t=0;t<f;t++){const r=t+1;let o=0;n(e,t,v,x,r),n(i,t,w,b,r);for(let e=0;e<l;e++){const t=h(v[e]===r?x[e]:m,w[e]===r?b[e]:m);0!==t&&!1!==t&&(g.push(e),d.push(t),o++)}y[t+1]=y[t]+o}return new r({values:d,index:g,ptr:y,size:[l,f],datatype:s===e._datatype&&c===i._datatype?p:void 0})};function n(e,t,r,n,i){const o=e._values,a=e._index,s=e._ptr;for(let e=s[t],u=s[t+1];e<u;e++){const t=a[e];r[t]=i,n[t]=o[e]}}})),cs="bitXor",ls=he(cs,["typed","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:o}=e;const a=ta({typed:t}),s=us({typed:t,SparseMatrix:o}),u=zo({typed:t,DenseMatrix:n}),c=oa({typed:t,matrix:r,concat:i});return t(cs,{"number, number":Qa,"BigNumber, BigNumber":Ga,"bigint, bigint":(e,t)=>e^t},c({SS:s,DS:a,Ss:u}))})),fs=he("arg",["typed"],(e=>{let{typed:t}=e;return t("arg",{number:function(e){return Math.atan2(0,e)},BigNumber:function(e){return e.constructor.atan2(0,e)},Complex:function(e){return e.arg()},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ps="conj",ms=he(ps,["typed"],(e=>{let{typed:t}=e;return t(ps,{"number | BigNumber | Fraction":e=>e,Complex:e=>e.conjugate(),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),hs=he("im",["typed"],(e=>{let{typed:t}=e;return t("im",{number:()=>0,"BigNumber | Fraction":e=>e.mul(0),Complex:e=>e.im,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),ds=he("re",["typed"],(e=>{let{typed:t}=e;return t("re",{"number | BigNumber | Fraction":e=>e,Complex:e=>e.re,"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),gs="number, number";function ys(e){return!e}function xs(e,t){return!(!e&&!t)}function bs(e,t){return!!e!=!!t}function vs(e,t){return!(!e||!t)}ys.signature="number",xs.signature=gs,bs.signature=gs,vs.signature=gs;const ws=he("not",["typed"],(e=>{let{typed:t}=e;return t("not",{"null | undefined":()=>!0,number:ys,Complex:function(e){return 0===e.re&&0===e.im},BigNumber:function(e){return e.isZero()||e.isNaN()},bigint:e=>!e,Unit:t.referToSelf((e=>r=>t.find(e,r.valueType())(r.value))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ns=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=ta({typed:t}),s=ra({typed:t,equalScalar:n}),u=zo({typed:t,DenseMatrix:i}),c=oa({typed:t,matrix:r,concat:o});return t("or",{"number, number":xs,"Complex, Complex":function(e,t){return 0!==e.re||0!==e.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(e,t){return!e.isZero()&&!e.isNaN()||!t.isZero()&&!t.isNaN()},"bigint, bigint":xs,"Unit, Unit":t.referToSelf((e=>(t,r)=>e(t.value||0,r.value||0)))},c({SS:s,DS:a,Ss:u}))})),Es=he("xor",["typed","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:r,DenseMatrix:n,concat:i,SparseMatrix:o}=e;const a=ta({typed:t}),s=us({typed:t,SparseMatrix:o}),u=zo({typed:t,DenseMatrix:n}),c=oa({typed:t,matrix:r,concat:i});return t("xor",{"number, number":bs,"Complex, Complex":function(e,t){return(0!==e.re||0!==e.im)!=(0!==t.re||0!==t.im)},"bigint, bigint":bs,"BigNumber, BigNumber":function(e,t){return(!e.isZero()&&!e.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":t.referToSelf((e=>(t,r)=>e(t.value||0,r.value||0)))},c({SS:s,DS:a,Ss:u}))})),As="concat",Ss=he(As,["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:r,isInteger:n}=e;return t(As,{"...Array | Matrix | number | BigNumber":function(e){let t;const i=e.length;let o,a=-1,s=!1;const u=[];for(t=0;t<i;t++){const r=e[t];if(E(r)&&(s=!0),d(r)||g(r)){if(t!==i-1)throw new Error("Dimension must be specified as last argument");if(o=a,a=r.valueOf(),!n(a))throw new TypeError("Integer number expected for dimension");if(a<0||t>0&&a>o)throw new bn(a,o+1)}else{const e=ae(r).valueOf(),n=vn(e);if(u[t]=e,o=a,a=n.length-1,t>0&&a!==o)throw new xn(o+1,a+1)}}if(0===u.length)throw new SyntaxError("At least one matrix expected");let c=u.shift();for(;u.length;)c=Hn(c,u.shift(),a);return s?r(c):c},"...string":function(e){return e.join("")}})})),Ms="column",Cs=he(Ms,["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;return t(Ms,{"Matrix, number":o,"Array, number":function(e,t){return o(n(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");An(t,e.size()[1]);const o=i(0,e.size()[0]),a=new r(o,t),s=e.subset(a);return E(s)?s:n([[s]])}})),Ts="count",Ds=he(Ts,["typed","size","prod"],(e=>{let{typed:t,size:r,prod:n}=e;return t(Ts,{string:function(e){return e.length},"Matrix | Array":function(e){return n(r(e))}})})),Bs="cross",Fs=he(Bs,["typed","matrix","subtract","multiply"],(e=>{let{typed:t,matrix:r,subtract:n,multiply:i}=e;return t(Bs,{"Matrix, Matrix":function(e,t){return r(o(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(o(e.toArray(),t))},"Array, Matrix":function(e,t){return r(o(e,t.toArray()))},"Array, Array":o});function o(e,t){const r=Math.max(vn(e).length,vn(t).length);e=Fn(e),t=Fn(t);const o=vn(e),a=vn(t);if(1!==o.length||1!==a.length||3!==o[0]||3!==a[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+o.join(", ")+"], B = ["+a.join(", ")+"])");const s=[n(i(e[1],t[2]),i(e[2],t[1])),n(i(e[2],t[0]),i(e[0],t[2])),n(i(e[0],t[1]),i(e[1],t[0]))];return r>1?[s]:s}})),Os="diag",_s=he(Os,["typed","matrix","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,matrix:r,DenseMatrix:n,SparseMatrix:i}=e;return t(Os,{Array:function(e){return o(e,0,vn(e),null)},"Array, number":function(e,t){return o(e,t,vn(e),null)},"Array, BigNumber":function(e,t){return o(e,t.toNumber(),vn(e),null)},"Array, string":function(e,t){return o(e,0,vn(e),t)},"Array, number, string":function(e,t,r){return o(e,t,vn(e),r)},"Array, BigNumber, string":function(e,t,r){return o(e,t.toNumber(),vn(e),r)},Matrix:function(e){return o(e,0,e.size(),e.storage())},"Matrix, number":function(e,t){return o(e,t,e.size(),e.storage())},"Matrix, BigNumber":function(e,t){return o(e,t.toNumber(),e.size(),e.storage())},"Matrix, string":function(e,t){return o(e,0,e.size(),t)},"Matrix, number, string":function(e,t,r){return o(e,t,e.size(),r)},"Matrix, BigNumber, string":function(e,t,r){return o(e,t.toNumber(),e.size(),r)}});function o(e,t,o,a){if(!ye(t))throw new TypeError("Second parameter in function diag must be an integer");const s=t>0?t:0,u=t<0?-t:0;switch(o.length){case 1:return function(e,t,r,o,a,s){const u=[o+a,o+s];if(r&&"sparse"!==r&&"dense"!==r)throw new TypeError(`Unknown matrix type ${r}"`);const c="sparse"===r?i.diagonal(u,e,t):n.diagonal(u,e,t);return null!==r?c:c.valueOf()}(e,t,a,o[0],u,s);case 2:return function(e,t,n,i,o,a){if(E(e)){const i=e.diagonal(t);return null!==n?n!==i.storage()?r(i,n):i:i.valueOf()}const s=Math.min(i[0]-o,i[1]-a),u=[];for(let t=0;t<s;t++)u[t]=e[t+o][t+a];return null!==n?r(u):u}(e,t,a,o,u,s)}throw new RangeError("Matrix for function diag must be 2 dimensional")}})),Is=he("filter",["typed"],(e=>{let{typed:t}=e;return t("filter",{"Array, function":zs,"Matrix, function":function(e,t){return e.create(zs(e.valueOf(),t),e.datatype())},"Array, RegExp":qn,"Matrix, RegExp":function(e,t){return e.create(qn(e.valueOf(),t),e.datatype())}})}));function zs(e,t){const r=Jn(t,e,"filter");return function(e){if(1!==vn(e).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(e,(function(e,t,n){return r(e,[t],n)}))}(e)}const ks="flatten",Rs=he(ks,["typed"],(e=>{let{typed:t}=e;return t(ks,{Array:function(e){return zn(e)},Matrix:function(e){return e.create(zn(e.toArray()),e.datatype())}})})),qs="forEach",Ps=he(qs,["typed"],(e=>{let{typed:t}=e;return t(qs,{"Array, function":js,"Matrix, function":function(e,t){e.forEach(t)}})}));function js(e,t){Yn(e,[],e,Jn(t,e,qs))}const Us="getMatrixDataType",Ls=he(Us,["typed"],(e=>{let{typed:t}=e;return t(Us,{Array:function(e){return Ln(e,oe)},Matrix:function(e){return e.getDataType()}})})),$s="identity",Hs=he($s,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i,DenseMatrix:o,SparseMatrix:a}=e;return t($s,{"":function(){return"Matrix"===r.matrix?n([]):[]},string:function(e){return n(e)},"number | BigNumber":function(e){return u(e,e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, string":function(e,t){return u(e,e,t)},"number | BigNumber, number | BigNumber":function(e,t){return u(e,t,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(e,t,r){return u(e,t,r)},Array:function(e){return s(e)},"Array, string":function(e,t){return s(e,t)},Matrix:function(e){return s(e.valueOf(),e.storage())},"Matrix, string":function(e,t){return s(e.valueOf(),t)}});function s(e,t){switch(e.length){case 0:return t?n(t):[];case 1:return u(e[0],e[0],t);case 2:return u(e[0],e[1],t);default:throw new Error("Vector containing two values expected")}}function u(e,t,r){const n=g(e)||g(t)?i:null;if(g(e)&&(e=e.toNumber()),g(t)&&(t=t.toNumber()),!ye(e)||e<1)throw new Error("Parameters in function identity must be positive integers");if(!ye(t)||t<1)throw new Error("Parameters in function identity must be positive integers");const s=n?new i(1):1,u=n?new n(0):0,c=[e,t];if(r){if("sparse"===r)return a.diagonal(c,s,0,u);if("dense"===r)return o.diagonal(c,s,0,u);throw new TypeError(`Unknown matrix type "${r}"`)}const l=Mn([],c,u),f=e<t?e:t;for(let e=0;e<f;e++)l[e][e]=s;return l}})),Gs="kron",Vs=he(Gs,["typed","matrix","multiplyScalar"],(e=>{let{typed:t,matrix:r,multiplyScalar:n}=e;return t(Gs,{"Matrix, Matrix":function(e,t){return r(i(e.toArray(),t.toArray()))},"Matrix, Array":function(e,t){return r(i(e.toArray(),t))},"Array, Matrix":function(e,t){return r(i(e,t.toArray()))},"Array, Array":i});function i(e,t){if(1===vn(e).length&&(e=[e]),1===vn(t).length&&(t=[t]),vn(e).length>2||vn(t).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(e.length)+", y = "+JSON.stringify(t.length)+")");const r=[];let i=[];return e.map((function(e){return t.map((function(t){return i=[],r.push(i),e.map((function(e){return t.map((function(t){return i.push(n(e,t))}))}))}))}))&&r}})),Ws="map",Zs=he(Ws,["typed"],(e=>{let{typed:t}=e;return t(Ws,{"Array, function":r,"Matrix, function":function(e,t){return e.map(t)},"Array|Matrix, Array|Matrix, ...Array|Matrix|function":(e,n,i)=>function(e,n){if("function"!=typeof n)throw new Error("Last argument must be a callback function");const i=e[0].isMatrix,o=Gn(...e.map((e=>e.isMatrix?e.size():vn(e)))),a=i?(e,t)=>e.get(t):Zn,s=i?e.map((t=>t.isMatrix?t.create(Wn(t.toArray(),o),t.datatype()):e[0].create(Wn(t.valueOf(),o)))):e.map((e=>e.isMatrix?Wn(e.toArray(),o):Wn(e,o)));let u;if(t.isTypedFunction(n)){const e=o.map((()=>0)),r=s.map((t=>a(t,e))),i=function(e,r,n,i){return null!==t.resolve(e,[...r,n,...i])?2:null!==t.resolve(e,[...r,n])?1:(t.resolve(e,r),0)}(n,r,e,s);u=l(i)}else{const t=e.length,r=function(e,t){return e.length>t+1?2:e.length===t+1?1:0}(n,t);u=l(r)}const c=(e,t)=>u([e,...s.slice(1).map((e=>a(e,t)))],t);return i?s[0].map(c):r(s[0],c);function l(e){switch(e){case 0:return e=>n(...e);case 1:return(e,t)=>n(...e,t);case 2:return(e,t)=>n(...e,t,...s)}}}([e,n,...i.slice(0,i.length-1)],i[i.length-1])});function r(e,t){return Yn(e,[],e,Jn(t,e,Ws))}})),Ys="diff",Js=he(Ys,["typed","matrix","subtract","number"],(e=>{let{typed:t,matrix:r,subtract:n,number:i}=e;return t(Ys,{"Array | Matrix":function(e){return E(e)?r(a(e.toArray())):a(e)},"Array | Matrix, number":function(e,t){if(!ye(t))throw new RangeError("Dimension must be a whole number");return E(e)?r(o(e.toArray(),t)):o(e,t)},"Array, BigNumber":t.referTo("Array,number",(e=>(t,r)=>e(t,i(r)))),"Matrix, BigNumber":t.referTo("Matrix,number",(e=>(t,r)=>e(t,i(r))))});function o(e,t){if(E(e)&&(e=e.toArray()),!Array.isArray(e))throw RangeError("Array/Matrix does not have that many dimensions");if(t>0){const r=[];return e.forEach((e=>{r.push(o(e,t-1))})),r}if(0===t)return a(e);throw RangeError("Cannot have negative dimension")}function a(e){const t=[],r=e.length;for(let n=1;n<r;n++)t.push(s(e[n-1],e[n]));return t}function s(e,t){E(e)&&(e=e.toArray()),E(t)&&(t=t.toArray());const r=Array.isArray(e),i=Array.isArray(t);if(r&&i)return function(e,t){if(e.length!==t.length)throw RangeError("Not all sub-arrays have the same length");const r=[],n=e.length;for(let i=0;i<n;i++)r.push(s(e[i],t[i]));return r}(e,t);if(!r&&!i)return n(t,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}})),Xs=he("ones",["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i}=e;return t("ones",{"":function(){return"Array"===r.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===r.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const r=function(e){let t=!1;return e.forEach((function(e,r,n){g(e)&&(t=!0,n[r]=e.toNumber())})),t}(e),o=r?new i(1):1;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function ones must be positive integers")}))}(e),t){const r=n(t);return e.length>0?r.resize(e,o):r}{const t=[];return e.length>0?Mn(t,e,o):t}}}));function Qs(){throw new Error('No "bignumber" implementation available')}function Ks(){throw new Error('No "fraction" implementation available')}function eu(){throw new Error('No "matrix" implementation available')}const tu="range",ru=he(tu,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:r,matrix:n,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;return t(tu,{string:p,"string, boolean":p,"number, number":function(e,t){return f(m(e,t,1,!1))},"number, number, number":function(e,t,r){return f(m(e,t,r,!1))},"number, number, boolean":function(e,t,r){return f(m(e,t,1,r))},"number, number, number, boolean":function(e,t,r,n){return f(m(e,t,r,n))},"BigNumber, BigNumber":function(e,t){return f(m(e,t,new(0,e.constructor)(1),!1))},"BigNumber, BigNumber, BigNumber":function(e,t,r){return f(m(e,t,r,!1))},"BigNumber, BigNumber, boolean":function(e,t,r){return f(m(e,t,new(0,e.constructor)(1),r))},"BigNumber, BigNumber, BigNumber, boolean":function(e,t,r,n){return f(m(e,t,r,n))},"Unit, Unit, Unit":function(e,t,r){return f(m(e,t,r,!1))},"Unit, Unit, Unit, boolean":function(e,t,r,n){return f(m(e,t,r,n))}});function f(e){return"Matrix"===r.matrix?n?n(e):eu():e}function p(e,t){const n=function(e){const t=e.split(":").map((function(e){return Number(e)}));if(t.some((function(e){return isNaN(e)})))return null;switch(t.length){case 2:return{start:t[0],end:t[1],step:1};case 3:return{start:t[0],end:t[2],step:t[1]};default:return null}}(e);if(!n)throw new SyntaxError('String "'+e+'" is no valid range');return"BigNumber"===r.number?(void 0===i&&Qs(),f(m(i(n.start),i(n.end),i(n.step)))):f(m(n.start,n.end,n.step,t))}function m(e,t,r,n){const i=[],f=l(r)?n?a:o:n?u:s;let p=e;for(;f(p,t);)i.push(p),p=c(p,r);return i}})),nu="reshape",iu=he(nu,["typed","isInteger","matrix"],(e=>{let{typed:t,isInteger:r}=e;return t(nu,{"Matrix, Array":function(e,t){return e.reshape(t,!0)},"Array, Array":function(e,t){return t.forEach((function(e){if(!r(e))throw new TypeError("Invalid size for dimension: "+e)})),Tn(e,t)}})})),ou=he("resize",["config","matrix"],(e=>{let{config:t,matrix:r}=e;return function(e,n,i){if(2!==arguments.length&&3!==arguments.length)throw new la("resize",arguments.length,2,3);if(E(n)&&(n=n.valueOf()),g(n[0])&&(n=n.map((function(e){return g(e)?e.toNumber():e}))),E(e))return e.resize(n,i,!0);if("string"==typeof e)return function(e,t,r){if(void 0!==r){if("string"!=typeof r||1!==r.length)throw new TypeError("Single character expected as defaultValue")}else r=" ";if(1!==t.length)throw new xn(t.length,1);const n=t[0];if("number"!=typeof n||!ye(n))throw new TypeError("Invalid size, must contain positive integers (size: "+pn(t)+")");if(e.length>n)return e.substring(0,n);if(e.length<n){let t=e;for(let i=0,o=n-e.length;i<o;i++)t+=r;return t}return e}(e,n,i);const o=!Array.isArray(e)&&"Array"!==t.matrix;if(0===n.length){for(;Array.isArray(e);)e=e[0];return ae(e)}{Array.isArray(e)||(e=[e]);const t=Mn(e=ae(e),n,i);return o?r(t):t}}})),au="rotate",su=he(au,["typed","multiply","rotationMatrix"],(e=>{let{typed:t,multiply:r,rotationMatrix:n}=e;return t(au,{"Array , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),r(n(t),e).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(e,t){return i(e,2),r(n(t),e)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),r(n(t,o),e)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(e,t,o){return i(e,3),r(n(t,o),e)}});function i(e,t){const r=Array.isArray(e)?vn(e):e.size();if(r.length>2)throw new RangeError(`Vector must be of dimensions 1x${t}`);if(2===r.length&&1!==r[1])throw new RangeError(`Vector must be of dimensions 1x${t}`);if(r[0]!==t)throw new RangeError(`Vector must be of dimensions 1x${t}`)}})),uu="rotationMatrix",cu=he(uu,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],(e=>{let{typed:t,config:r,multiplyScalar:n,addScalar:i,unaryMinus:o,norm:a,BigNumber:s,matrix:u,DenseMatrix:c,SparseMatrix:l,cos:f,sin:p}=e;return t(uu,{"":function(){return"Matrix"===r.matrix?u([]):[]},string:function(e){return u(e)},"number | BigNumber | Complex | Unit":function(e){return m(e,"Matrix"===r.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(e,t){return m(e,t)},"number | BigNumber | Complex | Unit, Array":function(e,t){const r=u(t);return h(r),x(e,r,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(e,t){h(t);const n=t.storage()||("Matrix"===r.matrix?"dense":void 0);return x(e,t,n)},"number | BigNumber | Complex | Unit, Array, string":function(e,t,r){const n=u(t);return h(n),x(e,n,r)},"number | BigNumber | Complex | Unit, Matrix, string":function(e,t,r){return h(t),x(e,t,r)}});function m(e,t){const r=g(e)?new s(-1):-1,i=f(e),o=p(e);return y([[i,n(r,o)],[o,i]],t)}function h(e){const t=e.size();if(t.length<1||3!==t[0])throw new RangeError("Vector must be of dimensions 1x3")}function d(e){return e.reduce(((e,t)=>n(e,t)))}function y(e,t){if(t){if("sparse"===t)return new l(e);if("dense"===t)return new c(e);throw new TypeError(`Unknown matrix type "${t}"`)}return e}function x(e,t,r){const n=a(t);if(0===n)throw new RangeError("Rotation around zero vector");const u=g(e)?s:null,c=u?new u(1):1,l=u?new u(-1):-1,m=u?new u(t.get([0])/n):t.get([0])/n,h=u?new u(t.get([1])/n):t.get([1])/n,x=u?new u(t.get([2])/n):t.get([2])/n,b=f(e),v=i(c,o(b)),w=p(e);return y([[i(b,d([m,m,v])),i(d([m,h,v]),d([l,x,w])),i(d([m,x,v]),d([h,w]))],[i(d([m,h,v]),d([x,w])),i(b,d([h,h,v])),i(d([h,x,v]),d([l,m,w]))],[i(d([m,x,v]),d([l,h,w])),i(d([h,x,v]),d([m,w])),i(b,d([x,x,v]))]],r)}})),lu=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;return t("row",{"Matrix, number":o,"Array, number":function(e,t){return o(n(ae(e)),t).valueOf()}});function o(e,t){if(2!==e.size().length)throw new Error("Only two dimensional matrix is supported");An(t,e.size()[0]);const o=i(0,e.size()[1]),a=new r(t,o),s=e.subset(a);return E(s)?s:n([[s]])}})),fu="size",pu=he(fu,["typed","config","?matrix"],(e=>{let{typed:t,config:r,matrix:n}=e;return t(fu,{Matrix:function(e){return e.create(e.size(),"number")},Array:vn,string:function(e){return"Array"===r.matrix?[e.length]:n([e.length],"dense","number")},"number | Complex | BigNumber | Unit | boolean | null":function(e){return"Array"===r.matrix?[]:n?n([],"dense","number"):eu()}})})),mu="squeeze",hu=he(mu,["typed"],(e=>{let{typed:t}=e;return t(mu,{Array:function(e){return Fn(ae(e))},Matrix:function(e){const t=Fn(e.toArray());return Array.isArray(t)?e.create(t,e.datatype()):t},any:function(e){return ae(e)}})})),du="subset",gu=he(du,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:r,zeros:n,add:i}=e;return t(du,{"Matrix, Index":function(e,t){return Sn(t)?r():(En(e,t),e.subset(t))},"Array, Index":t.referTo("Matrix, Index",(function(e){return function(t,n){const i=e(r(t),n);return n.isScalar()?i:i.valueOf()}})),"Object, Index":bu,"string, Index":yu,"Matrix, Index, any, any":function(e,t,r,o){return Sn(t)?e:(En(e,t),e.clone().subset(t,function(e,t){if("string"==typeof e)throw new Error("can't boradcast a string");if(t._isScalar)return e;const r=t.size();if(!r.every((e=>e>0)))return e;try{return i(e,n(r))}catch(t){return e}}(r,t),o))},"Array, Index, any, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,n,i,o){const a=e(r(t),n,i,o);return a.isMatrix?a.valueOf():a}})),"Array, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,n,i){return e(r(t),n,i,void 0).valueOf()}})),"Matrix, Index, any":t.referTo("Matrix, Index, any, any",(function(e){return function(t,r,n){return e(t,r,n,void 0)}})),"string, Index, string":xu,"string, Index, string, string":xu,"Object, Index, any":vu})}));function yu(e,t){if(!T(t))throw new TypeError("Index expected");if(Sn(t))return"";if(En(Array.from(e),t),1!==t.size().length)throw new xn(t.size().length,1);const r=e.length;An(t.min()[0],r),An(t.max()[0],r);const n=t.dimension(0);let i="";return n.forEach((function(t){i+=e.charAt(t)})),i}function xu(e,t,r,n){if(!t||!0!==t.isIndex)throw new TypeError("Index expected");if(Sn(t))return e;if(En(Array.from(e),t),1!==t.size().length)throw new xn(t.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw new TypeError("Single character expected as defaultValue")}else n=" ";const i=t.dimension(0);if(i.size()[0]!==r.length)throw new xn(i.size()[0],r.length);const o=e.length;An(t.min()[0]),An(t.max()[0]);const a=[];for(let t=0;t<o;t++)a[t]=e.charAt(t);if(i.forEach((function(e,t){a[e]=r.charAt(t[0])})),a.length>o)for(let e=o-1,t=a.length;e<t;e++)a[e]||(a[e]=n);return a.join("")}function bu(e,t){if(Sn(t))return;if(1!==t.size().length)throw new xn(t.size(),1);const r=t.dimension(0);if("string"!=typeof r)throw new TypeError("String expected as index to retrieve an object property");return i(e,r)}function vu(e,t,r){if(Sn(t))return e;if(1!==t.size().length)throw new xn(t.size(),1);const n=t.dimension(0);if("string"!=typeof n)throw new TypeError("String expected as index to retrieve an object property");const i=ae(e);return o(i,n,r),i}const wu="transpose",Nu=he(wu,["typed","matrix"],(e=>{let{typed:t,matrix:r}=e;return t(wu,{Array:e=>n(r(e)).valueOf(),Matrix:n,any:ae});function n(e){const t=e.size();let r;switch(t.length){case 1:r=e.clone();break;case 2:{const n=t[0],i=t[1];if(0===i)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+pn(t)+")");switch(e.storage()){case"dense":r=function(e,t,r){const n=e._data,i=[];let o;for(let e=0;e<r;e++){o=i[e]=[];for(let r=0;r<t;r++)o[r]=ae(n[r][e])}return e.createDenseMatrix({data:i,size:[r,t],datatype:e._datatype})}(e,n,i);break;case"sparse":r=function(e,t,r){const n=e._values,i=e._index,o=e._ptr,a=n?[]:void 0,s=[],u=[],c=[];for(let e=0;e<t;e++)c[e]=0;let l,f,p;for(l=0,f=i.length;l<f;l++)c[i[l]]++;let m=0;for(let e=0;e<t;e++)u.push(m),m+=c[e],c[e]=u[e];for(u.push(m),p=0;p<r;p++)for(let e=o[p],t=o[p+1],r=e;r<t;r++){const e=c[i[r]]++;s[e]=p,n&&(a[e]=ae(n[r]))}return e.createSparseMatrix({values:a,index:s,ptr:u,size:[r,t],datatype:e._datatype})}(e,n,i)}}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+pn(t)+")")}return r}})),Eu="ctranspose",Au=he(Eu,["typed","transpose","conj"],(e=>{let{typed:t,transpose:r,conj:n}=e;return t(Eu,{any:function(e){return n(r(e))}})})),Su="zeros",Mu=he(Su,["typed","config","matrix","BigNumber"],(e=>{let{typed:t,config:r,matrix:n,BigNumber:i}=e;return t(Su,{"":function(){return"Array"===r.matrix?o([]):o([],"default")},"...number | BigNumber | string":function(e){if("string"==typeof e[e.length-1]){const t=e.pop();return o(e,t)}return"Array"===r.matrix?o(e):o(e,"default")},Array:o,Matrix:function(e){const t=e.storage();return o(e.valueOf(),t)},"Array | Matrix, string":function(e,t){return o(e.valueOf(),t)}});function o(e,t){const r=function(e){let t=!1;return e.forEach((function(e,r,n){g(e)&&(t=!0,n[r]=e.toNumber())})),t}(e),o=r?new i(0):0;if(function(e){e.forEach((function(e){if("number"!=typeof e||!ye(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")}))}(e),t){const r=n(t);return e.length>0?r.resize(e,o):r}{const t=[];return e.length>0?Mn(t,e,o):t}}})),Cu=he("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],(e=>{let{typed:t,matrix:r,addScalar:n,multiplyScalar:i,divideScalar:o,exp:a,tau:s,i:u,dotDivide:c,conj:l,pow:f,ceil:p,log2:m}=e;return t("fft",{Array:h,Matrix:function(e){return e.create(h(e.valueOf()),e.datatype())}});function h(e){const t=vn(e);return 1===t.length?g(e,t[0]):d(e.map((e=>h(e,t.slice(1)))),0)}function d(e,t){const r=vn(e);if(0!==t)return new Array(r[0]).fill(0).map(((r,n)=>d(e[n],t-1)));if(1===r.length)return g(e);function n(e){const t=vn(e);return new Array(t[1]).fill(0).map(((r,n)=>new Array(t[0]).fill(0).map(((t,r)=>e[r][n]))))}return n(d(n(e),1))}function g(e){const t=e.length;if(1===t)return[e[0]];if(t%2==0){const r=[...g(e.filter(((e,t)=>t%2==0))),...g(e.filter(((e,t)=>t%2==1)))];for(let e=0;e<t/2;e++){const c=r[e],l=i(r[e+t/2],a(i(i(s,u),o(-e,t))));r[e]=n(c,l),r[e+t/2]=n(c,i(-1,l))}return r}return function(e){const t=e.length,r=a(o(i(-1,i(u,s)),t)),n=[];for(let e=1-t;e<t;e++)n.push(f(r,o(f(e,2),2)));const d=f(2,p(m(t+t-1))),y=[...new Array(t).fill(0).map(((r,o)=>i(e[o],n[t-1+o]))),...new Array(d-t).fill(0)],x=[...new Array(t+t-1).fill(0).map(((e,t)=>o(1,n[t]))),...new Array(d-(t+t-1)).fill(0)],b=g(y),v=g(x),w=new Array(d).fill(0).map(((e,t)=>i(b[t],v[t]))),N=c(l(h(l(w))),d),E=[];for(let e=t-1;e<t+t-1;e++)E.push(i(N[e],n[e]));return E}(e)}})),Tu="ifft",Du=he(Tu,["typed","fft","dotDivide","conj"],(e=>{let{typed:t,fft:r,dotDivide:n,conj:i}=e;return t(Tu,{"Array | Matrix":function(e){const t=E(e)?e.size():vn(e);return n(i(r(i(e))),t.reduce(((e,t)=>e*t),1))}})})),Bu=he("solveODE",["typed","add","subtract","multiply","divide","max","map","abs","isPositive","isNegative","larger","smaller","matrix","bignumber","unaryMinus"],(e=>{let{typed:t,add:r,subtract:n,multiply:i,divide:o,max:a,map:s,abs:u,isPositive:c,isNegative:l,larger:f,smaller:p,matrix:m,bignumber:h,unaryMinus:y}=e;function x(e){return function(t,m,d,x){if(2!==m.length||!m.every(E)&&!m.every(v))throw new Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');const b=m[0],w=m[1],N=f(w,b),A=x.firstStep;if(void 0!==A&&!c(A))throw new Error('"firstStep" must be positive');const S=x.maxStep;if(void 0!==S&&!c(S))throw new Error('"maxStep" must be positive');const M=x.minStep;if(M&&l(M))throw new Error('"minStep" must be positive or zero');const C=[b,w,A,M,S].filter((e=>void 0!==e));if(!C.every(E)&&!C.every(v))throw new Error('Inconsistent type of "t" dependant variables');const T=x.tol?x.tol:1e-4,D=x.minDelta?x.minDelta:.2,B=x.maxDelta?x.maxDelta:5,F=x.maxIter?x.maxIter:1e4,O=[b,w,...d,S,M].some(g),[_,I,z,k]=O?[h(e.a),h(e.c),h(e.b),h(e.bp)]:[e.a,e.c,e.b,e.bp];let R=A?N?A:y(A):o(n(w,b),1);const q=[b],P=[d],j=n(z,k);let U=0,L=0;const $=function(e){return e?p:f}(N),H=function(e){const t=e?f:p;return function(e,i,o){const a=r(e,o);return t(a,i)?n(i,e):o}}(N);for(;$(q[U],w);){const e=[];R=H(q[U],w,R),e.push(t(q[U],P[U]));for(let n=1;n<I.length;++n)e.push(t(r(q[U],i(I[n],R)),r(P[U],i(R,_[n],e))));const n=a(u(s(i(j,e),(e=>v(e)?e.value:e))));n<T&&T/n>1/4&&(q.push(r(q[U],R)),P.push(r(P[U],i(R,z,e))),U++);let o=.84*(T/n)**.2;if(p(o,D)?o=D:f(o,B)&&(o=B),o=O?h(o):o,R=i(R,o),S&&f(u(R),S)?R=N?S:y(S):M&&p(u(R),M)&&(R=N?M:y(M)),L++,L>F)throw new Error("Maximum number of iterations reached, try changing options")}return{t:q,y:P}}}function b(e,t,r,n){return x({a:[[],[.5],[0,3/4],[2/9,1/3,4/9]],c:[null,.5,3/4,1],b:[2/9,1/3,4/9,0],bp:[7/24,1/4,1/3,1/8]})(e,t,r,n)}function w(e,t,r,n){return x({a:[[],[.2],[3/40,9/40],[44/45,-56/15,32/9],[19372/6561,-25360/2187,64448/6561,-212/729],[9017/3168,-355/33,46732/5247,49/176,-5103/18656],[35/384,0,500/1113,125/192,-2187/6784,11/84]],c:[null,.2,.3,.8,8/9,1,1],b:[35/384,0,500/1113,125/192,-2187/6784,11/84,0],bp:[5179/57600,0,7571/16695,393/640,-92097/339200,187/2100,1/40]})(e,t,r,n)}function N(e,t,r,n){const i=n.method?n.method:"RK45",o={RK23:b,RK45:w};if(i.toUpperCase()in o){const a={...n};return delete a.method,o[i.toUpperCase()](e,t,r,a)}{const e=Object.keys(o).map((e=>`"${e}"`)),t=`${e.slice(0,-1).join(", ")} and ${e.slice(-1)}`;throw new Error(`Unavailable method "${i}". Available methods are ${t}`)}}function E(e){return g(e)||d(e)}function A(e,t,r,n){const i=N(e,t.toArray(),r.toArray(),n);return{t:m(i.t),y:m(i.y)}}return t("solveODE",{"function, Array, Array, Object":N,"function, Matrix, Matrix, Object":A,"function, Array, Array":(e,t,r)=>N(e,t,r,{}),"function, Matrix, Matrix":(e,t,r)=>A(e,t,r,{}),"function, Array, number | BigNumber | Unit":(e,t,r)=>{const n=N(e,t,[r],{});return{t:n.t,y:n.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit":(e,t,r)=>{const n=N(e,t.toArray(),[r],{});return{t:m(n.t),y:m(n.y.map((e=>e[0])))}},"function, Array, number | BigNumber | Unit, Object":(e,t,r,n)=>{const i=N(e,t,[r],n);return{t:i.t,y:i.y.map((e=>e[0]))}},"function, Matrix, number | BigNumber | Unit, Object":(e,t,r,n)=>{const i=N(e,t.toArray(),[r],n);return{t:m(i.t),y:m(i.y.map((e=>e[0])))}}})})),Fu=he("erf",["typed"],(e=>{let{typed:t}=e;return t("name",{number:function(e){const t=Math.abs(e);return t>=ku?be(e):t<=Ou?be(e)*function(e){const t=e*e;let r,n=Iu[0][4]*t,i=t;for(r=0;r<3;r+=1)n=(n+Iu[0][r])*t,i=(i+zu[0][r])*t;return e*(n+Iu[0][3])/(i+zu[0][3])}(t):t<=4?be(e)*(1-function(e){let t,r=Iu[1][8]*e,n=e;for(t=0;t<7;t+=1)r=(r+Iu[1][t])*e,n=(n+zu[1][t])*e;const i=(r+Iu[1][7])/(n+zu[1][7]),o=parseInt(16*e)/16,a=(e-o)*(e+o);return Math.exp(-o*o)*Math.exp(-a)*i}(t)):be(e)*(1-function(e){let t,r=1/(e*e),n=Iu[2][5]*r,i=r;for(t=0;t<4;t+=1)n=(n+Iu[2][t])*r,i=(i+zu[2][t])*r;let o=r*(n+Iu[2][4])/(i+zu[2][4]);o=(_u-o)/e,r=parseInt(16*e)/16;const a=(e-r)*(e+r);return Math.exp(-r*r)*Math.exp(-a)*o}(t))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Ou=.46875,_u=.5641895835477563,Iu=[[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]],zu=[[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),Ru="zeta",qu=he(Ru,["typed","config","multiply","pow","divide","factorial","equal","smallerEq","isNegative","gamma","sin","subtract","add","?Complex","?BigNumber","pi"],(e=>{let{typed:t,config:r,multiply:n,pow:i,divide:o,factorial:a,equal:s,smallerEq:u,isNegative:c,gamma:l,sin:f,subtract:p,add:m,Complex:h,BigNumber:d,pi:g}=e;return t(Ru,{number:e=>y(e,(e=>e),(()=>20)),BigNumber:e=>y(e,(e=>new d(e)),(()=>Math.abs(Math.log10(r.relTol)))),Complex:function(e){return 0===e.re&&0===e.im?new h(-.5):1===e.re?new h(NaN,NaN):e.re===1/0&&0===e.im?new h(1):e.im===1/0||e.re===-1/0?new h(NaN,NaN):x(e,(e=>e),(e=>Math.round(19.5+.9*Math.abs(e.im))),(e=>e.re))}});function y(e,t,r){return s(e,0)?t(-.5):s(e,1)?t(NaN):isFinite(e)?x(e,t,r,(e=>e)):c(e)?t(NaN):t(1)}function x(e,t,r,a){const s=r(e);if(a(e)>-(s-1)/2)return function(e,t,r){const a=o(1,n(b(r(0),t),p(1,i(2,p(1,e)))));let s=r(0);for(let a=r(1);u(a,t);a=m(a,1))s=m(s,o(n((-1)**(a-1),b(a,t)),i(a,e)));return n(a,s)}(e,t(s),t);{let s=n(i(2,e),i(t(g),p(e,1)));return s=n(s,f(n(o(t(g),2),e))),s=n(s,l(p(1,e))),n(s,x(p(1,e),t,r,a))}}function b(e,t){let r=e;for(let s=e;u(s,t);s=m(s,1)){const e=o(n(a(m(t,p(s,1))),i(4,s)),n(a(p(t,s)),a(n(2,s))));r=m(r,e)}return n(t,r)}})),Pu="mode",ju=he(Pu,["typed","isNaN","isNumeric"],(e=>{let{typed:t,isNaN:r,isNumeric:n}=e;return t(Pu,{"Array | Matrix":i,"...":function(e){return i(e)}});function i(e){if(0===(e=zn(e.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");const t={};let i=[],o=0;for(let a=0;a<e.length;a++){const s=e[a];if(n(s)&&r(s))throw new Error("Cannot calculate mode of an array containing NaN values");s in t||(t[s]=0),t[s]++,t[s]===o?i.push(s):t[s]>o&&(o=t[s],i=[s])}return i}}));function Uu(e,t,r){let n;return String(e).includes("Unexpected type")?(n=arguments.length>2?" (type: "+oe(r)+", value: "+JSON.stringify(r)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+n)):String(e).includes("complex numbers")?(n=arguments.length>2?" (type: "+oe(r)+", value: "+JSON.stringify(r)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+n)):e}const Lu="prod",$u=he(Lu,["typed","config","multiplyScalar","numeric"],(e=>{let{typed:t,config:r,multiplyScalar:n,numeric:i}=e;return t(Lu,{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(e){return o(e)}});function o(e){let t;if(ni(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Uu(t,"prod",e)}})),"string"==typeof t&&(t=i(t,xe(t,r))),void 0===t)throw new Error("Cannot calculate prod of an empty array");return t}})),Hu="format",Gu=he(Hu,["typed"],(e=>{let{typed:t}=e;return t(Hu,{any:pn,"any, Object | function | number | BigNumber":pn})})),Vu=he("bin",["typed","format"],(e=>{let{typed:t,format:r}=e;return t("bin",{"number | BigNumber":function(e){return r(e,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"bin",wordSize:t})}})})),Wu=he("oct",["typed","format"],(e=>{let{typed:t,format:r}=e;return t("oct",{"number | BigNumber":function(e){return r(e,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"oct",wordSize:t})}})})),Zu=he("hex",["typed","format"],(e=>{let{typed:t,format:r}=e;return t("hex",{"number | BigNumber":function(e){return r(e,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(e,t){return r(e,{notation:"hex",wordSize:t})}})})),Yu=/\$([\w.]+)/g,Ju="print",Xu=he(Ju,["typed"],(e=>{let{typed:t}=e;return t(Ju,{"string, Object | Array":Qu,"string, Object | Array, number | Object":Qu})}));function Qu(e,t,r){return e.replace(Yu,(function(e,n){const i=n.split(".");let o=t[i.shift()];for(void 0!==o&&o.isMatrix&&(o=o.toArray());i.length&&void 0!==o;){const e=i.shift();o=e?o[e]:o+"."}return void 0!==o?w(o)?o:pn(o,r):e}))}const Ku=he("to",["typed","matrix","concat"],(e=>{let{typed:t,matrix:r,concat:n}=e;return t("to",{"Unit, Unit | string":(e,t)=>e.to(t)},oa({typed:t,matrix:r,concat:n})({Ds:!0}))})),ec="isPrime",tc=he(ec,["typed"],(e=>{let{typed:t}=e;return t(ec,{number:function(e){if(e<=3)return e>1;if(e%2==0||e%3==0)return!1;for(let t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0},bigint:function(e){if(e<=3n)return e>1n;if(e%2n===0n||e%3n===0n)return!1;for(let t=5n;t*t<=e;t+=6n)if(e%t===0n||e%(t+2n)===0n)return!1;return!0},BigNumber:function(e){if(e.lte(3))return e.gt(1);if(e.mod(2).eq(0)||e.mod(3).eq(0))return!1;if(e.lt(Math.pow(2,32))){const t=e.toNumber();for(let e=5;e*e<=t;e+=6)if(t%e==0||t%(e+2)==0)return!1;return!0}function t(e,t,r){let n=1;for(;!t.eq(0);)t.mod(2).eq(0)?(t=t.div(2),e=e.mul(e).mod(r)):(t=t.sub(1),n=e.mul(n).mod(r));return n}const r=e.constructor.clone({precision:2*e.toFixed(0).length});let n=0,i=(e=new r(e)).sub(1);for(;i.mod(2).eq(0);)i=i.div(2),n+=1;let o=null;if(e.lt("3317044064679887385961981"))o=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter((t=>t<e));else{const t=Math.min(e.toNumber()-2,Math.floor(2*Math.pow(e.toFixed(0).length*Math.log(10),2)));o=[];for(let e=2;e<=t;e+=1)o.push(t)}for(let r=0;r<o.length;r+=1){const a=o[r],s=t(e.sub(e).add(a),i,e);if(!s.eq(1))for(let t=0,r=s;!r.eq(e.sub(1));t+=1,r=r.mul(r).mod(e))if(t===n-1)return!1}return!0},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),rc=he("numeric",["number","?bignumber","?fraction"],(e=>{let{number:t,bignumber:r,fraction:n}=e;const i={string:!0,number:!0,BigNumber:!0,Fraction:!0},o={number:e=>t(e),BigNumber:r?e=>r(e):Qs,bigint:e=>BigInt(e),Fraction:n?e=>n(e):Ks};return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number";if(void 0!==(arguments.length>2?arguments[2]:void 0))throw new SyntaxError("numeric() takes one or two arguments");const r=oe(e);if(!(r in i))throw new TypeError("Cannot convert "+e+' of type "'+r+'"; valid input types are '+Object.keys(i).join(", "));if(!(t in o))throw new TypeError("Cannot convert "+e+' to type "'+t+'"; valid output types are '+Object.keys(o).join(", "));return t===r?e:o[t](e)}})),nc="divideScalar",ic=he(nc,["typed","numeric"],(e=>{let{typed:t,numeric:r}=e;return t(nc,{"number, number":function(e,t){return e/t},"Complex, Complex":function(e,t){return e.div(t)},"BigNumber, BigNumber":function(e,t){return e.div(t)},"bigint, bigint":function(e,t){return e/t},"Fraction, Fraction":function(e,t){return e.div(t)},"Unit, number | Complex | Fraction | BigNumber | Unit":(e,t)=>e.divide(t),"number | Fraction | Complex | BigNumber, Unit":(e,t)=>t.divideInto(e)})})),oc=he("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],(e=>{let{typed:t,config:r,identity:n,multiply:i,matrix:o,inv:a,number:s,fraction:u,Complex:c}=e;return t("pow",{"number, number":l,"Complex, Complex":function(e,t){return e.pow(t)},"BigNumber, BigNumber":function(e,t){return t.isInteger()||e>=0||r.predictable?e.pow(t):new c(e.toNumber(),0).pow(t.toNumber(),0)},"bigint, bigint":(e,t)=>e**t,"Fraction, Fraction":function(e,t){const n=e.pow(t);if(null!=n)return n;if(r.predictable)throw new Error("Result of pow is non-rational and cannot be expressed as a fraction");return l(e.valueOf(),t.valueOf())},"Array, number":f,"Array, BigNumber":function(e,t){return f(e,t.toNumber())},"Matrix, number":p,"Matrix, BigNumber":function(e,t){return p(e,t.toNumber())},"Unit, number | BigNumber":function(e,t){return e.pow(t)}});function l(e,t){if(r.predictable&&!ye(t)&&e<0)try{const r=u(t),n=s(r);if((t===n||Math.abs((t-n)/t)<1e-14)&&r.d%2n===1n)return(r.n%2n===0n?1:-1)*Math.pow(-e,t)}catch(e){}return r.predictable&&(e<-1&&t===1/0||e>-1&&e<0&&t===-1/0)?NaN:ye(t)||e>=0||r.predictable?xo(e,t):e*e<1&&t===1/0||e*e>1&&t===-1/0?0:new c(e,0).pow(t,0)}function f(e,t){if(!ye(t))throw new TypeError("For A^b, b must be an integer (value is "+t+")");const r=vn(e);if(2!==r.length)throw new Error("For A^b, A must be 2 dimensional (A has "+r.length+" dimensions)");if(r[0]!==r[1])throw new Error("For A^b, A must be square (size is "+r[0]+"x"+r[1]+")");if(t<0)try{return f(a(e),-t)}catch(e){if("Cannot calculate inverse, determinant is zero"===e.message)throw new TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+t+")");throw e}let o=n(r[0]).valueOf(),s=e;for(;t>=1;)1&~t||(o=i(s,o)),t>>=1,s=i(s,s);return o}function p(e,t){return o(f(e.valueOf(),t))}})),ac="Number of decimals in function round must be an integer",sc="round",uc=he(sc,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],(e=>{let{typed:t,config:r,matrix:n,equalScalar:i,zeros:o,BigNumber:a,DenseMatrix:s}=e;const u=Io({typed:t,equalScalar:i}),c=zo({typed:t,DenseMatrix:s}),l=ko({typed:t});function f(e){return Math.abs(Te(e).exponent)}return t(sc,{number:function(e){const t=bo(e,f(r.relTol));return bo(_e(e,t,r.relTol,r.absTol)?t:e)},"number, number":function(e,t){const n=f(r.relTol);if(t>=n)return bo(e,t);const i=bo(e,n);return bo(_e(e,i,r.relTol,r.absTol)?i:e,t)},"number, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ac);return new a(e).toDecimalPlaces(t.toNumber())},Complex:function(e){return e.round()},"Complex, number":function(e,t){if(t%1)throw new TypeError(ac);return e.round(t)},"Complex, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ac);const r=t.toNumber();return e.round(r)},BigNumber:function(e){const t=new a(e).toDecimalPlaces(f(r.relTol));return(hi(e,t,r.relTol,r.absTol)?t:e).toDecimalPlaces(0)},"BigNumber, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ac);const n=f(r.relTol);if(t>=n)return e.toDecimalPlaces(t.toNumber());const i=e.toDecimalPlaces(n);return(hi(e,i,r.relTol,r.absTol)?i:e).toDecimalPlaces(t.toNumber())},Fraction:function(e){return e.round()},"Fraction, number":function(e,t){if(t%1)throw new TypeError(ac);return e.round(t)},"Fraction, BigNumber":function(e,t){if(!t.isInteger())throw new TypeError(ac);return e.round(t.toNumber())},"Unit, number, Unit":t.referToSelf((e=>function(t,r,n){const i=t.toNumeric(n);return n.multiply(e(i,r))})),"Unit, BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>e(t,r.toNumber(),n))),"Array | Matrix, number | BigNumber, Unit":t.referToSelf((e=>(t,r,n)=>ii(t,(t=>e(t,r,n)),!0))),"Array | Matrix | Unit, Unit":t.referToSelf((e=>(t,r)=>e(t,0,r))),"Array | Matrix":t.referToSelf((e=>t=>ii(t,e,!0))),"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>u(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>l(t,r,e,!1))),"Array, number | BigNumber":t.referToSelf((e=>(t,r)=>l(n(t),r,e,!1).valueOf())),"number | Complex | BigNumber | Fraction, SparseMatrix":t.referToSelf((e=>(t,r)=>i(t,0)?o(r.size(),r.storage()):c(r,t,e,!0))),"number | Complex | BigNumber | Fraction, DenseMatrix":t.referToSelf((e=>(t,r)=>i(t,0)?o(r.size(),r.storage()):l(r,t,e,!0))),"number | Complex | BigNumber | Fraction, Array":t.referToSelf((e=>(t,r)=>l(n(r),t,e,!0).valueOf()))})})),cc=he("log",["config","typed","typeOf","divideScalar","Complex"],(e=>{let{typed:t,typeOf:r,config:n,divideScalar:i,Complex:o}=e;return t("log",{number:function(e){return e>=0||n.predictable?function(e){return Math.log(e)}(e):new o(e,0).log()},Complex:function(e){return e.log()},BigNumber:function(e){return!e.isNegative()||n.predictable?e.ln():new o(e.toNumber(),0).log()},"any, any":t.referToSelf((e=>(t,n)=>{if("Fraction"===r(t)&&"Fraction"===r(n)){const e=t.log(n);if(null!==e)return e}return i(e(t),e(n))}))})})),lc="log1p",fc=he(lc,["typed","config","divideScalar","log","Complex"],(e=>{let{typed:t,config:r,divideScalar:n,log:i,Complex:o}=e;return t(lc,{number:function(e){return e>=-1||r.predictable?Ne(e):a(new o(e,0))},Complex:a,BigNumber:function(e){const t=e.plus(1);return!t.isNegative()||r.predictable?t.ln():a(new o(e.toNumber(),0))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e))),"any, any":t.referToSelf((e=>(t,r)=>n(e(t),i(r))))});function a(e){const t=e.re+1;return new o(Math.log(Math.sqrt(t*t+e.im*e.im)),Math.atan2(e.im,t))}})),pc="nthRoots",mc=he(pc,["config","typed","divideScalar","Complex"],(e=>{let{typed:t,config:r,divideScalar:n,Complex:i}=e;const o=[function(e){return new i(e,0)},function(e){return new i(0,e)},function(e){return new i(-e,0)},function(e){return new i(0,-e)}];function a(e,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===e||0===e.abs())return[new i(0,0)];const r="number"==typeof e;let n;(r||0===e.re||0===e.im)&&(n=r?2*+(e<0):0===e.im?2*+(e.re<0):2*+(e.im<0)+1);const a=e.arg(),s=e.abs(),u=[],c=Math.pow(s,1/t);for(let e=0;e<t;e++){const r=(n+4*e)/t;r!==Math.round(r)?u.push(new i({r:c,phi:(a+2*Math.PI*e)/t})):u.push(o[r%4](c))}return u}return t(pc,{Complex:function(e){return a(e,2)},"Complex, number":a})})),hc="dotPow",dc=he(hc,["typed","equalScalar","matrix","pow","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,equalScalar:r,matrix:n,pow:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ta({typed:t}),c=us({typed:t,SparseMatrix:s}),l=Io({typed:t,equalScalar:r}),f=zo({typed:t,DenseMatrix:o}),p=oa({typed:t,matrix:n,concat:a}),m={};for(const e in i.signatures)Object.prototype.hasOwnProperty.call(i.signatures,e)&&(e.includes("Matrix")||e.includes("Array")||(m[e]=i.signatures[e]));const h=t(m);return t(hc,p({elop:h,SS:c,DS:u,Ss:l,sS:f}))})),gc="dotDivide",yc=he(gc,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:r,equalScalar:n,divideScalar:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ea({typed:t,equalScalar:n}),c=ta({typed:t}),l=us({typed:t,SparseMatrix:s}),f=Io({typed:t,equalScalar:n}),p=zo({typed:t,DenseMatrix:o}),m=oa({typed:t,matrix:r,concat:a});return t(gc,m({elop:i,SS:l,DS:c,SD:u,Ss:f,sS:p}))}));function xc(e){let{DenseMatrix:t}=e;return function(e,r,n){const i=e.size();if(2!==i.length)throw new RangeError("Matrix must be two dimensional (size: "+pn(i)+")");const o=i[0];if(o!==i[1])throw new RangeError("Matrix must be square (size: "+pn(i)+")");let a=[];if(E(r)){const e=r.size(),i=r._data;if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[i[e]];return new t({data:a,size:[o,1],datatype:r._datatype})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(S(r)){if(n){a=[];for(let e=0;e<o;e++)a[e]=[i[e][0]];return new t({data:a,size:[o,1],datatype:r._datatype})}return r}if(M(r)){for(let e=0;e<o;e++)a[e]=[0];const e=r._values,n=r._index,i=r._ptr;for(let t=i[1],r=i[0];r<t;r++)a[n[r]][0]=e[r];return new t({data:a,size:[o,1],datatype:r._datatype})}}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(N(r)){const e=vn(r);if(1===e.length){if(e[0]!==o)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[r[e]];return new t({data:a,size:[o,1]})}if(2===e.length){if(e[0]!==o||1!==e[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(let e=0;e<o;e++)a[e]=[r[e][0]];return new t({data:a,size:[o,1]})}throw new RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}const bc="lsolve",vc=he(bc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=xc({DenseMatrix:s});return t(bc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=0;e<l;e++){const t=r[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e],d=m[e+1];for(let t=l;t<d;t++){const r=p[t];r===e?s=f[t]:r>e&&(u.push(f[t]),c.push(r))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const g=n(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];r[t]=[o(r[t][0]||0,i(g,u[e]))]}h[e]=[g]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).valueOf()}});function c(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=0;e<l;e++){const t=r[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=n(t,u);for(let t=e+1;t<c;t++)r[t]=[o(r[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),wc="usolve",Nc=he(wc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=xc({DenseMatrix:s});return t(wc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr,h=[];for(let e=l-1;e>=0;e--){const t=r[e][0]||0;if(a(t,0))h[e]=[0];else{let s=0;const u=[],c=[],l=m[e];for(let t=m[e+1]-1;t>=l;t--){const r=p[t];r===e?s=f[t]:r<e&&(u.push(f[t]),c.push(r))}if(a(s,0))throw new Error("Linear system cannot be solved since matrix is singular");const d=n(t,s);for(let e=0,t=c.length;e<t;e++){const t=c[e];r[t]=[o(r[t][0],i(d,u[e]))]}h[e]=[d]}}return new s({data:h,size:[c,1]})}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).valueOf()}});function c(e,t){const r=(t=u(e,t,!0))._data,c=e._size[0],l=e._size[1],f=[],p=e._data;for(let e=l-1;e>=0;e--){const t=r[e][0]||0;let s;if(a(t,0))s=0;else{const u=p[e][e];if(a(u,0))throw new Error("Linear system cannot be solved since matrix is singular");s=n(t,u);for(let t=e-1;t>=0;t--)r[t]=[o(r[t][0]||0,i(s,p[t][e]))]}f[e]=[s]}return new s({data:f,size:[c,1]})}})),Ec="lsolveAll",Ac=he(Ec,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=xc({DenseMatrix:s});return t(Ec,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=0;e<l;e++){let t=r.length;for(let s=0;s<t;s++){const u=r[s],c=[],l=[],h=m[e],d=m[e+1];let g=0;for(let t=h;t<d;t++){const r=p[t];r===e?g=f[t]:r>e&&(c.push(f[t]),l.push(r))}if(a(g,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,r=l.length;e<r;e++){const r=l[e];t[r]=o(t[r],c[e])}r.push(t)}}else{if(0===s)return[];r.splice(s,1),s-=1,t-=1}else{u[e]=n(u[e],g);for(let t=0,r=l.length;t<r;t++){const r=l[t];u[r]=o(u[r],i(u[e],c[t]))}}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).map((e=>e.valueOf()))}});function c(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0],f=e._size[1];for(let e=0;e<f;e++){let t=r.length;for(let s=0;s<t;s++){const u=r[s];if(a(c[e][e],0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let r=e+1;r<f;r++)t[r]=o(t[r],c[r][e]);r.push(t)}}else{if(0===s)return[];r.splice(s,1),s-=1,t-=1}else{u[e]=n(u[e],c[e][e]);for(let t=e+1;t<f;t++)u[t]=o(u[t],i(u[e],c[t][e]))}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),Sc="usolveAll",Mc=he(Sc,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],(e=>{let{typed:t,matrix:r,divideScalar:n,multiplyScalar:i,subtractScalar:o,equalScalar:a,DenseMatrix:s}=e;const u=xc({DenseMatrix:s});return t(Sc,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._size[0],l=e._size[1],f=e._values,p=e._index,m=e._ptr;for(let e=l-1;e>=0;e--){let t=r.length;for(let s=0;s<t;s++){const u=r[s],c=[],l=[],h=m[e];let d=0;for(let t=m[e+1]-1;t>=h;t--){const r=p[t];r===e?d=f[t]:r<e&&(c.push(f[t]),l.push(r))}if(a(d,0))if(a(u[e],0)){if(0===s){const t=[...u];t[e]=1;for(let e=0,r=l.length;e<r;e++){const r=l[e];t[r]=o(t[r],c[e])}r.push(t)}}else{if(0===s)return[];r.splice(s,1),s-=1,t-=1}else{u[e]=n(u[e],d);for(let t=0,r=l.length;t<r;t++){const r=l[t];u[r]=o(u[r],i(u[e],c[t]))}}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[c,1]})))}(e,t)},"DenseMatrix, Array | Matrix":function(e,t){return c(e,t)},"Array, Array | Matrix":function(e,t){return c(r(e),t).map((e=>e.valueOf()))}});function c(e,t){const r=[u(e,t,!0)._data.map((e=>e[0]))],c=e._data,l=e._size[0];for(let t=e._size[1]-1;t>=0;t--){let e=r.length;for(let s=0;s<e;s++){const u=r[s];if(a(c[t][t],0))if(a(u[t],0)){if(0===s){const e=[...u];e[t]=1;for(let r=t-1;r>=0;r--)e[r]=o(e[r],c[r][t]);r.push(e)}}else{if(0===s)return[];r.splice(s,1),s-=1,e-=1}else{u[t]=n(u[t],c[t][t]);for(let e=t-1;e>=0;e--)u[e]=o(u[e],i(u[t],c[e][t]))}}}return r.map((e=>new s({data:e.map((e=>[e])),size:[l,1]})))}})),Cc=he("matAlgo08xS0Sid",["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return function(e,n,i){const o=e._values,a=e._index,s=e._ptr,u=e._size,c=e._datatype||void 0===e._data?e._datatype:e.getDataType(),l=n._values,f=n._index,p=n._ptr,m=n._size,h=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(u.length!==m.length)throw new xn(u.length,m.length);if(u[0]!==m[0]||u[1]!==m[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+m+")");if(!o||!l)throw new Error("Cannot perform operation on Pattern Sparse Matrices");const d=u[0],g=u[1];let y,x=r,b=0,v=i;"string"==typeof c&&c===h&&"mixed"!==c&&(y=c,x=t.find(r,[y,y]),b=t.convert(0,y),v=t.find(i,[y,y]));const w=[],N=[],E=[],A=[],S=[];let M,C,T,D;for(let e=0;e<g;e++){E[e]=N.length;const t=e+1;for(C=s[e],T=s[e+1],M=C;M<T;M++)D=a[M],S[D]=t,A[D]=o[M],N.push(D);for(C=p[e],T=p[e+1],M=C;M<T;M++)D=f[M],S[D]===t&&(A[D]=v(A[D],l[M]));for(M=E[e];M<N.length;){D=N[M];const e=A[D];x(e,b)?N.splice(M,1):(w.push(e),M++)}}return E[g]=N.length,e.createSparseMatrix({values:w,index:N,ptr:E,size:[d,g],datatype:c===e._datatype&&h===n._datatype?y:void 0})}})),Tc=he("useMatrixForArrayScalar",["typed","matrix"],(e=>{let{typed:t,matrix:r}=e;return{"Array, number":t.referTo("DenseMatrix, number",(e=>(t,n)=>e(r(t),n).valueOf())),"Array, BigNumber":t.referTo("DenseMatrix, BigNumber",(e=>(t,n)=>e(r(t),n).valueOf())),"number, Array":t.referTo("number, DenseMatrix",(e=>(t,n)=>e(t,r(n)).valueOf())),"BigNumber, Array":t.referTo("BigNumber, DenseMatrix",(e=>(t,n)=>e(t,r(n)).valueOf()))}})),Dc="leftShift",Bc=he(Dc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:o,concat:a}=e;const s=sa({typed:t}),u=ea({typed:t,equalScalar:n}),c=Cc({typed:t,equalScalar:n}),l=ca({typed:t,DenseMatrix:o}),f=Io({typed:t,equalScalar:n}),p=ko({typed:t}),m=oa({typed:t,matrix:r,concat:a}),h=Tc({typed:t,matrix:r});return t(Dc,{"number, number":Ka,"BigNumber, BigNumber":Va,"bigint, bigint":(e,t)=>e<<t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():f(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():p(t,r,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):l(r,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):p(r,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),Fc="rightArithShift",Oc=he(Fc,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:o,concat:a}=e;const s=sa({typed:t}),u=ea({typed:t,equalScalar:n}),c=Cc({typed:t,equalScalar:n}),l=ca({typed:t,DenseMatrix:o}),f=Io({typed:t,equalScalar:n}),p=ko({typed:t}),m=oa({typed:t,matrix:r,concat:a}),h=Tc({typed:t,matrix:r});return t(Fc,{"number, number":es,"BigNumber, BigNumber":Wa,"bigint, bigint":(e,t)=>e>>t,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():f(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():p(t,r,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):l(r,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):p(r,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),_c="rightLogShift",Ic=he(_c,["typed","matrix","equalScalar","zeros","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,DenseMatrix:o,concat:a}=e;const s=sa({typed:t}),u=ea({typed:t,equalScalar:n}),c=Cc({typed:t,equalScalar:n}),l=ca({typed:t,DenseMatrix:o}),f=Io({typed:t,equalScalar:n}),p=ko({typed:t}),m=oa({typed:t,matrix:r,concat:a}),h=Tc({typed:t,matrix:r});return t(_c,{"number, number":ts,"SparseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():f(t,r,e,!1))),"DenseMatrix, number | BigNumber":t.referToSelf((e=>(t,r)=>n(r,0)?t.clone():p(t,r,e,!1))),"number | BigNumber, SparseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):l(r,t,e,!0))),"number | BigNumber, DenseMatrix":t.referToSelf((e=>(t,r)=>n(t,0)?i(r.size(),r.storage()):p(r,t,e,!0)))},h,m({SS:c,DS:s,SD:u}))})),zc=he("and",["typed","matrix","equalScalar","zeros","not","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a}=e;const s=ea({typed:t,equalScalar:n}),u=da({typed:t,equalScalar:n}),c=Io({typed:t,equalScalar:n}),l=ko({typed:t}),f=oa({typed:t,matrix:r,concat:a});return t("and",{"number, number":vs,"Complex, Complex":function(e,t){return!(0===e.re&&0===e.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(e,t){return!(e.isZero()||t.isZero()||e.isNaN()||t.isNaN())},"bigint, bigint":vs,"Unit, Unit":t.referToSelf((e=>(t,r)=>e(t.value||0,r.value||0))),"SparseMatrix, any":t.referToSelf((e=>(t,r)=>o(r)?i(t.size(),t.storage()):c(t,r,e,!1))),"DenseMatrix, any":t.referToSelf((e=>(t,r)=>o(r)?i(t.size(),t.storage()):l(t,r,e,!1))),"any, SparseMatrix":t.referToSelf((e=>(t,r)=>o(t)?i(t.size(),t.storage()):c(r,t,e,!0))),"any, DenseMatrix":t.referToSelf((e=>(t,r)=>o(t)?i(t.size(),t.storage()):l(r,t,e,!0))),"Array, any":t.referToSelf((e=>(t,n)=>e(r(t),n).valueOf())),"any, Array":t.referToSelf((e=>(t,n)=>e(t,r(n)).valueOf()))},f({SS:u,DS:s}))})),kc="compare",Rc=he(kc,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],(e=>{let{typed:t,config:r,equalScalar:n,matrix:i,BigNumber:o,Fraction:a,DenseMatrix:s,concat:u}=e;const c=ta({typed:t}),l=ra({typed:t,equalScalar:n}),f=zo({typed:t,DenseMatrix:s}),p=oa({typed:t,matrix:i,concat:u}),m=Di({typed:t});return t(kc,qc({typed:t,config:r}),{"boolean, boolean":function(e,t){return e===t?0:e>t?1:-1},"BigNumber, BigNumber":function(e,t){return hi(e,t,r.relTol,r.absTol)?new o(0):new o(e.cmp(t))},"bigint, bigint":function(e,t){return e===t?0n:e>t?1n:-1n},"Fraction, Fraction":function(e,t){return new a(e.compare(t))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},m,p({SS:l,DS:c,Ss:f}))})),qc=he(kc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(kc,{"number, number":function(e,t){return _e(e,t,r.relTol,r.absTol)?0:e>t?1:-1}})}));var Pc=r(1880);const jc="compareNatural",Uc=he(jc,["typed","compare"],(e=>{let{typed:t,compare:r}=e;const n=r.signatures["boolean,boolean"];return t(jc,{"any, any":function e(t,a){const s=oe(t),u=oe(a);let c;if(!("number"!==s&&"BigNumber"!==s&&"Fraction"!==s||"number"!==u&&"BigNumber"!==u&&"Fraction"!==u))return c=r(t,a),"0"!==c.toString()?c>0?1:-1:Pc(s,u);const l=["Array","DenseMatrix","SparseMatrix"];if(l.includes(s)||l.includes(u))return c=i(e,t,a),0!==c?c:Pc(s,u);if(s!==u)return Pc(s,u);if("Complex"===s)return function(e,t){return e.re>t.re?1:e.re<t.re?-1:e.im>t.im?1:e.im<t.im?-1:0}(t,a);if("Unit"===s)return t.equalBase(a)?e(t.value,a.value):o(e,t.formatUnits(),a.formatUnits());if("boolean"===s)return n(t,a);if("string"===s)return Pc(t,a);if("Object"===s)return function(e,t,r){const n=Object.keys(t),i=Object.keys(r);n.sort(Pc),i.sort(Pc);const a=o(e,n,i);if(0!==a)return a;for(let o=0;o<n.length;o++){const a=e(t[n[o]],r[i[o]]);if(0!==a)return a}return 0}(e,t,a);if("null"===s)return 0;if("undefined"===s)return 0;throw new TypeError('Unsupported type of value "'+s+'"')}});function i(e,t,r){return M(t)&&M(r)?o(e,t.toJSON().values,r.toJSON().values):M(t)?i(e,t.toArray(),r):M(r)?i(e,t,r.toArray()):S(t)?i(e,t.toJSON().data,r):S(r)?i(e,t,r.toJSON().data):Array.isArray(t)?Array.isArray(r)?o(e,t,r):i(e,t,[r]):i(e,[t],r)}function o(e,t,r){for(let n=0,i=Math.min(t.length,r.length);n<i;n++){const i=e(t[n],r[n]);if(0!==i)return i}return t.length>r.length?1:t.length<r.length?-1:0}})),Lc="compareText",$c=["typed","matrix","concat"];yn.signature="any, any";const Hc=he(Lc,$c,(e=>{let{typed:t,matrix:r,concat:n}=e;const i=oa({typed:t,matrix:r,concat:n});return t(Lc,yn,i({elop:yn,Ds:!0}))})),Gc="equal",Vc=he(Gc,["typed","matrix","equalScalar","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ta({typed:t}),u=us({typed:t,SparseMatrix:a}),c=zo({typed:t,DenseMatrix:i}),l=oa({typed:t,matrix:r,concat:o});return t(Gc,Wc({typed:t,equalScalar:n}),l({elop:n,SS:u,DS:s,Ss:c}))})),Wc=he(Gc,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return t(Gc,{"any, any":function(e,t){return null===e?null===t:null===t?null===e:void 0===e?void 0===t:void 0===t?void 0===e:r(e,t)}})})),Zc="equalText",Yc=he(Zc,["typed","compareText","isZero"],(e=>{let{typed:t,compareText:r,isZero:n}=e;return t(Zc,{"any, any":function(e,t){return n(r(e,t))}})})),Jc="smaller",Xc=he(Jc,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ta({typed:t}),u=us({typed:t,SparseMatrix:a}),c=zo({typed:t,DenseMatrix:i}),l=oa({typed:t,matrix:n,concat:o}),f=Di({typed:t});return t(Jc,Qc({typed:t,config:r}),{"boolean, boolean":(e,t)=>e<t,"BigNumber, BigNumber":function(e,t){return e.lt(t)&&!hi(e,t,r.relTol,r.absTol)},"bigint, bigint":(e,t)=>e<t,"Fraction, Fraction":(e,t)=>-1===e.compare(t),"Complex, Complex":function(e,t){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),Qc=he(Jc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Jc,{"number, number":function(e,t){return e<t&&!_e(e,t,r.relTol,r.absTol)}})})),Kc="smallerEq",el=he(Kc,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ta({typed:t}),u=us({typed:t,SparseMatrix:a}),c=zo({typed:t,DenseMatrix:i}),l=oa({typed:t,matrix:n,concat:o}),f=Di({typed:t});return t(Kc,tl({typed:t,config:r}),{"boolean, boolean":(e,t)=>e<=t,"BigNumber, BigNumber":function(e,t){return e.lte(t)||hi(e,t,r.relTol,r.absTol)},"bigint, bigint":(e,t)=>e<=t,"Fraction, Fraction":(e,t)=>1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),tl=he(Kc,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(Kc,{"number, number":function(e,t){return e<=t||_e(e,t,r.relTol,r.absTol)}})})),rl="larger",nl=he(rl,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ta({typed:t}),u=us({typed:t,SparseMatrix:a}),c=zo({typed:t,DenseMatrix:i}),l=oa({typed:t,matrix:n,concat:o}),f=Di({typed:t});return t(rl,il({typed:t,config:r}),{"boolean, boolean":(e,t)=>e>t,"BigNumber, BigNumber":function(e,t){return e.gt(t)&&!hi(e,t,r.relTol,r.absTol)},"bigint, bigint":(e,t)=>e>t,"Fraction, Fraction":(e,t)=>1===e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),il=he(rl,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(rl,{"number, number":function(e,t){return e>t&&!_e(e,t,r.relTol,r.absTol)}})})),ol="largerEq",al=he(ol,["typed","config","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:r,matrix:n,DenseMatrix:i,concat:o,SparseMatrix:a}=e;const s=ta({typed:t}),u=us({typed:t,SparseMatrix:a}),c=zo({typed:t,DenseMatrix:i}),l=oa({typed:t,matrix:n,concat:o}),f=Di({typed:t});return t(ol,sl({typed:t,config:r}),{"boolean, boolean":(e,t)=>e>=t,"BigNumber, BigNumber":function(e,t){return e.gte(t)||hi(e,t,r.relTol,r.absTol)},"bigint, bigint":function(e,t){return e>=t},"Fraction, Fraction":(e,t)=>-1!==e.compare(t),"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")}},f,l({SS:u,DS:s,Ss:c}))})),sl=he(ol,["typed","config"],(e=>{let{typed:t,config:r}=e;return t(ol,{"number, number":function(e,t){return e>=t||_e(e,t,r.relTol,r.absTol)}})})),ul="deepEqual",cl=he(ul,["typed","equal"],(e=>{let{typed:t,equal:r}=e;return t(ul,{"any, any":function(e,t){return n(e.valueOf(),t.valueOf())}});function n(e,t){if(Array.isArray(e)){if(Array.isArray(t)){const r=e.length;if(r!==t.length)return!1;for(let i=0;i<r;i++)if(!n(e[i],t[i]))return!1;return!0}return!1}return!Array.isArray(t)&&r(e,t)}})),ll="unequal",fl=he(ll,["typed","config","equalScalar","matrix","DenseMatrix","concat","SparseMatrix"],(e=>{let{typed:t,config:r,equalScalar:n,matrix:i,DenseMatrix:o,concat:a,SparseMatrix:s}=e;const u=ta({typed:t}),c=us({typed:t,SparseMatrix:s}),l=zo({typed:t,DenseMatrix:o}),f=oa({typed:t,matrix:i,concat:a});return t(ll,pl({typed:t,equalScalar:n}),f({elop:function(e,t){return!n(e,t)},SS:c,DS:u,Ss:l}))})),pl=he(ll,["typed","equalScalar"],(e=>{let{typed:t,equalScalar:r}=e;return t(ll,{"any, any":function(e,t){return null===e?null!==t:null===t?null!==e:void 0===e?void 0!==t:void 0===t?void 0!==e:!r(e,t)}})})),ml="partitionSelect",hl=he(ml,["typed","isNumeric","isNaN","compare"],(e=>{let{typed:t,isNumeric:r,isNaN:n,compare:i}=e;const o=i,a=(e,t)=>-i(e,t);return t(ml,{"Array | Matrix, number":function(e,t){return s(e,t,o)},"Array | Matrix, number, string":function(e,t,r){if("asc"===r)return s(e,t,o);if("desc"===r)return s(e,t,a);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":s});function s(e,t,r){if(!ye(t)||t<0)throw new Error("k must be a non-negative integer");if(E(e)){if(e.size().length>1)throw new Error("Only one dimensional matrices supported");return u(e.valueOf(),t,r)}if(Array.isArray(e))return u(e,t,r)}function u(e,t,i){if(t>=e.length)throw new Error("k out of bounds");for(let t=0;t<e.length;t++)if(r(e[t])&&n(e[t]))return e[t];let o=0,a=e.length-1;for(;o<a;){let r=o,n=a;const s=e[Math.floor(Math.random()*(a-o+1))+o];for(;r<n;)if(i(e[r],s)>=0){const t=e[n];e[n]=e[r],e[r]=t,--n}else++r;i(e[r],s)>0&&--r,t<=r?a=r:o=r+1}return e[t]}})),dl="sort",gl=he(dl,["typed","matrix","compare","compareNatural"],(e=>{let{typed:t,matrix:r,compare:n,compareNatural:i}=e;const o=n,a=(e,t)=>-n(e,t);return t(dl,{Array:function(e){return u(e),e.sort(o)},Matrix:function(e){return c(e),r(e.toArray().sort(o),e.storage())},"Array, function":function(e,t){return u(e),e.sort(t)},"Matrix, function":function(e,t){return c(e),r(e.toArray().sort(t),e.storage())},"Array, string":function(e,t){return u(e),e.sort(s(t))},"Matrix, string":function(e,t){return c(e),r(e.toArray().sort(s(t)),e.storage())}});function s(e){if("asc"===e)return o;if("desc"===e)return a;if("natural"===e)return i;throw new Error('String "asc", "desc", or "natural" expected')}function u(e){if(1!==vn(e).length)throw new Error("One dimensional array expected")}function c(e){if(1!==e.size().length)throw new Error("One dimensional matrix expected")}})),yl=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:r,numeric:n,larger:i}=e;return t("max",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return oi(e,t.valueOf(),o)},"...":function(e){if(ri(e))throw new TypeError("Scalar values expected in function max");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Uu(e,"max",t)}}function a(e){let t;if(ni(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Uu(t,"max",e)}})),void 0===t)throw new Error("Cannot calculate max of an empty array");return"string"==typeof t&&(t=n(t,xe(t,r))),t}})),xl=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:r,numeric:n,smaller:i}=e;return t("min",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){return oi(e,t.valueOf(),o)},"...":function(e){if(ri(e))throw new TypeError("Scalar values expected in function min");return a(e)}});function o(e,t){try{return i(e,t)?e:t}catch(e){throw Uu(e,"min",t)}}function a(e){let t;if(ni(e,(function(e){try{isNaN(e)&&"number"==typeof e?t=NaN:(void 0===t||i(e,t))&&(t=e)}catch(t){throw Uu(t,"min",e)}})),void 0===t)throw new Error("Cannot calculate min of an empty array");return"string"==typeof t&&(t=n(t,xe(t,r))),t}})),bl=he("ImmutableDenseMatrix",["smaller","DenseMatrix"],(e=>{let{smaller:t,DenseMatrix:r}=e;function n(e,t){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(t&&!w(t))throw new Error("Invalid datatype: "+t);if(E(e)||N(e)){const n=new r(e,t);this._data=n._data,this._size=n._size,this._datatype=n._datatype,this._min=null,this._max=null}else if(e&&N(e.data)&&N(e.size))this._data=e.data,this._size=e.size,this._datatype=e.datatype,this._min=void 0!==e.min?e.min:null,this._max=void 0!==e.max?e.max:null;else{if(e)throw new TypeError("Unsupported type of data ("+oe(e)+")");this._data=[],this._size=[0],this._datatype=t,this._min=null,this._max=null}}return n.prototype=new r,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(e){switch(arguments.length){case 1:{const t=r.prototype.subset.call(this,e);return E(t)?new n({data:t._data,size:t._size,datatype:t._datatype}):t}case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:ae(this._data),size:ae(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){let e=null;this.forEach((function(r){(null===e||t(r,e))&&(e=r)})),this._min=null!==e?e:void 0}return this._min},n.prototype.max=function(){if(null===this._max){let e=null;this.forEach((function(r){(null===e||t(e,r))&&(e=r)})),this._max=null!==e?e:void 0}return this._max},n}),{isClass:!0}),vl=he("Index",["ImmutableDenseMatrix","getMatrixDataType"],(e=>{let{ImmutableDenseMatrix:t,getMatrixDataType:r}=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(let e=0,t=arguments.length;e<t;e++){const t=arguments[e],n=N(t),o=E(t);let a=null;if(C(t))this._dimensions.push(t),this._isScalar=!1;else if(n||o){let e;"boolean"===r(t)?(n&&(e=i(wl(t).valueOf())),o&&(e=i(wl(t._data).valueOf())),a=t.valueOf().length):e=i(t.valueOf()),this._dimensions.push(e);const s=e.size();1===s.length&&1===s[0]&&null===a||(this._isScalar=!1)}else if("number"==typeof t)this._dimensions.push(i([t]));else{if("string"!=typeof t)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(t)}this._sourceSize.push(a)}}function i(e){for(let t=0,r=e.length;t<r;t++)if("number"!=typeof e[t]||!ye(e[t]))throw new TypeError("Index parameters must be positive integer numbers");return new t(e)}return n.prototype.type="Index",n.prototype.isIndex=!0,n.prototype.clone=function(){const e=new n;return e._dimensions=ae(this._dimensions),e._isScalar=this._isScalar,e._sourceSize=this._sourceSize,e},n.create=function(e){const t=new n;return n.apply(t,e),t},n.prototype.size=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e[t]="string"==typeof r?1:r.size()[0]}return e},n.prototype.max=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e[t]="string"==typeof r?r:r.max()}return e},n.prototype.min=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e[t]="string"==typeof r?r:r.min()}return e},n.prototype.forEach=function(e){for(let t=0,r=this._dimensions.length;t<r;t++)e(this._dimensions[t],t,this)},n.prototype.dimension=function(e){return"number"!=typeof e?null:this._dimensions[e]||null},n.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];e.push("string"==typeof r?r:r.toArray())}return e},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){const e=[];for(let t=0,r=this._dimensions.length;t<r;t++){const r=this._dimensions[t];"string"==typeof r?e.push(JSON.stringify(r)):e.push(r.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 wl(e){const t=[];return e.forEach(((e,r)=>{e&&t.push(r)})),t}const Nl=he("FibonacciHeap",["smaller","larger"],(e=>{let{smaller:t,larger:r}=e;const 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 o(e,t,r){t.left.right=t.right,t.right.left=t.left,r.degree--,r.child===t&&(r.child=t.right),0===r.degree&&(r.child=null),t.left=e,t.right=e.right,e.right=t,t.right.left=t,t.parent=null,t.mark=!1}function a(e,t){const r=t.parent;r&&(t.mark?(o(e,t,r),a(r)):t.mark=!0)}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(e,r){const n={key:e,value:r,degree:0};if(this._minimum){const r=this._minimum;n.left=r,n.right=r.right,r.right=n,n.right.left=n,t(e,r.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(){const e=this._minimum;if(null===e)return e;let i=this._minimum,o=e.degree,a=e.child;for(;o>0;){const e=a.right;a.left.right=a.right,a.right.left=a.left,a.left=i,a.right=i.right,i.right=a,a.right.left=a,a.parent=null,a=e,o--}return e.left.right=e.right,e.right.left=e.left,e===e.right?i=null:(i=e.right,i=function(e,i){const o=Math.floor(Math.log(i)*n)+1,a=new Array(o);let u,c=0,l=e;if(l)for(c++,l=l.right;l!==e;)c++,l=l.right;for(;c>0;){let e=l.degree;const t=l.right;for(;u=a[e],u;){if(r(l.key,u.key)){const e=u;u=l,l=e}s(u,l),a[e]=null,e++}a[e]=l,l=t,c--}e=null;for(let r=0;r<o;r++)u=a[r],u&&(e?(u.left.right=u.right,u.right.left=u.left,u.left=e,u.right=e.right,e.right=u,u.right.left=u,t(u.key,e.key)&&(e=u)):e=u);return e}(i,this._size)),this._size--,this._minimum=i,e},i.prototype.remove=function(e){this._minimum=function(e,r){r.key=-1;const n=r.parent;return n&&t(r.key,n.key)&&(o(e,r,n),a(e,n)),t(r.key,e.key)&&(e=r),e}(this._minimum,e),this.extractMinimum()};const s=function(e,t){e.left.right=e.right,e.right.left=e.left,e.parent=t,t.child?(e.left=t.child,e.right=t.child.right,t.child.right=e,e.right.left=e):(t.child=e,e.right=e,e.left=e),t.degree++,e.mark=!1};return i}),{isClass:!0}),El=he("Spa",["addScalar","equalScalar","FibonacciHeap"],(e=>{let{addScalar:t,equalScalar:r,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,t){if(this._values[e])this._values[e].value=t;else{const r=this._heap.insert(e,t);this._values[e]=r}},i.prototype.get=function(e){const t=this._values[e];return t?t.value:0},i.prototype.accumulate=function(e,r){let n=this._values[e];n?n.value=t(n.value,r):(n=this._heap.insert(e,r),this._values[e]=n)},i.prototype.forEach=function(e,t,n){const i=this._heap,o=this._values,a=[];let s=i.extractMinimum();for(s&&a.push(s);s&&s.key<=t;)s.key>=e&&(r(s.value,0)||n(s.key,s.value,this)),s=i.extractMinimum(),s&&a.push(s);for(let e=0;e<a.length;e++){const t=a[e];s=i.insert(t.key,t.value),o[s.key]=s}},i.prototype.swap=function(e,t){let r=this._values[e],n=this._values[t];if(!r&&n)r=this._heap.insert(e,n.value),this._heap.remove(n),this._values[e]=r,this._values[t]=void 0;else if(r&&!n)n=this._heap.insert(t,r.value),this._heap.remove(r),this._values[t]=n,this._values[e]=void 0;else if(r&&n){const e=r.value;r.value=n.value,n.value=e}},i}),{isClass:!0});function Al(e){let t=0,r=1,n=Object.create(null),i=Object.create(null),o=0;const a=function(e){const a=i[e];if(a&&(delete n[a],delete i[e],--t,r===a)){if(!t)return o=0,void(r=1);for(;!Object.prototype.hasOwnProperty.call(n,++r););}};return e=Math.abs(e),{hit:function(s){const u=i[s],c=++o;if(n[c]=s,i[s]=c,!u){if(++t,t<=e)return;return s=n[r],a(s),s}if(delete n[u],r===u)for(;!Object.prototype.hasOwnProperty.call(n,++r););},delete:a,clear:function(){t=o=0,r=1,n=Object.create(null),i=Object.create(null)}}}function Sl(e){let{hasher:t,limit:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r=null==r?Number.POSITIVE_INFINITY:r,t=null==t?JSON.stringify:t,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:Al(r||Number.POSITIVE_INFINITY)});const i=[];for(let e=0;e<arguments.length;e++)i[e]=arguments[e];const o=t(i);if(n.cache.values.has(o))return n.cache.lru.hit(o),n.cache.values.get(o);const a=e.apply(e,i);return n.cache.values.set(o,a),n.cache.values.delete(n.cache.lru.hit(o)),a}}const Ml=Sl((function(e){return new e(1).exp()}),{hasher:Bl}),Cl=Sl((function(e){return new e(1).plus(new e(5).sqrt()).div(2)}),{hasher:Bl}),Tl=Sl((function(e){return e.acos(-1)}),{hasher:Bl}),Dl=Sl((function(e){return Tl(e).times(2)}),{hasher:Bl});function Bl(e){return e[0].precision}const Fl=he("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],(e=>{let{on:t,config:r,addScalar:n,subtractScalar:i,multiplyScalar:o,divideScalar:a,pow:s,abs:u,fix:c,round:l,equal:f,isNumeric:p,format:m,number:h,Complex:d,BigNumber:g,Fraction:y}=e;const b=h;function w(e,t){if(!(this instanceof w))throw new Error("Constructor must be called with the new operator");if(null!=e&&!p(e)&&!x(e))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===t)this.units=[],this.dimensions=z.map((e=>0));else if("string"==typeof t){const e=w.parse(t);this.units=e.units,this.dimensions=e.dimensions}else{if(!v(t)||null!==t.value)throw new TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.fixPrefix=t.fixPrefix,this.skipAutomaticSimplification=t.skipAutomaticSimplification,this.dimensions=t.dimensions.slice(0),this.units=t.units.map((e=>sn({},e)))}this.value=this._normalize(e)}let N,E,A;function S(){for(;" "===A||"\t"===A;)C()}function M(e){return e>="0"&&e<="9"}function C(){E++,A=N.charAt(E)}function T(e){E=e,A=N.charAt(E)}function D(){let e="";const t=E;if("+"===A?C():"-"===A&&(e+=A,C()),!function(e){return e>="0"&&e<="9"||"."===e}(A))return T(t),null;if("."===A){if(e+=A,C(),!M(A))return T(t),null}else{for(;M(A);)e+=A,C();"."===A&&(e+=A,C())}for(;M(A);)e+=A,C();if("E"===A||"e"===A){let t="";const r=E;if(t+=A,C(),"+"!==A&&"-"!==A||(t+=A,C()),!M(A))return T(r),e;for(e+=t;M(A);)e+=A,C()}return e}function B(){let e="";for(;M(A)||w.isValidAlpha(A);)e+=A,C();const t=e.charAt(0);return w.isValidAlpha(t)?e:null}function F(e){return A===e?(C(),e):null}Object.defineProperty(w,"name",{value:"Unit"}),w.prototype.constructor=w,w.prototype.type="Unit",w.prototype.isUnit=!0,w.parse=function(e,t){if(t=t||{},N=e,E=-1,A="","string"!=typeof N)throw new TypeError("Invalid argument in Unit.parse, string expected");const n=new w;n.units=[];let i=1,o=!1;C(),S();const a=D();let s=null;if(a){if("BigNumber"===r.number)s=new g(a);else if("Fraction"===r.number)try{s=new y(a)}catch(e){s=parseFloat(a)}else s=parseFloat(a);S(),F("*")?(i=1,o=!0):F("/")&&(i=-1,o=!0)}const u=[];let c=1;for(;;){for(S();"("===A;)u.push(i),c*=i,i=1,C(),S();let t;if(!A)break;{const e=A;if(t=B(),null===t)throw new SyntaxError('Unexpected "'+e+'" in "'+N+'" at index '+E.toString())}const r=O(t);if(null===r)throw new SyntaxError('Unit "'+t+'" not found.');let a=i*c;if(S(),F("^")){S();const t=D();if(null===t)throw new SyntaxError('In "'+e+'", "^" must be followed by a floating-point number');a*=t}n.units.push({unit:r.unit,prefix:r.prefix,power:a});for(let e=0;e<z.length;e++)n.dimensions[e]+=(r.unit.dimensions[e]||0)*a;for(S();")"===A;){if(0===u.length)throw new SyntaxError('Unmatched ")" in "'+N+'" at index '+E.toString());c/=u.pop(),C(),S()}if(o=!1,F("*")?(i=1,o=!0):F("/")?(i=-1,o=!0):i=1,r.unit.base){const e=r.unit.base.key;U.auto[e]={unit:r.unit,prefix:r.prefix}}}if(S(),A)throw new SyntaxError('Could not parse: "'+e+'"');if(o)throw new SyntaxError('Trailing characters: "'+e+'"');if(0!==u.length)throw new SyntaxError('Unmatched "(" in "'+N+'"');if(0===n.units.length&&!t.allowNoUnits)throw new SyntaxError('"'+e+'" contains no units');return n.value=void 0!==s?n._normalize(s):null,n},w.prototype.clone=function(){const e=new w;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=ae(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(let t=0;t<this.units.length;t++){e.units[t]={};for(const r in this.units[t])me(this.units[t],r)&&(e.units[t][r]=this.units[t][r])}return e},w.prototype.valueType=function(){return oe(this.value)},w.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},w.prototype._normalize=function(e){if(null==e||0===this.units.length)return e;let t=e;const r=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const n=r(this.units[e].unit.value),i=r(this.units[e].prefix.value),a=r(this.units[e].power);t=o(t,s(o(n,i),a))}return t},w.prototype._denormalize=function(e,t){if(null==e||0===this.units.length)return e;let r=e;const n=w._getNumberConverter(oe(e));for(let e=0;e<this.units.length;e++){const t=n(this.units[e].unit.value),i=n(this.units[e].prefix.value),u=n(this.units[e].power);r=a(r,s(o(t,i),u))}return r};const O=Sl((e=>{if(me(q,e)){const t=q[e];return{unit:t,prefix:t.prefixes[""]}}for(const t in q)if(me(q,t)&&fn(e,t)){const r=q[t],n=e.length-t.length,i=e.substring(0,n),o=me(r.prefixes,i)?r.prefixes[i]:void 0;if(void 0!==o)return{unit:r,prefix:o}}return null}),{hasher:e=>e[0],limit:100});function _(e){return e.equalBase(k.NONE)&&null!==e.value&&!r.predictable?e.value:e}w.isValuelessUnit=function(e){return null!==O(e)},w.prototype.hasBase=function(e){if("string"==typeof e&&(e=k[e]),!e)return!1;for(let t=0;t<z.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equalBase=function(e){for(let t=0;t<z.length;t++)if(Math.abs((this.dimensions[t]||0)-(e.dimensions[t]||0))>1e-12)return!1;return!0},w.prototype.equals=function(e){return this.equalBase(e)&&f(this.value,e.value)},w.prototype.multiply=function(e){const t=this.clone(),r=v(e)?e:new w(e);for(let e=0;e<z.length;e++)t.dimensions[e]=(this.dimensions[e]||0)+(r.dimensions[e]||0);for(let e=0;e<r.units.length;e++){const n={...r.units[e]};t.units.push(n)}if(null!==this.value||null!==r.value){const e=null===this.value?this._normalize(1):this.value,n=null===r.value?r._normalize(1):r.value;t.value=o(e,n)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.divideInto=function(e){return new w(e).divide(this)},w.prototype.divide=function(e){const t=this.clone(),r=v(e)?e:new w(e);for(let e=0;e<z.length;e++)t.dimensions[e]=(this.dimensions[e]||0)-(r.dimensions[e]||0);for(let e=0;e<r.units.length;e++){const n={...r.units[e],power:-r.units[e].power};t.units.push(n)}if(null!==this.value||null!==r.value){const e=null===this.value?this._normalize(1):this.value,n=null===r.value?r._normalize(1):r.value;t.value=a(e,n)}else t.value=null;return v(e)&&(t.skipAutomaticSimplification=!1),_(t)},w.prototype.pow=function(e){const t=this.clone();for(let r=0;r<z.length;r++)t.dimensions[r]=(this.dimensions[r]||0)*e;for(let r=0;r<t.units.length;r++)t.units[r].power*=e;return null!==t.value?t.value=s(t.value,e):t.value=null,t.skipAutomaticSimplification=!1,_(t)},w.prototype.abs=function(){const e=this.clone();if(null!==e.value)if(e._isDerived()||0===e.units.length||0===e.units[0].unit.offset)e.value=u(e.value);else{const t=e._numberConverter(),r=t(e.units[0].unit.value),a=t(e.units[0].unit.offset),s=o(r,a);e.value=i(u(n(e.value,s)),s)}for(const t in e.units)"VA"!==e.units[t].unit.name&&"VAR"!==e.units[t].unit.name||(e.units[t].unit=q.W);return e},w.prototype.to=function(e){const t=null===this.value?this._normalize(1):this.value;let r;if("string"==typeof e)r=w.parse(e);else{if(!v(e))throw new Error("String or Unit expected as parameter");r=e.clone()}if(!this.equalBase(r))throw new Error(`Units do not match ('${r.toString()}' != '${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=ae(t);else{const e=w._getNumberConverter(oe(t)),a=this.units[0].unit.value,s=this.units[0].unit.offset,u=o(a,s),c=r.units[0].unit.value,l=r.units[0].unit.offset,f=o(c,l);r.value=n(t,e(i(u,f)))}return r.fixPrefix=!0,r.skipAutomaticSimplification=!0,r},w.prototype.toNumber=function(e){return b(this.toNumeric(e))},w.prototype.toNumeric=function(e){let t;return t=e?this.to(e):this.clone(),t._isDerived()||0===t.units.length?t._denormalize(t.value):t._denormalize(t.value,t.units[0].prefix.value)},w.prototype.toString=function(){return this.format()},w.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.units.length>0?this.formatUnits():null,fixPrefix:this.fixPrefix}},w.fromJSON=function(e){var t;const r=new w(e.value,null!==(t=e.unit)&&void 0!==t?t:void 0);return r.fixPrefix=e.fixPrefix||!1,r},w.prototype.valueOf=w.prototype.toString,w.prototype.simplify=function(){const e=this.clone(),t=[];let r;for(const t in L)if(me(L,t)&&e.hasBase(k[t])){r=t;break}if("NONE"===r)e.units=[];else{let n;if(r&&me(L,r)&&(n=L[r]),n)e.units=[{unit:n.unit,prefix:n.prefix,power:1}];else{let r=!1;for(let n=0;n<z.length;n++){const i=z[n];Math.abs(e.dimensions[n]||0)>1e-12&&(me(L,i)?t.push({unit:L[i].unit,prefix:L[i].prefix,power:e.dimensions[n]||0}):r=!0)}t.length<e.units.length&&!r&&(e.units=t)}}return e},w.prototype.toSI=function(){const e=this.clone(),t=[];for(let r=0;r<z.length;r++){const n=z[r];if(Math.abs(e.dimensions[r]||0)>1e-12){if(!me(U.si,n))throw new Error("Cannot express custom unit "+n+" in SI units");t.push({unit:U.si[n].unit,prefix:U.si[n].prefix,power:e.dimensions[r]||0})}}return e.units=t,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,null!==this.value?(e.value=null,this.to(e)):e},w.prototype.formatUnits=function(){let e="",t="",r=0,n=0;for(let t=0;t<this.units.length;t++)this.units[t].power>0?(r++,e+=" "+this.units[t].prefix.name+this.units[t].unit.name,Math.abs(this.units[t].power-1)>1e-15&&(e+="^"+this.units[t].power)):this.units[t].power<0&&n++;if(n>0)for(let e=0;e<this.units.length;e++)this.units[e].power<0&&(r>0?(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,Math.abs(this.units[e].power+1)>1e-15&&(t+="^"+-this.units[e].power)):(t+=" "+this.units[e].prefix.name+this.units[e].unit.name,t+="^"+this.units[e].power));e=e.substr(1),t=t.substr(1),r>1&&n>0&&(e="("+e+")"),n>1&&r>0&&(t="("+t+")");let i=e;return r>0&&n>0&&(i+=" / "),i+=t,i},w.prototype.format=function(e){const t=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify();let r=!1;void 0!==t.value&&null!==t.value&&x(t.value)&&(r=Math.abs(t.value.re)<1e-14);for(const e in t.units)me(t.units,e)&&t.units[e].unit&&("VA"===t.units[e].unit.name&&r?t.units[e].unit=q.VAR:"VAR"!==t.units[e].unit.name||r||(t.units[e].unit=q.VA));1!==t.units.length||t.fixPrefix||Math.abs(t.units[0].power-Math.round(t.units[0].power))<1e-14&&(t.units[0].prefix=t._bestPrefix());const n=t._denormalize(t.value);let i=null!==t.value?m(n,e||{}):"";const o=t.formatUnits();return t.value&&x(t.value)&&(i="("+i+")"),o.length>0&&i.length>0&&(i+=" "),i+=o,i},w.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");const e=null!==this.value?u(this.value):0,t=u(this.units[0].unit.value);let r=this.units[0].prefix;if(0===e)return r;const n=this.units[0].power;let i=Math.log(e/Math.pow(r.value*t,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return r;i=Math.abs(i);const o=this.units[0].unit.prefixes;for(const a in o)if(me(o,a)){const s=o[a];if(s.scientific){const o=Math.abs(Math.log(e/Math.pow(s.value*t,n))/Math.LN10-1.2);(o<i||o===i&&s.name.length<r.name.length)&&(r=s,i=o)}}return r},w.prototype.splitUnit=function(e){let t=this.clone();const r=[];for(let n=0;n<e.length&&(t=t.to(e[n]),n!==e.length-1);n++){const o=t.toNumeric(),a=l(o);let s;s=f(a,o)?a:c(t.toNumeric());const u=new w(s,e[n].toString());r.push(u),t=i(t,u)}let o=0;for(let e=0;e<r.length;e++)o=n(o,r[e].value);return f(o,this.value)&&(t.value=0),r.push(t),r};const I={NONE:{"":{name:"",value:1,scientific:!0}},SHORT:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:10,scientific:!1},h:{name:"h",value:100,scientific:!1},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0},R:{name:"R",value:1e27,scientific:!0},Q:{name:"Q",value:1e30,scientific:!0},d:{name:"d",value:.1,scientific:!1},c:{name:"c",value:.01,scientific:!1},m:{name:"m",value:.001,scientific:!0},u:{name:"u",value:1e-6,scientific:!0},n:{name:"n",value:1e-9,scientific:!0},p:{name:"p",value:1e-12,scientific:!0},f:{name:"f",value:1e-15,scientific:!0},a:{name:"a",value:1e-18,scientific:!0},z:{name:"z",value:1e-21,scientific:!0},y:{name:"y",value:1e-24,scientific:!0},r:{name:"r",value:1e-27,scientific:!0},q:{name:"q",value:1e-30,scientific:!0}},LONG:{"":{name:"",value:1,scientific:!0},deca:{name:"deca",value:10,scientific:!1},hecto:{name:"hecto",value:100,scientific:!1},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0},ronna:{name:"ronna",value:1e27,scientific:!0},quetta:{name:"quetta",value:1e30,scientific:!0},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};I.SHORTLONG=sn({},I.SHORT,I.LONG),I.BINARY_SHORT=sn({},I.BINARY_SHORT_SI,I.BINARY_SHORT_IEC),I.BINARY_LONG=sn({},I.BINARY_LONG_SI,I.BINARY_LONG_IEC);const z=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],k={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(const e in k)me(k,e)&&(k[e].key=e);const R={name:"",base:{},value:1,offset:0,dimensions:z.map((e=>0))},q={meter:{name:"meter",base:k.LENGTH,prefixes:I.LONG,value:1,offset:0},inch:{name:"inch",base:k.LENGTH,prefixes:I.NONE,value:.0254,offset:0},foot:{name:"foot",base:k.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yard:{name:"yard",base:k.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mile:{name:"mile",base:k.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},link:{name:"link",base:k.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rod:{name:"rod",base:k.LENGTH,prefixes:I.NONE,value:5.0292,offset:0},chain:{name:"chain",base:k.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:k.LENGTH,prefixes:I.NONE,value:1e-10,offset:0},m:{name:"m",base:k.LENGTH,prefixes:I.SHORT,value:1,offset:0},in:{name:"in",base:k.LENGTH,prefixes:I.NONE,value:.0254,offset:0},ft:{name:"ft",base:k.LENGTH,prefixes:I.NONE,value:.3048,offset:0},yd:{name:"yd",base:k.LENGTH,prefixes:I.NONE,value:.9144,offset:0},mi:{name:"mi",base:k.LENGTH,prefixes:I.NONE,value:1609.344,offset:0},li:{name:"li",base:k.LENGTH,prefixes:I.NONE,value:.201168,offset:0},rd:{name:"rd",base:k.LENGTH,prefixes:I.NONE,value:5.02921,offset:0},ch:{name:"ch",base:k.LENGTH,prefixes:I.NONE,value:20.1168,offset:0},mil:{name:"mil",base:k.LENGTH,prefixes:I.NONE,value:254e-7,offset:0},m2:{name:"m2",base:k.SURFACE,prefixes:I.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:k.SURFACE,prefixes:I.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:k.SURFACE,prefixes:I.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:k.SURFACE,prefixes:I.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:k.SURFACE,prefixes:I.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:k.SURFACE,prefixes:I.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:k.SURFACE,prefixes:I.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:k.SURFACE,prefixes:I.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:k.SURFACE,prefixes:I.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:k.SURFACE,prefixes:I.NONE,value:1e4,offset:0},m3:{name:"m3",base:k.VOLUME,prefixes:I.CUBIC,value:1,offset:0},L:{name:"L",base:k.VOLUME,prefixes:I.SHORT,value:.001,offset:0},l:{name:"l",base:k.VOLUME,prefixes:I.SHORT,value:.001,offset:0},litre:{name:"litre",base:k.VOLUME,prefixes:I.LONG,value:.001,offset:0},cuin:{name:"cuin",base:k.VOLUME,prefixes:I.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:k.VOLUME,prefixes:I.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:k.VOLUME,prefixes:I.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:k.VOLUME,prefixes:I.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:k.VOLUME,prefixes:I.NONE,value:15e-6,offset:0},drop:{name:"drop",base:k.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:k.VOLUME,prefixes:I.NONE,value:5e-8,offset:0},minim:{name:"minim",base:k.VOLUME,prefixes:I.NONE,value:6.1611519921875e-8,offset:0},fluiddram:{name:"fluiddram",base:k.VOLUME,prefixes:I.NONE,value:36966911953125e-19,offset:0},fluidounce:{name:"fluidounce",base:k.VOLUME,prefixes:I.NONE,value:295735295625e-16,offset:0},gill:{name:"gill",base:k.VOLUME,prefixes:I.NONE,value:.00011829411825,offset:0},cc:{name:"cc",base:k.VOLUME,prefixes:I.NONE,value:1e-6,offset:0},cup:{name:"cup",base:k.VOLUME,prefixes:I.NONE,value:.0002365882365,offset:0},pint:{name:"pint",base:k.VOLUME,prefixes:I.NONE,value:.000473176473,offset:0},quart:{name:"quart",base:k.VOLUME,prefixes:I.NONE,value:.000946352946,offset:0},gallon:{name:"gallon",base:k.VOLUME,prefixes:I.NONE,value:.003785411784,offset:0},beerbarrel:{name:"beerbarrel",base:k.VOLUME,prefixes:I.NONE,value:.117347765304,offset:0},oilbarrel:{name:"oilbarrel",base:k.VOLUME,prefixes:I.NONE,value:.158987294928,offset:0},hogshead:{name:"hogshead",base:k.VOLUME,prefixes:I.NONE,value:.238480942392,offset:0},g:{name:"g",base:k.MASS,prefixes:I.SHORT,value:.001,offset:0},gram:{name:"gram",base:k.MASS,prefixes:I.LONG,value:.001,offset:0},ton:{name:"ton",base:k.MASS,prefixes:I.SHORT,value:907.18474,offset:0},t:{name:"t",base:k.MASS,prefixes:I.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:k.MASS,prefixes:I.LONG,value:1e3,offset:0},grain:{name:"grain",base:k.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:k.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:k.MASS,prefixes:I.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:k.MASS,prefixes:I.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:k.MASS,prefixes:I.NONE,value:45.359237,offset:0},stick:{name:"stick",base:k.MASS,prefixes:I.NONE,value:.115,offset:0},stone:{name:"stone",base:k.MASS,prefixes:I.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:k.MASS,prefixes:I.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:k.MASS,prefixes:I.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:k.MASS,prefixes:I.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:k.MASS,prefixes:I.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:k.MASS,prefixes:I.NONE,value:45.359237,offset:0},s:{name:"s",base:k.TIME,prefixes:I.SHORT,value:1,offset:0},min:{name:"min",base:k.TIME,prefixes:I.NONE,value:60,offset:0},h:{name:"h",base:k.TIME,prefixes:I.NONE,value:3600,offset:0},second:{name:"second",base:k.TIME,prefixes:I.LONG,value:1,offset:0},sec:{name:"sec",base:k.TIME,prefixes:I.LONG,value:1,offset:0},minute:{name:"minute",base:k.TIME,prefixes:I.NONE,value:60,offset:0},hour:{name:"hour",base:k.TIME,prefixes:I.NONE,value:3600,offset:0},day:{name:"day",base:k.TIME,prefixes:I.NONE,value:86400,offset:0},week:{name:"week",base:k.TIME,prefixes:I.NONE,value:604800,offset:0},month:{name:"month",base:k.TIME,prefixes:I.NONE,value:2629800,offset:0},year:{name:"year",base:k.TIME,prefixes:I.NONE,value:31557600,offset:0},decade:{name:"decade",base:k.TIME,prefixes:I.NONE,value:315576e3,offset:0},century:{name:"century",base:k.TIME,prefixes:I.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:k.TIME,prefixes:I.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:k.FREQUENCY,prefixes:I.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:k.FREQUENCY,prefixes:I.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:k.ANGLE,prefixes:I.SHORT,value:1,offset:0},radian:{name:"radian",base:k.ANGLE,prefixes:I.LONG,value:1,offset:0},deg:{name:"deg",base:k.ANGLE,prefixes:I.SHORT,value:null,offset:0},degree:{name:"degree",base:k.ANGLE,prefixes:I.LONG,value:null,offset:0},grad:{name:"grad",base:k.ANGLE,prefixes:I.SHORT,value:null,offset:0},gradian:{name:"gradian",base:k.ANGLE,prefixes:I.LONG,value:null,offset:0},cycle:{name:"cycle",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:k.ANGLE,prefixes:I.NONE,value:null,offset:0},A:{name:"A",base:k.CURRENT,prefixes:I.SHORT,value:1,offset:0},ampere:{name:"ampere",base:k.CURRENT,prefixes:I.LONG,value:1,offset:0},K:{name:"K",base:k.TEMPERATURE,prefixes:I.SHORT,value:1,offset:0},degC:{name:"degC",base:k.TEMPERATURE,prefixes:I.SHORT,value:1,offset:273.15},degF:{name:"degF",base:k.TEMPERATURE,prefixes:I.SHORT,value:new y(5,9),offset:459.67},degR:{name:"degR",base:k.TEMPERATURE,prefixes:I.SHORT,value:new y(5,9),offset:0},kelvin:{name:"kelvin",base:k.TEMPERATURE,prefixes:I.LONG,value:1,offset:0},celsius:{name:"celsius",base:k.TEMPERATURE,prefixes:I.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:k.TEMPERATURE,prefixes:I.LONG,value:new y(5,9),offset:459.67},rankine:{name:"rankine",base:k.TEMPERATURE,prefixes:I.LONG,value:new y(5,9),offset:0},mol:{name:"mol",base:k.AMOUNT_OF_SUBSTANCE,prefixes:I.SHORT,value:1,offset:0},mole:{name:"mole",base:k.AMOUNT_OF_SUBSTANCE,prefixes:I.LONG,value:1,offset:0},cd:{name:"cd",base:k.LUMINOUS_INTENSITY,prefixes:I.SHORT,value:1,offset:0},candela:{name:"candela",base:k.LUMINOUS_INTENSITY,prefixes:I.LONG,value:1,offset:0},N:{name:"N",base:k.FORCE,prefixes:I.SHORT,value:1,offset:0},newton:{name:"newton",base:k.FORCE,prefixes:I.LONG,value:1,offset:0},dyn:{name:"dyn",base:k.FORCE,prefixes:I.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:k.FORCE,prefixes:I.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:k.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:k.FORCE,prefixes:I.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:k.FORCE,prefixes:I.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:k.FORCE,prefixes:I.NONE,value:9.80665,offset:0},J:{name:"J",base:k.ENERGY,prefixes:I.SHORT,value:1,offset:0},joule:{name:"joule",base:k.ENERGY,prefixes:I.LONG,value:1,offset:0},erg:{name:"erg",base:k.ENERGY,prefixes:I.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:k.ENERGY,prefixes:I.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:k.ENERGY,prefixes:I.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:k.ENERGY,prefixes:I.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:k.ENERGY,prefixes:I.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:k.POWER,prefixes:I.SHORT,value:1,offset:0},watt:{name:"watt",base:k.POWER,prefixes:I.LONG,value:1,offset:0},hp:{name:"hp",base:k.POWER,prefixes:I.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:k.POWER,prefixes:I.SHORT,value:d.I,offset:0},VA:{name:"VA",base:k.POWER,prefixes:I.SHORT,value:1,offset:0},Pa:{name:"Pa",base:k.PRESSURE,prefixes:I.SHORT,value:1,offset:0},psi:{name:"psi",base:k.PRESSURE,prefixes:I.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:k.PRESSURE,prefixes:I.NONE,value:101325,offset:0},bar:{name:"bar",base:k.PRESSURE,prefixes:I.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:k.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:k.PRESSURE,prefixes:I.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:k.PRESSURE,prefixes:I.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:k.PRESSURE,prefixes:I.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:k.ELECTRIC_CHARGE,prefixes:I.LONG,value:1,offset:0},C:{name:"C",base:k.ELECTRIC_CHARGE,prefixes:I.SHORT,value:1,offset:0},farad:{name:"farad",base:k.ELECTRIC_CAPACITANCE,prefixes:I.LONG,value:1,offset:0},F:{name:"F",base:k.ELECTRIC_CAPACITANCE,prefixes:I.SHORT,value:1,offset:0},volt:{name:"volt",base:k.ELECTRIC_POTENTIAL,prefixes:I.LONG,value:1,offset:0},V:{name:"V",base:k.ELECTRIC_POTENTIAL,prefixes:I.SHORT,value:1,offset:0},ohm:{name:"ohm",base:k.ELECTRIC_RESISTANCE,prefixes:I.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:k.ELECTRIC_INDUCTANCE,prefixes:I.LONG,value:1,offset:0},H:{name:"H",base:k.ELECTRIC_INDUCTANCE,prefixes:I.SHORT,value:1,offset:0},siemens:{name:"siemens",base:k.ELECTRIC_CONDUCTANCE,prefixes:I.LONG,value:1,offset:0},S:{name:"S",base:k.ELECTRIC_CONDUCTANCE,prefixes:I.SHORT,value:1,offset:0},weber:{name:"weber",base:k.MAGNETIC_FLUX,prefixes:I.LONG,value:1,offset:0},Wb:{name:"Wb",base:k.MAGNETIC_FLUX,prefixes:I.SHORT,value:1,offset:0},tesla:{name:"tesla",base:k.MAGNETIC_FLUX_DENSITY,prefixes:I.LONG,value:1,offset:0},T:{name:"T",base:k.MAGNETIC_FLUX_DENSITY,prefixes:I.SHORT,value:1,offset:0},b:{name:"b",base:k.BIT,prefixes:I.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:k.BIT,prefixes:I.BINARY_LONG,value:1,offset:0},B:{name:"B",base:k.BIT,prefixes:I.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:k.BIT,prefixes:I.BINARY_LONG,value:8,offset:0}},P={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fldr:"fluiddram",fluiddrams:"fluiddram",floz:"fluidounce",fluidounces:"fluidounce",gi:"gill",gills:"gill",cp:"cup",cups:"cup",pt:"pint",pints:"pint",qt:"quart",quarts:"quart",gal:"gallon",gallons:"gallon",bbl:"beerbarrel",beerbarrels:"beerbarrel",obl:"oilbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function j(e){if("BigNumber"===e.number){const e=Tl(g);q.rad.value=new g(1),q.deg.value=e.div(180),q.grad.value=e.div(200),q.cycle.value=e.times(2),q.arcsec.value=e.div(648e3),q.arcmin.value=e.div(10800)}else q.rad.value=1,q.deg.value=Math.PI/180,q.grad.value=Math.PI/200,q.cycle.value=2*Math.PI,q.arcsec.value=Math.PI/648e3,q.arcmin.value=Math.PI/10800;q.radian.value=q.rad.value,q.degree.value=q.deg.value,q.gradian.value=q.grad.value}j(r),t&&t("config",(function(e,t){e.number!==t.number&&j(e)}));const U={si:{NONE:{unit:R,prefix:I.NONE[""]},LENGTH:{unit:q.m,prefix:I.SHORT[""]},MASS:{unit:q.g,prefix:I.SHORT.k},TIME:{unit:q.s,prefix:I.SHORT[""]},CURRENT:{unit:q.A,prefix:I.SHORT[""]},TEMPERATURE:{unit:q.K,prefix:I.SHORT[""]},LUMINOUS_INTENSITY:{unit:q.cd,prefix:I.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:q.mol,prefix:I.SHORT[""]},ANGLE:{unit:q.rad,prefix:I.SHORT[""]},BIT:{unit:q.bits,prefix:I.SHORT[""]},FORCE:{unit:q.N,prefix:I.SHORT[""]},ENERGY:{unit:q.J,prefix:I.SHORT[""]},POWER:{unit:q.W,prefix:I.SHORT[""]},PRESSURE:{unit:q.Pa,prefix:I.SHORT[""]},ELECTRIC_CHARGE:{unit:q.C,prefix:I.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:q.F,prefix:I.SHORT[""]},ELECTRIC_POTENTIAL:{unit:q.V,prefix:I.SHORT[""]},ELECTRIC_RESISTANCE:{unit:q.ohm,prefix:I.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:q.H,prefix:I.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:q.S,prefix:I.SHORT[""]},MAGNETIC_FLUX:{unit:q.Wb,prefix:I.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:q.T,prefix:I.SHORT[""]},FREQUENCY:{unit:q.Hz,prefix:I.SHORT[""]}}};U.cgs=JSON.parse(JSON.stringify(U.si)),U.cgs.LENGTH={unit:q.m,prefix:I.SHORT.c},U.cgs.MASS={unit:q.g,prefix:I.SHORT[""]},U.cgs.FORCE={unit:q.dyn,prefix:I.SHORT[""]},U.cgs.ENERGY={unit:q.erg,prefix:I.NONE[""]},U.us=JSON.parse(JSON.stringify(U.si)),U.us.LENGTH={unit:q.ft,prefix:I.NONE[""]},U.us.MASS={unit:q.lbm,prefix:I.NONE[""]},U.us.TEMPERATURE={unit:q.degF,prefix:I.NONE[""]},U.us.FORCE={unit:q.lbf,prefix:I.NONE[""]},U.us.ENERGY={unit:q.BTU,prefix:I.BTU[""]},U.us.POWER={unit:q.hp,prefix:I.NONE[""]},U.us.PRESSURE={unit:q.psi,prefix:I.NONE[""]},U.auto=JSON.parse(JSON.stringify(U.si));let L=U.auto;w.setUnitSystem=function(e){if(!me(U,e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(U).join(", "));L=U[e]},w.getUnitSystem=function(){for(const e in U)if(me(U,e)&&U[e]===L)return e},w.typeConverters={BigNumber:function(e){return null!=e&&e.isFraction?new g(String(e.n)).div(String(e.d)).times(String(e.s)):new g(e+"")},Fraction:function(e){return new y(e)},Complex:function(e){return e},number:function(e){return null!=e&&e.isFraction?h(e):e}},w.prototype._numberConverter=function(){const e=w.typeConverters[this.valueType()];if(e)return e;throw new TypeError('Unsupported Unit value type "'+this.valueType()+'"')},w._getNumberConverter=function(e){if(!w.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return w.typeConverters[e]};for(const e in q)if(me(q,e)){const t=q[e];t.dimensions=t.base.dimensions}for(const e in P)if(me(P,e)){const t=q[P[e]],r={};for(const e in t)me(t,e)&&(r[e]=t[e]);r.name=e,q[e]=r}return w.isValidAlpha=function(e){return/^[a-zA-Z]$/.test(e)},w.createUnit=function(e,t){if("object"!=typeof e)throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(t&&t.override)for(const t in e)if(me(e,t)&&w.deleteUnit(t),e[t].aliases)for(let r=0;r<e[t].aliases.length;r++)w.deleteUnit(e[t].aliases[r]);let r;for(const t in e)me(e,t)&&(r=w.createUnitSingle(t,e[t]));return r},w.createUnitSingle=function(e,t){if(null==t&&(t={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(me(q,e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(let t=0;t<e.length;t++){if(A=e.charAt(t),0===t&&!w.isValidAlpha(A))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(t>0&&!w.isValidAlpha(A)&&!M(A))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}}(e);let r,n,i,o=null,a=[],s=0;if(t&&"Unit"===t.type)o=t.clone();else if("string"==typeof t)""!==t&&(r=t);else{if("object"!=typeof t)throw new TypeError('Cannot create unit "'+e+'" from "'+t.toString()+'": expecting "string" or "Unit" or "Object"');r=t.definition,n=t.prefixes,s=t.offset,i=t.baseName,t.aliases&&(a=t.aliases.valueOf())}if(a)for(let e=0;e<a.length;e++)if(me(q,a[e]))throw new Error('Cannot create alias "'+a[e]+'": a unit with that name already exists');if(r&&"string"==typeof r&&!o)try{o=w.parse(r,{allowNoUnits:!0})}catch(t){throw t.message='Could not create unit "'+e+'" from "'+r+'": '+t.message,t}else r&&"Unit"===r.type&&(o=r.clone());a=a||[],s=s||0,n=n&&n.toUpperCase&&I[n.toUpperCase()]||I.NONE;let u={};if(o){u={name:e,value:o.value,dimensions:o.dimensions.slice(0),prefixes:n,offset:s};let t=!1;for(const e in k)if(me(k,e)){let r=!0;for(let t=0;t<z.length;t++)if(Math.abs((u.dimensions[t]||0)-(k[e].dimensions[t]||0))>1e-12){r=!1;break}if(r){t=!0,u.base=k[e];break}}if(!t){i=i||e+"_STUFF";const t={dimensions:o.dimensions.slice(0)};t.key=i,k[i]=t,L[i]={unit:u,prefix:I.NONE[""]},u.base=k[i]}}else{if(i=i||e+"_STUFF",z.indexOf(i)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');z.push(i);for(const e in k)me(k,e)&&(k[e].dimensions[z.length-1]=0);const t={dimensions:[]};for(let e=0;e<z.length;e++)t.dimensions[e]=0;t.dimensions[z.length-1]=1,t.key=i,k[i]=t,u={name:e,value:1,dimensions:k[i].dimensions.slice(0),prefixes:n,offset:s,base:k[i]},L[i]={unit:u,prefix:I.NONE[""]}}w.UNITS[e]=u;for(let e=0;e<a.length;e++){const t=a[e],r={};for(const e in u)me(u,e)&&(r[e]=u[e]);r.name=t,w.UNITS[t]=r}return delete O.cache,new w(null,e)},w.deleteUnit=function(e){delete w.UNITS[e],delete O.cache},w.PREFIXES=I,w.BASE_DIMENSIONS=z,w.BASE_UNITS=k,w.UNIT_SYSTEMS=U,w.UNITS=q,w}),{isClass:!0}),Ol="unit",_l=he(Ol,["typed","Unit"],(e=>{let{typed:t,Unit:r}=e;return t(Ol,{Unit:function(e){return e.clone()},string:function(e){return r.isValuelessUnit(e)?new r(null,e):r.parse(e,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(e,t){return new r(e,t)},"number | BigNumber | Fraction":function(e){return new r(e)},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Il="sparse",zl=he(Il,["typed","SparseMatrix"],(e=>{let{typed:t,SparseMatrix:r}=e;return t(Il,{"":function(){return new r([])},string:function(e){return new r([],e)},"Array | Matrix":function(e){return new r(e)},"Array | Matrix, string":function(e,t){return new r(e,t)}})})),kl="createUnit",Rl=he(kl,["typed","Unit"],(e=>{let{typed:t,Unit:r}=e;return t(kl,{"Object, Object":function(e,t){return r.createUnit(e,t)},Object:function(e){return r.createUnit(e,{})},"string, Unit | string | Object, Object":function(e,t,n){const i={};return i[e]=t,r.createUnit(i,n)},"string, Unit | string | Object":function(e,t){const n={};return n[e]=t,r.createUnit(n,{})},string:function(e){const t={};return t[e]={},r.createUnit(t,{})}})})),ql="acos",Pl=he(ql,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(ql,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.acos(e):new n(e,0).acos()},Complex:function(e){return e.acos()},BigNumber:function(e){return e.acos()}})})),jl="number";function Ul(e){return Ie(e)}function Ll(e){return Math.atan(1/e)}function $l(e){return isFinite(e)?(Math.log((e+1)/e)+Math.log(e/(e-1)))/2:0}function Hl(e){return Math.asin(1/e)}function Gl(e){const t=1/e;return Math.log(t+Math.sqrt(t*t+1))}function Vl(e){return Math.acos(1/e)}function Wl(e){const t=1/e,r=Math.sqrt(t*t-1);return Math.log(r+t)}function Zl(e){return ze(e)}function Yl(e){return ke(e)}function Jl(e){return 1/Math.tan(e)}function Xl(e){const t=Math.exp(2*e);return(t+1)/(t-1)}function Ql(e){return 1/Math.sin(e)}function Kl(e){return 0===e?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(e)-Math.exp(-e)))*be(e)}function ef(e){return 1/Math.cos(e)}function tf(e){return 2/(Math.exp(e)+Math.exp(-e))}function rf(e){return qe(e)}Ul.signature=jl,Ll.signature=jl,$l.signature=jl,Hl.signature=jl,Gl.signature=jl,Vl.signature=jl,Wl.signature=jl,Zl.signature=jl,Yl.signature=jl,Jl.signature=jl,Xl.signature=jl,Ql.signature=jl,Kl.signature=jl,ef.signature=jl,tf.signature=jl,rf.signature=jl;const nf="acosh",of=he(nf,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(nf,{number:function(e){return e>=1||r.predictable?Ul(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()}})})),af="acot",sf=he(af,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(af,{number:Ll,Complex:function(e){return e.acot()},BigNumber:function(e){return new r(1).div(e).atan()}})})),uf="acoth",cf=he(uf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(uf,{number:function(e){return e>=1||e<=-1||r.predictable?$l(e):new n(e,0).acoth()},Complex:function(e){return e.acoth()},BigNumber:function(e){return new i(1).div(e).atanh()}})})),lf="acsc",ff=he(lf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(lf,{number:function(e){return e<=-1||e>=1||r.predictable?Hl(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=he(pf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(pf,{number:Gl,Complex:function(e){return e.acsch()},BigNumber:function(e){return new r(1).div(e).asinh()}})})),hf="asec",df=he(hf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(hf,{number:function(e){return e<=-1||e>=1||r.predictable?Vl(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=he(gf,["typed","config","Complex","BigNumber"],(e=>{let{typed:t,config:r,Complex:n,BigNumber:i}=e;return t(gf,{number:function(e){if(e<=1&&e>=-1||r.predictable){const t=1/e;if(t>0||r.predictable)return Wl(e);const i=Math.sqrt(t*t-1);return new n(Math.log(i-t),Math.PI)}return new n(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new i(1).div(e).acosh()}})})),xf="asin",bf=he(xf,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(xf,{number:function(e){return e>=-1&&e<=1||r.predictable?Math.asin(e):new n(e,0).asin()},Complex:function(e){return e.asin()},BigNumber:function(e){return e.asin()}})})),vf=he("asinh",["typed"],(e=>{let{typed:t}=e;return t("asinh",{number:Zl,Complex:function(e){return e.asinh()},BigNumber:function(e){return e.asinh()}})})),wf=he("atan",["typed"],(e=>{let{typed:t}=e;return t("atan",{number:function(e){return Math.atan(e)},Complex:function(e){return e.atan()},BigNumber:function(e){return e.atan()}})})),Nf="atan2",Ef=he(Nf,["typed","matrix","equalScalar","BigNumber","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,BigNumber:i,DenseMatrix:o,concat:a}=e;const s=ea({typed:t,equalScalar:n}),u=ta({typed:t}),c=Ra({typed:t,equalScalar:n}),l=Io({typed:t,equalScalar:n}),f=zo({typed:t,DenseMatrix:o}),p=oa({typed:t,matrix:r,concat:a});return t(Nf,{"number, number":Math.atan2,"BigNumber, BigNumber":(e,t)=>i.atan2(e,t)},p({scalar:"number | BigNumber",SS:c,DS:u,SD:s,Ss:l,sS:f}))})),Af="atanh",Sf=he(Af,["typed","config","Complex"],(e=>{let{typed:t,config:r,Complex:n}=e;return t(Af,{number:function(e){return e<=1&&e>=-1||r.predictable?Yl(e):new n(e,0).atanh()},Complex:function(e){return e.atanh()},BigNumber:function(e){return e.atanh()}})})),Mf=he("trigUnit",["typed"],(e=>{let{typed:t}=e;return{Unit:t.referToSelf((e=>r=>{if(!r.hasBase(r.constructor.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return t.find(e,r.valueType())(r.value)}))}})),Cf=he("cos",["typed"],(e=>{let{typed:t}=e;const r=Mf({typed:t});return t("cos",{number:Math.cos,"Complex | BigNumber":e=>e.cos()},r)})),Tf="cosh",Df=he(Tf,["typed"],(e=>{let{typed:t}=e;return t(Tf,{number:Re,"Complex | BigNumber":e=>e.cosh()})})),Bf=he("cot",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("cot",{number:Jl,Complex:e=>e.cot(),BigNumber:e=>new r(1).div(e.tan())},Mf({typed:t}))})),Ff="coth",Of=he(Ff,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(Ff,{number:Xl,Complex:e=>e.coth(),BigNumber:e=>new r(1).div(e.tanh())})})),_f=he("csc",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("csc",{number:Ql,Complex:e=>e.csc(),BigNumber:e=>new r(1).div(e.sin())},Mf({typed:t}))})),If="csch",zf=he(If,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(If,{number:Kl,Complex:e=>e.csch(),BigNumber:e=>new r(1).div(e.sinh())})})),kf=he("sec",["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t("sec",{number:ef,Complex:e=>e.sec(),BigNumber:e=>new r(1).div(e.cos())},Mf({typed:t}))})),Rf="sech",qf=he(Rf,["typed","BigNumber"],(e=>{let{typed:t,BigNumber:r}=e;return t(Rf,{number:tf,Complex:e=>e.sech(),BigNumber:e=>new r(1).div(e.cosh())})})),Pf=he("sin",["typed"],(e=>{let{typed:t}=e;const r=Mf({typed:t});return t("sin",{number:Math.sin,"Complex | BigNumber":e=>e.sin()},r)})),jf="sinh",Uf=he(jf,["typed"],(e=>{let{typed:t}=e;return t(jf,{number:rf,"Complex | BigNumber":e=>e.sinh()})})),Lf=he("tan",["typed"],(e=>{let{typed:t}=e;const r=Mf({typed:t});return t("tan",{number:Math.tan,"Complex | BigNumber":e=>e.tan()},r)})),$f=he("tanh",["typed"],(e=>{let{typed:t}=e;return t("tanh",{number:Pe,"Complex | BigNumber":e=>e.tanh()})})),Hf="setCartesian",Gf=he(Hf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Hf,{"Array | Matrix, Array | Matrix":function(e,t){let s=[];if(0!==n(r(e),new o(0))&&0!==n(r(t),new o(0))){const r=zn(Array.isArray(e)?e:e.toArray()).sort(i),n=zn(Array.isArray(t)?t:t.toArray()).sort(i);s=[];for(let e=0;e<r.length;e++)for(let t=0;t<n.length;t++)s.push([r[e],n[t]])}return Array.isArray(e)&&Array.isArray(t)?s:new a(s)}})})),Vf="setDifference",Wf=he(Vf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Vf,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===n(r(e),new o(0)))s=[];else{if(0===n(r(t),new o(0)))return zn(e.toArray());{const r=jn(zn(Array.isArray(e)?e:e.toArray()).sort(i)),n=jn(zn(Array.isArray(t)?t:t.toArray()).sort(i));let o;s=[];for(let e=0;e<r.length;e++){o=!1;for(let t=0;t<n.length;t++)if(0===i(r[e].value,n[t].value)&&r[e].identifier===n[t].identifier){o=!0;break}o||s.push(r[e])}}}return Array.isArray(e)&&Array.isArray(t)?Un(s):new a(Un(s))}})})),Zf="setDistinct",Yf=he(Zf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Zf,{"Array | Matrix":function(e){let t;if(0===n(r(e),new o(0)))t=[];else{const r=zn(Array.isArray(e)?e:e.toArray()).sort(i);t=[],t.push(r[0]);for(let e=1;e<r.length;e++)0!==i(r[e],r[e-1])&&t.push(r[e])}return Array.isArray(e)?t:new a(t)}})})),Jf="setIntersect",Xf=he(Jf,["typed","size","subset","compareNatural","Index","DenseMatrix"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o,DenseMatrix:a}=e;return t(Jf,{"Array | Matrix, Array | Matrix":function(e,t){let s;if(0===n(r(e),new o(0))||0===n(r(t),new o(0)))s=[];else{const r=jn(zn(Array.isArray(e)?e:e.toArray()).sort(i)),n=jn(zn(Array.isArray(t)?t:t.toArray()).sort(i));s=[];for(let e=0;e<r.length;e++)for(let t=0;t<n.length;t++)if(0===i(r[e].value,n[t].value)&&r[e].identifier===n[t].identifier){s.push(r[e]);break}}return Array.isArray(e)&&Array.isArray(t)?Un(s):new a(Un(s))}})})),Qf="setIsSubset",Kf=he(Qf,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o}=e;return t(Qf,{"Array | Matrix, Array | Matrix":function(e,t){if(0===n(r(e),new o(0)))return!0;if(0===n(r(t),new o(0)))return!1;const a=jn(zn(Array.isArray(e)?e:e.toArray()).sort(i)),s=jn(zn(Array.isArray(t)?t:t.toArray()).sort(i));let u;for(let e=0;e<a.length;e++){u=!1;for(let t=0;t<s.length;t++)if(0===i(a[e].value,s[t].value)&&a[e].identifier===s[t].identifier){u=!0;break}if(!1===u)return!1}return!0}})})),ep="setMultiplicity",tp=he(ep,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o}=e;return t(ep,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===n(r(t),new o(0)))return 0;const a=zn(Array.isArray(t)?t:t.toArray());let s=0;for(let t=0;t<a.length;t++)0===i(a[t],e)&&s++;return s}})})),rp="setPowerset",np=he(rp,["typed","size","subset","compareNatural","Index"],(e=>{let{typed:t,size:r,subset:n,compareNatural:i,Index:o}=e;return t(rp,{"Array | Matrix":function(e){if(0===n(r(e),new o(0)))return[];const t=zn(Array.isArray(e)?e:e.toArray()).sort(i),s=[];let u=0;for(;u.toString(2).length<=t.length;)s.push(a(t,u.toString(2).split("").reverse())),u++;return function(e){let t=[];for(let r=e.length-1;r>0;r--)for(let n=0;n<r;n++)e[n].length>e[n+1].length&&(t=e[n],e[n]=e[n+1],e[n+1]=t);return e}(s)}});function a(e,t){const r=[];for(let n=0;n<t.length;n++)"1"===t[n]&&r.push(e[n]);return r}})),ip="setSize",op=he(ip,["typed","compareNatural"],(e=>{let{typed:t,compareNatural:r}=e;return t(ip,{"Array | Matrix":function(e){return Array.isArray(e)?zn(e).length:zn(e.toArray()).length},"Array | Matrix, boolean":function(e,t){if(!1===t||0===e.length)return Array.isArray(e)?zn(e).length:zn(e.toArray()).length;{const t=zn(Array.isArray(e)?e:e.toArray()).sort(r);let n=1;for(let e=1;e<t.length;e++)0!==r(t[e],t[e-1])&&n++;return n}}})})),ap="setSymDifference",sp=he(ap,["typed","size","concat","subset","setDifference","Index"],(e=>{let{typed:t,size:r,concat:n,subset:i,setDifference:o,Index:a}=e;return t(ap,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new a(0)))return zn(t);if(0===i(r(t),new a(0)))return zn(e);const s=zn(e),u=zn(t);return n(o(s,u),o(u,s))}})})),up="setUnion",cp=he(up,["typed","size","concat","subset","setIntersect","setSymDifference","Index"],(e=>{let{typed:t,size:r,concat:n,subset:i,setIntersect:o,setSymDifference:a,Index:s}=e;return t(up,{"Array | Matrix, Array | Matrix":function(e,t){if(0===i(r(e),new s(0)))return zn(t);if(0===i(r(t),new s(0)))return zn(e);const u=zn(e),c=zn(t);return n(a(u,c),o(u,c))}})})),lp=he("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],(e=>{let{typed:t,matrix:r,addScalar:n,equalScalar:i,DenseMatrix:o,SparseMatrix:a,concat:s}=e;const u=sa({typed:t}),c=ua({typed:t,equalScalar:i}),l=ca({typed:t,DenseMatrix:o}),f=oa({typed:t,matrix:r,concat:s});return t("add",{"any, any":n,"any, any, ...any":t.referToSelf((e=>(t,r,n)=>{let i=e(t,r);for(let t=0;t<n.length;t++)i=e(i,n[t]);return i}))},f({elop:n,DS:u,SS:c,Ss:l}))})),fp="hypot",pp=he(fp,["typed","abs","addScalar","divideScalar","multiplyScalar","sqrt","smaller","isPositive"],(e=>{let{typed:t,abs:r,addScalar:n,divideScalar:i,multiplyScalar:o,sqrt:a,smaller:s,isPositive:u}=e;return t(fp,{"... number | BigNumber":c,Array:c,Matrix:e=>c(zn(e.toArray()))});function c(e){let t=0,c=0;for(let a=0;a<e.length;a++){if(x(e[a]))throw new TypeError("Unexpected type of argument to hypot");const l=r(e[a]);s(c,l)?(t=o(t,o(i(c,l),i(c,l))),t=n(t,1),c=l):t=n(t,u(l)?o(i(l,c),i(l,c)):l)}return o(c,a(t))}})),mp="norm",hp=he(mp,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],(e=>{let{typed:t,abs:r,add:n,pow:i,conj:o,sqrt:a,multiply:s,equalScalar:u,larger:c,smaller:l,matrix:f,ctranspose:p,eigs:m}=e;return t(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 h(f(e),2)},Matrix:function(e){return h(e,2)},"Array, number | BigNumber | string":function(e,t){return h(f(e),t)},"Matrix, number | BigNumber | string":function(e,t){return h(e,t)}});function h(e,t){const f=e.size();if(1===f.length)return function(e,t){if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){let t=0;return e.forEach((function(e){const n=r(e);c(n,t)&&(t=n)}),!0),t}(e);if(t===Number.NEGATIVE_INFINITY||"-inf"===t)return function(e){let t;return e.forEach((function(e){const n=r(e);t&&!l(n,t)||(t=n)}),!0),t||0}(e);if("fro"===t)return h(e,2);if("number"==typeof t&&!isNaN(t)){if(!u(t,0)){let o=0;return e.forEach((function(e){o=n(i(r(e),t),o)}),!0),i(o,1/t)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}(e,t);if(2===f.length){if(f[0]&&f[1])return function(e,t){if(1===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[1],s=n(t[a]||0,r(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if(t===Number.POSITIVE_INFINITY||"inf"===t)return function(e){const t=[];let i=0;return e.forEach((function(e,o){const a=o[0],s=n(t[a]||0,r(e));c(s,i)&&(i=s),t[a]=s}),!0),i}(e);if("fro"===t)return function(e){let t=0;return e.forEach((function(e,r){t=n(t,s(e,o(e)))})),r(a(t))}(e);if(2===t)return function(e){const t=e.size();if(t[0]!==t[1])throw new RangeError("Invalid matrix dimensions");const n=p(e),i=s(n,e),o=m(i).values.toArray(),u=o[o.length-1];return r(a(u))}(e);throw new Error("Unsupported parameter value "+t)}(e,t);throw new RangeError("Invalid matrix dimensions")}}})),dp=he("dot",["typed","addScalar","multiplyScalar","conj","size"],(e=>{let{typed:t,addScalar:r,multiplyScalar:n,conj:i,size:o}=e;return t("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(e,o){const u=a(e,o),c=E(e)?e._data:e,l=E(e)?e._datatype||e.getDataType():void 0,f=E(o)?o._data:o,p=E(o)?o._datatype||o.getDataType():void 0,m=2===s(e).length,h=2===s(o).length;let d=r,g=n;if(l&&p&&l===p&&"string"==typeof l&&"mixed"!==l){const e=l;d=t.find(r,[e,e]),g=t.find(n,[e,e])}if(!m&&!h){let e=g(i(c[0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t]));return e}if(!m&&h){let e=g(i(c[0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t]),f[t][0]));return e}if(m&&!h){let e=g(i(c[0][0]),f[0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t]));return e}if(m&&h){let e=g(i(c[0][0]),f[0][0]);for(let t=1;t<u;t++)e=d(e,g(i(c[t][0]),f[t][0]));return e}},"SparseMatrix, SparseMatrix":function(e,t){a(e,t);const i=e._index,o=e._values,s=t._index,u=t._values;let c=0;const l=r,f=n;let p=0,m=0;for(;p<i.length&&m<s.length;){const e=i[p],t=s[m];e<t?p++:e>t?m++:e===t&&(c=l(c,f(o[p],u[m])),p++,m++)}return c}});function a(e,t){const r=s(e),n=s(t);let i,o;if(1===r.length)i=r[0];else{if(2!==r.length||1!==r[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+r.join(", ")+")");i=r[0]}if(1===n.length)o=n[0];else{if(2!==n.length||1!==n[1])throw new RangeError("Expected a column vector, instead got a matrix of size ("+n.join(", ")+")");o=n[0]}if(i!==o)throw new RangeError("Vectors must have equal length ("+i+" != "+o+")");if(0===i)throw new RangeError("Cannot calculate the dot product of empty vectors");return i}function s(e){return E(e)?e.size():o(e)}})),gp=he("trace",["typed","matrix","add"],(e=>{let{typed:t,matrix:r,add:n}=e;return t("trace",{Array:function(e){return i(r(e))},SparseMatrix:function(e){const t=e._values,r=e._index,i=e._ptr,o=e._size,a=o[0],s=o[1];if(a===s){let e=0;if(t.length>0)for(let o=0;o<s;o++){const a=i[o],s=i[o+1];for(let i=a;i<s;i++){const a=r[i];if(a===o){e=n(e,t[i]);break}if(a>o)break}}return e}throw new RangeError("Matrix must be square (size: "+pn(o)+")")},DenseMatrix:i,any:ae});function i(e){const t=e._size,r=e._data;switch(t.length){case 1:if(1===t[0])return ae(r[0]);throw new RangeError("Matrix must be square (size: "+pn(t)+")");case 2:{const e=t[0];if(e===t[1]){let t=0;for(let i=0;i<e;i++)t=n(t,r[i][i]);return t}throw new RangeError("Matrix must be square (size: "+pn(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pn(t)+")")}}})),yp="index",xp=he(yp,["typed","Index"],(e=>{let{typed:t,Index:r}=e;return t(yp,{"...number | string | BigNumber | Range | Array | Matrix":function(e){const t=e.map((function(e){return g(e)?e.toNumber():N(e)||E(e)?e.map((function(e){return g(e)?e.toNumber():e})):e})),n=new r;return r.apply(n,t),n}})})),bp=new Set(["end"]),vp=he("Node",["mathWithTransform"],(e=>{let{mathWithTransform:t}=e;return class{get type(){return"Node"}get isNode(){return!0}evaluate(e){return this.compile().evaluate(e)}compile(){const e=this._compile(t,{}),r={};return{evaluate:function(t){const n=h(t);return function(e){for(const t of[...bp])if(e.has(t))throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(n),e(n,r,null)}}}_compile(e,t){throw new Error("Method _compile must be implemented by type "+this.type)}forEach(e){throw new Error("Cannot run forEach on a Node interface")}map(e){throw new Error("Cannot run map on a Node interface")}_ifNode(e){if(!X(e))throw new TypeError("Callback function must return a Node");return e}traverse(e){e(this,null,null),function e(t,r){t.forEach((function(t,n,i){r(t,n,i),e(t,r)}))}(this,e)}transform(e){return function t(r,n,i){const o=e(r,n,i);return o!==r?o:r.map(t)}(this,null,null)}filter(e){const t=[];return this.traverse((function(r,n,i){e(r,n,i)&&t.push(r)})),t}clone(){throw new Error("Cannot clone a Node interface")}cloneDeep(){return this.map((function(e){return e.cloneDeep()}))}equals(e){return!!e&&this.type===e.type&&ce(this,e)}toString(e){const t=this._getCustomString(e);return void 0!==t?t:this._toString(e)}_toString(){throw new Error("_toString not implemented for "+this.type)}toJSON(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)}toHTML(e){const t=this._getCustomString(e);return void 0!==t?t:this._toHTML(e)}_toHTML(){throw new Error("_toHTML not implemented for "+this.type)}toTex(e){const t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)}_toTex(e){throw new Error("_toTex not implemented for "+this.type)}_getCustomString(e){if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw new TypeError("Object or function expected as callback")}}getIdentifier(){return this.type}getContent(){return this}}}),{isClass:!0,isNode:!0});function wp(e){return wp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wp(e)}function Np(e,t,r){return(t=function(e){var t=function(e){if("object"!=wp(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=wp(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==wp(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ep(e){return e&&e.isIndexError?new bn(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function Ap(e){let{subset:t}=e;return function(e,r){try{if(Array.isArray(e))return t(e,r);if(e&&"function"==typeof e.subset)return e.subset(r);if("string"==typeof e)return t(e,r);if("object"==typeof e){if(!r.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return i(e,r.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Ep(e)}}}const Sp="AccessorNode",Mp=he(Sp,["subset","Node"],(e=>{let{subset:t,Node:r}=e;const n=Ap({subset:t});function o(e){return!(U(e)||L(e)||V(e)||Y(e)||Q(e)||ee(e)||ne(e))}class a extends r{constructor(e,t){if(super(),!X(e))throw new TypeError('Node expected for parameter "object"');if(!J(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e,this.index=t}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Sp}get isAccessorNode(){return!0}_compile(e,t){const r=this.object._compile(e,t),o=this.index._compile(e,t);if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,n,o){return i(r(t,n,o),e)}}return function(e,t,i){const a=r(e,t,i),s=o(e,t,a);return n(a,s)}}forEach(e){e(this.object,"object",this),e(this.index,"index",this)}map(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))}clone(){return new a(this.object,this.index)}_toString(e){let t=this.object.toString(e);return o(this.object)&&(t="("+t+")"),t+this.index.toString(e)}_toHTML(e){let t=this.object.toHTML(e);return o(this.object)&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t+this.index.toHTML(e)}_toTex(e){let t=this.object.toTex(e);return o(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)}toJSON(){return{mathjs:Sp,object:this.object,index:this.index}}static fromJSON(e){return new a(e.object,e.index)}}return Np(a,"name",Sp),a}),{isClass:!0,isNode:!0}),Cp="ArrayNode",Tp=he(Cp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){if(super(),this.items=e||[],!Array.isArray(this.items)||!this.items.every(X))throw new TypeError("Array containing Nodes expected")}get type(){return Cp}get isArrayNode(){return!0}_compile(e,t){const r=kn(this.items,(function(r){return r._compile(e,t)}));if("Array"!==e.config.matrix){const t=e.matrix;return function(e,n,i){return t(kn(r,(function(t){return t(e,n,i)})))}}return function(e,t,n){return kn(r,(function(r){return r(e,t,n)}))}}forEach(e){for(let t=0;t<this.items.length;t++)e(this.items[t],"items["+t+"]",this)}map(e){const t=[];for(let r=0;r<this.items.length;r++)t[r]=this._ifNode(e(this.items[r],"items["+r+"]",this));return new r(t)}clone(){return new r(this.items.slice(0))}_toString(e){return"["+this.items.map((function(t){return t.toString(e)})).join(", ")+"]"}toJSON(){return{mathjs:Cp,items:this.items}}static fromJSON(e){return new r(e.items)}_toHTML(e){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map((function(t){return t.toHTML(e)})).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){return function t(r,n){const i=r.some(L)&&!r.every(L),o=n||i,a=o?"&":"\\\\",s=r.map((function(r){return r.items?t(r.items,!n):r.toTex(e)})).join(a);return i||!o||o&&!n?"\\begin{bmatrix}"+s+"\\end{bmatrix}":s}(this.items,!1)}}return Np(r,"name",Cp),r}),{isClass:!0,isNode:!0}),Dp=[{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 Bp(e,t){if(!t||"auto"!==t)return e;let r=e;for(;ee(r);)r=r.content;return r}function Fp(e,t,r,n){let i=e;"keep"!==t&&(i=e.getContent());const o=i.getIdentifier();let a=null;for(let e=0;e<Dp.length;e++)if(o in Dp[e]){a=e;break}if("OperatorNode:multiply"===o&&i.implicit&&"show"!==r){const e=Bp(i.args[0],t);V(e)&&n&&"OperatorNode:divide"===n.getIdentifier()&&W(Bp(n.args[0],t))||"OperatorNode:divide"===e.getIdentifier()&&W(Bp(e.args[0],t))&&V(Bp(e.args[1]))||(a+=1)}return a}function Op(e,t){let r=e;"keep"!==t&&(r=e.getContent());const n=r.getIdentifier(),i=Fp(r,t);if(null===i)return null;const o=Dp[i][n];if(me(o,"associativity")){if("left"===o.associativity)return"left";if("right"===o.associativity)return"right";throw Error("'"+n+"' has the invalid associativity '"+o.associativity+"'.")}return null}function _p(e,t,r){const n="keep"!==r?e.getContent():e,i="keep"!==r?e.getContent():t,o=n.getIdentifier(),a=i.getIdentifier(),s=Fp(n,r);if(null===s)return null;const u=Dp[s][o];if(me(u,"associativeWith")&&u.associativeWith instanceof Array){for(let e=0;e<u.associativeWith.length;e++)if(u.associativeWith[e]===a)return!0;return!1}return null}const Ip="AssignmentNode",zp=he(Ip,["subset","?matrix","Node"],(e=>{let{subset:t,matrix:r,Node:n}=e;const a=Ap({subset:t}),s=function(e){let{subset:t,matrix:r}=e;return function(e,n,i){try{if(Array.isArray(e))return r(e).subset(n,i).valueOf().forEach(((t,r)=>{e[r]=t})),e;if(e&&"function"==typeof e.subset)return e.subset(n,i);if("string"==typeof e)return t(e,n,i);if("object"==typeof e){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return o(e,n.getObjectProperty(),i),e}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw Ep(e)}}}({subset:t,matrix:r});function u(e,t,r){t||(t="keep");const n=Fp(e,t,r),i=Fp(e.value,t,r);return"all"===t||null!==i&&i<=n}class c extends n{constructor(e,t,r){if(super(),this.object=e,this.index=r?t:null,this.value=r||t,!ne(e)&&!U(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(ne(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!J(this.index))throw new TypeError('IndexNode expected as "index"');if(!X(this.value))throw new TypeError('Node expected as "value"')}get name(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}get type(){return Ip}get isAssignmentNode(){return!0}_compile(e,t){const r=this.object._compile(e,t),n=this.index?this.index._compile(e,t):null,u=this.value._compile(e,t),c=this.object.name;if(this.index){if(this.index.isObjectProperty()){const e=this.index.getObjectProperty();return function(t,n,i){const a=r(t,n,i),s=u(t,n,i);return o(a,e,s),s}}if(ne(this.object))return function(e,t,i){const o=r(e,t,i),a=u(e,t,i),l=n(e,t,o);return e.set(c,s(o,l,a)),a};{const r=this.object.object._compile(e,t);if(this.object.index.isObjectProperty()){const e=this.object.index.getObjectProperty();return function(t,a,c){const l=r(t,a,c),f=i(l,e),p=n(t,a,f),m=u(t,a,c);return o(l,e,s(f,p,m)),m}}{const i=this.object.index._compile(e,t);return function(e,t,o){const c=r(e,t,o),l=i(e,t,c),f=a(c,l),p=n(e,t,f),m=u(e,t,o);return s(c,l,s(f,p,m)),m}}}}if(!ne(this.object))throw new TypeError("SymbolNode expected as object");return function(e,t,r){const n=u(e,t,r);return e.set(c,n),n}}forEach(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)}map(e){const t=this._ifNode(e(this.object,"object",this)),r=this.index?this._ifNode(e(this.index,"index",this)):null,n=this._ifNode(e(this.value,"value",this));return new c(t,r,n)}clone(){return new c(this.object,this.index,this.value)}_toString(e){const t=this.object.toString(e),r=this.index?this.index.toString(e):"";let n=this.value.toString(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(n="("+n+")"),t+r+" = "+n}toJSON(){return{mathjs:Ip,object:this.object,index:this.index,value:this.value}}static fromJSON(e){return new c(e.object,e.index,e.value)}_toHTML(e){const t=this.object.toHTML(e),r=this.index?this.index.toHTML(e):"";let n=this.value.toHTML(e);return u(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>'),t+r+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n}_toTex(e){const t=this.object.toTex(e),r=this.index?this.index.toTex(e):"";let n=this.value.toTex(e);return u(this,e&&e.parenthesis,e&&e.implicit)&&(n=`\\left(${n}\\right)`),t+r+"="+n}}return Np(c,"name",Ip),c}),{isClass:!0,isNode:!0}),kp="BlockNode",Rp=he(kp,["ResultSet","Node"],(e=>{let{ResultSet:t,Node:r}=e;class n extends r{constructor(e){if(super(),!Array.isArray(e))throw new Error("Array expected");this.blocks=e.map((function(e){const t=e&&e.node,r=!e||void 0===e.visible||e.visible;if(!X(t))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:t,visible:r}}))}get type(){return kp}get isBlockNode(){return!0}_compile(e,r){const n=kn(this.blocks,(function(t){return{evaluate:t.node._compile(e,r),visible:t.visible}}));return function(e,r,i){const o=[];return Rn(n,(function(t){const n=t.evaluate(e,r,i);t.visible&&o.push(n)})),new t(o)}}forEach(e){for(let t=0;t<this.blocks.length;t++)e(this.blocks[t].node,"blocks["+t+"].node",this)}map(e){const t=[];for(let r=0;r<this.blocks.length;r++){const n=this.blocks[r],i=this._ifNode(e(n.node,"blocks["+r+"].node",this));t[r]={node:i,visible:n.visible}}return new n(t)}clone(){const e=this.blocks.map((function(e){return{node:e.node,visible:e.visible}}));return new n(e)}_toString(e){return this.blocks.map((function(t){return t.node.toString(e)+(t.visible?"":";")})).join("\n")}toJSON(){return{mathjs:kp,blocks:this.blocks}}static fromJSON(e){return new n(e.blocks)}_toHTML(e){return this.blocks.map((function(t){return t.node.toHTML(e)+(t.visible?"":'<span class="math-separator">;</span>')})).join('<span class="math-separator"><br /></span>')}_toTex(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")}}return Np(n,"name",kp),n}),{isClass:!0,isNode:!0}),qp="ConditionalNode",Pp=he(qp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e,t,r){if(super(),!X(e))throw new TypeError("Parameter condition must be a Node");if(!X(t))throw new TypeError("Parameter trueExpr must be a Node");if(!X(r))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=r}get type(){return qp}get isConditionalNode(){return!0}_compile(e,t){const r=this.condition._compile(e,t),n=this.trueExpr._compile(e,t),i=this.falseExpr._compile(e,t);return function(e,t,o){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(g(e))return!e.isZero();if(x(e))return!(!e.re&&!e.im);if(v(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+oe(e)+'"')}(r(e,t,o))?n(e,t,o):i(e,t,o)}}forEach(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)}map(e){return new r(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))}clone(){return new r(this.condition,this.trueExpr,this.falseExpr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Fp(this,t,e&&e.implicit);let n=this.condition.toString(e);const i=Fp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n="("+n+")");let o=this.trueExpr.toString(e);const a=Fp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=r)&&(o="("+o+")");let s=this.falseExpr.toString(e);const u=Fp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(s="("+s+")"),n+" ? "+o+" : "+s}toJSON(){return{mathjs:qp,condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}}static fromJSON(e){return new r(e.condition,e.trueExpr,e.falseExpr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Fp(this,t,e&&e.implicit);let n=this.condition.toHTML(e);const i=Fp(this.condition,t,e&&e.implicit);("all"===t||"OperatorNode"===this.condition.type||null!==i&&i<=r)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>');let o=this.trueExpr.toHTML(e);const a=Fp(this.trueExpr,t,e&&e.implicit);("all"===t||"OperatorNode"===this.trueExpr.type||null!==a&&a<=r)&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>');let s=this.falseExpr.toHTML(e);const u=Fp(this.falseExpr,t,e&&e.implicit);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==u&&u<=r)&&(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>'+o+'<span class="math-operator math-conditional-operator">:</span>'+s}_toTex(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"}}return Np(r,"name",qp),r}),{isClass:!0,isNode:!0});var jp=r(3144);const Up={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{?}"},Lp={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"},$p={abs:{1:"\\left|${args[0]}\\right|"},add:{2:`\\left(\${args[0]}${Lp.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]}${Lp.dotDivide}\${args[1]}\\right)`},dotMultiply:{2:`\\left(\${args[0]}${Lp.dotMultiply}\${args[1]}\\right)`},dotPow:{2:`\\left(\${args[0]}${Lp.dotPow}\${args[1]}\\right)`},exp:{1:"\\exp\\left(${args[0]}\\right)"},expm1:`\\left(e${Lp.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]}${Lp.mod}\${args[1]}\\right)`},multiply:{2:`\\left(\${args[0]}${Lp.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)${Lp.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]}${Lp.subtract}\${args[1]}\\right)`},unaryMinus:{1:`${Lp.unaryMinus}\\left(\${args[0]}\\right)`},unaryPlus:{1:`${Lp.unaryPlus}\\left(\${args[0]}\\right)`},bitAnd:{2:`\\left(\${args[0]}${Lp.bitAnd}\${args[1]}\\right)`},bitNot:{1:Lp.bitNot+"\\left(${args[0]}\\right)"},bitOr:{2:`\\left(\${args[0]}${Lp.bitOr}\${args[1]}\\right)`},bitXor:{2:`\\left(\${args[0]}${Lp.bitXor}\${args[1]}\\right)`},leftShift:{2:`\\left(\${args[0]}${Lp.leftShift}\${args[1]}\\right)`},rightArithShift:{2:`\\left(\${args[0]}${Lp.rightArithShift}\${args[1]}\\right)`},rightLogShift:{2:`\\left(\${args[0]}${Lp.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]}${Lp.and}\${args[1]}\\right)`},not:{1:Lp.not+"\\left(${args[0]}\\right)"},or:{2:`\\left(\${args[0]}${Lp.or}\${args[1]}\\right)`},xor:{2:`\\left(\${args[0]}${Lp.xor}\${args[1]}\\right)`},cross:{2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},ctranspose:{1:`\\left(\${args[0]}\\right)${Lp.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]}}${Lp.pow}{\\frac{1}{2}}`},trace:{1:"\\mathrm{tr}\\left(${args[0]}\\right)"},transpose:{1:`\\left(\${args[0]}\\right)${Lp.transpose}`},combinations:{2:"\\binom{${args[0]}}{${args[1]}}"},combinationsWithRep:{2:"\\left(\\!\\!{\\binom{${args[0]}}{${args[1]}}}\\!\\!\\right)"},factorial:{1:`\\left(\${args[0]}\\right)${Lp.factorial}`},gamma:{1:"\\Gamma\\left(${args[0]}\\right)"},lgamma:{1:"\\ln\\Gamma\\left(${args[0]}\\right)"},equal:{2:`\\left(\${args[0]}${Lp.equal}\${args[1]}\\right)`},larger:{2:`\\left(\${args[0]}${Lp.larger}\${args[1]}\\right)`},largerEq:{2:`\\left(\${args[0]}${Lp.largerEq}\${args[1]}\\right)`},smaller:{2:`\\left(\${args[0]}${Lp.smaller}\${args[1]}\\right)`},smallerEq:{2:`\\left(\${args[0]}${Lp.smallerEq}\${args[1]}\\right)`},unequal:{2:`\\left(\${args[0]}${Lp.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]}${Lp.to}\${args[1]}\\right)`},numeric:function(e,t){return e.args[0].toTex()},number:{0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},string:{0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},bignumber:{0:"0",1:"\\left(${args[0]}\\right)"},bigint:{0:"0",1:"\\left(${args[0]}\\right)"},complex:{0:"0",1:"\\left(${args[0]}\\right)",2:`\\left(\\left(\${args[0]}\\right)+${Up.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)"}},Hp={deg:"^\\circ"};function Gp(e){return jp(e,{preserveFormatting:!0})}function Vp(e,t){return(t=void 0!==t&&t)?me(Hp,e)?Hp[e]:"\\mathrm{"+Gp(e)+"}":me(Up,e)?Up[e]:Gp(e)}const Wp="ConstantNode",Zp=he(Wp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){super(),this.value=e}get type(){return Wp}get isConstantNode(){return!0}_compile(e,t){const r=this.value;return function(){return r}}forEach(e){}map(e){return this.clone()}clone(){return new r(this.value)}_toString(e){return pn(this.value,e)}_toHTML(e){const t=this._toString(e);switch(oe(this.value)){case"number":case"bigint":case"BigNumber":case"Fraction":return'<span class="math-number">'+t+"</span>";case"string":return'<span class="math-string">'+t+"</span>";case"boolean":return'<span class="math-boolean">'+t+"</span>";case"null":return'<span class="math-null-symbol">'+t+"</span>";case"undefined":return'<span class="math-undefined">'+t+"</span>";default:return'<span class="math-symbol">'+t+"</span>"}}toJSON(){return{mathjs:Wp,value:this.value}}static fromJSON(e){return new r(e.value)}_toTex(e){const t=this._toString(e),r=oe(this.value);switch(r){case"string":return"\\mathtt{"+Gp(t)+"}";case"number":case"BigNumber":{if(!("BigNumber"===r?this.value.isFinite():isFinite(this.value)))return this.value.valueOf()<0?"-\\infty":"\\infty";const e=t.toLowerCase().indexOf("e");return-1!==e?t.substring(0,e)+"\\cdot10^{"+t.substring(e+1)+"}":t}case"bigint":return t.toString();case"Fraction":return this.value.toLatex();default:return t}}}return Np(r,"name",Wp),r}),{isClass:!0,isNode:!0}),Yp="FunctionAssignmentNode",Jp=he(Yp,["typed","Node"],(e=>{let{typed:t,Node:r}=e;function n(e,t,r){const n=Fp(e,t,r),i=Fp(e.expr,t,r);return"all"===t||null!==i&&i<=n}class i extends r{constructor(e,t,r){if(super(),"string"!=typeof e)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(t))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!X(r))throw new TypeError('Node expected for parameter "expr"');if(bp.has(e))throw new Error('Illegal function name, "'+e+'" is a reserved keyword');const n=new Set;for(const e of t){const t="string"==typeof e?e:e.name;if(n.has(t))throw new Error(`Duplicate parameter name "${t}"`);n.add(t)}this.name=e,this.params=t.map((function(e){return e&&e.name||e})),this.types=t.map((function(e){return e&&e.type||"any"})),this.expr=r}get type(){return Yp}get isFunctionAssignmentNode(){return!0}_compile(e,r){const n=Object.create(r);Rn(this.params,(function(e){n[e]=!0}));const i=this.expr._compile(e,n),o=this.name,a=this.params,s=Pn(this.types,","),u=o+"("+Pn(this.params,", ")+")";return function(e,r,n){const c={};c[s]=function(){const t=Object.create(r);for(let e=0;e<a.length;e++)t[a[e]]=arguments[e];return i(e,t,n)};const l=t(o,c);return l.syntax=u,e.set(o,l),l}}forEach(e){e(this.expr,"expr",this)}map(e){const t=this._ifNode(e(this.expr,"expr",this));return new i(this.name,this.params.slice(0),t)}clone(){return new i(this.name,this.params.slice(0),this.expr)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let r=this.expr.toString(e);return n(this,t,e&&e.implicit)&&(r="("+r+")"),this.name+"("+this.params.join(", ")+") = "+r}toJSON(){const e=this.types;return{mathjs:Yp,name:this.name,params:this.params.map((function(t,r){return{name:t,type:e[r]}})),expr:this.expr}}static fromJSON(e){return new i(e.name,e.params,e.expr)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=[];for(let e=0;e<this.params.length;e++)r.push('<span class="math-symbol math-parameter">'+dn(this.params[e])+"</span>");let i=this.expr.toHTML(e);return n(this,t,e&&e.implicit)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+dn(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+r.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+i}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep";let r=this.expr.toTex(e);return n(this,t,e&&e.implicit)&&(r=`\\left(${r}\\right)`),"\\mathrm{"+this.name+"}\\left("+this.params.map(Vp).join(",")+"\\right)="+r}}return Np(i,"name",Yp),i}),{isClass:!0,isNode:!0}),Xp="IndexNode",Qp=he(Xp,["Node","size"],(e=>{let{Node:t,size:r}=e;class n extends t{constructor(e,t){if(super(),this.dimensions=e,this.dotNotation=t||!1,!Array.isArray(e)||!e.every(X))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties")}get type(){return Xp}get isIndexNode(){return!0}_compile(e,t){const n=kn(this.dimensions,(function(n,i){if(n.filter((e=>e.isSymbolNode&&"end"===e.name)).length>0){const o=Object.create(t);o.end=!0;const a=n._compile(e,o);return function(e,t,n){if(!E(n)&&!N(n)&&!w(n))throw new TypeError('Cannot resolve "end": context must be a Matrix, Array, or string but is '+oe(n));const o=r(n).valueOf(),s=Object.create(t);return s.end=o[i],a(e,s,n)}}return n._compile(e,t)})),o=i(e,"index");return function(e,t,r){const i=kn(n,(function(n){return n(e,t,r)}));return o(...i)}}forEach(e){for(let t=0;t<this.dimensions.length;t++)e(this.dimensions[t],"dimensions["+t+"]",this)}map(e){const t=[];for(let r=0;r<this.dimensions.length;r++)t[r]=this._ifNode(e(this.dimensions[r],"dimensions["+r+"]",this));return new n(t,this.dotNotation)}clone(){return new n(this.dimensions.slice(0),this.dotNotation)}isObjectProperty(){return 1===this.dimensions.length&&V(this.dimensions[0])&&"string"==typeof this.dimensions[0].value}getObjectProperty(){return this.isObjectProperty()?this.dimensions[0].value:null}_toString(e){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"}toJSON(){return{mathjs:Xp,dimensions:this.dimensions,dotNotation:this.dotNotation}}static fromJSON(e){return new n(e.dimensions,e.dotNotation)}_toHTML(e){const t=[];for(let e=0;e<this.dimensions.length;e++)t[e]=this.dimensions[e].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+dn(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'}_toTex(e){const t=this.dimensions.map((function(t){return t.toTex(e)}));return this.dotNotation?"."+this.getObjectProperty():"_{"+t.join(",")+"}"}}return Np(n,"name",Xp),n}),{isClass:!0,isNode:!0}),Kp="ObjectNode",em=he(Kp,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){if(super(),this.properties=e||{},e&&("object"!=typeof e||!Object.keys(e).every((function(t){return X(e[t])}))))throw new TypeError("Object containing Nodes expected")}get type(){return Kp}get isObjectNode(){return!0}_compile(e,t){const r={};for(const n in this.properties)if(me(this.properties,n)){const o=mn(n),a=JSON.parse(o),s=i(this.properties,n);r[a]=s._compile(e,t)}return function(e,t,n){const i={};for(const o in r)me(r,o)&&(i[o]=r[o](e,t,n));return i}}forEach(e){for(const t in this.properties)me(this.properties,t)&&e(this.properties[t],"properties["+mn(t)+"]",this)}map(e){const t={};for(const r in this.properties)me(this.properties,r)&&(t[r]=this._ifNode(e(this.properties[r],"properties["+mn(r)+"]",this)));return new r(t)}clone(){const e={};for(const t in this.properties)me(this.properties,t)&&(e[t]=this.properties[t]);return new r(e)}_toString(e){const t=[];for(const r in this.properties)me(this.properties,r)&&t.push(mn(r)+": "+this.properties[r].toString(e));return"{"+t.join(", ")+"}"}toJSON(){return{mathjs:Kp,properties:this.properties}}static fromJSON(e){return new r(e.properties)}_toHTML(e){const t=[];for(const r in this.properties)me(this.properties,r)&&t.push('<span class="math-symbol math-property">'+dn(r)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[r].toHTML(e));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'}_toTex(e){const t=[];for(const r in this.properties)me(this.properties,r)&&t.push("\\mathbf{"+r+":} & "+this.properties[r].toTex(e)+"\\\\");return"\\left\\{\\begin{array}{ll}"+t.join("\n")+"\\end{array}\\right\\}"}}return Np(r,"name",Kp),r}),{isClass:!0,isNode:!0});function tm(e,t){return new f(e,new l(t),new Set(Object.keys(t)))}const rm="OperatorNode",nm=he(rm,["Node"],(e=>{let{Node:t}=e;function r(e,t){let n=e;if("auto"===t)for(;ee(n);)n=n.content;return!!V(n)||!!K(n)&&r(n.args[0],t)}function n(e,t,n,i,o){const a=Fp(e,t,n),s=Op(e,t);if("all"===t||i.length>2&&"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier())return i.map((function(e){switch(e.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}}));let u;switch(i.length){case 0:u=[];break;case 1:{const r=Fp(i[0],t,n,e);if(o&&null!==r){let n,o;if("keep"===t?(n=i[0].getIdentifier(),o=e.getIdentifier()):(n=i[0].getContent().getIdentifier(),o=e.getContent().getIdentifier()),!1===Dp[a][o].latexLeftParens){u=[!1];break}if(!1===Dp[r][n].latexParens){u=[!1];break}}if(null===r){u=[!1];break}if(r<=a){u=[!0];break}u=[!1]}break;case 2:{let r;const c=Fp(i[0],t,n,e),l=_p(e,i[0],t);let f;r=null!==c&&(c===a&&"right"===s&&!l||c<a);const p=Fp(i[1],t,n,e),m=_p(e,i[1],t);if(f=null!==p&&(p===a&&"left"===s&&!m||p<a),o){let n,i,o;"keep"===t?(n=e.getIdentifier(),i=e.args[0].getIdentifier(),o=e.args[1].getIdentifier()):(n=e.getContent().getIdentifier(),i=e.args[0].getContent().getIdentifier(),o=e.args[1].getContent().getIdentifier()),null!==c&&(!1===Dp[a][n].latexLeftParens&&(r=!1),!1===Dp[c][i].latexParens&&(r=!1)),null!==p&&(!1===Dp[a][n].latexRightParens&&(f=!1),!1===Dp[p][o].latexParens&&(f=!1))}u=[r,f]}break;default:"OperatorNode:add"!==e.getIdentifier()&&"OperatorNode:multiply"!==e.getIdentifier()||(u=i.map((function(r){const i=Fp(r,t,n,e),o=_p(e,r,t),u=Op(r,t);return null!==i&&(a===i&&s===u&&!o||i<a)})))}if(i.length>=2&&"OperatorNode:multiply"===e.getIdentifier()&&e.implicit&&"all"!==t&&"hide"===n)for(let e=1;e<u.length;++e)!r(i[e],t)||u[e-1]||"keep"===t&&ee(i[e-1])||(u[e]=!0);return u}class o extends t{constructor(e,t,r,n,i){if(super(),"string"!=typeof e)throw new TypeError('string expected for parameter "op"');if("string"!=typeof t)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(r)||!r.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===n,this.isPercentage=!0===i,this.op=e,this.fn=t,this.args=r||[]}get type(){return rm}get isOperatorNode(){return!0}_compile(e,t){if("string"!=typeof this.fn||!s(e,this.fn))throw e[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');const r=i(e,this.fn),n=kn(this.args,(function(r){return r._compile(e,t)}));if("function"==typeof r&&!0===r.rawArgs){const t=this.args;return function(n,i,o){return r(t,e,tm(n,i))}}if(1===n.length){const e=n[0];return function(t,n,i){return r(e(t,n,i))}}if(2===n.length){const e=n[0],t=n[1];return function(n,i,o){return r(e(n,i,o),t(n,i,o))}}return function(e,t,i){return r.apply(null,kn(n,(function(r){return r(e,t,i)})))}}forEach(e){for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=[];for(let r=0;r<this.args.length;r++)t[r]=this._ifNode(e(this.args[r],"args["+r+"]",this));return new o(this.op,this.fn,t,this.implicit,this.isPercentage)}clone(){return new o(this.op,this.fn,this.args.slice(0),this.implicit,this.isPercentage)}isUnary(){return 1===this.args.length}isBinary(){return 2===this.args.length}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,o=n(this,t,r,i,!1);if(1===i.length){const r=Op(this,t);let n=i[0].toString(e);o[0]&&(n="("+n+")");const a=/[a-zA-Z]+/.test(this.op);return"right"===r?this.op+(a?" ":"")+n:"left"===r?n+(a?" ":"")+this.op:n+this.op}if(2===i.length){let t=i[0].toString(e),n=i[1].toString(e);return o[0]&&(t="("+t+")"),o[1]&&(n="("+n+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t+" "+n:t+" "+this.op+" "+n}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,r){return t=t.toString(e),o[r]&&(t="("+t+")"),t}));return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t.join(" "):t.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"}toJSON(){return{mathjs:rm,op:this.op,fn:this.fn,args:this.args,implicit:this.implicit,isPercentage:this.isPercentage}}static fromJSON(e){return new o(e.op,e.fn,e.args,e.implicit,e.isPercentage)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,o=n(this,t,r,i,!1);if(1===i.length){const r=Op(this,t);let n=i[0].toHTML(e);return o[0]&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===r?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+dn(this.op)+"</span>"+n:n+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+dn(this.op)+"</span>"}if(2===i.length){let t=i[0].toHTML(e),n=i[1].toHTML(e);return o[0]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),o[1]&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+n:t+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dn(this.op)+"</span>"+n}{const t=i.map((function(t,r){return t=t.toHTML(e),o[r]&&(t='<span class="math-parenthesis math-round-parenthesis">(</span>'+t+'<span class="math-parenthesis math-round-parenthesis">)</span>'),t}));return i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?t.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):t.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dn(this.op)+"</span>"):'<span class="math-function">'+dn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=e&&e.implicit?e.implicit:"hide",i=this.args,o=n(this,t,r,i,!0);let a=Lp[this.fn];if(a=void 0===a?this.op:a,1===i.length){const r=Op(this,t);let n=i[0].toTex(e);return o[0]&&(n=`\\left(${n}\\right)`),"right"===r?a+n:n+a}if(2===i.length){const n=i[0];let s=n.toTex(e);o[0]&&(s=`\\left(${s}\\right)`);let u,c=i[1].toTex(e);switch(o[1]&&(c=`\\left(${c}\\right)`),u="keep"===t?n.getIdentifier():n.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return a+"{"+s+"}{"+c+"}";case"OperatorNode:pow":switch(s="{"+s+"}",c="{"+c+"}",u){case"ConditionalNode":case"OperatorNode:divide":s=`\\left(${s}\\right)`}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===r)return s+"~"+c}return s+a+c}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){const t=i.map((function(t,r){return t=t.toTex(e),o[r]&&(t=`\\left(${t}\\right)`),t}));return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit&&"hide"===r?t.join("~"):t.join(a)}return"\\mathrm{"+this.fn+"}\\left("+i.map((function(t){return t.toTex(e)})).join(",")+"\\right)"}getIdentifier(){return this.type+":"+this.fn}}return Np(o,"name",rm),o}),{isClass:!0,isNode:!0}),im="ParenthesisNode",om=he(im,["Node"],(e=>{let{Node:t}=e;class r extends t{constructor(e){if(super(),!X(e))throw new TypeError('Node expected for parameter "content"');this.content=e}get type(){return im}get isParenthesisNode(){return!0}_compile(e,t){return this.content._compile(e,t)}getContent(){return this.content.getContent()}forEach(e){e(this.content,"content",this)}map(e){const t=e(this.content,"content",this);return new r(t)}clone(){return new r(this.content)}_toString(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?"("+this.content.toString(e)+")":this.content.toString(e)}toJSON(){return{mathjs:im,content:this.content}}static fromJSON(e){return new r(e.content)}_toHTML(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(e)}_toTex(e){return!e||e&&!e.parenthesis||e&&"keep"===e.parenthesis?`\\left(${this.content.toTex(e)}\\right)`:this.content.toTex(e)}}return Np(r,"name",im),r}),{isClass:!0,isNode:!0}),am="RangeNode",sm=he(am,["Node"],(e=>{let{Node:t}=e;function r(e,t,r){const n=Fp(e,t,r),i={},o=Fp(e.start,t,r);if(i.start=null!==o&&o<=n||"all"===t,e.step){const o=Fp(e.step,t,r);i.step=null!==o&&o<=n||"all"===t}const a=Fp(e.end,t,r);return i.end=null!==a&&a<=n||"all"===t,i}class n extends t{constructor(e,t,r){if(super(),!X(e))throw new TypeError("Node expected");if(!X(t))throw new TypeError("Node expected");if(r&&!X(r))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=e,this.end=t,this.step=r||null}get type(){return am}get isRangeNode(){return!0}needsEnd(){return this.filter((function(e){return ne(e)&&"end"===e.name})).length>0}_compile(e,t){const r=e.range,n=this.start._compile(e,t),i=this.end._compile(e,t);if(this.step){const o=this.step._compile(e,t);return function(e,t,a){return r(n(e,t,a),i(e,t,a),o(e,t,a))}}return function(e,t,o){return r(n(e,t,o),i(e,t,o))}}forEach(e){e(this.start,"start",this),e(this.end,"end",this),this.step&&e(this.step,"step",this)}map(e){return new 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){const t=r(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let n,i=this.start.toString(e);if(t.start&&(i="("+i+")"),n=i,this.step){let r=this.step.toString(e);t.step&&(r="("+r+")"),n+=":"+r}let o=this.end.toString(e);return t.end&&(o="("+o+")"),n+=":"+o,n}toJSON(){return{mathjs:am,start:this.start,end:this.end,step:this.step}}static fromJSON(e){return new n(e.start,e.end,e.step)}_toHTML(e){const t=r(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let n,i=this.start.toHTML(e);if(t.start&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n=i,this.step){let r=this.step.toHTML(e);t.step&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+='<span class="math-operator math-range-operator">:</span>'+r}let o=this.end.toHTML(e);return t.end&&(o='<span class="math-parenthesis math-round-parenthesis">(</span>'+o+'<span class="math-parenthesis math-round-parenthesis">)</span>'),n+='<span class="math-operator math-range-operator">:</span>'+o,n}_toTex(e){const t=r(this,e&&e.parenthesis?e.parenthesis:"keep",e&&e.implicit);let n=this.start.toTex(e);if(t.start&&(n=`\\left(${n}\\right)`),this.step){let r=this.step.toTex(e);t.step&&(r=`\\left(${r}\\right)`),n+=":"+r}let i=this.end.toTex(e);return t.end&&(i=`\\left(${i}\\right)`),n+=":"+i,n}}return Np(n,"name",am),n}),{isClass:!0,isNode:!0}),um="RelationalNode",cm=he(um,["Node"],(e=>{let{Node:t}=e;const r={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="};class n extends t{constructor(e,t){if(super(),!Array.isArray(e))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(t))throw new TypeError("Parameter params must be an array");if(e.length!==t.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=e,this.params=t}get type(){return um}get isRelationalNode(){return!0}_compile(e,t){const r=this,n=this.params.map((r=>r._compile(e,t)));return function(t,o,a){let s,u=n[0](t,o,a);for(let c=0;c<r.conditionals.length;c++)if(s=u,u=n[c+1](t,o,a),!i(e,r.conditionals[c])(s,u))return!1;return!0}}forEach(e){this.params.forEach(((t,r)=>e(t,"params["+r+"]",this)),this)}map(e){return new n(this.conditionals.slice(),this.params.map(((t,r)=>this._ifNode(e(t,"params["+r+"]",this))),this))}clone(){return new n(this.conditionals,this.params)}_toString(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Fp(this,t,e&&e.implicit),i=this.params.map((function(r,i){const o=Fp(r,t,e&&e.implicit);return"all"===t||null!==o&&o<=n?"("+r.toString(e)+")":r.toString(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+=" "+r[this.conditionals[e]],o+=" "+i[e+1];return o}toJSON(){return{mathjs:um,conditionals:this.conditionals,params:this.params}}static fromJSON(e){return new n(e.conditionals,e.params)}_toHTML(e){const t=e&&e.parenthesis?e.parenthesis:"keep",n=Fp(this,t,e&&e.implicit),i=this.params.map((function(r,i){const o=Fp(r,t,e&&e.implicit);return"all"===t||null!==o&&o<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+r.toHTML(e)+'<span class="math-parenthesis math-round-parenthesis">)</span>':r.toHTML(e)}));let o=i[0];for(let e=0;e<this.conditionals.length;e++)o+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+dn(r[this.conditionals[e]])+"</span>"+i[e+1];return o}_toTex(e){const t=e&&e.parenthesis?e.parenthesis:"keep",r=Fp(this,t,e&&e.implicit),n=this.params.map((function(n,i){const o=Fp(n,t,e&&e.implicit);return"all"===t||null!==o&&o<=r?"\\left("+n.toTex(e)+"\right)":n.toTex(e)}));let i=n[0];for(let e=0;e<this.conditionals.length;e++)i+=Lp[this.conditionals[e]]+n[e+1];return i}}return Np(n,"name",um),n}),{isClass:!0,isNode:!0}),lm=he("SymbolNode",["math","?Unit","Node"],(e=>{let{math:t,Unit:r,Node:n}=e;function o(e){return!!r&&r.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,t){const n=this.name;if(!0===t[n])return function(e,t,r){return i(t,n)};if(n in e)return function(t,r,o){return t.has(n)?t.get(n):i(e,n)};{const e=o(n);return function(t,i,o){return t.has(n)?t.get(n):e?new r(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){const t=dn(this.name);return"true"===t||"false"===t?'<span class="math-symbol math-boolean">'+t+"</span>":"i"===t?'<span class="math-symbol math-imaginary-symbol">'+t+"</span>":"Infinity"===t?'<span class="math-symbol math-infinity-symbol">'+t+"</span>":"NaN"===t?'<span class="math-symbol math-nan-symbol">'+t+"</span>":"null"===t?'<span class="math-symbol math-null-symbol">'+t+"</span>":"undefined"===t?'<span class="math-symbol math-undefined-symbol">'+t+"</span>":'<span class="math-symbol">'+t+"</span>"}toJSON(){return{mathjs:"SymbolNode",name:this.name}}static fromJSON(e){return new a(e.name)}_toTex(e){let r=!1;void 0===t[this.name]&&o(this.name)&&(r=!0);const n=Vp(this.name,r);return"\\"===n[0]?n:" "+n}}return a}),{isClass:!0,isNode:!0}),fm="FunctionNode",pm=he(fm,["math","Node","SymbolNode"],(e=>{var t;let{math:r,Node:n,SymbolNode:o}=e;const a=e=>pn(e,{truncate:78});function u(e,t,r){let n="";const i=/\$(?:\{([a-z_][a-z_0-9]*)(?:\[([0-9]+)\])?\}|\$)/gi;let o,a=0;for(;null!==(o=i.exec(e));)if(n+=e.substring(a,o.index),a=o.index,"$$"===o[0])n+="$",a++;else{a+=o[0].length;const e=t[o[1]];if(!e)throw new ReferenceError("Template: Property "+o[1]+" does not exist.");if(void 0===o[2])switch(typeof e){case"string":n+=e;break;case"object":if(X(e))n+=e.toTex(r);else{if(!Array.isArray(e))throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes");n+=e.map((function(e,t){if(X(e))return e.toTex(r);throw new TypeError("Template: "+o[1]+"["+t+"] is not a Node.")})).join(",")}break;default:throw new TypeError("Template: "+o[1]+" has to be a Node, String or array of Nodes")}else{if(!X(e[o[2]]&&e[o[2]]))throw new TypeError("Template: "+o[1]+"["+o[2]+"] is not a Node.");n+=e[o[2]].toTex(r)}}return n+=e.slice(a),n}class c extends n{constructor(e,t){if(super(),"string"==typeof e&&(e=new o(e)),!X(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(t)||!t.every(X))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=t||[]}get name(){return this.fn.name||""}get type(){return fm}get isFunctionNode(){return!0}_compile(e,t){const r=this.args.map((r=>r._compile(e,t)));if(!ne(this.fn)){if(U(this.fn)&&J(this.fn.index)&&this.fn.index.isObjectProperty()){const n=this.fn.object._compile(e,t),i=this.fn.index.getObjectProperty(),o=this.args;return function(t,a,u){const c=n(t,a,u),l=function(e,t){if(!s(e,t))throw new Error('No access to method "'+t+'"');return e[t]}(c,i);if(null!=l&&l.rawArgs)return l(o,e,tm(t,a));{const e=r.map((e=>e(t,a,u)));return l.apply(c,e)}}}{const n=this.fn.toString(),i=this.fn._compile(e,t),o=this.args;return function(t,s,u){const c=i(t,s,u);if("function"!=typeof c)throw new TypeError(`Expression '${n}' did not evaluate to a function; value is:\n ${a(c)}`);if(c.rawArgs)return c(o,e,tm(t,s));{const e=r.map((e=>e(t,s,u)));return c.apply(c,e)}}}}{const n=this.fn.name;if(t[n]){const t=this.args;return function(o,s,u){const c=i(s,n);if("function"!=typeof c)throw new TypeError(`Argument '${n}' was not a function; received: ${a(c)}`);if(c.rawArgs)return c(t,e,tm(o,s));{const e=r.map((e=>e(o,s,u)));return c.apply(c,e)}}}{const t=n in e?i(e,n):void 0,o="function"==typeof t&&!0===t.rawArgs,s=t=>{let r;if(t.has(n))r=t.get(n);else{if(!(n in e))return c.onUndefinedFunction(n);r=i(e,n)}if("function"==typeof r)return r;throw new TypeError(`'${n}' is not a function; its value is:\n ${a(r)}`)};if(o){const t=this.args;return function(n,i,o){const a=s(n);return!0===a.rawArgs?a(t,e,tm(n,i)):a(...r.map((e=>e(n,i,o))))}}switch(r.length){case 0:return function(e,t,r){return s(e)()};case 1:return function(e,t,n){return s(e)((0,r[0])(e,t,n))};case 2:return function(e,t,n){const i=s(e),o=r[0],a=r[1];return i(o(e,t,n),a(e,t,n))};default:return function(e,t,n){return s(e)(...r.map((r=>r(e,t,n))))}}}}}forEach(e){e(this.fn,"fn",this);for(let t=0;t<this.args.length;t++)e(this.args[t],"args["+t+"]",this)}map(e){const t=this._ifNode(e(this.fn,"fn",this)),r=[];for(let t=0;t<this.args.length;t++)r[t]=this._ifNode(e(this.args[t],"args["+t+"]",this));return new c(t,r)}clone(){return new c(this.fn,this.args.slice(0))}toString(e){let t;const r=this.fn.toString(e);return e&&"object"==typeof e.handler&&me(e.handler,r)&&(t=e.handler[r](this,e)),void 0!==t?t:super.toString(e)}_toString(e){const t=this.args.map((function(t){return t.toString(e)}));return(Z(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+t.join(", ")+")"}toJSON(){return{mathjs:fm,fn:this.fn,args:this.args}}_toHTML(e){const t=this.args.map((function(t){return t.toHTML(e)}));return'<span class="math-function">'+dn(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'}toTex(e){let t;return e&&"object"==typeof e.handler&&me(e.handler,this.name)&&(t=e.handler[this.name](this,e)),void 0!==t?t:super.toTex(e)}_toTex(e){const t=this.args.map((function(t){return t.toTex(e)}));let n,i;switch($p[this.name]&&(n=$p[this.name]),!r[this.name]||"function"!=typeof r[this.name].toTex&&"object"!=typeof r[this.name].toTex&&"string"!=typeof r[this.name].toTex||(n=r[this.name].toTex),typeof n){case"function":i=n(this,e);break;case"string":i=u(n,this,e);break;case"object":switch(typeof n[t.length]){case"function":i=n[t.length](this,e);break;case"string":i=u(n[t.length],this,e)}}return void 0!==i?i:u("\\mathrm{${name}}\\left(${args}\\right)",this,e)}getIdentifier(){return this.type+":"+this.name}}return t=c,Np(c,"name",fm),Np(c,"onUndefinedFunction",(function(e){throw new Error("Undefined function "+e)})),Np(c,"fromJSON",(function(e){return new t(e.fn,e.args)})),c}),{isClass:!0,isNode:!0}),mm="parse",hm=he(mm,["typed","numeric","config","AccessorNode","ArrayNode","AssignmentNode","BlockNode","ConditionalNode","ConstantNode","FunctionAssignmentNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","RangeNode","RelationalNode","SymbolNode"],(e=>{let{typed:t,numeric:r,config:n,AccessorNode:i,ArrayNode:o,AssignmentNode:a,BlockNode:s,ConditionalNode:u,ConstantNode:c,FunctionAssignmentNode:l,FunctionNode:f,IndexNode:p,ObjectNode:m,OperatorNode:h,ParenthesisNode:d,RangeNode:g,RelationalNode:y,SymbolNode:x}=e;const b=t(mm,{string:function(e){return k(e,{})},"Array | Matrix":function(e){return v(e,{})},"string, Object":function(e,t){return k(e,void 0!==t.nodes?t.nodes:{})},"Array | Matrix, Object":v});function v(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=void 0!==t.nodes?t.nodes:{};return ii(e,(function(e){if("string"!=typeof e)throw new TypeError("String expected");return k(e,r)}))}const w={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},N={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},E={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},A={true:!0,false:!1,null:null,undefined:void 0},S=["NaN","Infinity"],M={'"':'"',"'":"'","\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function C(e,t){return e.expression.substr(e.index,t)}function T(e){return C(e,1)}function D(e){e.index++}function B(e){return e.expression.charAt(e.index-1)}function F(e){return e.expression.charAt(e.index+1)}function O(e){for(e.tokenType=w.NULL,e.token="",e.comment="";;){if("#"===T(e))for(;"\n"!==T(e)&&""!==T(e);)e.comment+=T(e),D(e);if(!b.isWhitespace(T(e),e.nestingLevel))break;D(e)}if(""===T(e))return void(e.tokenType=w.DELIMITER);if("\n"===T(e)&&!e.nestingLevel)return e.tokenType=w.DELIMITER,e.token=T(e),void D(e);const t=T(e),r=C(e,2),n=C(e,3);if(3===n.length&&N[n])return e.tokenType=w.DELIMITER,e.token=n,D(e),D(e),void D(e);if(2===r.length&&N[r])return e.tokenType=w.DELIMITER,e.token=r,D(e),void D(e);if(N[t])return e.tokenType=w.DELIMITER,e.token=t,void D(e);if(b.isDigitDot(t)){e.tokenType=w.NUMBER;const t=C(e,2);if("0b"===t||"0o"===t||"0x"===t){for(e.token+=T(e),D(e),e.token+=T(e),D(e);b.isHexDigit(T(e));)e.token+=T(e),D(e);if("."===T(e))for(e.token+=".",D(e);b.isHexDigit(T(e));)e.token+=T(e),D(e);else if("i"===T(e))for(e.token+="i",D(e);b.isDigit(T(e));)e.token+=T(e),D(e);return}if("."===T(e)){if(e.token+=T(e),D(e),!b.isDigit(T(e)))return void(e.tokenType=w.DELIMITER)}else{for(;b.isDigit(T(e));)e.token+=T(e),D(e);b.isDecimalMark(T(e),F(e))&&(e.token+=T(e),D(e))}for(;b.isDigit(T(e));)e.token+=T(e),D(e);if("E"===T(e)||"e"===T(e))if(b.isDigit(F(e))||"-"===F(e)||"+"===F(e)){if(e.token+=T(e),D(e),"+"!==T(e)&&"-"!==T(e)||(e.token+=T(e),D(e)),!b.isDigit(T(e)))throw ue(e,'Digit expected, got "'+T(e)+'"');for(;b.isDigit(T(e));)e.token+=T(e),D(e);if(b.isDecimalMark(T(e),F(e)))throw ue(e,'Digit expected, got "'+T(e)+'"')}else if("."===F(e))throw D(e),ue(e,'Digit expected, got "'+T(e)+'"')}else{if(!b.isAlpha(T(e),B(e),F(e))){for(e.tokenType=w.UNKNOWN;""!==T(e);)e.token+=T(e),D(e);throw ue(e,'Syntax error in part "'+e.token+'"')}for(;b.isAlpha(T(e),B(e),F(e))||b.isDigit(T(e));)e.token+=T(e),D(e);me(E,e.token)?e.tokenType=w.DELIMITER:e.tokenType=w.SYMBOL}}function _(e){do{O(e)}while("\n"===e.token)}function I(e){e.nestingLevel++}function z(e){e.nestingLevel--}function k(e,t){const r={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:w.NULL,nestingLevel:0,conditionalLevel:null};sn(r,{expression:e,extraNodes:t}),O(r);const n=function(e){let t;const r=[];let n;for(""!==e.token&&"\n"!==e.token&&";"!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment));"\n"===e.token||";"===e.token;)0===r.length&&t&&(n=";"!==e.token,r.push({node:t,visible:n})),O(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&(t=R(e),e.comment&&(t.comment=e.comment),n=";"!==e.token,r.push({node:t,visible:n}));return r.length>0?new s(r):(t||(t=new c(void 0),e.comment&&(t.comment=e.comment)),t)}(r);if(""!==r.token)throw r.tokenType===w.DELIMITER?ce(r,"Unexpected operator "+r.token):ue(r,'Unexpected part "'+r.token+'"');return n}function R(e){let t,r,n,i;const o=function(e){let t=function(e){let t=q(e);for(;"or"===e.token;)_(e),t=new h("or","or",[t,q(e)]);return t}(e);for(;"?"===e.token;){const r=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,_(e);const n=t,i=R(e);if(":"!==e.token)throw ue(e,"False part of conditional expression expected");e.conditionalLevel=null,_(e);const o=R(e);t=new u(n,i,o),e.conditionalLevel=r}return t}(e);if("="===e.token){if(ne(o))return t=o.name,_(e),n=R(e),new a(new x(t),n);if(U(o))return _(e),n=R(e),new a(o.object,o.index,n);if(Y(o)&&ne(o.fn)&&(i=!0,r=[],t=o.name,o.args.forEach((function(e,t){ne(e)?r[t]=e.name:i=!1})),i))return _(e),n=R(e),new l(t,r,n);throw ue(e,"Invalid left hand side of assignment operator =")}return o}function q(e){let t=P(e);for(;"xor"===e.token;)_(e),t=new h("xor","xor",[t,P(e)]);return t}function P(e){let t=j(e);for(;"and"===e.token;)_(e),t=new h("and","and",[t,j(e)]);return t}function j(e){let t=L(e);for(;"|"===e.token;)_(e),t=new h("|","bitOr",[t,L(e)]);return t}function L(e){let t=$(e);for(;"^|"===e.token;)_(e),t=new h("^|","bitXor",[t,$(e)]);return t}function $(e){let t=H(e);for(;"&"===e.token;)_(e),t=new h("&","bitAnd",[t,H(e)]);return t}function H(e){const t=[G(e)],r=[],n={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};for(;me(n,e.token);){const i={name:e.token,fn:n[e.token]};r.push(i),_(e),t.push(G(e))}return 1===t.length?t[0]:2===t.length?new h(r[0].name,r[0].fn,t):new y(r.map((e=>e.fn)),t)}function G(e){let t,r,n,i;t=Z(e);const o={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};for(;me(o,e.token);)r=e.token,n=o[r],_(e),i=[t,Z(e)],t=new h(r,n,i);return t}function Z(e){let t,r,n,i;t=J(e);const o={to:"to",in:"to"};for(;me(o,e.token);)r=e.token,n=o[r],_(e),"in"===r&&""===e.token?t=new h("*","multiply",[t,new x("in")],!0):(i=[t,J(e)],t=new h(r,n,i));return t}function J(e){let t;const r=[];if(t=":"===e.token?new c(1):X(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(r.push(t);":"===e.token&&r.length<3;)_(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?r.push(new x("end")):r.push(X(e));t=3===r.length?new g(r[0],r[2],r[1]):new g(r[0],r[1])}return t}function X(e){let t,r,n,i;t=Q(e);const o={"+":"add","-":"subtract"};for(;me(o,e.token);){r=e.token,n=o[r],_(e);const a=Q(e);i=a.isPercentage?[t,new h("*","multiply",[t,a])]:[t,a],t=new h(r,n,i)}return t}function Q(e){let t,r,n,i;t=ee(e),r=t;const o={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};for(;me(o,e.token);)if(n=e.token,i=o[n],_(e),"%"===n&&e.tokenType===w.DELIMITER&&"("!==e.token)if(""!==e.token&&o[e.token]){const a=new h("/","divide",[t,new c(100)],!1,!0);n=e.token,i=o[n],_(e),r=ee(e),t=new h(n,i,[a,r])}else t=new h("/","divide",[t,new c(100)],!1,!0);else r=ee(e),t=new h(n,i,[t,r]);return t}function ee(e){let t,r;for(t=te(e),r=t;e.tokenType===w.SYMBOL||"in"===e.token&&V(t)||"in"===e.token&&K(t)&&"unaryMinus"===t.fn&&V(t.args[0])||!(e.tokenType!==w.NUMBER||V(r)||K(r)&&"!"!==r.op)||"("===e.token;)r=te(e),t=new h("*","multiply",[t,r],!0);return t}function te(e){let t=re(e),r=t;const n=[];for(;"/"===e.token&&W(r);){if(n.push(sn({},e)),_(e),e.tokenType!==w.NUMBER){sn(e,n.pop());break}if(n.push(sn({},e)),_(e),e.tokenType!==w.SYMBOL&&"("!==e.token&&"in"!==e.token){n.pop(),sn(e,n.pop());break}sn(e,n.pop()),n.pop(),r=re(e),t=new h("/","divide",[t,r])}return t}function re(e){let t,i,a;const s={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return me(s,e.token)?(a=s[e.token],t=e.token,_(e),i=[re(e)],new h(t,a,i)):function(e){let t,i,a,s;return t=function(e){let t,i,a,s;t=function(e){let t=[];if(e.tokenType===w.SYMBOL&&me(e.extraNodes,e.token)){const r=e.extraNodes[e.token];if(O(e),"("===e.token){if(t=[],I(e),O(e),")"!==e.token)for(t.push(R(e));","===e.token;)O(e),t.push(R(e));if(")"!==e.token)throw ue(e,"Parenthesis ) expected");z(e),O(e)}return new r(t)}return function(e){let t,i;return e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E?(i=e.token,O(e),t=me(A,i)?new c(A[i]):S.includes(i)?new c(r(i,"number")):new x(i),t=ie(e,t),t):function(e){let t,i;return'"'===e.token||"'"===e.token?(i=oe(e,e.token),t=new c(i),t=ie(e,t),t):function(e){let t,i,a,s;if("["===e.token){if(I(e),O(e),"]"!==e.token){const r=ae(e);if(";"===e.token){for(a=1,i=[r];";"===e.token;)O(e),"]"!==e.token&&(i[a]=ae(e),a++);if("]"!==e.token)throw ue(e,"End of matrix ] expected");z(e),O(e),s=i[0].items.length;for(let t=1;t<a;t++)if(i[t].items.length!==s)throw ce(e,"Column dimensions mismatch ("+i[t].items.length+" !== "+s+")");t=new o(i)}else{if("]"!==e.token)throw ue(e,"End of matrix ] expected");z(e),O(e),t=r}}else z(e),O(e),t=new o([]);return ie(e,t)}return function(e){if("{"===e.token){let t;I(e);const r={};do{if(O(e),"}"!==e.token){if('"'===e.token||"'"===e.token)t=oe(e,e.token);else{if(!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ue(e,"Symbol or string expected as object key");t=e.token,O(e)}if(":"!==e.token)throw ue(e,"Colon : expected after object key");O(e),r[t]=R(e)}}while(","===e.token);if("}"!==e.token)throw ue(e,"Comma , or bracket } expected after object value");z(e),O(e);let n=new m(r);return n=ie(e,n),n}return function(e){let t;if(e.tokenType===w.NUMBER){t=e.token,O(e);const i=xe(t,n),o=r(t,i);return new c(o)}return function(e){let t;if("("===e.token){if(I(e),O(e),t=R(e),")"!==e.token)throw ue(e,"Parenthesis ) expected");return z(e),O(e),t=new d(t),t=ie(e,t),t}return function(e){throw""===e.token?ue(e,"Unexpected end of expression"):ue(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e);const u={"!":"factorial","'":"ctranspose"};for(;me(u,e.token);)i=e.token,a=u[i],O(e),s=[t],t=new h(i,a,s),t=ie(e,t);return t}(e),("^"===e.token||".^"===e.token)&&(i=e.token,a="^"===i?"pow":"dotPow",_(e),s=[t,re(e)],t=new h(i,a,s)),t}(e)}function ie(e,t,r){let n;for(;("("===e.token||"["===e.token||"."===e.token)&&(!r||r.includes(e.token));)if(n=[],"("===e.token){if(!ne(t)&&!U(t))return t;if(I(e),O(e),")"!==e.token)for(n.push(R(e));","===e.token;)O(e),n.push(R(e));if(")"!==e.token)throw ue(e,"Parenthesis ) expected");z(e),O(e),t=new f(t,n)}else if("["===e.token){if(I(e),O(e),"]"!==e.token)for(n.push(R(e));","===e.token;)O(e),n.push(R(e));if("]"!==e.token)throw ue(e,"Parenthesis ] expected");z(e),O(e),t=new i(t,new p(n))}else{if(O(e),!(e.tokenType===w.SYMBOL||e.tokenType===w.DELIMITER&&e.token in E))throw ue(e,"Property name expected after dot");n.push(new c(e.token)),O(e),t=new i(t,new p(n,!0))}return t}function oe(e,t){let r="";for(;""!==T(e)&&T(e)!==t;)if("\\"===T(e)){D(e);const t=T(e),n=M[t];if(void 0!==n)r+=n,e.index+=1;else{if("u"!==t)throw ue(e,`Bad escape character \\${t}`);{const t=e.expression.slice(e.index+1,e.index+5);if(!/^[0-9A-Fa-f]{4}$/.test(t))throw ue(e,`Invalid unicode character \\u${t}`);r+=String.fromCharCode(parseInt(t,16)),e.index+=5}}}else r+=T(e),D(e);if(O(e),e.token!==t)throw ue(e,`End of string ${t} expected`);return O(e),r}function ae(e){const t=[R(e)];let r=1;for(;","===e.token;)O(e),"]"!==e.token&&";"!==e.token&&(t[r]=R(e),r++);return new o(t)}function se(e){return e.index-e.token.length+1}function ue(e,t){const r=se(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}function ce(e,t){const r=se(e),n=new SyntaxError(t+" (char "+r+")");return n.char=r,n}return b.isAlpha=function(e,t,r){return b.isValidLatinOrGreek(e)||b.isValidMathSymbol(e,r)||b.isValidMathSymbol(t,e)},b.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},b.isValidMathSymbol=function(e,t){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(t)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(t)},b.isWhitespace=function(e,t){return" "===e||"\t"===e||"\n"===e&&t>0},b.isDecimalMark=function(e,t){return"."===e&&"/"!==t&&"*"!==t&&"^"!==t},b.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},b.isDigit=function(e){return e>="0"&&e<="9"},b.isHexDigit=function(e){return e>="0"&&e<="9"||e>="a"&&e<="f"||e>="A"&&e<="F"},t.addConversion({from:"string",to:"Node",convert:b}),b})),dm="compile",gm=he(dm,["typed","parse"],(e=>{let{typed:t,parse:r}=e;return t(dm,{string:function(e){return r(e).compile()},"Array | Matrix":function(e){return ii(e,(function(e){return r(e).compile()}))}})})),ym="evaluate",xm=he(ym,["typed","parse"],(e=>{let{typed:t,parse:r}=e;return t(ym,{string:function(e){const t=m();return r(e).compile().evaluate(t)},"string, Map | Object":function(e,t){return r(e).compile().evaluate(t)},"Array | Matrix":function(e){const t=m();return ii(e,(function(e){return r(e).compile().evaluate(t)}))},"Array | Matrix, Map | Object":function(e,t){return ii(e,(function(e){return r(e).compile().evaluate(t)}))}})})),bm=he("Parser",["evaluate","parse"],(e=>{let{evaluate:t,parse:r}=e;function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");Object.defineProperty(this,"scope",{value:m(),writable:!1})}return n.prototype.type="Parser",n.prototype.isParser=!0,n.prototype.evaluate=function(e){return t(e,this.scope)},n.prototype.get=function(e){if(this.scope.has(e))return this.scope.get(e)},n.prototype.getAll=function(){return function(e){if(e instanceof l)return e.wrappedObject;const t={};for(const r of e.keys())o(t,r,e.get(r));return t}(this.scope)},n.prototype.getAllAsMap=function(){return this.scope},n.prototype.set=function(e,t){if(!function(e){if(0===e.length)return!1;for(let t=0;t<e.length;t++){const n=e.charAt(t-1),i=e.charAt(t),o=e.charAt(t+1);if(!(r.isAlpha(i,n,o)||t>0&&r.isDigit(i)))return!1}return!0}(e))throw new Error(`Invalid variable name: '${e}'. Variable names must follow the specified rules.`);return this.scope.set(e,t),t},n.prototype.remove=function(e){this.scope.delete(e)},n.prototype.clear=function(){this.scope.clear()},n}),{isClass:!0}),vm="parser",wm=he(vm,["typed","Parser"],(e=>{let{typed:t,Parser:r}=e;return t(vm,{"":function(){return new r}})})),Nm=he("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],(e=>{let{typed:t,matrix:r,abs:n,addScalar:i,divideScalar:o,multiplyScalar:a,subtractScalar:s,larger:u,equalScalar:c,unaryMinus:l,DenseMatrix:f,SparseMatrix:p,Spa:m}=e;return t("lup",{DenseMatrix:function(e){return h(e)},SparseMatrix:function(e){return function(e){const t=e._size[0],r=e._size[1],i=Math.min(t,r),s=e._values,f=e._index,h=e._ptr,d=[],g=[],y=[],x=[t,i],b=[],v=[],w=[],N=[i,r];let E,A,S;const M=[],C=[];for(E=0;E<t;E++)M[E]=E,C[E]=E;const T=function(e,t){const r=C[e],n=C[t];M[r]=t,M[n]=e,C[e]=n,C[t]=r};for(A=0;A<r;A++){const e=new m;A<t&&(y.push(d.length),d.push(1),g.push(A)),w.push(b.length);const r=h[A],i=h[A+1];for(S=r;S<i;S++)E=f[S],e.set(M[E],s[S]);A>0&&e.forEach(0,A-1,(function(t,r){p._forEachRow(t,d,g,y,(function(n,i){n>t&&e.accumulate(n,l(a(i,r)))}))}));let C=A,D=e.get(A),B=n(D);e.forEach(A+1,t-1,(function(e,t){const r=n(t);u(r,B)&&(C=e,B=r,D=t)})),A!==C&&(p._swapRows(A,C,x[1],d,g,y),p._swapRows(A,C,N[1],b,v,w),e.swap(A,C),T(A,C)),e.forEach(0,t-1,(function(e,t){e<=A?(b.push(t),v.push(e)):(t=o(t,D),c(t,0)||(d.push(t),g.push(e)))}))}return w.push(b.length),y.push(d.length),{L:new p({values:d,index:g,ptr:y,size:x}),U:new p({values:b,index:v,ptr:w,size:N}),p:M,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(e)},Array:function(e){const t=h(r(e));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}});function h(e){const t=e._size[0],r=e._size[1];let l=Math.min(t,r);const p=ae(e._data),m=[],h=[t,l],d=[],g=[l,r];let y,x,b;const v=[];for(y=0;y<t;y++)v[y]=y;for(x=0;x<r;x++){if(x>0)for(y=0;y<t;y++){const e=Math.min(y,x);let t=0;for(b=0;b<e;b++)t=i(t,a(p[y][b],p[b][x]));p[y][x]=s(p[y][x],t)}let e=x,r=0,l=0;for(y=x;y<t;y++){const t=p[y][x],i=n(t);u(i,r)&&(e=y,r=i,l=t)}if(x!==e&&(v[x]=[v[e],v[e]=v[x]][0],f._swapRows(x,e,p)),x<t)for(y=x+1;y<t;y++){const e=p[y][x];c(e,0)||(p[y][x]=o(p[y][x],l))}}for(x=0;x<r;x++)for(y=0;y<t;y++)0===x&&(y<r&&(d[y]=[]),m[y]=[]),y<x?(y<r&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=0)):y!==x?(y<r&&(d[y][x]=0),x<t&&(m[y][x]=p[y][x])):(y<r&&(d[y][x]=p[y][x]),x<t&&(m[y][x]=1));const w=new f({data:m,size:h}),N=new f({data:d,size:g}),E=[];for(y=0,l=v.length;y<l;y++)E[v[y]]=y;return{L:w,U:N,p:E,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}})),Em=he("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],(e=>{let{typed:t,matrix:r,zeros:n,identity:i,isZero:o,equal:a,sign:s,sqrt:u,conj:c,unaryMinus:l,addScalar:f,divideScalar:p,multiplyScalar:m,subtractScalar:h,complex:d}=e;return sn(t("qr",{DenseMatrix:function(e){return y(e)},SparseMatrix:function(e){return function(){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(e){const t=y(r(e));return{Q:t.Q.valueOf(),R:t.R.valueOf()}}}),{_denseQRimpl:g});function g(e){const t=e._size[0],r=e._size[1],d=i([t],"dense"),g=d._data,y=e.clone(),x=y._data;let b,v,w;const N=n([t],"");for(w=0;w<Math.min(r,t);++w){const e=x[w][w],n=l(a(e,0)?1:s(e)),i=c(n);let d=0;for(b=w;b<t;b++)d=f(d,m(x[b][w],c(x[b][w])));const y=m(n,u(d));if(!o(y)){const n=h(e,y);for(N[w]=1,b=w+1;b<t;b++)N[b]=p(x[b][w],n);const o=l(c(p(n,y)));let a;for(v=w;v<r;v++){for(a=0,b=w;b<t;b++)a=f(a,m(c(N[b]),x[b][v]));for(a=m(a,o),b=w;b<t;b++)x[b][v]=m(h(x[b][v],m(N[b],a)),i)}for(b=0;b<t;b++){for(a=0,v=w;v<t;v++)a=f(a,m(g[b][v],N[v]));for(a=m(a,o),v=w;v<t;++v)g[b][v]=p(h(g[b][v],m(a,c(N[v]))),i)}}}return{Q:d,R:y,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function y(e){const t=g(e),r=t.R._data;if(e._data.length>0){const e="Complex"===r[0][0].type?d(0):0;for(let t=0;t<r.length;++t)for(let n=0;n<t&&n<(r[0]||[]).length;++n)r[t][n]=e}return t}}));function Am(e,t,r,n,i,o,a){let s=0;for(r[a]=e;s>=0;){const e=r[a+s],u=r[n+e];-1===u?(s--,o[t++]=e):(r[n+e]=r[i+u],++s,r[a+s]=u)}return t}function Sm(e){return-e-2}const Mm=he("csAmd",["add","multiply","transpose"],(e=>{let{add:t,multiply:r,transpose:n}=e;return function(e,a){if(!a||e<=0||e>3)return null;const s=a._size,u=s[0],c=s[1];let l=0,f=Math.max(16,10*Math.sqrt(c));f=Math.min(c-2,f);const p=function(e,i,o,a,s){const u=n(i);if(1===e&&a===o)return t(i,u);if(2===e){const e=u._index,t=u._ptr;let a=0;for(let r=0;r<o;r++){let n=t[r];if(t[r]=a,!(t[r+1]-n>s))for(const i=t[r+1];n<i;n++)e[a++]=e[n]}return t[o]=a,i=n(u),r(u,i)}return r(u,i)}(e,a,u,c,f);!function(e,t){const r=e._values,n=e._index,i=e._ptr,o=e._size[1];let a=0;for(let e=0;e<o;e++){let o=i[e];for(i[e]=a;o<i[e+1];o++)t(n[o],e,r?r[o]:1,null)&&(n[a]=n[o],r&&(r[a]=r[o]),a++)}i[o]=a,n.splice(a,n.length-a),r&&r.splice(a,r.length-a)}(p,o);const m=p._index,h=p._ptr;let d=h[c];const g=[],y=[],x=c+1,b=2*(c+1),v=3*(c+1),w=4*(c+1),N=5*(c+1),E=6*(c+1),A=7*(c+1),S=g;let M,C,T,D,B,F,O,_,I,z,k,R,q,P,j,U,L=function(e,t,r,n,o,a,s,u,c,l,f,p){for(let n=0;n<e;n++)r[0+n]=t[n+1]-t[n];r[0+e]=0;for(let t=0;t<=e;t++)r[o+t]=-1,a[t]=-1,r[s+t]=-1,r[u+t]=-1,r[c+t]=1,r[l+t]=1,r[f+t]=0,r[p+t]=r[0+t];const m=i(0,0,r,l,e);return r[f+e]=-2,t[e]=-1,r[l+e]=0,m}(c,h,y,0,v,S,b,A,x,E,w,N),$=function(e,t,r,n,i,o,a,s,u,c,l){let f=0;for(let p=0;p<e;p++){const m=r[n+p];if(0===m)r[i+p]=-2,f++,t[p]=-1,r[o+p]=0;else if(m>a)r[s+p]=0,r[i+p]=-1,f++,t[p]=Sm(e),r[s+e]++;else{const e=r[u+m];-1!==e&&(c[e]=p),r[l+p]=r[u+m],r[u+m]=p}}return f}(c,h,y,N,w,E,f,x,v,S,b),H=0;for(;$<c;){for(T=-1;H<c&&-1===(T=y[v+H]);H++);-1!==y[b+T]&&(S[y[b+T]]=-1),y[v+H]=y[b+T];const e=y[w+T];let t=y[x+T];$+=t;let r=0;y[x+T]=-t;let n=h[T];const o=0===e?n:d;let a=o;for(D=1;D<=e+1;D++){for(D>e?(F=T,O=n,_=y[0+T]-e):(F=m[n++],O=h[F],_=y[0+F]),B=1;B<=_;B++)M=m[O++],(I=y[x+M])<=0||(r+=I,y[x+M]=-I,m[a++]=M,-1!==y[b+M]&&(S[y[b+M]]=S[M]),-1!==S[M]?y[b+S[M]]=y[b+M]:y[v+y[N+M]]=y[b+M]);F!==T&&(h[F]=Sm(T),y[E+F]=0)}for(0!==e&&(d=a),y[N+T]=r,h[T]=o,y[0+T]=a-o,y[w+T]=-2,L=i(L,l,y,E,c),z=o;z<a;z++){if(M=m[z],(k=y[w+M])<=0)continue;I=-y[x+M];const e=L-I;for(n=h[M],R=h[M]+k-1;n<=R;n++)F=m[n],y[E+F]>=L?y[E+F]-=I:0!==y[E+F]&&(y[E+F]=y[N+F]+e)}for(z=o;z<a;z++){for(M=m[z],R=h[M],q=R+y[w+M]-1,P=R,j=0,U=0,n=R;n<=q;n++)if(F=m[n],0!==y[E+F]){const e=y[E+F]-L;e>0?(U+=e,m[P++]=F,j+=F):(h[F]=Sm(T),y[E+F]=0)}y[w+M]=P-R+1;const e=P,i=R+y[0+M];for(n=q+1;n<i;n++){C=m[n];const e=y[x+C];e<=0||(U+=e,m[P++]=C,j+=C)}0===U?(h[M]=Sm(T),I=-y[x+M],r-=I,t+=I,$+=I,y[x+M]=0,y[w+M]=-1):(y[N+M]=Math.min(y[N+M],U),m[P]=m[e],m[e]=m[R],m[R]=T,y[0+M]=P-R+1,j=(j<0?-j:j)%c,y[b+M]=y[A+j],y[A+j]=M,S[M]=j)}for(y[N+T]=r,l=Math.max(l,r),L=i(L+l,l,y,E,c),z=o;z<a;z++)if(M=m[z],!(y[x+M]>=0))for(j=S[M],M=y[A+j],y[A+j]=-1;-1!==M&&-1!==y[b+M];M=y[b+M],L++){for(_=y[0+M],k=y[w+M],n=h[M]+1;n<=h[M]+_-1;n++)y[E+m[n]]=L;let e=M;for(C=y[b+M];-1!==C;){let t=y[0+C]===_&&y[w+C]===k;for(n=h[C]+1;t&&n<=h[C]+_-1;n++)y[E+m[n]]!==L&&(t=0);t?(h[C]=Sm(M),y[x+M]+=y[x+C],y[x+C]=0,y[w+C]=-1,C=y[b+C],y[b+e]=C):(e=C,C=y[b+C])}}for(n=o,z=o;z<a;z++)M=m[z],(I=-y[x+M])<=0||(y[x+M]=I,U=y[N+M]+r-I,U=Math.min(U,c-$-I),-1!==y[v+U]&&(S[y[v+U]]=M),y[b+M]=y[v+U],S[M]=-1,y[v+U]=M,H=Math.min(H,U),y[N+M]=U,m[n++]=M);y[x+T]=t,0==(y[0+T]=n-o)&&(h[T]=-1,y[E+T]=0),0!==e&&(d=n)}for(M=0;M<c;M++)h[M]=Sm(h[M]);for(C=0;C<=c;C++)y[v+C]=-1;for(C=c;C>=0;C--)y[x+C]>0||(y[b+C]=y[v+h[C]],y[v+h[C]]=C);for(F=c;F>=0;F--)y[x+F]<=0||-1!==h[F]&&(y[b+F]=y[v+h[F]],y[v+h[F]]=F);for(T=0,M=0;M<=c;M++)-1===h[M]&&(T=Am(M,T,y,v,b,g,E));return g.splice(g.length-1,1),g};function i(e,t,r,n,i){if(e<2||e+t<0){for(let e=0;e<i;e++)0!==r[n+e]&&(r[n+e]=1);e=2}return e}function o(e,t){return e!==t}}));function Cm(e,t,r,n,i,o,a){let s,u,c,l=0;if(e<=t||r[n+t]<=r[i+e])return-1;r[i+e]=r[n+t];const f=r[o+e];if(r[o+e]=t,-1===f)l=1,c=e;else{for(l=2,c=f;c!==r[a+c];c=r[a+c]);for(s=f;s!==c;s=u)u=r[a+s],r[a+s]=c}return{jleaf:l,q:c}}const Tm=he("csCounts",["transpose"],(e=>{let{transpose:t}=e;return function(e,r,n,i){if(!e||!r||!n)return null;const o=e._size,a=o[0],s=o[1];let u,c,l,f,p,m,h;const d=4*s+(i?s+a+1:0),g=[],y=s,x=2*s,b=3*s,v=4*s,w=5*s+1;for(l=0;l<d;l++)g[l]=-1;const N=[],E=t(e),A=E._index,S=E._ptr;for(l=0;l<s;l++)for(c=n[l],N[c]=-1===g[b+c]?1:0;-1!==c&&-1===g[b+c];c=r[c])g[b+c]=l;if(i){for(l=0;l<s;l++)g[n[l]]=l;for(u=0;u<a;u++){for(l=s,m=S[u],h=S[u+1],p=m;p<h;p++)l=Math.min(l,g[A[p]]);g[w+u]=g[v+l],g[v+l]=u}}for(u=0;u<s;u++)g[0+u]=u;for(l=0;l<s;l++){for(c=n[l],-1!==r[c]&&N[r[c]]--,f=i?g[v+l]:c;-1!==f;f=i?g[w+f]:-1)for(p=S[f];p<S[f+1];p++){u=A[p];const e=Cm(u,c,g,b,y,x,0);e.jleaf>=1&&N[c]++,2===e.jleaf&&N[e.q]--}-1!==r[c]&&(g[0+c]=r[c])}for(c=0;c<s;c++)-1!==r[c]&&(N[r[c]]+=N[c]);return N}})),Dm=he("csSqr",["add","multiply","transpose"],(e=>{let{add:t,multiply:r,transpose:n}=e;const i=Mm({add:t,multiply:r,transpose:n}),o=Tm({transpose:n});return function(e,t,r){const n=t._ptr,a=t._size[1];let s;const u={};if(u.q=i(e,t),e&&!u.q)return null;if(r){const r=e?function(e,t,r){const n=e._values,i=e._index,o=e._ptr,a=e._size,s=e._datatype,u=a[0],c=a[1],l=null,f=[],p=[];let m=0;for(let e=0;e<c;e++){p[e]=m;const t=r?r[e]:e;for(let e=o[t],r=o[t+1],a=e;a<r;a++){const e=i[a];f[m]=e,l&&(l[m]=n[a]),m++}}return p[c]=m,e.createSparseMatrix({values:l,index:f,ptr:p,size:[u,c],datatype:s})}(t,0,u.q):t;u.parent=function(e){if(!e)return null;const t=e._index,r=e._ptr,n=e._size,i=n[0],o=n[1],a=[],s=[],u=o;let c,l;for(c=0;c<i;c++)s[u+c]=-1;for(let e=0;e<o;e++){a[e]=-1,s[0+e]=-1;for(let n=r[e],i=r[e+1],o=n;o<i;o++){const r=t[o];for(c=s[u+r];-1!==c&&c<e;c=l)l=s[0+c],s[0+c]=e,-1===l&&(a[c]=e);s[u+r]=e}}return a}(r);const n=function(e,t){if(!e)return null;let r,n=0;const i=[],o=[],a=t,s=2*t;for(r=0;r<t;r++)o[0+r]=-1;for(r=t-1;r>=0;r--)-1!==e[r]&&(o[a+r]=o[0+e[r]],o[0+e[r]]=r);for(r=0;r<t;r++)-1===e[r]&&(n=Am(r,n,o,0,a,i,s));return i}(u.parent,a);if(u.cp=o(r,u.parent,n,1),r&&u.parent&&u.cp&&function(e,t){const r=e._ptr,n=e._index,i=e._size,o=i[0],a=i[1];t.pinv=[],t.leftmost=[];const s=t.parent,u=t.pinv,c=t.leftmost,l=[],f=o,p=o+a,m=o+2*a;let h,d,g,y,x;for(d=0;d<a;d++)l[f+d]=-1,l[p+d]=-1,l[m+d]=0;for(h=0;h<o;h++)c[h]=-1;for(d=a-1;d>=0;d--)for(y=r[d],x=r[d+1],g=y;g<x;g++)c[n[g]]=d;for(h=o-1;h>=0;h--)u[h]=-1,d=c[h],-1!==d&&(0==l[m+d]++&&(l[p+d]=h),l[0+h]=l[f+d],l[f+d]=h);for(t.lnz=0,t.m2=o,d=0;d<a;d++){if(h=l[f+d],t.lnz++,h<0&&(h=t.m2++),u[h]=d,--m[d]<=0)continue;t.lnz+=l[m+d];const e=s[d];-1!==e&&(0===l[m+e]&&(l[p+e]=l[p+d]),l[0+l[p+d]]=l[f+e],l[f+e]=l[0+h],l[m+e]+=l[m+d])}for(h=0;h<o;h++)u[h]<0&&(u[h]=d++);return!0}(r,u))for(u.unz=0,s=0;s<a;s++)u.unz+=u.cp[s]}else u.unz=4*n[a]+a,u.lnz=u.unz;return u}}));function Bm(e,t){return e[t]<0}function Fm(e,t){e[t]=Sm(e[t])}function Om(e){return e<0?Sm(e):e}function _m(e,t,r,n,i){const o=t._index,a=t._ptr,s=t._size[1];let u,c,l,f=0;for(n[0]=e;f>=0;){e=n[f];const t=i?i[e]:e;Bm(a,e)||(Fm(a,e),n[s+f]=t<0?0:Om(a[t]));let p=1;for(c=n[s+f],l=t<0?0:Om(a[t+1]);c<l;c++)if(u=o[c],!Bm(a,u)){n[s+f]=c,n[++f]=u,p=0;break}p&&(f--,n[--r]=e)}return r}const Im=he("csSpsolve",["divideScalar","multiply","subtract"],(e=>{let{divideScalar:t,multiply:r,subtract:n}=e;return function(e,i,o,a,s,u,c){const l=e._values,f=e._index,p=e._ptr,m=e._size[1],h=i._values,d=i._index,g=i._ptr;let y,x,b,v;const w=function(e,t,r,n,i){const o=e._ptr,a=e._size,s=t._index,u=t._ptr,c=a[1];let l,f,p,m=c;for(f=u[r],p=u[r+1],l=f;l<p;l++){const t=s[l];Bm(o,t)||(m=_m(t,e,m,n,i))}for(l=m;l<c;l++)Fm(o,n[l]);return m}(e,i,o,a,u);for(y=w;y<m;y++)s[a[y]]=0;for(x=g[o],b=g[o+1],y=x;y<b;y++)s[d[y]]=h[y];for(let e=w;e<m;e++){const i=a[e],o=u?u[i]:i;if(!(o<0))for(x=p[o],b=p[o+1],s[i]=t(s[i],l[c?x:b-1]),y=c?x+1:x,v=c?b:b-1;y<v;y++){const e=f[y];s[e]=n(s[e],r(l[y],s[i]))}}return w}})),zm=he("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],(e=>{let{abs:t,divideScalar:r,multiply:n,subtract:i,larger:o,largerEq:a,SparseMatrix:s}=e;const u=Im({divideScalar:r,multiply:n,subtract:i});return function(e,i,c){if(!e)return null;const l=e._size[1];let f,p=100,m=100;i&&(f=i.q,p=i.lnz||p,m=i.unz||m);const h=[],d=[],g=[],y=new s({values:h,index:d,ptr:g,size:[l,l]}),x=[],b=[],v=[],w=new s({values:x,index:b,ptr:v,size:[l,l]}),N=[];let E,A;const S=[],M=[];for(E=0;E<l;E++)S[E]=0,N[E]=-1,g[E+1]=0;p=0,m=0;for(let i=0;i<l;i++){g[i]=p,v[i]=m;const s=f?f[i]:i,w=u(y,e,s,M,S,N,1);let C=-1,T=-1;for(A=w;A<l;A++)if(E=M[A],N[E]<0){const e=t(S[E]);o(e,T)&&(T=e,C=E)}else b[m]=N[E],x[m++]=S[E];if(-1===C||T<=0)return null;N[s]<0&&a(t(S[s]),n(T,c))&&(C=s);const D=S[C];for(b[m]=i,x[m++]=D,N[C]=i,d[p]=C,h[p++]=1,A=w;A<l;A++)E=M[A],N[E]<0&&(d[p]=E,h[p++]=r(S[E],D)),S[E]=0}for(g[l]=p,v[l]=m,A=0;A<p;A++)d[A]=N[d[A]];return h.splice(p,h.length-p),d.splice(p,d.length-p),x.splice(m,x.length-m),b.splice(m,b.length-m),{L:y,U:w,pinv:N}}})),km=he("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],(e=>{let{typed:t,abs:r,add:n,multiply:i,transpose:o,divideScalar:a,subtract:s,larger:u,largerEq:c,SparseMatrix:l}=e;const f=Dm({add:n,multiply:i,transpose:o}),p=zm({abs:r,divideScalar:a,multiply:i,subtract:s,larger:u,largerEq:c,SparseMatrix:l});return t("slu",{"SparseMatrix, number, number":function(e,t,r){if(!ye(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(r<0||r>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");const n=f(t,e,!1),i=p(e,n,r);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}));function Rm(e,t){let r;const n=t.length,i=[];if(e)for(r=0;r<n;r++)i[e[r]]=t[r];else for(r=0;r<n;r++)i[r]=t[r];return i}const qm="lusolve",Pm=he(qm,["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],(e=>{let{typed:t,matrix:r,lup:n,slu:i,usolve:o,lsolve:a,DenseMatrix:s}=e;const u=xc({DenseMatrix:s});return t(qm,{"Array, Array | Matrix":function(e,t){e=r(e);const i=n(e);return l(i.L,i.U,i.p,null,t).valueOf()},"DenseMatrix, Array | Matrix":function(e,t){const r=n(e);return l(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix":function(e,t){const r=n(e);return l(r.L,r.U,r.p,null,t)},"SparseMatrix, Array | Matrix, number, number":function(e,t,r,n){const o=i(e,r,n);return l(o.L,o.U,o.p,o.q,t)},"Object, Array | Matrix":function(e,t){return l(e.L,e.U,e.p,e.q,t)}});function c(e){if(E(e))return e;if(N(e))return r(e);throw new TypeError("Invalid Matrix LU decomposition")}function l(e,t,r,n,i){e=c(e),t=c(t),r&&((i=u(e,i,!0))._data=Rm(r,i._data));const s=a(e,i),l=o(t,s);return n&&(l._data=Rm(n,l._data)),l}})),jm="polynomialRoot",Um=he(jm,["typed","isZero","equalScalar","add","subtract","multiply","divide","sqrt","unaryMinus","cbrt","typeOf","im","re"],(e=>{let{typed:t,isZero:r,equalScalar:n,add:i,subtract:o,multiply:a,divide:s,sqrt:u,unaryMinus:c,cbrt:l,typeOf:f,im:p,re:m}=e;return t(jm,{"number|Complex, ...number|Complex":(e,t)=>{const h=[e,...t];for(;h.length>0&&r(h[h.length-1]);)h.pop();if(h.length<2)throw new RangeError(`Polynomial [${e}, ${t}] must have a non-zero non-constant coefficient`);switch(h.length){case 2:return[c(s(h[0],h[1]))];case 3:{const[e,t,r]=h,i=a(2,r),l=a(t,t),f=a(4,r,e);if(n(l,f))return[s(c(t),i)];const p=u(o(l,f));return[s(o(p,t),i),s(o(c(p),t),i)]}case 4:{const[e,t,r,d]=h,g=c(a(3,d)),y=a(r,r),x=a(3,d,t),b=i(a(2,r,r,r),a(27,d,d,e)),v=a(9,d,r,t);if(n(y,x)&&n(b,v))return[s(r,g)];const w=o(y,x),N=o(b,v),E=i(a(18,d,r,t,e),a(r,r,t,t)),A=i(a(4,r,r,r,e),a(4,d,t,t,t),a(27,d,d,e,e));if(n(E,A))return[s(o(a(4,d,r,t),i(a(9,d,d,e),a(r,r,r))),a(d,w)),s(o(a(9,d,e),a(r,t)),a(2,w))];let S;return S=n(y,x)?N:s(i(N,u(o(a(N,N),a(4,w,w,w)))),2),l(S,!0).toArray().map((e=>s(i(r,e,s(w,e)),g))).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 ${h}`)}}})}));r(9463);const Lm=he("Help",["evaluate"],(e=>{let{evaluate:t}=e;function r(e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");if(!e)throw new Error('Argument "doc" missing');this.doc=e}return r.prototype.type="Help",r.prototype.isHelp=!0,r.prototype.toString=function(){const e=this.doc||{};let r="\n";if(e.name&&(r+="Name: "+e.name+"\n\n"),e.category&&(r+="Category: "+e.category+"\n\n"),e.description&&(r+="Description:\n "+e.description+"\n\n"),e.syntax&&(r+="Syntax:\n "+e.syntax.join("\n ")+"\n\n"),e.examples){r+="Examples:\n";let n=!1;const i=t("config()"),o={config:e=>(n=!0,t("config(newConfig)",{newConfig:e}))};for(let n=0;n<e.examples.length;n++){const i=e.examples[n];let a;r+=" "+i+"\n";try{a=t(i,o)}catch(e){a=e}void 0===a||F(a)||(r+=" "+pn(a,{precision:14})+"\n")}r+="\n",n&&t("config(originalConfig)",{originalConfig:i})}return e.mayThrow&&e.mayThrow.length&&(r+="Throws: "+e.mayThrow.join(", ")+"\n\n"),e.seealso&&e.seealso.length&&(r+="See also: "+e.seealso.join(", ")+"\n"),r},r.prototype.toJSON=function(){const e=ae(this.doc);return e.mathjs="Help",e},r.fromJSON=function(e){const t={};return Object.keys(e).filter((e=>"mathjs"!==e)).forEach((r=>{t[r]=e[r]})),new r(t)},r.prototype.valueOf=r.prototype.toString,r}),{isClass:!0}),$m=he("Chain",["?on","math","typed"],(e=>{let{on:t,math:r,typed:n}=e;function i(e){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");ie(e)?this.value=e.value:this.value=e}function o(e,t){pe(i.prototype,e,(function(){const e=t();if("function"==typeof e)return a(e)}))}function a(e){return function(){if(0===arguments.length)return new i(e(this.value));const t=[this.value];for(let e=0;e<arguments.length;e++)t[e+1]=arguments[e];if(n.isTypedFunction(e)){const r=n.resolve(e,t);if(1===r.params.length)throw new Error("chain function "+e.name+" cannot match rest parameter between chain value and additional arguments.");return new i(r.implementation.apply(e,t))}return new i(e.apply(e,t))}}i.prototype.type="Chain",i.prototype.isChain=!0,i.prototype.done=function(){return this.value},i.prototype.valueOf=function(){return this.value},i.prototype.toString=function(){return pn(this.value)},i.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},i.fromJSON=function(e){return new i(e.value)},i.createProxy=function(e,t){if("string"==typeof e)r=e,"function"==typeof(n=t)&&(i.prototype[r]=a(n));else for(const t in e)me(e,t)&&void 0===s[t]&&o(t,(()=>e[t]));var r,n};const s={expression:!0,docs:!0,type:!0,classes:!0,json:!0,error:!0,isChain:!0};return i.createProxy(r),t&&t("import",(function(e,t,r){r||o(e,t)})),i}),{isClass:!0}),Hm={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"]},Gm={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"]},Vm={bignumber:{name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","bigint","complex","fraction","index","matrix","string","unit"]},bigint:{name:"bigint",category:"Construction",syntax:["bigint(x)"],description:"Create a bigint, an integer with an arbitrary number of digits, from a number or string.",examples:["123123123123123123 # a large number will lose digits",'bigint("123123123123123123")','bignumber(["1", "3", "5"])'],seealso:["boolean","bignumber","number","complex","fraction","index","matrix","string","unit"]},boolean:{name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]},complex:{name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]},createUnit:{name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]},fraction:{name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(matrix)","fraction(num,den)","fraction({n: num, d: den})"],description:"Create a fraction from a number or from integer numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)","fraction({n: 333, d: 53})","fraction([sqrt(9), sqrt(10), sqrt(11)])"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]},index:{name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[1:2, 1:2] = 1","B = [1, 2, 3]","B[B>1 and B<3]"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]},matrix:{name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]},number:{name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","bigint","boolean","complex","fraction","index","matrix","string","unit"]},sparse:{name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]},splitUnit:{name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]},string:{name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]},unit:{name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]},e:Hm,E:Hm,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:Gm,PI:Gm,phi:{name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]},SQRT1_2:{name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]},SQRT2:{name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]},tau:{name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]},true:{name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]},version:{name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]},speedOfLight:{description:"Speed of light in vacuum",examples:["speedOfLight"]},gravitationConstant:{description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},planckConstant:{description:"Planck constant",examples:["planckConstant"]},reducedPlanckConstant:{description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},magneticConstant:{description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},electricConstant:{description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},vacuumImpedance:{description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},coulomb:{description:"Coulomb's constant",examples:["coulomb"]},elementaryCharge:{description:"Elementary charge",examples:["elementaryCharge"]},bohrMagneton:{description:"Bohr magneton",examples:["bohrMagneton"]},conductanceQuantum:{description:"Conductance quantum",examples:["conductanceQuantum"]},inverseConductanceQuantum:{description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},magneticFluxQuantum:{description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},nuclearMagneton:{description:"Nuclear magneton",examples:["nuclearMagneton"]},klitzing:{description:"Von Klitzing constant",examples:["klitzing"]},bohrRadius:{description:"Bohr radius",examples:["bohrRadius"]},classicalElectronRadius:{description:"Classical electron radius",examples:["classicalElectronRadius"]},electronMass:{description:"Electron mass",examples:["electronMass"]},fermiCoupling:{description:"Fermi coupling constant",examples:["fermiCoupling"]},fineStructure:{description:"Fine-structure constant",examples:["fineStructure"]},hartreeEnergy:{description:"Hartree energy",examples:["hartreeEnergy"]},protonMass:{description:"Proton mass",examples:["protonMass"]},deuteronMass:{description:"Deuteron Mass",examples:["deuteronMass"]},neutronMass:{description:"Neutron mass",examples:["neutronMass"]},quantumOfCirculation:{description:"Quantum of circulation",examples:["quantumOfCirculation"]},rydberg:{description:"Rydberg constant",examples:["rydberg"]},thomsonCrossSection:{description:"Thomson cross section",examples:["thomsonCrossSection"]},weakMixingAngle:{description:"Weak mixing angle",examples:["weakMixingAngle"]},efimovFactor:{description:"Efimov factor",examples:["efimovFactor"]},atomicMass:{description:"Atomic mass constant",examples:["atomicMass"]},avogadro:{description:"Avogadro's number",examples:["avogadro"]},boltzmann:{description:"Boltzmann constant",examples:["boltzmann"]},faraday:{description:"Faraday constant",examples:["faraday"]},firstRadiation:{description:"First radiation constant",examples:["firstRadiation"]},loschmidt:{description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},gasConstant:{description:"Gas constant",examples:["gasConstant"]},molarPlanckConstant:{description:"Molar Planck constant",examples:["molarPlanckConstant"]},molarVolume:{description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},sackurTetrode:{description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},secondRadiation:{description:"Second radiation constant",examples:["secondRadiation"]},stefanBoltzmann:{description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},wienDisplacement:{description:"Wien displacement law constant",examples:["wienDisplacement"]},molarMass:{description:"Molar mass constant",examples:["molarMass"]},molarMassC12:{description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},gravity:{description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},planckLength:{description:"Planck length",examples:["planckLength"]},planckMass:{description:"Planck mass",examples:["planckMass"]},planckTime:{description:"Planck time",examples:["planckTime"]},planckCharge:{description:"Planck charge",examples:["planckCharge"]},planckTemperature:{description:"Planck temperature",examples:["planckTemperature"]},derivative:{name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.evaluate({x: 3})"],seealso:["simplify","parse","evaluate"]},lsolve:{name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Finds one solution of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolveAll","lup","lusolve","usolve","matrix","sparse"]},lsolveAll:{name:"lsolveAll",category:"Algebra",syntax:["x=lsolveAll(L, b)"],description:"Finds all solutions of the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lsolve","lup","lusolve","usolve","matrix","sparse"]},lup:{name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]},lusolve:{name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]},leafCount:{name:"leafCount",category:"Algebra",syntax:["leafCount(expr)"],description:"Computes the number of leaves in the parse tree of the given expression",examples:['leafCount("e^(i*pi)-1")','leafCount(parse("{a: 22/7, b: 10^(1/2)}"))'],seealso:["simplify"]},polynomialRoot:{name:"polynomialRoot",category:"Algebra",syntax:["x=polynomialRoot(-6, 3)","x=polynomialRoot(4, -4, 1)","x=polynomialRoot(-8, 12, -6, 1)"],description:"Finds the roots of a univariate polynomial given by its coefficients starting from constant, linear, and so on, increasing in degree.",examples:["a = polynomialRoot(-6, 11, -6, 1)"],seealso:["cbrt","sqrt"]},resolve:{name:"resolve",category:"Algebra",syntax:["resolve(node, scope)"],description:"Recursively substitute variables in an expression tree.",examples:['resolve(parse("1 + x"), { x: 7 })','resolve(parse("size(text)"), { text: "Hello World" })','resolve(parse("x + y"), { x: parse("3z") })','resolve(parse("3x"), { x: parse("y+z"), z: parse("w^y") })'],seealso:["simplify","evaluate"],mayThrow:["ReferenceError"]},simplify:{name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.evaluate({x: 2})"],seealso:["simplifyCore","derivative","evaluate","parse","rationalize","resolve"]},simplifyConstant:{name:"simplifyConstant",category:"Algebra",syntax:["simplifyConstant(expr)","simplifyConstant(expr, options)"],description:"Replace constant subexpressions of node with their values.",examples:['simplifyConstant("(3-3)*x")','simplifyConstant(parse("z-cos(tau/8)"))'],seealso:["simplify","simplifyCore","evaluate"]},simplifyCore:{name:"simplifyCore",category:"Algebra",syntax:["simplifyCore(node)"],description:"Perform simple one-pass simplifications on an expression tree.",examples:['simplifyCore(parse("0*x"))','simplifyCore(parse("(x+0)*2"))'],seealso:["simplify","simplifyConstant","evaluate"]},symbolicEqual:{name:"symbolicEqual",category:"Algebra",syntax:["symbolicEqual(expr1, expr2)","symbolicEqual(expr1, expr2, options)"],description:"Returns true if the difference of the expressions simplifies to 0",examples:['symbolicEqual("x*y","y*x")','symbolicEqual("abs(x^2)", "x^2")','symbolicEqual("abs(x)", "x", {context: {abs: {trivial: true}}})'],seealso:["simplify","evaluate"]},rationalize:{name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]},slu:{name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]},usolve:{name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds one solution of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolveAll","lup","lusolve","lsolve","matrix","sparse"]},usolveAll:{name:"usolveAll",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Finds all solutions of the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["usolve","lup","lusolve","lsolve","matrix","sparse"]},qr:{name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]},abs:{name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]},add:{name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]},cbrt:{name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]},ceil:{name:"ceil",category:"Arithmetic",syntax:["ceil(x)","ceil(x, n)","ceil(unit, valuelessUnit)","ceil(unit, n, valuelessUnit)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)","ceil(3.241cm, cm)","ceil(3.241cm, 2, cm)"],seealso:["floor","fix","round"]},cube:{name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]},divide:{name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]},dotDivide:{name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]},dotMultiply:{name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]},dotPow:{name:"dotPow",category:"Operators",syntax:["x .^ y","dotPow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]},exp:{name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]},expm:{name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]},expm1:{name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]},fix:{name:"fix",category:"Arithmetic",syntax:["fix(x)","fix(x, n)","fix(unit, valuelessUnit)","fix(unit, n, valuelessUnit)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)","fix(3.241cm, cm)","fix(3.241cm, 2, cm)"],seealso:["ceil","floor","round"]},floor:{name:"floor",category:"Arithmetic",syntax:["floor(x)","floor(x, n)","floor(unit, valuelessUnit)","floor(unit, n, valuelessUnit)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)","floor(3.241cm, cm)","floor(3.241cm, 2, cm)"],seealso:["ceil","fix","round"]},gcd:{name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]},hypot:{name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenuse of a list with values.",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]},lcm:{name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]},log:{name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]},log2:{name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]},log1p:{name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]},log10:{name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]},mod:{name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]},multiply:{name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]},norm:{name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']},nthRoot:{name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]},nthRoots:{name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]},pow:{name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)","pow([[1, 2], [4, 3]], 2)","pow([[1, 2], [4, 3]], -1)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]},round:{name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)","round(unit, valuelessUnit)","round(unit, n, valuelessUnit)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)","round(3.241cm, 2, cm)","round([3.2, 3.8, -4.7])"],seealso:["ceil","floor","fix"]},sign:{name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>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 indicate the dimension of the array/matrix to apply the difference","If no dimension parameter is passed it is assumed as dimension 0","Dimension is zero-based in javascript and one-based in the parser","Arrays must be 'rectangular' meaning arrays like [1, 2]","If something is passed as a matrix it will be returned as a matrix but other than that all matrices are converted to arrays"],examples:["A = [1, 2, 4, 7, 0]","diff(A)","diff(A, 1)","B = [[1, 2], [3, 4]]","diff(B)","diff(B, 1)","diff(B, 2)","diff(B, bignumber(2))","diff([[1, 2], matrix([3, 4])], 2)"],seealso:["subtract","partitionSelect"]},dot:{name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]},getMatrixDataType:{name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeOf"]},identity:{name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]},filter:{name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]},flatten:{name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]},forEach:{name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["numberOfPets = {}","addPet(n) = numberOfPets[n] = (numberOfPets[n] ? numberOfPets[n]:0 ) + 1;",'forEach(["Dog","Cat","Cat"], addPet)',"numberOfPets"],seealso:["map","sort","filter"]},inv:{name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]},pinv:{name:"pinv",category:"Matrix",syntax:["pinv(x)"],description:"Calculate the Moore–Penrose inverse of a matrix",examples:["pinv([1, 2; 3, 4])","pinv([[1, 0], [0, 1], [0, 1]])","pinv(4)"],seealso:["inv"]},eigs:{name:"eigs",category:"Matrix",syntax:["eigs(x)"],description:"Calculate the eigenvalues and optionally eigenvectors of a square matrix",examples:["eigs([[5, 2.3], [2.3, 1]])","eigs([[1, 2, 3], [4, 5, 6], [7, 8, 9]], { precision: 1e-6, eigenvectors: false })"],seealso:["inv"]},kron:{name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the Kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]},matrixFromFunction:{name:"matrixFromFunction",category:"Matrix",syntax:["matrixFromFunction(size, fn)","matrixFromFunction(size, fn, format)","matrixFromFunction(size, fn, format, datatype)","matrixFromFunction(size, format, fn)","matrixFromFunction(size, format, datatype, fn)"],description:"Create a matrix by evaluating a generating function at each index.",examples:["f(I) = I[1] - I[2]","matrixFromFunction([3,3], f)","g(I) = I[1] - I[2] == 1 ? 4 : 0",'matrixFromFunction([100, 100], "sparse", g)',"matrixFromFunction([5], random)"],seealso:["matrix","matrixFromRows","matrixFromColumns","zeros"]},matrixFromRows:{name:"matrixFromRows",category:"Matrix",syntax:["matrixFromRows(...arr)","matrixFromRows(row1, row2)","matrixFromRows(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual rows.",examples:["matrixFromRows([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromColumns","matrixFromFunction","zeros"]},matrixFromColumns:{name:"matrixFromColumns",category:"Matrix",syntax:["matrixFromColumns(...arr)","matrixFromColumns(row1, row2)","matrixFromColumns(row1, row2, row3)"],description:"Create a dense matrix from vectors as individual columns.",examples:["matrixFromColumns([1, 2, 3], [[4],[5],[6]])"],seealso:["matrix","matrixFromRows","matrixFromFunction","zeros"]},map:{name:"map",category:"Matrix",syntax:["map(x, callback)","map(x, y, ..., callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array or the matrices/arrays.",examples:["map([1, 2, 3], square)","map([1, 2], [3, 4], f(a,b) = a + b)"],seealso:["filter","forEach"]},ones:{name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]},partitionSelect:{name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1, compareText)',"arr = [5, 2, 1]","partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]","arr","partitionSelect(arr, 1, 'desc') # returns 2, arr is now: [5, 2, 1]","arr"],seealso:["sort"]},range:{name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"range(1m, 1m, 3m)","a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]},resize:{name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]},reshape:{name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])","reshape([1, 2, 3, 4], [-1, 2])"],seealso:["size","squeeze","resize"]},rotate:{name:"rotate",category:"Matrix",syntax:["rotate(w, theta)","rotate(w, theta, v)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotate([1, 0], pi / 2)",'rotate(matrix([1, 0]), unit("35deg"))','rotate([1, 0, 0], unit("90deg"), [0, 0, 1])','rotate(matrix([1, 0, 0]), unit("90deg"), matrix([0, 0, 1]))'],seealso:["matrix","rotationMatrix"]},rotationMatrix:{name:"rotationMatrix",category:"Matrix",syntax:["rotationMatrix(theta)","rotationMatrix(theta, v)","rotationMatrix(theta, v, format)"],description:"Returns a 2-D rotation matrix (2x2) for a given angle (in radians). Returns a 2-D rotation matrix (3x3) of a given angle (in radians) around given axis.",examples:["rotationMatrix(pi / 2)",'rotationMatrix(unit("45deg"), [0, 0, 1])','rotationMatrix(1, matrix([0, 0, 1]), "sparse")'],seealso:["cos","sin"]},row:{name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column","matrixFromRows"]},size:{name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","count","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]},sort:{name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"], "natural")',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]},squeeze:{name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]},subset:{name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of the entries of a matrix or characters of a string. Indexes are one-based. There should be one index specification for each dimension of the target. Each specification can be a single index, a list of indices, or a range in colon notation `l:u`. In a range, both the lower bound l and upper bound u are included; and if a bound is omitted it defaults to the most extreme valid value. The cartesian product of the indices specified in each dimension determines the target of the operation.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]","f[[1,2], [1,3]] = [9, 10; 11, 12]","f"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]},trace:{name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]},transpose:{name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]},zeros:{name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]},fft:{name:"fft",category:"Matrix",syntax:["fft(x)"],description:"Calculate N-dimensional Fourier transform",examples:["fft([[1, 0], [1, 0]])"],seealso:["ifft"]},ifft:{name:"ifft",category:"Matrix",syntax:["ifft(x)"],description:"Calculate N-dimensional inverse Fourier transform",examples:["ifft([[2, 2], [0, 0]])"],seealso:["fft"]},sylvester:{name:"sylvester",category:"Algebra",syntax:["sylvester(A,B,C)"],description:"Solves the real-valued Sylvester equation AX+XB=C for X",examples:["sylvester([[-1, -2], [1, 1]], [[-2, 1], [-1, 2]], [[-3, 2], [3, 0]])","A = [[-1, -2], [1, 1]]; B = [[2, -1], [1, -2]]; C = [[-3, 2], [3, 0]]","sylvester(A, B, C)"],seealso:["schur","lyap"]},schur:{name:"schur",category:"Algebra",syntax:["schur(A)"],description:"Performs a real Schur decomposition of the real matrix A = UTU'",examples:["schur([[1, 0], [-4, 3]])","A = [[1, 0], [-4, 3]]","schur(A)"],seealso:["lyap","sylvester"]},lyap:{name:"lyap",category:"Algebra",syntax:["lyap(A,Q)"],description:"Solves the Continuous-time Lyapunov equation AP+PA'+Q=0 for P",examples:["lyap([[-2, 0], [1, -4]], [[3, 1], [1, 3]])","A = [[-2, 0], [1, -4]]","Q = [[3, 1], [1, 3]]","lyap(A,Q)"],seealso:["schur","sylvester"]},solveODE:{name:"solveODE",category:"Numeric",syntax:["solveODE(func, tspan, y0)","solveODE(func, tspan, y0, options)"],description:"Numerical Integration of Ordinary Differential Equations.",examples:["f(t,y) = y","tspan = [0, 4]","solveODE(f, tspan, 1)","solveODE(f, tspan, [1, 2])",'solveODE(f, tspan, 1, { method:"RK23", maxStep:0.1 })'],seealso:["derivative","simplifyCore"]},combinations:{name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["combinationsWithRep","permutations","factorial"]},combinationsWithRep:{name:"combinationsWithRep",category:"Probability",syntax:["combinationsWithRep(n, k)"],description:"Compute the number of combinations of n items taken k at a time with replacements.",examples:["combinationsWithRep(7, 5)"],seealso:["combinations","permutations","factorial"]},factorial:{name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","combinationsWithRep","permutations","gamma"]},gamma:{name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]},kldivergence:{name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]},lgamma:{name:"lgamma",category:"Probability",syntax:["lgamma(n)"],description:"Logarithm of the gamma function for real, positive numbers and complex numbers, using Lanczos approximation for numbers and Stirling series for complex numbers.",examples:["lgamma(4)","lgamma(1/2)","lgamma(i)","lgamma(complex(1.1, 2))"],seealso:["gamma"]},multinomial:{name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]},permutations:{name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","combinationsWithRep","factorial"]},pickRandom:{name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]},random:{name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]},randomInt:{name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]},compare:{name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]},compareNatural:{name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]},compareText:{name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]},deepEqual:{name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]},equal:{name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]},equalText:{name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]},larger:{name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]},largerEq:{name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]},smaller:{name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]},smallerEq:{name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]},unequal:{name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]},setCartesian:{name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays and the values will be sorted in ascending order before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]},setDifference:{name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]},setDistinct:{name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]},setIntersect:{name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]},setIsSubset:{name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]},setMultiplicity:{name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]},setPowerset:{name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]},setSize:{name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]},setSymDifference:{name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]},setUnion:{name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]},zpk2tf:{name:"zpk2tf",category:"Signal",syntax:["zpk2tf(z, p, k)"],description:"Compute the transfer function of a zero-pole-gain model.",examples:["zpk2tf([1, 2], [-1, -2], 1)","zpk2tf([1, 2], [-1, -2])","zpk2tf([1 - 3i, 2 + 2i], [-1, -2])"],seealso:[]},freqz:{name:"freqz",category:"Signal",syntax:["freqz(b, a)","freqz(b, a, w)"],description:"Calculates the frequency response of a filter given its numerator and denominator coefficients.",examples:["freqz([1, 2], [1, 2, 3])","freqz([1, 2], [1, 2, 3], [0, 1])","freqz([1, 2], [1, 2, 3], 512)"],seealso:[]},erf:{name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]},zeta:{name:"zeta",category:"Special",syntax:["zeta(s)"],description:"Compute the Riemann Zeta Function using an infinite series and Riemann's Functional Equation for the entire complex plane",examples:["zeta(0.2)","zeta(-0.5)","zeta(4)"],seealso:[]},cumsum:{name:"cumsum",category:"Statistics",syntax:["cumsum(a, b, c, ...)","cumsum(A)"],description:"Compute the cumulative sum of all values.",examples:["cumsum(2, 3, 4, 1)","cumsum([2, 3, 4, 1])","cumsum([1, 2; 3, 4])","cumsum([1, 2; 3, 4], 1)","cumsum([1, 2; 3, 4], 2)"],seealso:["max","mean","median","min","prod","std","sum","variance"]},mad:{name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]},max:{name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dimension)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","variance"]},mean:{name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dimension)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","variance"]},median:{name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","variance","quantileSeq"]},min:{name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dimension)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","variance"]},mode:{name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","variance"]},prod:{name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","variance"]},quantileSeq:{name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probability are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","variance"]},std:{name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, dimension)","std(A, normalization)","std(A, dimension, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(variance(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","prod","sum","variance"]},sum:{name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)","sum(A, dimension)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","variance"]},variance:{name:"variance",category:"Statistics",syntax:["variance(a, b, c, ...)","variance(A)","variance(A, dimension)","variance(A, normalization)","variance(A, dimension, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["variance(2, 4, 6)","variance([2, 4, 6, 8])",'variance([2, 4, 6, 8], "uncorrected")','variance([2, 4, 6, 8], "biased")',"variance([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]},corr:{name:"corr",category:"Statistics",syntax:["corr(A,B)"],description:"Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.",examples:["corr([2, 4, 6, 8],[1, 2, 3, 6])","corr(matrix([[1, 2.2, 3, 4.8, 5], [1, 2, 3, 4, 5]]), matrix([[4, 5.3, 6.6, 7, 8], [1, 2, 3, 4, 5]]))"],seealso:["max","mean","min","median","min","prod","std","sum"]},acos:{name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]},acosh:{name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]},acot:{name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]},acoth:{name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the inverse hyperbolic tangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]},acsc:{name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]},acsch:{name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the inverse hyperbolic cosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]},asec:{name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]},asech:{name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]},asin:{name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]},asinh:{name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]},atan:{name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]},atanh:{name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]},atan2:{name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]},cos:{name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]},cosh:{name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]},cot:{name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]},coth:{name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]},csc:{name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]},csch:{name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]},sec:{name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]},sech:{name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]},sin:{name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]},sinh:{name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]},tan:{name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]},tanh:{name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]},to:{name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]},clone:{name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables, and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]},format:{name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]},bin:{name:"bin",category:"Utils",syntax:["bin(value)"],description:"Format a number as binary",examples:["bin(2)"],seealso:["oct","hex"]},oct:{name:"oct",category:"Utils",syntax:["oct(value)"],description:"Format a number as octal",examples:["oct(56)"],seealso:["bin","hex"]},hex:{name:"hex",category:"Utils",syntax:["hex(value)"],description:"Format a number as hexadecimal",examples:["hex(240)"],seealso:["bin","oct"]},isNaN:{name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isInteger:{name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]},isNegative:{name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]},isNumeric:{name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]},hasNumericValue:{name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]},isPositive:{name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isPrime:{name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]},isZero:{name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]},print:{name:"print",category:"Utils",syntax:["print(template, values)","print(template, values, precision)"],description:"Interpolate values into a string template.",examples:['print("Lucy is $age years old", {age: 5})','print("The value of pi is $pi", {pi: pi}, 3)','print("Hello, $user.name!", {user: {name: "John"}})','print("Values: $1, $2, $3", [6, 9, 4])'],seealso:["format"]},typeOf:{name:"typeOf",category:"Utils",syntax:["typeOf(x)"],description:"Get the type of a variable.",examples:["typeOf(3.5)","typeOf(2 - 4i)","typeOf(45 deg)",'typeOf("hello world")'],seealso:["getMatrixDataType"]},numeric:{name:"numeric",category:"Utils",syntax:["numeric(x)"],description:"Convert a numeric input to a specific numeric type: number, BigNumber, bigint, or Fraction.",examples:['numeric("4")','numeric("4", "number")','numeric("4", "bigint")','numeric("4", "BigNumber")','numeric("4", "Fraction")','numeric(4, "Fraction")','numeric(fraction(2, 5), "number")'],seealso:["number","bigint","fraction","bignumber","string","format"]}},Wm="help",Zm=he(Wm,["typed","mathWithTransform","Help"],(e=>{let{typed:t,mathWithTransform:r,Help:n}=e;return t(Wm,{any:function(e){let t,o=e;if("string"!=typeof e)for(t in r)if(me(r,t)&&e===r[t]){o=t;break}const a=i(Vm,o);if(!a){const e="function"==typeof o?o.name:o;throw new Error('No documentation found on "'+e+'"')}return new n(a)}})})),Ym="chain",Jm=he(Ym,["typed","Chain"],(e=>{let{typed:t,Chain:r}=e;return t(Ym,{"":function(){return new r},any:function(e){return new r(e)}})})),Xm=he("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],(e=>{let{typed:t,matrix:r,subtractScalar:n,multiply:i,divideScalar:o,isZero:a,unaryMinus:s}=e;return t("det",{any:function(e){return ae(e)},"Array | Matrix":function(e){let t;switch(t=E(e)?e.size():Array.isArray(e)?(e=r(e)).size():[],t.length){case 0:return ae(e);case 1:if(1===t[0])return ae(e.valueOf()[0]);if(0===t[0])return 1;throw new RangeError("Matrix must be square (size: "+pn(t)+")");case 2:{const r=t[0],u=t[1];if(r===u)return function(e,t){if(1===t)return ae(e[0][0]);if(2===t)return n(i(e[0][0],e[1][1]),i(e[1][0],e[0][1]));{let r=!1;const u=new Array(t).fill(0).map(((e,t)=>t));for(let s=0;s<t;s++){let c=u[s];if(a(e[c][s])){let n;for(n=s+1;n<t;n++)if(!a(e[u[n]][s])){c=u[n],u[n]=u[s],u[s]=c,r=!r;break}if(n===t)return e[c][s]}const l=e[c][s],f=0===s?1:e[u[s-1]][s-1];for(let r=s+1;r<t;r++){const a=u[r];for(let r=s+1;r<t;r++)e[a][r]=o(n(i(e[a][r],l),i(e[a][s],e[c][r])),f)}}const c=e[u[t-1]][t-1];return r?s(c):c}}(e.clone().valueOf(),r);if(0===u)return 1;throw new RangeError("Matrix must be square (size: "+pn(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pn(t)+")")}}})})),Qm=he("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],(e=>{let{typed:t,matrix:r,divideScalar:n,addScalar:i,multiply:o,unaryMinus:a,det:s,identity:u,abs:c}=e;return t("inv",{"Array | Matrix":function(e){const t=E(e)?e.size():vn(e);switch(t.length){case 1:if(1===t[0])return E(e)?r([n(1,e.valueOf()[0])]):[n(1,e[0])];throw new RangeError("Matrix must be square (size: "+pn(t)+")");case 2:{const n=t[0],i=t[1];if(n===i)return E(e)?r(l(e.valueOf(),n,i),e.storage()):l(e,n,i);throw new RangeError("Matrix must be square (size: "+pn(t)+")")}default:throw new RangeError("Matrix must be two dimensional (size: "+pn(t)+")")}},any:function(e){return n(1,e)}});function l(e,t,r){let l,f,p,m,h;if(1===t){if(m=e[0][0],0===m)throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,m)]]}if(2===t){const t=s(e);if(0===t)throw Error("Cannot calculate inverse, determinant is zero");return[[n(e[1][1],t),n(a(e[0][1]),t)],[n(a(e[1][0]),t),n(e[0][0],t)]]}{const s=e.concat();for(l=0;l<t;l++)s[l]=s[l].concat();const m=u(t).valueOf();for(let e=0;e<r;e++){let u=c(s[e][e]),d=e;for(l=e+1;l<t;)c(s[l][e])>u&&(u=c(s[l][e]),d=l),l++;if(0===u)throw Error("Cannot calculate inverse, determinant is zero");l=d,l!==e&&(h=s[e],s[e]=s[l],s[l]=h,h=m[e],m[e]=m[l],m[l]=h);const g=s[e],y=m[e];for(l=0;l<t;l++){const t=s[l],u=m[l];if(l!==e){if(0!==t[e]){for(p=n(a(t[e]),g[e]),f=e;f<r;f++)t[f]=i(t[f],o(p,g[f]));for(f=0;f<r;f++)u[f]=i(u[f],o(p,y[f]))}}else{for(p=g[e],f=e;f<r;f++)t[f]=n(t[f],p);for(f=0;f<r;f++)u[f]=n(u[f],p)}}}return m}}})),Km="pinv",eh=he(Km,["typed","matrix","inv","deepEqual","equal","dotDivide","dot","ctranspose","divideScalar","multiply","add","Complex"],(e=>{let{typed:t,matrix:r,inv:n,deepEqual:i,equal:o,dotDivide:a,dot:s,ctranspose:u,divideScalar:c,multiply:l,add:f,Complex:p}=e;return t(Km,{"Array | Matrix":function(e){const t=E(e)?e.size():vn(e);switch(t.length){case 1:return d(e)?u(e):1===t[0]?n(e):a(u(e),s(e,e));case 2:{if(d(e))return u(e);const i=t[0],o=t[1];if(i===o)try{return n(e)}catch(e){if(!(e instanceof Error&&e.message.match(/Cannot calculate inverse, determinant is zero/)))throw e}return E(e)?r(m(e.valueOf(),i,o),e.storage()):m(e,i,o)}default:throw new RangeError("Matrix must be two dimensional (size: "+pn(t)+")")}},any:function(e){return o(e,0)?ae(e):c(1,e)}});function m(e,t,r){const{C:i,F:o}=function(e,t,r){const n=function(e,t,r){const n=ae(e);let i=0;for(let e=0;e<t;e++){if(r<=i)return n;let o=e;for(;h(n[o][i]);)if(o++,t===o&&(o=e,i++,r===i))return n;[n[o],n[e]]=[n[e],n[o]];let s=n[e][i];for(let t=0;t<r;t++)n[e][t]=a(n[e][t],s);for(let o=0;o<t;o++)if(o!==e){s=n[o][i];for(let t=0;t<r;t++)n[o][t]=f(n[o][t],l(-1,l(s,n[e][t])))}i++}return n}(e,t,r);return{C:e.map(((e,r)=>e.filter(((e,r)=>r<t&&!h(s(n[r],n[r])))))),F:n.filter(((e,t)=>!h(s(n[t],n[t]))))}}(e,t,r),c=l(n(l(u(i),i)),u(i)),p=l(u(o),n(l(o,u(o))));return l(p,c)}function h(e){return o(f(e,p(1,1)),f(0,p(1,1)))}function d(e){return i(f(e,p(1,1)),f(l(e,0),p(1,1)))}}));const th=he("eigs",["config","typed","matrix","addScalar","equal","subtract","abs","atan","cos","sin","multiplyScalar","divideScalar","inv","bignumber","multiply","add","larger","column","flatten","number","complex","sqrt","diag","size","reshape","qr","usolve","usolveAll","im","re","smaller","matrixFromColumns","dot"],(e=>{let{config:t,typed:r,matrix:n,addScalar:i,subtract:o,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,divideScalar:p,inv:m,bignumber:h,multiply:y,add:v,larger:w,column:N,flatten:E,number:A,complex:S,sqrt:M,diag:C,size:T,reshape:D,qr:B,usolve:F,usolveAll:O,im:_,re:I,smaller:z,matrixFromColumns:k,dot:R}=e;const q=function(e){let{config:t,addScalar:r,subtract:n,abs:i,atan:o,cos:a,sin:s,multiplyScalar:u,inv:c,bignumber:l,multiply:f,add:p}=e;function m(e,r,n){const i=r-e;return Math.abs(i)<=t.relTol?Math.PI/4:.5*Math.atan(2*n/(r-e))}function h(e,r,a){const s=n(r,e);return i(s)<=t.relTol?l(-1).acos().div(4):u(.5,o(f(2,a,c(s))))}function d(e,t,r,n){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=Array(i).fill(0),u=Array(i).fill(0);for(let t=0;t<i;t++)s[t]=o*e[t][r]-a*e[t][n],u[t]=a*e[t][r]+o*e[t][n];for(let t=0;t<i;t++)e[t][r]=s[t],e[t][n]=u[t];return e}function g(e,t,i,o){const c=e.length,f=a(t),p=s(t),m=Array(c).fill(l(0)),h=Array(c).fill(l(0));for(let t=0;t<c;t++)m[t]=n(u(f,e[t][i]),u(p,e[t][o])),h[t]=r(u(p,e[t][i]),u(f,e[t][o]));for(let t=0;t<c;t++)e[t][i]=m[t],e[t][o]=h[t];return e}function y(e,t,i,o){const c=e.length,m=l(a(t)),h=l(s(t)),d=u(m,m),g=u(h,h),y=Array(c).fill(l(0)),x=Array(c).fill(l(0)),b=f(l(2),m,h,e[i][o]),v=r(n(u(d,e[i][i]),b),u(g,e[o][o])),w=p(u(g,e[i][i]),b,u(d,e[o][o]));for(let t=0;t<c;t++)y[t]=n(u(m,e[i][t]),u(h,e[o][t])),x[t]=r(u(h,e[i][t]),u(m,e[o][t]));e[i][i]=v,e[o][o]=w,e[i][o]=l(0),e[o][i]=l(0);for(let t=0;t<c;t++)t!==i&&t!==o&&(e[i][t]=y[t],e[t][i]=y[t],e[o][t]=x[t],e[t][o]=x[t]);return e}function x(e,t,r,n){const i=e.length,o=Math.cos(t),a=Math.sin(t),s=o*o,u=a*a,c=Array(i).fill(0),l=Array(i).fill(0),f=s*e[r][r]-2*o*a*e[r][n]+u*e[n][n],p=u*e[r][r]+2*o*a*e[r][n]+s*e[n][n];for(let t=0;t<i;t++)c[t]=o*e[r][t]-a*e[n][t],l[t]=a*e[r][t]+o*e[n][t];e[r][r]=f,e[n][n]=p,e[r][n]=0,e[n][r]=0;for(let t=0;t<i;t++)t!==r&&t!==n&&(e[r][t]=c[t],e[t][r]=c[t],e[n][t]=l[t],e[t][n]=l[t]);return e}function b(e){const t=e.length;let r=0,n=[0,1];for(let i=0;i<t;i++)for(let o=i+1;o<t;o++)Math.abs(r)<Math.abs(e[i][o])&&(r=Math.abs(e[i][o]),n=[i,o]);return[n,r]}function v(e){const t=e.length;let r=0,n=[0,1];for(let o=0;o<t;o++)for(let a=o+1;a<t;a++)i(r)<i(e[o][a])&&(r=i(e[o][a]),n=[o,a]);return[n,r]}function w(e,t,r){const n=e.length,o=Array(n);let a;if(r){a=Array(n);for(let e=0;e<n;e++)a[e]=Array(n)}for(let s=0;s<n;s++){let u=0,c=e[0];for(let t=0;t<e.length;t++)i(e[t])<i(c)&&(u=t,c=e[u]);if(o[s]=e.splice(u,1)[0],r)for(let e=0;e<n;e++)a[s][e]=t[e][u],t[e].splice(u,1)}if(!r)return{values:o};const s=a.map(((e,t)=>({value:o[t],vector:e})));return{values:o,eigenvectors:s}}return function(e,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.relTol,o=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;if("number"===o)return function(e,t,r){const n=e.length,i=Math.abs(t/n);let o,a;if(r){a=new Array(n);for(let e=0;e<n;e++)a[e]=Array(n).fill(0),a[e][e]=1}let s=b(e);for(;Math.abs(s[1])>=Math.abs(i);){const t=s[0][0],n=s[0][1];o=m(e[t][t],e[n][n],e[t][n]),e=x(e,o,t,n),r&&(a=d(a,o,t,n)),s=b(e)}const u=Array(n).fill(0);for(let t=0;t<n;t++)u[t]=e[t][t];return w(ae(u),a,r)}(e,n,a);if("BigNumber"===o)return function(e,t,r){const n=e.length,o=i(t/n);let a,s;if(r){s=new Array(n);for(let e=0;e<n;e++)s[e]=Array(n).fill(0),s[e][e]=1}let u=v(e);for(;i(u[1])>=i(o);){const t=u[0][0],n=u[0][1];a=h(e[t][t],e[n][n],e[t][n]),e=y(e,a,t,n),r&&(s=g(s,a,t,n)),u=v(e)}const c=Array(n).fill(0);for(let t=0;t<n;t++)c[t]=e[t][t];return w(ae(c),s,r)}(e,n,a);throw TypeError("Unsupported data type: "+o)}}({config:t,addScalar:i,subtract:o,column:N,flatten:E,equal:a,abs:s,atan:u,cos:c,sin:l,multiplyScalar:f,inv:m,bignumber:h,complex:S,multiply:y,add:v}),P=function(e){let{addScalar:t,subtract:r,flatten:n,multiply:i,multiplyScalar:o,divideScalar:a,sqrt:s,abs:u,bignumber:c,diag:l,size:f,reshape:p,inv:m,qr:h,usolve:d,usolveAll:g,equal:y,complex:x,larger:b,smaller:v,matrixFromColumns:w,dot:N}=e;function E(e,n,i,a){const u=t(e,a),c=r(o(e,a),o(n,i)),l=o(u,.5),f=o(s(r(o(u,u),o(4,c))),.5);return[t(l,f),r(l,f)]}function A(e,t,n,i,o,a,s,l){const f="BigNumber"===l,p="Complex"===l,m=f?c(0):p?x(0):0,h=f?c(1):p?x(1):1;if(v(u(n),s))return[[h,m],[m,h]];if(b(u(r(o,a)),s))return[[r(o,i),r(a,i)],[n,n]];const d=r(e,o),g=r(i,o);return v(u(t),s)&&v(u(g),s)?[[d,h],[n,m]]:[[t,m],[g,h]]}function S(e,t){for(let r=0;r<e.length;r++)e[r].push(...Array(t-e[r].length).fill(0));for(let r=e.length;r<t;r++)e.push(Array(t).fill(0)),e[r][r]=1;return e}function M(e,t,r){for(let n=0;n<e.length;n++)if(r(e[n],t))return n;return-1}function C(e,t,r,n,i){const o="BigNumber"===i?c(1e3):1e3;let a,s=0;for(;s<5;++s){a=T(t,r,i);try{a=d(e,a)}catch(e){continue}if(b(B(a),o))break}if(s>=5)return null;for(s=0;;){const t=d(e,a);if(v(B(D(a,[t])),n))break;if(++s>=10)return null;a=F(t)}return a}function T(e,t,r){const n="BigNumber"===r,i="Complex"===r;let o=Array(e).fill(0).map((e=>2*Math.random()-1));return n&&(o=o.map((e=>c(e)))),i&&(o=o.map((e=>x(e)))),o=D(o,t),F(o,r)}function D(e,t){const n=f(e);for(let o of t)o=p(o,n),e=r(e,i(a(N(o,e),N(o,o)),o));return e}function B(e){return u(s(N(e,e)))}function F(e,t){const r="Complex"===t,n="BigNumber"===t?c(1):r?x(1):1;return i(a(n,B(e)),e)}return function(e,s,f,p){let d=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const w=function(e,r,n,i,s){const f="BigNumber"===i,p="Complex"===i,m=f?c(0):0,h=f?c(1):p?x(1):1,d=f?c(1):1,g=f?c(10):2,w=o(g,g);let N;s&&(N=Array(r).fill(h));let E=!1;for(;!E;){E=!0;for(let n=0;n<r;n++){let i=m,c=m;for(let o=0;o<r;o++)n!==o&&(i=t(i,u(e[o][n])),c=t(c,u(e[n][o])));if(!y(i,0)&&!y(c,0)){let u=d,l=i;const f=a(c,g),p=o(c,g);for(;v(l,f);)l=o(l,w),u=o(u,g);for(;b(l,p);)l=a(l,w),u=a(u,g);if(v(a(t(l,c),u),o(t(i,c),.95))){E=!1;const t=a(1,u);for(let i=0;i<r;i++)n!==i&&(e[n][i]=o(e[n][i],t),e[i][n]=o(e[i][n],u));s&&(N[n]=o(N[n],t))}}}}return s?l(N):null}(e,s,0,p,d);!function(e,n,i,s,l,f){const p="BigNumber"===s,m="Complex"===s,h=p?c(0):m?x(0):0;p&&(i=c(i));for(let s=0;s<n-2;s++){let c=0,p=h;for(let t=s+1;t<n;t++){const r=e[t][s];v(u(p),u(r))&&(p=r,c=t)}if(!v(u(p),i)){if(c!==s+1){const t=e[c];e[c]=e[s+1],e[s+1]=t;for(let t=0;t<n;t++){const r=e[t][c];e[t][c]=e[t][s+1],e[t][s+1]=r}if(l){const e=f[c];f[c]=f[s+1],f[s+1]=e}}for(let i=s+2;i<n;i++){const u=a(e[i][s],p);if(0!==u){for(let t=0;t<n;t++)e[i][t]=r(e[i][t],o(u,e[s+1][t]));for(let r=0;r<n;r++)e[r][s+1]=t(e[r][s+1],o(u,e[r][i]));if(l)for(let e=0;e<n;e++)f[i][e]=r(f[i][e],o(u,f[s+1][e]))}}}}}(e,s,f,p,d,w);const{values:N,C:T}=function(e,n,o,a,s){const f="BigNumber"===a,p="Complex"===a,m=f?c(1):p?x(1):1;f&&(o=c(o));let d=ae(e);const g=[];let y=n;const b=[];let w=s?l(Array(n).fill(m)):void 0,N=s?l(Array(y).fill(m)):void 0,M=0;for(;M<=100;){M+=1;const e=d[y-1][y-1];for(let t=0;t<y;t++)d[t][t]=r(d[t][t],e);const{Q:c,R:f}=h(d);d=i(f,c);for(let r=0;r<y;r++)d[r][r]=t(d[r][r],e);if(s&&(N=i(N,c)),1===y||v(u(d[y-1][y-2]),o)){M=0,g.push(d[y-1][y-1]),s&&(b.unshift([[1]]),S(N,n),w=i(w,N),y>1&&(N=l(Array(y-1).fill(m)))),y-=1,d.pop();for(let e=0;e<y;e++)d[e].pop()}else if(2===y||v(u(d[y-2][y-3]),o)){M=0;const e=E(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1]);g.push(...e),s&&(b.unshift(A(d[y-2][y-2],d[y-2][y-1],d[y-1][y-2],d[y-1][y-1],e[0],e[1],o,a)),S(N,n),w=i(w,N),y>2&&(N=l(Array(y-2).fill(m)))),y-=2,d.pop(),d.pop();for(let e=0;e<y;e++)d[e].pop(),d[e].pop()}if(0===y)break}if(g.sort(((e,t)=>+r(u(e),u(t)))),M>100){const e=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+g.join(", "));throw e.values=g,e.vectors=[],e}const C=s?i(w,function(e,t){const r=[];for(let e=0;e<t;e++)r[e]=Array(t).fill(0);let n=0;for(const t of e){const e=t.length;for(let i=0;i<e;i++)for(let o=0;o<e;o++)r[n+i][n+o]=t[i][o];n+=e}return r}(b,n)):void 0;return{values:g,C}}(e,s,f,p,d);if(d){const t=function(e,t,o,a,s,u,f){const p=m(o),h=i(p,e,o),d="BigNumber"===f,b="Complex"===f,v=d?c(0):b?x(0):0,w=d?c(1):b?x(1):1,N=[],E=[];for(const e of s){const t=M(N,e,y);-1===t?(N.push(e),E.push(1)):E[t]+=1}const A=[],S=N.length,T=Array(t).fill(v),D=l(Array(t).fill(w));for(let e=0;e<S;e++){const s=N[e],c=r(h,i(s,D));let l=g(c,T);for(l.shift();l.length<E[e];){const e=C(c,t,l,u,f);if(null===e)break;l.push(e)}const p=i(m(a),o);l=l.map((e=>i(p,e))),A.push(...l.map((e=>({value:s,vector:n(e)}))))}return A}(e,s,T,w,N,f,p);return{values:N,eigenvectors:t}}return{values:N}}}({config:t,addScalar:i,subtract:o,multiply:y,multiplyScalar:f,flatten:E,divideScalar:p,sqrt:M,abs:s,bignumber:h,diag:C,size:T,reshape:D,qr:B,inv:m,usolve:F,usolveAll:O,equal:a,complex:S,larger:w,smaller:z,matrixFromColumns:k,dot:R});return r("eigs",{Array:function(e){return j(n(e))},"Array, number|BigNumber":function(e,t){return j(n(e),{precision:t})},"Array, Object":(e,t)=>j(n(e),t),Matrix:function(e){return j(e,{matricize:!0})},"Matrix, number|BigNumber":function(e,t){return j(e,{precision:t,matricize:!0})},"Matrix, Object":function(e,t){const r={matricize:!0};return sn(r,t),j(e,r)}});function j(e){var r;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=!("eigenvectors"in i)||i.eigenvectors,u=function(e,t,r){const n=e.toArray(),i=e.size();if(2!==i.length||i[0]!==i[1])throw new RangeError(`Matrix must be square (size: ${pn(i)})`);const a=i[0];if(function(e,t,r){for(let n=0;n<t;n++)for(let i=0;i<t;i++)if(w(h(s(_(e[n][i]))),r))return!1;return!0}(n,a,t)&&(function(e,t){for(let r=0;r<t;r++)for(let n=0;n<t;n++)e[r][n]=I(e[r][n])}(n,a),function(e,t,r){for(let n=0;n<t;n++)for(let i=n;i<t;i++)if(w(h(s(o(e[n][i],e[i][n]))),r))return!1;return!0}(n,a,t))){const i=U(e,n,a);return q(n,a,t,i,r)}const u=U(e,n,a);return P(n,a,t,u,r)}(e,null!==(r=i.precision)&&void 0!==r?r:t.relTol,a);return i.matricize&&(u.values=n(u.values),a&&(u.eigenvectors=u.eigenvectors.map((e=>{let{value:t,vector:r}=e;return{value:t,vector:n(r)}})))),a&&Object.defineProperty(u,"vectors",{enumerable:!1,get:()=>{throw new Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),u}function U(e,t,r){const n=e.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;let i=!1,o=!1,a=!1;for(let e=0;e<r;e++)for(let n=0;n<r;n++){const r=t[e][n];if(d(r)||b(r))i=!0;else if(g(r))o=!0;else{if(!x(r))throw TypeError("Unsupported type in Matrix: "+oe(r));a=!0}}if(o&&a&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),a){for(let e=0;e<r;e++)for(let n=0;n<r;n++)t[e][n]=S(t[e][n]);return"Complex"}if(o){for(let e=0;e<r;e++)for(let n=0;n<r;n++)t[e][n]=h(t[e][n]);return"BigNumber"}if(i){for(let e=0;e<r;e++)for(let n=0;n<r;n++)t[e][n]=A(t[e][n]);return"number"}throw TypeError("Matrix contains unsupported types only.")}})),rh="expm",nh=he(rh,["typed","abs","add","identity","inv","multiply"],(e=>{let{typed:t,abs:r,add:n,identity:i,inv:o,multiply:a}=e;return t(rh,{Matrix:function(e){const t=e.size();if(2!==t.length||t[0]!==t[1])throw new RangeError("Matrix must be square (size: "+pn(t)+")");const u=t[0],c=function(e){const t=e.size()[0];let n=0;for(let i=0;i<t;i++){let o=0;for(let n=0;n<t;n++)o+=r(e.get([i,n]));n=Math.max(o,n)}return n}(e),l=function(e){for(let t=0;t<30;t++)for(let r=0;r<=t;r++){const n=t-r;if(s(e,r,n)<1e-15)return{q:r,j:n}}throw new Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(c),f=l.q,p=l.j,m=a(e,Math.pow(2,-p));let h=i(u),d=i(u),g=1,y=m,x=-1;for(let e=1;e<=f;e++)e>1&&(y=a(y,m),x=-x),g=g*(f-e+1)/((2*f-e+1)*e),h=n(h,a(g,y)),d=n(d,a(g*x,y));let b=a(o(d),h);for(let e=0;e<p;e++)b=a(b,b);return M(e)?e.createSparseMatrix(b):b}});function s(e,t,r){let n=1;for(let e=2;e<=t;e++)n*=e;let i=n;for(let e=t+1;e<=2*t;e++)i*=e;const o=i*(2*t+1);return 8*Math.pow(e/Math.pow(2,r),2*t)*n*n/(i*o)}})),ih="sqrtm",oh=he(ih,["typed","abs","add","multiply","map","sqrt","subtract","inv","size","max","identity"],(e=>{let{typed:t,abs:r,add:n,multiply:i,map:o,sqrt:a,subtract:s,inv:u,size:c,max:l,identity:f}=e;const p=1e-6;function m(e){let t,o=0,a=e,m=f(c(e));do{const e=a;if(a=i(.5,n(e,u(m))),m=i(.5,n(m,u(e))),t=l(r(s(a,e))),t>p&&++o>1e3)throw new Error("computing square root of matrix: iterative method could not converge")}while(t>p);return a}return t(ih,{"Array | Matrix":function(e){const t=E(e)?e.size():vn(e);switch(t.length){case 1:if(1===t[0])return o(e,a);throw new RangeError("Matrix must be square (size: "+pn(t)+")");case 2:if(t[0]===t[1])return m(e);throw new RangeError("Matrix must be square (size: "+pn(t)+")");default:throw new RangeError("Matrix must be at most two dimensional (size: "+pn(t)+")")}}})})),ah="sylvester",sh=he(ah,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],(e=>{let{typed:t,schur:r,matrixFromColumns:n,matrix:i,multiply:o,range:a,concat:s,transpose:u,index:c,subset:l,add:f,subtract:p,identity:m,lusolve:h,abs:d}=e;return t(ah,{"Matrix, Matrix, Matrix":g,"Array, Matrix, Matrix":function(e,t,r){return g(i(e),t,r)},"Array, Array, Matrix":function(e,t,r){return g(i(e),i(t),r)},"Array, Matrix, Array":function(e,t,r){return g(i(e),t,i(r))},"Matrix, Array, Matrix":function(e,t,r){return g(e,i(t),r)},"Matrix, Array, Array":function(e,t,r){return g(e,i(t),i(r))},"Matrix, Matrix, Array":function(e,t,r){return g(e,t,i(r))},"Array, Array, Array":function(e,t,r){return g(i(e),i(t),i(r)).toArray()}});function g(e,t,g){const y=t.size()[0],x=e.size()[0],b=r(e),v=b.T,w=b.U,N=r(o(-1,t)),E=N.T,A=N.U,S=o(o(u(w),g),A),M=a(0,x),C=[],T=(e,t)=>s(e,t,1),D=(e,t)=>s(e,t,0);for(let e=0;e<y;e++)if(e<y-1&&d(l(E,c(e+1,e)))>1e-5){let t=D(l(S,c(M,e)),l(S,c(M,e+1)));for(let r=0;r<e;r++)t=f(t,D(o(C[r],l(E,c(r,e))),o(C[r],l(E,c(r,e+1)))));const r=o(m(x),o(-1,l(E,c(e,e)))),n=o(m(x),o(-1,l(E,c(e+1,e)))),i=o(m(x),o(-1,l(E,c(e,e+1)))),s=o(m(x),o(-1,l(E,c(e+1,e+1)))),u=D(T(f(v,r),n),T(i,f(v,s))),p=h(u,t);C[e]=p.subset(c(a(0,x),0)),C[e+1]=p.subset(c(a(x,2*x),0)),e++}else{let t=l(S,c(M,e));for(let r=0;r<e;r++)t=f(t,o(C[r],l(E,c(r,e))));const r=l(E,c(e,e)),n=p(v,o(r,m(x)));C[e]=h(n,t)}const B=i(n(...C));return o(w,o(B,u(A)))}})),uh="schur",ch=he(uh,["typed","matrix","identity","multiply","qr","norm","subtract"],(e=>{let{typed:t,matrix:r,identity:n,multiply:i,qr:o,norm:a,subtract:s}=e;return t(uh,{Array:function(e){const t=u(r(e));return{U:t.U.valueOf(),T:t.T.valueOf()}},Matrix:function(e){return u(e)}});function u(e){const t=e.size()[0];let r,u=e,c=n(t),l=0;do{r=u;const e=o(u),t=e.Q,n=e.R;if(u=i(n,t),c=i(c,t),l++>100)break}while(a(s(u,r))>1e-4);return{U:c,T:u}}})),lh="lyap",fh=he(lh,["typed","matrix","sylvester","multiply","transpose"],(e=>{let{typed:t,matrix:r,sylvester:n,multiply:i,transpose:o}=e;return t(lh,{"Matrix, Matrix":function(e,t){return n(e,o(e),i(-1,t))},"Array, Matrix":function(e,t){return n(r(e),o(r(e)),i(-1,t))},"Matrix, Array":function(e,t){return n(e,o(r(e)),r(i(-1,t)))},"Array, Array":function(e,t){return n(r(e),o(r(e)),r(i(-1,t))).toArray()}})})),ph=he("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],(e=>{let{typed:t,matrix:r,multiply:n,equalScalar:i,divideScalar:o,inv:a}=e;const s=Io({typed:t,equalScalar:i}),u=ko({typed:t});return t("divide",se({"Array | Matrix, Array | Matrix":function(e,t){return n(e,a(t))},"DenseMatrix, any":function(e,t){return u(e,t,o,!1)},"SparseMatrix, any":function(e,t){return s(e,t,o,!1)},"Array, any":function(e,t){return u(r(e),t,o,!1).valueOf()},"any, Array | Matrix":function(e,t){return n(e,a(t))}},o.signatures))})),mh="distance",hh=he(mh,["typed","addScalar","subtractScalar","divideScalar","multiplyScalar","deepEqual","sqrt","abs"],(e=>{let{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:o,deepEqual:a,sqrt:s,abs:u}=e;return t(mh,{"Array, Array, Array":function(e,t,r){if(2===e.length&&2===t.length&&2===r.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!l(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(a(t,r))throw new TypeError("LinePoint1 should not be same with LinePoint2");const o=n(r[1],t[1]),s=n(t[0],r[0]),u=n(i(r[0],t[1]),i(t[0],r[1]));return d(e[0],e[1],o,s,u)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(e,t,r){if(2===Object.keys(e).length&&2===Object.keys(t).length&&2===Object.keys(r).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!l(r))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(a(h(t),h(r)))throw new TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in e&&"pointY"in e&&"lineOnePtX"in t&&"lineOnePtY"in t&&"lineTwoPtX"in r&&"lineTwoPtY"in r){const o=n(r.lineTwoPtY,t.lineOnePtY),a=n(t.lineOnePtX,r.lineTwoPtX),s=n(i(r.lineTwoPtX,t.lineOnePtY),i(t.lineOnePtX,r.lineTwoPtY));return d(e.pointX,e.pointY,o,a,s)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(e,t){if(2===e.length&&3===t.length){if(!l(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return d(e[0],e[1],t[0],t[1],t[2])}if(3===e.length&&6===t.length){if(!f(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!m(t))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return y(e[0],e[1],e[2],t[0],t[1],t[2],t[3],t[4],t[5])}if(e.length===t.length&&e.length>0){if(!p(e))throw new TypeError("All values of an array should be numbers or BigNumbers");if(!p(t))throw new TypeError("All values of an array should be numbers or BigNumbers");return x(e,t)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(e,t){if(2===Object.keys(e).length&&3===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"xCoeffLine"in t&&"yCoeffLine"in t&&"constant"in t)return d(e.pointX,e.pointY,t.xCoeffLine,t.yCoeffLine,t.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&6===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!m(t))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in e&&"pointY"in e&&"x0"in t&&"y0"in t&&"z0"in t&&"a"in t&&"b"in t&&"c"in t)return y(e.pointX,e.pointY,e.pointZ,t.x0,t.y0,t.z0,t.a,t.b,t.c);throw new TypeError("Key names do not match")}if(2===Object.keys(e).length&&2===Object.keys(t).length){if(!l(e))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!l(t))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointTwoX"in t&&"pointTwoY"in t)return x([e.pointOneX,e.pointOneY],[t.pointTwoX,t.pointTwoY]);throw new TypeError("Key names do not match")}if(3===Object.keys(e).length&&3===Object.keys(t).length){if(!f(e))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(t))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in e&&"pointOneY"in e&&"pointOneZ"in e&&"pointTwoX"in t&&"pointTwoY"in t&&"pointTwoZ"in t)return x([e.pointOneX,e.pointOneY,e.pointOneZ],[t.pointTwoX,t.pointTwoY,t.pointTwoZ]);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(e){if(!function(e){if(2===e[0].length&&c(e[0][0])&&c(e[0][1])){if(e.some((e=>2!==e.length||!c(e[0])||!c(e[1]))))return!1}else{if(!(3===e[0].length&&c(e[0][0])&&c(e[0][1])&&c(e[0][2])))return!1;if(e.some((e=>3!==e.length||!c(e[0])||!c(e[1])||!c(e[2]))))return!1}return!0}(e))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(e){const t=[];let r=[],n=[];for(let i=0;i<e.length-1;i++)for(let o=i+1;o<e.length;o++)2===e[0].length?(r=[e[i][0],e[i][1]],n=[e[o][0],e[o][1]]):3===e[0].length&&(r=[e[i][0],e[i][1],e[i][2]],n=[e[o][0],e[o][1],e[o][2]]),t.push(x(r,n));return t}(e)}});function c(e){return"number"==typeof e||g(e)}function l(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])}function f(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])}function p(e){return Array.isArray(e)||(e=h(e)),e.every(c)}function m(e){return e.constructor!==Array&&(e=h(e)),c(e[0])&&c(e[1])&&c(e[2])&&c(e[3])&&c(e[4])&&c(e[5])}function h(e){const t=Object.keys(e),r=[];for(let n=0;n<t.length;n++)r.push(e[t[n]]);return r}function d(e,t,n,a,c){const l=u(r(r(i(n,e),i(a,t)),c)),f=s(r(i(n,n),i(a,a)));return o(l,f)}function y(e,t,a,u,c,l,f,p,m){let h=[n(i(n(c,t),m),i(n(l,a),p)),n(i(n(l,a),f),i(n(u,e),m)),n(i(n(u,e),p),i(n(c,t),f))];h=s(r(r(i(h[0],h[0]),i(h[1],h[1])),i(h[2],h[2])));const d=s(r(r(i(f,f),i(p,p)),i(m,m)));return o(h,d)}function x(e,t){const o=e.length;let a=0,u=0;for(let s=0;s<o;s++)u=n(e[s],t[s]),a=r(i(u,u),a);return s(a)}})),dh=he("intersect",["typed","config","abs","add","addScalar","matrix","multiply","multiplyScalar","divideScalar","subtract","smaller","equalScalar","flatten","isZero","isNumeric"],(e=>{let{typed:t,config:r,abs:n,add:i,addScalar:o,matrix:a,multiply:s,multiplyScalar:u,divideScalar:c,subtract:l,smaller:f,equalScalar:p,flatten:m,isZero:h,isNumeric:d}=e;return t("intersect",{"Array, Array, Array":g,"Array, Array, Array, Array":y,"Matrix, Matrix, Matrix":function(e,t,r){const n=g(e.valueOf(),t.valueOf(),r.valueOf());return null===n?null:a(n)},"Matrix, Matrix, Matrix, Matrix":function(e,t,r,n){const i=y(e.valueOf(),t.valueOf(),r.valueOf(),n.valueOf());return null===i?null:a(i)}});function g(e,t,r){if(e=x(e),t=x(t),r=x(r),!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(e){return 4===e.length&&d(e[0])&&d(e[1])&&d(e[2])&&d(e[3])}(r))throw new TypeError("Array with 4 numbers expected as third argument");return function(e,t,r,n,i,a,s,f,p,m){const h=u(e,s),d=u(n,s),g=u(t,f),y=u(i,f),x=u(r,p),b=u(a,p),v=l(l(l(m,h),g),x),w=l(l(l(o(o(d,y),b),h),g),x),N=c(v,w);return[o(e,u(N,l(n,e))),o(t,u(N,l(i,t))),o(r,u(N,l(a,r)))]}(e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2],r[3])}function y(e,t,a,m){if(e=x(e),t=x(t),a=x(a),m=x(m),2===e.length){if(!b(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(a))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(m))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(e,t,a,p){const m=e,d=a,g=l(m,t),y=l(d,p),x=l(u(g[0],y[1]),u(y[0],g[1]));if(h(x))return null;if(f(n(x),r.relTol))return null;const b=u(y[0],m[1]),v=u(y[1],m[0]),w=u(y[0],d[1]),N=u(y[1],d[0]),E=c(o(l(l(b,v),w),N),x);return i(s(g,E),m)}(e,t,a,m)}if(3===e.length){if(!v(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!v(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!v(a))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!v(m))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(e,t,r,n,i,a,s,f,m,d,g,y){const x=w(e,s,d,s,t,f,g,f,r,m,y,m),b=w(d,s,n,e,g,f,i,t,y,m,a,r),v=w(e,s,n,e,t,f,i,t,r,m,a,r),N=w(d,s,d,s,g,f,g,f,y,m,y,m),E=w(n,e,n,e,i,t,i,t,a,r,a,r),A=l(u(x,b),u(v,N)),S=l(u(E,N),u(b,b));if(h(S))return null;const M=c(A,S),C=c(o(x,u(M,b)),N),T=o(e,u(M,l(n,e))),D=o(t,u(M,l(i,t))),B=o(r,u(M,l(a,r))),F=o(s,u(C,l(d,s))),O=o(f,u(C,l(g,f))),_=o(m,u(C,l(y,m)));return p(T,F)&&p(D,O)&&p(B,_)?[T,D,B]:null}(e[0],e[1],e[2],t[0],t[1],t[2],a[0],a[1],a[2],m[0],m[1],m[2])}throw new TypeError("Arrays with two or thee dimensional points expected")}function x(e){return 1===e.length?e[0]:e.length>1&&Array.isArray(e[0])&&e.every((e=>Array.isArray(e)&&1===e.length))?m(e):e}function b(e){return 2===e.length&&d(e[0])&&d(e[1])}function v(e){return 3===e.length&&d(e[0])&&d(e[1])&&d(e[2])}function w(e,t,r,n,i,a,s,c,f,p,m,h){const d=u(l(e,t),l(r,n)),g=u(l(i,a),l(s,c)),y=u(l(f,p),l(m,h));return o(o(d,g),y)}})),gh=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:r,add:n,numeric:i}=e;return t("sum",{"Array | Matrix":o,"Array | Matrix, number | BigNumber":function(e,t){try{return oi(e,t,n)}catch(e){throw Uu(e,"sum")}},"...":function(e){if(ri(e))throw new TypeError("Scalar values expected in function sum");return o(e)}});function o(e){let t;return ni(e,(function(e){try{t=void 0===t?e:n(t,e)}catch(t){throw Uu(t,"sum",e)}})),void 0===t&&(t=i(0,r.number)),"string"==typeof t&&(t=i(t,xe(t,r))),t}})),yh="cumsum",xh=he(yh,["typed","add","unaryPlus"],(e=>{let{typed:t,add:r,unaryPlus:n}=e;return t(yh,{Array:i,Matrix:function(e){return e.create(i(e.valueOf(),e.datatype()))},"Array, number | BigNumber":a,"Matrix, number | BigNumber":function(e,t){return e.create(a(e.valueOf(),t),e.datatype())},"...":function(e){if(ri(e))throw new TypeError("All values expected to be scalar in function cumsum");return i(e)}});function i(e){try{return o(e)}catch(e){throw Uu(e,yh)}}function o(e){if(0===e.length)return[];const t=[n(e[0])];for(let n=1;n<e.length;++n)t.push(r(t[n-1],e[n]));return t}function a(e,t){const r=vn(e);if(t<0||t>=r.length)throw new bn(t,r.length);try{return s(e,t)}catch(e){throw Uu(e,yh)}}function s(e,t){let r,n,i;if(t<=0){const a=e[0][0];if(Array.isArray(a)){for(i=ti(e),n=[],r=0;r<i.length;r++)n[r]=s(i[r],t-1);return n}return o(e)}for(n=[],r=0;r<e.length;r++)n[r]=s(e[r],t-1);return n}})),bh="mean",vh=he(bh,["typed","add","divide"],(e=>{let{typed:t,add:r,divide:n}=e;return t(bh,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(e,t){try{const i=oi(e,t,r),o=Array.isArray(e)?vn(e):e.size();return n(i,o[t])}catch(e){throw Uu(e,"mean")}},"...":function(e){if(ri(e))throw new TypeError("Scalar values expected in function mean");return i(e)}});function i(e){let t,i=0;if(ni(e,(function(e){try{t=void 0===t?e:r(t,e),i++}catch(t){throw Uu(t,"mean",e)}})),0===i)throw new Error("Cannot calculate the mean of an empty array");return n(t,i)}})),wh="median",Nh=he(wh,["typed","add","divide","compare","partitionSelect"],(e=>{let{typed:t,add:r,divide:n,compare:i,partitionSelect:o}=e;function a(e){try{const t=(e=zn(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){const r=t/2-1,n=o(e,r+1);let a=e[r];for(let t=0;t<r;++t)i(e[t],a)>0&&(a=e[t]);return u(a,n)}{const r=o(e,(t-1)/2);return s(r)}}catch(e){throw Uu(e,"median")}}const s=t({"number | BigNumber | Complex | Unit":function(e){return e}}),u=t({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(e,t){return n(r(e,t),2)}});return t(wh,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(e,t){throw new Error("median(A, dim) is not yet supported")},"...":function(e){if(ri(e))throw new TypeError("Scalar values expected in function median");return a(e)}})})),Eh=he("mad",["typed","abs","map","median","subtract"],(e=>{let{typed:t,abs:r,map:n,median:i,subtract:o}=e;return t("mad",{"Array | Matrix":a,"...":function(e){return a(e)}});function a(e){if(0===(e=zn(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{const t=i(e);return i(n(e,(function(e){return r(o(e,t))})))}catch(e){throw e instanceof TypeError&&e.message.includes("median")?new TypeError(e.message.replace("median","mad")):Uu(e,"mad")}}})),Ah="unbiased",Sh="variance",Mh=he(Sh,["typed","add","subtract","multiply","divide","apply","isNaN"],(e=>{let{typed:t,add:r,subtract:n,multiply:i,divide:o,apply:a,isNaN:s}=e;return t(Sh,{"Array | Matrix":function(e){return u(e,Ah)},"Array | Matrix, string":u,"Array | Matrix, number | BigNumber":function(e,t){return c(e,t,Ah)},"Array | Matrix, number | BigNumber, string":c,"...":function(e){return u(e,Ah)}});function u(e,t){let a,u=0;if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");if(ni(e,(function(e){try{a=void 0===a?e:r(a,e),u++}catch(t){throw Uu(t,"variance",e)}})),0===u)throw new Error("Cannot calculate variance of an empty array");const c=o(a,u);if(a=void 0,ni(e,(function(e){const t=n(e,c);a=void 0===a?i(t,t):r(a,i(t,t))})),s(a))return a;switch(t){case"uncorrected":return o(a,u);case"biased":return o(a,u+1);case"unbiased":{const e=g(a)?a.mul(0):0;return 1===u?e:o(a,u-1)}default:throw new Error('Unknown normalization "'+t+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function c(e,t,r){try{if(0===e.length)throw new SyntaxError("Function variance requires one or more parameters (0 provided)");return a(e,t,(e=>u(e,r)))}catch(e){throw Uu(e,"variance")}}})),Ch="quantileSeq",Th=he(Ch,["typed","?bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],(e=>{let{typed:t,bignumber:r,add:n,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p}=e;const m=Mo({typed:t,isInteger:c});return t(Ch,{"Array | Matrix, number | BigNumber":(e,t)=>g(e,t,!1),"Array | Matrix, number | BigNumber, number":(e,t,r)=>h(e,t,!1,r,g),"Array | Matrix, number | BigNumber, boolean":g,"Array | Matrix, number | BigNumber, boolean, number":(e,t,r,n)=>h(e,t,r,n,g),"Array | Matrix, Array | Matrix":(e,t)=>y(e,t,!1),"Array | Matrix, Array | Matrix, number":(e,t,r)=>h(e,t,!1,r,y),"Array | Matrix, Array | Matrix, boolean":y,"Array | Matrix, Array | Matrix, boolean, number":(e,t,r,n)=>h(e,t,r,n,y)});function h(e,t,r,n,i){return m(e,n,(e=>i(e,t,r)))}function g(e,t,i){let a;const s=e.valueOf();if(l(t,0))throw new Error("N/prob must be non-negative");if(f(t,1))return d(t)?x(s,t,i):r(x(s,t,i));if(p(t,1)){if(!c(t))throw new Error("N must be a positive integer");if(p(t,4294967295))throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");const e=n(t,1);a=[];for(let r=0;l(r,t);r++){const t=o(r+1,e);a.push(x(s,t,i))}return d(t)?a:r(a)}}function y(e,t,r){const n=e.valueOf(),i=t.valueOf(),o=[];for(let e=0;e<i.length;++e)o.push(x(n,i[e],r));return o}function x(e,t,r){const o=zn(e),l=o.length;if(0===l)throw new Error("Cannot calculate quantile of an empty sequence");const f=d(t)?t*(l-1):t.times(l-1),p=d(t)?Math.floor(f):f.floor().toNumber(),m=d(t)?f%1:f.minus(p);if(c(f))return r?o[f]:s(o,d(t)?f:f.valueOf());let h,g;if(r)h=o[p],g=o[p+1];else{g=s(o,p+1),h=o[p];for(let e=0;e<p;++e)u(o[e],h)>0&&(h=o[e])}return n(a(h,i(1,m)),a(g,m))}})),Dh=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:r,sqrt:n,variance:i}=e;return t("std",{"Array | Matrix":o,"Array | Matrix, string":o,"Array | Matrix, number | BigNumber":o,"Array | Matrix, number | BigNumber, string":o,"...":function(e){return o(e)}});function o(e,t){if(0===e.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{const e=i.apply(null,arguments);return A(e)?r(e,n):n(e)}catch(e){throw e instanceof TypeError&&e.message.includes(" variance")?new TypeError(e.message.replace(" variance"," std")):e}}})),Bh="corr",Fh=he(Bh,["typed","matrix","mean","sqrt","sum","add","subtract","multiply","pow","divide"],(e=>{let{typed:t,matrix:r,sqrt:n,sum:i,add:o,subtract:a,multiply:s,pow:u,divide:c}=e;return t(Bh,{"Array, Array":function(e,t){return l(e,t)},"Matrix, Matrix":function(e,t){const n=l(e.toArray(),t.toArray());return Array.isArray(n)?r(n):n}});function l(e,t){const r=[];if(Array.isArray(e[0])&&Array.isArray(t[0])){if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(let n=0;n<e.length;n++){if(e[n].length!==t[n].length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");r.push(f(e[n],t[n]))}return r}if(e.length!==t.length)throw new SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return f(e,t)}function f(e,t){const r=e.length,l=i(e),f=i(t),p=e.reduce(((e,r,n)=>o(e,s(r,t[n]))),0),m=i(e.map((e=>u(e,2)))),h=i(t.map((e=>u(e,2)))),d=a(s(r,p),s(l,f)),g=n(s(a(s(r,m),u(l,2)),a(s(r,h),u(f,2))));return c(d,g)}}));function Oh(e,t){if(t<e)return 1;if(t===e)return t;const r=t+e>>1;return Oh(e,r)*Oh(r+1,t)}function _h(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinations");if(t>e)throw new TypeError("k must be less than or equal to n");const r=e-t;let n=1,i=2;const o=t<r?t:r;for(let a=t<r?r+1:t+1;a<=e;++a)for(n*=a;i<=o&&n%i==0;)n/=i,++i;return i<=o&&(n/=Oh(i,o)),n}_h.signature="number, number";const Ih="combinations",zh=he(Ih,["typed"],(e=>{let{typed:t}=e;return t(Ih,{"number, number":_h,"BigNumber, BigNumber":function(e,t){const r=e.constructor;let n,i;const o=e.minus(t),a=new r(1);if(!kh(e)||!kh(t))throw new TypeError("Positive integer value expected in function combinations");if(t.gt(e))throw new TypeError("k must be less than n in function combinations");if(n=a,t.lt(o))for(i=a;i.lte(o);i=i.plus(a))n=n.times(t.plus(i)).dividedBy(i);else for(i=a;i.lte(t);i=i.plus(a))n=n.times(o.plus(i)).dividedBy(i);return n}})}));function kh(e){return e.isInteger()&&e.gte(0)}const Rh="combinationsWithRep",qh=he(Rh,["typed"],(e=>{let{typed:t}=e;return t(Rh,{"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e<1)throw new TypeError("k must be less than or equal to n + k - 1");return t<e-1?Oh(e,e+t-1)/Oh(1,t):Oh(t+1,e+t-1)/Oh(1,e-1)},"BigNumber, BigNumber":function(e,t){let r,n;const i=new(0,e.constructor)(1),o=e.minus(i);if(!Ph(e)||!Ph(t))throw new TypeError("Positive integer value expected in function combinationsWithRep");if(e.lt(i))throw new TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(r=i,t.lt(o))for(n=i;n.lte(o);n=n.plus(i))r=r.times(t.plus(n)).dividedBy(n);else for(n=i;n.lte(t);n=n.plus(i))r=r.times(o.plus(n)).dividedBy(n);return r}})}));function Ph(e){return e.isInteger()&&e.gte(0)}function jh(e){let t;if(ye(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:Oh(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*jh(1-e));if(e>=171.35)return 1/0;if(e>85){const t=e*e,r=t*e,n=r*e,i=n*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*t)-139/(51840*r)-571/(2488320*n)+163879/(209018880*i)+5246819/(75246796800*i*e))}--e,t=Lh[0];for(let r=1;r<Lh.length;++r)t+=Lh[r]/(e+r);const r=e+Uh+.5;return Math.sqrt(2*Math.PI)*Math.pow(r,e+.5)*Math.exp(-r)*t}jh.signature="number";const Uh=4.7421875,Lh=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],$h=.9189385332046728,Hh=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function Gh(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))-Gh(1-e);const t=5+(e-=1)+.5;let r=Hh[0];for(let t=6;t>=1;t--)r+=Hh[t]/(e+t);return $h+(e+.5)*Math.log(t)-t+Math.log(r)}Gh.signature="number";const Vh="gamma",Wh=he(Vh,["typed","config","multiplyScalar","pow","BigNumber","Complex"],(e=>{let{typed:t,config:r,multiplyScalar:n,pow:i,BigNumber:o,Complex:a}=e;return t(Vh,{number:jh,Complex:function e(t){if(0===t.im)return jh(t.re);if(t.re<.5){const r=new a(1-t.re,-t.im),n=new a(Math.PI*t.re,Math.PI*t.im);return new a(Math.PI).div(n.sin()).div(e(r))}t=new a(t.re-1,t.im);let r=new a(Lh[0],0);for(let e=1;e<Lh.length;++e){const n=new a(Lh[e],0);r=r.add(n.div(t.add(e)))}const n=new a(t.re+Uh+.5,t.im),i=Math.sqrt(2*Math.PI),o=n.pow(t.add(.5)),s=n.neg().exp();return r.mul(i).mul(o).mul(s)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new o(1/0):s(e.minus(1));if(!e.isFinite())return new o(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")}});function s(e){if(e<8)return new o([1,1,2,6,24,120,720,5040][e]);const t=r.precision+(0|Math.log(e.toNumber())),n=o.clone({precision:t});if(e%2==1)return e.times(s(new o(e-1)));let i=e,a=new n(e),u=e.toNumber();for(;i>2;)i-=2,u+=i,a=a.times(u);return new o(a.toPrecision(o.precision))}})),Zh="lgamma",Yh=he(Zh,["Complex","typed"],(e=>{let{Complex:t,typed:r}=e;const n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,.0008417508417508417,-.0005952380952380953,.0007936507936507937,-.002777777777777778,.08333333333333333];return r(Zh,{number:Gh,Complex:function e(r){if(r.isNaN())return new t(NaN,NaN);if(0===r.im)return new t(Gh(r.re),0);if(r.re>=7||Math.abs(r.im)>=7)return i(r);if(r.re<=.1){const i=(n=6.283185307179586,(!0^((a=r.im)>0||!(a<0)&&1/a==1/0)?-n:n)*Math.floor(.5*r.re+.25)),o=r.mul(Math.PI).sin().log(),s=e(new t(1-r.re,-r.im));return new t(1.1447298858494002,i).sub(o).sub(s)}return r.im>=0?o(r):o(r.conjugate()).conjugate();var n,a},BigNumber:function(){throw new Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(e){const r=e.sub(.5).mul(e.log()).sub(e).add($h),i=new t(1,0).div(e),o=i.div(e);let a=n[0],s=n[1];const u=2*o.re,c=o.re*o.re+o.im*o.im;for(let e=2;e<8;e++){const t=s;s=-c*a+n[e],a=u*a+t}const l=i.mul(o.mul(a).add(s));return r.add(l)}function o(e){let r=0,n=0,o=e;for(e=e.add(1);e.re<=7;){o=o.mul(e);const t=o.im<0?1:0;0!==t&&0===n&&r++,n=t,e=e.add(1)}return i(e).sub(o.log()).sub(new t(0,2*r*Math.PI*1))}})),Jh="factorial",Xh=he(Jh,["typed","gamma"],(e=>{let{typed:t,gamma:r}=e;return t(Jh,{number:function(e){if(e<0)throw new Error("Value must be non-negative");return r(e+1)},BigNumber:function(e){if(e.isNegative())throw new Error("Value must be non-negative");return r(e.plus(1))},"Array | Matrix":t.referToSelf((e=>t=>ii(t,e)))})})),Qh="kldivergence",Kh=he(Qh,["typed","matrix","divide","sum","multiply","map","dotDivide","log","isNumeric"],(e=>{let{typed:t,matrix:r,divide:n,sum:i,multiply:o,map:a,dotDivide:s,log:u,isNumeric:c}=e;return t(Qh,{"Array, Array":function(e,t){return l(r(e),r(t))},"Matrix, Array":function(e,t){return l(e,r(t))},"Array, Matrix":function(e,t){return l(r(e),t)},"Matrix, Matrix":function(e,t){return l(e,t)}});function l(e,t){const r=t.size().length,l=e.size().length;if(r>1)throw new Error("first object must be one dimensional");if(l>1)throw new Error("second object must be one dimensional");if(r!==l)throw new Error("Length of two vectors must be equal");if(0===i(e))throw new Error("Sum of elements in first object must be non zero");if(0===i(t))throw new Error("Sum of elements in second object must be non zero");const f=n(e,i(e)),p=n(t,i(t)),m=i(o(f,a(s(f,p),(e=>u(e)))));return c(m)?m:Number.NaN}})),ed="multinomial",td=he(ed,["typed","add","divide","multiply","factorial","isInteger","isPositive"],(e=>{let{typed:t,add:r,divide:n,multiply:i,factorial:o,isInteger:a,isPositive:s}=e;return t(ed,{"Array | Matrix":function(e){let t=0,u=1;return ni(e,(function(e){if(!a(e)||!s(e))throw new TypeError("Positive integer value expected in function multinomial");t=r(t,e),u=i(u,o(e))})),n(o(t),u)}})})),rd="permutations",nd=he(rd,["typed","factorial"],(e=>{let{typed:t,factorial:r}=e;return t(rd,{"number | BigNumber":r,"number, number":function(e,t){if(!ye(e)||e<0)throw new TypeError("Positive integer value expected in function permutations");if(!ye(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>e)throw new TypeError("second argument k must be less than or equal to first argument n");return Oh(e-t+1,e)},"BigNumber, BigNumber":function(e,t){let r,n;if(!id(e)||!id(t))throw new TypeError("Positive integer value expected in function permutations");if(t.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(r=e.mul(0).add(1),n=e.minus(t).plus(1);n.lte(e);n=n.plus(1))r=r.times(n);return r}})}));function id(e){return e.isInteger()&&e.gte(0)}var od=r(7391);const ad=od(Date.now());function sd(e){let t;var r;return t=null===(r=e)?ad:od(String(r)),function(){return t()}}const ud="pickRandom",cd=he(ud,["typed","config","?on"],(e=>{let{typed:t,config:r,on:n}=e,i=sd(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=sd(e.randomSeed))})),t(ud,{"Array | Matrix":function(e){return o(e,{})},"Array | Matrix, Object":function(e,t){return o(e,t)},"Array | Matrix, number":function(e,t){return o(e,{number:t})},"Array | Matrix, Array | Matrix":function(e,t){return o(e,{weights:t})},"Array | Matrix, Array | Matrix, number":function(e,t,r){return o(e,{number:r,weights:t})},"Array | Matrix, number, Array | Matrix":function(e,t,r){return o(e,{number:t,weights:r})}});function o(e,t){let{number:r,weights:n,elementWise:o=!0}=t;const a=void 0===r;a&&(r=1);const s=E(e)?e.create:E(n)?n.create:null;e=e.valueOf(),n&&(n=n.valueOf()),!0===o&&(e=zn(e),n=zn(n));let u=0;if(void 0!==n){if(n.length!==e.length)throw new Error("Weights must have the same length as possibles");for(let e=0,t=n.length;e<t;e++){if(!d(n[e])||n[e]<0)throw new Error("Weights must be an array of positive numbers");u+=n[e]}}const c=e.length,l=[];let f;for(;l.length<r;){if(void 0===n)f=e[Math.floor(i()*c)];else{let t=i()*u;for(let r=0,i=e.length;r<i;r++)if(t-=n[r],t<0){f=e[r];break}}l.push(f)}return a?l[0]:s?s(l):l}}));function ld(e,t){const r=[];if((e=e.slice(0)).length>1)for(let n=0,i=e.shift();n<i;n++)r.push(ld(e,t));else for(let n=0,i=e.shift();n<i;n++)r.push(t());return r}const fd="random",pd=he(fd,["typed","config","?on"],(e=>{let{typed:t,config:r,on:n}=e,i=sd(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=sd(e.randomSeed))})),t(fd,{"":()=>a(0,1),number:e=>a(0,e),"number, number":(e,t)=>a(e,t),"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,r)=>o(e,t,r)});function o(e,t,r){const n=ld(e.valueOf(),(()=>a(t,r)));return E(e)?e.create(n,"number"):n}function a(e,t){return e+i()*(t-e)}})),md="randomInt",hd=he(md,["typed","config","?on"],(e=>{let{typed:t,config:r,on:n}=e,i=sd(r.randomSeed);return n&&n("config",(function(e,t){e.randomSeed!==t.randomSeed&&(i=sd(e.randomSeed))})),t(md,{"":()=>a(0,1),number:e=>a(0,e),"number, number":(e,t)=>a(e,t),"Array | Matrix":e=>o(e,0,1),"Array | Matrix, number":(e,t)=>o(e,0,t),"Array | Matrix, number, number":(e,t,r)=>o(e,t,r)});function o(e,t,r){const n=ld(e.valueOf(),(()=>a(t,r)));return E(e)?e.create(n,"number"):n}function a(e,t){return Math.floor(e+i()*(t-e))}})),dd="stirlingS2",gd=he(dd,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],(e=>{let{typed:t,addScalar:r,subtractScalar:n,multiplyScalar:i,divideScalar:o,pow:a,factorial:s,combinations:u,isNegative:c,isInteger:l,number:f,bignumber:p,larger:m}=e;const h=[],g=[];return t(dd,{"number | BigNumber, number | BigNumber":function(e,t){if(!l(e)||c(e)||!l(t)||c(t))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(m(t,e))throw new TypeError("k must be less than or equal to n in function stirlingS2");const n=!(d(e)&&d(t)),o=n?g:h,a=n?p:f,s=f(e),u=f(t);if(o[s]&&o[s].length>u)return o[s][u];for(let e=0;e<=s;++e){if(o[e]||(o[e]=[a(0===e?1:0)]),0===e)continue;const t=o[e],n=o[e-1];for(let o=t.length;o<=e&&o<=u;++o)t[o]=o===e?1:r(i(a(o),n[o]),n[o-1])}return o[s][u]}})})),yd="bellNumbers",xd=he(yd,["typed","addScalar","isNegative","isInteger","stirlingS2"],(e=>{let{typed:t,addScalar:r,isNegative:n,isInteger:i,stirlingS2:o}=e;return t(yd,{"number | BigNumber":function(e){if(!i(e)||n(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");let t=0;for(let n=0;n<=e;n++)t=r(t,o(e,n));return t}})})),bd="catalan",vd=he(bd,["typed","addScalar","divideScalar","multiplyScalar","combinations","isNegative","isInteger"],(e=>{let{typed:t,addScalar:r,divideScalar:n,multiplyScalar:i,combinations:o,isNegative:a,isInteger:s}=e;return t(bd,{"number | BigNumber":function(e){if(!s(e)||a(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(o(i(e,2),e),r(e,1))}})})),wd="composition",Nd=he(wd,["typed","addScalar","combinations","isNegative","isPositive","isInteger","larger"],(e=>{let{typed:t,addScalar:r,combinations:n,isPositive:i,isNegative:o,isInteger:a,larger:s}=e;return t(wd,{"number | BigNumber, number | BigNumber":function(e,t){if(!(a(e)&&i(e)&&a(t)&&i(t)))throw new TypeError("Positive integer value expected in function composition");if(s(t,e))throw new TypeError("k must be less than or equal to n in function composition");return n(r(e,-1),r(t,-1))}})})),Ed="leafCount",Ad=he(Ed,["parse","typed"],(e=>{let{parse:t,typed:r}=e;function n(e){let t=0;return e.forEach((e=>{t+=n(e)})),t||1}return r(Ed,{Node:function(e){return n(e)}})}));function Sd(e){return V(e)||K(e)&&e.isUnary()&&V(e.args[0])}function Md(e){return!!V(e)||!(!Y(e)&&!K(e)||!e.args.every(Md))||!(!ee(e)||!Md(e.content))}const Cd=he("simplifyUtil",["FunctionNode","OperatorNode","SymbolNode"],(e=>{let{FunctionNode:t,OperatorNode:r,SymbolNode:n}=e;const i=!0,o=!1,a="defaultF",s={add:{trivial:i,total:i,commutative:i,associative:i},unaryPlus:{trivial:i,total:i,commutative:i,associative:i},subtract:{trivial:o,total:i,commutative:o,associative:o},multiply:{trivial:i,total:i,commutative:i,associative:i},divide:{trivial:o,total:i,commutative:o,associative:o},paren:{trivial:i,total:i,commutative:i,associative:o},defaultF:{trivial:o,total:i,commutative:o,associative:o}};function u(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,n=a;if("string"==typeof e?n=e:K(e)?n=e.fn.toString():Y(e)?n=e.name:ee(e)&&(n="paren"),me(r,n)){const e=r[n];if(me(e,t))return e[t];if(me(s,n))return s[n][t]}if(me(r,a)){const e=r[a];return me(e,t)?e[t]:s[a][t]}if(me(s,n)){const e=s[n];if(me(e,t))return e[t]}return s[a][t]}function c(e){return u(e,"associative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)}function l(e,t){let r;const n=[],i=function(e){for(let t=0;t<e.args.length;t++){const o=e.args[t];K(o)&&r===o.op?i(o):n.push(o)}};return c(e,t)?(r=e.op,i(e),n):e.args}function f(e){return K(e)?function(t){try{return new r(e.op,e.fn,t,e.implicit)}catch(e){return console.error(e),[]}}:function(r){return new t(new n(e.name),r)}}return{createMakeNodeFunction:f,hasProperty:u,isCommutative:function(e){return u(e,"commutative",arguments.length>1&&void 0!==arguments[1]?arguments[1]:s)},isAssociative:c,mergeContext:function(e,t){const r={...e};for(const n in t)me(e,n)?r[n]={...t[n],...e[n]}:r[n]=t[n];return r},flatten:function e(t,r){if(!t.args||0===t.args.length)return t;t.args=l(t,r);for(let n=0;n<t.args.length;n++)e(t.args[n],r)},allChildren:l,unflattenr:function e(t,r){if(!t.args||0===t.args.length)return;const n=f(t),i=t.args.length;for(let n=0;n<i;n++)e(t.args[n],r);if(i>2&&c(t,r)){let e=t.args.pop();for(;t.args.length>0;)e=n([t.args.pop(),e]);t.args=e.args}},unflattenl:function e(t,r){if(!t.args||0===t.args.length)return;const n=f(t),i=t.args.length;for(let n=0;n<i;n++)e(t.args[n],r);if(i>2&&c(t,r)){let e=t.args.shift();for(;t.args.length>0;)e=n([e,t.args.shift()]);t.args=e.args}},defaultContext:s,realContext:{divide:{total:o},log:{total:o}},positiveContext:{subtract:{total:o},abs:{trivial:i},log:{total:i}}}})),Td=he("simplify",["typed","parse","equal","resolve","simplifyConstant","simplifyCore","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode","replacer"],(e=>{let{typed:t,parse:r,equal:n,resolve:i,simplifyConstant:o,simplifyCore:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:d,ParenthesisNode:g,SymbolNode:y,replacer:x}=e;const{hasProperty:b,isCommutative:v,isAssociative:w,mergeContext:N,flatten:E,unflattenr:A,unflattenl:S,createMakeNodeFunction:M,defaultContext:C,realContext:T,positiveContext:D}=Cd({FunctionNode:l,OperatorNode:d,SymbolNode:y});t.addConversion({from:"Object",to:"Map",convert:h});const B=t("simplify",{Node:k,"Node, Map":(e,t)=>k(e,!1,t),"Node, Map, Object":(e,t,r)=>k(e,!1,t,r),"Node, Array":k,"Node, Array, Map":k,"Node, Array, Map, Object":k});function F(e){return e.transform((function(e){return ee(e)?F(e.content):e}))}t.removeConversion({from:"Object",to:"Map",convert:h}),B.defaultContext=C,B.realContext=T,B.positiveContext=D;const O={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};function _(e,t){const n={};if(e.s){const t=e.s.split("->");if(2!==t.length)throw SyntaxError("Could not parse rule: "+e.s);n.l=t[0],n.r=t[1]}else n.l=e.l,n.r=e.r;n.l=F(r(n.l)),n.r=F(r(n.r));for(const t of["imposeContext","repeat","assuming"])t in e&&(n[t]=e[t]);if(e.evaluate&&(n.evaluate=r(e.evaluate)),w(n.l,t)){const e=!v(n.l,t);let r;e&&(r=z());const i=M(n.l),o=z();n.expanded={},n.expanded.l=i([n.l,o]),E(n.expanded.l,t),A(n.expanded.l,t),n.expanded.r=i([n.r,o]),e&&(n.expandedNC1={},n.expandedNC1.l=i([r,n.l]),n.expandedNC1.r=i([r,n.r]),n.expandedNC2={},n.expandedNC2.l=i([r,n.expanded.l]),n.expandedNC2.r=i([r,n.expanded.r]))}return n}B.rules=[a,{l:"log(e)",r:"1"},{s:"n-n1 -> n+-n1",assuming:{subtract:{total:!0}}},{s:"n-n -> 0",assuming:{subtract:{total:!1}}},{s:"-(cl*v) -> v * (-cl)",assuming:{multiply:{commutative:!0},subtract:{total:!0}}},{s:"-(cl*v) -> (-cl) * v",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{s:"-(v*cl) -> v * (-cl)",assuming:{multiply:{commutative:!1},subtract:{total:!0}}},{l:"-(n1/n2)",r:"-n1/n2"},{l:"-v",r:"v * (-1)"},{l:"(n1 + n2)*(-1)",r:"n1*(-1) + n2*(-1)",repeat:!0},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{s:"(n1*n2)^n3 -> n1^n3 * n2^n3",assuming:{multiply:{commutative:!0}}},{s:"(n1*n2)^(-1) -> n2^(-1) * n1^(-1)",assuming:{multiply:{commutative:!1}}},{s:"(n ^ n1) ^ n2 -> n ^ (n1 * n2)",assuming:{divide:{total:!0}}},{l:" vd * ( vd * n1 + n2)",r:"vd^2 * n1 + vd * n2"},{s:" vd * (vd^n4 * n1 + n2) -> vd^(1+n4) * n1 + vd * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * ( vd * n1 + n2) -> vd^(n3+1) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{s:"vd^n3 * (vd^n4 * n1 + n2) -> vd^(n3+n4) * n1 + vd^n3 * n2",assuming:{divide:{total:!0}}},{l:"n*n",r:"n^2"},{s:"n * n^n1 -> n^(n1+1)",assuming:{divide:{total:!0}}},{s:"n^n1 * n^n2 -> n^(n1+n2)",assuming:{divide:{total:!0}}},o,{s:"n+n -> 2*n",assuming:{add:{total:!0}}},{l:"n+-n",r:"0"},{l:"vd*n + vd",r:"vd*(n+1)"},{l:"n3*n1 + n3*n2",r:"n3*(n1+n2)"},{l:"n3^(-n4)*n1 + n3 * n2",r:"n3^(-n4)*(n1 + n3^(n4+1) *n2)"},{l:"n3^(-n4)*n1 + n3^n5 * n2",r:"n3^(-n4)*(n1 + n3^(n4+n5)*n2)"},{s:"n*vd + vd -> (n+1)*vd",assuming:{multiply:{commutative:!1}}},{s:"vd + n*vd -> (1+n)*vd",assuming:{multiply:{commutative:!1}}},{s:"n1*n3 + n2*n3 -> (n1+n2)*n3",assuming:{multiply:{commutative:!1}}},{s:"n^n1 * n -> n^(n1+1)",assuming:{divide:{total:!0},multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3 -> (n1 + n2*n3^(n4 + 1))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{s:"n1*n3^(-n4) + n2 * n3^n5 -> (n1 + n2*n3^(n4 + n5))*n3^(-n4)",assuming:{multiply:{commutative:!1}}},{l:"n*cd + cd",r:"(n+1)*cd"},{s:"cd*n + cd -> cd*(n+1)",assuming:{multiply:{commutative:!1}}},{s:"cd + cd*n -> cd*(1+n)",assuming:{multiply:{commutative:!1}}},o,{s:"(-n)*n1 -> -(n*n1)",assuming:{subtract:{total:!0}}},{s:"n1*(-n) -> -(n1*n)",assuming:{subtract:{total:!0},multiply:{commutative:!1}}},{s:"ce+ve -> ve+ce",assuming:{add:{commutative:!0}},imposeContext:{add:{commutative:!1}}},{s:"vd*cd -> cd*vd",assuming:{multiply:{commutative:!0}},imposeContext:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n+-(n1)",r:"n-(n1)"},{s:"n*(n1^-1) -> n/n1",assuming:{multiply:{commutative:!0}}},{s:"n*n1^-n2 -> n/n1^n2",assuming:{multiply:{commutative:!0}}},{s:"n^-1 -> 1/n",assuming:{multiply:{commutative:!0}}},{l:"n^1",r:"n"},{s:"n*(n1/n2) -> (n*n1)/n2",assuming:{multiply:{associative:!0}}},{s:"n-(n1+n2) -> n-n1-n2",assuming:{addition:{associative:!0,commutative:!0}}},{l:"1*n",r:"n",imposeContext:{multiply:{commutative:!0}}},{s:"n1/(n2/n3) -> (n1*n3)/n2",assuming:{multiply:{associative:!0}}},{l:"n1/(-n2)",r:"-n1/n2"}];let I=0;function z(){return new y("_p"+I++)}function k(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m(),n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=n.consoleDebug;t=function(e,t){const r=[];for(let n=0;n<e.length;n++){let i,o=e[n];const a=typeof o;switch(a){case"string":o={s:o};case"object":i=_(o,t);break;case"function":i=o;break;default:throw TypeError("Unsupported type of rule: "+a)}r.push(i)}return r}(t||B.rules,n.context);let a=i(e,r);a=F(a);const s={};let u=a.toString({parenthesis:"all"});for(;!s[u];){s[u]=!0,I=0;let e=u;o&&console.log("Working on: ",u);for(let r=0;r<t.length;r++){let i="";if("function"==typeof t[r]?(a=t[r](a,n),o&&(i=t[r].name)):(E(a,n.context),a=q(a,t[r],n.context),o&&(i=`${t[r].l.toString()} -> ${t[r].r.toString()}`)),o){const t=a.toString({parenthesis:"all"});t!==e&&(console.log("Applying",i,"produced",t),e=t)}S(a,n.context)}u=a.toString({parenthesis:"all"})}return a}function R(e,t,r){let n=e;if(e)for(let i=0;i<e.length;++i){const o=q(e[i],t,r);o!==e[i]&&(n===e&&(n=e.slice()),n[i]=o)}return n}function q(e,t,r){if(t.assuming)for(const n in t.assuming)for(const i in t.assuming[n])if(b(n,i,r)!==t.assuming[n][i])return e;const n=N(t.imposeContext,r);let i=e;if(i instanceof d||i instanceof l){const e=R(i.args,t,r);e!==i.args&&(i=i.clone(),i.args=e)}else if(i instanceof g){if(i.content){const e=q(i.content,t,r);e!==i.content&&(i=new g(e))}}else if(i instanceof u){const e=R(i.items,t,r);e!==i.items&&(i=new u(e))}else if(i instanceof s){let e=i.object;i.object&&(e=q(i.object,t,r));let n=i.index;i.index&&(n=q(i.index,t,r)),e===i.object&&n===i.index||(i=new s(e,n))}else if(i instanceof f){const e=R(i.dimensions,t,r);e!==i.dimensions&&(i=new f(e))}else if(i instanceof p){let e=!1;const n={};for(const o in i.properties)n[o]=q(i.properties[o],t,r),n[o]!==i.properties[o]&&(e=!0);e&&(i=new p(n))}let o=t.r,a=U(t.l,i,n)[0];if(!a&&t.expanded&&(o=t.expanded.r,a=U(t.expanded.l,i,n)[0]),!a&&t.expandedNC1&&(o=t.expandedNC1.r,a=U(t.expandedNC1.l,i,n)[0],a||(o=t.expandedNC2.r,a=U(t.expandedNC2.l,i,n)[0])),a){const e=i.implicit;i=o.clone(),e&&"implicit"in o&&(i.implicit=!0),i=i.transform((function(e){return e.isSymbolNode&&me(a.placeholders,e.name)?a.placeholders[e.name].clone():e}))}return t.repeat&&i!==e&&(i=q(i,t,r)),i}function P(e,t){const r={placeholders:{}};if(!e.placeholders&&!t.placeholders)return r;if(!e.placeholders)return t;if(!t.placeholders)return e;for(const n in e.placeholders)if(me(e.placeholders,n)&&(r.placeholders[n]=e.placeholders[n],me(t.placeholders,n)&&!L(e.placeholders[n],t.placeholders[n])))return null;for(const e in t.placeholders)me(t.placeholders,e)&&(r.placeholders[e]=t.placeholders[e]);return r}function j(e,t){const r=[];if(0===e.length||0===t.length)return r;let n;for(let i=0;i<e.length;i++)for(let o=0;o<t.length;o++)n=P(e[i],t[o]),n&&r.push(n);return r}function U(e,t,r,i){let o=[{placeholders:{}}];if(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l){if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return[]}else if(e instanceof l&&e.name!==t.name)return[];if(!(1===t.args.length&&1===e.args.length||!w(t,r)&&t.args.length===e.args.length||i)){if(t.args.length>=2&&2===e.args.length){const n=function(e,t){const r=[];let n,i;const o=M(e);if(v(e,t))for(let t=0;t<e.args.length;t++)i=e.args.slice(0),i.splice(t,1),n=1===i.length?i[0]:o(i),r.push(o([e.args[t],n]));else for(let t=1;t<e.args.length;t++){let a=e.args[0];t>1&&(a=o(e.args.slice(0,t))),i=e.args.slice(t),n=1===i.length?i[0]:o(i),r.push(o([a,n]))}return r}(t,r);let i=[];for(let t=0;t<n.length;t++){const o=U(e,n[t],r,!0);i=i.concat(o)}return i}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}{let n=[];for(let i=0;i<e.args.length;i++){const o=U(e.args[i],t.args[i],r);if(0===o.length)break;n.push(o)}if(n.length!==e.args.length){if(!v(t,r)||1===e.args.length)return[];if(e.args.length>2)throw new Error("permuting >2 commutative non-associative rule arguments not yet implemented");const i=U(e.args[0],t.args[1],r);if(0===i.length)return[];const o=U(e.args[1],t.args[0],r);if(0===o.length)return[];n=[i,o]}o=function(e){if(0===e.length)return e;const t=e.reduce(j),r=[],n={};for(let e=0;e<t.length;e++){const i=JSON.stringify(t[e],x);n[i]||(n[i]=!0,r.push(t[e]))}return r}(n)}}else if(e instanceof y){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(O[e.name]){if(e.name!==t.name)return[]}else switch(e.name[1]>="a"&&e.name[1]<="z"?e.name.substring(0,2):e.name[0]){case"n":case"_p":o[0].placeholders[e.name]=t;break;case"c":case"cl":if(!V(t))return[];o[0].placeholders[e.name]=t;break;case"v":if(V(t))return[];o[0].placeholders[e.name]=t;break;case"vl":if(!ne(t))return[];o[0].placeholders[e.name]=t;break;case"cd":if(!Sd(t))return[];o[0].placeholders[e.name]=t;break;case"vd":if(Sd(t))return[];o[0].placeholders[e.name]=t;break;case"ce":if(!Md(t))return[];o[0].placeholders[e.name]=t;break;case"ve":if(Md(t))return[];o[0].placeholders[e.name]=t;break;default:throw new Error("Invalid symbol in rule: "+e.name)}}else{if(!(e instanceof c))return[];if(!n(e.value,t.value))return[]}return o}function L(e,t){if(e instanceof c&&t instanceof c){if(!n(e.value,t.value))return!1}else if(e instanceof y&&t instanceof y){if(e.name!==t.name)return!1}else{if(!(e instanceof d&&t instanceof d||e instanceof l&&t instanceof l))return!1;if(e instanceof d){if(e.op!==t.op||e.fn!==t.fn)return!1}else if(e instanceof l&&e.name!==t.name)return!1;if(e.args.length!==t.args.length)return!1;for(let r=0;r<e.args.length;r++)if(!L(e.args[r],t.args[r]))return!1}return!0}return B})),Dd=he("simplifyConstant",["typed","config","mathWithTransform","matrix","?fraction","?bignumber","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode"],(e=>{let{typed:t,config:r,mathWithTransform:n,matrix:i,fraction:o,bignumber:a,AccessorNode:s,ArrayNode:u,ConstantNode:c,FunctionNode:l,IndexNode:f,ObjectNode:p,OperatorNode:m,SymbolNode:h}=e;const{isCommutative:d,isAssociative:g,allChildren:y,createMakeNodeFunction:x}=Cd({FunctionNode:l,OperatorNode:m,SymbolNode:h}),v=t("simplifyConstant",{Node:e=>S(B(e,{})),"Node, Object":function(e,t){return S(B(e,t))}});function w(e){return b(e)?e.valueOf():e instanceof Array?e.map(w):E(e)?i(w(e.valueOf())):e}function N(e,t,r){try{return n[e].apply(null,t)}catch(i){return t=t.map(w),C(n[e].apply(null,t),r)}}const A=t({Fraction:function(e){const t=e=>"BigNumber"===r.number&&a?a(e):Number(e),n=e.s*e.n,i=n<0n?new m("-","unaryMinus",[new c(-t(n))]):new c(t(n));return 1n===e.d?i:new m("/","divide",[i,new c(t(e.d))])},number:function(e){return e<0?T(new c(-e)):new c(e)},BigNumber:function(e){return e<0?T(new c(-e)):new c(e)},bigint:function(e){return e<0n?T(new c(-e)):new c(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")},string:function(e){return new c(e)},Matrix:function(e){return new u(e.valueOf().map((e=>A(e))))}});function S(e){return X(e)?e:A(e)}function M(e,t){if(t&&!1!==t.exactFractions&&isFinite(e)&&o){const r=o(e),n=t&&"number"==typeof t.fractionsLimit?t.fractionsLimit:1/0;if(r.valueOf()===e&&r.n<n&&r.d<n)return r}return e}const C=t({"string, Object":function(e,t){const n=xe(e,r);return"BigNumber"===n?(void 0===a&&Qs(),a(e)):"bigint"===n?BigInt(e):"Fraction"===n?(void 0===o&&Ks(),o(e)):M(parseFloat(e),t)},"Fraction, Object":function(e,t){return e},"BigNumber, Object":function(e,t){return e},"number, Object":function(e,t){return M(e,t)},"bigint, Object":function(e,t){return e},"Complex, Object":function(e,t){return 0!==e.im?e:M(e.re,t)},"Matrix, Object":function(e,t){return i(M(e.valueOf()))},"Array, Object":function(e,t){return e.map(M)}});function T(e){return new m("-","unaryMinus",[e])}function D(e,t,r,n){const i=t.shift(),o=t.reduce(((t,i)=>{if(!X(i)){const r=t.pop();if(X(r))return[r,i];try{return t.push(N(e,[r,i],n)),t}catch(e){t.push(r)}}t.push(S(t.pop()));const o=1===t.length?t[0]:r(t);return[r([o,S(i)])]}),[i]);return 1===o.length?o[0]:r([o[0],A(o[1])])}function B(e,t){switch(e.type){case"SymbolNode":return e;case"ConstantNode":switch(typeof e.value){case"number":case"bigint":return C(e.value,t);case"string":return e.value;default:if(!isNaN(e.value))return C(e.value,t)}return e;case"FunctionNode":if(n[e.name]&&n[e.name].rawArgs)return e;if(!["add","multiply"].includes(e.name)){const r=e.args.map((e=>B(e,t)));if(!r.some(X))try{return N(e.name,r,t)}catch(e){}if("size"===e.name&&1===r.length&&L(r[0])){const e=[];let t=r[0];for(;L(t);)e.push(t.items.length),t=t.items[0];return i(e)}return new l(e.name,r.map(S))}case"OperatorNode":{const r=e.fn.toString();let n,i;const o=x(e);if(K(e)&&e.isUnary())n=[B(e.args[0],t)],i=X(n[0])?o(n):N(r,n,t);else if(g(e,t.context))if(n=y(e,t.context),n=n.map((e=>B(e,t))),d(r,t.context)){const e=[],a=[];for(let t=0;t<n.length;t++)X(n[t])?a.push(n[t]):e.push(n[t]);e.length>1?(i=D(r,e,o,t),a.unshift(i),i=D(r,a,o,t)):i=D(r,n,o,t)}else i=D(r,n,o,t);else n=e.args.map((e=>B(e,t))),i=D(r,n,o,t);return i}case"ParenthesisNode":return B(e.content,t);case"AccessorNode":return function(e,t,r){if(!J(t))return new s(S(e),S(t));if(L(e)||E(e)){const n=Array.from(t.dimensions);for(;n.length>0;)if(V(n[0])&&"string"!=typeof n[0].value){const t=C(n.shift().value,r);L(e)?e=e.items[t-1]:(e=e.valueOf()[t-1])instanceof Array&&(e=i(e))}else{if(!(n.length>1&&V(n[1])&&"string"!=typeof n[1].value))break;{const t=C(n[1].value,r),o=[],a=L(e)?e.items:e.valueOf();for(const r of a)if(L(r))o.push(r.items[t-1]);else{if(!E(e))break;o.push(r[t-1])}if(o.length!==a.length)break;e=L(e)?new u(o):i(o),n.splice(1,1)}}return n.length===t.dimensions.length?new s(S(e),t):n.length>0?(t=new f(n),new s(S(e),t)):e}if(Q(e)&&1===t.dimensions.length&&V(t.dimensions[0])){const r=t.dimensions[0].value;return r in e.properties?e.properties[r]:new c}return new s(S(e),t)}(B(e.object,t),B(e.index,t),t);case"ArrayNode":{const r=e.items.map((e=>B(e,t)));return r.some(X)?new u(r.map(S)):i(r)}case"IndexNode":return new f(e.dimensions.map((e=>v(e,t))));case"ObjectNode":{const r={};for(const n in e.properties)r[n]=v(e.properties[n],t);return new p(r)}default:throw new Error(`Unimplemented node type in simplifyConstant: ${e.type}`)}}return v})),Bd="simplifyCore",Fd=he(Bd,["typed","parse","equal","isZero","add","subtract","multiply","divide","pow","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,parse:r,equal:n,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,AccessorNode:l,ArrayNode:f,ConstantNode:p,FunctionNode:m,IndexNode:h,ObjectNode:d,OperatorNode:g,ParenthesisNode:y,SymbolNode:x}=e;const b=new p(0),v=new p(1),w=new p(!0),N=new p(!1);function E(e){return K(e)&&["and","not","or"].includes(e.op)}const{hasProperty:A,isCommutative:S}=Cd({FunctionNode:m,OperatorNode:g,SymbolNode:x});function M(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=t?t.context:void 0;if(A(e,"trivial",r)){if(Y(e)&&1===e.args.length)return M(e.args[0],t);let r=!1,n=0;if(e.forEach((e=>{++n,1===n&&(r=M(e,t))})),1===n)return r}let o=e;if(Y(o)){const e=function(e){const t="OperatorNode:"+e;for(const e of Dp)if(t in e)return e[t].op;return null}(o.name);if(!e)return new m(M(o.fn),o.args.map((e=>M(e,t))));if(o.args.length>2&&A(o,"associative",r))for(;o.args.length>2;){const t=o.args.pop(),r=o.args.pop();o.args.push(new g(e,o.name,[t,r]))}o=new g(e,o.name,o.args)}if(K(o)&&o.isUnary()){const e=M(o.args[0],t);if("~"===o.op&&K(e)&&e.isUnary()&&"~"===e.op)return e.args[0];if("not"===o.op&&K(e)&&e.isUnary()&&"not"===e.op&&E(e.args[0]))return e.args[0];let r=!0;if("-"===o.op&&K(e)&&(e.isBinary()&&"subtract"===e.fn&&(o=new g("-","subtract",[e.args[1],e.args[0]]),r=!1),e.isUnary()&&"-"===e.op))return e.args[0];if(r)return new g(o.op,o.fn,[e])}if(K(o)&&o.isBinary()){const e=M(o.args[0],t);let a=M(o.args[1],t);if("+"===o.op){if(V(e)&&i(e.value))return a;if(V(a)&&i(a.value))return e;K(a)&&a.isUnary()&&"-"===a.op&&(a=a.args[0],o=new g("-","subtract",[e,a]))}if("-"===o.op)return K(a)&&a.isUnary()&&"-"===a.op?M(new g("+","add",[e,a.args[0]]),t):V(e)&&i(e.value)?M(new g("-","unaryMinus",[a])):V(a)&&i(a.value)?e:new g(o.op,o.fn,[e,a]);if("*"===o.op){if(V(e)){if(i(e.value))return b;if(n(e.value,1))return a}if(V(a)){if(i(a.value))return b;if(n(a.value,1))return e;if(S(o,r))return new g(o.op,o.fn,[a,e],o.implicit)}return new g(o.op,o.fn,[e,a],o.implicit)}if("/"===o.op)return V(e)&&i(e.value)?b:V(a)&&n(a.value,1)?e:new g(o.op,o.fn,[e,a]);if("^"===o.op&&V(a)){if(i(a.value))return v;if(n(a.value,1))return e}if("and"===o.op){if(V(e)){if(!e.value)return N;if(E(a))return a;if(V(a))return a.value?w:N}if(V(a)){if(!a.value)return N;if(E(e))return e}}if("or"===o.op){if(V(e)){if(e.value)return w;if(E(a))return a}if(V(a)){if(a.value)return w;if(E(e))return e}}return new g(o.op,o.fn,[e,a])}if(K(o))return new g(o.op,o.fn,o.args.map((e=>M(e,t))));if(L(o))return new f(o.items.map((e=>M(e,t))));if(U(o))return new l(M(o.object,t),M(o.index,t));if(J(o))return new h(o.dimensions.map((e=>M(e,t))));if(Q(o)){const e={};for(const r in o.properties)e[r]=M(o.properties[r],t);return new d(e)}return o}return t(Bd,{Node:M,"Node,Object":M})})),Od=he("resolve",["typed","parse","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode"],(e=>{let{typed:t,parse:r,ConstantNode:n,FunctionNode:i,OperatorNode:o,ParenthesisNode:a}=e;function s(e,t){let u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set;if(!t)return e;if(ne(e)){if(u.has(e.name)){const e=Array.from(u).join(", ");throw new ReferenceError(`recursive loop of variable definitions among {${e}}`)}const i=t.get(e.name);if(X(i)){const r=new Set(u);return r.add(e.name),s(i,t,r)}return"number"==typeof i?r(String(i)):void 0!==i?new n(i):e}if(K(e)){const r=e.args.map((function(e){return s(e,t,u)}));return new o(e.op,e.fn,r,e.implicit)}if(ee(e))return new a(s(e.content,t,u));if(Y(e)){const r=e.args.map((function(e){return s(e,t,u)}));return new i(e.name,r)}return e.map((e=>s(e,t,u)))}return t("resolve",{Node:s,"Node, Map | null | undefined":s,"Node, Object":(e,t)=>s(e,h(t)),"Array | Matrix":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array | Matrix, null | undefined":t.referToSelf((e=>t=>t.map((t=>e(t))))),"Array, Object":t.referTo("Array,Map",(e=>(t,r)=>e(t,h(r)))),"Matrix, Object":t.referTo("Matrix,Map",(e=>(t,r)=>e(t,h(r)))),"Array | Matrix, Map":t.referToSelf((e=>(t,r)=>t.map((t=>e(t,r)))))})})),_d="symbolicEqual",Id=he(_d,["parse","simplify","typed","OperatorNode"],(e=>{let{parse:t,simplify:r,typed:n,OperatorNode:i}=e;function o(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new i("-","subtract",[e,t]),a=r(o,{},n);return V(a)&&!a.value}return n(_d,{"Node, Node":o,"Node, Node, Object":o})})),zd="derivative",kd=he(zd,["typed","config","parse","simplify","equal","isZero","numeric","ConstantNode","FunctionNode","OperatorNode","ParenthesisNode","SymbolNode"],(e=>{let{typed:t,config:r,parse:n,simplify:i,equal:o,isZero:a,numeric:s,ConstantNode:u,FunctionNode:c,OperatorNode:l,ParenthesisNode:f,SymbolNode:p}=e;function m(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{simplify:!0};const n={};y(n,e,t.name);const o=x(e,n);return r.simplify?i(o):o}function h(e){const t=n(e);if(!t.isSymbolNode)throw new TypeError(`Invalid variable. Cannot parse ${JSON.stringify(e)} into a variable in function derivative`);return t}const d=t(zd,{"Node, SymbolNode":m,"Node, SymbolNode, Object":m,"Node, string":(e,t)=>m(e,h(t)),"Node, string, Object":(e,t,r)=>m(e,h(t),r)});d._simplify=!0,d.toTex=function(e){return g.apply(null,e.args)};const g=t("_derivTex",{"Node, SymbolNode":function(e,t){return V(e)&&"string"===oe(e.value)?g(n(e.value).toString(),t.toString(),1):g(e.toTex(),t.toString(),1)},"Node, ConstantNode":function(e,t){if("string"===oe(t.value))return g(e,n(t.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,t,r){return g(e.toString(),t.name,r.value)},"string, string, number":function(e,t,r){let n;return n=1===r?"{d\\over d"+t+"}":"{d^{"+r+"}\\over d"+t+"^{"+r+"}}",n+`\\left[${e}\\right]`}}),y=t("constTag",{"Object, ConstantNode, string":function(e,t){return e[t]=!0,!0},"Object, SymbolNode, string":function(e,t,r){return t.name!==r&&(e[t]=!0,!0)},"Object, ParenthesisNode, string":function(e,t,r){return y(e,t.content,r)},"Object, FunctionAssignmentNode, string":function(e,t,r){return t.params.includes(r)?y(e,t.expr,r):(e[t]=!0,!0)},"Object, FunctionNode | OperatorNode, string":function(e,t,r){if(t.args.length>0){let n=y(e,t.args[0],r);for(let i=1;i<t.args.length;++i)n=y(e,t.args[i],r)&&n;if(n)return e[t]=!0,!0}return!1}}),x=t("_derivative",{"ConstantNode, Object":function(e){return b(0)},"SymbolNode, Object":function(e,t){return void 0!==t[e]?b(0):b(1)},"ParenthesisNode, Object":function(e,t){return new f(x(e.content,t))},"FunctionAssignmentNode, Object":function(e,t){return void 0!==t[e]?b(0):x(e.expr,t)},"FunctionNode, Object":function(e,t){if(void 0!==t[e])return b(0);const r=e.args[0];let n,i,o,a,s=!1,u=!1;switch(e.name){case"cbrt":s=!0,i=new l("*","multiply",[b(3),new l("^","pow",[r,new l("/","divide",[b(2),b(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,i=new l("*","multiply",[b(2),new c("sqrt",[r])]);else if(2===e.args.length)return n=new l("/","divide",[b(1),e.args[1]]),t[n]=t[e.args[1]],x(new l("^","pow",[r,n]),t);break;case"log10":n=b(10);case"log":if(n||1!==e.args.length){if(1===e.args.length&&n||2===e.args.length&&void 0!==t[e.args[1]])i=new l("*","multiply",[r.clone(),new c("log",[n||e.args[1]])]),s=!0;else if(2===e.args.length)return x(new l("/","divide",[new c("log",[r]),new c("log",[e.args[1]])]),t)}else i=r.clone(),s=!0;break;case"pow":if(2===e.args.length)return t[n]=t[e.args[1]],x(new l("^","pow",[r,e.args[1]]),t);break;case"exp":i=new c("exp",[r.clone()]);break;case"sin":i=new c("cos",[r.clone()]);break;case"cos":i=new l("-","unaryMinus",[new c("sin",[r.clone()])]);break;case"tan":i=new l("^","pow",[new c("sec",[r.clone()]),b(2)]);break;case"sec":i=new l("*","multiply",[e,new c("tan",[r.clone()])]);break;case"csc":u=!0,i=new l("*","multiply",[e,new c("cot",[r.clone()])]);break;case"cot":u=!0,i=new l("^","pow",[new c("csc",[r.clone()]),b(2)]);break;case"asin":s=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])])]);break;case"acos":s=!0,u=!0,i=new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])])]);break;case"atan":s=!0,i=new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)]);break;case"asec":s=!0,i=new l("*","multiply",[new c("abs",[r.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[r.clone(),b(2)]),b(1)])])]);break;case"acsc":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[r.clone()]),new c("sqrt",[new l("-","subtract",[new l("^","pow",[r.clone(),b(2)]),b(1)])])]);break;case"acot":s=!0,u=!0,i=new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)]);break;case"sinh":i=new c("cosh",[r.clone()]);break;case"cosh":i=new c("sinh",[r.clone()]);break;case"tanh":i=new l("^","pow",[new c("sech",[r.clone()]),b(2)]);break;case"sech":u=!0,i=new l("*","multiply",[e,new c("tanh",[r.clone()])]);break;case"csch":u=!0,i=new l("*","multiply",[e,new c("coth",[r.clone()])]);break;case"coth":u=!0,i=new l("^","pow",[new c("csch",[r.clone()]),b(2)]);break;case"asinh":s=!0,i=new c("sqrt",[new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)])]);break;case"acosh":s=!0,i=new c("sqrt",[new l("-","subtract",[new l("^","pow",[r.clone(),b(2)]),b(1)])]);break;case"atanh":s=!0,i=new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])]);break;case"asech":s=!0,u=!0,i=new l("*","multiply",[r.clone(),new c("sqrt",[new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])])])]);break;case"acsch":s=!0,u=!0,i=new l("*","multiply",[new c("abs",[r.clone()]),new c("sqrt",[new l("+","add",[new l("^","pow",[r.clone(),b(2)]),b(1)])])]);break;case"acoth":s=!0,u=!0,i=new l("-","subtract",[b(1),new l("^","pow",[r.clone(),b(2)])]);break;case"abs":i=new l("/","divide",[new c(new p("abs"),[r.clone()]),r.clone()]);break;default:throw new Error('Cannot process function "'+e.name+'" in derivative: the function is not supported, undefined, or the number of arguments passed to it are not supported')}s?(o="/",a="divide"):(o="*",a="multiply");let f=x(r,t);return u&&(f=new l("-","unaryMinus",[f])),new l(o,a,[f,i])},"OperatorNode, Object":function(e,t){if(void 0!==t[e])return b(0);if("+"===e.op)return new l(e.op,e.fn,e.args.map((function(e){return x(e,t)})));if("-"===e.op){if(e.isUnary())return new l(e.op,e.fn,[x(e.args[0],t)]);if(e.isBinary())return new l(e.op,e.fn,[x(e.args[0],t),x(e.args[1],t)])}if("*"===e.op){const r=e.args.filter((function(e){return void 0!==t[e]}));if(r.length>0){const n=e.args.filter((function(e){return void 0===t[e]})),i=1===n.length?n[0]:new l("*","multiply",n),o=r.concat(x(i,t));return new l("*","multiply",o)}return new l("+","add",e.args.map((function(r){return new l("*","multiply",e.args.map((function(e){return e===r?x(e,t):e.clone()})))})))}if("/"===e.op&&e.isBinary()){const r=e.args[0],n=e.args[1];return void 0!==t[n]?new l("/","divide",[x(r,t),n]):void 0!==t[r]?new l("*","multiply",[new l("-","unaryMinus",[r]),new l("/","divide",[x(n,t),new l("^","pow",[n.clone(),b(2)])])]):new l("/","divide",[new l("-","subtract",[new l("*","multiply",[x(r,t),n.clone()]),new l("*","multiply",[r.clone(),x(n,t)])]),new l("^","pow",[n.clone(),b(2)])])}if("^"===e.op&&e.isBinary()){const r=e.args[0],n=e.args[1];if(void 0!==t[r])return V(r)&&(a(r.value)||o(r.value,1))?b(0):new l("*","multiply",[e,new l("*","multiply",[new c("log",[r.clone()]),x(n.clone(),t)])]);if(void 0!==t[n]){if(V(n)){if(a(n.value))return b(0);if(o(n.value,1))return x(r,t)}const e=new l("^","pow",[r.clone(),new l("-","subtract",[n,b(1)])]);return new l("*","multiply",[n.clone(),new l("*","multiply",[x(r,t),e])])}return new l("*","multiply",[new l("^","pow",[r.clone(),n.clone()]),new l("+","add",[new l("*","multiply",[x(r,t),new l("/","divide",[n.clone(),r.clone()])]),new l("*","multiply",[x(n,t),new c("log",[r.clone()])])])])}throw new Error('Cannot process operator "'+e.op+'" in derivative: the operator is not supported, undefined, or the number of arguments passed to it are not supported')}});function b(e,t){return new u(s(e,t||xe(String(e),r)))}return d})),Rd="rationalize",qd=he(Rd,["config","typed","equal","isZero","add","subtract","multiply","divide","pow","parse","simplifyConstant","simplifyCore","simplify","?bignumber","?fraction","mathWithTransform","matrix","AccessorNode","ArrayNode","ConstantNode","FunctionNode","IndexNode","ObjectNode","OperatorNode","SymbolNode","ParenthesisNode"],(e=>{let{config:t,typed:r,equal:n,isZero:i,add:o,subtract:a,multiply:s,divide:u,pow:c,parse:l,simplifyConstant:f,simplifyCore:p,simplify:m,fraction:h,bignumber:d,mathWithTransform:g,matrix:y,AccessorNode:x,ArrayNode:b,ConstantNode:v,FunctionNode:w,IndexNode:N,ObjectNode:E,OperatorNode:A,SymbolNode:S,ParenthesisNode:M}=e;function C(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=function(){const e=[p,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},f,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],t=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],r=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],n={};return n.firstRules=e.concat(t,r),n.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],n.sucDivRules=r,n.firstRulesAgain=e.concat(t),n.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))"}],n}(),i=function(e,t,r,n){const i=[],o=m(e,n,t,{exactFractions:!1}),a="+-*"+((r=!!r)?"/":"");!function e(t){const r=t.type;if("FunctionNode"===r)throw new Error("There is an unsolved function call");if("OperatorNode"===r)if("^"===t.op){if("ConstantNode"!==t.args[1].type||!ye(parseFloat(t.args[1].value)))throw new Error("There is a non-integer exponent");e(t.args[0])}else{if(!a.includes(t.op))throw new Error("Operator "+t.op+" invalid in polynomial expression");for(let r=0;r<t.args.length;r++)e(t.args[r])}else if("SymbolNode"===r){const e=t.name;-1===i.indexOf(e)&&i.push(e)}else if("ParenthesisNode"===r)e(t.content);else if("ConstantNode"!==r)throw new Error("type "+r+" is not allowed in polynomial expression")}(o);const s={};return s.expression=o,s.variables=i,s}(e,t,!0,n.firstRules),o=i.variables.length,a={exactFractions:!1},s={exactFractions:!0};if(e=i.expression,o>=1){let t,r;e=T(e);let i,o=!0,u=!1;for(e=m(e,n.firstRules,{},a);r=o?n.distrDivRules:n.sucDivRules,o=!o,i=(e=m(e,r,{},s)).toString(),i!==t;)u=!0,t=i;u&&(e=m(e,n.firstRulesAgain,{},a)),e=m(e,n.finalRules,{},a)}const u=[],c={};return"OperatorNode"===e.type&&e.isBinary()&&"/"===e.op?(1===o&&(e.args[0]=D(e.args[0],u),e.args[1]=D(e.args[1])),r&&(c.numerator=e.args[0],c.denominator=e.args[1])):(1===o&&(e=D(e,u)),r&&(c.numerator=e,c.denominator=null)),r?(c.coefficients=u,c.variables=i.variables,c.expression=e,c):e}return r(Rd,{Node:C,"Node, boolean":(e,t)=>C(e,{},t),"Node, Object":C,"Node, Object, boolean":C});function T(e,t,r){const n=e.type,i=arguments.length>1;if("OperatorNode"===n&&e.isBinary()){let n,o=!1;if("^"===e.op&&("ParenthesisNode"!==e.args[0].type&&"OperatorNode"!==e.args[0].type||"ConstantNode"!==e.args[1].type||(n=parseFloat(e.args[1].value),o=n>=2&&ye(n))),o){if(n>2){const t=e.args[0],r=new A("^","pow",[e.args[0].cloneDeep(),new v(n-1)]);e=new A("*","multiply",[t,r])}else e=new A("*","multiply",[e.args[0],e.args[0].cloneDeep()]);i&&("content"===r?t.content=e:t.args[r]=e)}}if("ParenthesisNode"===n)T(e.content,e,"content");else if("ConstantNode"!==n&&"SymbolNode"!==n)for(let t=0;t<e.args.length;t++)T(e.args[t],e,t);if(!i)return e}function D(e,t){void 0===t&&(t=[]),t[0]=0;let r=0,n="";!function e(i,o,a){const s=i.type;if("FunctionNode"===s)throw new Error("There is an unsolved function call");if("OperatorNode"===s){if(!"+-*^".includes(i.op))throw new Error("Operator "+i.op+" invalid");if(null!==o){if(("unaryMinus"===i.fn||"pow"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn&&"multiply"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"multiply"===i.fn)&&"add"!==o.fn&&"subtract"!==o.fn)throw new Error("Invalid "+i.op+" placing");if(("subtract"===i.fn||"add"===i.fn||"unaryMinus"===i.fn)&&0!==a.noFil)throw new Error("Invalid "+i.op+" placing")}"^"!==i.op&&"*"!==i.op||(a.fire=i.op);for(let t=0;t<i.args.length;t++)"unaryMinus"===i.fn&&(a.oper="-"),"+"!==i.op&&"subtract"!==i.fn||(a.fire="",a.cte=1,a.oper=0===t?"+":i.op),a.noFil=t,e(i.args[t],i,a)}else if("SymbolNode"===s){if(i.name!==n&&""!==n)throw new Error("There is more than one variable");if(n=i.name,null===o)return void(t[1]=1);if("^"===o.op&&0!==a.noFil)throw new Error("In power the variable should be the first parameter");if("*"===o.op&&1!==a.noFil)throw new Error("In multiply the variable should be the second parameter");""!==a.fire&&"*"!==a.fire||(r<1&&(t[1]=0),t[1]+=a.cte*("+"===a.oper?1:-1),r=Math.max(1,r))}else{if("ConstantNode"!==s)throw new Error("Type "+s+" is not allowed");{const e=parseFloat(i.value);if(null===o)return void(t[0]=e);if("^"===o.op){if(1!==a.noFil)throw new Error("Constant cannot be powered");if(!ye(e)||e<=0)throw new Error("Non-integer exponent is not allowed");for(let n=r+1;n<e;n++)t[n]=0;return e>r&&(t[e]=0),t[e]+=a.cte*("+"===a.oper?1:-1),void(r=Math.max(e,r))}a.cte=e,""===a.fire&&(t[0]+=a.cte*("+"===a.oper?1:-1))}}}(e,null,{cte:1,oper:"+",fire:""}),r=t.length-1;let i,o=!0;for(let e=r;e>=0;e--){if(0===t[e])continue;let r=new v(o?t[e]:Math.abs(t[e]));const a=t[e]<0?"-":"+";if(e>0){let i=new S(n);if(e>1){const t=new v(e);i=new A("^","pow",[i,t])}r=-1===t[e]&&o?new A("-","unaryMinus",[i]):1===Math.abs(t[e])?i:new A("*","multiply",[r,i])}i=o?r:"+"===a?new A("+","add",[i,r]):new A("-","subtract",[i,r]),o=!1}return o?new v(0):i}})),Pd="zpk2tf",jd=he(Pd,["typed","add","multiply","Complex","number"],(e=>{let{typed:t,add:r,multiply:n,Complex:i,number:o}=e;return t(Pd,{"Array,Array,number":function(e,t,r){return a(e,t,r)},"Array,Array":function(e,t){return a(e,t,1)},"Matrix,Matrix,number":function(e,t,r){return a(e.valueOf(),t.valueOf(),r)},"Matrix,Matrix":function(e,t){return a(e.valueOf(),t.valueOf(),1)}});function a(e,t,r){e.some((e=>"BigNumber"===e.type))&&(e=e.map((e=>o(e)))),t.some((e=>"BigNumber"===e.type))&&(t=t.map((e=>o(e))));let a=[i(1,0)],u=[i(1,0)];for(let t=0;t<e.length;t++){let r=e[t];"number"==typeof r&&(r=i(r,0)),a=s(a,[i(1,0),i(-r.re,-r.im)])}for(let e=0;e<t.length;e++){let r=t[e];"number"==typeof r&&(r=i(r,0)),u=s(u,[i(1,0),i(-r.re,-r.im)])}for(let e=0;e<a.length;e++)a[e]=n(a[e],r);return[a,u]}function s(e,t){const o=[];for(let a=0;a<e.length+t.length-1;a++){o[a]=i(0,0);for(let i=0;i<e.length;i++)a-i>=0&&a-i<t.length&&(o[a]=r(o[a],n(e[i],t[a-i])))}return o}})),Ud="freqz",Ld=he(Ud,["typed","add","multiply","Complex","divide","matrix"],(e=>{let{typed:t,add:r,multiply:n,Complex:i,divide:o,matrix:a}=e;return t(Ud,{"Array, Array":function(e,t){return s(e,t,u(512))},"Array, Array, Array":function(e,t,r){return s(e,t,r)},"Array, Array, number":function(e,t,r){if(r<0)throw new Error("w must be a positive number");return s(e,t,u(r))},"Matrix, Matrix":function(e,t){const r=u(512),{w:n,h:i}=s(e.valueOf(),t.valueOf(),r);return{w:a(n),h:a(i)}},"Matrix, Matrix, Matrix":function(e,t,r){const{h:n}=s(e.valueOf(),t.valueOf(),r.valueOf());return{h:a(n),w:a(r)}},"Matrix, Matrix, number":function(e,t,r){if(r<0)throw new Error("w must be a positive number");const n=u(r),{h:i}=s(e.valueOf(),t.valueOf(),n);return{h:a(i),w:a(n)}}});function s(e,t,a){const s=[],u=[];for(let o=0;o<a.length;o++){let c=i(0,0),l=i(0,0);for(let t=0;t<e.length;t++)c=r(c,n(e[t],i(Math.cos(-t*a[o]),Math.sin(-t*a[o]))));for(let e=0;e<t.length;e++)l=r(l,n(t[e],i(Math.cos(-e*a[o]),Math.sin(-e*a[o]))));s.push(c),u.push(l)}const c=[];for(let e=0;e<s.length;e++)c.push(o(s[e],u[e]));return{h:c,w:a}}function u(e){const t=[];for(let r=0;r<e;r++)t.push(r/e*Math.PI);return t}})),$d=he("reviver",["classes"],(e=>{let{classes:t}=e;return function(e,r){const n=t[r&&r.mathjs];return n&&"function"==typeof n.fromJSON?n.fromJSON(r):r}})),Hd=he("replacer",[],(()=>function(e,t){return"number"!=typeof t||isFinite(t)&&!isNaN(t)?"bigint"==typeof t?{mathjs:"bigint",value:String(t)}:t:{mathjs:"number",value:String(t)}})),Gd=Math.PI,Vd=2*Math.PI,Wd=Math.E,Zd=he("true",[],(()=>!0)),Yd=he("false",[],(()=>!1)),Jd=he("null",[],(()=>null)),Xd=mg("Infinity",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1/0):1/0})),Qd=mg("NaN",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(NaN):NaN})),Kd=mg("pi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?Tl(r):Gd})),eg=mg("tau",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?Dl(r):Vd})),tg=mg("e",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?Ml(r):Wd})),rg=mg("phi",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?Cl(r):1.618033988749895})),ng=mg("LN2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(2).ln():Math.LN2})),ig=mg("LN10",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(10).ln():Math.LN10})),og=mg("LOG2E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1).div(new r(2).ln()):Math.LOG2E})),ag=mg("LOG10E",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(1).div(new r(10).ln()):Math.LOG10E})),sg=mg("SQRT1_2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r("0.5").sqrt():Math.SQRT1_2})),ug=mg("SQRT2",["config","?BigNumber"],(e=>{let{config:t,BigNumber:r}=e;return"BigNumber"===t.number?new r(2).sqrt():Math.SQRT2})),cg=mg("i",["Complex"],(e=>{let{Complex:t}=e;return t.I})),lg=he("PI",["pi"],(e=>{let{pi:t}=e;return t})),fg=he("E",["e"],(e=>{let{e:t}=e;return t})),pg=he("version",[],(()=>"14.0.0"));function mg(e,t,r){return he(e,t,r,{recreateOnConfigChange:!0})}const hg=ly("speedOfLight","299792458","m s^-1"),dg=ly("gravitationConstant","6.67430e-11","m^3 kg^-1 s^-2"),gg=ly("planckConstant","6.62607015e-34","J s"),yg=ly("reducedPlanckConstant","1.0545718176461565e-34","J s"),xg=ly("magneticConstant","1.25663706212e-6","N A^-2"),bg=ly("electricConstant","8.8541878128e-12","F m^-1"),vg=ly("vacuumImpedance","376.730313667","ohm"),wg=ly("coulomb","8.987551792261171e9","N m^2 C^-2"),Ng=ly("elementaryCharge","1.602176634e-19","C"),Eg=ly("bohrMagneton","9.2740100783e-24","J T^-1"),Ag=ly("conductanceQuantum","7.748091729863649e-5","S"),Sg=ly("inverseConductanceQuantum","12906.403729652257","ohm"),Mg=ly("magneticFluxQuantum","2.0678338484619295e-15","Wb"),Cg=ly("nuclearMagneton","5.0507837461e-27","J T^-1"),Tg=ly("klitzing","25812.807459304513","ohm"),Dg=ly("bohrRadius","5.29177210903e-11","m"),Bg=ly("classicalElectronRadius","2.8179403262e-15","m"),Fg=ly("electronMass","9.1093837015e-31","kg"),Og=ly("fermiCoupling","1.1663787e-5","GeV^-2"),_g=fy("fineStructure",.0072973525693),Ig=ly("hartreeEnergy","4.3597447222071e-18","J"),zg=ly("protonMass","1.67262192369e-27","kg"),kg=ly("deuteronMass","3.3435830926e-27","kg"),Rg=ly("neutronMass","1.6749271613e-27","kg"),qg=ly("quantumOfCirculation","3.6369475516e-4","m^2 s^-1"),Pg=ly("rydberg","10973731.568160","m^-1"),jg=ly("thomsonCrossSection","6.6524587321e-29","m^2"),Ug=fy("weakMixingAngle",.2229),Lg=fy("efimovFactor",22.7),$g=ly("atomicMass","1.66053906660e-27","kg"),Hg=ly("avogadro","6.02214076e23","mol^-1"),Gg=ly("boltzmann","1.380649e-23","J K^-1"),Vg=ly("faraday","96485.33212331001","C mol^-1"),Wg=ly("firstRadiation","3.7417718521927573e-16","W m^2"),Zg=ly("loschmidt","2.686780111798444e25","m^-3"),Yg=ly("gasConstant","8.31446261815324","J K^-1 mol^-1"),Jg=ly("molarPlanckConstant","3.990312712893431e-10","J s mol^-1"),Xg=ly("molarVolume","0.022413969545014137","m^3 mol^-1"),Qg=fy("sackurTetrode",-1.16487052358),Kg=ly("secondRadiation","0.014387768775039337","m K"),ey=ly("stefanBoltzmann","5.67037441918443e-8","W m^-2 K^-4"),ty=ly("wienDisplacement","2.897771955e-3","m K"),ry=ly("molarMass","0.99999999965e-3","kg mol^-1"),ny=ly("molarMassC12","11.9999999958e-3","kg mol^-1"),iy=ly("gravity","9.80665","m s^-2"),oy=ly("planckLength","1.616255e-35","m"),ay=ly("planckMass","2.176435e-8","kg"),sy=ly("planckTime","5.391245e-44","s"),uy=ly("planckCharge","1.87554603778e-18","C"),cy=ly("planckTemperature","1.416785e+32","K");function ly(e,t,r){return he(e,["config","Unit","BigNumber"],(e=>{let{config:n,Unit:i,BigNumber:o}=e;const a=new i("BigNumber"===n.number?new o(t):parseFloat(t),r);return a.fixPrefix=!0,a}))}function fy(e,t){return he(e,["config","BigNumber"],(e=>{let{config:r,BigNumber:n}=e;return"BigNumber"===r.number?new n(t):t}))}const py=he("apply",["typed","isInteger"],(e=>{let{typed:t,isInteger:r}=e;const n=Mo({typed:t,isInteger:r});return t("apply",{"...any":function(e){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1));try{return n.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),my=he("column",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;const o=Cs({typed:t,Index:r,matrix:n,range:i});return t("column",{"...any":function(e){const t=e.length-1,r=e[t];d(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0});function hy(e,t,r){const n=e.filter((function(e){return ne(e)&&!(e.name in t)&&!r.has(e.name)}))[0];if(!n)throw new Error('No undefined variable found in inline expression "'+e+'"');const i=n.name,o=new Map,a=new f(r,o,new Set([i])),s=e.compile();return function(e){return o.set(i,e),s.evaluate(a)}}r(3921);const dy=he("transformCallback",["typed"],(e=>{let{typed:t}=e;return function(e,n){return t.isTypedFunction(e)?r(e,n):gy(e,e.length,n)};function r(e,n){const i=Object.fromEntries(Object.entries(e.signatures).map((e=>{let[i,o]=e;const a=i.split(",").length;return t.isTypedFunction(o)?[i,r(o,n)]:[i,gy(o,a,n)]})));return"string"==typeof e.name?t(e.name,i):t(i)}}));function gy(e,t,r){return t===r?e:t===r+1?function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];const o=n.slice(0,r),a=yy(n[r]);return e(...o,a)}:t>r+1?function(){for(var t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];const o=n.slice(0,r),a=yy(n[r]),s=n.slice(r+1);return e(...o,a,...s)}:e}function yy(e){return e.map((e=>e+1))}const xy=he("filter",["typed"],(e=>{let{typed:t}=e;function r(e,r,i){const o=Is({typed:t}),a=dy({typed:t});if(0===e.length)return o();let s=e[0];if(1===e.length)return o(s);const u=e.length-1;let c=e[u];return s&&(s=n(s,i)),c&&(c=ne(c)||Z(c)?n(c,i):hy(c,r,i)),o(s,a(c,u))}function n(e,t){return e.compile().evaluate(t)}return r.rawArgs=!0,r}),{isTransformFunction:!0}),by=he("forEach",["typed"],(e=>{let{typed:t}=e;const r=Ps({typed:t}),n=dy({typed:t});function i(e,t,i){if(0===e.length)return r();let a=e[0];if(1===e.length)return r(a);const s=e.length-1;let u=e[s];return a&&(a=o(a,i)),u&&(u=ne(u)||Z(u)?o(u,i):hy(u,t,i)),r(a,n(u,s))}function o(e,t){return e.compile().evaluate(t)}return i.rawArgs=!0,i}),{isTransformFunction:!0}),vy=he("index",["Index","getMatrixDataType"],(e=>{let{Index:t,getMatrixDataType:r}=e;return function(){const e=[];for(let t=0,n=arguments.length;t<n;t++){let n=arguments[t];if(C(n))n.start--,n.end-=n.step>0?0:2;else if(n&&!0===n.isSet)n=n.map((function(e){return e-1}));else if(N(n)||E(n))"boolean"!==r(n)&&(n=n.map((function(e){return e-1})));else if(d(n))n--;else if(g(n))n=n.toNumber()-1;else if("string"!=typeof n)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");e[t]=n}const n=new t;return t.apply(n,e),n}}),{isTransformFunction:!0}),wy=he("map",["typed"],(e=>{let{typed:t}=e;const r=Zs({typed:t}),n=dy({typed:t});function i(e,t,i){if(0===e.length)return r();if(1===e.length)return r(e[0]);const o=e.length-1;let a=e.slice(0,o),s=e[o];return a=a.map((e=>u(e,i))),s&&(s=ne(s)||Z(s)?u(s,i):hy(s,t,i)),r(...a,n(s,o));function u(e,t){return e.compile().evaluate(t)}}return i.rawArgs=!0,i}),{isTransformFunction:!0});function Ny(e){if(2===e.length&&A(e[0])){const r=(e=e.slice())[1];(d(t=r)||g(t))&&(e[1]=function(e){return d(e)?e-1:g(e)?e.minus(1):e}(r))}var t;return e}const Ey=he("max",["typed","config","numeric","larger"],(e=>{let{typed:t,config:r,numeric:n,larger:i}=e;const o=yl({typed:t,config:r,numeric:n,larger:i});return t("max",{"...any":function(e){e=Ny(e);try{return o.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Ay=he("mean",["typed","add","divide"],(e=>{let{typed:t,add:r,divide:n}=e;const i=vh({typed:t,add:r,divide:n});return t("mean",{"...any":function(e){e=Ny(e);try{return i.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Sy=he("min",["typed","config","numeric","smaller"],(e=>{let{typed:t,config:r,numeric:n,smaller:i}=e;const o=xl({typed:t,config:r,numeric:n,smaller:i});return t("min",{"...any":function(e){e=Ny(e);try{return o.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),My=he("range",["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],(e=>{let{typed:t,config:r,matrix:n,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l}=e;const f=ru({typed:t,config:r,matrix:n,bignumber:i,smaller:o,smallerEq:a,larger:s,largerEq:u,add:c,isPositive:l});return t("range",{"...any":function(e){return"boolean"!=typeof e[e.length-1]&&e.push(!0),f.apply(null,e)}})}),{isTransformFunction:!0}),Cy=he("row",["typed","Index","matrix","range"],(e=>{let{typed:t,Index:r,matrix:n,range:i}=e;const o=lu({typed:t,Index:r,matrix:n,range:i});return t("row",{"...any":function(e){const t=e.length-1,r=e[t];d(r)&&(e[t]=r-1);try{return o.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Ty=he("subset",["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:r,zeros:n,add:i}=e;const o=gu({typed:t,matrix:r,zeros:n,add:i});return t("subset",{"...any":function(e){try{return o.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Dy=he("concat",["typed","matrix","isInteger"],(e=>{let{typed:t,matrix:r,isInteger:n}=e;const i=Ss({typed:t,matrix:r,isInteger:n});return t("concat",{"...any":function(e){const t=e.length-1,r=e[t];d(r)?e[t]=r-1:g(r)&&(e[t]=r.minus(1));try{return i.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),By="diff",Fy=he(By,["typed","matrix","subtract","number","bignumber"],(e=>{let{typed:t,matrix:r,subtract:n,number:i,bignumber:o}=e;const a=Js({typed:t,matrix:r,subtract:n,number:i,bignumber:o});return t(By,{"...any":function(e){e=Ny(e);try{return a.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Oy=he("std",["typed","map","sqrt","variance"],(e=>{let{typed:t,map:r,sqrt:n,variance:i}=e;const o=Dh({typed:t,map:r,sqrt:n,variance:i});return t("std",{"...any":function(e){e=Ny(e);try{return o.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),_y=he("sum",["typed","config","add","numeric"],(e=>{let{typed:t,config:r,add:n,numeric:i}=e;const o=gh({typed:t,config:r,add:n,numeric:i});return t("sum",{"...any":function(e){e=Ny(e);try{return o.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Iy=he("quantileSeq",["typed","bignumber","add","subtract","divide","multiply","partitionSelect","compare","isInteger","smaller","smallerEq","larger"],(e=>{let{typed:t,bignumber:r,add:n,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p}=e;const m=Th({typed:t,bignumber:r,add:n,subtract:i,divide:o,multiply:a,partitionSelect:s,compare:u,isInteger:c,smaller:l,smallerEq:f,larger:p});return t("quantileSeq",{"Array | Matrix, number | BigNumber":m,"Array | Matrix, number | BigNumber, number":(e,t,r)=>m(e,t,h(r)),"Array | Matrix, number | BigNumber, boolean":m,"Array | Matrix, number | BigNumber, boolean, number":(e,t,r,n)=>m(e,t,r,h(n)),"Array | Matrix, Array | Matrix":m,"Array | Matrix, Array | Matrix, number":(e,t,r)=>m(e,t,h(r)),"Array | Matrix, Array | Matrix, boolean":m,"Array | Matrix, Array | Matrix, boolean, number":(e,t,r,n)=>m(e,t,r,h(n))});function h(e){return Ny([[],e])[1]}}),{isTransformFunction:!0}),zy="cumsum",ky=he(zy,["typed","add","unaryPlus"],(e=>{let{typed:t,add:r,unaryPlus:n}=e;const i=xh({typed:t,add:r,unaryPlus:n});return t(zy,{"...any":function(e){if(2===e.length&&A(e[0])){const t=e[1];d(t)?e[1]=t-1:g(t)&&(e[1]=t.minus(1))}try{return i.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Ry="variance",qy=he(Ry,["typed","add","subtract","multiply","divide","apply","isNaN"],(e=>{let{typed:t,add:r,subtract:n,multiply:i,divide:o,apply:a,isNaN:s}=e;const u=Mh({typed:t,add:r,subtract:n,multiply:i,divide:o,apply:a,isNaN:s});return t(Ry,{"...any":function(e){e=Ny(e);try{return u.apply(null,e)}catch(e){throw Ep(e)}}})}),{isTransformFunction:!0}),Py="print",jy=he(Py,["typed","matrix","zeros","add"],(e=>{let{typed:t,matrix:r,zeros:n,add:i}=e;const o=Xu({typed:t,matrix:r,zeros:n,add:i});return t(Py,{"string, Object | Array":function(e,t){return o(a(e),t)},"string, Object | Array, number | Object":function(e,t,r){return o(a(e),t,r)}});function a(e){return e.replace(Yu,(e=>"$"+e.slice(1).split(".").map((function(e){return!isNaN(e)&&e.length>0?parseInt(e)-1:e})).join(".")))}}),{isTransformFunction:!0}),Uy=he("and",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a}=e;const s=zc({typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a});function u(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)&&!s(n,!0))return!1;const i=e[1].compile().evaluate(r);return s(n,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Ly=he("or",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=Ns({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o});function s(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)&&a(n,!1))return!0;const i=e[1].compile().evaluate(r);return a(n,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0}),$y=he("bitAnd",["typed","matrix","zeros","add","equalScalar","not","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a}=e;const s=ns({typed:t,matrix:r,equalScalar:n,zeros:i,not:o,concat:a});function u(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)){if(isNaN(n))return NaN;if(0===n||!1===n)return 0}const i=e[1].compile().evaluate(r);return s(n,i)}return u.rawArgs=!0,u}),{isTransformFunction:!0}),Hy=he("bitOr",["typed","matrix","equalScalar","DenseMatrix","concat"],(e=>{let{typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o}=e;const a=ss({typed:t,matrix:r,equalScalar:n,DenseMatrix:i,concat:o});function s(e,t,r){const n=e[0].compile().evaluate(r);if(!A(n)){if(isNaN(n))return NaN;if(-1===n)return-1;if(!0===n)return 1}const i=e[1].compile().evaluate(r);return a(n,i)}return s.rawArgs=!0,s}),{isTransformFunction:!0});var Gy=r(1504);const Vy={relTol:1e-12,absTol:1e-15,matrix:"Matrix",number:"number",numberFallback:"number",precision:64,predictable:!1,randomSeed:null},Wy=["Matrix","Array"],Zy=["number","BigNumber","Fraction"];function Yy(e,t){function r(n){if(n){if(void 0!==n.epsilon){console.warn('Warning: The configuration option "epsilon" is deprecated. Use "relTol" and "absTol" instead.');const e=ae(n);return e.relTol=n.epsilon,e.absTol=.001*n.epsilon,delete e.epsilon,r(e)}const i=ae(e);Jy(n,"matrix",Wy),Jy(n,"number",Zy),ue(e,n);const o=ae(e),a=ae(n);return t("config",o,i,a),o}return ae(e)}return r.MATRIX_OPTIONS=Wy,r.NUMBER_OPTIONS=Zy,Object.keys(Vy).forEach((t=>{Object.defineProperty(r,t,{get:()=>e[t],enumerable:!0,configurable:!0})})),r}function Jy(e,t,r){void 0===e[t]||r.includes(e[t])||console.warn('Warning: Unknown value "'+e[t]+'" for configuration option "'+t+'". Available options: '+r.map((e=>JSON.stringify(e))).join(", ")+".")}const Xy=function e(r,n){const i=sn({},Vy,n);if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");const o=function(e){const t=new Gy;return e.on=t.on.bind(t),e.off=t.off.bind(t),e.once=t.once.bind(t),e.emit=t.emit.bind(t),e}({isNumber:d,isComplex:x,isBigNumber:g,isBigInt:y,isFraction:b,isUnit:v,isString:w,isArray:N,isMatrix:E,isCollection:A,isDenseMatrix:S,isSparseMatrix:M,isRange:C,isIndex:T,isBoolean:D,isResultSet:B,isHelp:F,isFunction:O,isDate:_,isRegExp:I,isObject:z,isMap:k,isPartitionedMap:R,isObjectWrappingMap:q,isNull:P,isUndefined:j,isAccessorNode:U,isArrayNode:L,isAssignmentNode:$,isBlockNode:H,isConditionalNode:G,isConstantNode:V,isFunctionAssignmentNode:Z,isFunctionNode:Y,isIndexNode:J,isNode:X,isObjectNode:Q,isOperatorNode:K,isParenthesisNode:ee,isRangeNode:te,isRelationalNode:re,isSymbolNode:ne,isChain:ie});o.config=Yy(i,o.emit),o.expression={transform:{},mathWithTransform:{config:o.config}};const a={};function s(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return o.typed.apply(o.typed,t)}s.isTypedFunction=t.isTypedFunction;const u=function(e,t,r,n){function i(t,i,a){var s,u;if(a.wrap&&"function"==typeof i&&(i=function(e){const t=function(){const t=[];for(let e=0,r=arguments.length;e<r;e++){const r=arguments[e];t[e]=r&&r.valueOf()}return e.apply(r,t)};return e.transform&&(t.transform=e.transform),t}(i)),"function"==typeof(u=i)&&"string"==typeof u.signature&&(i=e(t,{[i.signature]:i})),e.isTypedFunction(r[t])&&e.isTypedFunction(i))return i=a.override?e(t,i.signatures):e(r[t],i),r[t]=i,delete n[t],o(t,i),void r.emit("import",t,(function(){return i}));const c=void 0!==r[t],l=null===(s=r.Unit)||void 0===s?void 0:s.isValuelessUnit(t);if(!c&&!l||a.override)return r[t]=i,delete n[t],o(t,i),void r.emit("import",t,(function(){return i}));if(!a.silent)throw new Error('Cannot import "'+t+'": already exists')}function o(e,t){t&&"function"==typeof t.transform?(r.expression.transform[e]=t.transform,u(e)&&(r.expression.mathWithTransform[e]=t.transform)):(delete r.expression.transform[e],u(e)&&(r.expression.mathWithTransform[e]=t))}function a(e){delete r.expression.transform[e],u(e)?r.expression.mathWithTransform[e]=r[e]:delete r.expression.mathWithTransform[e]}function s(t,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.fn;if(o.includes("."))throw new Error("Factory name should not contain a nested path. Name: "+JSON.stringify(o));const s=l(t)?r.expression.transform:r,u=o in r.expression.transform,f=me(s,o)?s[o]:void 0,p=function(){const n={};t.dependencies.map(ge).forEach((e=>{if(e.includes("."))throw new Error("Factory dependency should not contain a nested path. Name: "+JSON.stringify(e));"math"===e?n.math=r:"mathWithTransform"===e?n.mathWithTransform=r.expression.mathWithTransform:"classes"===e?n.classes=r:n[e]=r[e]}));const a=t(n);if(a&&"function"==typeof a.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with export const path = "expression.transform"');if(void 0===f||i.override)return a;if(e.isTypedFunction(f)&&e.isTypedFunction(a))return e(f,a);if(i.silent)return f;throw new Error('Cannot import "'+o+'": already exists')};t.meta&&!1===t.meta.lazy?(s[o]=p(),f&&u?a(o):(l(t)||c(t))&&pe(r.expression.mathWithTransform,o,(()=>s[o]))):(pe(s,o,p),f&&u?a(o):(l(t)||c(t))&&pe(r.expression.mathWithTransform,o,(()=>s[o]))),n[o]=t,r.emit("import",o,p)}function u(e){return!me(f,e)}function c(e){return!(e.fn.includes(".")||me(f,e.fn)||e.meta&&e.meta.isClass)}function l(e){return void 0!==e&&void 0!==e.meta&&!0===e.meta.isTransformFunction||!1}const f={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function(e,t){const r=arguments.length;if(1!==r&&2!==r)throw new la("import",r,1,2);t||(t={});const n={};!function e(r,n,i){if(Array.isArray(n))n.forEach((t=>e(r,t)));else if("object"==typeof n)for(const t in n)me(n,t)&&e(r,n[t],t);else if(de(n)||void 0!==i){const e=de(n)?l(n)?n.fn+".transform":n.fn:i;if(me(r,e)&&r[e]!==n&&!t.silent)throw new Error('Cannot import "'+e+'" twice');r[e]=n}else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}(n,e);for(const e in n)if(me(n,e)){const r=n[e];if(de(r))s(r,t);else if("function"==typeof(o=r)||"number"==typeof o||"string"==typeof o||"boolean"==typeof o||null===o||v(o)||x(o)||g(o)||b(o)||E(o)||Array.isArray(o))i(e,r,t);else if(!t.silent)throw new TypeError("Factory, Object, or Array expected")}var o}}(s,0,o,a);return o.import=u,o.on("config",(()=>{Object.values(a).forEach((e=>{e&&e.meta&&e.meta.recreateOnConfigChange&&u(e,{override:!0})}))})),o.create=e.bind(null,r),o.factory=he,o.import(Object.values(le(r))),o.ArgumentsError=la,o.DimensionError=xn,o.IndexError=bn,o}(e)})(),n.default})()));
3
3
  //# sourceMappingURL=math.js.map