1!function(){try{var r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},e=(new r.Error).stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="95c1477e-177a-4420-80b3-2c0a9728e9dd",r._sentryDebugIdIdentifier="sentry-dbid-95c1477e-177a-4420-80b3-2c0a9728e9dd")}catch(r){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2951],{189:r=>{r.exports=function r(e,t){"use strict";var n,i,u=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,a=/(^[ ]*|[ ]*$)/g,o=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,s=/^0x[0-9a-f]+$/i,f=/^0/,c=function(e){return r.insensitive&&(""+e).toLowerCase()||""+e},l=c(e).replace(a,"")||"",h=c(t).replace(a,"")||"",p=l.replace(u,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=h.replace(u,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),v=parseInt(l.match(s),16)||1!==p.length&&l.match(o)&&Date.parse(l),d=parseInt(h.match(s),16)||v&&h.match(o)&&Date.parse(h)||null;if(d){if(v<d)return -1;else if(v>d)return 1}for(var g=0,y=Math.max(p.length,m.length);g<y;g++){if(n=!(p[g]||"").match(f)&&parseFloat(p[g])||p[g]||0,i=!(m[g]||"").match(f)&&parseFloat(m[g])||m[g]||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}},7136:function(r,e,t){var n;!function(r,i,u){function a(r){var e=this,t="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var r=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^r^r>>>8},r===(0|r)?e.x=r:t+=r;for(var n=0;n<t.length+64;n++)e.x^=t.charCodeAt(n),e.next()}function o(r,e){return e.x=r.x,e.y=r.y,e.z=r.z,e.w=r.w,e}function s(r,e){var t=new a(r),n=e&&e.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var r=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===r);return r},i.int32=t.next,i.quick=i,n&&("object"==typeof n&&o(n,t),i.state=function(){return o(t,{})}),i}i&&i.exports?i.exports=s:t.amdD&&t.amdO?void 0===(n=(function(){return s}).call(e,t,e,i))||(i.exports=n):this.xor128=s}(0,r=t.nmd(r),t.amdD)},9581:function(r){r.exports=function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";return function i(){let u,a;function o(r){return"object"==typeof r&&null!==r&&r.constructor===Object}let s=[{name:"number",test:function(r){return"number"==typeof r}},{name:"string",test:function(r){return"string"==typeof r}},{name:"boolean",test:function(r){return"boolean"==typeof r}},{name:"Function",test:function(r){return"function"==typeof r}},{name:"Array",test:Array.isArray},{name:"Date",test:function(r){return r instanceof Date}},{name:"RegExp",test:function(r){return r instanceof RegExp}},{name:"Object",test:o},{name:"null",test:function(r){return null===r}},{name:"undefined",test:function(r){return void 0===r}}],f={name:"any",test:r,isAny:!0},c=0,l={createCount:0};function h(r){let e,t=u.get(r);if(t)return t;let n='Unknown type "'+r+'"',i=r.toLowerCase();for(e of a)if(e.toLowerCase()===i){n+='. Did you mean "'+e+'" ?';break}throw TypeError(n)}function p(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"any",t=e?h(e).index:a.length,n=[];for(let e=0;e<r.length;++e){if(!r[e]||"string"!=typeof r[e].name||"function"!=typeof r[e].test)throw TypeError("Object with properties {name: string, test: function} expected");let i=r[e].name;if(u.has(i))throw TypeError('Duplicate type name "'+i+'"');n.push(i),u.set(i,{name:i,test:r[e].test,isAny:r[e].isAny,index:t+e,conversionsTo:[]})}let i=a.slice(t);a=a.slice(0,t).concat(n).concat(i);for(let r=t+n.length;r<a.length;++r)u.get(a[r]).index=r}function m(){u=new Map,a=[],c=0,p([f],!1)}function v(r){let e=a.filter(e=>{let t=u.get(e);return!t.isAny&&t.test(r)});return e.length?e:["any"]}function d(r){return r&&"function"==typeof r&&"_typedFunctionData"in r}function g(r,e,t){let i,u;if(!d(r))throw TypeError(n);let a=t&&t.exact,o=x(Array.isArray(e)?e.join(","):e),s=y(o);if(!a||s in r.signatures){let e=r._typedFunctionData.signatureMap.get(s);if(e)return e}let f=o.length;if(a){let e;for(e in i=[],r.signatures)i.push(r._typedFunctionData.signatureMap.get(e))}else i=r._typedFunctionData.signatures;for(let r=0;r<f;++r){let e,t=o[r],n=[];for(e of i){let i=w(e.params,r);if(i&&(!t.restParam||i.restParam)){if(!i.hasAny){let r=D(i);if(t.types.some(e=>!r.has(e.name)))continue}n.push(e)}}if(0===(i=n).length)break}for(u of i)if(u.params.length<=f)return u;throw TypeError("Signature not found (signature: "+(r.name||"unnamed")+"("+y(o,", ")+"))")}function y(r){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return r.map(r=>r.name).join(e)}function b(r){let e=function(r){if(0===r.length)return[];let e=r.map(h);r.length>1&&e.sort((r,e)=>r.index-e.index);let t=e[0].conversionsTo;if(1===r.length)return t;t=t.concat([]);let n=new Set(r);for(let r=1;r<e.length;++r){let i;for(i of e[r].conversionsTo)n.has(i.from)||(t.push(i),n.add(i.from))}return t}(r.types.map(r=>r.name)),t=r.hasAny,n=r.name,i=e.map(function(r){let e=h(r.from);return t=e.isAny||t,n+="|"+r.from,{name:r.from,typeIndex:e.index,test:e.test,isAny:e.isAny,conversion:r,conversionIndex:r.index}});return{types:r.types.concat(i),name:n,hasAny:t,hasConversion:i.length>0,restParam:r.restParam}}function D(r){return r.typeSet||(r.typeSet=new Set,r.types.forEac
1h(e=>r.typeSet.add(e.name))),r.typeSet}function x(r){let e=[];if("string"!=typeof r)throw TypeError("Signatures must be strings");let t=r.trim();if(""===t)return e;let n=t.split(",");for(let r=0;r<n.length;++r){let t=function(r){let e=0===r.indexOf("..."),t=(e?r.length>3?r.slice(3):"any":r).split("|").map(r=>h(r.trim())),n=!1,i=e?"...":"";return{types:t.map(function(r){return n=r.isAny||n,i+=r.name+"|",{name:r.name,typeIndex:r.index,test:r.test,isAny:r.isAny,conversion:null,conversionIndex:-1}}),name:i.slice(0,-1),hasAny:n,hasConversion:!1,restParam:e}}(n[r].trim());if(t.restParam&&r!==n.length-1)throw SyntaxError('Unexpected rest parameter "'+n[r]+'": only allowed for the last parameter');if(0===t.types.length)return null;e.push(t)}return e}function E(r){let e=I(r);return!!e&&e.restParam}function A(e){if(!e||0===e.types.length)return r;if(1===e.types.length)return h(e.types[0].name).test;if(2===e.types.length){let r=h(e.types[0].name).test,t=h(e.types[1].name).test;return function(e){return r(e)||t(e)}}{let r=e.types.map(function(r){return h(r.name).test});return function(e){for(let t=0;t<r.length;t++)if(r[t](e))return!0;return!1}}}function w(r,e){return e<r.length?r[e]:E(r)?I(r):null}function N(r,e){let t=w(r,e);return t?D(t):new Set}function M(r){return null===r.conversion||void 0===r.conversion}function C(r,e){let t=new Set;return r.forEach(r=>{let n;for(n of N(r.params,e))t.add(n)}),t.has("any")?["any"]:Array.from(t)}function F(r,e,t){let n,i,u,a=r||"unnamed",o=t;for(u=0;
1u<e.length;u++){let r=[];if(o.forEach(t=>{let n=A(w(t.params,u));(u<t.params.length||E(t.params))&&n(e[u])&&r.push(t)}),0===r.length){if((i=C(o,u)).length>0){let r=v(e[u]);return(n=TypeError("Unexpected type of argument in function "+a+" (expected: "+i.join(" or ")+", actual: "+r.join(" | ")+", index: "+u+")")).data={category:"wrongType",fn:a,index:u,actual:r,expected:i},n}}else o=r}let s=o.map(function(r){return E(r.params)?1/0:r.params.length});if(e.length<Math.min.apply(null,s))return(n=TypeError("Too few arguments in function "+a+" (expected: "+(i=C(o,u)).join(" or ")+", index: "+e.length+")")).data={category:"tooFewArgs",fn:a,index:e.length,expected:i},n;let f=Math.max.apply(null,s);if(e.length>f)return(n=TypeError("Too many arguments in function "+a+" (expected: "+f+", actual: "+e.length+")")).data={category:"tooManyArgs",fn:a,index:e.length,expectedLength:f},n;let c=[];for(let r=0;r<e.length;++r)c.push(v(e[r]).join("|"));return(n=TypeError('Arguments of type "'+c.join(", ")+'" do not match any of the defined signatures of function '+a+".")).data={category:"mismatch",actual:c},n}function S(r){let e=a.length+1;for(let t=0;t<r.types.length;t++)M(r.types[t])&&(e=Math.min(e,r.types[t].typeIndex));return e}function _(r){let e=c+1;for(let t=0;t<r.types.length;t++)M(r.types[t])||(e=Math.min(e,r.types[t].conversionIndex));return e}function B(r,e){let t,n,i=r.params,u=e.params,a=I(i),o=I(u),s=E(i),f=E(u);if(s&&a.hasAny){if(!f||!o.hasAny)return 1}else if(f&&o.hasAny)return -1;let c=0,l=0;for(t of i)t.hasAny&&++c,t.hasConversion&&++l;let h=0,p=0;for(t of u)t.hasAny&&++h,t.hasConversion&&++p;if(c!==h)return c-h;if(s&&a.hasConversion){if(!f||!o.hasConversion)return 1}else if(f&&o.hasConversion)return -1;if(l!==p)return l-p;if(s){if(!f)return 1}else if(f)return -1;let m=(i.length-u.length)*(s?-1:1);if(0!==m)return m;let v=[],d=0;for(let r=0;r<i.length;++r){let e=function(r,e){if(r.hasAny){if(!e.hasAny)return 1}else if(e.hasAny)return -1;if(r.restParam){if(!e.restParam)return 1}else if(e.restParam)return -1;if(r.hasConversion){if(!e.hasConversion)return 1}else if(e.hasConversion)return -1;let t=S(r)-S(e);if(t<0)return -1;if(t>0)return 1;let n=_(r)-_(e);return n<0?-1:+(n>0)}(i[r],u[r]);v.push(e),d+=e}if(0!==d)return d;for(n of v)if(0!==n)return n;return 0}function T(r){let e,t,n,i,u=[],a=[];switch(r.types.forEach(function(r){r.conversion&&(u.push(h(r.conversion.from).test),a.push(r.conversion.convert))}),a.length){case 0:return function(r){return r};case 1:return e=u[0],n=a[0],function(r){return e(r)?n(r):r};case 2:return e=u[0],t=u[1],n=a[0],i=a[1],function(r){return e(r)?n(r):t(r)?i(r):r};default:return function(r){for(let e=0;e<a.length;e++)if(u[e](r))return a[e](r);return r}}}function O(r,e,t){throw F(r,e,t)}function z(r){return R(r,0,r.length-1)}function I(r){return r[r.length-1]}function R(r,e,t){return Array.prototype.slice.call(r,e,t)}function U(r,e){return{referTo:{references:r,callback:e}}}function P(r){if("function"!=typeof r)throw TypeError("Callback function expected as first argument");return{referToSelf:{callback:r}}}function j(r){return r&&"object"==typeof r.referTo&&Array.isArray(r.referTo.references)&&"function"==typeof r.referTo.callback}function k(r){return r&&"object"==typeof r.referToSelf&&"function"==typeof r.referToSelf.callback}function q(r,e){if(!r)return e;if(e&&e!==r){let t=Error("Function names do not match (expected: "+r+", actual: "+e+")");throw t.data={actual:e,expected:r},t}return r}m(),p(s);let L=l;function H(r){if(!r||"string"!=typeof r.from||"string"!=typeof r.to||"function"!=typeof r.convert)throw TypeError("Object with properties {from: string, to: string, convert: function} expected");if(r.to===r.from)throw SyntaxError('Illegal to define conversion from "'+r.from+'" to itself.')}return(l=function(r){let n="string"==typeof r,i=+!!n,u=n?r:"",a={};for(let r=i;r<arguments.length;++r){let e,t=arguments[r],i={};if("function"==typeof t?(e=t.name,"string"==typeof t.signature?i[t.signature]=t:d(t)&&(i=t.signatures)):o(t)&&(i=t,n||(e=function(r){let e;for(let t in r)Object.prototype.hasOwnProperty.call(r,t)&&(d(r[t])||"string"==typeof r[t].signature)&&(e=q(e,r[t].name));return e}(t))),0===Object.keys(i).length){let e=TypeError("Argument to 'typed' at index "+r+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw e.data={index:r,argument:t},e}n||(u=q(u,e)),function(r,e){let t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t)){if(t in r&&e[t]!==r[t]){let n=Error('Signature "'+t+'" is defined twice');throw n.data={signature:t,sourceFunction:e[t],destFunction:r[t]},n}r[t]=e[t]}}(a,i)}return function(r,n){let i,u;if(l.createCount++,0===Object.keys(n).length)throw SyntaxError("No signatures provided");l.warnAgainstDeprecatedThis&&function(r){let e=/\bthis(\(|\.signatures\b)/;Object.keys(r).forEach(t=>{let n=r[t];if(e.test(n.toString()))throw SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}(n);let a=[],o=[],s={},f=[];for(i in n){let r;if(!Object.prototype.hasOwnProperty.call(n,i))continue;let e=x(i);if(!e)continue;a.forEach(function(r){if(function(r,e){let t=Math.max(r.length,e.length);for(let n=0;n<t;n++){let t,i=N(r,n),u=N(e,n),a=!1;for(t of u)if(i.has(t)){a=!0;break}if(!a)return!1}let n=r.length,i=e.length,u=E(r),a=E(e);return u?a?n===i:i>=n:a?n>=i:n===i}(r,e))throw TypeError('Conflicting signatures "'+y(r)+'" and "'+y(e)+'".')}),a.push(e);
1let t=o.length;for(r of(o.push(n[i]),function r(e,t,n){if(!(t<e.length))return[n];{var i,u;let a=e[t],o=[];if(a.restParam){let r=a.types.filter(M);r.length<a.types.length&&o.push({types:r,name:"..."+r.map(r=>r.name).join("|"),hasAny:r.some(r=>r.isAny),hasConversion:!1,restParam:!0}),o.push(a)}else o=a.types.map(function(r){return{types:[r],name:r.name,hasAny:r.isAny,hasConversion:r.conversion,restParam:!1}});return i=o,u=function(i){return r(e,t+1,n.concat([i]))},Array.prototype.concat.apply([],i.map(u))}}(e.map(b),0,[]))){let e=y(r);f.push({params:r,name:e,fn:t}),r.every(r=>!r.hasConversion)&&(s[e]=t)}}f.sort(B);let c=function(r,e,t){let n=r.map(r=>k(r)?P(r.referToSelf.callback):j(r)?U(r.referTo.references,r.referTo.callback):r),i=Array(n.length).fill(!1),u=!0;for(;u;){u=!1;let r=!0;for(let a=0;a<n.length;++a){if(i[a])continue;let o=n[a];if(k(o))n[a]=o.referToSelf.callback(t),n[a].referToSelf=o.referToSelf,i[a]=!0,r=!1;else if(j(o)){let t=function(r,e,t){let n,i=[];for(n of r){let r=t[n];if("number"!=typeof r)throw TypeError('No definition for referenced signature "'+n+'"');if("function"!=typeof(r=e[r]))return!1;i.push(r)}return i}(o.referTo.references,n,e);t?(n[a]=o.referTo.callback.apply(this,t),n[a].referTo=o.referTo,i[a]=!0,r=!1):u=!0}}if(r&&u)throw SyntaxError("Circular reference detected in resolving typed.referTo")}return n}(o,s,rl);for(u in s)Object.prototype.hasOwnProperty.call(s,u)&&(s[u]=c[s[u]]);let h=[],p=new Map;for(u of f)p.has(u.name)||(u.fn=c[u.fn],h.push(u),p.set(u.name,u));let m=h[0]&&h[0].params.length<=2&&!E(h[0].params),v=h[1]&&h[1].params.length<=2&&!E(h[1].params),d=h[2]&&h[2].params.length<=2&&!E(h[2].params),g=h[3]&&h[3].params.length<=2&&!E(h[3].params),D=h[4]&&h[4].params.length<=2&&!E(h[4].params),w=h[5]&&h[5].params.length<=2&&!E(h[5].params);for(let r=0;r<h.length;++r)h[r].test=function(r){let e,t,n;if(E(r)){let t=(e=z(r).map(A)).length,n=A(I(r)),i=function(r){for(let e=t;e<r.length;e++)if(!n(r[e]))return!1;return!0};return function(r){for(let t=0;t<e.length;t++)if(!e[t](r[t]))return!1;return i(r)&&r.length>=t+1}}return 0===r.length?function(r){return 0===r.length}:1===r.length?(t=A(r[0]),function(r){return t(r[0])&&1===r.length}):2===r.length?(t=A(r[0]),n=A(r[1]),function(r){return t(r[0])&&n(r[1])&&2===r.length}):(e=r.map(A),function(r){for(let t=0;t<e.length;t++)if(!e[t](r[t]))return!1;return r.length===e.length})}(h[r].params);let C=m?A(h[0].params[0]):e,F=v?A(h[1].params[0]):e,S=d?A(h[2].params[0]):e,_=g?A(h[3].params[0]):e,O=D?A(h[4].params[0]):e,q=w?A(h[5].params[0]):e,L=m?A(h[0].params[1]):e,H=v?A(h[1].params[1]):e,G=d?A(h[2].params[1]):e,V=g?A(h[3].params[1]):e,Z=D?A(h[4].params[1]):e,Y=w?A(h[5].params[1]):e;for(let r=0;r<h.length;++r)h[r].implementation=function(r,e){let t=e;if(r.some(r=>r.hasConversion)){let n=E(r),i=r.map(T);t=function(){let r=[],t=n?arguments.length-1:arguments.length;for(let e=0;e<t;e++)r[e]=i[e](arguments[e]);return n&&(r[t]=arguments[t].map(i[t])),e.apply(this,r)}}let n=t;if(E(r)){let e=r.length-1;n=function(){return t.apply(this,R(arguments,0,e).concat([R(arguments,e)]))}}return n}(h[r].params,h[r].fn);let X=m?h[0].implementation:t,J=v?h[1].implementation:t,W=d?h[2].implementation:t,$=g?h[3].implementation:t,Q=D?h[4].implementation:t,K=w?h[5].implementation:t,rr=m?h[0].params.length:-1,re=v?h[1].params.length:-1,rt=d?h[2].params.length:-1,rn=g?h[3].params.length:-1,ri=D?h[4].params.length:-1,ru=w?h[5].params.length:-1,ra=6*!!(m&&v&&d&&g&&D&&w),ro=h.length,rs=h.map(r=>r.test),rf=h.map(r=>r.implementation),rc=function(){for(let r=ra;r<ro;r++)if(rs[r](arguments))return rf[r].apply(this,arguments);return l.onMismatch(r,arguments,h)};function rl(r,e){return arguments.length===rr&&C(r)&&L(e)?X.apply(this,arguments):arguments.length===re&&F(r)&&H(e)?J.apply(this,arguments):arguments.length===rt&&S(r)&&G(e)?W.apply(this,arguments):arguments.length===rn&&_(r)&&V(e)?$.apply(this,arguments):arguments.length===ri&&O(r)&&Z(e)?Q.apply(this,arguments):arguments.length===ru&&q(r)&&Y(e)?K.apply(this,arguments):rc.apply(this,arguments)}try{Object.defineProperty(rl,"name",{value:r})}catch(r){}return rl.signatures=s,rl._typedFunctionData={signatures:h,signatureMap:p},rl}(u||"",a)}).create=i,l.createCount=L.createCount,l.onMismatch=O,l.throwMismatchError=O,l.createError=F,l.clear=m,l.clearConversions=function(){let r;for(r of a)u.get(r).conversionsTo=[];c=0},l.addTypes=p,l._findType=h,l.referTo=function(){let r=z(arguments).map(r=>y(x(r))),e=I(arguments);if("function"!=typeof e)throw TypeError("Callback function expected as last argument");return U(r,e)},l.referToSelf=P,l.convert=function(r,e){let t=h(e);if(t.test(r))return r;let n=t.conversionsTo;if(0===n.length)throw Error("There are no conversions to "+e+" defined.");for(let e=0;e<n.length;e++)if(h(n[e].from).test(r))return n[e].convert(r);throw Error("Cannot convert "+r+" to "+e)},l.findSignature=g,l.find=function(r,e,t){return g(r,e,t).implementation}
1,l.isTypedFunction=d,l.warnAgainstDeprecatedThis=!0,l.addType=function(r,e){let t="any";!1!==e&&u.has("Object")&&(t="Object"),l.addTypes([r],t)},l.addConversion=function(r){H(r);let e=h(r.to);if(e.conversionsTo.every(function(e){return e.from!==r.from}))e.conversionsTo.push({from:r.from,convert:r.convert,index:c++});else throw Error('There is already a conversion from "'+r.from+'" to "'+e.name+'"')},l.addConversions=function(r){r.forEach(l.addConversion)},l.removeConversion=function(r){H(r);let e=h(r.to),t=function(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return r[t]}(e.conversionsTo,e=>e.from===r.from);if(!t)throw Error("Attempt to remove nonexistent conversion from "+r.from+" to "+r.to);if(t.convert!==r.convert)throw Error("Conversion to remove does not match existing conversion");let n=e.conversionsTo.indexOf(t);e.conversionsTo.splice(n,1)},l.resolve=function(r,e){if(!d(r))throw TypeError(n);let t=r._typedFunctionData.signatures;for(let r=0;r<t.length;++r)if(t[r].test(e))return t[r];return null},l}()}()},12162:(r,e,t)=>{var n=t(38401),i=t(7136),u=t(33338),a=t(57374),o=t(81844),s=t(68792),f=t(41124);f.alea=n,f.xor128=i,f.xorwow=u,f.xorshift7=a,f.xor4096=o,f.tychei=s,r.exports=f},15239:(r,e,t)=>{"use strict";t.d(e,{default:()=>i.a});var n=t(54652),i=t.n(n)},21655:(r,e,t)=>{r.exports=t(68144)},25547:(r,e,t)=>{"use strict";t.d(e,{A:()=>i});var n=t(92926);function i(r){var e=function(r,e){if("object"!=(0,n.A)(r)||!r)return r;var t=r[Symbol.toPrimitive];if(void 0!==t){var i=t.call(r,e||"default");if("object"!=(0,n.A)(i))return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(r)}(r,"string");return"symbol"==(0,n.A)(e)?e:e+""}},33338:function(r,e,t){var n;!function(r,i,u){function a(r){var e=this,t="";e.next=function(){var r=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^(r^r<<1))|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,r===(0|r)?e.x=r:t+=r;for(var n=0;n<t.length+64;n++)e.x^=t.charCodeAt(n),n==t.length&&(e.d=e.x<<10^e.x>>>4),e.next()}function o(r,e){return e.x=r.x,e.y=r.y,e.z=r.z,e.w=r.w,e.v=r.v,e.d=r.d,e}function s(r,e){var t=new a(r),n=e&&e.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var r=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===r);return r},i.int32=t.next,i.quick=i,n&&("object"==typeof n&&o(n,t),i.state=function(){return o(t,{})}),i}i&&i.exports?i.exports=s:t.amdD&&t.amdO?void 0===(n=(function(){return s}).call(e,t,e,i))||(i.exports=n):this.xorwow=s}(0,r=t.nmd(r),t.amdD)},38401:function(r,e,t){var n;!function(r,i,u){function a(r){var e,t=this,n=(e=0xefc8249d,function(r){r=String(r);for(var t=0;t<r.length;t++){var n=.02519603282416938*(e+=r.charCodeAt(t));e=n>>>0,n-=e,n*=e,e=n>>>0,n-=e,e+=0x100000000*n}return(e>>>0)*23283064365386963e-26});t.next=function(){var r=2091639*t.s0+23283064365386963e-26*t.c;return t.s0=t.s1,t.s1=t.s2,t.s2=r-(t.c=0|r)},t.c=1,t.s0=n(" "),t.s1=n(" "),t.s2=n(" "),t.s0-=n(r),t.s0<0&&(t.s0+=1),t.s1-=n(r),t.s1<0&&(t.s1+=1),t.s2-=n(r),t.s2<0&&(t.s2+=1)}function o(r,e){return e.c=r.c,e.s0=r.s0,e.s1=r.s1,e.s2=r.s2,e}function s(r,e){var t=new a(r),n=e&&e.state,i=t.next;return i.int32=function(){return 0x100000000*t.next()|0},i.double=function(){return i()+(2097152*i()|0)*11102230246251565e-32},i.quick=i,n&&("object"==typeof n&&o(n,t),i.state=function(){return o(t,{})}),i}i&&i.exports?i.exports=s:t.amdD&&t.amdO?void 0===(n=(function(){return s}).call(e,t,e,i))||(i.exports=n):this.alea=s}(0,r=t.nmd(r),t.amdD)},41124:function(r,e,t){var n;!function(i,u,a){var o,s=a.pow(256,6),f=a.pow(2,52),c=2*f;function l(r,e,t){var n=[],l=m(function r(e,t){var n,i=[],u=typeof e;if(t&&"object"==u)for(n in e)try{i.push(r(e[n],t-1))}catch(r){}return i.length?i:"string"==u?e:e+"\0"}((e=!0==e?{entropy:!0}:e||{}).entropy?[r,v(u)]:null==r?function(){try{var r;return o&&(r=o.randomBytes)?r=r(256):(r=new Uint8Array(256),(i.crypto||i.msCrypto).getRandomValues(r)),v(r)}catch(r){var e=i.navigator,t=e&&e.plugins;return[+new Date,i,t,i.screen,v(u)]}}():r,3),n),d=new h(n),g=function(){for(var r=d.g(6),e=s,t=0;r<f;)r=(r+t)*256,e*=256,t=d.g(1);for(;r>=c;)r/=2,e/=2,t>>>=1;return(r+t)/e};return g.int32=function(){return 0|d.g(4)},g.quick=function(){return d.g(4)/0x100000000},g.double=g,m(v(d.S),u),(e.pass||t||function(r,e,t,n){return(n&&(n.S&&p(n,d),r.state=function(){return p(d,{})}),t)?(a.random=r,e):r})(g,l,"global"in e?e.global:this==a,e.state)}function h(r){var e,t=r.length,n=this,i=0,u=n.i=n.j=0,a=n.S=[];for(t||(r=[t++]);i<256;)a[i]=i++;for(i=0;i<256;i++)a[i]=a[u=255&u+r[i%t]+(e=a[i])],a[u]=e;(n.g=function(r){for(var e,t=0,i=n.i,u=n.j,a=n.S;r--;)e=a[i=255&i+1],t=256*t+a[255&(a[i]=a[u=255&u+e])+(a[u]=e)];return n.i=i,n.j=u,t})(256)}function p(r,e){return e.i=r.i,e.j=r.j,e.S=r.S.slice(),e}function m(r,e){for(var t,n=r+"",i=0;i<n.length;)e[255&i]=255&(t^=19*e[255&i])+n.charCodeAt(i++);return v(e)}function v(r){return String.fromCharCode.apply(0,r)}if(m(a.random(),u),r.exports){r.exports=l;try{o=t(27713)}catch(r){}}else void 0===(n=(function(){return l}).call(e,t,e,r))||(r.exports=n)}("undefined"!=typeof self?self:this,[],Math)},45298:(r,e,t)=>{"use strict";t.d(e,{vjN:()=>fj});var n=t(24264),i={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null},u=function(r){if(r)throw Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");return Object.freeze(i)};(0,n.A)(u,i,{MATRIX_OPTIONS:["Matrix","Array"],NUMBER_OPTIONS:["number","BigNumber","Fraction"]});var a,o,s="0123456789abcdef",f="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",c="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823
1066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",l={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-9e15,maxE:9e15,crypto:!1},h=!0,p="[DecimalError] ",m=p+"Invalid argument: ",v=p+"Precision limit exceeded",d=p+"crypto unavailable",g="[object Decimal]",y=Math.floor,b=Math.pow,D=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,x=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,E=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,A=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,w=f.length-1,N=c.length-1,M={toStringTag:g};function C(r){var e,t,n,i=r.length-1,u="",a=r[0];if(i>0){for(u+=a,e=1;e<i;e++)(t=7-(n=r[e]+"").length)&&(u+=P(t)),u+=n;(t=7-(n=(a=r[e])+"").length)&&(u+=P(t))}else if(0===a)return"0";for(;a%10==0;)a/=10;return u+a}function F(r,e,t){if(r!==~~r||r<e||r>t)throw Error(m+r)}function S(r,e,t,n){var i,u,a,o;for(u=r[0];u>=10;u/=10)--e;return--e<0?(e+=7,i=0):(i=Math.ceil((e+1)/7),e%=7),u=b(10,7-e),o=r[i]%u|0,null==n?e<3?(0==e?o=o/100|0:1==e&&(o=o/10|0),a=t<4&&99999==o||t>3&&49999==o||5e4==o||0==o):a=(t<4&&o+1==u||t>3&&o+1==u/2)&&(r[i+1]/u/100|0)==b(10,e-2)-1||(o==u/2||0==o)&&(r[i+1]/u/100|0)==0:e<4?(0==e?o=o/1e3|0:1==e?o=o/100|0:2==e&&(o=o/10|0),a=(n||t<4)&&9999==o||!n&&t>3&&4999==o):a=((n||t<4)&&o+1==u||!n&&t>3&&o+1==u/2)&&(r[i+1]/u/1e3|0)==b(10,e-3)-1,a}function _(r,e,t){for(var n,i,u=[0],a=0,o=r.length;a<o;){for(i=u.length;i--;)u[i]*=e;for(u[0]+=s.indexOf(r.charAt(a++)),n=0;n<u.length;n++)u[n]>t-1&&(void 0===u[n+1]&&(u[n+1]=0),u[n+1]+=u[n]/t|0,u[n]%=t)}return u.reverse()}M.absoluteValue=M.abs=function(){var r=new this.constructor(this);return r.s<0&&(r.s=1),T(r)},M.ceil=function(){return T(new this.constructor(this),this.e+1,2)},M.clampedTo=M.clamp=function(r,e){var t=this.constructor;if(r=new t(r),e=new t(e),!r.s||!e.s)return new t(NaN);if(r.gt(e))throw Error(m+e);return 0>this.cmp(r)?r:this.cmp(e)>0?e:new t(this)},M.comparedTo=M.cmp=function(r){var e,t,n,i,u=this.d,a=(r=new this.constructor(r)).d,o=this.s,s=r.s;if(!u||!a)return o&&s?o!==s?o:u===a?0:!u^o<0?1:-1:NaN;if(!u[0]||!a[0])return u[0]?o:a[0]?-s:0;if(o!==s)return o;if(this.e!==r.e)return this.e>r.e^o<0?1:-1;for(e=0,t=(n=u.length)<(i=a.length)?n:i;e<t;++e)if(u[e]!==a[e])return u[e]>a[e]^o<0?1:-1;return n===i?0:n>i^o<0?1:-1},M.cosine=M.cos=function(){var r,e,t=this,n=t.constructor;return t.d?t.d[0]?(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+7,n.rounding=1,t=function(r,e){var t,n,i;if(e.isZero())return e;(n=e.d.length)<32?i=(1/Y(4,t=Math.ceil(n/3))).toString():(t=16,i="2.3283064365386962890625e-10"),r.precision+=t,e=Z(r,1,e.times(i),new r(1));for(var u=t;u--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return r.precision-=t,e}(n,X(n,t)),n.precision=r,n.rounding=e,T(2==o||3==o?t.neg():t,r,e,!0)):new n(1):new n(NaN)},M.cubeRoot=M.cbrt=function(){var r,e,t,n,i,u,a,o,s,f,c=this.constructor;if(!this.isFinite()||this.isZero())return new c(this);for(h=!1,(u=this.s*b(this.s*this,1/3))&&Math.abs(u)!=1/0?n=new c(u.toString()):(t=C(this.d),(u=((r=this.e)-t.length+1)%3)&&(t+=1==u||-2==u?"0":"00"),u=b(t,1/3),r=y((r+1)/3)-(r%3==(r<0?-1:2)),(n=new c(t=u==1/0?"5e"+r:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+r)).s=this.s),a=(r=c.precision)+3;;)if(n=B((f=(s=(o=n).times(o).times(o)).plus(this)).plus(this).times(o),f.plus(s),a+2,1),C(o.d).slice(0,a)===(t=C(n.d)).slice(0,a)){if
1("9999"!=(t=t.slice(a-3,a+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(T(n,r+1,1),e=!n.times(n).times(n).eq(this));break}if(!i&&(T(o,r+1,0),o.times(o).times(o).eq(this))){n=o;break}a+=4,i=1}return h=!0,T(n,r,c.rounding,e)},M.decimalPlaces=M.dp=function(){var r,e=this.d,t=NaN;if(e){if(t=((r=e.length-1)-y(this.e/7))*7,r=e[r])for(;r%10==0;r/=10)t--;t<0&&(t=0)}return t},M.dividedBy=M.div=function(r){return B(this,new this.constructor(r))},M.dividedToIntegerBy=M.divToInt=function(r){var e=this.constructor;return T(B(this,new e(r),0,1,1),e.precision,e.rounding)},M.equals=M.eq=function(r){return 0===this.cmp(r)},M.floor=function(){return T(new this.constructor(this),this.e+1,3)},M.greaterThan=M.gt=function(r){return this.cmp(r)>0},M.greaterThanOrEqualTo=M.gte=function(r){var e=this.cmp(r);return 1==e||0===e},M.hyperbolicCosine=M.cosh=function(){var r,e,t,n,i,u=this,a=u.constructor,o=new a(1);if(!u.isFinite())return new a(u.s?1/0:NaN);if(u.isZero())return o;t=a.precision,n=a.rounding,a.precision=t+Math.max(u.e,u.sd())+4,a.rounding=1,(i=u.d.length)<32?e=(1/Y(4,r=Math.ceil(i/3))).toString():(r=16,e="2.3283064365386962890625e-10"),u=Z(a,1,u.times(e),new a(1),!0);for(var s,f=r,c=new a(8);f--;)s=u.times(u),u=o.minus(s.times(c.minus(s.times(c))));return T(u,a.precision=t,a.rounding=n,!0)},M.hyperbolicSine=M.sinh=function(){var r,e,t,n,i=this,u=i.constructor;if(!i.isFinite()||i.isZero())return new u(i);if(e=u.precision,t=u.rounding,u.precision=e+Math.max(i.e,i.sd())+4,u.rounding=1,(n=i.d.length)<3)i=Z(u,2,i,i,!0);else{r=(r=1.4*Math.sqrt(n))>16?16:0|r,i=Z(u,2,i=i.times(1/Y(5,r)),i,!0);for(var a,o=new u(5),s=new u(16),f=new u(20);r--;)a=i.times(i),i=i.times(o.plus(a.times(s.times(a).plus(f))))}return u.precision=e,u.rounding=t,T(i,e,t,!0)},M.hyperbolicTangent=M.tanh=function(){var r,e,t=this.constructor;return this.isFinite()?this.isZero()?new t(this):(r=t.precision,e=t.rounding,t.precision=r+7,t.rounding=1,B(this.sinh(),this.cosh(),t.precision=r,t.rounding=e)):new t(this.s)},M.inverseCosine=M.acos=function(){var r,e=this,t=e.constructor,n=e.abs().cmp(1),i=t.precision,u=t.rounding;return -1!==n?0===n?e.isNeg()?R(t,i,u):new t(0):new t(NaN):e.isZero()?R(t,i+4,u).times(.5):(t.precision=i+6,t.rounding=1,e=e.asin(),r=R(t,i+4,u).times(.5),t.precision=i,t.rounding=u,r.minus(e))},M.inverseHyperbolicCosine=M.acosh=function(){var r,e,t=this,n=t.constructor;return t.lte(1)?new n(t.eq(1)?0:NaN):t.isFinite()?(r=n.precision,e=n.rounding,n.precision=r+Math.max(Math.abs(t.e),t.sd())+4,n.rounding=1,h=!1,t=t.times(t).minus(1).sqrt().plus(t),h=!0,n.precision=r,n.rounding=e,t.ln()):new n(t)},M.inverseHyperbolicSine=M.asinh=function(){var r,e,t=this,n=t.constructor;return!t.isFinite()||t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+2*Math.max(Math.abs(t.e),t.sd())+6,n.rounding=1,h=!1,t=t.times(t).plus(1).sqrt().plus(t),h=!0,n.precision=r,n.rounding=e,t.ln())},M.inverseHyperbolicTangent=M.atanh=function(){var r,e,t,n,i=this,u=i.constructor;return i.isFinite()?i.e>=0?new u(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(r=u.precision,e=u.rounding,Math.max(n=i.sd(),r)<-(2*i.e)-1)?T(new u(i),r,e,!0):(u.precision=t=n-i.e,i=B(i.plus(1),new u(1).minus(i),t+r,1),u.precision=r+4,u.rounding=1,i=i.ln(),u.precision=r,u.rounding=e,i.times(.5)):new u(NaN)},M.inverseSine=M.asin=function(){var r,e,t,n,i=this,u=i.constructor;return i.isZero()?new u(i):(e=i.abs().cmp(1),t=u.precision,n=u.rounding,-1!==e)?0===e?((r=R(u,t+4,n).times(.5)).s=i.s,r):new u(NaN):(u.precision=t+6,u.rounding=1,i=i.div(new u(1).minus(i.times(i)).sqrt().plus(1)).atan(),u.precision=t,u.rounding=n,i.times(2))},M.inverseTangent=M.atan=function(){var r,e,t,n,i,u,a,o,s,f=this,c=f.constructor,l=c.precision,p=c.rounding;if(f.isFinite()){if(f.isZero())return new c(f);else if(f.abs().eq(1)&&l+4<=N)return(a=R(c,l+4,p).times(.25)).s=f.s,a}else{if(!f.s)return new c(NaN);if(l+4<=N)return(a=R(c,l+4,p).times(.5)).s=f.s,a}for(c.precision=o=l+10,c.rounding=1,r=t=Math.min(28,o/7+2|0);r;--r)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(h=!1,e=Math.ceil(o/7),n=1,s=f.times(f),a=new c(f),i=f;-1!==r;)if(i=i.times(s),u=a.minus(i.div(n+=2)),i=i.times(s),void 0!==(a=u.plus(i.div(n+=2))).d[e])for(r=e;a.d[r]===u.d[r]&&r--;);
1return t&&(a=a.times(2<<t-1)),h=!0,T(a,c.precision=l,c.rounding=p,!0)},M.isFinite=function(){return!!this.d},M.isInteger=M.isInt=function(){return!!this.d&&y(this.e/7)>this.d.length-2},M.isNaN=function(){return!this.s},M.isNegative=M.isNeg=function(){return this.s<0},M.isPositive=M.isPos=function(){return this.s>0},M.isZero=function(){return!!this.d&&0===this.d[0]},M.lessThan=M.lt=function(r){return 0>this.cmp(r)},M.lessThanOrEqualTo=M.lte=function(r){return 1>this.cmp(r)},M.logarithm=M.log=function(r){var e,t,n,i,u,a,o,s,f=this.constructor,c=f.precision,l=f.rounding;if(null==r)r=new f(10),e=!0;else{if(t=(r=new f(r)).d,r.s<0||!t||!t[0]||r.eq(1))return new f(NaN);e=r.eq(10)}if(t=this.d,this.s<0||!t||!t[0]||this.eq(1))return new f(t&&!t[0]?-1/0:1!=this.s?NaN:t?0:1/0);if(e)if(t.length>1)u=!0;else{for(i=t[0];i%10==0;)i/=10;u=1!==i}if(h=!1,S((s=B(a=H(this,o=c+5),e?I(f,o+10):H(r,o),o,1)).d,i=c,l))do if(o+=10,s=B(a=H(this,o),e?I(f,o+10):H(r,o),o,1),!u){+C(s.d).slice(i+1,i+15)+1==1e14&&(s=T(s,c+1,0));break}while(S(s.d,i+=10,l));return h=!0,T(s,c,l)},M.minus=M.sub=function(r){var e,t,n,i,u,a,o,s,f,c,l,p,m=this.constructor;if(r=new m(r),!this.d||!r.d)return this.s&&r.s?this.d?r.s=-r.s:r=new m(r.d||this.s!==r.s?this:NaN):r=new m(NaN),r;if(this.s!=r.s)return r.s=-r.s,this.plus(r);if(f=this.d,p=r.d,o=m.precision,s=m.rounding,!f[0]||!p[0]){if(p[0])r.s=-r.s;else{if(!f[0])return new m(3===s?-0:0);r=new m(this)}return h?T(r,o,s):r}if(t=y(r.e/7),c=y(this.e/7),f=f.slice(),u=c-t){for((l=u<0)?(e=f,u=-u,a=p.length):(e=p,t=c,a=f.length),u>(n=Math.max(Math.ceil(o/7),a)+2)&&(u=n,e.length=1),e.reverse(),n=u;n--;)e.push(0);e.reverse()}else{for((l=(n=f.length)<(a=p.length))&&(a=n),n=0;n<a;n++)if(f[n]!=p[n]){l=f[n]<p[n];break}u=0}for(l&&(e=f,f=p,p=e,r.s=-r.s),a=f.length,n=p.length-a;n>0;--n)f[a++]=0;for(n=p.length;n>u;){if(f[--n]<p[n]){for(i=n;i&&0===f[--i];)f[i]=1e7-1;--f[i],f[n]+=1e7}f[n]-=p[n]}for(;0===f[--a];)f.pop();for(;0===f[0];f.shift())--t;return f[0]?(r.d=f,r.e=z(f,t),h?T(r,o,s):r):new m(3===s?-0:0)},M.modulo=M.mod=function(r){var e,t=this.constructor;
1return(r=new t(r),this.d&&r.s&&(!r.d||r.d[0]))?r.d&&(!this.d||this.d[0])?(h=!1,9==t.modulo?(e=B(this,r.abs(),0,3,1),e.s*=r.s):e=B(this,r,0,t.modulo,1),e=e.times(r),h=!0,this.minus(e)):T(new t(this),t.precision,t.rounding):new t(NaN)},M.naturalExponential=M.exp=function(){return L(this)},M.naturalLogarithm=M.ln=function(){return H(this)},M.negated=M.neg=function(){var r=new this.constructor(this);return r.s=-r.s,T(r)},M.plus=M.add=function(r){var e,t,n,i,u,a,o,s,f,c,l=this.constructor;if(r=new l(r),!this.d||!r.d)return this.s&&r.s?this.d||(r=new l(r.d||this.s===r.s?this:NaN)):r=new l(NaN),r;if(this.s!=r.s)return r.s=-r.s,this.minus(r);if(f=this.d,c=r.d,o=l.precision,s=l.rounding,!f[0]||!c[0])return c[0]||(r=new l(this)),h?T(r,o,s):r;if(u=y(this.e/7),n=y(r.e/7),f=f.slice(),i=u-n){for(i<0?(t=f,i=-i,a=c.length):(t=c,n=u,a=f.length),i>(a=(u=Math.ceil(o/7))>a?u+1:a+1)&&(i=a,t.length=1),t.reverse();i--;)t.push(0);t.reverse()}for((a=f.length)-(i=c.length)<0&&(i=a,t=c,c=f,f=t),e=0;i;)e=(f[--i]=f[i]+c[i]+e)/1e7|0,f[i]%=1e7;for(e&&(f.unshift(e),++n),a=f.length;0==f[--a];)f.pop();return r.d=f,r.e=z(f,n),h?T(r,o,s):r},M.precision=M.sd=function(r){var e;if(void 0!==r&&!!r!==r&&1!==r&&0!==r)throw Error(m+r);return this.d?(e=U(this.d),r&&this.e+1>e&&(e=this.e+1)):e=NaN,e},M.round=function(){var r=this.constructor;return T(new r(this),this.e+1,r.rounding)},M.sine=M.sin=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+Math.max(t.e,t.sd())+7,n.rounding=1,t=function(r,e){var t,n=e.d.length;if(n<3)return e.isZero()?e:Z(r,2,e,e);t=(t=1.4*Math.sqrt(n))>16?16:0|t,e=Z(r,2,e=e.times(1/Y(5,t)),e);for(var i,u=new r(5),a=new r(16),o=new r(20);t--;)i=e.times(e),e=e.times(u.plus(i.times(a.times(i).minus(o))));return e}(n,X(n,t)),n.precision=r,n.rounding=e,T(o>2?t.neg():t,r,e,!0)):new n(NaN)},M.squareRoot=M.sqrt=function(){var r,e,t,n,i,u,a=this.d,o=this.e,s=this.s,f=this.constructor;if(1!==s||!a||!a[0])return new f(!s||s<0&&(!a||a[0])?NaN:a?this:1/0);for(h=!1,0==(s=Math.sqrt(+this))||s==1/0?(((e=C(a)).length+o)%2==0&&(e+="0"),s=Math.sqrt(e),o=y((o+1)/2)-(o<0||o%2),n=new f(e=s==1/0?"5e"+o:(e=s.toExponential()).slice(0,e.indexOf("e")+1)+o)):n=new f(s.toString()),t=(o=f.precision)+3;;)if(n=(u=n).plus(B(this,u,t+2,1)).times(.5),C(u.d).slice(0,t)===(e=C(n.d)).slice(0,t)){if("9999"!=(e=e.slice(t-3,t+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(T(n,o+1,1),r=!n.times(n).eq(this));break}if(!i&&(T(u,o+1,0),u.times(u).eq(this))){n=u;break}t+=4,i=1}return h=!0,T(n,o,f.rounding,r)},M.tangent=M.tan=function(){var r,e,t=this,n=t.constructor;return t.isFinite()?t.isZero()?new n(t):(r=n.precision,e=n.rounding,n.precision=r+10,n.rounding=1,(t=t.sin()).s=1,t=B(t,new n(1).minus(t.times(t)).sqrt(),r+10,0),n.precision=r,n.rounding=e,T(2==o||4==o?t.neg():t,r,e,!0)):new n(NaN)},M.times=M.mul=function(r){var e,t,n,i,u,a,o,s,f,c=this.constructor,l=this.d,p=(r=new c(r)).d;if(r.s*=this.s,!l||!l[0]||!p||!p[0])return new c(!r.s||l&&!l[0]&&!p||p&&!p[0]&&!l?NaN:!l||!p?r.s/0:0*r.s);for(t=y(this.e/7)+y(r.e/7),(s=l.length)<(f=p.length)&&(u=l,l=p,p=u,a=s,s=f,f=a),u=[],n=a=s+f;n--;)u.push(0);for(n=f;--n>=0;){for(e=0,i=s+n;i>n;)o=u[i]+p[n]*l[i-n-1]+e,u[i--]=o%1e7|0,e=o/1e7|0;u[i]=(u[i]+e)%1e7|0}for(;!u[--a];)u.pop();return e?++t:u.shift(),r.d=u,r.e=z(u,t),h?T(r,c.precision,c.rounding):r},M.toBinary=function(r,e){return J(this,2,r,e)},M.toDecimalPlaces=M.toDP=function(r,e){var t=this,n=t.constructor;return(t=new n(t),void 0===r)?t:(F(r,0,1e9),void 0===e?e=n.rounding:F(e,0,8),T(t,r+t.e+1,e))},M.toExponential=function(r,e){var t,n=this,i=n.constructor;return void 0===r?t=O(n,!0):(F(r,0,1e9),void 0===e?e=i.rounding:F(e,0,8),t=O(n=T(new i(n),r+1,e),!0,r+1)),n.isNeg()&&!n.isZero()?"-"+t:t},M.toFixed=function(r,e){var t,n,i=this.constructor;return void 0===r?t=O(this):(F(r,0,1e9),void 0===e?e=i.rounding:F(e,0,8),t=O(n=T(new i(this),r+this.e+1,e),!1,r+n.e+1)),this.isNeg()&&!this.isZero()?"-"+t:t},M.toFraction=function(r){var e,t,n,i,u,a,o,s,f,c,l,p,v=this.d,d=this.constructor;if(!v)return new d(this);
1if(f=t=new d(1),n=s=new d(0),a=(u=(e=new d(n)).e=U(v)-this.e-1)%7,e.d[0]=b(10,a<0?7+a:a),null==r)r=u>0?e:f;else{if(!(o=new d(r)).isInt()||o.lt(f))throw Error(m+o);r=o.gt(e)?u>0?e:f:o}for(h=!1,o=new d(C(v)),c=d.precision,d.precision=u=7*v.length*2;l=B(o,e,0,1,1),1!=(i=t.plus(l.times(n))).cmp(r);)t=n,n=i,i=f,f=s.plus(l.times(i)),s=i,i=e,e=o.minus(l.times(i)),o=i;return i=B(r.minus(t),n,0,1,1),s=s.plus(i.times(f)),t=t.plus(i.times(n)),s.s=f.s=this.s,p=1>B(f,n,u,1).minus(this).abs().cmp(B(s,t,u,1).minus(this).abs())?[f,n]:[s,t],d.precision=c,h=!0,p},M.toHexadecimal=M.toHex=function(r,e){return J(this,16,r,e)},M.toNearest=function(r,e){var t=this,n=t.constructor;if(t=new n(t),null==r){if(!t.d)return t;r=new n(1),e=n.rounding}else{if(r=new n(r),void 0===e?e=n.rounding:F(e,0,8),!t.d)return r.s?t:r;if(!r.d)return r.s&&(r.s=t.s),r}return r.d[0]?(h=!1,t=B(t,r,0,e,1).times(r),h=!0,T(t)):(r.s=t.s,t=r),t},M.toNumber=function(){return+this},M.toOctal=function(r,e){return J(this,8,r,e)},M.toPower=M.pow=function(r){var e,t,n,i,u,a,o=this,s=o.constructor,f=+(r=new s(r));if(!o.d||!r.d||!o.d[0]||!r.d[0])return new s(b(+o,f));if((o=new s(o)).eq(1))return o;if(n=s.precision,u=s.rounding,r.eq(1))return T(o,n,u);if((e=y(r.e/7))>=r.d.length-1&&(t=f<0?-f:f)<=0x1fffffffffffff)return i=j(s,o,t,n),r.s<0?new s(1).div(i):T(i,n,u);if((a=o.s)<0){if(e<r.d.length-1)return new s(NaN);if((1&r.d[e])==0&&(a=1),0==o.e&&1==o.d[0]&&1==o.d.length)return o.s=a,o}return(e=0!=(t=b(+o,f))&&isFinite(t)?new s(t+"").e:y(f*(Math.log("0."+C(o.d))/Math.LN10+o.e+1)))>s.maxE+1||e<s.minE-1?new s(e>0?a/0:0):(h=!1,s.rounding=o.s=1,t=Math.min(12,(e+"").length),(i=L(r.times(H(o,n+t)),n)).d&&S((i=T(i,n+5,1)).d,n,u)&&(e=n+10,+C((i=T(L(r.times(H(o,e+t)),e),e+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=T(i,n+1,0))),i.s=a,h=!0,s.rounding=u,T(i,n,u))},M.toPrecision=function(r,e){var t,n=this,i=n.constructor;return void 0===r?t=O(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(F(r,1,1e9),void 0===e?e=i.rounding:F(e,0,8),t=O(n=T(new i(n),r,e),r<=n.e||n.e<=i.toExpNeg,r)),n.isNeg()&&!n.isZero()?"-"+t:t},M.toSignificantDigits=M.toSD=function(r,e){var t=this.constructor;return void 0===r?(r=t.precision,e=t.rounding):(F(r,1,1e9),void 0===e?e=t.rounding:F(e,0,8)),T(new t(this),r,e)},M.toString=function(){var r=this.constructor,e=O(this,this.e<=r.toExpNeg||this.e>=r.toExpPos);return this.isNeg()&&!this.isZero()?"-"+e:e},M.truncated=M.trunc=function(){return T(new this.constructor(this),this.e+1,1)},M.valueOf=M.toJSON=function(){var r=this.constructor,e=O(this,this.e<=r.toExpNeg||this.e>=r.toExpPos);return this.isNeg()?"-"+e:e};var B=function(){function r(r,e,t){var n,i=0,u=r.length;for(r=r.slice();u--;)n=r[u]*e+i,r[u]=n%t|0,i=n/t|0;return i&&r.unshift(i),r}function e(r,e,t,n){var i,u;if(t!=n)u=t>n?1:-1;else for(i=u=0;i<t;i++)if(r[i]!=e[i]){u=r[i]>e[i]?1:-1;break}return u}function t(r,e,t,n){for(var i=0;t--;)r[t]-=i,i=+(r[t]<e[t]),r[t]=i*n+r[t]-e[t];for(;!r[0]&&r.length>1;)r.shift()}return function(n,i,u,o,s,f){var c,l,h,p,m,v,d,g,b,D,x,E,A,w,N,M,C,F,S,_,B=n.constructor,O=n.s==i.s?1:-1,z=n.d,I=i.d;if(!z||!z[0]||!I||!I[0])return new B(!n.s||!i.s||(z?I&&z[0]==I[0]:!I)?NaN:z&&0==z[0]||!I?0*O:O/0);for(f?(m=1,l=n.e-i.e):(f=1e7,m=7,l=y(n.e/m)-y(i.e/m)),S=I.length,C=z.length,D=(b=new B(O)).d=[],h=0;I[h]==(z[h]||0);h++);if(I[h]>(z[h]||0)&&l--,null==u?(w=u=B.precision,o=B.rounding):w=s?u+(n.e-i.e)+1:u,w<0)D.push(1),v=!0;else{if(w=w/m+2|0,h=0,1==S){for(p=0,I=I[0],w++;(h<C||p)&&w--;h++)N=p*f+(z[h]||0),D[h]=N/I|0,p=N%I|0;v=p||h<C}else{for((p=f/(I[0]+1)|0)>1&&(I=r(I,p,f),z=r(z,p,f),S=I.length,C=z.length),M=S,E=(x=z.slice(0,S)).length;E<S;)x[E++]=0;(_=I.slice()).unshift(0),F=I[0],I[1]>=f/2&&++F;do p=0,(c=e(I,x,S,E))<0?(A=x[0],S!=E&&(A=A*f+(x[1]||0)),(p=A/F|0)>1?(p>=f&&(p=f-1),g=(d=r(I,p,f)).length,E=x.length,1==(c=e(d,x,g,E))&&(p--,t(d,S<g?_:I,g,f))):(0==p&&(c=p=1),d=I.slice()),(g=d.length)<E&&d.unshift(0),t(x,d,E,f),-1==c&&(E=x.length,(c=e(I,x,S,E))<1&&(p++,t(x,S<E?_:I,E,f))),E=x.length):0===c&&(p++,x=[0]),D[h++]=p,c&&x[0]?x[E++]=z[M]||0:(x=[z[M]],E=1);while((M++<C||void 0!==x[0])&&w--);v=void 0!==x[0]}D[0]||D.shift()}if(1==m)b.e=l,a=v;else{for(h=1,p=D[0];p>=10;p/=10)h++;b.e=h+l*m-1,T(b,s?u+b.e+1:u,o,v)}return b}}();function T(r,e,t,n){var i,u,a,o,s,f,c,l,p,m=r.constructor;r:if(null!=e){if(!(l=r.d))return r;for(i=1,o=l[0];o>=10;o/=10)i++;if((u=e-i)<0)u+=7,a=e,s=(c=l[p=0])/b(10,i-a-1)%10|0;else if((p=Math.ceil((u+1)/7))>=(o=l.length))if(n){for(;o++<=p;)l.push(0);c=s=0,i=1,u%=7,a=u-7+1}else break r;else{for(i=1,c=o=l[p];o>=10;o/=10)i++;u%=7,s=(a=u-7+i)<0?0:c/b(10,i-a-1)%10|0}
vendor: 4,373 bytes, line 1
1if(n=n||e<0||void 0!==l[p+1]||(a<0?c:c%b(10,i-a-1)),f=t<4?(s||n)&&(0==t||t==(r.s<0?3:2)):s>5||5==s&&(4==t||n||6==t&&(u>0?a>0?c/b(10,i-a):0:l[p-1])%10&1||t==(r.s<0?8:7)),e<1||!l[0])return l.length=0,f?(e-=r.e+1,l[0]=b(10,(7-e%7)%7),r.e=-e||0):l[0]=r.e=0,r;if(0==u?(l.length=p,o=1,p--):(l.length=p+1,o=b(10,7-u),l[p]=a>0?(c/b(10,i-a)%b(10,a)|0)*o:0),f)for(;;)if(0==p){for(u=1,a=l[0];a>=10;a/=10)u++;for(a=l[0]+=o,o=1;a>=10;a/=10)o++;u!=o&&(r.e++,1e7==l[0]&&(l[0]=1));break}else{if(l[p]+=o,1e7!=l[p])break;l[p--]=0,o=1}for(u=l.length;0===l[--u];)l.pop()}return h&&(r.e>m.maxE?(r.d=null,r.e=NaN):r.e<m.minE&&(r.e=0,r.d=[0])),r}function O(r,e,t){if(!r.isFinite())return G(r);var n,i=r.e,u=C(r.d),a=u.length;return e?(t&&(n=t-a)>0?u=u.charAt(0)+"."+u.slice(1)+P(n):a>1&&(u=u.charAt(0)+"."+u.slice(1)),u=u+(r.e<0?"e":"e+")+r.e):i<0?(u="0."+P(-i-1)+u,t&&(n=t-a)>0&&(u+=P(n))):i>=a?(u+=P(i+1-a),t&&(n=t-i-1)>0&&(u=u+"."+P(n))):((n=i+1)<a&&(u=u.slice(0,n)+"."+u.slice(n)),t&&(n=t-a)>0&&(i+1===a&&(u+="."),u+=P(n))),u}function z(r,e){var t=r[0];for(e*=7;t>=10;t/=10)e++;return e}function I(r,e,t){if(e>w)throw h=!0,t&&(r.precision=t),Error(v);return T(new r(f),e,1,!0)}function R(r,e,t){if(e>N)throw Error(v);return T(new r(c),e,t,!0)}function U(r){var e=r.length-1,t=7*e+1;if(e=r[e]){for(;e%10==0;e/=10)t--;for(e=r[0];e>=10;e/=10)t++}return t}function P(r){for(var e="";r--;)e+="0";return e}function j(r,e,t,n){var i,u=new r(1),a=Math.ceil(n/7+4);for(h=!1;;){if(t%2&&W((u=u.times(e)).d,a)&&(i=!0),0===(t=y(t/2))){t=u.d.length-1,i&&0===u.d[t]&&++u.d[t];break}W((e=e.times(e)).d,a)}return h=!0,u}function k(r){return 1&r.d[r.d.length-1]}function q(r,e,t){for(var n,i=new r(e[0]),u=0;++u<e.length;)if((n=new r(e[u])).s)i[t](n)&&(i=n);else{i=n;break}return i}function L(r,e){var t,n,i,u,a,o,s,f=0,c=0,l=0,p=r.constructor,m=p.rounding,v=p.precision;if(!r.d||!r.d[0]||r.e>17)return new p(r.d?!r.d[0]?1:r.s<0?0:1/0:r.s?r.s<0?0:r:0/0);for(null==e?(h=!1,s=v):s=e,o=new p(.03125);r.e>-2;)r=r.times(o),l+=5;for(s+=n=Math.log(b(2,l))/Math.LN10*2+5|0,t=u=a=new p(1),p.precision=s;;){if(u=T(u.times(r),s,1),t=t.times(++c),C((o=a.plus(B(u,t,s,1))).d).slice(0,s)===C(a.d).slice(0,s)){for(i=l;i--;)a=T(a.times(a),s,1);if(null!=e)return p.precision=v,a;if(!(f<3&&S(a.d,s-n,m,f)))return T(a,p.precision=v,m,h=!0);p.precision=s+=10,t=u=o=new p(1),c=0,f++}a=o}}function H(r,e){var t,n,i,u,a,o,s,f,c,l,p,m=1,v=r,d=v.d,g=v.constructor,y=g.rounding,b=g.precision;if(v.s<0||!d||!d[0]||!v.e&&1==d[0]&&1==d.length)return new g(d&&!d[0]?-1/0:1!=v.s?NaN:d?0:v);if(null==e?(h=!1,c=b):c=e,g.precision=c+=10,n=(t=C(d)).charAt(0),!(15e14>Math.abs(u=v.e)))return f=I(g,c+2,b).times(u+""),v=H(new g(n+"."+t.slice(1)),c-10).plus(f),g.precision=b,null==e?T(v,b,y,h=!0):v;for(;n<7&&1!=n||1==n&&t.charAt(1)>3;)n=(t=C((v=v.times(r)).d)).charAt(0),m++;for(u=v.e,n>1?(v=new g("0."+t),u++):v=new g(n+"."+t.slice(1)),l=v,s=a=v=B(v.minus(1),v.plus(1),c,1),p=T(v.times(v),c,1),i=3;;){if(a=T(a.times(p),c,1),C((f=s.plus(B(a,new g(i),c,1))).d).slice(0,c)===C(s.d).slice(0,c)){if(s=s.times(2),0!==u&&(s=s.plus(I(g,c+2,b).times(u+""))),s=B(s,new g(m),c,1),null!=e)return g.precision=b,s;if(!S(s.d,c-10,y,o))return T(s,g.precision=b,y,h=!0);g.precision=c+=10,f=a=v=B(l.minus(1),l.plus(1),c,1),p=T(v.times(v),c,1),i=o=1}s=f,i+=2}}function G(r){return String(r.s*r.s/0)}function V(r,e){var t,n,i;for((t=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(t<0&&(t=n),t+=+e.slice(n+1),e=e.substring(0,n)):t<0&&(t=e.length),n=0;48===e.charCodeAt(n);n++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(n,i)){if(i-=n,r.e=t=t-n-1,r.d=[],n=(t+1)%7,t<0&&(n+=7),n<i){for(n&&r.d.push(+e.slice(0,n)),i-=7;n<i;)r.d.push(+e.slice(n,n+=7));n=7-(e=e.slice(n)).length}else n-=i;for(;n--;)e+="0";r.d.push(+e),h&&(r.e>r.constructor.maxE?(r.d=null,r.e=NaN):r.e<r.constructor.minE&&(r.e=0,r.d=[0]))}else r.e=0,r.d=[0];return r}function Z(r,e,t,n,i){var u,a,o,s,f=r.precision,c=Math.ceil(f/7);for(h=!1,s=t.times(t),o=new r(n);;){if(a=B(o.times(s),new r(e++*e++),f,1),o=i?n.plus(a):n.minus(a),n=B(a.times(s),new r(e++*e++),f,1),void 0!==(a=o.plus(n)).d[c]){for(u=c;a.d[u]===o.d[u]&&u--;);if(-1==u)break}u=o,o=n,n=a,a=u}return h=!0,a.d.length=c+1,a}function Y(r,e){for(var t=r;--e;)t*=r;return t}function X(r,e){var t,n=e.s<0,i=R(r,r.precision,1),u=i.times(.5);if((e=e.abs()).lte(u))return o=n?4:1,e;if((t=e.divToInt(i)).isZero())o=n?3:2;
1else{if((e=e.minus(t.times(i))).lte(u))return o=k(t)?n?2:3:n?4:1,e;o=k(t)?n?1:4:n?3:2}return e.minus(i).abs()}function J(r,e,t,n){var i,u,o,f,c,l,h,p,m,v=r.constructor,d=void 0!==t;if(d?(F(t,1,1e9),void 0===n?n=v.rounding:F(n,0,8)):(t=v.precision,n=v.rounding),r.isFinite()){for(o=(h=O(r)).indexOf("."),d?(i=2,16==e?t=4*t-3:8==e&&(t=3*t-2)):i=e,o>=0&&(h=h.replace(".",""),(m=new v(1)).e=h.length-o,m.d=_(O(m),10,i),m.e=m.d.length),u=c=(p=_(h,10,i)).length;0==p[--c];)p.pop();if(p[0]){if(o<0?u--:((r=new v(r)).d=p,r.e=u,p=(r=B(r,m,t,n,0,i)).d,u=r.e,l=a),o=p[t],f=i/2,l=l||void 0!==p[t+1],l=n<4?(void 0!==o||l)&&(0===n||n===(r.s<0?3:2)):o>f||o===f&&(4===n||l||6===n&&1&p[t-1]||n===(r.s<0?8:7)),p.length=t,l)for(;++p[--t]>i-1;)p[t]=0,t||(++u,p.unshift(1));for(c=p.length;!p[c-1];--c);for(o=0,h="";o<c;o++)h+=s.charAt(p[o]);if(d){if(c>1)if(16==e||8==e){for(o=16==e?4:3,--c;c%o;c++)h+="0";for(c=(p=_(h,i,e)).length;!p[c-1];--c);for(o=1,h="1.";o<c;o++)h+=s.charAt(p[o])}else h=h.charAt(0)+"."+h.slice(1);h=h+(u<0?"p":"p+")+u}else if(u<0){for(;++u;)h="0"+h;h="0."+h}else if(++u>c)for(u-=c;u--;)h+="0";else u<c&&(h=h.slice(0,u)+"."+h.slice(u))}else h=d?"0p+0":"0";h=(16==e?"0x":2==e?"0b":8==e?"0o":"")+h}else h=G(r);return r.s<0?"-"+h:h}function W(r,e){if(r.length>e)return r.length=e,!0}function $(r){return new this(r).abs()}function Q(r){return new this(r).acos()}function K(r){return new this(r).acosh()}function rr(r,e){return new this(r).plus(e)}function re(r){return new this(r).asin()}function rt(r){return new this(r).asinh()}function rn(r){return new this(r).atan()}function ri(r){return new this(r).atanh()}function ru(r,e){r=new this(r),e=new this(e);var t,n=this.precision,i=this.rounding,u=n+4;return r.s&&e.s?r.d||e.d?!e.d||r.isZero()?(t=e.s<0?R(this,n,i):new this(0)).s=r.s:!r.d||e.isZero()?(t=R(this,u,1).times(.5)).s=r.s:e.s<0?(this.precision=u,this.rounding=1,t=this.atan(B(r,e,u,1)),e=R(this,u,1),this.precision=n,this.rounding=i,t=r.s<0?t.minus(e):t.plus(e)):t=this.atan(B(r,e,u,1)):(t=R(this,u,1).times(e.s>0?.25:.75)).s=r.s:t=new this(NaN),t}function ra(r){return new this(r).cbrt()}function ro(r){return T(r=new this(r),r.e+1,2)}function rs(r,e,t){return new this(r).clamp(e,t)}function rf(r){if(!r||"object"!=typeof r)throw Error(p+"Object expected");var e,t,n,i=!0===r.defaults,u=["precision",1,1e9,"rounding",0,8,"toExpNeg",-9e15,0,"toExpPos",0,9e15,"maxE",0,9e15,"minE",-9e15,0,"modulo",0,9];for(e=0;e<u.length;e+=3)if(t=u[e],i&&(this[t]=l[t]),void 0!==(n=r[t]))if(y(n)===n&&n>=u[e+1]&&n<=u[e+2])this[t]=n;else throw Error(m+t+": "+n);if(t="crypto",i&&(this[t]=l[t]),void 0!==(n=r[t]))if(!0===n||!1===n||0===n||1===n)if(n)if("undefined"!=typeof crypto&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[t]=!0;else throw Error(d);else this[t]=!1;else throw Error(m+t+": "+n);return this}function rc(r){return new this(r).cos()}function rl(r){return new this(r).cosh()}function rh(r,e){return new this(r).div(e)}function rp(r){return new this(r).exp()}function rm(r){return T(r=new this(r),r.e+1,3)}function rv(){var r,e,t=new this(0);for(r=0,h=!1;r<arguments.length;)if(e=new this(arguments[r++]),e.d)t.d&&(t=t.plus(e.times(e)));else{if(e.s)return h=!0,new this(1/0);t=e}return h=!0,t.sqrt()}function rd(r){return r instanceof rU||r&&r.toStringTag===g||!1}function rg(r){return new this(r).ln()}function ry(r,e){return new this(r).log(e)}function rb(r){return new this(r).log(2)}function rD(r){return new this(r).log(10)}function rx(){return q(this,arguments,"lt")}function rE(){return q(this,arguments,"gt")}function rA(r,e){return new this(r).mod(e)}function rw(r,e){return new this(r).mul(e)}function rN(r,e){return new this(r).pow(e)}function rM(r){var e,t,n,i,u=0,a=new this(1),o=[];if(void 0===r?r=this.precision:F(r,1,1e9),n=Math.ceil(r/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));u<n;)(i=e[u])>=429e7?e[u]=crypto.getRandomValues(new Uint32Array(1))[0]:o[u++]=i%1e7;else if(crypto.randomBytes){for(e=crypto.randomBytes(n*=4);u<n;)(i=e[u]+(e[u+1]<<8)+(e[u+2]<<16)+((127&e[u+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,u):(o.push(i%1e7),u+=4);u=n/4}else throw Error(d);else for(;u<n;)o[u++]=1e7*Math.random()|0;for(n=o[--u],r%=7,n&&r&&(i=b(10,7-r),o[u]=(n/i|0)*i);0===o[u];u--)o.pop();if(u<0)t=0,o=[0];else{for(t=-1;0===o[0];t-=7)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<7&&(t-=7-n)}return a.e=t,a.d=o,a}function rC(r){return T(r=new this(r),r.e+1,this.rounding)}
1function rF(r){return(r=new this(r)).d?r.d[0]?r.s:0*r.s:r.s||NaN}function rS(r){return new this(r).sin()}function r_(r){return new this(r).sinh()}function rB(r){return new this(r).sqrt()}function rT(r,e){return new this(r).sub(e)}function rO(){var r=0,e=arguments,t=new this(e[0]);for(h=!1;t.s&&++r<e.length;)t=t.plus(e[r]);return h=!0,T(t,this.precision,this.rounding)}function rz(r){return new this(r).tan()}function rI(r){return new this(r).tanh()}function rR(r){return T(r=new this(r),r.e+1,1)}M[Symbol.for("nodejs.util.inspect.custom")]=M.toString,M[Symbol.toStringTag]="Decimal";var rU=M.constructor=function r(e){var t,n,i;function u(r){var e,t,n;if(!(this instanceof u))return new u(r);if(this.constructor=u,rd(r)){this.s=r.s,h?!r.d||r.e>u.maxE?(this.e=NaN,this.d=null):r.e<u.minE?(this.e=0,this.d=[0]):(this.e=r.e,this.d=r.d.slice()):(this.e=r.e,this.d=r.d?r.d.slice():r.d);return}if("number"==(n=typeof r)){if(0===r){this.s=1/r<0?-1:1,this.e=0,this.d=[0];return}if(r<0?(r=-r,this.s=-1):this.s=1,r===~~r&&r<1e7){for(e=0,t=r;t>=10;t/=10)e++;h?e>u.maxE?(this.e=NaN,this.d=null):e<u.minE?(this.e=0,this.d=[0]):(this.e=e,this.d=[r]):(this.e=e,this.d=[r]);return}if(0*r!=0){r||(this.s=NaN),this.e=NaN,this.d=null;return}return V(this,r.toString())}if("string"!==n)throw Error(m+r);return 45===(t=r.charCodeAt(0))?(r=r.slice(1),this.s=-1):(43===t&&(r=r.slice(1)),this.s=1),A.test(r)?V(this,r):function(r,e){var t,n,i,u,a,o,s,f,c;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),A.test(e))return V(r,e)}else if("Infinity"===e||"NaN"===e)return+e||(r.s=NaN),r.e=NaN,r.d=null,r;if(x.test(e))t=16,e=e.toLowerCase();else if(D.test(e))t=2;else if(E.test(e))t=8;else throw Error(m+e);for((u=e.search(/p/i))>0?(s=+e.slice(u+1),e=e.substring(2,u)):e=e.slice(2),a=(u=e.indexOf("."))>=0,n=r.constructor,a&&(u=(o=(e=e.replace(".","")).length)-u,i=j(n,new n(t),u,2*u)),u=c=(f=_(e,t,1e7)).length-1;0===f[u];--u)f.pop();return u<0?new n(0*r.s):(r.e=z(f,c),r.d=f,h=!1,a&&(r=B(r,i,4*o)),s&&(r=r.times(54>Math.abs(s)?b(2,s):rU.pow(2,s))),h=!0,r)}(this,r)}if(u.prototype=M,u.ROUND_UP=0,u.ROUND_DOWN=1,u.ROUND_CEIL=2,u.ROUND_FLOOR=3,u.ROUND_HALF_UP=4,u.ROUND_HALF_DOWN=5,u.ROUND_HALF_EVEN=6,u.ROUND_HALF_CEIL=7,u.ROUND_HALF_FLOOR=8,u.EUCLID=9,u.config=u.set=rf,u.clone=r,u.isDecimal=rd,u.abs=$,u.acos=Q,u.acosh=K,u.add=rr,u.asin=re,u.asinh=rt,u.atan=rn,u.atanh=ri,u.atan2=ru,u.cbrt=ra,u.ceil=ro,u.clamp=rs,u.cos=rc,u.cosh=rl,u.div=rh,u.exp=rp,u.floor=rm,u.hypot=rv,u.ln=rg,u.log=ry,u.log10=rD,u.log2=rb,u.max=rx,u.min=rE,u.mod=rA,u.mul=rw,u.pow=rN,u.random=rM,u.round=rC,u.sign=rF,u.sin=rS,u.sinh=r_,u.sqrt=rB,u.sub=rT,u.sum=rO,u.tan=rz,u.tanh=rI,u.trunc=rR,void 0===e&&(e={}),e&&!0!==e.defaults)for(t=0,i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"];t<i.length;)e.hasOwnProperty(n=i[t++])||(e[n]=this[n]);return u.config(e),u}(l);function rP(r){return"number"==typeof r}function rj(r){return!!r&&"object"==typeof r&&"function"==typeof r.constructor&&(!0===r.isBigNumber&&"object"==typeof r.constructor.prototype&&!0===r.constructor.prototype.isBigNumber||"function"==typeof r.constructor.isDecimal&&!0===r.constructor.isDecimal(r))}function rk(r){return r&&"object"==typeof r&&!0===Object.getPrototypeOf(r).isComplex||!1}function rq(r){return r&&"object"==typeof r&&!0===Object.getPrototypeOf(r).isFraction||!1}function rL(r){return r&&!0===r.constructor.prototype.isUnit||!1}function rH(r){return"string"==typeof r}f=new rU(f),c=new rU(c);var rG=Array.isArray;function rV(r){return r&&!0===r.constructor.prototype.isMatrix||!1}function rZ(r){return Array.isArray(r)||rV(r)}function rY(r){return r&&r.isDenseMatrix&&!0===r.constructor.prototype.isMatrix||!1}function rX(r){return r&&r.isSparseMatrix&&!0===r.constructor.prototype.isMatrix||!1}function rJ(r){return r&&!0===r.constructor.prototype.isRange||!1}function rW(r){return r&&!0===r.constructor.prototype.isIndex||!1}function r$(r){return"boolean"==typeof r}function rQ(r){return r&&!0===r.constructor.prototype.isResultSet||!1}function rK(r){return r&&!0===r.constructor.prototype.isHelp||!1}function r0(r){return"function"==typeof r}function r1(r){return r instanceof Date}function r2(r){return r instanceof RegExp}function r3(r){return!!(r&&"object"==typeof r&&r.constructor===Object&&!rk(r)&&!rq(r))}function r8(r){return null===r}function r5(r){return void 0===r}function r4(r){return r&&!0===r.isAccessorNode&&!0===r.constructor.prototype.isNode||!1}function r7(r){return r&&!0===r.isArrayNode&&!0===r.constructor.prototype.isNode||!1}function r9(r){return r&&!0===r.isAssignmentNode&&!0===r.constructor.prototype.isNode||!1}function r6(r){return r&&!0===r.isBlockNode&&!0===r.constructor.prototype.isNode||!1}function er(r){return r&&!0===r.isConditionalNode&&!0===r.constructor.prototype.isNode||!1}function ee(r){return r&&!0===r.isConstantNode&&!0===r.constructor.prototype.isNode||!1}function et(r){return r&&!0===r.isFunctionAssignmentNode&&!0===r.constructor.prototype.isNode||!1}function en(r){return r&&!0===r.isFunctionNode&&!0===r.constructor.prototype.isNode||!1}function ei(r){return r&&!0===r.isIndexNode&&!0===r.constructor.prototype.isNode||!1}function eu(r){return r&&!0===r.isNode&&!0===r.constructor.prototype.isNode||!1}function ea(r){return r&&!0===r.isObjectNode&&!0===r.constructor.prototype.isNode||!1}function eo(r){return r&&!0===r.isOperatorNode&&!0===r.constructor.prototype.isNode||!1}function es(r){return r&&!0===r.isParenthesisNode&&!0===r.constructor.prototype.isNode||!1}function ef(r){return r&&!0===r.isRangeNode&&!0===r.constructor.prototype.isNode||!1}function ec(r){return r&&!0===r.isRelationalNode&&!0===r.constructor.prototype.isNode||!1}function el(r){return r&&!0===r.isSymbolNode&&!0===r.constructor.prototype.isNode||!1}function eh(r){return r&&!0===r.constructor.prototype.isChain||!1}function ep(r){var e=typeof r;return"object"===e?null===r?"null":rj(r)?"BigNumber":r.constructor&&r.constructor.name?r.constructor.name:"Object":e}function em(r){var e=typeof r;if("number"===e||"string"===e||"boolean"===e||null==r)return r;if("function"==typeof r.clone)return r.clone();if(Array.isArray(r))return r.map(function(r){return em(r)});if(r instanceof Date)return new Date(r.valueOf());if(rj(r))return r;if(r3(r)){var t=r,n=em,i={};for(var u in t)eg(t,u)&&(i[u]=n(t[u]));return i}throw TypeError("Cannot clone: unknown type of value (value: ".concat(r,")"))}function ev(r,e){for(var t in e)eg(e,t)&&(r[t]=e[t]);return r}function ed(r,e){var t,n,i;if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(n=0,i=r.length;n<i;n++)if(!ed(r[n],e[n]))return!1;return!0}if("function"==typeof r)return r===e;if(!(r instanceof Object))return r===e;if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in r)if(!(t in e)||!ed(r[t],e[t]))return!1;for(t in e)if(!(t in r))return!1;return!0}function eg(r,e){return r&&Object.hasOwnProperty.call(r,e)}function ey(r,e,t,n){function i(n){var i=function(r,e){for(var t={},n=0;n<e.length;n++){var i=e[n],u=r[i];void 0!==u&&(t[i]=u)}return t}(n,e.map(eb));return function(r,e,t){if(!e.filter(r=>{var e;return!((e=r)&&"?"===e[0])}).every(r=>void 0!==t[r])){var n=e.filter(r=>void 0===t[r]);throw Error('Cannot create function "'.concat(r,'", ')+"some dependencies are missing: ".concat(n.map(r=>'"'.concat(r,'"')).join(", "),"."))}}(r,e,n),t(i)}return i.isFactory=!0,i.fn=r,i.dependencies=e.slice().sort(),n&&(i.meta=n),i}function eb(r){return r&&"?"===r[0]?r.slice(1):r}var eD=ey("BigNumber",["?on","config"],r=>{var{on:e,config:t}=r,n=rU.clone({precision:t.precision,modulo:rU.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(r){return new n(r.value)},e&&e("config",function(r,e){r.precision!==e.precision&&n.config({precision:r.precision})}),n},{isClass:!0}),ex=t(97721),eE=t.n(ex);function eA(r){return"boolean"==typeof r||!!isFinite(r)&&r===Math.round(r)}var ew=Math.sign||function(r){return r>0?1:r<0?-1:0},eN=Math.log2||function(r){return Math.log(r)/Math.LN2},eM=Math.log10||function(r){return Math.log(r)/Math.LN10},eC=Math.log1p||function(r){return Math.log(r+1)},eF=Math.cbrt||function(r){if(0===r)return r;var e,t=r<0;return t&&(r=-r),isFinite(r)?(e=Math.exp(Math.log(r)/3),e=(r/(e*e)+2*e)/3):e=r,t?-e:e},eS=Math.expm1||function(r){return r>=2e-4||r<=-2e-4?Math.exp(r)-1:r+r*r/2+r*r*r/6};function e_(r,e,t){var n="";if(t){if(t<1)throw Error("size must be in greater than 0");if(!eA(t))throw Error("size must be an integer");if(r>2**(t-1)-1||r<-(2**(t-1)))throw Error("Value must be in range [-2^".concat(t-1,", 2^").
1concat(t-1,"-1]"));if(!eA(r))throw Error("Value must be an integer");r<0&&(r+=2**t),n="i".concat(t)}var i="";return r<0&&(r=-r,i="-"),"".concat(i).concat({2:"0b",8:"0o",16:"0x"}[e]).concat(r.toString(e)).concat(n)}function eB(r,e){if("function"==typeof e)return e(r);if(r===1/0)return"Infinity";if(r===-1/0)return"-Infinity";if(isNaN(r))return"NaN";var{notation:t,precision:n,wordSize:i}=eT(e);switch(t){case"fixed":return ez(r,n);case"exponential":return eI(r,n);case"engineering":return function(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=eR(eO(r),e),n=t.exponent,i=t.coefficients,u=n%3==0?n:n<0?n-3-n%3:n-n%3;if(rP(e))for(;e>i.length||n-u+1>i.length;)i.push(0);else for(var a=Math.abs(n-u)-(i.length-1),o=0;o<a;o++)i.push(0);for(var s=Math.abs(n-u),f=1;s>0;)f++,s--;var c=i.slice(f).join(""),l=rP(e)&&c.length||c.match(/[1-9]/)?"."+c:"",h=i.slice(0,f).join("")+l+"e"+(n>=0?"+":"")+u.toString();return t.sign+h}(r,n);case"bin":return e_(r,2,i);case"oct":return e_(r,8,i);case"hex":return e_(r,16,i);case"auto":return(function(r,e,t){if(isNaN(r)||!isFinite(r))return String(r);var n=eY(null==t?void 0:t.lowerExp,-3),i=eY(null==t?void 0:t.upperExp,5),u=eO(r),a=e?eR(u,e):u;if(a.exponent<n||a.exponent>=i)return eI(r,e);var o=a.coefficients,s=a.exponent;o.length<e&&(o=o.concat(eU(e-o.length))),o=o.concat(eU(s-o.length+1+(o.length<e?e-o.length:0))),o=eU(-s).concat(o);var f=s>0?s:0;return f<o.length-1&&o.splice(f+1,0,"."),a.sign+o.join("")})(r,n,e).replace(/((\.\d*?)(0+))($|e)/,function(){var r=arguments[2],e=arguments[4];return"."!==r?r+e:e});default:throw Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}function eT(r){var e,t,n="auto";if(void 0!==r)if(rP(r))e=r;else if(rj(r))e=r.toNumber();else if(r3(r))void 0!==r.precision&&(e=eZ(r.precision,()=>{throw Error('Option "precision" must be a number or BigNumber')})),void 0!==r.wordSize&&(t=eZ(r.wordSize,()=>{throw Error('Option "wordSize" must be a number or BigNumber')})),r.notation&&(n=r.notation);else throw Error("Unsupported type of options, number, BigNumber, or object expected");return{notation:n,precision:e,wordSize:t}}function eO(r){var e=String(r).toLowerCase().match(/^(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!e)throw SyntaxError("Invalid number "+r);var t=e[1],n=e[2],i=parseFloat(e[4]||"0"),u=n.indexOf(".");i+=-1!==u?u-1:n.length-1;var a=n.replace(".","").replace(/^0*/,function(r){return i-=r.length,""}).replace(/0*$/,"").split("").map(function(r){return parseInt(r)});return 0===a.length&&(a.push(0),i++),{sign:t,coefficients:a,exponent:i}}function ez(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=eO(r),n="number"==typeof e?eR(t,t.exponent+1+e):t,i=n.coefficients,u=n.exponent+1,a=u+(e||0);return i.length<a&&(i=i.concat(eU(a-i.length))),u<0&&(i=eU(-u+1).concat(i),u=1),u<i.length&&i.splice(u,0,0===u?"0.":"."),n.sign+i.join("")}function eI(r,e){if(isNaN(r)||!isFinite(r))return String(r);var t=eO(r),n=e?eR(t,e):t,i=n.coefficients,u=n.exponent;i.length<e&&(i=i.concat(eU(e-i.length)));var a=i.shift();return n.sign+a+(i.length>0?"."+i.join(""):"")+"e"+(u>=0?"+":"")+u}function eR(r,e){for(var t={sign:r.sign,coefficients:r.coefficients,exponent:r.exponent},n=t.coefficients;e<=0;)n.unshift(0),t.exponent++,e++;if(n.length>e&&n.splice(e,n.length-e)[0]>=5){var i=e-1;for(n[i]++;10===n[i];)n.pop(),0===i&&(n.unshift(0),t.exponent++,i++),i--,n[i]++}return t}function eU(r){for(var e=[],t=0;t<r;t++)e.push(0);return e}var eP=Number.EPSILON||2220446049250313e-31;function ej(r,e,t){if(null==t)return r===e;if(r===e)return!0;if(isNaN(r)||isNaN(e))return!1;if(isFinite(r)&&isFinite(e)){var n=Math.abs(r-e);return n<=eP||n<=Math.max(Math.abs(r),Math.abs(e))*t}return!1}var ek=Math.acosh||function(r){return Math.log(Math.sqrt(r*r-1)+r)},eq=Math.asinh||function(r){return Math.log(Math.sqrt(r*r+1)+r)},eL=Math.atanh||function(r){return Math.log((1+r)/(1-r))/2},eH=Math.cosh||function(r){return(Math.exp(r)+Math.exp(-r))/2},eG=Math.sinh||function(r){return(Math.exp(r)-Math.exp(-r))/2},eV=Math.tanh||function(r){var e=Math.exp(2*r);return(e-1)/(e+1)};function eZ(r,e){return rP(r)?r:rj(r)?r.toNumber():void e()}function eY(r,e){return rP(r)?r:rj(r)?r.toNumber():e}var eX=ey("Complex",[],()=>(Object.defineProperty(eE(),"name",{value:"Complex"}),eE().prototype.constructor=eE(),eE().prototype.type="Complex",eE().prototype.isComplex=!0,eE().prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},eE().prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},eE().prototype.format=function(r){var e="",t=this.im,n=this.re,i=eB(this.re,r),u=eB(this.im,r),a=rP(r)?r:r?r.precision:null;if(null!==a){var o=Math.pow(10,-a);Math.abs(n/t)<o&&(n=0),Math.abs(t/n)<o&&(t=0)}return 0===t?i:0===n?1===t?"i":-1===t?"-i":u+"i":t<0?-1===t?i+" - i":i+" - "+u.substring(1)+"i":1===t?i+" + i":i+" + "+u+"i"},eE().fromPolar=function(r){switch(arguments.length){case 1:var e=arguments[0];if("object"==typeof e)return eE()(e);throw TypeError("Input has to be an object with r and phi keys.");case 2:var t=arguments[0],n=arguments[1];if(rP(t)){if(rL(n)&&n.hasBase("ANGLE")&&(n=n.toNumber("rad")),rP(n))return new(eE())({r:t,phi:n});throw TypeError("Phi is not a number nor an angle unit.")}throw TypeError("Radius r is not a number.");default:throw SyntaxError("Wrong number of arguments in function fromPolar")}},eE().prototype.valueOf=eE().prototype.toString,eE().fromJSON=function(r){return new(eE())(r)},eE().compare=function(r,e){return r.re>e.re?1:r.re<e.re?-1:r.im>e.im?1:r.im<e.im?-1:0},eE()),{isClass:!0});function eJ(r){var{hasher:e,limit:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t=null==t?Number.POSITIVE_INFINITY:t,e=null==e?JSON.stringify:e,function n(){"object"!=typeof n.cache&&(n.cache={values:new Map,lru:(i=t||Number.POSITIVE_INFINITY,u=0,a=1,o=Object.create(null),s=Object.create(null),f=0,c=function(r){var e=s[r];if(e&&(delete o[e],delete s[r],--u,a===e)){if(!u){f=0,a=1;return}for(;!Object.prototype.hasOwnProperty.call(o,++a););}},i=Math.abs(i),{hit:function(r){var e=s[r],t=++f;if(o[t]=r,s[r]=t,!e){if(++u<=i)return;return c(r=o[a]),r}if(delete o[e],a===e)for(;!Object.prototype.hasOwnProperty.call(o,++a););},delete:c,clear:function(){u=f=0,a=1,o=Object.create(null),s=Object.create(null)}})});for(var i,u,a,o,s,f,c,l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];var p=e(l);
1if(n.cache.values.has(p))return n.cache.lru.hit(p),n.cache.values.get(p);var m=r.apply(r,l);return n.cache.values.set(p,m),n.cache.values.delete(n.cache.lru.hit(p)),m}}function eW(r){return Object.keys(r.signatures||{}).reduce(function(r,e){return Math.max(r,(e.match(/,/g)||[]).length+1)},-1)}var e$=eJ(function(r){return new r(1).exp()},{hasher:e1}),eQ=eJ(function(r){return new r(1).plus(new r(5).sqrt()).div(2)},{hasher:e1}),eK=eJ(function(r){return r.acos(-1)},{hasher:e1}),e0=eJ(function(r){return eK(r).times(2)},{hasher:e1});function e1(r){return r[0].precision}var e2=Math.PI,e3=2*Math.PI,e8=Math.E,e5=(()=>!0,e9("pi",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return"BigNumber"===e.number?eK(t):e2})),e4=e9("tau",["config","?BigNumber"],r=>{var{config:e,BigNumber:t}=r;return"BigNumber"===e.number?e0(t):e3}),e7=(r=>{var{config:e,BigNumber:t}=r;return"BigNumber"===e.number?e$(t):e8},e9("i",["Complex"],r=>{var{Complex:e}=r;return e.I}));function e9(r,e,t){return ey(r,e,t,{recreateOnConfigChange:!0})}function e6(r,e,t){return ey(r,["config","Unit","BigNumber"],r=>{var{config:n,Unit:i,BigNumber:u}=r,a=new i("BigNumber"===n.number?new u(e):parseFloat(e),t);return a.fixPrefix=!0,a})}function tr(r,e){return ey(r,["config","BigNumber"],r=>{var{config:t,BigNumber:n}=r;return"BigNumber"===t.number?new n(e):e})}tr("fineStructure",.0072973525693),tr("weakMixingAngle",.2229),tr("efimovFactor",22.7),tr("sackurTetrode",-1.16487052358);var te=t(99540),tt=t.n(te),tn=ey("Fraction",[],()=>(Object.defineProperty(tt(),"name",{value:"Fraction"}),tt().prototype.constructor=tt(),tt().prototype.type="Fraction",tt().prototype.isFraction=!0,tt().prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},tt().fromJSON=function(r){return new(tt())(r)},tt()),{isClass:!0}),ti=ey("Matrix",[],()=>{function r(){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator")}return r.prototype.type="Matrix",r.prototype.isMatrix=!0,r.prototype.storage=function(){throw Error("Cannot invoke storage on a Matrix interface")},r.prototype.datatype=function(){throw Error("Cannot invoke datatype on a Matrix interface")},r.prototype.create=function(r,e){throw Error("Cannot invoke create on a Matrix interface")},r.prototype.subset=function(r,e,t){throw Error("Cannot invoke subset on a Matrix interface")},r.prototype.get=function(r){throw Error("Cannot invoke get on a Matrix interface")},r.prototype.set=function(r,e,t){throw Error("Cannot invoke set on a Matrix interface")},r.prototype.resize=function(r,e){throw Error("Cannot invoke resize on a Matrix interface")},r.prototype.reshape=function(r,e){throw Error("Cannot invoke reshape on a Matrix interface")},r.prototype.clone=function(){throw Error("Cannot invoke clone on a Matrix interface")},r.prototype.size=function(){throw Error("Cannot invoke size on a Matrix interface")},r.prototype.map=function(r,e){throw Error("Cannot invoke map on a Matrix interface")},r.prototype.forEach=function(r){throw Error("Cannot invoke forEach on a Matrix interface")},r.prototype[Symbol.iterator]=function(){throw Error("Cannot iterate a Matrix interface")},r.prototype.toArray=function(){throw Error("Cannot invoke toArray on a Matrix interface")},r.prototype.valueOf=function(){throw Error("Cannot invoke valueOf on a Matrix interface")},r.prototype.format=function(r){throw Error("Cannot invoke format on a Matrix interface")},r.prototype.toString=function(){throw Error("Cannot invoke toString on a Matrix interface")},r},{isClass:!0});function tu(r,e,t){var n=new r.constructor(2),i="";if(t){if(t<1)throw Error("size must be in greater than 0");if(!eA(t))throw Error("size must be an integer");if(r.greaterThan(n.pow(t-1).sub(1))||r.lessThan(n.pow(t-1).mul(-1)))throw Error("Value must be in range [-2^".concat(t-1,", 2^").concat(t-1,"-1]"));if(!r.isInteger())throw Error("Value must be an integer");r.lessThan(0)&&(r=r.add(n.pow(t))),i="i".concat(t)}switch(e){case 2:return"".concat(r.toBinary()).concat(i);case 8:return"".concat(r.toOctal()).concat(i);case 16:return"".concat(r.toHexadecimal()).concat(i);default:throw Error("Base ".concat(e," not supported "))}}function ta(r,e){return void 0!==e?r.toExponential(e-1):r.toExponential()}function to(r,e){return rP(r)?r:rj(r)?r.toNumber():e}function ts(r,e){var t=function(r,e){var t;if("number"==typeof r)return eB(r,e);if(rj(r))return function(r,e){if("function"==typeof e)return e(r);if(!r.isFinite())return r.isNaN()?"NaN":r.gt(0)?"Infinity":"-Infinity";var{notation:t,precision:n,wordSize:i}=eT(e);switch(t){case"fixed":return u=r,a=n,u.toFixed(a);case"exponential":return ta(r,n);case"engineering":return o=r,s=n,c=(f=o.e)%3==0?f:f<0?f-3-f%3:f-f%3,-1!==(l=o.mul(Math.pow(10,-c)).toPrecision(s)).indexOf("e")&&(l=new o.constructor(l).toFixed()),l+"e"+(f>=0?"+":"")+c.toString();case"bin":return tu(r,2,i);case"oct":return tu(r,8,i);case"hex":return tu(r,16,i);case"auto":var u,a,o,s,f,c,l,h,p=to(null==e?void 0:e.lowerExp,-3),m=to(null==e?void 0:e.upperExp,5);if(r.isZero())return"0";var v=r.toSignificantDigits(n),d=v.e;return(d>=p&&d<m?v.toFixed():ta(r,n)).replace(/((\.\d*?)(0+))($|e)/,function(){var r=arguments[2],e=arguments[4];return"."!==r?r+e:e});default:throw Error('Unknown notation "'+t+'". Choose "auto", "exponential", "fixed", "bin", "oct", or "hex.')}}(r,e);if((t=r)&&"object"==typeof t&&"number"==typeof t.s&&"number"==typeof t.n&&"number"==typeof t.d)if(!e||"decimal"!==e.fraction)return r.s*r.n+"/"+r.d;else return r.toString();if(Array.isArray(r))return function r(e,t){if(!Array.isArray(e))return ts(e,t);for(var n="[",i=e.length,u=0;u<i;u++)0!==u&&(n+=", "),n+=r(e[u],t);return n+"]"}(r,e);if(rH(r))return tf(r);if("function"==typeof r)return r.syntax?String(r.syntax):"function";if(r&&"object"==typeof r)if("function"==typeof r.format)return r.format(e);else return r&&r.toString(e)!==({}).toString()?r.toString(e):"{"+Object.keys(r).map(t=>tf(t)+": "+ts(r[t],e)).join(", ")+"}";return String(r)}(r,e);return e&&"object"==typeof e&&"truncate"in e&&t.length>e.truncate?t.substring(0,e.truncate-3)+"...":t}function tf(r){for(var e=String(r),t="",n=0;n<e.length;){var i=e.charAt(n);t+=i in tc?tc[i]:i,n++}return'"'+t+'"'}()=>{function r(e,t,n){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");var i=null!=e,u=null!=t,a=null!=n;if(i){if(rj(e))e=e.toNumber();else if("number"!=typeof e)throw TypeError("Parameter start must be a number")}if(u){if(rj(t))t=t.toNumber();else if("number"!=typeof t)throw TypeError("Parameter end must be a number")}if(a){if(rj(n))n=n.toNumber();else if("number"!=typeof n)throw TypeError("Parameter step must be a number")}this.start=i?parseFloat(e):0,this.end=u?parseFloat(t):0,this.step=a?parseFloat(n):1}return r.prototype.type="Range",r.prototype.isRange=!0,r.parse=function(e){if("string"!=typeof e)return null;var t=e.split(":").map(function(r){return parseFloat(r)});if(t.some(function(r){return isNaN(r)}))return null;switch(t.length){case 2:return new r(t[0],t[1]);case 3:return new r(t[0],t[2],t[1]);default:return null}},r.prototype.clone=function(){return new r(this.start,this.end,this.step)},r.prototype.size=function(){var r=0,e=this.start,t=this.step,n=this.end-e;return ew(t)===ew(n)?r=Math.ceil(n/t):0===n&&(r=0),isNaN(r)&&(r=0),[r]},r.prototype.min=function(){var r=this.size()[0];return r>0?this.step>0?this.start:this.start+(r-1)*this.step:void 0},r.prototype.max=function(){var r=this.size()[0];return r>0?this.step>0?this.start+(r-1)*this.step:this.start:void 0},r.prototype.forEach=function(r){var e=this.start,t=this.step,n=this.end,i=0;if(t>0)for(;e<n;)r(e,[i],this),e+=t,i++;else if(t<0)for(;e>n;)r(e,[i],this),e+=t,i++},r.prototype.map=function(r){var e=[];return this.forEach(function(t,n,i){e[n[0]]=r(t,n,i)}),e},r.prototype.toArray=function(){var r=[];return this.forEach(function(e,t){r[t[0]]=e}),r},r.prototype.valueOf=function(){return this.toArray()},r.prototype.format=function(r){var e=eB(this.start,r);return 1!==this.step&&(e+=":"+eB(this.step,r)),e+=":"+eB(this.end,r)},r.prototype.toString=function(){return this.format()},r.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},r.fromJSON=function(e){return new r(e.start,e.end,e.step)},r},()=>{function r(e){if(!(this instanceof r))throw SyntaxError("Constructor must be called with the new operator");this.entries=e||[]}return r.prototype.type="ResultSet",r.prototype.isResultSet=!0,r.prototype.valueOf=function(){return this.entries},r.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},r.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},r.fromJSON=function(e){return new r(e.entries)},r};var tc={'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"};function tl(r,e){if(!rH(r))throw TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+ep(r)+", index: 0)");if(!rH(e))throw TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+ep(e)+", index: 1)");return r===e?0:r>e?1:-1}function th(r,e,t){if(!(this instanceof th))throw SyntaxError("Constructor must be called with the new operator");this.actual=r,this.expected=e,this.relation=t,this.message="Dimension mismatch ("+(Array.isArray(r)?"["+r.join(", ")+"]":r)+" "+(this.relation||"!=")+" "+(Array.isArray(e)?"["+e.join(", ")+"]":e)+")",this.stack=Error().stack}function tp(r,e,t){if(!(this instanceof tp))throw SyntaxError("Constructor must be called with the new operator");this.index=r,arguments.length<3?(this.min=0,this.max=e):(this.min=e,this.max=t),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=Error().stack}function tm(r){for(var e=[];Array.isArray(r);)e.push(r.length),r=r[0];return e}function tv(r,e){if(0===e.length){if(Array.isArray(r))throw new th(r.length,0)}else!function r(e,t,n){var i,u=e.length;if(u!==t[n])throw new th(u,t[n]);if(n<t.length-1){var a=n+1;for(i=0;i<u;i++){if(!Array.isArray(e[i]))throw new th(t.length-1,t.length,"<");r(e[i],t,a)}}else for(i=0;i<u;i++)if(Array.isArray(e[i]))throw new th(t.length+1,t.length,">")}(r,e,0)}function td(r,e){var t=r.isMatrix?r._size:tm(r);e._sourceSize.forEach((r,e)=>{if(null!==r&&r!==t[e])throw new th(r,t[e])})}function tg(r,e){if(void 0!==r){if(!rP(r)||!eA(r))throw TypeError("Index must be an integer (value: "+r+")");if(r<0||"number"==typeof e&&r>=e)throw new tp(r,e)}}function ty(r){for(var e=0;e<r._dimensions.length;++e){var t=r._dimensions[e];
1if(t._data&&rG(t._data)){if(0===t._size[0])return!0}else if(t.isRange){if(t.start===t.end)return!0}else if(rH(t)&&0===t.length)return!0}return!1}function tb(r,e,t){if(!Array.isArray(e))throw TypeError("Array expected");if(0===e.length)throw Error("Resizing to scalar is not supported");return e.forEach(function(r){if(!rP(r)||!eA(r)||r<0)throw TypeError("Invalid size, must contain positive integers (size: "+ts(e)+")")}),(rP(r)||rj(r))&&(r=[r]),function r(e,t,n,i){var u,a,o=e.length,s=t[n],f=Math.min(o,s);if(e.length=s,n<t.length-1){var c=n+1;for(u=0;u<f;u++)Array.isArray(a=e[u])||(a=[a],e[u]=a),r(a,t,c,i);for(u=f;u<s;u++)a=[],e[u]=a,r(a,t,c,i)}else{for(u=0;u<f;u++)for(;Array.isArray(e[u]);)e[u]=e[u][0];for(u=f;u<s;u++)e[u]=i}}(r,e,0,void 0!==t?t:0),r}function tD(r,e){var t=tN(r),n=t.length;if(!Array.isArray(r)||!Array.isArray(e))throw TypeError("Array expected");if(0===e.length)throw new th(0,n,"!=");var i=tE(e=tx(e,n));if(n!==i)throw new th(i,n,"!=");try{return function(r,e){for(var t,n=r,i=e.length-1;i>0;i--){var u=e[i];t=[];for(var a=n.length/u,o=0;o<a;o++)t.push(n.slice(o*u,(o+1)*u));n=t}return n}(t,e)}catch(r){if(r instanceof th)throw new th(i,n,"!=");throw r}}function tx(r,e){var t=tE(r),n=r.slice(),i=r.indexOf(-1);if(r.indexOf(-1,i+1)>=0)throw Error("More than one wildcard in sizes");if(i>=0)if(e%t==0)n[i]=-e/t;else throw Error("Could not replace wildcard, since "+e+" is no multiple of "+-t);return n}function tE(r){return r.reduce((r,e)=>r*e,1)}function tA(r,e){for(var t=e||tm(r);Array.isArray(r)&&1===r.length;)r=r[0],t.shift();for(var n=t.length;1===t[n-1];)n--;return n<t.length&&(r=function r(e,t,n){var i,u;if(n<t){var a=n+1;for(i=0,u=e.length;i<u;i++)e[i]=r(e[i],t,a)}else for(;Array.isArray(e);)e=e[0];return e}(r,n,0),t.length=n),r}function tw(r,e,t,n){var i=n||tm(r);if(t)for(var u=0;u<t;u++)r=[r],i.unshift(1);for(r=function r(e,t,n){var i,u;if(Array.isArray(e)){var a=n+1;for(i=0,u=e.length;i<u;i++)e[i]=r(e[i],t,a)}else for(var o=n;o<t;o++)e=[e];return e}(r,e,0);i.length<e;)i.push(1);return r}function tN(r){if(!Array.isArray(r))return r;var e=[];return r.forEach(function r(t){Array.isArray(t)?t.forEach(r):e.push(t)}),e}function tM(r,e){if(1!==tm(r).length)throw Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,r=>e.test(r))}function tC(r){if(!Array.isArray(r))throw TypeError("Array input expected");if(0===r.length)return r;var e=[],t=0;e[0]={value:r[0],identifier:0};for(var n=1;n<r.length;n++)r[n]===r[n-1]?t++:t=0,e.push({value:r[n],identifier:t});return e}function tF(r){if(!Array.isArray(r))throw TypeError("Array input expected");if(0===r.length)return r;for(var e=[],t=0;t<r.length;t++)e.push(r[t].value);return e}function tS(r,e){for(var t,n=0,i=0;i<r.length;i++){var u=r[i],a=Array.isArray(u);if(0===i&&a&&(n=u.length),a&&u.length!==n)return;var o=a?tS(u,e):e(u);if(void 0===t)t=o;else if(t!==o)return"mixed"}return t}function t_(){var r=Array.prototype.slice.call(arguments,0,-1),e=Array.prototype.slice.call(arguments,-1);if(1===r.length)return r[0];if(r.length>1)return r.slice(1).reduce(function(r,t){return function r(e,t,n,i){if(!(i<n))return e.concat(t);if(e.length!==t.length)throw new th(e.length,t.length);for(var u=[],a=0;a<e.length;a++)u[a]=r(e[a],t[a],n,i+1);return u}(r,t,e,0)},r[0]);throw Error("Wrong number of arguments in function concat")}th.prototype=RangeError(),th.prototype.constructor=RangeError,th.prototype.name="DimensionError",th.prototype.isDimensionError=!0,tp.prototype=RangeError(),tp.prototype.constructor=RangeError,tp.prototype.name="IndexError",tp.prototype.isIndexError=!0;function tB(r,e){for(var t=e.length,n=r.length,i=0;i<n;i++){var u=t-n+i;if(r[i]<e[u]&&r[i]>1||r[i]>e[u])throw Error("shape missmatch: missmatch is found in arg with shape (".concat(r,") not possible to broadcast dimension ").concat(n," with size ").concat(r[i]," to size ").concat(e[u]))}}function tT(r,e){var t,i,u,a,o=tm(r);if(ed(o,e))return r;tB(o,e);var s=function(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var n=e.map(r=>r.length),i=Math.max(...n),u=Array(i).fill(null),a=0;a<e.length;a++)for(var o=e[a],s=n[a],f=0;f<s;f++){var c=i-s+f;o[f]>u[c]&&(u[c]=o[f])}for(var l=0;l<e.length;l++)tB(e[l],u);return u}(o,e),f=s.length,c=[...Array(f-o.length).fill(1),...o],l=(t=r,(0,n.A)([],t));o.length<f&&(o=tm(l=tD(l,c)));for(var h=0;h<f;h++){o[h]<s[h]&&(o=tm((i=l,u=s[h],a=h,l=t_(...Array(u).fill(i),a))))}return l}
1var tO=ey("DenseMatrix",["Matrix"],r=>{var{Matrix:e}=r;function t(r,e){if(!(this instanceof t))throw SyntaxError("Constructor must be called with the new operator");if(e&&!rH(e))throw Error("Invalid datatype: "+e);if(rV(r))"DenseMatrix"===r.type?(this._data=em(r._data),this._size=em(r._size)):(this._data=r.toArray(),this._size=r.size()),this._datatype=e||r._datatype;else if(r&&rG(r.data)&&rG(r.size))this._data=r.data,this._size=r.size,tv(this._data,this._size),this._datatype=e||r.datatype;else if(rG(r))this._data=function r(e){return rV(e)?r(e.valueOf()):rG(e)?e.map(r):e}(r),this._size=tm(this._data),tv(this._data,this._size),this._datatype=e;else if(r)throw TypeError("Unsupported type of data ("+ep(r)+")");else this._data=[],this._size=[0],this._datatype=e}function n(r,e,t){if(0===e.length){for(var n=r._data;rG(n);)n=n[0];return n}return r._size=e.slice(0),r._data=tb(r._data,r._size,t),r}function i(r,e,t){for(var i=r._size.slice(0),u=!1;i.length<e.length;)i.push(0),u=!0;for(var a=0,o=e.length;a<o;a++)e[a]>i[a]&&(i[a]=e[a],u=!0);u&&n(r,i,t)}return t.prototype=new e,t.prototype.createDenseMatrix=function(r,e){return new t(r,e)},Object.defineProperty(t,"name",{value:"DenseMatrix"}),t.prototype.constructor=t,t.prototype.type="DenseMatrix",t.prototype.isDenseMatrix=!0,t.prototype.getDataType=function(){return tS(this._data,ep)},t.prototype.storage=function(){return"dense"},t.prototype.datatype=function(){return this._datatype},t.prototype.create=function(r,e){return new t(r,e)},t.prototype.subset=function(r,e,n){switch(arguments.length){case 1:return function(r,e){if(!rW(e))throw TypeError("Invalid index");if(e.isScalar())return r.get(e.min());var n=e.size();if(n.length!==r._size.length)throw new th(n.length,r._size.length);for(var i=e.min(),u=e.max(),a=0,o=r._size.length;a<o;a++)tg(i[a],r._size[a]),tg(u[a],r._size[a]);return new t(function r(e,t,n,i){var u=i===n-1,a=t.dimension(i);return u?a.map(function(r){return tg(r,e.length),e[r]}).valueOf():a.map(function(u){return tg(u,e.length),r(e[u],t,n,i+1)}).valueOf()}(r._data,e,n.length,0),r._datatype)}(this,r);case 2:case 3:return function(r,e,t,n){if(!e||!0!==e.isIndex)throw TypeError("Invalid index");var u,a=e.size(),o=e.isScalar();if(rV(t)?(u=t.size(),t=t.valueOf()):u=tm(t),o){if(0!==u.length)throw TypeError("Scalar expected");r.set(e.min(),t,n)}else{if(!ed(u,a))try{t=0===u.length?tT([t],a):tT(t,a),u=tm(t)}catch(r){}if(a.length<r._size.length)throw new th(a.length,r._size.length,"<");if(u.length<a.length){for(var s=0,f=0;1===a[s]&&1===u[s];)s++;for(;1===a[s];)f++,s++;t=tw(t,a.length,f,u)}if(!ed(a,u))throw new th(a,u,">");i(r,e.max().map(function(r){return r+1}),n);var c=a.length;!function r(e,t,n,i,u){var a=u===i-1,o=t.dimension(u);a?o.forEach(function(r,t){tg(r),e[r]=n[t[0]]}):o.forEach(function(a,o){tg(a),r(e[a],t,n[o[0]],i,u+1)})}(r._data,e,t,c,0)}return r}(this,r,e,n);default:throw SyntaxError("Wrong number of arguments")}},t.prototype.get=function(r){if(!rG(r))throw TypeError("Array expected");if(r.length!==this._size.length)throw new th(r.length,this._size.length);for(var e=0;e<r.length;e++)tg(r[e],this._size[e]);for(var t=this._data,n=0,i=r.length;n<i;n++){var u=r[n];tg(u,t.length),t=t[u]}return t},t.prototype.set=function(r,e,t){if(!rG(r))throw TypeError("Array expected");if(r.length<this._size.length)throw new th(r.length,this._size.length,"<");i(this,r.map(function(r){return r+1}),t);var n,u,a,o=this._data;for(n=0,u=r.length-1;n<u;n++)tg(a=r[n],o.length),o=o[a];return tg(a=r[r.length-1],o.length),o[a]=e,this},t.prototype.resize=function(r,e,t){if(!rZ(r))throw TypeError("Array or Matrix expected");var i=r.valueOf().map(r=>Array.isArray(r)&&1===r.length?r[0]:r);return n(t?this.clone():this,i,e)},t.prototype.reshape=function(r,e){var t=e?this.clone():this;t._data=tD(t._data,r);var n=t._size.reduce((r,e)=>r*e);return t._size=tx(r,n),t},t.prototype.clone=function(){return new t({data:em(this._data),size:em(this._size),datatype:this._datatype})},t.prototype.size=function(){return this._size.slice(0)},t.prototype.map=function(r){var e=this,n=eW(r),i=function t(i,u){return rG(i)?i.map(function(r,e){return t(r,u.concat(e))}):1===n?r(i):2===n?r(i,u):r(i,u,e)}(this._data,[]),u=void 0!==this._datatype?tS(i,ep):void 0;return new t(i,u)},t.prototype.forEach=function(r){var e=this;
1!function t(n,i){rG(n)?n.forEach(function(r,e){t(r,i.concat(e))}):r(n,i,e)}(this._data,[])},t.prototype[Symbol.iterator]=function*(){var r=function* r(e,t){if(rG(e))for(var n=0;n<e.length;n++)yield*r(e[n],t.concat(n));else yield{value:e,index:t}};yield*r(this._data,[])},t.prototype.rows=function(){var r=[];if(2!==this.size().length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var e of this._data)r.push(new t([e],this._datatype));return r},t.prototype.columns=function(){var r=this,e=[],n=this.size();if(2!==n.length)throw TypeError("Rows can only be returned for a 2D matrix.");for(var i=this._data,u=function(n){var u=i.map(r=>[r[n]]);e.push(new t(u,r._datatype))},a=0;a<n[1];a++)u(a);return e},t.prototype.toArray=function(){return em(this._data)},t.prototype.valueOf=function(){return this._data},t.prototype.format=function(r){return ts(this._data,r)},t.prototype.toString=function(){return ts(this._data)},t.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},t.prototype.diagonal=function(r){if(r){if(rj(r)&&(r=r.toNumber()),!rP(r)||!eA(r))throw TypeError("The parameter k must be an integer number")}else r=0;for(var e=r>0?r:0,n=r<0?-r:0,i=Math.min(this._size[0]-n,this._size[1]-e),u=[],a=0;a<i;a++)u[a]=this._data[a+n][a+e];return new t({data:u,size:[i],datatype:this._datatype})},t.diagonal=function(r,e,n,i){if(!rG(r))throw TypeError("Array expected, size parameter");if(2!==r.length)throw Error("Only two dimensions matrix are supported");if(r=r.map(function(r){if(rj(r)&&(r=r.toNumber()),!rP(r)||!eA(r)||r<1)throw Error("Size values must be positive integers");return r}),n){if(rj(n)&&(n=n.toNumber()),!rP(n)||!eA(n))throw TypeError("The parameter k must be an integer number")}else n=0;var u,a=n>0?n:0,o=n<0?-n:0,s=r[0],f=r[1],c=Math.min(s-o,f-a);if(rG(e)){if(e.length!==c)throw Error("Invalid value array length");u=function(r){return e[r]}}else if(rV(e)){var l=e.size();if(1!==l.length||l[0]!==c)throw Error("Invalid matrix length");u=function(r){return e.get([r])}}else u=function(){return e};i||(i=rj(u(0))?u(0).mul(0):0);var h=[];if(r.length>0){h=tb(h,r,i);for(var p=0;p<c;p++)h[p+o][p+a]=u(p)}return new t({data:h,size:[s,f]})},t.fromJSON=function(r){return new t(r)},t.prototype.swapRows=function(r,e){if(!rP(r)||!eA(r)||!rP(e)||!eA(e))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return tg(r,this._size[0]),tg(e,this._size[0]),t._swapRows(r,e,this._data),this},t._swapRows=function(r,e,t){var n=t[r];t[r]=t[e],t[e]=n},t},{isClass:!0}),tz=(()=>function(r,e){return"number"==typeof e&&(!isFinite(e)||isNaN(e))?{mathjs:"number",value:String(e)}:e},t(9581)),tI=t.n(tz);function tR(r,e){if(tj(r)&&tP(r,e))return r[e];if("function"==typeof r[e]&&function(r,e){return!(null==r||"function"!=typeof r[e]||eg(r,e)&&Object.getPrototypeOf&&e in Object.getPrototypeOf(r))&&(!!eg(tq,e)||!(e in Object.prototype)&&!(e in Function.prototype))}(r,e))throw Error('Cannot access method "'+e+'" as a property');throw Error('No access to property "'+e+'"')}function tU(r,e,t){if(tj(r)&&tP(r,e))return r[e]=t,t;throw Error('No access to property "'+e+'"')}function tP(r,e){return!!r&&"object"==typeof r&&(!!eg(tk,e)||!(e in Object.prototype)&&!(e in Function.prototype))}function tj(r){return"object"==typeof r&&r&&r.constructor===Object}var tk={length:!0,name:!0},tq={toString:!0,valueOf:!0,toLocaleString:!0};class tL{constructor(r){this.wrappedObject=r,this[Symbol.iterator]=this.entries}keys(){return Object.keys(this.wrappedObject).values()}get(r){return tR(this.wrappedObject,r)}set(r,e){return tU(this.wrappedObject,r,e),this}has(r){return r in this.wrappedObject}entries(){var r,e;return r=this.keys(),e=r=>[r,this.get(r)],{next:()=>{var t=r.next();return t.done?t:{value:e(t.value),done:!1}}}}forEach(r){for(var e of this.keys())r(this.get(e),e,this)}delete(r){delete this.wrappedObject[r]}clear(){for(var r of this.keys())this.delete(r)}get size(){return Object.keys(this.wrappedObject).length}}function tH(r){return!!r&&(r instanceof Map||r instanceof tL||"function"==typeof r.set&&"function"==typeof r.get&&"function"==typeof r.keys&&"function"==typeof r.has)}var tG=function(){return tG=tI().create,tI()},tV=ey("typed",["?BigNumber","?Complex","?DenseMatrix","?Fraction"],function(r){var{BigNumber:e,Complex:t,DenseMatrix:n,Fraction:i}=r,u=tG();return u.clear(),u.addTypes([{name:"number",test:rP},{name:"Complex",test:rk},{name:"BigNumber",test:rj},{name:"Fraction",test:rq},{name:"Unit",test:rL},{name:"identifier",test:r=>rH
vendor: 16,030 bytes, line 1
1&&/^(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])(?:[0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDF70-\uDF81\uDFB0-\uDFC4\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE3F\uDE40\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2\uDF02\uDF04-\uDF10\uDF12-\uDF33\uDFB0]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2F\uDC41-\uDC46]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE70-\uDEBE\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD32\uDD50-\uDD52\uDD55\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]|\uD838[\uDC30-\uDC6D\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB]|\uD839[\uDCD0-\uDCEB\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF])*$/.test(
1r)},{name:"string",test:rH},{name:"Chain",test:eh},{name:"Array",test:rG},{name:"Matrix",test:rV},{name:"DenseMatrix",test:rY},{name:"SparseMatrix",test:rX},{name:"Range",test:rJ},{name:"Index",test:rW},{name:"boolean",test:r$},{name:"ResultSet",test:rQ},{name:"Help",test:rK},{name:"function",test:r0},{name:"Date",test:r1},{name:"RegExp",test:r2},{name:"null",test:r8},{name:"undefined",test:r5}
1,{name:"AccessorNode",test:r4},{name:"ArrayNode",test:r7},{name:"AssignmentNode",test:r9},{name:"BlockNode",test:r6},{name:"ConditionalNode",test:er},{name:"ConstantNode",test:ee},{name:"FunctionNode",test:en},{name:"FunctionAssignmentNode",test:et},{name:"IndexNode",test:ei},{name:"Node",test:eu},{name:"ObjectNode",test:ea},{name:"OperatorNode",test:eo},{name:"ParenthesisNode",test:es},{name:"RangeNode",test:ef},{name:"RelationalNode",test:ec},{name:"SymbolNode",test:el},{name:"Map",test:tH},{name:"Object",test:r3}]),u.addConversions([{from:"number",to:"BigNumber",convert:function(r){if(e||tZ(r),r.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length>15)throw TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+r+"). Use function bignumber(x) to convert to BigNumber.");return new e(r)}},{from:"number",to:"Complex",convert:function(r){return t||tY(r),new t(r,0)}},{from:"BigNumber",to:"Complex",convert:function(r){return t||tY(r),new t(r.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(r){throw TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(r){return t||tY(r),new t(r.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(r){i||tX(r);var e=new i(r);if(e.valueOf()!==r)throw TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+r+"). Use function fraction(x) to convert to Fraction.");return e}},{from:"string",to:"number",convert:function(r){var e=Number(r);if(isNaN(e))throw Error('Cannot convert "'+r+'" to a number');return e}},{from:"string",to:"BigNumber",convert:function(r){e||tZ(r);try{return new e(r)}catch(e){throw Error('Cannot convert "'+r+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(r){i||tX(r);try{return new i(r)}catch(e){throw Error('Cannot convert "'+r+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(r){t||tY(r);try{return new t(r)}catch(e){throw Error('Cannot convert "'+r+'" to Complex')}}},{from:"boolean",to:"number",convert:function(r){return+r}},{from:"boolean",to:"BigNumber",convert:function(r){return e||tZ(r),new e(+r)}},{from:"boolean",to:"Fraction",convert:function(r){return i||tX(r),new i(+r)}},{from:"boolean",to:"string",convert:function(r){return String(r)}},{from:"Array",to:"Matrix",convert:function(r){return n||function(){throw Error("Cannot convert array into a Matrix: no class 'DenseMatrix' provided")}(),new n(r)}},{from:"Matrix",to:"Array",convert:function(r){return r.valueOf()}}]),u.onMismatch=(r,e,t)=>{var n=u.createError(r,e,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===e.length&&rZ(e[0])&&t.some(r=>!r.params.includes(","))){var i=TypeError("Function '".concat(r,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(r,")'."));throw i.data=n.data,i}throw n},u.onMismatch=(r,e,t)=>{var n=u.createError(r,e,t);if(["wrongType","mismatch"].includes(n.data.category)&&1===e.length&&rZ(e[0])&&t.some(r=>!r.params.includes(","))){var i=TypeError("Function '".concat(r,"' doesn't apply to matrices. To call it ")+"elementwise on a matrix 'M', try 'map(M, ".concat(r,")'."));throw i.data=n.data,i}throw n},u});function tZ(r){throw Error("Cannot convert value ".concat(r," into a BigNumber: no class 'BigNumber' provided"))}function tY(r){throw Error("Cannot convert value ".concat(r," into a Complex number: no class 'Complex' provided"))}function tX(r){throw Error("Cannot convert value ".concat(r," into a Fraction, no class 'Fraction' provided."))}function tJ(r){var e,t,n=r.length,i=r[0].length,u=[];for(t=0;t<i;t++){var a=[];for(e=0;e<n;e++)a.push(r[e][t]);u.push(a)}return u}function tW(r){for(var e=0;e<r.length;e++)if(rZ(r[e]))return!0;return!1}function t$(r,e){rV(r)&&(r=r.valueOf());for(var t=0,n=r.length;t<n;t++){var i=r[t];Array.isArray(i)?t$(i,e):e(i)}}function tQ(r,e,t){return r&&"function"==typeof r.map?r.map(function(r){return tQ(r,e,t)}):e(r)}function tK(r,e,t){var n=Array.isArray(r)?tm(r):r.size();if(e<0||e>=n.length)throw new tp(e,n.length);return rV(r)?r.create(t0(r.valueOf(),e,t)):t0(r,e,t)}function t0(r,e,t){var n,i,u,a;if(e<=0)if(Array.isArray(r[0])){for(n=0,a=tJ(r),i=[];n<a.length;n++)i[n]=t0(a[n],e-1,t);return i}else{for(n=1,u=r[0];n<r.length;n++)u=t(u,r[n]);return u}for(n=0,i=[];n<r.length;n++)i[n]=t0(r[n],e-1,t);return i}function t1(r,e,t,n,i,u,a,o,s,f,c){var l,h,p,m,v=r._values,d=r._index,g=r._ptr;if(n)for(h=g[e],p=g[e+1],l=h;l<p;l++)t[m=d[l]]!==u?(t[m]=u,a.push(m),f?(n[m]=s?o(v[l],c):o(c,v[l]),i[m]=u):n[m]=v[l]):(n[m]=s?o(v[l],n[m]):o(n[m],v[l]),i[m]=u);else for(h=g[e],p=g[e+1],l=h;l<p;l++)t[m=d[l]]!==u?(t[m]=u,a.push(m)):i[m]=u}
1var t2="number",t3="number, number";function t8(r){return Math.abs(r)}function t5(r,e){return r+e}function t4(r,e){return r-e}function t7(r,e){return r*e}function t9(r){return-r}function t6(r){return r}function nr(r){return eF(r)}function ne(r){return r*r*r}function nt(r){return Math.exp(r)}function nn(r){return eS(r)}function ni(r,e){if(!eA(r)||!eA(e))throw Error("Parameters in function lcm must be integer numbers");if(0===r||0===e)return 0;for(var t,n=r*e;0!==e;)e=r%(t=e),r=t;return Math.abs(n/r)}t8.signature=t2,t5.signature=t3,t4.signature=t3,t7.signature=t3,t9.signature=t2,t6.signature=t2,nr.signature=t2,ne.signature=t2,nt.signature=t2,nn.signature=t2,ni.signature=t3;function nu(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,t=e<0;if(t&&(e=-e),0===e)throw Error("Root must be non-zero");if(r<0&&Math.abs(e)%2!=1)throw Error("Root must be odd when a is negative.");if(0===r)return t?1/0:0;if(!isFinite(r))return t?0:r;var n=Math.pow(Math.abs(r),1/e);return n=r<0?-n:n,t?1/n:n}function na(r){return ew(r)}function no(r){return r*r}function ns(r,e){var t,n,i,u,a=0,o=1,s=1,f=0;if(!eA(r)||!eA(e))throw Error("Parameters in function xgcd must be integer numbers");for(;e;)n=Math.floor(r/e),i=r-n*e,t=a,a=o-n*a,o=t,t=s,s=f-n*s,f=t,r=e,e=i;return r<0?[-r,-o,-f]:[r,r?o:0,f]}function nf(r,e){return r*r<1&&e===1/0||r*r>1&&e===-1/0?0:Math.pow(r,e)}function nc(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!eA(e)||e<0||e>15)throw Error("Number of decimals in function round must be an integer from 0 to 15 inclusive");return parseFloat(ez(r,e))}na.signature=t2,no.signature=t2,ns.signature=t3,nf.signature=t3;var nl="unaryPlus",nh=ey(nl,["typed","config","BigNumber"],r=>{var{typed:e,config:t,BigNumber:n}=r;return e(nl,{number:t6,Complex:function(r){return r},BigNumber:function(r){return r},Fraction:function(r){return r},Unit:function(r){return r.clone()},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0)),"boolean | string":function(r){return"BigNumber"===t.number?new n(+r):+r}})}),np=ey("abs",["typed"],r=>{var{typed:e}=r;return e("abs",{number:t8,"Complex | BigNumber | Fraction | Unit":r=>r.abs(),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0))})}),nm="acos",nv=(r=>{var{typed:e,config:t,Complex:n}=r;return e(nm,{number:function(r){return r>=-1&&r<=1||t.predictable?Math.acos(r):new n(r,0).acos()},Complex:function(r){return r.acos()},BigNumber:function(r){return r.acos()}})},"number");function nd(r){return Math.atan(1/r)}function ng(r){return isFinite(r)?(Math.log((r+1)/r)+Math.log(r/(r-1)))/2:0}function ny(r){return Math.asin(1/r)}function nb(r){var e=1/r;return Math.log(e+Math.sqrt(e*e+1))}function nD(r){return Math.acos(1/r)}function nx(r){var e=1/r;return Math.log(Math.sqrt(e*e-1)+e)}function nE(r){return eq(r)}nd.signature=nv,ng.signature=nv,ny.signature=nv,nb.signature=nv,nD.signature=nv,nx.signature=nv,nE.signature=nv;function nA(r){return 1/Math.tan(r)}function nw(r){var e=Math.exp(2*r);return(e+1)/(e-1)}function nN(r){return 1/Math.sin(r)}function nM(r){return 0===r?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(r)-Math.exp(-r)))*ew(r)}function nC(r){return 1/Math.cos(r)}function nF(r){return 2/(Math.exp(r)+Math.exp(-r))}function nS(r){return eG(r)}nA.signature=nv,nw.signature=nv,nN.signature=nv,nM.signature=nv,nC.signature=nv,nF.signature=nv,nS.signature=nv;var n_="acot",nB=(r=>{var{typed:e,BigNumber:t}=r;return e(n_,{number:nd,Complex:function(r){return r.acot()},BigNumber:function(r){return new t(1).div(r).atan()}})},"acsc"),nT=(r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(nB,{number:function(r){return r<=-1||r>=1||t.predictable?ny(r):new n(r,0).acsc()},Complex:function(r){return r.acsc()},BigNumber:function(r){return new i(1).div(r).asin()}})},"addScalar"),nO=ey(nT,["typed"],r=>{var{typed:e}=r;return e(nT,{"number, number":t5,"Complex, Complex":function(r,e){return r.add(e)},"BigNumber, BigNumber":function(r,e){return r.plus(e)},"Fraction, Fraction":function(r,e){return r.add(e)},"Unit, Unit":e.referToSelf(r=>(t,n)=>{if(null===t.value||void 0===t.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw Error("Units do not match");var i=t.clone();
1return i.value=e.find(r,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),nz=(r=>{var{typed:e}=r;return e("arg",{number:function(r){return Math.atan2(0,r)},BigNumber:function(r){return r.constructor.atan2(0,r)},Complex:function(r){return r.arg()},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})},"asech"),nI=(r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(nz,{number:function(r){if(r<=1&&r>=-1||t.predictable){var e=1/r;return e>0||t.predictable?nx(r):new n(Math.log(Math.sqrt(e*e-1)-e),Math.PI)}return new n(r,0).asech()},Complex:function(r){return r.asech()},BigNumber:function(r){return new i(1).div(r).acosh()}})},ey("atan",["typed"],r=>{var{typed:e}=r;return e("atan",{number:function(r){return Math.atan(r)},Complex:function(r){return r.atan()},BigNumber:function(r){return r.atan()}})})),nR="atanh",nU=(r=>{var{typed:e,config:t,Complex:n}=r;return e(nR,{number:function(r){return r<=1&&r>=-1||t.predictable?eL(r):new n(r,0).atanh()},Complex:function(r){return r.atanh()},BigNumber:function(r){return r.atanh()}})},ey("bignumber",["typed","BigNumber"],r=>{var{typed:e,BigNumber:t}=r;return e("bignumber",{"":function(){return new t(0)},number:function(r){return new t(r+"")},string:function(r){var e=r.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);if(e){var n=e[2],i=t(e[1]),u=new t(2).pow(Number(n));if(i.gt(u.sub(1)))throw SyntaxError('String "'.concat(r,'" is out of range'));var a=new t(2).pow(Number(n)-1);return i.gte(a)?i.sub(u):i}return new t(r)},BigNumber:function(r){return r},Unit:e.referToSelf(r=>e=>{var t=e.clone();return t.value=r(e.value),t}),Fraction:function(r){return new t(r.n).div(r.d).times(r.s)},null:function(r){return new t(0)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}));function nP(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw Error("Integers expected in function bitAnd");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero()||e.eq(-1)||r.eq(e))return r;if(e.isZero()||r.eq(-1))return e;if(!r.isFinite()||!e.isFinite()){if(!r.isFinite()&&!e.isFinite())return r.isNegative()===e.isNegative()?r:new t(0);if(!r.isFinite())return e.isNegative()?r:r.isNegative()?new t(0):e;if(!e.isFinite())return r.isNegative()?e:e.isNegative()?new t(0):r}return nq(r,e,function(r,e){return r&e})}function nj(r){if(r.isFinite()&&!r.isInteger())throw Error("Integer expected in function bitNot");var e=r.constructor,t=e.precision;e.config({precision:1e9});var n=r.plus(new e(1));return n.s=-n.s||null,e.config({precision:t}),n}function nk(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw Error("Integers expected in function bitOr");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);var n=new t(-1);return r.isZero()||e.eq(n)||r.eq(e)?e:e.isZero()||r.eq(n)?r:r.isFinite()&&e.isFinite()?nq(r,e,function(r,e){return r|e}):!r.isFinite()&&!r.isNegative()&&e.isNegative()||r.isNegative()&&!e.isNegative()&&!e.isFinite()?n:r.isNegative()&&e.isNegative()?r.isFinite()?r:e:r.isFinite()?e:r}function nq(r,e,t){var n,i,u,a,o,s=r.constructor,f=+(r.s<0),c=+(e.s<0);if(f){n=nL(nj(r));for(var l=0;l<n.length;++l)n[l]^=1}else n=nL(r);if(c){i=nL(nj(e));for(var h=0;h<i.length;++h)i[h]^=1}else i=nL(e);n.length<=i.length?(u=n,a=i,o=f):(u=i,a=n,o=c);var p=u.length,m=a.length,v=1^t(f,c),d=new s(1^v),g=new s(1),y=new s(2),b=s.precision;for(s.config({precision:1e9});p>0;)t(u[--p],a[--m])===v&&(d=d.plus(g)),g=g.times(y);for(;m>0;)t(o,a[--m])===v&&(d=d.plus(g)),g=g.times(y);return s.config({precision:b}),0===v&&(d.s=-d.s),d}function nL(r){for(var e=r.d,t=e[0]+"",n=1;n<e.length;++n){for(var i=e[n]+"",u=7-i.length;u--;)i="0"+i;t+=i}for(var a=t.length;"0"===t.charAt(a);)a--;var o=r.e,s=t.slice(0,a+1||1),f=s.length;if(o>0)if(++o>f)for(o-=f;o--;)s+="0";else o<f&&(s=s.slice(0,o)+"."+s.slice(o));for(var c=[0],l=0;l<s.length;){for(var h=c.length;h--;)c[h]*=10;c[0]+=parseInt(s.charAt(l++));for(var p=0;p<c.length;++p)c[p]>1&&((null===c[p+1]||void 0===c[p+1])&&(c[p+1]=0),c[p+1]+=c[p]>>1,c[p]&=1)}return c.reverse()}function nH(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw Error("Integers expected in function bitXor");var t=r.constructor;if(r.isNaN()||e.isNaN())return new t(NaN);if(r.isZero())return e;if(e.isZero())return r;if(r.eq(e))return new t(0);var n=new t(-1);
1return r.eq(n)?nj(e):e.eq(n)?nj(r):r.isFinite()&&e.isFinite()?nq(r,e,function(r,e){return r^e}):r.isFinite()||e.isFinite()?new t(r.isNegative()===e.isNegative()?1/0:-1/0):n}function nG(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw Error("Integers expected in function leftShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:r.isFinite()||e.isFinite()?e.lt(55)?r.times(Math.pow(2,e.toNumber())+""):r.times(new t(2).pow(e)):new t(NaN)}function nV(r,e){if(r.isFinite()&&!r.isInteger()||e.isFinite()&&!e.isInteger())throw Error("Integers expected in function rightArithShift");var t=r.constructor;return r.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):r.isZero()||e.isZero()?r:e.isFinite()?e.lt(55)?r.div(Math.pow(2,e.toNumber())+"").floor():r.div(new t(2).pow(e)).floor():new t(r.isNegative()?-1:r.isFinite()?0:NaN)}var nZ="number, number";function nY(r,e){if(!eA(r)||!eA(e))throw Error("Integers expected in function bitAnd");return r&e}function nX(r){if(!eA(r))throw Error("Integer expected in function bitNot");return~r}function nJ(r,e){if(!eA(r)||!eA(e))throw Error("Integers expected in function bitOr");return r|e}function nW(r,e){if(!eA(r)||!eA(e))throw Error("Integers expected in function bitXor");return r^e}function n$(r,e){if(!eA(r)||!eA(e))throw Error("Integers expected in function leftShift");return r<<e}function nQ(r,e){if(!eA(r)||!eA(e))throw Error("Integers expected in function rightArithShift");return r>>e}function nK(r,e){if(!eA(r)||!eA(e))throw Error("Integers expected in function rightLogShift");return r>>>e}nY.signature=nZ,nX.signature="number",nJ.signature=nZ,nW.signature=nZ,n$.signature=nZ,nQ.signature=nZ,nK.signature=nZ;var n0="bitNot",n1=(r=>{var{typed:e}=r;return e(n0,{number:nX,BigNumber:nj,"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})},"boolean"),n2=(r=>{var{typed:e}=r;return e(n1,{"":function(){return!1},boolean:function(r){return r},number:function(r){return!!r},null:function(r){return!1},BigNumber:function(r){return!r.isZero()},string:function(r){var e=r.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;var t=Number(r);
1if(""!==r&&!isNaN(t))return!!t;throw Error('Cannot convert "'+r+'" to a boolean')},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})},"clone");function n3(r,e){if(e<r)return 1;if(e===r)return e;var t=e+r>>1;return n3(r,t)*n3(t+1,e)}function n8(r,e){if(!eA(r)||r<0||!eA(e)||e<0)throw TypeError("Positive integer value expected in function combinations");if(e>r)throw TypeError("k must be less than or equal to n");for(var t=r-e,n=1,i=e<t?t+1:e+1,u=2,a=e<t?e:t,o=i;o<=r;++o)for(n*=o;u<=a&&n%u==0;)n/=u,++u;return u<=a&&(n/=n3(u,a)),n}r=>{var{typed:e}=r;return e(n2,{any:em})},n8.signature="number, number";var n5="combinations",n4=ey(n5,["typed"],r=>{var{typed:e}=r;return e(n5,{"number, number":n8,"BigNumber, BigNumber":function(r,e){var t,n,i=r.constructor,u=r.minus(e),a=new i(1);if(!n7(r)||!n7(e))throw TypeError("Positive integer value expected in function combinations");if(e.gt(r))throw TypeError("k must be less than n in function combinations");if(t=a,e.lt(u))for(n=a;n.lte(u);n=n.plus(a))t=t.times(e.plus(n)).dividedBy(n);else for(n=a;n.lte(e);n=n.plus(a))t=t.times(u.plus(n)).dividedBy(n);return t}})});function n7(r){return r.isInteger()&&r.gte(0)}var n9=ey("complex",["typed","Complex"],r=>{var{typed:e,Complex:t}=r;return e("complex",{"":function(){return t.ZERO},number:function(r){return new t(r,0)},"number, number":function(r,e){return new t(r,e)},"BigNumber, BigNumber":function(r,e){return new t(r.toNumber(),e.toNumber())},Fraction:function(r){return new t(r.valueOf(),0)},Complex:function(r){return r.clone()},string:function(r){return t(r)},null:function(r){return t(0)},Object:function(r){if("re"in r&&"im"in r)return new t(r.re,r.im);if("r"in r&&"phi"in r||"abs"in r&&"arg"in r)return new t(r);throw Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}),n6="conj",ir=ey(n6,["typed"],r=>{var{typed:e}=r;return e(n6,{"number | BigNumber | Fraction":r=>r,Complex:r=>r.conjugate(),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}),ie=ey("trigUnit",["typed"],r=>{var{typed:e}=r;return{Unit:e.referToSelf(r=>t=>{if(!t.hasBase(t.constructor.BASE_UNITS.ANGLE))throw TypeError("Unit in function cot is no angle");return e.find(r,t.valueType())(t.value)})}}),it=ey("cos",["typed"],r=>{var{typed:e}=r,t=ie({typed:e});return e("cos",{number:Math.cos,"Complex | BigNumber":r=>r.cos()},t)}),ii=(r=>{var{typed:e,BigNumber:t}=r,n=ie({typed:e});return e("cot",{number:nA,Complex:r=>r.cot(),BigNumber:r=>new t(1).div(r.tan())},n)},"cube");function iu(r,e,t){if(null==t)return r.eq(e);
1if(r.eq(e))return!0;if(r.isNaN()||e.isNaN())return!1;if(r.isFinite()&&e.isFinite()){var n=r.minus(e).abs();if(n.isZero())return!0;var i=r.constructor.max(r.abs(),e.abs());return n.lte(i.times(t))}return!1}r=>{var{typed:e}=r;return e(ii,{number:ne,Complex:function(r){return r.mul(r).mul(r)},BigNumber:function(r){return r.times(r).times(r)},Fraction:function(r){return r.pow(3)},Unit:function(r){return r.pow(3)}})};var ia=ey("compareUnits",["typed"],r=>{var{typed:e}=r;return{"Unit, Unit":e.referToSelf(r=>(t,n)=>{if(!t.equalBase(n))throw Error("Cannot compare units with different base");return e.find(r,[t.valueType(),n.valueType()])(t.value,n.value)})}}),io="equalScalar",is=ey(io,["typed","config"],r=>{var{typed:e,config:t}=r,n=ia({typed:e});return e(io,{"boolean, boolean":function(r,e){return r===e},"number, number":function(r,e){return ej(r,e,t.epsilon)},"BigNumber, BigNumber":function(r,e){return r.eq(e)||iu(r,e,t.epsilon)},"Fraction, Fraction":function(r,e){return r.equals(e)},"Complex, Complex":function(r,e){var n;return n=t.epsilon,ej(r.re,e.re,n)&&ej(r.im,e.im,n)}},n)});ey(io,["typed","config"],r=>{var{typed:e,config:t}=r;return e(io,{"number, number":function(r,e){return ej(r,e,t.epsilon)}})}),r=>{var{typed:e}=r;return e("name",{number:function(r){var e=Math.abs(r);return e>=im?ew(r):e<=ic?ew(r)*function(r){var e,t=r*r,n=ih[0][4]*t,i=t;for(e=0;e<3;e+=1)n=(n+ih[0][e])*t,i=(i+ip[0][e])*t;return r*(n+ih[0][3])/(i+ip[0][3])}(e):e<=4?ew(r)*(1-function(r){var e,t=ih[1][8]*r,n=r;for(e=0;e<7;e+=1)t=(t+ih[1][e])*r,n=(n+ip[1][e])*r;var i=(t+ih[1][7])/(n+ip[1][7]),u=parseInt(16*r)/16;return Math.exp(-u*u)*Math.exp(-((r-u)*(r+u)))*i}(e)):ew(r)*(1-function(r){var e,t=1/(r*r),n=ih[2][5]*t,i=t;
1for(e=0;e<4;e+=1)n=(n+ih[2][e])*t,i=(i+ip[2][e])*t;var u=t*(n+ih[2][4])/(i+ip[2][4]);u=(il-u)/r,t=parseInt(16*r)/16;var a=(r-t)*(r+t);return Math.exp(-t*t)*Math.exp(-a)*u}(e))},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})};var ic=.46875,il=.5641895835477563,ih=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,21531153547440383e-24],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,6587491615298378e-19,.016315387137302097]],ip=[[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]],im=0x20000000000000,iv=ey("exp",["typed"],r=>{var{typed:e}=r;return e("exp",{number:nt,Complex:function(r){return r.exp()},BigNumber:function(r){return r.exp()}})}),id="expm1";function ig(r,e,t,n,i){if(!tI().isTypedFunction(r))return r(e,t,n);var u=[e,t,n],a=tI().resolve(r,u);if(a)return l(a.implementation,u);var o=[e,t],s=tI().resolve(r,o);if(s)return l(s.implementation,o);var f=[e],c=tI().resolve(r,f);return c?l(c.implementation,f):l(r,u);function l(u,a){try{return u.apply(u,a)}catch(u){var o;if(u instanceof TypeError&&(null==(o=u.data)?void 0:o.category)==="wrongType"){var s=[];throw s.push("value: ".concat(ep(e))),a.length>=2&&s.push("index: ".concat(ep(t))),a.length>=3&&s.push("array: ".concat(ep(n))),TypeError("Function ".concat(i," cannot apply callback arguments ")+"".concat(r.name,"(").concat(s.join(", "),") at index ").concat(JSON.stringify(t)))}throw TypeError("Function ".concat(i," cannot apply callback arguments ")+"to function ".concat(r.name,": ").concat(u.message))}}}function iy(r,e){if(1!==tm(r).length)throw Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,function(r,t,n){return ig(e,r,[t],n,"filter")})}r=>{var{typed:e,Complex:t}=r;return e(id,{number:nn,Complex:function(r){var e=Math.exp(r.re);return new t(e*Math.cos(r.im)-1,e*Math.sin(r.im))},BigNumber:function(r){return r.exp().minus(1)}})},r=>{var{typed:e}=r;return e("filter",{"Array, function":iy,"Matrix, function":function(r,e){return r.create(iy(r.toArray(),e))},"Array, RegExp":tM,"Matrix, RegExp":function(r,e){return r.create(tM(r.toArray(),e))}})};var ib="forEach";function iD(r,e){!function t(n,i){if(!Array.isArray(n))return ig(e,n,i,r,"forEach");Array.prototype.forEach.call(n,function(r,e){t(r,i.concat(e))})}(r,[])}r=>{var{typed:e}=r;return e(ib,{"Array, function":iD,"Matrix, function":function(r,e){r.forEach(e)}})};var ix="format",iE=ey(ix,["typed"],r=>{var{typed:e}=r;return e(ix,{any:ts,"any, Object | function | number | BigNumber":ts})}),iA="getMatrixDataType",iw=ey(iA,["typed"],r=>{var{typed:e}=r;return e(iA,{Array:function(r){return tS(r,ep)},Matrix:function(r){return r.getDataType()}})}),iN=(ey("hex",["typed","format"],r=>{var{typed:e,format:t}=r;return e("hex",{"number | BigNumber":function(r){return t(r,{notation:"hex"})},"number | BigNumber, number | BigNumber":function(r,e){return t(r,{notation:"hex",wordSize:e})}})}),ey("im",["typed"],r=>{var{typed:e}=r;return e("im",{number:()=>0,"BigNumber | Fraction":r=>r.mul(0),Complex:r=>r.im,"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})})),iM="isInteger",iC=ey(iM,["typed"],r=>{var{typed:e}=r;return e(iM,{number:eA,BigNumber:function(r){return r.isInt()},Fraction:function(r){return 1===r.d&&isFinite(r.n)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}),iF="number";function iS(r){return r<0}function i_(r){return r>0}function iB(r){return 0===r}function iT(r){return Number.isNaN(r)}iS.signature=iF,i_.signature=iF,iB.signature=iF,iT.signature=iF;var iO="isNegative",iz=ey(iO,["typed"],r=>{var{typed:e}=r;return e(iO,{number:iS,BigNumber:function(r){return r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s<0},Unit:e.referToSelf(r=>t=>e.find(r,t.valueType())(t.value)),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}),iI="isPositive",iR=ey(iI,["typed"],r=>{var{typed:e}=r;return e(iI,{number:i_,BigNumber:function(r){return!r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s>0&&r.n>0},Unit:e.referToSelf(r=>t=>e.find(r,t.valueType())(t.value)),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}),iU="isZero",iP=ey(iU,["typed"],r=>{var{typed:e}=r;return e(iU,{number:iB,BigNumber:function(r){return r.isZero()},Complex:function(r){return 0===r.re&&0===r.im},Fraction:function(r){return 1===r.d&&0===r.n},Unit:e.referToSelf(r=>t=>e.find(r,t.valueType())(t.value)),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})});function ij(r){if(eA(r))return r<=0?isFinite(r)?1/0:NaN:r>171?1/0:n3(1,r-1);if(r<.5)return Math.PI/(Math.sin(Math.PI*r)*ij(1-r));if(r>=171.35)return 1/0;if(r>85){var e,t=r*r,n=t*r,i=n*r,u=i*r;return Math.sqrt(2*Math.PI/r)*Math.pow(r/Math.E,r)*(1+1/(12*r)+1/(288*t)-139/(51840*n)-571/(2488320*i)+163879/(0xc756000*u)+5246819/(0x11850f0000*u*r))}--r,e=iq[0];for(var a=1;a<iq.length;++a)e+=iq[a]/(r+a);var o=r+ik+.5;return Math.sqrt(2*Math.PI)*Math.pow(o,r+.5)*Math.exp(-o)*e}ij.signature="number";var ik=4.7421875,iq=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,339946499848
11189e-20,4652362892704858e-20,-9837447530487956e-20,1580887032249125e-19,-21026444172410488e-20,21743961811521265e-20,-1643181065367639e-19,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22],iL=[1.000000000190015,76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18];function iH(r){if(r<0)return NaN;if(0===r)return 1/0;if(!isFinite(r))return r;if(r<.5)return Math.log(Math.PI/Math.sin(Math.PI*r))-iH(1-r);for(var e=(r-=1)+5+.5,t=iL[0],n=6;n>=1;n--)t+=iL[n]/(r+n);return .9189385332046728+(r+.5)*Math.log(e)-e+Math.log(t)}iH.signature="number";var iG="lgamma",iV=(r=>{var{Complex:e,typed:t}=r,n=[-.029550653594771242,.00641025641025641,-.0019175269175269176,8417508417508417e-19,-5952380952380953e-19,7936507936507937e-19,-.002777777777777778,.08333333333333333];return t(iG,{number:iH,Complex:function r(t){if(t.isNaN())return new e(NaN,NaN);if(0===t.im)return new e(iH(t.re),0);if(t.re>=7||Math.abs(t.im)>=7)return i(t);if(t.re<=.1){var n,a=(!0^((n=t.im)>0||!(n<0)&&1/n==1/0)?-6.283185307179586:6.283185307179586)*Math.floor(.5*t.re+.25),o=t.mul(Math.PI).sin().log(),s=r(new e(1-t.re,-t.im));return new e(1.1447298858494002,a).sub(o).sub(s)}return t.im>=0?u(t):u(t.conjugate()).conjugate()},BigNumber:function(){throw Error("mathjs doesn't yet provide an implementation of the algorithm lgamma for BigNumber")}});function i(r){for(var t=r.sub(.5).mul(r.log()).sub(r).add(.9189385332046728),i=new e(1,0).div(r),u=i.div(r),a=n[0],o=n[1],s=2*u.re,f=u.re*u.re+u.im*u.im,c=2;c<8;c++){var l=o;o=-f*a+n[c],a=s*a+l}var h=i.mul(u.mul(a).add(o));return t.add(h)}function u(r){var t=0,n=0,u=r;for(r=r.add(1);r.re<=7;){var a=+((u=u.mul(r)).im<0);0!==a&&0===n&&t++,n=a,r=r.add(1)}return i(r).sub(u.log()).sub(new e(0,2*t*Math.PI*1))}},"log10"),iZ=(r=>{var{typed:e,config:t,Complex:n}=r;return e(iV,{number:function(r){return r>=0||t.predictable?eM(r):new n(r,0).log().div(Math.LN10)},Complex:function(r){return new n(r).log().div(Math.LN10)},BigNumber:function(r){return!r.isNegative()||t.predictable?r.log():new n(r.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})},"log2"),iY=ey(iZ,["typed","config","Complex"],r=>{var{typed:e,config:t,Complex:n}=r;return e(iZ,{number:function(r){return r>=0||t.predictable?eN(r):i(new n(r,0))},Complex:i,BigNumber:function(r){return!r.isNegative()||t.predictable?r.log(2):i(new n(r.toNumber(),0))},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))});function i(r){var e=Math.sqrt(r.re*r.re+r.im*r.im);return new n(Math.log2?Math.log2(e):Math.log(e)/Math.LN2,Math.atan2(r.im,r.re)/Math.LN2)}}),iX=ey("map",["typed"],r=>{var{typed:e}=r;return e("map",{"Array, function":iJ,"Matrix, function":function(r,e){return r.map(e)}})});function iJ(r,e){return function t(n,i){return Array.isArray(n)?n.map(function(r,e){return t(r,i.concat(e))}):ig(e,n,i,r,"map")}(r,[])}var iW=ey("multiplyScalar",["typed"],r=>{var{typed:e}=r;return e("multiplyScalar",{"number, number":t7,"Complex, Complex":function(r,e){return r.mul(e)},"BigNumber, BigNumber":function(r,e){return r.times(e)},"Fraction, Fraction":function(r,e){return r.mul(e)},"number | Fraction | BigNumber | Complex, Unit":(r,e)=>e.multiply(r),"Unit, number | Fraction | BigNumber | Complex | Unit":(r,e)=>r.multiply(e)})}),i$="number, number";function iQ(r){return!r}function iK(r,e){return!!(r||e)}function i0(r,e){return!!r!=!!e}function i1(r,e){return!!(r&&e)}iQ.signature="number",iK.signature=i$,i0.signature=i$,i1.signature=i$;var i2=ey("not",["typed"],r=>{var{typed:e}=r;return e("not",{"null | undefined":()=>!0,number:iQ,Complex:function(r){return 0===r.re&&0===r.im},BigNumber:function(r){return r.isZero()||r.isNaN()},Unit:e.referToSelf(r=>t=>e.find(r,t.valueType())(t.value)),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}),i3=ey("number",["typed"],r=>{var{typed:e}=r,t=e("number",{"":function(){return 0},number:function(r){return r},string:function(r){if("NaN"===r)return NaN;var e=function(r){var e=r.match(/(0[box])([0-9a-fA-F]*)\.([0-9a-fA-F]*)/);if(!e)return null;var t={"0b":2,"0o":8,"0x":16}[e[1]];return{input:r,radix:t,integerPart:e[2],fractionalPart:e[3]}}(r);if(e){for(var t=parseInt(e.integerPart,e.radix),n=0,i=0;i<e.fractionalPart.length;i++)n+=parseInt(e.fractionalPart[i],e.radix)/Math.pow(e.radix,i+1);var u=t+n;if(isNaN(u))throw SyntaxError('String "'+e.input+'" is not a valid number');return u}var a=0,o=r.match(/(0[box][0-9a-fA-F]*)i([0-9]*)/);o&&(a=Number(o[2]),r=o[1]);var s=Number(r);
1if(isNaN(s))throw SyntaxError('String "'+r+'" is not a valid number');if(o){if(s>2**a-1)throw SyntaxError('String "'.concat(r,'" is out of range'));s>=2**(a-1)&&(s-=2**a)}return s},BigNumber:function(r){return r.toNumber()},Fraction:function(r){return r.valueOf()},Unit:e.referToSelf(r=>e=>{var t=e.clone();return t.value=r(e.value),t}),null:function(r){return 0},"Unit, string | Unit":function(r,e){return r.toNumber(e)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))});return t.fromJSON=function(r){return parseFloat(r.value)},t}),i8=(ey("oct",["typed","format"],r=>{var{typed:e,format:t}=r;return e("oct",{"number | BigNumber":function(r){return t(r,{notation:"oct"})},"number | BigNumber, number | BigNumber":function(r,e){return t(r,{notation:"oct",wordSize:e})}})}),t(12162)),i5=t.n(i8),i4=i5()(Date.now());function i7(r){var e;return e=null===r?i4:i5()(String(r)),function(){return e()}}var i9="pickRandom",i6=(r=>{var{typed:e,config:t,on:n}=r,i=i7(t.randomSeed);return n&&n("config",function(r,e){r.randomSeed!==e.randomSeed&&(i=i7(r.randomSeed))}),e(i9,{"Array | Matrix":function(r){return u(r,{})},"Array | Matrix, Object":function(r,e){return u(r,e)},"Array | Matrix, number":function(r,e){return u(r,{number:e})},"Array | Matrix, Array | Matrix":function(r,e){return u(r,{weights:e})},"Array | Matrix, Array | Matrix, number":function(r,e,t){return u(r,{number:t,weights:e})},"Array | Matrix, number, Array | Matrix":function(r,e,t){return u(r,{number:e,weights:t})}});function u(r,e){var t,{number:n,weights:u,elementWise:a=!0}=e,o=void 0===n;o&&(n=1);var s=rV(r)?r.create:rV(u)?u.create:null;r=r.valueOf(),u&&(u=u.valueOf()),!0===a&&(r=tN(r),u=tN(u));var f=0;if(void 0!==u){if(u.length!==r.length)throw Error("Weights must have the same length as possibles");for(var c=0,l=u.length;c<l;c++){if(!rP(u[c])||u[c]<0)throw Error("Weights must be an array of positive numbers");f+=u[c]}}for(var h=r.length,p=[];p.length<n;){if(void 0===u)t=r[Math.floor(i()*h)];else for(var m=i()*f,v=0,d=r.length;v<d;v++)if((m-=u[v])<0){t=r[v];break}p.push(t)}return o?p[0]:s?s(p):p}},/\$([\w.]+)/g),ur="print";function ue(r,e,t){return r.replace(i6,function(r,n){var i=n.split("."),u=e[i.shift()];for(void 0!==u&&u.isMatrix&&(u=u.toArray());i.length&&void 0!==u;){var a=i.shift();u=a?u[a]:u+"."}if(void 0!==u)if(!rH(u))return ts(u,t);else return u;return r})}function ut(r,e){var t=[];if((r=r.slice(0)).length>1)for(var n=0,i=r.shift();n<i;n++)t.push(ut(r,e));else for(var u=0,a=r.shift();u<a;u++)t.push(e());return t}r=>{var{typed:e}=r;return e(ur,{"string, Object | Array":ue,"string, Object | Array, number | Object":ue})};var un="random",ui=(r=>{var{typed:e,config:t,on:n}=r,i=i7(t.randomSeed);return n&&n("config",function(r,e){r.randomSeed!==e.randomSeed&&(i=i7(r.randomSeed))}),e(un,{"":()=>(function(r,e){return 0+ +i()})(0,1),number:r=>(function(r,e){return 0+i()*(e-0)})(0,r),"number, number":(r,e)=>(function(r,e){return r+i()*(e-r)})(r,e),"Array | Matrix":r=>u(r,0,1),"Array | Matrix, number":(r,e)=>u(r,0,e),"Array | Matrix, number, number":(r,e,t)=>u(r,e,t)});function u(r,e,t){var n=ut(r.valueOf(),()=>{var r,n;return r=e,n=t,r+i()*(n-r)});return rV(r)?r.create(n):n}},ey("re",["typed"],r=>{var{typed:e}=r;return e("re",{"number | BigNumber | Fraction":r=>r,Complex:r=>r.re,"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})})),uu=(r=>{var{typed:e,BigNumber:t}=r,n=ie({typed:e});return e("sec",{number:nC,Complex:r=>r.sec(),BigNumber:r=>new t(1).div(r.cos())},n)},"sign"),ua=ey(uu,["typed","BigNumber","Fraction","complex"],r=>{var{typed:e,BigNumber:t,complex:n,Fraction:i}=r;return e(uu,{number:na,Complex:function(r){return 0===r.im?n(na(r.re)):r.sign()},BigNumber:function(r){return new t(r.cmp(0))},Fraction:function(r){return new i(r.s,1)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0)),Unit:e.referToSelf(r=>t=>{if(!t._isDerived()&&0!==t.units[0].unit.offset)throw TypeError("sign is ambiguous for units with offset");return e.find(r,t.valueType())(t.value)})})}),uo=ey("sin",["typed"],r=>{var{typed:e}=r,t=ie({typed:e});return e("sin",{number:Math.sin,"Complex | BigNumber":r=>r.sin()},t)}),us=ey("SparseMatrix",["typed","equalScalar","Matrix"],r=>{var{typed:e,equalScalar:t,Matrix:n}=r;function i(r,e){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");if(e&&!rH(e))throw Error("Invalid datatype: "+e);if(rV(r)){var t,n,a;t=this,n=r,a=e,"SparseMatrix"===n.type?(t._values=n._values?em(n._values):void 0,t._index=em(n._index),t._ptr=em(n._ptr),t._size=em(n._size),t._datatype=a||n._datatype):u(t,n.valueOf(),a||n._datatype)}else if(r&&rG(r.index)&&rG(r.ptr)&&rG(r.size))this._values=r.values,this._index=r.index,this._ptr=r.ptr,this._size=r.size,this._datatype=e||r.datatype;else if(rG(r))u(this,r,e);else if(r)throw TypeError("Unsupported type of data ("+ep(r)+")");else this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=e}function u(r,n,i){r._values=[],r._index=[],r._ptr=[],r._datatype=i;var u=n.length,a=0,o=t,s=0;if(rH(i)&&(o=e.find(t,[i,i])||t,s=e.convert(0,i)),u>0){var f=0;do{r._ptr.push(r._index.length);for(var c=0;c<u;c++){var l=n[c];if(rG(l)){if(0===f&&a<l.length&&(a=l.length),f<l.length){var h=l[f];o(h,s)||(r._values.push(h),r._index.push(c))}}else 0===f&&a<1&&(a=1),o(l,s)||(r._values.push(l),r._index.push(c))}f++}while(f<a)}r._ptr.push(r._index.length),r._size=[u,a]}function a(r,e,t,n){if(t-e==0)return t;for(var i=e;i<t;i++)if(n[i]===r)return i;return e}function o(r,e,t,n,i,u,a){i.splice(r,0,n),u.splice(r,0,e);for(var o=t+1;o<a.length;o++)a[o]++}function s(r,n,i,u){var a,o,s,f=u||0,c=t,l=0;rH(r._datatype)&&(c=e.find(t,[r._datatype,r._datatype])||t,l=e.convert(0,r._datatype),f=e.convert(f,r._datatype));var h=!c(f,l),p=r._size[0],m=r._size[1];if(i>m){for(o=m;o<i;o++)if(r._ptr[o]=r._values.length,h)for(a=0;a<p;a++)r._values.push(f),r._index.push(a);r._ptr[i]=r._values.length}else i<m&&(r._ptr.splice(i+1,m-i),r._values.splice(r._ptr[i],r._values.length),r._index.splice(r._ptr[i],r._index.length));if(m=i,n>p){if(h){var v=0;for(o=0;o<m;o++){r._ptr[o]=r._ptr[o]+v,s=r._ptr[o+1]+v;var d=0;for(a=p;a<n;a++,d++)r._values.splice(s+d,0,f),r._index.splice(s+d,0,a),v++}r._ptr[m]=r._values.length}}else if(n<p){var g=0;for(o=0;o<m;o++){r._ptr[o]=r._ptr[o]-g;var y=r._ptr[o],b=r._ptr[o+1]-g;for(s=y;s<b;s++)(a=r._index[s])>n-1&&(r._values.splice(s,1),r._index.splice(s,1),g++)}r._ptr[o]=r._values.length}return r._size[0]=n,r._size[1]=i,r}function f(r,e,t,n,i){var u,a,o=n[0],s=n[1],f=[];for(u=0;
1u<o;u++)for(a=0,f[u]=[];a<s;a++)f[u][a]=0;for(a=0;a<s;a++)for(var c=t[a],l=t[a+1],h=c;h<l;h++)f[u=e[h]][a]=r?i?em(r[h]):r[h]:1;return f}return i.prototype=new n,i.prototype.createSparseMatrix=function(r,e){return new i(r,e)},Object.defineProperty(i,"name",{value:"SparseMatrix"}),i.prototype.constructor=i,i.prototype.type="SparseMatrix",i.prototype.isSparseMatrix=!0,i.prototype.getDataType=function(){return tS(this._values,ep)},i.prototype.storage=function(){return"sparse"},i.prototype.datatype=function(){return this._datatype},i.prototype.create=function(r,e){return new i(r,e)},i.prototype.density=function(){var r=this._size[0],e=this._size[1];return 0!==r&&0!==e?this._index.length/(r*e):0},i.prototype.subset=function(r,e,t){if(!this._values)throw Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(r,e){if(!rW(e))throw TypeError("Invalid index");if(e.isScalar())return r.get(e.min());var t,n,u,a,o=e.size();if(o.length!==r._size.length)throw new th(o.length,r._size.length);var s=e.min(),f=e.max();for(t=0,n=r._size.length;t<n;t++)tg(s[t],r._size[t]),tg(f[t],r._size[t]);var c=r._values,l=r._index,h=r._ptr,p=e.dimension(0),m=e.dimension(1),v=[],d=[];p.forEach(function(r,e){d[r]=e[0],v[r]=!0});var g=c?[]:void 0,y=[],b=[];return m.forEach(function(r){for(b.push(y.length),u=h[r],a=h[r+1];u<a;u++)!0===v[t=l[u]]&&(y.push(d[t]),g&&g.push(c[u]))}),b.push(y.length),new i({values:g,index:y,ptr:b,size:o,datatype:r._datatype})}(this,r);case 2:case 3:return function(r,e,t,n){if(!e||!0!==e.isIndex)throw TypeError("Invalid index");var i,u=e.size(),a=e.isScalar();if(rV(t)?(i=t.size(),t=t.toArray()):i=tm(t),a){if(0!==i.length)throw TypeError("Scalar expected");r.set(e.min(),t,n)}else{if(1!==u.length&&2!==u.length)throw new th(u.length,r._size.length,"<");if(i.length<u.length){for(var o=0,s=0;1===u[o]&&1===i[o];)o++;for(;1===u[o];)s++,o++;t=tw(t,u.length,s,i)}if(!ed(u,i))throw new th(u,i,">");if(1===u.length)e.dimension(0).forEach(function(e,i){tg(e),r.set([e,0],t[i[0]],n)});else{var f=e.dimension(0),c=e.dimension(1);f.forEach(function(e,i){tg(e),c.forEach(function(u,a){tg(u),r.set([e,u],t[i[0]][a[0]],n)})})}}return r}(this,r,e,t);default:throw SyntaxError("Wrong number of arguments")}},i.prototype.get=function(r){if(!rG(r))throw TypeError("Array expected");if(r.length!==this._size.length)throw new th(r.length,this._size.length);if(!this._values)throw Error("Cannot invoke get on a Pattern only matrix");var e=r[0],t=r[1];tg(e,this._size[0]),tg(t,this._size[1]);var n=a(e,this._ptr[t],this._ptr[t+1],this._index);return n<this._ptr[t+1]&&this._index[n]===e?this._values[n]:0},i.prototype.set=function(r,n,i){if(!rG(r))throw TypeError("Array expected");if(r.length!==this._size.length)throw new th(r.length,this._size.length);if(!this._values)throw Error("Cannot invoke set on a Pattern only matrix");var u=r[0],f=r[1],c=this._size[0],l=this._size[1],h=t,p=0;rH(this._datatype)&&(h=e.find(t,[this._datatype,this._datatype])||t,p=e.convert(0,this._datatype)),(u>c-1||f>l-1)&&(s(this,Math.max(u+1,c),Math.max(f+1,l),i),c=this._size[0],l=this._size[1]),tg(u,c),tg(f,l);var m=a(u,this._ptr[f],this._ptr[f+1],this._index);return m<this._ptr[f+1]&&this._index[m]===u?h(n,p)?function(r,e,t,n,i){t.splice(r,1),n.splice(r,1);for(var u=e+1;u<i.length;u++)i[u]--}(m,f,this._values,this._index,this._ptr):this._values[m]=n:h(n,p)||o(m,u,f,n,this._values,this._index,this._ptr),this},i.prototype.resize=function(r,e,t){if(!rZ(r))throw TypeError("Array or Matrix expected");var n=r.valueOf().map(r=>Array.isArray(r)&&1===r.length?r[0]:r);if(2!==n.length)throw Error("Only two dimensions matrix are supported");return n.forEach(function(r){if(!rP(r)||!eA(r)||r<0)throw TypeError("Invalid size, must contain positive integers (size: "+ts(n)+")")}),s(t?this.clone():this,n[0],n[1],e)},i.prototype.reshape=function(r,e){if(!rG(r))throw TypeError("Array expected");if(2!==r.length)throw Error("Sparse matrices can only be reshaped in two dimensions");r.forEach(function(e){if(!rP(e)||!eA(e)||e<=-2||0===e)throw TypeError("Invalid size, must contain positive integers or -1 (size: "+ts(r)+")")});var t=this._size[0]*this._size[1],n=(r=tx(r,t))[0]*r[1];if(t!==n)throw Error("Reshaping sparse matrix will result in the wrong number of elements");var i=e?this.clone():this;if(this._size[0]===r[0]&&this._size[1]===r[1])return i;for(var u=[],s=0;s<i._ptr.length;s++)for(var f=0;f<i._ptr[s+1]-i._ptr[s];f++)u.push(s);for(var c=i._values.slice(),l=i._index.slice(),h=0;h<i._index.length;h++){var p=l[h],m=u[h],v=p*i._size[1]+m;u[h]=v%r[1],l[h]=Math.floor(v/r[1])}i._values.length=0,i._index.length=0,i._ptr.length=r[1]+1,i._size=r.slice();for(var d=0;d<i._ptr.length;d++)i._ptr[d]=0;for(var g=0;g<c.length;g++){var y=l[g],b=u[g],D=c[g];
1o(a(y,i._ptr[b],i._ptr[b+1],i._index),y,b,D,i._values,i._index,i._ptr)}return i},i.prototype.clone=function(){return new i({values:this._values?em(this._values):void 0,index:em(this._index),ptr:em(this._ptr),size:em(this._size),datatype:this._datatype})},i.prototype.size=function(){return this._size.slice(0)},i.prototype.map=function(r,n){if(!this._values)throw Error("Cannot invoke map on a Pattern only matrix");var u=this,a=this._size[0],o=this._size[1],s=eW(r);return function(r,n,u,a,o,s,f){var c=[],l=[],h=[],p=t,m=0;rH(r._datatype)&&(p=e.find(t,[r._datatype,r._datatype])||t,m=e.convert(0,r._datatype));for(var v=function(r,e,t){r=s(r,e,t),p(r,m)||(c.push(r),l.push(e))},d=0;d<=o;d++){h.push(c.length);var g=r._ptr[d],y=r._ptr[d+1];if(f)for(var b=g;b<y;b++){var D=r._index[b];D>=0&&D<=u&&v(r._values[b],D-n,d-a)}else{for(var x={},E=g;E<y;E++)x[r._index[E]]=r._values[E];for(var A=n;A<=u;A++)v(A in x?x[A]:0,A-n,d-a)}}return h.push(c.length),new i({values:c,index:l,ptr:h,size:[u-n+1,o-a+1]})}(this,0,a-1,0,o-1,function(e,t,n){return 1===s?r(e):2===s?r(e,[t,n]):r(e,[t,n],u)},n)},i.prototype.forEach=function(r,e){if(!this._values)throw Error("Cannot invoke forEach on a Pattern only matrix");for(var t=this._size[0],n=this._size[1],i=0;i<n;i++){var u=this._ptr[i],a=this._ptr[i+1];if(e)for(var o=u;o<a;o++){var s=this._index[o];r(this._values[o],[s,i],this)}else{for(var f={},c=u;c<a;c++)f[this._index[c]]=this._values[c];for(var l=0;l<t;l++)r(l in f?f[l]:0,[l,i],this)}}},i.prototype[Symbol.iterator]=function*(){if(!this._values)throw Error("Cannot iterate a Pattern only matrix");for(var r=this._size[1],e=0;e<r;e++)for(var t=this._ptr[e],n=this._ptr[e+1],i=t;i<n;i++){var u=this._index[i];yield{value:this._values[i],index:[u,e]}}},i.prototype.toArray=function(){return f(this._values,this._index,this._ptr,this._size,!0)},i.prototype.valueOf=function(){return f(this._values,this._index,this._ptr,this._size,!1)},i.prototype.format=function(r){for(var e=this._size[0],t=this._size[1],n=this.density(),i="Sparse Matrix ["+ts(e,r)+" x "+ts(t,r)+"] density: "+ts(n,r)+"\n",u=0;u<t;u++)for(var a=this._ptr[u],o=this._ptr[u+1],s=a;s<o;s++)i+="\n ("+ts(this._index[s],r)+", "+ts(u,r)+") ==> "+(this._values?ts(this._values[s],r):"X");return i},i.prototype.toString=function(){return ts(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(r){if(r){if(rj(r)&&(r=r.toNumber()),!rP(r)||!eA(r))throw TypeError("The parameter k must be an integer number")}else r=0;var e=r>0?r:0,t=r<0?-r:0,n=this._size[0],u=this._size[1],a=Math.min(n-t,u-e),o=[],s=[],f=[];f[0]=0;for(var c=e;c<u&&o.length<a;c++)for(var l=this._ptr[c],h=this._ptr[c+1],p=l;p<h;p++){var m=this._index[p];if(m===c-e+t){o.push(this._values[p]),s[o.length-1]=m-t;break}}return f.push(o.length),new i({values:o,index:s,ptr:f,size:[a,1]})},i.fromJSON=function(r){return new i(r)},i.diagonal=function(r,n,u,a,o){if(!rG(r))throw TypeError("Array expected, size parameter");if(2!==r.length)throw Error("Only two dimensions matrix are supported");if(r=r.map(function(r){if(rj(r)&&(r=r.toNumber()),!rP(r)||!eA(r)||r<1)throw Error("Size values must be positive integers");return r}),u){if(rj(u)&&(u=u.toNumber()),!rP(u)||!eA(u))throw TypeError("The parameter k must be an integer number")}else u=0;var s,f=t,c=0;rH(o)&&(f=e.find(t,[o,o])||t,c=e.convert(0,o));var l=u>0?u:0,h=u<0?-u:0,p=r[0],m=r[1],v=Math.min(p-h,m-l);if(rG(n)){if(n.length!==v)throw Error("Invalid value array length");s=function(r){return n[r]}}else if(rV(n)){var d=n.size();if(1!==d.length||d[0]!==v)throw Error("Invalid matrix length");s=function(r){return n.get([r])}}else s=function(){return n};for(var g=[],y=[],b=[],D=0;D<m;D++){b.push(g.length);var x=D-l;if(x>=0&&x<v){var E=s(x);f(E,c)||(y.push(x+h),g.push(E))}}return b.push(g.length),new i({values:g,index:y,ptr:b,size:[p,m]})},i.prototype.swapRows=function(r,e){if(!rP(r)||!eA(r)||!rP(e)||!eA(e))throw Error("Row index must be positive integers");if(2!==this._size.length)throw Error("Only two dimensional matrix is supported");return tg(r,this._size[0]),tg(e,this._size[0]),i._swapRows(r,e,this._size[1],this._values,this._index,this._ptr),this}
1,i._forEachRow=function(r,e,t,n,i){for(var u=n[r],a=n[r+1],o=u;o<a;o++)i(t[o],e[o])},i._swapRows=function(r,e,t,n,i,u){for(var o=0;o<t;o++){var s=u[o],f=u[o+1],c=a(r,s,f,i),l=a(e,s,f,i);if(c<f&&l<f&&i[c]===r&&i[l]===e){if(n){var h=n[c];n[c]=n[l],n[l]=h}continue}if(c<f&&i[c]===r&&(l>=f||i[l]!==e)){var p=n?n[c]:void 0;i.splice(l,0,e),n&&n.splice(l,0,p),i.splice(l<=c?c+1:c,1),n&&n.splice(l<=c?c+1:c,1);continue}if(l<f&&i[l]===e&&(c>=f||i[c]!==r)){var m=n?n[l]:void 0;i.splice(c,0,r),n&&n.splice(c,0,m),i.splice(c<=l?l+1:l,1),n&&n.splice(c<=l?l+1:l,1)}}},i},{isClass:!0}),uf="splitUnit",uc=(r=>{var{typed:e}=r;return e(uf,{"Unit, Array":function(r,e){return r.splitUnit(e)}})},"square"),ul=(r=>{var{typed:e}=r;return e(uc,{number:no,Complex:function(r){return r.mul(r)},BigNumber:function(r){return r.times(r)},Fraction:function(r){return r.mul(r)},Unit:function(r){return r.pow(2)}})},"string"),uh=(r=>{var{typed:e}=r;return e(ul,{"":function(){return""},number:eB,null:function(r){return"null"},boolean:function(r){return r+""},string:function(r){return r},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r)),any:function(r){return String(r)}})},"subtractScalar"),up=ey(uh,["typed"],r=>{var{typed:e}=r;return e(uh,{"number, number":t4,"Complex, Complex":function(r,e){return r.sub(e)},"BigNumber, BigNumber":function(r,e){return r.minus(e)},"Fraction, Fraction":function(r,e){return r.sub(e)},"Unit, Unit":e.referToSelf(r=>(t,n)=>{if(null===t.value||void 0===t.value)throw Error("Parameter x contains a unit with undefined value");if(null===n.value||void 0===n.value)throw Error("Parameter y contains a unit with undefined value");if(!t.equalBase(n))throw Error("Units do not match");var i=t.clone();return i.value=e.find(r,[i.valueType(),n.valueType()])(i.value,n.value),i.fixPrefix=!1,i})})}),um=(r=>{var{typed:e}=r,t=ie({typed:e});return e("tan",{number:Math.tan,"Complex | BigNumber":r=>r.tan()},t)},"typeOf"),uv=ey(um,["typed"],r=>{var{typed:e}=r;return e(um,{any:ep})}),ud="acosh",ug=(r=>{var{typed:e,config:t,Complex:n}=r;return e(ud,{number:function(r){return r>=1||t.predictable?ek(r):r<=-1?new n(Math.log(Math.sqrt(r*r-1)-r),Math.PI):new n(r,0).acosh()},Complex:function(r){return r.acosh()},BigNumber:function(r){return r.acosh()}})},"acsch"),uy=(r=>{var{typed:e,BigNumber:t}=r;return e(ug,{number:nb,Complex:function(r){return r.acsch()},BigNumber:function(r){return new t(1).div(r).asinh()}})},"apply"),ub=ey(uy,["typed","isInteger"],r=>{var{typed:e,isInteger:t}=r;return e(uy,{"Array | Matrix, number | BigNumber, function":function(r,e,n){if(!t(e))throw TypeError("Integer number expected for dimension");var i=Array.isArray(r)?tm(r):r.size();if(e<0||e>=i.length)throw new tp(e,i.length);return rV(r)?r.create(uD(r.valueOf(),e,n)):uD(r,e,n)}})});function uD(r,e,t){var n,i,u;if(e<=0)if(!Array.isArray(r[0]))return t(r);else{for(n=0,u=function(r){var e,t,n=r.length,i=r[0].length,u=[];for(t=0;t<i;t++){var a=[];for(e=0;e<n;e++)a.push(r[e][t]);u.push(a)}return u}(r),i=[];n<u.length;n++)i[n]=uD(u[n],e-1,t);return i}for(n=0,i=[];n<r.length;n++)i[n]=uD(r[n],e-1,t);return i}var ux="asec",uE=(ey("bin",["typed","format"],r=>{var{typed:e,format:t}=r;return e("bin",{"number | BigNumber":function(r){return t(r,{notation:"bin"})},"number | BigNumber, number | BigNumber":function(r,e){return t(r,{notation:"bin",wordSize:e})}})}),"combinationsWithRep");function uA(r){return r.isInteger()&&r.gte(0)}r=>{var{typed:e}=r;return e(uE,{"number, number":function(r,e){if(!eA(r)||r<0||!eA(e)||e<0)throw TypeError("Positive integer value expected in function combinationsWithRep");if(r<1)throw TypeError("k must be less than or equal to n + k - 1");return e<r-1?n3(r,r+e-1)/n3(1,e):n3(e+1,r+e-1)/n3(1,r-1)},"BigNumber, BigNumber":function(r,e){var t,n,i=new r.constructor(1),u=r.minus(i);if(!uA(r)||!uA(e))throw TypeError("Positive integer value expected in function combinationsWithRep");if(r.lt(i))throw TypeError("k must be less than or equal to n + k - 1 in function combinationsWithRep");if(t=i,e.lt(u))for(n=i;n.lte(u);n=n.plus(i))t=t.times(e.plus(n)).dividedBy(n);else for(n=i;n.lte(e);n=n.plus(i))t=t.times(u.plus(n)).dividedBy(n);return t}})};var uw="cosh",uN=(r=>{var{typed:e}=r;return e(uw,{number:eH,"Complex | BigNumber":r=>r.cosh()})},"csch"),uM=(r=>{var{typed:e,BigNumber:t}=r;return e(uN,{number:nM,Complex:r=>r.csch(),BigNumber:r=>new t(1).div(r.sinh())})},"isNaN"),uC=ey(uM,["typed"],r=>{var{typed:e}=r;return e(uM,{number:iT,BigNumber:function(r){return r.isNaN()},Fraction:function(r){return!1},Complex:function(r){return r.isNaN()},Unit:function(r){return Number.isNaN(r.value)},"Array | Matrix":function(r){return tQ(r,Number.isNaN)}})}),uF="isPrime",uS=(r=>{var{typed:e}=r;return e(uF,{number:function(r){if(0*r!=0)return!1;if(r<=3)return r>1;if(r%2==0||r%3==0)return!1;for(var e=5;e*e<=r;e+=6)if(r%e==0||r%(e+2)==0)return!1;return!0},BigNumber:function(r){if(0*r.toNumber()!=0)return!1;if(r.lte(3))return r.gt(1);if(r.mod(2).eq(0)||r.mod(3).eq(0))return!1;if(r.lt(0x100000000)){for(var e=r.toNumber(),t=5;t*t<=e;t+=6)if(e%t==0||e%(t+2)==0)return!1;return!0}r=new(r.constructor.clone({precision:2*r.toFixed(0).length}))(r);for(var n=0,i=r.sub(1);i.mod(2).eq(0);)i=i.div(2),n+=1;var u=null;if(r.lt("3317044064679887385961981"))u=[2,3,5,7,11,13,17,19,23,29,31,37,41].filter(e=>e<r);else{var a=Math.min(r.toNumber()-2,Math.floor(2*Math.pow(r.toFixed(0).length*Math.log(10),2)));u=[];for(var o=2;o<=a;o+=1)u.push(a)}for(var s=0;s<u.length;s+=1){var f=u[s],c=function(r,e,t){for(var n=1;!e.eq(0);)e.mod(2).eq(0)?(e=e.div(2),r=r.mul(r).mod(t)):(e=e.sub(1),n=r.mul(n).mod(t));return n}(r.sub(r).add(f),i,r);if(!c.eq(1)){for(var l=0,h=c;!h.eq(r.sub(1));l+=1,h=h.mul(h).mod(r))if(l===n-1)return!1}}return!0},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})},"randomInt"),u_=(r=>{var{typed:e,config:t,on:n}=r,i=i7(t.randomSeed);return n&&n("config",function(r,e){r.randomSeed!==e.randomSeed&&(i=i7(r.randomSeed))}),e(uS,{"":()=>a(0,1),number:r=>a(0,r),"number, number":(r,e)=>a(r,e),"Array | Matrix":r=>u(r,0,1),"Array | Matrix, number":(r,e)=>u(r,0,e),"Array | Matrix, number, number":(r,e,t)=>u(r,e,t)});function u(r,e,t){var n=ut(r.valueOf(),()=>a(e,t));return rV(r)?r.create(n):n}
1function a(r,e){return Math.floor(r+i()*(e-r))}},"sech"),uB=(r=>{var{typed:e,BigNumber:t}=r;return e(u_,{number:nF,Complex:r=>r.sech(),BigNumber:r=>new t(1).div(r.cosh())})},"sinh"),uT=(r=>{var{typed:e}=r;return e(uB,{number:nS,"Complex | BigNumber":r=>r.sinh()})},"sparse"),uO=(r=>{var{typed:e,SparseMatrix:t}=r;return e(uT,{"":function(){return new t([])},string:function(r){return new t([],r)},"Array | Matrix":function(r){return new t(r)},"Array | Matrix, string":function(r,e){return new t(r,e)}})},ey("sqrt",["config","typed","Complex"],r=>{var{config:e,typed:t,Complex:n}=r;return t("sqrt",{number:i,Complex:function(r){return r.sqrt()},BigNumber:function(r){return!r.isNegative()||e.predictable?r.sqrt():i(r.toNumber())},Unit:function(r){return r.pow(.5)}});function i(r){return isNaN(r)?NaN:r>=0||e.predictable?Math.sqrt(r):new n(r,0).sqrt()}})),uz=(r=>{var{typed:e}=r;return e("tanh",{number:eV,"Complex | BigNumber":r=>r.tanh()})},"unaryMinus"),uI=ey(uz,["typed"],r=>{var{typed:e}=r;return e(uz,{number:t9,"Complex | BigNumber | Fraction":r=>r.neg(),Unit:e.referToSelf(r=>t=>{var n=t.clone();return n.value=e.find(r,n.valueType())(t.value),n}),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0))})}),uR="acoth",uU=(r=>{var{typed:e,config:t,Complex:n,BigNumber:i}=r;return e(uR,{number:function(r){return r>=1||r<=-1||t.predictable?ng(r):new n(r,0).acoth()},Complex:function(r){return r.acoth()},BigNumber:function(r){return new i(1).div(r).atanh()}})},"coth"),uP=(r=>{var{typed:e,BigNumber:t}=r;return e(uU,{number:nw,Complex:r=>r.coth(),BigNumber:r=>new t(1).div(r.tanh())})},ey("fraction",["typed","Fraction"],r=>{var{typed:e,Fraction:t}=r;return e("fraction",{number:function(r){if(!isFinite(r)||isNaN(r))throw Error(r+" cannot be represented as a fraction");return new t(r)},string:function(r){return new t(r)},"number, number":function(r,e){return new t(r,e)},null:function(r){return new t(0)},BigNumber:function(r){return new t(r.toString())},Fraction:function(r){return r},Unit:e.referToSelf(r=>e=>{var t=e.clone();return t.value=r(e.value),t}),Object:function(r){return new t(r)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})})),uj="isNumeric",uk=ey(uj,["typed"],r=>{var{typed:e}=r;return e(uj,{"number | BigNumber | Fraction | boolean":()=>!0,"Complex | Unit | string | null | undefined | Node":()=>!1,"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})}),uq="matrix",uL=ey(uq,["typed","Matrix","DenseMatrix","SparseMatrix"],r=>{var{typed:e,Matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(uq,{"":function(){return u([])},string:function(r){return u([],r)},"string, string":function(r,e){return u([],r,e)},Array:function(r){return u(r)},Matrix:function(r){return u(r,r.storage())},"Array | Matrix, string":u,"Array | Matrix, string, string":u});function u(r,e,t){if("dense"===e||"default"===e||void 0===e)return new n(r,t);if("sparse"===e)return new i(r,t);throw TypeError("Unknown matrix type "+JSON.stringify(e)+".")}}),uH="matrixFromFunction",uG=(r=>{var{typed:e,matrix:t,isZero:n}=r;return e(uH,{"Array | Matrix, function, string, string":function(r,e,t,n){return i(r,e,t,n)},"Array | Matrix, function, string":function(r,e,t){return i(r,e,t)},"Matrix, function":function(r,e){return i(r,e,"dense")},"Array, function":function(r,e){return i(r,e,"dense").toArray()},"Array | Matrix, string, function":function(r,e,t){return i(r,t,e)},"Array | Matrix, string, string, function":function(r,e,t,n){return i(r,n,e,t)}});function i(r,e,i,u){var a;return(a=void 0!==u?t(i,u):t(i)).resize(r),a.forEach(function(r,t){var i=e(t);n(i)||a.set(t,i)}),a}},"mode");function uV(){throw Error('No "bignumber" implementation available')}function uZ(){throw Error('No "fraction" implementation available')}function uY(){throw Error('No "matrix" implementation available')}r=>{var{typed:e,isNaN:t,isNumeric:n}=r;return e(uG,{"Array | Matrix":i,"...":function(r){return i(r)}});function i(r){if(0===(r=tN(r.valueOf())).length)throw Error("Cannot calculate mode of an empty array");for(var e={},i=[],u=0,a=0;a<r.length;a++){var o=r[a];if(n(o)&&t(o))throw Error("Cannot calculate mode of an array containing NaN values");o in e||(e[o]=0),e[o]++,e[o]===u?i.push(o):e[o]>u&&(u=e[o],i=[o])}return i}};var uX=ey("numeric",["number","?bignumber","?fraction"],r=>{var{number:e,bignumber:t,fraction:n}=r,i={string:!0,number:!0,BigNumber:!0,Fraction:!0},u={number:r=>e(r),BigNumber:t?r=>t(r):uV,Fraction:n?r=>n(r):uZ};return function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"number",t=arguments.length>2?arguments[2]:void 0;
1if(void 0!==t)throw SyntaxError("numeric() takes one or two arguments");var n=ep(r);if(!(n in i))throw TypeError("Cannot convert "+r+' of type "'+n+'"; valid input types are '+Object.keys(i).join(", "));if(!(e in u))throw TypeError("Cannot convert "+r+' to type "'+e+'"; valid output types are '+Object.keys(u).join(", "));return e===n?r:u[e](r)}});function uJ(r,e,t){var n;return -1!==String(r).indexOf("Unexpected type")?(n=arguments.length>2?" (type: "+ep(t)+", value: "+JSON.stringify(t)+")":" (type: "+r.data.actual+")",TypeError("Cannot calculate "+e+", unexpected type of argument"+n)):-1!==String(r).indexOf("complex numbers")?(n=arguments.length>2?" (type: "+ep(t)+", value: "+JSON.stringify(t)+")":"",TypeError("Cannot calculate "+e+", no ordering relation is defined for complex numbers"+n)):r}var uW="prod",u$=ey(uW,["typed","config","multiplyScalar","numeric"],r=>{var{typed:e,config:t,multiplyScalar:n,numeric:i}=r;return e(uW,{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(r,e){throw Error("prod(A, dim) is not yet supported")},"...":function(r){return u(r)}});function u(r){var e;if(t$(r,function(r){try{e=void 0===e?r:n(e,r)}catch(e){throw uJ(e,"prod",r)}}),"string"==typeof e&&(e=i(e,t.number)),void 0===e)throw Error("Cannot calculate prod of an empty array");return e}}),uQ="reshape",uK=ey(uQ,["typed","isInteger","matrix"],r=>{var{typed:e,isInteger:t}=r;return e(uQ,{"Matrix, Array":function(r,e){return r.reshape(e,!0)},"Array, Array":function(r,e){return e.forEach(function(r){if(!t(r))throw TypeError("Invalid size for dimension: "+r)}),tD(r,e)}})}),u0="size",u1=ey(u0,["typed","config","?matrix"],r=>{var{typed:e,config:t,matrix:n}=r;return e(u0,{Matrix:function(r){return r.create(r.size())},Array:tm,string:function(r){return"Array"===t.matrix?[r.length]:n([r.length])},"number | Complex | BigNumber | Unit | boolean | null":function(r){return"Array"===t.matrix?[]:n?n([]):uY()}})}),u2="squeeze",u3=(r=>{var{typed:e,matrix:t}=r;return e(u2,{Array:function(r){return tA(em(r))},Matrix:function(r){var e=tA(r.toArray());return Array.isArray(e)?t(e):e},any:function(r){return em(r)}})},"transpose"),u8=ey(u3,["typed","matrix"],r=>{var{typed:e,matrix:t}=r;return e(u3,{Array:r=>n(t(r)).valueOf(),Matrix:n,any:em});function n(r){var e,t=r.size();switch(t.length){case 1:e=r.clone();break;case 2:var n=t[0],i=t[1];if(0===i)throw RangeError("Cannot transpose a 2D matrix with no columns (size: "+ts(t)+")");switch(r.storage()){case"dense":e=function(r,e,t){for(var n,i=r._data,u=[],a=0;a<t;a++){n=u[a]=[];for(var o=0;o<e;o++)n[o]=em(i[o][a])}return r.createDenseMatrix({data:u,size:[t,e],datatype:r._datatype})}(r,n,i);break;case"sparse":e=function(r,e,t){for(var n,i,u,a=r._values,o=r._index,s=r._ptr,f=a?[]:void 0,c=[],l=[],h=[],p=0;p<e;p++)h[p]=0;for(n=0,i=o.length;n<i;n++)h[o[n]]++;for(var m=0,v=0;v<e;v++)l.push(m),m+=h[v],h[v]=l[v];for(l.push(m),u=0;u<t;u++)for(var d=s[u],g=s[u+1],y=d;y<g;y++){var b=h[o[y]]++;c[b]=u,a&&(f[b]=em(a[y]))}return r.createSparseMatrix({values:f,index:c,ptr:l,size:[t,e],datatype:r._datatype})}(r,n,i)}break;default:throw RangeError("Matrix must be a vector or two dimensional (size: "+ts(t)+")")}return e}}),u5="xgcd",u4=ey(u5,["typed","config","matrix","BigNumber"],r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(u5,{"number, number":function(r,e){var i=ns(r,e);return"Array"===t.matrix?i:n(i)},"BigNumber, BigNumber":function(r,e){var u,a,o,s,f=new i(0),c=new i(1),l=f,h=c,p=c,m=f;if(!r.isInt()||!e.isInt())throw Error("Parameters in function xgcd must be integer numbers");for(;!e.isZero();)a=r.div(e).floor(),o=r.mod(e),u=l,l=h.minus(a.times(l)),h=u,u=p,p=m.minus(a.times(p)),m=u,r=e,e=o;return s=r.lt(f)?[r.neg(),h.neg(),m.neg()]:[r,r.isZero()?0:h,m],"Array"===t.matrix?s:n(s)}})}),u7="zeros",u9=ey(u7,["typed","config","matrix","BigNumber"],r=>{var{typed:e,config:t,matrix:n,BigNumber:i}=r;return e(u7,{"":function(){return"Array"===t.matrix?u([]):u([],"default")},"...number | BigNumber | string":function(r){if("string"==typeof r[r.length-1]){var e=r.pop();return u(r,e)}return"Array"===t.matrix?u(r):u(r,"default")},Array:u,Matrix:function(r){var e=r.storage();return u(r.valueOf(),e)},"Array | Matrix, string":function(r,e){return u(r.valueOf(),e)}});function u(r,e){var t,u=(t=!1,r.forEach(function(r,e,n){rj(r)&&(t=!0,n[e]=r.toNumber())}),t)?new i(0):0;if(r.forEach(function(r){if("number"!=typeof r||!eA(r)||r<0)throw Error("Parameters in function zeros must be positive integers")}),e){var a=n(e);return r.length>0?a.resize(r,u):a}var o=[];return r.length>0?tb(o,r,u):o}}),u6="asin",ar=(r=>{var{typed:e,config:t,Complex:n}=r;return e(u6,{number:function(r){return r>=-1&&r<=1||t.predictable?Math.asin(r):new n(r,0).asin()},Complex:function(r){return r.asin()},BigNumber:function(r){return r.asin()}})},"cbrt"),ae=ey(ar,["config","typed","isNegative","unaryMinus","matrix","Complex","BigNumber","Fraction"],r=>{var{config:e,typed:t,isNegative:n,unaryMinus:i,matrix:u,Complex:a,BigNumber:o,Fraction:s}=r;return t(ar,{number:nr,Complex:f,"Complex, boolean":f,BigNumber:function(r){return r.cbrt()},Unit:function(r){if(r.value&&rk(r.value)){var e=r.clone();return e.value=1,(e=e.pow(1/3)).value=f(r.value),e}var t,u=n(r.value);u&&(r.value=i(r.value)),t=rj(r.value)?new o(1).div(3):rq(r.value)?new s(1,3):1/3;var a=r.pow(t);return u&&(a.value=i(a.value)),a}});function f(r,t){var n=r.arg()/3,i=r.abs(),o=new a(nr(i),0).mul(new a(0,n).exp());if(!t)return o;var s=[o,new a(nr(i),0).mul(new a(0,n+2*Math.PI/3).exp()),new a(nr(i),0).mul(new a(0,n-2*Math.PI/3).exp())];return"Array"===e.matrix?s:u(s)}}),at="concat",an=ey(at,["typed","matrix","isInteger"],r=>{var{typed:e,matrix:t,isInteger:n}=r;return e(at,{"...Array | Matrix | number | BigNumber":function(r){var e,i,u=r.length,a=-1,o=!1,s=[];for(e=0;e<u;e++){var f=r[e];if(rV(f)&&(o=!0),rP(f)||rj(f)){if(e!==u-1)throw Error("Dimension must be specified as last argument");
1if(i=a,!n(a=f.valueOf()))throw TypeError("Integer number expected for dimension");if(a<0||e>0&&a>i)throw new tp(a,i+1)}else{var c=em(f).valueOf(),l=tm(c);if(s[e]=c,i=a,a=l.length-1,e>0&&a!==i)throw new th(i+1,a+1)}}if(0===s.length)throw SyntaxError("At least one matrix expected");for(var h=s.shift();s.length;)h=t_(h,s.shift(),a);return o?t(h):h},"...string":function(r){return r.join("")}})}),ai="count",au=(r=>{var{typed:e,size:t,prod:n}=r;return e(ai,{string:function(r){return r.length},"Matrix | Array":function(r){return n(t(r))}})},"ctranspose"),aa=ey(au,["typed","transpose","conj"],r=>{var{typed:e,transpose:t,conj:n}=r;return e(au,{any:function(r){return n(t(r))}})}),ao="diag",as=ey(ao,["typed","matrix","DenseMatrix","SparseMatrix"],r=>{var{typed:e,matrix:t,DenseMatrix:n,SparseMatrix:i}=r;return e(ao,{Array:function(r){return u(r,0,tm(r),null)},"Array, number":function(r,e){return u(r,e,tm(r),null)},"Array, BigNumber":function(r,e){return u(r,e.toNumber(),tm(r),null)},"Array, string":function(r,e){return u(r,0,tm(r),e)},"Array, number, string":function(r,e,t){return u(r,e,tm(r),t)},"Array, BigNumber, string":function(r,e,t){return u(r,e.toNumber(),tm(r),t)},Matrix:function(r){return u(r,0,r.size(),r.storage())},"Matrix, number":function(r,e){return u(r,e,r.size(),r.storage())},"Matrix, BigNumber":function(r,e){return u(r,e.toNumber(),r.size(),r.storage())},"Matrix, string":function(r,e){return u(r,0,r.size(),e)},"Matrix, number, string":function(r,e,t){return u(r,e,r.size(),t)},"Matrix, BigNumber, string":function(r,e,t){return u(r,e.toNumber(),r.size(),t)}});function u(r,e,u,a){if(!eA(e))throw TypeError("Second parameter in function diag must be an integer");var o=e>0?e:0,s=e<0?-e:0;switch(u.length){case 1:var f=r,c=e,l=a,h=u[0],p=s,m=o,v=[h+p,h+m];if(l&&"sparse"!==l&&"dense"!==l)throw TypeError("Unknown matrix type ".concat(l,'"'));var d="sparse"===l?i.diagonal(v,f,c):n.diagonal(v,f,c);return null!==l?d:d.valueOf();case 2:var g=r,y=e,b=a,D=u,x=s,E=o;if(rV(g)){var A=g.diagonal(y);return null!==b?b!==A.storage()?t(A,b):A:A.valueOf()}for(var w=Math.min(D[0]-x,D[1]-E),N=[],M=0;M<w;M++)N[M]=g[M+x][M+E];return null!==b?t(N):N}throw RangeError("Matrix for function diag must be 2 dimensional")}}),af="divideScalar",ac=ey(af,["typed","numeric"],r=>{var{typed:e,numeric:t}=r;return e(af,{"number, number":function(r,e){return r/e},"Complex, Complex":function(r,e){return r.div(e)},"BigNumber, BigNumber":function(r,e){return r.div(e)},"Fraction, Fraction":function(r,e){return r.div(e)},"Unit, number | Complex | Fraction | BigNumber | Unit":(r,e)=>r.divide(e),"number | Fraction | Complex | BigNumber, Unit":(r,e)=>e.divideInto(r)})}),al=ey("matAlgo02xDS0",["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return function(r,n,i,u){var a,o=r._data,s=r._size,f=r._datatype||r.getDataType(),c=n._values,l=n._index,h=n._ptr,p=n._size,m=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(s.length!==p.length)throw new th(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=s[0],d=s[1],g=t,y=0,b=i;"string"==typeof f&&f===m&&"mixed"!==f&&(a=f,g=e.find(t,[a,a]),y=e.convert(0,a),b=e.find(i,[a,a]));for(var D=[],x=[],E=[],A=0;A<d;A++){E[A]=x.length;for(var w=h[A],N=h[A+1],M=w;M<N;M++){var C=l[M],F=u?b(c[M],o[C][A]):b(o[C][A],c[M]);g(F,y)||(x.push(C),D.push(F))}}return E[d]=x.length,n.createSparseMatrix({values:D,index:x,ptr:E,size:[v,d],datatype:f===r._datatype&&m===n._datatype?a:void 0})}}),ah=ey("matAlgo03xDSf",["typed"],r=>{var{typed:e}=r;return function(r,t,n,i){var u,a=r._data,o=r._size,s=r._datatype||r.getDataType(),f=t._values,c=t._index,l=t._ptr,h=t._size,p=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(o.length!==h.length)throw new th(o.length,h.length);if(o[0]!==h[0]||o[1]!==h[1])throw RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+h+")");if(!f)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var m=o[0],v=o[1],d=0,g=n;"string"==typeof s&&s===p&&"mixed"!==s&&(u=s,d=e.convert(0,u),g=e.find(n,[u,u]));for(var y=[],b=0;b<m;b++)y[b]=[];for(var D=[],x=[],E=0;E<v;E++){for(var A=E+1,w=l[E],N=l[E+1],M=w;M<N;M++){var C=c[M];D[C]=i?g(f[M],a[C][E]):g(a[C][E],f[M]),x[C]=A}for(var F=0;F<m;F++)x[F]===A?y[F][E]=D[F]:y[F][E]=i?g(d,a[F][E]):g(a[F][E],d)}return r.createDenseMatrix({data:y,size:[m,v],datatype:s===r._datatype&&p===t._datatype?u:void 0})}}),ap=ey("matAlgo07xSSf",["typed","DenseMatrix"],r=>{var{typed:e,DenseMatrix:t}=r;return function(r,i,u){var a,o,s,f=r._size,c=r._datatype||void 0===r._data?r._datatype:r.getDataType(),l=i._size,h=i._datatype||void 0===i._data?i._datatype:i.getDataType();if(f.length!==l.length)throw new th(f.length,l.length);if(f[0]!==l[0]||f[1]!==l[1])throw RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+l+")");var p=f[0],m=f[1],v=0,d=u;"string"==typeof c&&c===h&&"mixed"!==c&&(a=c,v=e.convert(0,a),d=e.find(u,[a,a]));var g=[];for(o=0;o<p;o++)g[o]=[];var y=[],b=[],D=[],x=[];for(s=0;s<m;s++){var E=s+1;for(n(r,s,D,y,E),n(i,s,x,b,E),o=0;o<p;o++){var A=D[o]===E?y[o]:v,w=x[o]===E?b[o]:v;g[o][s]=d(A,w)}}return new t({data:g,size:[p,m],datatype:c===r._datatype&&h===i._datatype?a:void 0})};function n(r,e,t,n,i){for(var u=r._values,a=r._index,o=r._ptr,s=o[e],f=o[e+1];s<f;s++){var c=a[s];t[c]=i,n[c]=u[s]}}}),am=ey("matAlgo11xS0s",["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return function(r,n,i,u){var a,o=r._values,s=r._index,f=r._ptr,c=r._size,l=r._datatype;if(!o)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=c[0],p=c[1],m=t,v=0,d=i;"string"==typeof l&&(a=l,m=e.find(t,[a,a]),v=e.convert(0,a),n=e.convert(n,a),d=e.find(i,[a,a]));for(var g=[],y=[],b=[],D=0;D<p;D++){b[D]=y.length;for(var x=f[D],E=f[D+1],A=x;A<E;A++){var w=s[A],N=u?d(n,o[A]):d(o[A],n);m(N,v)||(y.push(w),g.push(N))}}return b[p]=y.length,r.createSparseMatrix({values:g,index:y,ptr:b,size:[h,p],datatype:a})}}),av=ey("matAlgo12xSfs",["typed","DenseMatrix"],r=>{var{typed:e,DenseMatrix:t}=r;return function(r,n,i,u){var a,o=r._values,s=r._index,f=r._ptr,c=r._size,l=r._datatype;if(!o)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=c[0],p=c[1],m=i;"string"==typeof l&&(a=l,n=e.convert(n,a),m=e.find(i,[a,a]));for(var v=[],d=[],g=[],y=0;y<p;y++){for(var b=y+1,D=f[y],x=f[y+1],E=D;E<x;E++){var A=s[E];d[A]=o[E],g[A]=b}for(var w=0;w<h;w++)0===y&&(v[w]=[]),g[w]===b?v[w][y]=u?m(n,d[w]):m(d[w],n):v[w][y]=u?m(n,
10):m(0,n)}return new t({data:v,size:[h,p],datatype:a})}}),ad=ey("matAlgo13xDD",["typed"],r=>{var{typed:e}=r;return function(r,t,n){var i,u=r._data,a=r._size,o=r._datatype,s=t._data,f=t._size,c=t._datatype,l=[];if(a.length!==f.length)throw new th(a.length,f.length);for(var h=0;h<a.length;h++){if(a[h]!==f[h])throw RangeError("Dimension mismatch. Matrix A ("+a+") must match Matrix B ("+f+")");l[h]=a[h]}var p=n;"string"==typeof o&&o===c&&(i=o,p=e.find(n,[i,i]));var m=l.length>0?function r(e,t,n,i,u,a){var o=[];if(t===n.length-1)for(var s=0;s<i;s++)o[s]=e(u[s],a[s]);else for(var f=0;f<i;f++)o[f]=r(e,t+1,n,n[t+1],u[f],a[f]);return o}(p,0,l,l[0],u,s):[];return r.createDenseMatrix({data:m,size:l,datatype:i})}}),ag=ey("matAlgo14xDs",["typed"],r=>{var{typed:e}=r;return function(r,t,n,i){var u,a=r._data,o=r._size,s=r._datatype,f=n;"string"==typeof s&&(u=s,t=e.convert(t,u),f=e.find(n,[u,u]));var c=o.length>0?function r(e,t,n,i,u,a,o){var s=[];if(t===n.length-1)for(var f=0;f<i;f++)s[f]=o?e(a,u[f]):e(u[f],a);else for(var c=0;c<i;c++)s[c]=r(e,t+1,n,n[t+1],u[c],a,o);return s}(f,0,o,o[0],a,t,i):[];return r.createDenseMatrix({data:c,size:em(o),datatype:u})}}),ay=ey("broadcast",["concat"],r=>{var{concat:e}=r;return function(r,e){var i=Math.max(r._size.length,e._size.length);if(r._size.length===e._size.length&&r._size.every((r,t)=>r===e._size[t]))return[r,e];for(var u=t(r._size,i,0),a=t(e._size,i,0),o=[],s=0;s<i;s++)o[s]=Math.max(u[s],a[s]);tB(u,o),tB(a,o);var f=r.clone(),c=e.clone();f._size.length<i?f.reshape(t(f._size,i,1)):c._size.length<i&&c.reshape(t(c._size,i,1));for(var l=0;l<i;l++)f._size[l]<o[l]&&(f=n(f,o[l],l)),c._size[l]<o[l]&&(c=n(c,o[l],l));return[f,c]};function t(r,e,t){return[...Array(e-r.length).fill(t),...r]}function n(r,t,n){return e(...Array(t).fill(r),n)}}),ab=ey("matrixAlgorithmSuite",["typed","matrix","concat"],r=>{var{typed:e,matrix:t,concat:n}=r,i=ad({typed:e}),u=ag({typed:e}),a=ay({concat:n});return function(r){var n,o=r.elop,s=r.SD||r.DS;o?(n={"DenseMatrix, DenseMatrix":(r,e)=>i(...a(r,e),o),"Array, Array":(r,e)=>i(...a(t(r),t(e)),o).valueOf(),"Array, DenseMatrix":(r,e)=>i(...a(t(r),e),o),"DenseMatrix, Array":(r,e)=>i(...a(r,t(e)),o)},r.SS&&(n["SparseMatrix, SparseMatrix"]=(e,t)=>r.SS(...a(e,t),o,!1)),r.DS&&(n["DenseMatrix, SparseMatrix"]=(e,t)=>r.DS(...a(e,t),o,!1),n["Array, SparseMatrix"]=(e,n)=>r.DS(...a(t(e),n),o,!1)),s&&(n["SparseMatrix, DenseMatrix"]=(r,e)=>s(...a(e,r),o,!0),n["SparseMatrix, Array"]=(r,e)=>s(...a(t(e),r),o,!0))):(n={"DenseMatrix, DenseMatrix":e.referToSelf(r=>(e,t)=>i(...a(e,t),r)),"Array, Array":e.referToSelf(r=>(e,n)=>i(...a(t(e),t(n)),r).valueOf()),"Array, DenseMatrix":e.referToSelf(r=>(e,n)=>i(...a(t(e),n),r)),"DenseMatrix, Array":e.referToSelf(r=>(e,n)=>i(...a(e,t(n)),r))},r.SS&&(n["SparseMatrix, SparseMatrix"]=e.referToSelf(e=>(t,n)=>r.SS(...a(t,n),e,!1))),r.DS&&(n["DenseMatrix, SparseMatrix"]=e.referToSelf(e=>(t,n)=>r.DS(...a(t,n),e,!1)),n["Array, SparseMatrix"]=e.referToSelf(e=>(n,i)=>r.DS(...a(t(n),i),e,!1))),s&&(n["SparseMatrix, DenseMatrix"]=e.referToSelf(r=>(e,t)=>s(...a(t,e),r,!0)),n["SparseMatrix, Array"]=e.referToSelf(r=>(e,n)=>s(...a(t(n),e),r,!0))));var f=r.scalar||"any";(r.Ds||r.Ss)&&(o?(n["DenseMatrix,"+f]=(r,e)=>u(r,e,o,!1),n[f+", DenseMatrix"]=(r,e)=>u(e,r,o,!0),n["Array,"+f]=(r,e)=>u(t(r),e,o,!1).valueOf(),n[f+", Array"]=(r,e)=>u(t(e),r,o,!0).valueOf()):(n["DenseMatrix,"+f]=e.referToSelf(r=>(e,t)=>u(e,t,r,!1)),n[f+", DenseMatrix"]=e.referToSelf(r=>(e,t)=>u(t,e,r,!0)),n["Array,"+f]=e.referToSelf(r=>(e,n)=>u(t(e),n,r,!1).valueOf()),n[f+", Array"]=e.referToSelf(r=>(e,n)=>u(t(n),e,r,!0).valueOf())));var c=void 0!==r.sS?r.sS:r.Ss;return o?(r.Ss&&(n["SparseMatrix,"+f]=(e,t)=>r.Ss(e,t,o,!1)),c&&(n[f+", SparseMatrix"]=(r,e)=>c(e,r,o,!0))):(r.Ss&&(n["SparseMatrix,"+f]=e.referToSelf(e=>(t,n)=>r.Ss(t,n,e,!1))),c&&(n[f+", SparseMatrix"]=e.referToSelf(r=>(e,t)=>c(t,e,r,!0)))),o&&o.signatures&&ev(n,o.signatures),n}}),aD="dotDivide",ax=ey(aD,["typed","matrix","equalScalar","divideScalar","DenseMatrix","concat"],r=>{var{typed:e,matrix:t,equalScalar:n,divideScalar:i,DenseMatrix:u,concat:a}=r,o=al({typed:e,equalScalar:n}),s=ah({typed:e}),f=ap({typed:e,DenseMatrix:u}),c=am({typed:e,equalScalar:n}),l=av({typed:e,DenseMatrix:u}),h=ab({typed:e,matrix:t,concat:a});return e(aD,h({elop:i,SS:f,DS:s,SD:o,Ss:c,sS:l}))}),aE="equal",aA=ey(aE,["typed","matrix","equalScalar","DenseMatrix","concat"],r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:u}=r,a=ah({typed:e}),o=ap({typed:e,DenseMatrix:i}),s=av({typed:e,DenseMatrix:i}),f=ab({typed:e,matrix:t,concat:u});return e(aE,aw({typed:e,equalScalar:n}),f({elop:n,SS:o,DS:a,Ss:s}))}),aw=ey(aE,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(aE,{"any, any":function(r,e){return null===r?null===e:null===e?null===r:void 0===r?void 0===e:void 0===e?void 0===r:t(r,e)}})}),aN="flatten",aM=ey(aN,["typed","matrix"],r=>{var{typed:e,matrix:t}=r;return e(aN,{Array:function(r){return tN(r)},Matrix:function(r){return t(tN(r.toArray()))}})}),aC="hasNumericValue",aF=(r=>{var{typed:e,isNumeric:t}=r;return e(aC,{boolean:()=>!0,string:function(r){return r.trim().length>0&&!isNaN(Number(r))},any:function(r){return t(r)}})},"identity"),aS=ey(aF,["typed","config","matrix","BigNumber","DenseMatrix","SparseMatrix"],r=>{var{typed:e,config:t,matrix:n,BigNumber:i,DenseMatrix:u,SparseMatrix:a}=r;return e(aF,{"":function(){return"Matrix"===t.matrix?n([]):[]},string:function(r){return n(r)},"number | BigNumber":function(r){return s(r,r,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber, string":function(r,e){return s(r,r,e)},"number | BigNumber, number | BigNumber":function(r,e){return s(r,e,"Matr
1ix"===t.matrix?"dense":void 0)},"number | BigNumber, number | BigNumber, string":function(r,e,t){return s(r,e,t)},Array:function(r){return o(r)},"Array, string":function(r,e){return o(r,e)},Matrix:function(r){return o(r.valueOf(),r.storage())},"Matrix, string":function(r,e){return o(r.valueOf(),e)}});function o(r,e){switch(r.length){case 0:return e?n(e):[];case 1:return s(r[0],r[0],e);case 2:return s(r[0],r[1],e);default:throw Error("Vector containing two values expected")}}function s(r,e,t){var n=rj(r)||rj(e)?i:null;if(rj(r)&&(r=r.toNumber()),rj(e)&&(e=e.toNumber()),!eA(r)||r<1||!eA(e)||e<1)throw Error("Parameters in function identity must be positive integers");var o=n?new i(1):1,s=n?new n(0):0,f=[r,e];if(t){if("sparse"===t)return a.diagonal(f,o,0,s);if("dense"===t)return u.diagonal(f,o,0,s);throw TypeError('Unknown matrix type "'.concat(t,'"'))}for(var c=tb([],f,s),l=r<e?r:e,h=0;h<l;h++)c[h][h]=o;return c}}),a_="kron",aB=(r=>{var{typed:e,matrix:t,multiplyScalar:n}=r;return e(a_,{"Matrix, Matrix":function(r,e){return t(i(r.toArray(),e.toArray()))},"Matrix, Array":function(r,e){return t(i(r.toArray(),e))},"Array, Matrix":function(r,e){return t(i(r,e.toArray()))},"Array, Array":i});function i(r,e){if(1===tm(r).length&&(r=[r]),1===tm(e).length&&(e=[e]),tm(r).length>2||tm(e).length>2)throw RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(r.length)+", y = "+JSON.stringify(e.length)+")");var t=[],i=[];return r.map(function(r){return e.map(function(e){return i=[],t.push(i),r.map(function(r){return e.map(function(e){return i.push(n(r,e))})})})})&&t}},"largerEq"),aT=ey(aB,["typed","config","matrix","DenseMatrix","concat"],r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:u}=r,a=ah({typed:e}),o=ap({typed:e,DenseMatrix:i}),s=av({typed:e,DenseMatrix:i}),f=ab({typed:e,matrix:n,concat:u}),c=ia({typed:e});return e(aB,aO({typed:e,config:t}),{"boolean, boolean":(r,e)=>r>=e,"BigNumber, BigNumber":function(r,e){return r.gte(e)||iu(r,e,t.epsilon)},"Fraction, Fraction":(r,e)=>-1!==r.compare(e),"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},c,f({SS:o,DS:a,Ss:s}))}),aO=ey(aB,["typed","config"],r=>{var{typed:e,config:t}=r;return e(aB,{"number, number":function(r,e){return r>=e||ej(r,e,t.epsilon)}})}),az=ey("matAlgo01xDSid",["typed"],r=>{var{typed:e}=r;return function(r,t,n,i){var u,a,o=r._data,s=r._size,f=r._datatype||r.getDataType(),c=t._values,l=t._index,h=t._ptr,p=t._size,m=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(s.length!==p.length)throw new th(s.length,p.length);if(s[0]!==p[0]||s[1]!==p[1])throw RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+p+")");if(!c)throw Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var v=s[0],d=s[1],g="string"==typeof f&&"mixed"!==f&&f===m?f:void 0,y=g?e.find(n,[g,g]):n,b=[];for(u=0;u<v;u++)b[u]=[];var D=[],x=[];for(a=0;a<d;a++){for(var E=a+1,A=h[a],w=h[a+1],N=A;N<w;N++)D[u=l[N]]=i?y(c[N],o[u][a]):y(o[u][a],c[N]),x[u]=E;for(u=0;u<v;u++)x[u]===E?b[u][a]=D[u]:b[u][a]=o[u][a]}return r.createDenseMatrix({data:b,size:[v,d],datatype:f===r._datatype&&m===t._datatype?g:void 0})}}),aI=ey("matAlgo10xSids",["typed","DenseMatrix"],r=>{var{typed:e,DenseMatrix:t}=r;return function(r,n,i,u){var a,o=r._values,s=r._index,f=r._ptr,c=r._size,l=r._datatype;if(!o)throw Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var h=c[0],p=c[1],m=i;"string"==typeof l&&(a=l,n=e.convert(n,a),m=e.find(i,[a,a]));for(var v=[],d=[],g=[],y=0;y<p;y++){for(var b=y+1,D=f[y],x=f[y+1],E=D;E<x;E++){var A=s[E];d[A]=o[E],g[A]=b}for(var w=0;w<h;w++)0===y&&(v[w]=[]),g[w]===b?v[w][y]=u?m(n,d[w]):m(d[w],n):v[w][y]=n}return new t({data:v,size:[h,p],datatype:a})}}),aR=ey("matAlgo08xS0Sid",["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return function(r,n,i){var u,a,o,s,f,c=r._values,l=r._index,h=r._ptr,p=r._size,m=r._datatype||void 0===r._data?r._datatype:r.getDataType(),v=n._values,d=n._index,g=n._ptr,y=n._size,b=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(p.length!==y.length)throw new th(p.length,y.length);if(p[0]!==y[0]||p[1]!==y[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+y+")");if(!c||!v)throw Error("Cannot perform operation on Pattern Sparse Matrices");
1var D=p[0],x=p[1],E=t,A=0,w=i;"string"==typeof m&&m===b&&"mixed"!==m&&(u=m,E=e.find(t,[u,u]),A=e.convert(0,u),w=e.find(i,[u,u]));for(var N=[],M=[],C=[],F=[],S=[],_=0;_<x;_++){C[_]=M.length;var B=_+1;for(o=h[_],s=h[_+1],a=o;a<s;a++)S[f=l[a]]=B,F[f]=c[a],M.push(f);for(o=g[_],s=g[_+1],a=o;a<s;a++)S[f=d[a]]===B&&(F[f]=w(F[f],v[a]));for(a=C[_];a<M.length;){var T=F[f=M[a]];E(T,A)?M.splice(a,1):(N.push(T),a++)}}return C[x]=M.length,r.createSparseMatrix({values:N,index:M,ptr:C,size:[D,x],datatype:m===r._datatype&&b===n._datatype?u:void 0})}}),aU=ey("useMatrixForArrayScalar",["typed","matrix"],r=>{var{typed:e,matrix:t}=r;return{"Array, number":e.referTo("DenseMatrix, number",r=>(e,n)=>r(t(e),n).valueOf()),"Array, BigNumber":e.referTo("DenseMatrix, BigNumber",r=>(e,n)=>r(t(e),n).valueOf()),"number, Array":e.referTo("number, DenseMatrix",r=>(e,n)=>r(e,t(n)).valueOf()),"BigNumber, Array":e.referTo("BigNumber, DenseMatrix",r=>(e,n)=>r(e,t(n)).valueOf())}}),aP="leftShift";function aj(r){var{DenseMatrix:e}=r;return function(r,t,n){var i=r.size();if(2!==i.length)throw RangeError("Matrix must be two dimensional (size: "+ts(i)+")");var u=i[0];if(u!==i[1])throw RangeError("Matrix must be square (size: "+ts(i)+")");var a=[];if(rV(t)){var o=t.size(),s=t._data;if(1===o.length){if(o[0]!==u)throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var f=0;f<u;f++)a[f]=[s[f]];return new e({data:a,size:[u,1],datatype:t._datatype})}if(2===o.length){if(o[0]!==u||1!==o[1])throw RangeError("Dimension mismatch. Matrix columns must match vector length.");if(rY(t)){if(n){a=[];for(var c=0;c<u;c++)a[c]=[s[c][0]];return new e({data:a,size:[u,1],datatype:t._datatype})}return t}if(rX(t)){for(var l=0;l<u;l++)a[l]=[0];for(var h=t._values,p=t._index,m=t._ptr,v=m[1],d=m[0];d<v;d++)a[p[d]][0]=h[d];return new e({data:a,size:[u,1],datatype:t._datatype})}}throw RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}if(rG(t)){var g=tm(t);if(1===g.length){if(g[0]!==u)throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var y=0;y<u;y++)a[y]=[t[y]];return new e({data:a,size:[u,1]})}if(2===g.length){if(g[0]!==u||1!==g[1])throw RangeError("Dimension mismatch. Matrix columns must match vector length.");for(var b=0;b<u;b++)a[b]=[t[b][0]];return new e({data:a,size:[u,1]})}throw RangeError("Dimension mismatch. The right side has to be either 1- or 2-dimensional vector.")}}}r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:u,concat:a}=r,o=az({typed:e}),s=al({typed:e,equalScalar:n}),f=aR({typed:e,equalScalar:n}),c=aI({typed:e,DenseMatrix:u}),l=am({typed:e,equalScalar:n}),h=ag({typed:e}),p=ab({typed:e,matrix:t,concat:a}),m=aU({typed:e,matrix:t});return e(aP,{"number, number":n$,"BigNumber, BigNumber":nG,"SparseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>n(t,0)?e.clone():l(e,t,r,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>n(t,0)?e.clone():h(e,t,r,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(r=>(e,t)=>n(e,0)?i(t.size(),t.storage()):c(t,e,r,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(r=>(e,t)=>n(e,0)?i(t.size(),t.storage()):h(t,e,r,!0))},m,p({SS:f,DS:o,SD:s}))};var ak="lsolve",aq=ey(ak,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:u,equalScalar:a,DenseMatrix:o}=r,s=aj({DenseMatrix:o});return e(ak,{"SparseMatrix, Array | Matrix":function(r,e){return function(r,e){for(var t=(e=s(r,e,!0))._data,f=r._size[0],c=r._size[1],l=r._values,h=r._index,p=r._ptr,m=[],v=0;v<c;v++){var d=t[v][0]||0;if(a(d,0))m[v]=[0];else{for(var g=0,y=[],b=[],D=p[v],x=p[v+1],E=D;E<x;E++){var A=h[E];A===v?g=l[E]:A>v&&(y.push(l[E]),b.push(A))}
1if(a(g,0))throw Error("Linear system cannot be solved since matrix is singular");for(var w=n(d,g),N=0,M=b.length;N<M;N++){var C=b[N];t[C]=[u(t[C][0]||0,i(w,y[N]))]}m[v]=[w]}}return new o({data:m,size:[f,1]})}(r,e)},"DenseMatrix, Array | Matrix":function(r,e){return f(r,e)},"Array, Array | Matrix":function(r,e){return f(t(r),e).valueOf()}});function f(r,e){for(var t=(e=s(r,e,!0))._data,f=r._size[0],c=r._size[1],l=[],h=r._data,p=0;p<c;p++){var m=t[p][0]||0,v=void 0;if(a(m,0))v=0;else{var d=h[p][p];if(a(d,0))throw Error("Linear system cannot be solved since matrix is singular");v=n(m,d);for(var g=p+1;g<f;g++)t[g]=[u(t[g][0]||0,i(v,h[g][p]))]}l[p]=[v]}return new o({data:l,size:[f,1]})}}),aL="matrixFromColumns",aH=ey(aL,["typed","matrix","flatten","size"],r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(aL,{"...Array":function(r){return u(r)},"...Matrix":function(r){return t(u(r.map(r=>r.toArray())))}});function u(r){if(0===r.length)throw TypeError("At least one column is needed to construct a matrix.");for(var e=a(r[0]),t=[],i=0;i<e;i++)t[i]=[];for(var u of r){var o=a(u);if(o!==e)throw TypeError("The vectors had different length: "+(0|e)+" ≠"+(0|o));for(var s=n(u),f=0;f<e;f++)t[f].push(s[f])}return t}function a(r){var e=i(r);if(1===e.length)return e[0];if(2===e.length)if(1===e[0])return e[1];else if(1===e[1])return e[0];else throw TypeError("At least one of the arguments is not a vector.");throw TypeError("Only one- or two-dimensional vectors are supported.")}}),aG=ey("matAlgo06xS0S0",["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return function(r,n,i){var u,a=r._values,o=r._size,s=r._datatype||void 0===r._data?r._datatype:r.getDataType(),f=n._values,c=n._size,l=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(o.length!==c.length)throw new th(o.length,c.length);if(o[0]!==c[0]||o[1]!==c[1])throw RangeError("Dimension mismatch. Matrix A ("+o+") must match Matrix B ("+c+")");var h=o[0],p=o[1],m=t,v=0,d=i;"string"==typeof s&&s===l&&"mixed"!==s&&(u=s,m=e.find(t,[u,u]),v=e.convert(0,u),d=e.find(i,[u,u]));for(var g=a&&f?[]:void 0,y=[],b=[],D=g?[]:void 0,x=[],E=[],A=0;A<p;A++){b[A]=y.length;var w=A+1;if(t1(r,A,x,D,E,w,y,d),t1(n,A,x,D,E,w,y,d),D)for(var N=b[A];N<y.length;){var M=y[N];if(E[M]===w){var C=D[M];m(C,v)?y.splice(N,1):(g.push(C),N++)}else y.splice(N,1)}else for(var F=b[A];F<y.length;)E[y[F]]!==w?y.splice(F,1):F++}return b[p]=y.length,r.createSparseMatrix({values:g,index:y,ptr:b,size:[h,p],datatype:s===r._datatype&&l===n._datatype?u:void 0})}}),aV="nthRoot",aZ=(r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,concat:u}=r,a=az({typed:e}),o=al({typed:e,equalScalar:n}),s=aG({typed:e,equalScalar:n}),f=am({typed:e,equalScalar:n}),c=ab({typed:e,matrix:t,concat:u});function l(){throw Error("Complex number not supported in function nthRoot. Use nthRoots instead.")}return e(aV,{number:nu,"number, number":nu,BigNumber:r=>h(r,new i(2)),"BigNumber, BigNumber":h,Complex:l,"Complex, number":l,Array:e.referTo("DenseMatrix,number",r=>e=>r(t(e),2).valueOf()),DenseMatrix:e.referTo("DenseMatrix,number",r=>e=>r(e,2)),SparseMatrix:e.referTo("SparseMatrix,number",r=>e=>r(e,2)),"SparseMatrix, SparseMatrix":e.referToSelf(r=>(e,t)=>{if(1===t.density())return s(e,t,r);throw Error("Root must be non-zero")}),"DenseMatrix, SparseMatrix":e.referToSelf(r=>(e,t)=>{if(1===t.density())return a(e,t,r,!1);throw Error("Root must be non-zero")}),"Array, SparseMatrix":e.referTo("DenseMatrix,SparseMatrix",r=>(e,n)=>r(t(e),n)),"number | BigNumber, SparseMatrix":e.referToSelf(r=>(e,t)=>{if(1===t.density())return f(t,e,r,!0);throw Error("Root must be non-zero")})},c({scalar:"number | BigNumber",SD:o,Ss:f,sS:!1}));function h(r,e){var t=i.precision,n=i.clone({precision:t+2}),u=new i(0),a=new n(1),o=e.isNegative();if(o&&(e=e.neg()),e.isZero())throw Error("Root must be non-zero");if(r.isNegative()&&!e.abs().mod(2).equals(1))throw Error("Root must be odd when a is negative.");if(r.isZero())return o?new n(1/0):0;if(!r.isFinite())return o?u:r;var s=r.abs().pow(a.div(e));return s=r.isNeg()?s.neg():s,new i((o?a.div(s):s).toPrecision(t))}},ey("qr",["typed","matrix","zeros","identity","isZero","equal","sign","sqrt","conj","unaryMinus","addScalar","divideScalar","multiplyScalar","subtractScalar","complex"],r=>{var{typed:e,matrix:t,zeros:i,identity:u,isZero:a,equal:o,sign:s,sqrt:f,conj:c,unaryMinus:l,addScalar:h,divideScalar:p,multiplyScalar:m,subtractScalar:v,complex:d}=r;return(0,n.A)(e("qr",{DenseMatrix:function(r){return y(r)},SparseMatrix:function(r){var e=0;throw Error("qr not implemented for sparse matrices yet")},Array:function(r){var e=y(t(r));return{Q:e.Q.valueOf(),R:e.R.valueOf()}}}),{_denseQRimpl:g});function g(r){var e,t,n,d=r._size[0],g=r._size[1],y=u([d],"dense"),b=y._data,D=r.clone(),x=D._data,E=i([d],"");for(n=0;n<Math.min(g,d);++n){var A=x[n][n],w=l(o(A,0)?1:s(A)),N=c(w),M=0;for(e=n;e<d;e++)M=h(M,m(x[e][n],c(x[e][n])));var C=m(w,f(M));if(!a(C)){var F=v(A,C);for(E[n]=1,e=n+1;
1e<d;e++)E[e]=p(x[e][n],F);var S=l(c(p(F,C))),_=void 0;for(t=n;t<g;t++){for(_=0,e=n;e<d;e++)_=h(_,m(c(E[e]),x[e][t]));for(_=m(_,S),e=n;e<d;e++)x[e][t]=m(v(x[e][t],m(E[e],_)),N)}for(e=0;e<d;e++){for(_=0,t=n;t<d;t++)_=h(_,m(b[e][t],E[t]));for(_=m(_,S),t=n;t<d;++t)b[e][t]=p(v(b[e][t],m(_,c(E[t]))),N)}}}return{Q:y,R:D,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}function y(r){var e=g(r),t=e.R._data;if(r._data.length>0)for(var n="Complex"===t[0][0].type?d(0):0,i=0;i<t.length;++i)for(var u=0;u<i&&u<(t[0]||[]).length;++u)t[i][u]=n;return e}}));function aY(r,e,t,n){if(!(this instanceof aY))throw SyntaxError("Constructor must be called with the new operator");this.fn=r,this.count=e,this.min=t,this.max=n,this.message="Wrong number of arguments in function "+r+" ("+e+" provided, "+t+(null!=n?"-"+n:"")+" expected)",this.stack=Error().stack}aY.prototype=Error(),aY.prototype.constructor=Error,aY.prototype.name="ArgumentsError",aY.prototype.isArgumentsError=!0,r=>{var{config:e,matrix:t}=r;return function(r,n,i){if(2!=arguments.length&&3!=arguments.length)throw new aY("resize",arguments.length,2,3);if(rV(n)&&(n=n.valueOf()),rj(n[0])&&(n=n.map(function(r){return rj(r)?r.toNumber():r})),rV(r))return r.resize(n,i,!0);if("string"==typeof r){var u=r,a=n,o=i;if(void 0!==o){if("string"!=typeof o||1!==o.length)throw TypeError("Single character expected as defaultValue")}else o=" ";if(1!==a.length)throw new th(a.length,1);var s=a[0];if("number"!=typeof s||!eA(s))throw TypeError("Invalid size, must contain positive integers (size: "+ts(a)+")");if(u.length>s)return u.substring(0,s);if(!(u.length<s))return u;for(var f=u,c=0,l=s-u.length;c<l;c++)f+=o;return f}var h=!Array.isArray(r)&&"Array"!==e.matrix;if(0===n.length){for(;Array.isArray(r);)r=r[0];return em(r)}Array.isArray(r)||(r=[r]);var p=tb(r=em(r),n,i);return h?t(p):p}};var aX="rightArithShift",aJ=(r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:u,concat:a}=r,o=az({typed:e}),s=al({typed:e,equalScalar:n}),f=aR({typed:e,equalScalar:n}),c=aI({typed:e,DenseMatrix:u}),l=am({typed:e,equalScalar:n}),h=ag({typed:e}),p=ab({typed:e,matrix:t,concat:a}),m=aU({typed:e,matrix:t});return e(aX,{"number, number":nQ,"BigNumber, BigNumber":nV,"SparseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>n(t,0)?e.clone():l(e,t,r,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>n(t,0)?e.clone():h(e,t,r,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(r=>(e,t)=>n(e,0)?i(t.size(),t.storage()):c(t,e,r,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(r=>(e,t)=>n(e,0)?i(t.size(),t.storage()):h(t,e,r,!0))},m,p({SS:f,DS:o,SD:s}))},"Number of decimals in function round must be an integer"),aW="round",a$=ey(aW,["typed","config","matrix","equalScalar","zeros","BigNumber","DenseMatrix"],r=>{var{typed:e,config:t,matrix:n,equalScalar:i,zeros:u,BigNumber:a,DenseMatrix:o}=r,s=am({typed:e,equalScalar:i}),f=av({typed:e,DenseMatrix:o}),c=ag({typed:e});function l(r){return Math.abs(eO(r).exponent)}return e(aW,{number:function(r){var e=nc(r,l(t.epsilon));return nc(ej(r,e,t.epsilon)?e:r)},"number, number":function(r,e){var n=l(t.epsilon);if(e>=n)return nc(r,e);var i=nc(r,n);return nc(ej(r,i,t.epsilon)?i:r,e)},"number, BigNumber":function(r,e){if(!e.isInteger())throw TypeError(aJ);return new a(r).toDecimalPlaces(e.toNumber())},Complex:function(r){return r.round()},"Complex, number":function(r,e){if(e%1)throw TypeError(aJ);return r.round(e)},"Complex, BigNumber":function(r,e){if(!e.isInteger())throw TypeError(aJ);var t=e.toNumber();return r.round(t)},BigNumber:function(r){var e=new a(r).toDecimalPlaces(l(t.epsilon));return(iu(r,e,t.epsilon)?e:r).toDecimalPlaces(0)},"BigNumber, BigNumber":function(r,e){if(!e.isInteger())throw TypeError(aJ);var n=l(t.epsilon);if(e>=n)return r.toDecimalPlaces(e.toNumber());var i=r.toDecimalPlaces(n);return(iu(r,i,t.epsilon)?i:r).toDecimalPlaces(e.toNumber())},Fraction:function(r){return r.round()},"Fraction, number":function(r,e){if(e%1)throw TypeError(aJ);return r.round(e)},"Fraction, BigNumber":function(r,e){if(!e.isInteger())throw TypeError(aJ);return r.round(e.toNumber())},"Unit, number, Unit":e.referToSelf(r=>function(e,t,n){var i=e.toNumeric(n);return n.multiply(r(i,t))}),"Unit, BigNumber, Unit":e.referToSelf(r=>
1(e,t,n)=>r(e,t.toNumber(),n)),"Unit, Unit":e.referToSelf(r=>(e,t)=>r(e,0,t)),"Array | Matrix, number, Unit":e.referToSelf(r=>(e,t,n)=>tQ(e,e=>r(e,t,n),!0)),"Array | Matrix, BigNumber, Unit":e.referToSelf(r=>(e,t,n)=>r(e,t.toNumber(),n)),"Array | Matrix, Unit":e.referToSelf(r=>(e,t)=>r(e,0,t)),"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0)),"SparseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>s(e,t,r,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>c(e,t,r,!1)),"Array, number | BigNumber":e.referToSelf(r=>(e,t)=>c(n(e),t,r,!1).valueOf()),"number | Complex | BigNumber | Fraction, SparseMatrix":e.referToSelf(r=>(e,t)=>i(e,0)?u(t.size(),t.storage()):f(t,e,r,!0)),"number | Complex | BigNumber | Fraction, DenseMatrix":e.referToSelf(r=>(e,t)=>i(e,0)?u(t.size(),t.storage()):c(t,e,r,!0)),"number | Complex | BigNumber | Fraction, Array":e.referToSelf(r=>(e,t)=>c(n(t),e,r,!0).valueOf())})}),aQ="smaller",aK=ey(aQ,["typed","config","matrix","DenseMatrix","concat"],r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:u}=r,a=ah({typed:e}),o=ap({typed:e,DenseMatrix:i}),s=av({typed:e,DenseMatrix:i}),f=ab({typed:e,matrix:n,concat:u}),c=ia({typed:e});return e(aQ,a0({typed:e,config:t}),{"boolean, boolean":(r,e)=>r<e,"BigNumber, BigNumber":function(r,e){return r.lt(e)&&!iu(r,e,t.epsilon)},"Fraction, Fraction":(r,e)=>-1===r.compare(e),"Complex, Complex":function(r,e){throw TypeError("No ordering relation is defined for complex numbers")}},c,f({SS:o,DS:a,Ss:s}))}),a0=ey(aQ,["typed","config"],r=>{var{typed:e,config:t}=r;return e(aQ,{"number, number":function(r,e){return r<e&&!ej(r,e,t.epsilon)}})}),a1=ey("matAlgo05xSfSf",["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return function(r,n,i){var u,a,o,s,f,c=r._values,l=r._index,h=r._ptr,p=r._size,m=r._datatype||void 0===r._data?r._datatype:r.getDataType(),v=n._values,d=n._index,g=n._ptr,y=n._size,b=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(p.length!==y.length)throw new th(p.length,y.length);if(p[0]!==y[0]||p[1]!==y[1])throw RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+y+")");var D=p[0],x=p[1],E=t,A=0,w=i;"string"==typeof m&&m===b&&"mixed"!==m&&(u=m,E=e.find(t,[u,u]),A=e.convert(0,u),w=e.find(i,[u,u]));var N=c&&v?[]:void 0,M=[],C=[],F=N?[]:void 0,S=N?[]:void 0,_=[],B=[];for(o=0;o<x;o++){C[o]=M.length;var T=o+1;for(s=h[o],f=h[o+1];s<f;s++)a=l[s],M.push(a),_[a]=T,F&&(F[a]=c[s]);for(s=g[o],f=g[o+1];s<f;s++)_[a=d[s]]!==T&&M.push(a),B[a]=T,S&&(S[a]=v[s]);if(N)for(s=C[o];s<M.length;){var O=_[a=M[s]],z=B[a];if(O===T||z===T){var I=w(O===T?F[a]:A,z===T?S[a]:A);E(I,A)?M.splice(s,1):(N.push(I),s++)}}}return C[x]=M.length,r.createSparseMatrix({values:N,index:M,ptr:C,size:[D,x],datatype:m===r._datatype&&b===n._datatype?u:void 0})}}),a2="subtract",a3=ey(a2,["typed","matrix","equalScalar","subtractScalar","unaryMinus","DenseMatrix","concat"],r=>{var{typed:e,matrix:t,equalScalar:n,subtractScalar:i,unaryMinus:u,DenseMatrix:a,concat:o}=r,s=az({typed:e}),f=ah({typed:e}),c=a1({typed:e,equalScalar:n}),l=aI({typed:e,DenseMatrix:a}),h=av({typed:e,DenseMatrix:a}),p=ab({typed:e,matrix:t,concat:o});return e(a2,{"any, any":i},p({elop:i,SS:c,DS:s,SD:f,Ss:h,sS:l}))}),a8=(r=>{var{typed:e,matrix:t,concat:n}=r,i=ab({typed:e,matrix:t,concat:n});return e("to",{"Unit, Unit | string":(r,e)=>r.to(e)},i({Ds:!0}))},"unequal"),a5=(r=>{var{typed:e,config:t,equalScalar:n,matrix:i,DenseMatrix:u,concat:a}=r,o=ah({typed:e}),s=ap({typed:e,DenseMatrix:u}),f=av({typed:e,DenseMatrix:u}),c=ab({typed:e,matrix:i,concat:a});return e(a8,a5({typed:e,equalScalar:n}),c({elop:function(r,e){return!n(r,e)},SS:s,DS:o,Ss:f}))},ey(a8,["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return e(a8,{"any, any":function(r,e){return null===r?null!==e:null===e?null!==r:void 0===r?void 0!==e:void 0===e?void 0!==r:!t(r,e)}})})),a4="usolve",a7=ey(a4,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:u,equalScalar:a,DenseMatrix:o}=r,s=aj({DenseMatrix:o});return e(a4,{"SparseMatrix, Array | Matrix":function(r,e){return function(r,e){for(var t=(e=s(r,e,!0))._data,f=r._size[0],c=r._size[1],l=r._values,h=r._index,p=r._ptr,m=[],v=c-1;v>=0;v--){var d=t[v][0]||0;if(a(d,0))m[v]=[0];else{for(var g=0,y=[],b=[],D=p[v],x=p[v+1],E=x-1;E>=D;E--){var A=h[E];A===v?g=l[E]:A<v&&(y.push(l[E]),b.push(A))}
1if(a(g,0))throw Error("Linear system cannot be solved since matrix is singular");for(var w=n(d,g),N=0,M=b.length;N<M;N++){var C=b[N];t[C]=[u(t[C][0],i(w,y[N]))]}m[v]=[w]}}return new o({data:m,size:[f,1]})}(r,e)},"DenseMatrix, Array | Matrix":function(r,e){return f(r,e)},"Array, Array | Matrix":function(r,e){return f(t(r),e).valueOf()}});function f(r,e){for(var t=(e=s(r,e,!0))._data,f=r._size[0],c=r._size[1],l=[],h=r._data,p=c-1;p>=0;p--){var m=t[p][0]||0,v=void 0;if(a(m,0))v=0;else{var d=h[p][p];if(a(d,0))throw Error("Linear system cannot be solved since matrix is singular");v=n(m,d);for(var g=p-1;g>=0;g--)t[g]=[u(t[g][0]||0,i(v,h[g][p]))]}l[p]=[v]}return new o({data:l,size:[f,1]})}}),a9=(r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,u=ah({typed:e}),a=ap({typed:e,DenseMatrix:n}),o=av({typed:e,DenseMatrix:n}),s=ab({typed:e,matrix:t,concat:i});return e("xor",{"number, number":i0,"Complex, Complex":function(r,e){return(0!==r.re||0!==r.im)!=(0!==e.re||0!==e.im)},"BigNumber, BigNumber":function(r,e){return(!r.isZero()&&!r.isNaN())!=(!e.isZero()&&!e.isNaN())},"Unit, Unit":e.referToSelf(r=>(e,t)=>r(e.value||0,t.value||0))},s({SS:a,DS:u,Ss:o}))},ey("matAlgo04xSidSid",["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return function(r,n,i){var u,a,o,s,f,c,l=r._values,h=r._index,p=r._ptr,m=r._size,v=r._datatype||void 0===r._data?r._datatype:r.getDataType(),d=n._values,g=n._index,y=n._ptr,b=n._size,D=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(m.length!==b.length)throw new th(m.length,b.length);if(m[0]!==b[0]||m[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+m+") must match Matrix B ("+b+")");var x=m[0],E=m[1],A=t,w=0,N=i;"string"==typeof v&&v===D&&"mixed"!==v&&(u=v,A=e.find(t,[u,u]),w=e.convert(0,u),N=e.find(i,[u,u]));var M=l&&d?[]:void 0,C=[],F=[],S=l&&d?[]:void 0,_=l&&d?[]:void 0,B=[],T=[];for(o=0;o<E;o++){F[o]=C.length;var O=o+1;for(f=p[o],c=p[o+1],s=f;s<c;s++)a=h[s],C.push(a),B[a]=O,S&&(S[a]=l[s]);for(f=y[o],c=y[o+1],s=f;s<c;s++)if(B[a=g[s]]===O){if(S){var z=N(S[a],d[s]);A(z,w)?B[a]=null:S[a]=z}}else C.push(a),T[a]=O,_&&(_[a]=d[s]);if(S&&_)for(s=F[o];s<C.length;)B[a=C[s]]===O?(M[s]=S[a],s++):T[a]===O?(M[s]=_[a],s++):C.splice(s,1)}return F[E]=C.length,r.createSparseMatrix({values:M,index:C,ptr:F,size:[x,E],datatype:v===r._datatype&&D===n._datatype?u:void 0})}})),a6=ey("add",["typed","matrix","addScalar","equalScalar","DenseMatrix","SparseMatrix","concat"],r=>{var{typed:e,matrix:t,addScalar:n,equalScalar:i,DenseMatrix:u,SparseMatrix:a,concat:o}=r,s=az({typed:e}),f=a9({typed:e,equalScalar:i}),c=aI({typed:e,DenseMatrix:u}),l=ab({typed:e,matrix:t,concat:o});return e("add",{"any, any":n,"any, any, ...any":e.referToSelf(r=>(e,t,n)=>{for(var i=r(e,t),u=0;u<n.length;u++)i=r(i,n[u]);return i})},l({elop:n,DS:s,SS:f,Ss:c}))}),or=ey("matAlgo09xS0Sf",["typed","equalScalar"],r=>{var{typed:e,equalScalar:t}=r;return function(r,n,i){var u,a,o,s,f,c,l=r._values,h=r._index,p=r._ptr,m=r._size,v=r._datatype||void 0===r._data?r._datatype:r.getDataType(),d=n._values,g=n._index,y=n._ptr,b=n._size,D=n._datatype||void 0===n._data?n._datatype:n.getDataType();if(m.length!==b.length)throw new th(m.length,b.length);if(m[0]!==b[0]||m[1]!==b[1])throw RangeError("Dimension mismatch. Matrix A ("+m+") must match Matrix B ("+b+")");var x=m[0],E=m[1],A=t,w=0,N=i;"string"==typeof v&&v===D&&"mixed"!==v&&(u=v,A=e.find(t,[u,u]),w=e.convert(0,u),N=e.find(i,[u,u]));var M=l&&d?[]:void 0,C=[],F=[],S=M?[]:void 0,_=[];for(o=0;o<E;o++){F[o]=C.length;var B=o+1;if(S)for(f=y[o],c=y[o+1],s=f;s<c;s++)_[a=g[s]]=B,S[a]=d[s];for(f=p[o],c=p[o+1],s=f;s<c;s++)if(a=h[s],S){var T=_[a]===B?S[a]:w,O=N(l[s],T);A(O,w)||(C.push(a),M.push(O))}else C.push(a)}return F[E]=C.length,r.createSparseMatrix({values:M,index:C,ptr:F,size:[x,E],datatype:v===r._datatype&&D===n._datatype?u:void 0})}}),oe="atan2",ot=(r=>{var{typed:e,matrix:t,equalScalar:n,BigNumber:i,DenseMatrix:u,concat:a}=r,o=al({typed:e,equalScalar:n}),s=ah({typed:e}),f=or({typed:e,equalScalar:n}),c=am({typed:e,equalScalar:n}),l=av({typed:e,DenseMatrix:u}),h=ab({typed:e,matrix:t,concat:a});return e(oe,{"number, number":Math.atan2,"BigNumber, BigNumber":(r,e)=>i.atan2(r,e)},h({scalar:"number | BigNumber",SS:f,DS:s,SD:o,Ss:c,sS:l}))},"bitAnd"),on=(r=>{var{typed:e,matrix:t,equalScalar:n,concat:i}=r,u=al({typed:e,equalScalar:n}),a=aG({typed:e,equalScalar:n}),o=am({typed:e,equalScalar:n}),s=ab({typed:e,matrix:t,concat:i});return e(ot,{"number, number":nY,"BigNumber, BigNumber":nP},s({SS:a,DS:u,Ss:o}))},"bitOr"),oi=(r=>{var{typed:e,matrix:t,equalScalar:n,DenseMatrix:i,concat:u}=r,a=az({typed:e}),o=a9({typed:e,equalScalar:n}),s=aI({typed:e,DenseMatrix:i}),f=ab({typed:e,matrix:t,concat:u});return e(on,{"number, number":nJ,"BigNumber, BigNumber":nk},f({SS:o,DS:a,Ss:s}))},"bitXor"),ou=(r=>{var{typed:e,matrix:t,DenseMatrix:n,concat:i}=r,u=ah({typed:e}),a=ap({typed:e,DenseMatrix:n}),o=av({typed:e,DenseMatrix:n}),s=ab({typed:e,matrix:t,concat:i});return e(oi,{"number, number":nW,"BigNumber, BigNumber":nH},s({SS:a,DS:u,Ss:o}))},"catalan"),oa=(r=>
1{var{typed:e,addScalar:t,divideScalar:n,multiplyScalar:i,combinations:u,isNegative:a,isInteger:o}=r;return e(ou,{"number | BigNumber":function(r){if(!o(r)||a(r))throw TypeError("Non-negative integer value expected in function catalan");return n(u(i(r,2),r),t(r,1))}})},"compare"),oo=ey(oa,["typed","config","matrix","equalScalar","BigNumber","Fraction","DenseMatrix","concat"],r=>{var{typed:e,config:t,equalScalar:n,matrix:i,BigNumber:u,Fraction:a,DenseMatrix:o,concat:s}=r,f=ah({typed:e}),c=a1({typed:e,equalScalar:n}),l=av({typed:e,DenseMatrix:o}),h=ab({typed:e,matrix:i,concat:s}),p=ia({typed:e});return e(oa,os({typed:e,config:t}),{"boolean, boolean":function(r,e){return r===e?0:r>e?1:-1},"BigNumber, BigNumber":function(r,e){return new u(iu(r,e,t.epsilon)?0:r.cmp(e))},"Fraction, Fraction":function(r,e){return new a(r.compare(e))},"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},p,h({SS:c,DS:f,Ss:l}))}),os=ey(oa,["typed","config"],r=>{var{typed:e,config:t}=r;return e(oa,{"number, number":function(r,e){return ej(r,e,t.epsilon)?0:r>e?1:-1}})}),of="compareText";tl.signature="any, any";var oc=ey(of,["typed","matrix","concat"],r=>{var{typed:e,matrix:t,concat:n}=r,i=ab({typed:e,matrix:t,concat:n});return e(of,tl,i({elop:tl,Ds:!0}))}),ol="cumsum",oh=(r=>{var{typed:e,add:t,unaryPlus:n}=r;return e(ol,{Array:i,Matrix:function(r){return r.create(i(r.valueOf()))},"Array, number | BigNumber":a,"Matrix, number | BigNumber":function(r,e){return r.create(a(r.valueOf(),e))},"...":function(r){if(tW(r))throw TypeError("All values expected to be scalar in function cumsum");return i(r)}});function i(r){try{return u(r)}catch(r){throw uJ(r,ol)}}function u(r){if(0===r.length)return[];for(var e=[n(r[0])],i=1;i<r.length;++i)e.push(t(e[i-1],r[i]));return e}function a(r,e){var t=tm(r);if(e<0||e>=t.length)throw new tp(e,t.length);try{return function r(e,t){var n,i,a;if(t<=0){if(!Array.isArray(e[0][0]))return u(e);for(n=0,a=tJ(e),i=[];n<a.length;n++)i[n]=r(a[n],t-1);return i}for(n=0,i=[];n<e.length;n++)i[n]=r(e[n],t-1);return i}(r,e)}catch(r){throw uJ(r,ol)}}},"deepEqual"),op=ey(oh,["typed","equal"],r=>{var{typed:e,equal:t}=r;return e(oh,{"any, any":function(r,e){return function r(e,n){if(Array.isArray(e))if(!Array.isArray(n))return!1;else{var i=e.length;if(i!==n.length)return!1;for(var u=0;u<i;u++)if(!r(e[u],n[u]))return!1;return!0}return!Array.isArray(n)&&t(e,n)}(r.valueOf(),e.valueOf())}})}),om="diff",ov=(r=>{var{typed:e,matrix:t,subtract:n,number:i}=r;return e(om,{"Array | Matrix":function(r){return rV(r)?t(a(r.toArray())):a(r)},"Array | Matrix, number":function(r,e){if(!eA(e))throw RangeError("Dimension must be a whole number");return rV(r)?t(u(r.toArray(),e)):u(r,e)},"Array, BigNumber":e.referTo("Array,number",r=>(e,t)=>r(e,i(t))),"Matrix, BigNumber":e.referTo("Matrix,number",r=>(e,t)=>r(e,i(t)))});function u(r,e){if(rV(r)&&(r=r.toArray()),!Array.isArray(r))throw RangeError("Array/Matrix does not have that many dimensions");if(e>0){var t=[];return r.forEach(r=>{t.push(u(r,e-1))}),t}if(0===e)return a(r);throw RangeError("Cannot have negative dimension")}function a(r){for(var e=[],t=r.length,i=1;i<t;i++)e.push(function r(e,t){rV(e)&&(e=e.toArray()),rV(t)&&(t=t.toArray());var i=Array.isArray(e),u=Array.isArray(t);if(i&&u){var a=e,o=t;if(a.length!==o.length)throw RangeError("Not all sub-arrays have the same length");for(var s=[],f=a.length,c=0;c<f;c++)s.push(r(a[c],o[c]));return s}if(!i&&!u)return n(t,e);throw TypeError("Cannot calculate difference between 1 array and 1 non-array")}(r[i-1],r[i]));return e}},"distance"),od=(r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:u,deepEqual:a,sqrt:o,abs:s}=r;return e(ov,{"Array, Array, Array":function(r,e,t){if(2===r.length&&2===e.length&&2===t.length){if(!c(r))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!c(e))throw TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!c(t))throw TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(a(e,t))throw TypeError("LinePoint1 should not be same with LinePoint2");var u=n(t[1],e[1]),o=n(e[0],t[0]),s=n(i(t[0],e[1]),i(e[0],t[1]));return v(r[0],r[1],u,o,s)}throw TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(r,e,t){if(2===Object.keys(r).length&&2===Object.keys(e).length&&2===Object.keys(t).length){if(!c(r))throw TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!c(e))throw TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!c(t))throw TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(a(m(e),m(t)))throw TypeError("LinePoint1 should not be same with LinePoint2");if("pointX"in r&&"pointY"in r&&"lineOnePtX"in e&&"lineOnePtY"in e&&"lineTwoPtX"in t&&"lineTwoPtY"in t){var u=n(t.lineTwoPtY,e.lineOnePtY),o=n(e.lineOnePtX,t.lineTwoPtX),s=n(i(t.lineTwoPtX,e.lineOnePtY),i(e.lineOnePtX,t.lineTwoPtY));return v(r.pointX,r.pointY,u,o,s)}
1throw TypeError("Key names do not match")}throw TypeError("Invalid Arguments: Try again")},"Array, Array":function(r,e){if(2===r.length&&3===e.length){if(!c(r))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!l(e))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");return v(r[0],r[1],e[0],e[1],e[2])}if(3===r.length&&6===e.length){if(!l(r))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!p(e))throw TypeError("Array with 6 numbers or BigNumbers expected for second argument");return d(r[0],r[1],r[2],e[0],e[1],e[2],e[3],e[4],e[5])}if(r.length===e.length&&r.length>0){if(!h(r)||!h(e))throw TypeError("All values of an array should be numbers or BigNumbers");return g(r,e)}throw TypeError("Invalid Arguments: Try again")},"Object, Object":function(r,e){if(2===Object.keys(r).length&&3===Object.keys(e).length){if(!c(r))throw TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!l(e))throw TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if("pointX"in r&&"pointY"in r&&"xCoeffLine"in e&&"yCoeffLine"in e&&"constant"in e)return v(r.pointX,r.pointY,e.xCoeffLine,e.yCoeffLine,e.constant);
1throw TypeError("Key names do not match")}if(3===Object.keys(r).length&&6===Object.keys(e).length){if(!l(r))throw TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!p(e))throw TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if("pointX"in r&&"pointY"in r&&"x0"in e&&"y0"in e&&"z0"in e&&"a"in e&&"b"in e&&"c"in e)return d(r.pointX,r.pointY,r.pointZ,e.x0,e.y0,e.z0,e.a,e.b,e.c);throw TypeError("Key names do not match")}if(2===Object.keys(r).length&&2===Object.keys(e).length){if(!c(r))throw TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!c(e))throw TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if("pointOneX"in r&&"pointOneY"in r&&"pointTwoX"in e&&"pointTwoY"in e)return g([r.pointOneX,r.pointOneY],[e.pointTwoX,e.pointTwoY]);throw TypeError("Key names do not match")}if(3===Object.keys(r).length&&3===Object.keys(e).length){if(!l(r))throw TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!l(e))throw TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if("pointOneX"in r&&"pointOneY"in r&&"pointOneZ"in r&&"pointTwoX"in e&&"pointTwoY"in e&&"pointTwoZ"in e)return g([r.pointOneX,r.pointOneY,r.pointOneZ],[e.pointTwoX,e.pointTwoY,e.pointTwoZ]);
1throw TypeError("Key names do not match")}throw TypeError("Invalid Arguments: Try again")},Array:function(r){if(!function(r){if(2===r[0].length&&f(r[0][0])&&f(r[0][1])){if(r.some(r=>2!==r.length||!f(r[0])||!f(r[1])))return!1}else if(!(3===r[0].length&&f(r[0][0])&&f(r[0][1])&&f(r[0][2])))return!1;else if(r.some(r=>3!==r.length||!f(r[0])||!f(r[1])||!f(r[2])))return!1;return!0}(r))throw TypeError("Incorrect array format entered for pairwise distance calculation");return function(r){for(var e=[],t=[],n=[],i=0;i<r.length-1;i++)for(var u=i+1;u<r.length;u++)2===r[0].length?(t=[r[i][0],r[i][1]],n=[r[u][0],r[u][1]]):3===r[0].length&&(t=[r[i][0],r[i][1],r[i][2]],n=[r[u][0],r[u][1],r[u][2]]),e.push(g(t,n));return e}(r)}});function f(r){return"number"==typeof r||rj(r)}function c(r){return r.constructor!==Array&&(r=m(r)),f(r[0])&&f(r[1])}function l(r){return r.constructor!==Array&&(r=m(r)),f(r[0])&&f(r[1])&&f(r[2])}function h(r){return Array.isArray(r)||(r=m(r)),r.every(f)}function p(r){return r.constructor!==Array&&(r=m(r)),f(r[0])&&f(r[1])&&f(r[2])&&f(r[3])&&f(r[4])&&f(r[5])}function m(r){for(var e=Object.keys(r),t=[],n=0;n<e.length;n++)t.push(r[e[n]]);return t}function v(r,e,n,a,f){return u(s(t(t(i(n,r),i(a,e)),f)),o(t(i(n,n),i(a,a))))}function d(r,e,a,s,f,c,l,h,p){var m=[n(i(n(f,e),p),i(n(c,a),h)),n(i(n(c,a),l),i(n(s,r),p)),n(i(n(s,r),h),i(n(f,e),l))];return u(m=o(t(t(i(m[0],m[0]),i(m[1],m[1])),i(m[2],m[2]))),o(t(t(i(l,l),i(h,h)),i(p,p))))}function g(r,e){for(var u=r.length,a=0,s=0,f=0;f<u;f++)a=t(i(s=n(r[f],e[f]),s),a);return o(a)}},ey("dot",["typed","addScalar","multiplyScalar","conj","size"],r=>{var{typed:e,addScalar:t,multiplyScalar:n,conj:i,size:u}=r;return e("dot",{"Array | DenseMatrix, Array | DenseMatrix":function(r,u){var s=a(r,u),f=rV(r)?r._data:r,c=rV(r)?r._datatype||r.getDataType():void 0,l=rV(u)?u._data:u,h=rV(u)?u._datatype||u.getDataType():void 0,p=2===o(r).length,m=2===o(u).length,v=t,d=n;if(c&&h&&c===h&&"string"==typeof c&&"mixed"!==c&&(v=e.find(t,[c,c]),d=e.find(n,[c,c])),!p&&!m){for(var g=d(i(f[0]),l[0]),y=1;y<s;y++)g=v(g,d(i(f[y]),l[y]));return g}if(!p&&m){for(var b=d(i(f[0]),l[0][0]),D=1;D<s;D++)b=v(b,d(i(f[D]),l[D][0]));return b}if(p&&!m){for(var x=d(i(f[0][0]),l[0]),E=1;E<s;E++)x=v(x,d(i(f[E][0]),l[E]));return x}if(p&&m){for(var A=d(i(f[0][0]),l[0][0]),w=1;w<s;w++)A=v(A,d(i(f[w][0]),l[w][0]));return A}},"SparseMatrix, SparseMatrix":function(r,e){a(r,e);for(var i=r._index,u=r._values,o=e._index,s=e._values,f=0,c=0,l=0;c<i.length&&l<o.length;){var h=i[c],p=o[l];if(h<p){c++;continue}if(h>p){l++;continue}h===p&&(f=t(f,n(u[c],s[l])),c++,l++)}return f}});function a(r,e){var t,n,i=o(r),u=o(e);if(1===i.length)t=i[0];else if(2===i.length&&1===i[1])t=i[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+i.join(", ")+")");if(1===u.length)n=u[0];else if(2===u.length&&1===u[1])n=u[0];else throw RangeError("Expected a column vector, instead got a matrix of size ("+u.join(", ")+")");if(t!==n)throw RangeError("Vectors must have equal length ("+t+" != "+n+")");if(0===t)throw RangeError("Cannot calculate the dot product of empty vectors");return t}function o(r){return rV(r)?r.size():u(r)}})),og="equalText",oy=(r=>{var{typed:e,compareText:t,isZero:n}=r;return e(og,{"any, any":function(r,e){return n(t(r,e))}})},"floor"),ob=ey(oy,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(oy,{number:function(r){return ej(r,n(r),t.epsilon)?n(r):Math.floor(r)},"number, number":function(r,e){if(ej(r,n(r,e),t.epsilon))return n(r,e);var[i,u]="".concat(r,"e").split("e"),a=Math.floor(Number("".concat(i,"e").concat(Number(u)+e)));return[i,u]="".concat(a,"e").split("e"),Number("".concat(i,"e").concat(Number(u)-e))}})}),oD=ey(oy,["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:u,zeros:a,DenseMatrix:o}=r,s=am({typed:e,equalScalar:u}),f=av({typed:e,DenseMatrix:o}),c=ag({typed:e}),l=ob({typed:e,config:t,round:n});return e("floor",{number:l.signatures.number,"number,number":l.signatures["number,number"],Complex:function(r){return r.floor()},"Complex, number":function(r,e){return r.floor(e)},"Complex, BigNumber":function(r,e){return r.floor(e.toNumber())},BigNumber:function(r){return iu(r,n(r),t.epsilon)?n(r):r.floor()},"BigNumber, BigNumber":function(r,e){return iu(r,n(r,e),t.epsilon)?n(r,e):r.toDecimalPlaces(e.toNumber(),rU.ROUND_FLOOR)},Fraction:function(r){return r.floor()},"Fraction, number":function(r,e){return r.floor(e)},"Fraction, BigNumber":function(r,e){return r.floor(e.toNumber())},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0)),"Array, number | BigNumber":e.referToSelf(r=>(e,t)=>
1tQ(e,e=>r(e,t),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>s(e,t,r,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>c(e,t,r,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(r=>(e,t)=>c(i(t),e,r,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(r=>(e,t)=>u(e,0)?a(t.size(),t.storage()):"dense"===t.storage()?c(t,e,r,!0):f(t,e,r,!0))})}),ox=ey("mod",["typed","config","round","matrix","equalScalar","zeros","DenseMatrix","concat"],r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:u,zeros:a,DenseMatrix:o,concat:s}=r,f=oD({typed:e,config:t,round:n,matrix:i,equalScalar:u,zeros:a,DenseMatrix:o}),c=al({typed:e,equalScalar:u}),l=ah({typed:e}),h=a1({typed:e,equalScalar:u}),p=am({typed:e,equalScalar:u}),m=av({typed:e,DenseMatrix:o}),v=ab({typed:e,matrix:i,concat:s});return e("mod",{"number, number":function(r,e){return 0===e?r:r-e*f(r/e)},"BigNumber, BigNumber":function(r,e){return e.isZero()?r:r.sub(e.mul(f(r.div(e))))},"Fraction, Fraction":function(r,e){return e.equals(0)?r:r.sub(e.mul(f(r.div(e))))}},v({SS:h,DS:l,SD:c,Ss:p,sS:m}))}),oE="number | BigNumber | Fraction | Matrix | Array",oA="".concat(oE,", ").concat(oE,", ...").concat(oE);function ow(r){return!r.some(r=>Array.isArray(r))}r=>{var{typed:e,matrix:t,config:n,round:i,equalScalar:u,zeros:a,BigNumber:o,DenseMatrix:s,concat:f}=r,c=ox({typed:e,config:n,round:i,matrix:t,equalScalar:u,zeros:a,DenseMatrix:s,concat:f}),l=az({typed:e}),h=a9({typed:e,equalScalar:u}),p=aI({typed:e,DenseMatrix:s}),m=ab({typed:e,matrix:t,concat:f});return e("gcd",{"number, number":function(r,e){var t;if(!eA(r)||!eA(e))throw Error("Parameters in function gcd must be integer numbers");for(;0!==e;)t=c(r,e),r=e,e=t;return r<0?-r:r},"BigNumber, BigNumber":function(r,e){if(!r.isInt()||!e.isInt())throw Error("Parameters in function gcd must be integer numbers");for(var t=new o(0);!e.isZero();){var n=c(r,e);r=e,e=n}return r.lt(t)?r.neg():r},"Fraction, Fraction":(r,e)=>r.gcd(e)},m({SS:h,DS:l,Ss:p}),{[oA]:e.referToSelf(r=>(e,t,n)=>{for(var i=r(e,t),u=0;u<n.length;u++)i=r(i,n[u]);return i}),Array:e.referToSelf(r=>e=>{if(1===e.length&&Array.isArray(e[0])&&ow(e[0]))return r(...e[0]);if(ow(e))return r(...e);throw new aY("gcd() supports only 1d matrices!")}),Matrix:e.referToSelf(r=>e=>r(e.toArray()))})};var oN="hypot",oM=(r=>{var{typed:e,abs:t,addScalar:n,divideScalar:i,multiplyScalar:u,sqrt:a,smaller:o,isPositive:s}=r;return e(oN,{"... number | BigNumber":f,Array:f,Matrix:r=>f(tN(r.toArray()))});function f(r){for(var e=0,f=0,c=0;c<r.length;c++){if(rk(r[c]))throw TypeError("Unexpected type of argument to hypot");var l=t(r[c]);o(f,l)?(e=n(e=u(e,u(i(f,l),i(f,l))),1),f=l):e=n(e,s(l)?u(i(l,f),i(l,f)):l)}return u(f,a(e))}},ey("ImmutableDenseMatrix",["smaller","DenseMatrix"],r=>{var{smaller:e,DenseMatrix:t}=r;function n(r,e){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");if(e&&!rH(e))throw Error("Invalid datatype: "+e);if(rV(r)||rG(r)){var i=new t(r,e);this._data=i._data,this._size=i._size,this._datatype=i._datatype,this._min=null,this._max=null}else if(r&&rG(r.data)&&rG(r.size))this._data=r.data,this._size=r.size,this._datatype=r.datatype,this._min=void 0!==r.min?r.min:null,this._max=void 0!==r.max?r.max:null;else if(r)throw TypeError("Unsupported type of data ("+ep(r)+")");else this._data=[],this._size=[0],this._datatype=e,this._min=null,this._max=null}return n.prototype=new t,n.prototype.type="ImmutableDenseMatrix",n.prototype.isImmutableDenseMatrix=!0,n.prototype.subset=function(r){switch(arguments.length){case 1:var e=t.prototype.subset.call(this,r);if(rV(e))return new n({data:e._data,size:e._size,datatype:e._datatype});return e;case 2:case 3:throw Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw SyntaxError("Wrong number of arguments")}},n.prototype.set=function(){throw Error("Cannot invoke set on an Immutable Matrix instance")},n.prototype.resize=function(){throw Error("Cannot invoke resize on an Immutable Matrix instance")},n.prototype.reshape=function(){throw Error("Cannot invoke reshape on an Immutable Matrix instance")},n.prototype.clone=function(){return new n({data:em(this._data),size:em(this._size),datatype:this._datatype})},n.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},n.fromJSON=function(r){return new n(r)},n.prototype.swapRows=function(){throw Error("Cannot invoke swapRows on an Immutable Matrix instance")},n.prototype.min=function(){if(null===this._min){var r=null;this.forEach(function(t){(null===r||e(t,r))&&(r=t)}),this._min=null!==r?r:void 0}return this._min},n.prototype.max=function(){if(null===this._max){var r=null;this.forEach(function(t){(null===r||e(r,t))&&(r=t)}),this._max=null!==r?r:void 0}return this._max},n},{isClass:!0})),oC=ey("Index",["ImmutableDenseMatrix","getMatrixDataType"],r=>{var{ImmutableDenseMatrix:e,getMatrixDataType:t}=r;function n(r){if(!(this instanceof n))throw SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._sourceSize=[],this._isScalar=!0;for(var e=0,u=arguments.length;e<u;e++){var a=arguments[e],o=rG(a),s=rV(a),f=null;if(rJ(a))this._dimensions.push(a),this._isScalar=!1;else if(o||s){var c=void 0;"boolean"===t(a)?(o&&(c=i(oF(a).valueOf())),s&&(c=i(oF(a._data).valueOf())),f=a.valueOf().length):c=i(a.valueOf()),this._dimensions.push(c);var l=c.size();(1!==l.length||1!==l[0]||null!==f)&&(this._isScalar=!1)}else if("number"==typeof a)this._dimensions.push(i([a]));else if("string"==typeof a)this._dimensions.push(a);else throw TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._sourceSize.push(f)}}function i(r){for(var t=0,n=r.length;t<n;t++)if("number"!=typeof r[t]||!eA(r[t]))throw TypeError("Index parameters must be positive integer numbers");return new e(r)}return n.prototype.type="Index",n.prototype.isIndex=!0,n.prototype.clone=function(){var r=new n;return r._dimensions=em(this._dimensions),r._isScalar=this._isScalar,r._sourceSize=this._sourceSize,r},n.create=function(r){var e=new n;return n.apply(e,r),e},n.prototype.size=function(){for(var r=[],e=0,t=this._dimensions.length;e<t;e++){var n=this._dimensions[e];
1r[e]="string"==typeof n?1:n.size()[0]}return r},n.prototype.max=function(){for(var r=[],e=0,t=this._dimensions.length;e<t;e++){var n=this._dimensions[e];r[e]="string"==typeof n?n:n.max()}return r},n.prototype.min=function(){for(var r=[],e=0,t=this._dimensions.length;e<t;e++){var n=this._dimensions[e];r[e]="string"==typeof n?n:n.min()}return r},n.prototype.forEach=function(r){for(var e=0,t=this._dimensions.length;e<t;e++)r(this._dimensions[e],e,this)},n.prototype.dimension=function(r){return this._dimensions[r]||null},n.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},n.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},n.prototype.isScalar=function(){return this._isScalar},n.prototype.toArray=function(){for(var r=[],e=0,t=this._dimensions.length;e<t;e++){var n=this._dimensions[e];r.push("string"==typeof n?n:n.toArray())}return r},n.prototype.valueOf=n.prototype.toArray,n.prototype.toString=function(){for(var r=[],e=0,t=this._dimensions.length;e<t;e++){var n=this._dimensions[e];"string"==typeof n?r.push(JSON.stringify(n)):r.push(n.toString())}return"["+r.join(", ")+"]"},n.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},n.fromJSON=function(r){return n.create(r.dimensions)},n},{isClass:!0});function oF(r){var e=[];return r.forEach((r,t)=>{r&&e.push(t)}),e}var oS="larger",o_=ey(oS,["typed","config","matrix","DenseMatrix","concat"],r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:u}=r,a=ah({typed:e}),o=ap({typed:e,DenseMatrix:i}),s=av({typed:e,DenseMatrix:i}),f=ab({typed:e,matrix:n,concat:u}),c=ia({typed:e});return e(oS,oB({typed:e,config:t}),{"boolean, boolean":(r,e)=>r>e,"BigNumber, BigNumber":function(r,e){return r.gt(e)&&!iu(r,e,t.epsilon)},"Fraction, Fraction":(r,e)=>1===r.compare(e),"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},c,f({SS:o,DS:a,Ss:s}))}),oB=ey(oS,["typed","config"],r=>{var{typed:e,config:t}=r;return e(oS,{"number, number":function(r,e){return r>e&&!ej(r,e,t.epsilon)}})}),oT=ey("log",["config","typed","divideScalar","Complex"],r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r;return e("log",{number:function(r){return r>=0||t.predictable?Math.log(r):new i(r,0).log()},Complex:function(r){return r.log()},BigNumber:function(r){return!r.isNegative()||t.predictable?r.ln():new i(r.toNumber(),0).log()},"any, any":e.referToSelf(r=>(e,t)=>n(r(e),r(t)))})}),oO="lsolveAll",oz=(r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:u,equalScalar:a,DenseMatrix:o}=r,s=aj({DenseMatrix:o});return e(oO,{"SparseMatrix, Array | Matrix":function(r,e){return function(r,e){for(var t=[s(r,e,!0)._data.map(r=>r[0])],f=r._size[0],c=r._size[1],l=r._values,h=r._index,p=r._ptr,m=0;m<c;m++)for(var v=t.length,d=0;d<v;d++){for(var g=t[d],y=[],b=[],D=p[m],x=p[m+1],E=0,A=D;A<x;A++){var w=h[A];w===m?E=l[A]:w>m&&(y.push(l[A]),b.push(w))}if(a(E,0))if(a(g[m],0)){if(0===d){var N=[...g];N[m]=1;for(var M=0,C=b.length;M<C;M++){var F=b[M];
1N[F]=u(N[F],y[M])}t.push(N)}}else{if(0===d)return[];t.splice(d,1),d-=1,v-=1}else{g[m]=n(g[m],E);for(var S=0,_=b.length;S<_;S++){var B=b[S];g[B]=u(g[B],i(g[m],y[S]))}}}return t.map(r=>new o({data:r.map(r=>[r]),size:[f,1]}))}(r,e)},"DenseMatrix, Array | Matrix":function(r,e){return f(r,e)},"Array, Array | Matrix":function(r,e){return f(t(r),e).map(r=>r.valueOf())}});function f(r,e){for(var t=[s(r,e,!0)._data.map(r=>r[0])],f=r._data,c=r._size[0],l=r._size[1],h=0;h<l;h++)for(var p=t.length,m=0;m<p;m++){var v=t[m];if(a(f[h][h],0))if(a(v[h],0)){if(0===m){var d=[...v];d[h]=1;for(var g=h+1;g<l;g++)d[g]=u(d[g],f[g][h]);t.push(d)}}else{if(0===m)return[];t.splice(m,1),m-=1,p-=1}else{v[h]=n(v[h],f[h][h]);for(var y=h+1;y<l;y++)v[y]=u(v[y],i(v[h],f[y][h]))}}return t.map(r=>new o({data:r.map(r=>[r]),size:[c,1]}))}},"matrixFromRows"),oI=(r=>{var{typed:e,matrix:t,flatten:n,size:i}=r;return e(oz,{"...Array":function(r){return u(r)},"...Matrix":function(r){return t(u(r.map(r=>r.toArray())))}});function u(r){if(0===r.length)throw TypeError("At least one row is needed to construct a matrix.");var e=a(r[0]),t=[];for(var i of r){var u=a(i);if(u!==e)throw TypeError("The vectors had different length: "+(0|e)+" ≠"+(0|u));t.push(n(i))}return t}function a(r){var e=i(r);if(1===e.length)return e[0];if(2===e.length)if(1===e[0])return e[1];else if(1===e[1])return e[0];else throw TypeError("At least one of the arguments is not a vector.");throw TypeError("Only one- or two-dimensional vectors are supported.")}},"multiply"),oR=ey(oI,["typed","matrix","addScalar","multiplyScalar","equalScalar","dot"],r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,equalScalar:u,dot:a}=r,o=am({typed:e,equalScalar:u}),s=ag({typed:e});function f(r,e){switch(r.length){case 1:switch(e.length){case 1:if(r[0]!==e[0])throw RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(r[0]!==e[0])throw RangeError("Dimension mismatch in multiplication. Vector length ("+r[0]+") must match Matrix rows ("+e[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+e.length+" dimensions)")}break;case 2:switch(e.length){case 1:if(r[1]!==e[0])throw RangeError("Dimension mismatch in multiplication. Matrix columns ("+r[1]+") must match Vector length ("+e[0]+")");break;case 2:if(r[1]!==e[0])throw RangeError("Dimension mismatch in multiplication. Matrix A columns ("+r[1]+") must match Matrix B rows ("+e[0]+")");break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+e.length+" dimensions)")}break;default:throw Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+r.length+" dimensions)")}}var c=e("_multiplyMatrixVector",{"DenseMatrix, any":function(r,t){var u,a=r._data,o=r._size,s=r._datatype||r.getDataType(),f=t._data,c=t._datatype||t.getDataType(),l=o[0],h=o[1],p=n,m=i;s&&c&&s===c&&"string"==typeof s&&"mixed"!==s&&(u=s,p=e.find(n,[u,u]),m=e.find(i,[u,u]));for(var v=[],d=0;d<l;d++){for(var g=a[d],y=m(g[0],f[0]),b=1;b<h;b++)y=p(y,m(g[b],f[b]));v[d]=y}return r.createDenseMatrix({data:v,size:[l],datatype:s===r._datatype&&c===t._datatype?u:void 0})},"SparseMatrix, any":function(r,t){var a,o=r._values,s=r._index,f=r._ptr,c=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!o)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var l=t._data,h=t._datatype||t.getDataType(),p=r._size[0],m=t._size[0],v=[],d=[],g=[],y=n,b=i,D=u,x=0;c&&h&&c===h&&"string"==typeof c&&"mixed"!==c&&(a=c,y=e.find(n,[a,a]),b=e.find(i,[a,a]),D=e.find(u,[a,a]),x=e.convert(0,a));var E=[],A=[];g[0]=0;for(var w=0;w<m;w++){var N=l[w];if(!D(N,x))for(var M=f[w],C=f[w+1],F=M;F<C;F++){var S=s[F];A[S]?E[S]=y(E[S],b(N,o[F])):(A[S]=!0,d.push(S),E[S]=b(N,o[F]))}}for(var _=d.length,B=0;B<_;B++){var T=d[B];v[B]=E[T]}return g[1]=d.length,r.createSparseMatrix({values:v,index:d,ptr:g,size:[p,1],datatype:c===r._datatype&&h===t._datatype?a:void 0})}}),l=e("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(r,t){var u,a=r._data,o=r._size,s=r._datatype||r.getDataType(),f=t._data,c=t._size,l=t._datatype||t.getDataType(),h=o[0],p=o[1],m=c[1],v=n,d=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&"mixed"!==s&&(u=s,v=e.find(n,[u,u]),d=e.find(i,[u,u]));for(var g=[],y=0;y<h;y++){var b=a[y];g[y]=[];for(var D=0;D<m;D++){for(var x=d(b[0],f[0][D]),E=1;E<p;E++)x=v(x,d(b[E],f[E][D]));g[y][D]=x}}return r.createDenseMatrix({data:g,size:[h,m],datatype:s===r._datatype&&l===t._datatype?u:void 0})},"DenseMatrix, SparseMatrix":function(r,t){var a,o=r._data,s=r._size,f=r._datatype||r.getDataType(),c=t._values,l=t._index,h=t._ptr,p=t._size,m=t._datatype||void 0===t._data?t._datatype:t.getDataType();if(!c)throw Error("Cannot multiply Dense Matrix times Pattern only Matrix");var v=s[0],d=p[1],g=n,y=i,b=u,D=0;f&&m&&f===m&&"string"==typeof f&&"mixed"!==f&&(a=f,g=e.find(n,[a,a]),y=e.find(i,[a,a]),b=e.find(u,[a,a]),D=e.convert(0,a));for(var x=[],E=[],A=[],w=t.createSparseMatrix({values:x,index:E,ptr:A,size:[v,d],datatype:f===r._datatype&&m===t._datatype?a:void 0}),N=0;N<d;N++){A[N]=E.length;var M=h[N],C=h[N+1];if(C>M)for(var F=0,S=0;S<v;
1S++){for(var _=S+1,B=void 0,T=M;T<C;T++){var O=l[T];F!==_?(B=y(o[S][O],c[T]),F=_):B=g(B,y(o[S][O],c[T]))}F!==_||b(B,D)||(E.push(S),x.push(B))}}return A[d]=E.length,w},"SparseMatrix, DenseMatrix":function(r,t){var a,o=r._values,s=r._index,f=r._ptr,c=r._datatype||void 0===r._data?r._datatype:r.getDataType();if(!o)throw Error("Cannot multiply Pattern only Matrix times Dense Matrix");var l=t._data,h=t._datatype||t.getDataType(),p=r._size[0],m=t._size[0],v=t._size[1],d=n,g=i,y=u,b=0;c&&h&&c===h&&"string"==typeof c&&"mixed"!==c&&(a=c,d=e.find(n,[a,a]),g=e.find(i,[a,a]),y=e.find(u,[a,a]),b=e.convert(0,a));for(var D=[],x=[],E=[],A=r.createSparseMatrix({values:D,index:x,ptr:E,size:[p,v],datatype:c===r._datatype&&h===t._datatype?a:void 0}),w=[],N=[],M=0;M<v;M++){E[M]=x.length;for(var C=M+1,F=0;F<m;F++){var S=l[F][M];if(!y(S,b))for(var _=f[F],B=f[F+1],T=_;T<B;T++){var O=s[T];N[O]!==C?(N[O]=C,x.push(O),w[O]=g(S,o[T])):w[O]=d(w[O],g(S,o[T]))}}for(var z=E[M],I=x.length,R=z;R<I;R++){var U=x[R];D[R]=w[U]}}return E[v]=x.length,A},"SparseMatrix, SparseMatrix":function(r,t){var u,a,o,s,f,c,l,h,p,m=r._values,v=r._index,d=r._ptr,g=r._datatype||void 0===r._data?r._datatype:r.getDataType(),y=t._values,b=t._index,D=t._ptr,x=t._datatype||void 0===t._data?t._datatype:t.getDataType(),E=r._size[0],A=t._size[1],w=m&&y,N=n,M=i;g&&x&&g===x&&"string"==typeof g&&"mixed"!==g&&(u=g,N=e.find(n,[u,u]),M=e.find(i,[u,u]));for(var C=w?[]:void 0,F=[],S=[],_=r.createSparseMatrix({values:C,index:F,ptr:S,size:[E,A],datatype:g===r._datatype&&x===t._datatype?u:void 0}),B=w?[]:void 0,T=[],O=0;O<A;O++){S[O]=F.length;var z=O+1;for(c=D[O],l=D[O+1],f=c;f<l;f++)if(p=b[f],w)for(o=d[p],s=d[p+1],a=o;a<s;a++)T[h=v[a]]!==z?(T[h]=z,F.push(h),B[h]=M(y[f],m[a])):B[h]=N(B[h],M(y[f],m[a]));else for(o=d[p],s=d[p+1],a=o;a<s;a++)T[h=v[a]]!==z&&(T[h]=z,F.push(h));if(w)for(var I=S[O],R=F.length,U=I;U<R;U++){var P=F[U];C[U]=B[P]}}return S[A]=F.length,_}});return e(oI,i,{"Array, Array":e.referTo("Matrix, Matrix",r=>(e,n)=>{f(tm(e),tm(n));var i=r(t(e),t(n));return rV(i)?i.valueOf():i}),"Matrix, Matrix":function(r,t){var u=r.size(),o=t.size();if(f(u,o),1===u.length){if(1===o.length){if(0===u[0])throw Error("Cannot multiply two empty vectors");return a(r,t)}if("dense"!==t.storage())throw Error("Support for SparseMatrix not implemented");return function(r,t){var u,a=r._data,o=r._size,s=r._datatype||r.getDataType(),f=t._data,c=t._size,l=t._datatype||t.getDataType(),h=o[0],p=c[1],m=n,v=i;s&&l&&s===l&&"string"==typeof s&&"mixed"!==s&&(u=s,m=e.find(n,[u,u]),v=e.find(i,[u,u]));for(var d=[],g=0;g<p;g++){for(var y=v(a[0],f[0][g]),b=1;b<h;b++)y=m(y,v(a[b],f[b][g]));d[g]=y}return r.createDenseMatrix({data:d,size:[p],datatype:s===r._datatype&&l===t._datatype?u:void 0})}(r,t)}return 1===o.length?c(r,t):l(r,t)},"Matrix, Array":e.referTo("Matrix,Matrix",r=>(e,n)=>r(e,t(n))),"Array, Matrix":e.referToSelf(r=>(e,n)=>r(t(e,n.storage()),n)),"SparseMatrix, any":function(r,e){return o(r,e,i,!1)},"DenseMatrix, any":function(r,e){return s(r,e,i,!1)},"any, SparseMatrix":function(r,e){return o(e,r,i,!0)},"any, DenseMatrix":function(r,e){return s(e,r,i,!0)},"Array, any":function(r,e){return s(t(r),e,i,!1).valueOf()},"any, Array":function(r,e){return s(t(e),r,i,!0).valueOf()},"any, any":i,"any, any, ...any":e.referToSelf(r=>(e,t,n)=>{for(var i=r(e,t),u=0;u<n.length;u++)i=r(i,n[u]);return i})})}),oU="nthRoots",oP=(r=>{var{typed:e,config:t,divideScalar:n,Complex:i}=r,u=[function(r){return new i(r,0)},function(r){return new i(0,r)},function(r){return new i(-r,0)},function(r){return new i(0,-r)}];function a(r,e){if(e<0)throw Error("Root must be greater than zero");if(0===e)throw Error("Root must be non-zero");if(e%1!=0)throw Error("Root must be an integer");if(0===r||0===r.abs())return[new i(0,0)];var t,n="number"==typeof r;(n||0===r.re||0===r.im)&&(t=n?2*(r<0):0===r.im?2*(r.re<0):2*(r.im<0)+1);for(var a=r.arg(),o=r.abs(),s=[],f=Math.pow(o,1/e),c=0;c<e;c++){var l=(t+4*c)/e;if(l===Math.round(l)){s.push(u[l%4](f));continue}s.push(new i({r:f,phi:(a+2*Math.PI*c)/e}))}return s}return e(oU,{Complex:function(r){return a(r,2)},"Complex, number":a})},"partitionSelect"),oj=ey(oP,["typed","isNumeric","isNaN","compare"],r=>{var{typed:e,isNumeric:t,isNaN:n,compare:i}=r,u=(r,e)=>-i(r,e);return e(oP,{"Array | Matrix, number":function(r,e){return a(r,e,i)},"Array | Matrix, number, string":function(r,e,t){if("asc"===t)return a(r,e,i);if("desc"===t)return a(r,e,u);
1throw Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":a});function a(r,e,t){if(!eA(e)||e<0)throw Error("k must be a non-negative integer");if(rV(r)){if(r.size().length>1)throw Error("Only one dimensional matrices supported");return o(r.valueOf(),e,t)}if(Array.isArray(r))return o(r,e,t)}function o(r,e,i){if(e>=r.length)throw Error("k out of bounds");for(var u=0;u<r.length;u++)if(t(r[u])&&n(r[u]))return r[u];for(var a=0,o=r.length-1;a<o;){for(var s=a,f=o,c=r[Math.floor(Math.random()*(o-a+1))+a];s<f;)if(i(r[s],c)>=0){var l=r[f];r[f]=r[s],r[s]=l,--f}else++s;i(r[s],c)>0&&--s,e<=s?o=s:a=s+1}return r[e]}}),ok="rightLogShift";function oq(r,e,t,n,i,u,a){var o=0;for(t[a]=r;o>=0;){var s=t[a+o],f=t[n+s];-1===f?(o--,u[e++]=s):(t[n+s]=t[i+f],t[a+ ++o]=f)}return e}r=>{var{typed:e,matrix:t,equalScalar:n,zeros:i,DenseMatrix:u,concat:a}=r,o=az({typed:e}),s=al({typed:e,equalScalar:n}),f=aR({typed:e,equalScalar:n}),c=aI({typed:e,DenseMatrix:u}),l=am({typed:e,equalScalar:n}),h=ag({typed:e}),p=ab({typed:e,matrix:t,concat:a}),m=aU({typed:e,matrix:t});return e(ok,{"number, number":nK,"SparseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>n(t,0)?e.clone():l(e,t,r,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>n(t,0)?e.clone():h(e,t,r,!1)),"number | BigNumber, SparseMatrix":e.referToSelf(r=>(e,t)=>n(e,0)?i(t.size(),t.storage()):c(t,e,r,!0)),"number | BigNumber, DenseMatrix":e.referToSelf(r=>(e,t)=>n(e,0)?i(t.size(),t.storage()):h(t,e,r,!0))},m,p({SS:f,DS:o,SD:s}))};var oL=ey("csAmd",["add","multiply","transpose"],r=>{var{add:e,multiply:t,transpose:n}=r;return function(r,a){if(!a||r<=0||r>3)return null;var o,s,f,c,l,h,p,m,v,d,g,y,b,D,x,E,A=a._size,w=A[0],N=A[1],M=0,C=Math.max(16,10*Math.sqrt(N));C=Math.min(N-2,C);var F=function(r,i,u,a,o){var s=n(i);if(1===r&&a===u)return e(i,s);if(2===r){for(var f=s._index,c=s._ptr,l=0,h=0;h<u;h++){var p=c[h];if(c[h]=l,!(c[h+1]-p>o))for(var m=c[h+1];p<m;p++)f[l++]=f[p]}c[u]=l,i=n(s)}return t(s,i)}(r,a,w,N,C);!function(r,e,t){for(var n=r._values,i=r._index,u=r._ptr,a=r._size[1],o=0,s=0;s<a;s++){var f=u[s];for(u[s]=o;f<u[s+1];f++)e(i[f],s,n?n[f]:1,null)&&(i[o]=i[f],n&&(n[o]=n[f]),o++)}u[a]=o,i.splice(o,i.length-o),n&&n.splice(o,n.length-o)}(F,u,0);for(var S=F._index,_=F._ptr,B=_[N],T=[],O=[],z=N+1,I=2*(N+1),R=3*(N+1),U=4*(N+1),P=5*(N+1),j=6*(N+1),k=7*(N+1),q=function(r,e,t,n,u,a,o,s,f,c,l,h){for(var p=0;p<r;p++)t[0+p]=e[p+1]-e[p];t[n+r]=0;for(var m=0;m<=r;m++)t[u+m]=-1,a[m]=-1,t[o+m]=-1,t[s+m]=-1,t[f+m]=1,t[c+m]=1,t[l+m]=0,t[h+m]=t[n+m];var v=i(0,0,t,c,r);return t[l+r]=-2,e[r]=-1,t[c+r]=0,v}(N,_,O,0,R,T,I,k,z,j,U,P),L=function(r,e,t,n,i,u,a,o,s,f,c){for(var l=0,h=0;h<r;h++){var p=t[n+h];if(0===p)t[i+h]=-2,l++,e[h]=-1,t[u+h]=0;else if(p>a)t[o+h]=0,t[i+h]=-1,l++,e[h]=-r-2,t[o+r]++;else{var m=t[s+p];-1!==m&&(f[m]=h),t[c+h]=t[s+p],t[s+p]=h}}return l}(N,_,O,P,U,j,C,z,R,T,I),H=0;L<N;){for(f=-1;H<N&&-1===(f=O[R+H]);H++);-1!==O[I+f]&&(T[O[I+f]]=-1),O[R+H]=O[I+f];var G=O[U+f],V=O[z+f];L+=V;var Z=0;O[z+f]=-V;var Y=_[f],X=0===G?Y:B,J=X;for(c=1;c<=G+1;c++){for(c>G?(h=f,p=Y,m=O[0+f]-G):(p=_[h=S[Y++]],m=O[0+h]),l=1;l<=m;l++)(v=O[z+(o=S[p++])])<=0||(Z+=v,O[z+o]=-v,S[J++]=o,-1!==O[I+o]&&(T[O[I+o]]=T[o]),-1!==T[o]?O[I+T[o]]=O[I+o]:O[R+O[P+o]]=O[I+o]);h!==f&&(_[h]=-f-2,O[j+h]=0)}for(0!==G&&(B=J),O[P+f]=Z,_[f]=X,O[0+f]=J-X,O[U+f]=-2,q=i(q,M,O,j,N),d=X;d<J;d++)if(!((g=O[U+(o=S[d])])<=0)){var W=q-(v=-O[z+o]);for(Y=_[o],y=_[o]+g-1;Y<=y;Y++)O[j+(h=S[Y])]>=q?O[j+h]-=v:0!==O[j+h]&&(O[j+h]=O[P+h]+W)}for(d=X;d<J;d++){for(x=0,b=(y=_[o=S[d]])+O[U+o]-1,D=y,E=0,Y=y;Y<=b;Y++)if(0!==O[j+(h=S[Y])]){var $=O[j+h]-q;$>0?(E+=$,S[D++]=h,x+=h):(_[h]=-f-2,O[j+h]=0)}O[U+o]=D-y+1;var Q=D,K=y+O[0+o];for(Y=b+1;Y<K;Y++){var rr=O[z+(s=S[Y])];rr<=0||(E+=rr,S[D++]=s,x+=s)}0===E?(_[o]=-f-2,Z-=v=-O[z+o],V+=v,L+=v,O[z+o]=0,O[U+o]=-1):(O[P+o]=Math.min(O[P+o],E),S[D]=S[Q],S[Q]=S[y],S[y]=f,O[0+o]=D-y+1,x=(x<0?-x:x)%N,O[I+o]=O[k+x],O[k+x]=o,T[o]=x)}for(O[P+f]=Z,q=i(q+(M=Math.max(M,Z)),M,O,j,N),d=X;d<J;d++)if(!(O[z+(o=S[d])]>=0))for(o=O[k+(x=T[o])],O[k+x]=-1;-1!==o&&-1!==O[I+o];o=O[I+o],q++){for(m=O[0+o],g=O[U+o],Y=_[o]+1;Y<=_[o]+m-1;Y++)O[j+S[Y]]=q;var re=o;for(s=O[I+o];-1!==s;){var rt=O[0+s]===m&&O[U+s]===g;for(Y=_[s]+1;rt&&Y<=_[s]+m-1;Y++)O[j+S[Y]]!==q&&(rt=0);rt?(_[s]=-o-2,O[z+o]+=O[z+s],O[z+s]=0,O[U+s]=-1,s=O[I+s],O[I+re]=s):(re=s,s=O[I+s])}}for(Y=X,d=X;d<J;d++)(v=-O[z+(o=S[d])])<=0||(O[z+o]=v,E=Math.min(E=O[P+o]+Z-v,N-L-v),-1!==O[R+E]&&(T[O[R+E]]=o),O[I+o]=O[R+E],T[o]=-1,O[R+E]=o,H=Math.min(H,E),O[P+o]=E,S[Y++]=o);O[z+f]=V,0==(O[0+f]=Y-X)&&(_[f]=-1,O[j+f]=0),0!==G&&(B=Y)}for(o=0;o<N;o++)_[o]=-_[o]-2;
1for(s=0;s<=N;s++)O[R+s]=-1;for(s=N;s>=0;s--)O[z+s]>0||(O[I+s]=O[R+_[s]],O[R+_[s]]=s);for(h=N;h>=0;h--)O[z+h]<=0||-1!==_[h]&&(O[I+h]=O[R+_[h]],O[R+_[h]]=h);for(f=0,o=0;o<=N;o++)-1===_[o]&&(f=oq(o,f,O,R,I,T,j));return T.splice(T.length-1,1),T};function i(r,e,t,n,i){if(r<2||r+e<0){for(var u=0;u<i;u++)0!==t[n+u]&&(t[n+u]=1);r=2}return r}function u(r,e){return r!==e}}),oH=ey("csCounts",["transpose"],r=>{var{transpose:e}=r;return function(r,t,n,i){if(!r||!t||!n)return null;var u,a,o,s,f,c,l,h=r._size,p=h[0],m=h[1],v=4*m+(i?m+p+1:0),d=[],g=2*m,y=3*m,b=4*m,D=5*m+1;for(o=0;o<v;o++)d[o]=-1;var x=[],E=e(r),A=E._index,w=E._ptr;for(o=0;o<m;o++)for(x[a=n[o]]=+(-1===d[y+a]);-1!==a&&-1===d[y+a];a=t[a])d[y+a]=o;if(i){for(o=0;o<m;o++)d[n[o]]=o;for(u=0;u<p;u++){for(o=m,c=w[u],l=w[u+1],f=c;f<l;f++)o=Math.min(o,d[A[f]]);d[D+u]=d[b+o],d[b+o]=u}}for(u=0;u<m;u++)d[0+u]=u;for(o=0;o<m;o++){for(-1!==t[a=n[o]]&&x[t[a]]--,s=i?d[b+o]:a;-1!==s;s=i?d[D+s]:-1)for(f=w[s];f<w[s+1];f++){var N=function(r,e,t,n,i,u,a){var o,s,f,c=0;if(r<=e||t[n+e]<=t[i+r])return -1;t[i+r]=t[n+e];var l=t[u+r];if(t[u+r]=e,-1===l)c=1,f=r;else{for(c=2,f=l;f!==t[0+f];f=t[0+f]);for(o=l;o!==f;o=s)s=t[a+o],t[a+o]=f}return{jleaf:c,q:f}}(u=A[f],a,d,y,m,g,0);N.jleaf>=1&&x[a]++,2===N.jleaf&&x[N.q]--}-1!==t[a]&&(d[0+a]=t[a])}for(a=0;a<m;a++)-1!==t[a]&&(x[t[a]]+=x[a]);return x}}),oG=ey("csSqr",["add","multiply","transpose"],r=>{var{add:e,multiply:t,transpose:n}=r,i=oL({add:e,multiply:t,transpose:n}),u=oH({transpose:n});return function(r,e,t){var n,a=e._ptr,o=e._size[1],s={};if(s.q=i(r,e),r&&!s.q)return null;if(t){var f=r?function(r,e,t,n){for(var i=r._values,u=r._index,a=r._ptr,o=r._size,s=r._datatype,f=o[0],c=o[1],l=[],h=[],p=0,m=0;m<c;m++){h[m]=p;for(var v=t?t[m]:m,d=a[v],g=a[v+1],y=d;y<g;y++){var b=u[y];l[p]=b,p++}}return h[c]=p,r.createSparseMatrix({values:null,index:l,ptr:h,size:[f,c],datatype:s})}(e,0,s.q,0):e;s.parent=function(r,e){if(!r)return null;var t,n,i=r._index,u=r._ptr,a=r._size,o=a[0],s=a[1],f=[],c=[];for(t=0;t<o;t++)c[s+t]=-1;for(var l=0;l<s;l++){f[l]=-1,c[0+l]=-1;for(var h=u[l],p=u[l+1],m=h;m<p;m++){var v=i[m];for(t=(0,c[s+v]);-1!==t&&t<l;t=n)n=c[0+t],c[0+t]=l,-1===n&&(f[t]=l);e&&(c[s+v]=l)}}return f}(f,1);var c=function(r,e){if(!r)return null;var t,n=0,i=[],u=[],a=2*e;for(t=0;t<e;t++)u[0+t]=-1;for(t=e-1;t>=0;t--)-1!==r[t]&&(u[e+t]=u[0+r[t]],u[0+r[t]]=t);for(t=0;t<e;t++)-1===r[t]&&(n=oq(t,n,u,0,e,i,a));return i}(s.parent,o);if(s.cp=u(f,s.parent,c,1),f&&s.parent&&s.cp&&function(r,e){var t,n,i,u,a,o=r._ptr,s=r._index,f=r._size,c=f[0],l=f[1];e.pinv=[],e.leftmost=[];var h=e.parent,p=e.pinv,m=e.leftmost,v=[],d=c+l,g=c+2*l;for(n=0;n<l;n++)v[c+n]=-1,v[d+n]=-1,v[g+n]=0;for(t=0;t<c;t++)m[t]=-1;for(n=l-1;n>=0;n--)for(u=o[n],a=o[n+1],i=u;i<a;i++)m[s[i]]=n;for(t=c-1;t>=0;t--)p[t]=-1,-1!==(n=m[t])&&(0==v[g+n]++&&(v[d+n]=t),v[0+t]=v[c+n],v[c+n]=t);for(n=0,e.lnz=0,e.m2=c;n<l;n++)if(t=v[c+n],e.lnz++,t<0&&(t=e.m2++),p[t]=n,!(--g[n]<=0)){e.lnz+=v[g+n];var y=h[n];-1!==y&&(0===v[g+y]&&(v[d+y]=v[d+n]),v[0+v[d+n]]=v[c+y],v[c+y]=v[0+t],v[g+y]+=v[g+n])}for(t=0;t<c;t++)p[t]<0&&(p[t]=n++);return!0}(f,s))for(s.unz=0,n=0;n<o;n++)s.unz+=s.cp[n]}else s.unz=4*a[o]+o,s.lnz=s.unz;return s}});function oV(r,e){r[e]=-r[e]-2}function oZ(r){return r<0?-r-2:r}var oY=ey("csSpsolve",["divideScalar","multiply","subtract"],r=>{var{divideScalar:e,multiply:t,subtract:n}=r;return function(r,i,u,a,o,s,f){var c,l,h,p,m=r._values,v=r._index,d=r._ptr,g=r._size[1],y=i._values,b=i._index,D=i._ptr,x=function(r,e,t,n,i){var u,a,o,s=r._ptr,f=r._size,c=e._index,l=e._ptr,h=f[1],p=h;for(a=l[t],o=l[t+1],u=a;u<o;u++){var m=c[u];s[m]<0||(p=function(r,e,t,n,i){var u,a,o,s=e._index,f=e._ptr,c=e._size[1],l=0;for(n[0]=r;l>=0;){r=n[l];var h,p,m=i?i[r]:r;f[r]<0||(oV(f,r),n[c+l]=m<0?0:(h=f[m])<0?-h-2:h);var v=1;for(a=n[c+l],o=m<0?0:(p=f[m+1])<0?-p-2:p;a<o;a++)if(!(f[u=s[a]]<0)){n[c+l]=a,n[++l]=u,v=0;break}v&&(l--,n[--t]=r)}return t}(m,r,p,n,i))}for(u=p;u<h;u++)oV(s,n[u]);return p}(r,i,u,a,s);for(c=x;c<g;c++)o[a[c]]=0;for(l=D[u],h=D[u+1],c=l;c<h;c++)o[b[c]]=y[c];for(var E=x;E<g;E++){var A=a[E],w=s?s[A]:A;if(!(w<0))for(l=d[w],h=d[w+1],o[A]=e(o[A],m[f?l:h-1]),c=f?l+1:l,p=f?h:h-1;c<p;c++){var N=v[c];o[N]=n(o[N],t(m[c],o[A]))}}return x}}),oX=ey("csLu",["abs","divideScalar","multiply","subtract","larger","largerEq","SparseMatrix"],r=>{var{abs:e,divideScalar:t,multiply:n,subtract:i,larger:u,largerEq:a,SparseMatrix:o}=r,s=oY({divideScalar:t,multiply:n,subtract:i});return function(r,i,f){if(!r)return null;var c,l,h,p=r._size[1],m=100,v=100;i&&(c=i.q,m=i.lnz||m,v=i.unz||v);var d=[],g=[],y=[],b=new o({values:d,index:g,ptr:y,size:[p,p]}),D=[],x=[],E=[],A=new o({values:D,index:x,ptr:E,size:[p,p]}),w=[],N=[],M=[];for(l=0;l<p;l++)N[l]=0,w[l]=-1,y[l+1]=0;m=0,v=0;for(var C=0;C<p;C++){y[C]=m,E[C]=v;var F=c?c[C]:C,S=s(b,r,F,M,N,w,1),_=-1,B=-1;for(h=S;h<p;h++)if(w[l=M[h]]<0){var T=e(N[l]);u(T,B)&&(B=T,_=l)}else x[v]=w[l],D[v++]=N[l];if(-1===_||B<=0)return null;w[F]<0&&a(e(N[F]),n(B,f))&&(_=F);var O=N[_];for(x[v]=C,D[v++]=O,w[_]=C,g[m]=_,d[m++]=1,h=S;h<p;h++)w[l=M[h]]<0&&(g[m]=l,d[m++]=t(N[l],O)),N[l]=0}for(h=0,y[p]=m,E[p]=v;h<m;h++)g[h]=w[g[h]];return d.splice(m,d.length-m),g.splice(m,g.length-m),D.splice(v,D.length-v),x.splice(v,x.length-v),{L:b,U:A,pinv:w}}}),oJ=ey("slu",["typed","abs","add","multiply","transpose","divideScalar","subtract","larger","largerEq","SparseMatrix"],r=>{var{typed:e,abs:t,add:n,multiply:i,transpose:u,divideScalar:a,subtract:o,larger:s,largerEq:f,SparseMatrix:c}=r,l=oG({add:n,multiply:i,transpose:u}),h=oX({abs:t,divideScalar:a,multiply:i,subtract:o,larger:s,largerEq:f,SparseMatrix:c});return e("slu",{"SparseMatrix, number, number":function(r,e,t){if(!eA(e)||e<0||e>3)throw Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(t<0||t>1)throw Error("Partial pivoting threshold must be a number from 0 to 1");var n=l(e,r,!1),i=h(r,n,t);return{L:i.L,U:i.U,p:i.pinv,q:n.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}),oW="subset",o$=ey(oW,["typed","matrix","zeros","add"],r=>{var{typed:e,matrix:t,zeros:n,add:i}=r;return e(oW,{"Matrix, Index":function(r,e){return ty(e)?t():(td(r,e),r.subset(e))},"Array, Index":e.referTo("Matrix, Index",function(r){return function(e,n){var i=r(t(e),n);return n.isScalar()?i:i.valueOf()}}),"Object, Index":o0,"string, Index":oQ,"Matrix, Index, any, any":function(r,e,t,u){return ty(e)?r:(td(r,e),r.clone().subset(e,function(r,e){if("string"==typeof r)throw Error("can't boradcast a string");if(e._isScalar)return r;var t=e.size();if(!t.every(r=>r>0))return r;try{return i(r,n(t))}catch(e){return r}}(t,e),u))},"Array, Index, any, any":e.referTo("Matrix, Index, any, any",function(r){return function(e,n,i,u){var a=r(t(e),n,i,u);return a.isMatrix?a.valueOf():a}}),"Array, Index, any":e.referTo("Matrix, Index, any, any",function(r){return function(e,n,i){return r(t(e),n,i,void 0).valueOf()}}),"Matrix, Index, any":e.referTo("Matrix, Index, any, any",function(r){return function(e,t,n){return r(e,t,n,void 0)}}),"string, Index, string":oK,"string, Index, string, string":oK,"Object, Index, any":o1})});function oQ(r,e){if(!rW(e))throw TypeError("Index expected");if(ty(e))return"";if(td(Array.from(r),e),1!==e.size().length)throw new th(e.size().length,1);var t=r.length;tg(e.min()[0],t),tg(e.max()[0],t);var n=e.dimension(0),i="";
1return n.forEach(function(e){i+=r.charAt(e)}),i}function oK(r,e,t,n){if(!e||!0!==e.isIndex)throw TypeError("Index expected");if(ty(e))return r;if(td(Array.from(r),e),1!==e.size().length)throw new th(e.size().length,1);if(void 0!==n){if("string"!=typeof n||1!==n.length)throw TypeError("Single character expected as defaultValue")}else n=" ";var i=e.dimension(0);if(i.size()[0]!==t.length)throw new th(i.size()[0],t.length);var u=r.length;tg(e.min()[0]),tg(e.max()[0]);for(var a=[],o=0;o<u;o++)a[o]=r.charAt(o);if(i.forEach(function(r,e){a[r]=t.charAt(e[0])}),a.length>u)for(var s=u-1,f=a.length;s<f;s++)a[s]||(a[s]=n);return a.join("")}function o0(r,e){if(!ty(e)){if(1!==e.size().length)throw new th(e.size(),1);var t=e.dimension(0);if("string"!=typeof t)throw TypeError("String expected as index to retrieve an object property");return tR(r,t)}}function o1(r,e,t){if(ty(e))return r;if(1!==e.size().length)throw new th(e.size(),1);var n=e.dimension(0);if("string"!=typeof n)throw TypeError("String expected as index to retrieve an object property");var i=em(r);return tU(i,n,t),i}var o2=ey("sum",["typed","config","add","numeric"],r=>{var{typed:e,config:t,add:n,numeric:i}=r;return e("sum",{"Array | Matrix":u,"Array | Matrix, number | BigNumber":function(r,e){try{return tK(r,e,n)}catch(r){throw uJ(r,"sum")}},"...":function(r){if(tW(r))throw TypeError("Scalar values expected in function sum");return u(r)}});function u(r){var e;return t$(r,function(r){try{e=void 0===e?r:n(e,r)}catch(e){throw uJ(e,"sum",r)}}),void 0===e&&(e=i(0,t.number)),"string"==typeof e&&(e=i(e,t.number)),e}}),o3=(r=>{var{typed:e,matrix:t,add:n}=r;return e("trace",{Array:function(r){return i(t(r))},SparseMatrix:function(r){var e=r._values,t=r._index,i=r._ptr,u=r._size,a=u[0],o=u[1];if(a===o){var s=0;if(e.length>0)for(var f=0;f<o;f++)for(var c=i[f],l=i[f+1],h=c;h<l;h++){var p=t[h];if(p===f){s=n(s,e[h]);break}if(p>f)break}return s}throw RangeError("Matrix must be square (size: "+ts(u)+")")},DenseMatrix:i,any:em});function i(r){var e=r._size,t=r._data;switch(e.length){case 1:if(1===e[0])return em(t[0]);throw RangeError("Matrix must be square (size: "+ts(e)+")");case 2:var i=e[0];if(i===e[1]){for(var u=0,a=0;a<i;a++)u=n(u,t[a][a]);return u}throw RangeError("Matrix must be square (size: "+ts(e)+")");default:throw RangeError("Matrix must be two dimensional (size: "+ts(e)+")")}}},"usolveAll"),o8=ey(o3,["typed","matrix","divideScalar","multiplyScalar","subtractScalar","equalScalar","DenseMatrix"],r=>{var{typed:e,matrix:t,divideScalar:n,multiplyScalar:i,subtractScalar:u,equalScalar:a,DenseMatrix:o}=r,s=aj({DenseMatrix:o});return e(o3,{"SparseMatrix, Array | Matrix":function(r,e){return function(r,e){for(var t=[s(r,e,!0)._data.map(r=>r[0])],f=r._size[0],c=r._size[1],l=r._values,h=r._index,p=r._ptr,m=c-1;m>=0;m--)for(var v=t.length,d=0;d<v;d++){for(var g=t[d],y=[],b=[],D=p[m],x=p[m+1],E=0,A=x-1;A>=D;A--){var w=h[A];w===m?E=l[A]:w<m&&(y.push(l[A]),b.push(w))}if(a(E,0))if(a(g[m],0)){if(0===d){var N=[...g];N[m]=1;for(var M=0,C=b.length;M<C;M++){var F=b[M];
1N[F]=u(N[F],y[M])}t.push(N)}}else{if(0===d)return[];t.splice(d,1),d-=1,v-=1}else{g[m]=n(g[m],E);for(var S=0,_=b.length;S<_;S++){var B=b[S];g[B]=u(g[B],i(g[m],y[S]))}}}return t.map(r=>new o({data:r.map(r=>[r]),size:[f,1]}))}(r,e)},"DenseMatrix, Array | Matrix":function(r,e){return f(r,e)},"Array, Array | Matrix":function(r,e){return f(t(r),e).map(r=>r.valueOf())}});function f(r,e){for(var t=[s(r,e,!0)._data.map(r=>r[0])],f=r._data,c=r._size[0],l=r._size[1],h=l-1;h>=0;h--)for(var p=t.length,m=0;m<p;m++){var v=t[m];if(a(f[h][h],0))if(a(v[h],0)){if(0===m){var d=[...v];d[h]=1;for(var g=h-1;g>=0;g--)d[g]=u(d[g],f[g][h]);t.push(d)}}else{if(0===m)return[];t.splice(m,1),m-=1,p-=1}else{v[h]=n(v[h],f[h][h]);for(var y=h-1;y>=0;y--)v[y]=u(v[y],i(v[h],f[y][h]))}}return t.map(r=>new o({data:r.map(r=>[r]),size:[c,1]}))}}),o5="zpk2tf",o4=(r=>{var{typed:e,add:t,multiply:n,Complex:i,number:u}=r;return e(o5,{"Array,Array,number":function(r,e,t){return a(r,e,t)},"Array,Array":function(r,e){return a(r,e,1)},"Matrix,Matrix,number":function(r,e,t){return a(r.valueOf(),e.valueOf(),t)},"Matrix,Matrix":function(r,e){return a(r.valueOf(),e.valueOf(),1)}});function a(r,e,t){r.some(r=>"BigNumber"===r.type)&&(r=r.map(r=>u(r))),e.some(r=>"BigNumber"===r.type)&&(e=e.map(r=>u(r)));for(var a=[i(1,0)],s=[i(1,0)],f=0;f<r.length;f++){var c=r[f];"number"==typeof c&&(c=i(c,0)),a=o(a,[i(1,0),i(-c.re,-c.im)])}for(var l=0;l<e.length;l++){var h=e[l];"number"==typeof h&&(h=i(h,0)),s=o(s,[i(1,0),i(-h.re,-h.im)])}for(var p=0;p<a.length;p++)a[p]=n(a[p],t);return[a,s]}function o(r,e){for(var u=[],a=0;a<r.length+e.length-1;a++){u[a]=i(0,0);for(var o=0;o<r.length;o++)a-o>=0&&a-o<e.length&&(u[a]=t(u[a],n(r[o],e[a-o])))}return u}},"ceil"),o7=ey(o4,["typed","config","round"],r=>{var{typed:e,config:t,round:n}=r;return e(o4,{number:function(r){return ej(r,n(r),t.epsilon)?n(r):Math.ceil(r)},"number, number":function(r,e){if(ej(r,n(r,e),t.epsilon))return n(r,e);var[i,u]="".concat(r,"e").split("e"),a=Math.ceil(Number("".concat(i,"e").concat(Number(u)+e)));return[i,u]="".concat(a,"e").split("e"),Number("".concat(i,"e").concat(Number(u)-e))}})}),o9=ey(o4,["typed","config","round","matrix","equalScalar","zeros","DenseMatrix"],r=>{var{typed:e,config:t,round:n,matrix:i,equalScalar:u,zeros:a,DenseMatrix:o}=r,s=am({typed:e,equalScalar:u}),f=av({typed:e,DenseMatrix:o}),c=ag({typed:e}),l=o7({typed:e,config:t,round:n});return e("ceil",{number:l.signatures.number,"number,number":l.signatures["number,number"],Complex:function(r){return r.ceil()},"Complex, number":function(r,e){return r.ceil(e)},"Complex, BigNumber":function(r,e){return r.ceil(e.toNumber())},BigNumber:function(r){return iu(r,n(r),t.epsilon)?n(r):r.ceil()},"BigNumber, BigNumber":function(r,e){return iu(r,n(r,e),t.epsilon)?n(r,e):r.toDecimalPlaces(e.toNumber(),rU.ROUND_CEIL)},Fraction:function(r){return r.ceil()},"Fraction, number":function(r,e){return r.ceil(e)},"Fraction, BigNumber":function(r,e){return r.ceil(e.toNumber())},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0)),"Array, number | BigNumber":e.referToSelf(r=>(e,t)=>tQ(e,e=>r(e,t),!0)),"SparseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>s(e,t,r,!1)),"DenseMatrix, number | BigNumber":e.referToSelf(r=>(e,t)=>c(e,t,r,!1)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(r=>(e,t)=>c(i(t),e,r,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(r=>(e,t)=>u(e,0)?a(t.size(),t.storage()):"dense"===t.storage()?c(t,e,r,!0):f(t,e,r,!0))})}),o6=t(189),sr=t.n(o6),se="compareNatural",st=ey(se,["typed","compare"],r=>{var{typed:e,compare:t}=r,n=t.signatures["boolean,boolean"];return e(se,{"any, any":function r(e,u){var a,o,s,f=ep(e),c=ep(u);if(("number"===f||"BigNumber"===f||"Fraction"===f)&&("number"===c||"BigNumber"===c||"Fraction"===c))return"0"!==(s=t(e,u)).toString()?s>0?1:-1:sr()(f,c);var l=["Array","DenseMatrix","SparseMatrix"];
1if(l.includes(f)||l.includes(c))return 0!==(s=function r(e,t,n){return rX(t)&&rX(n)?i(e,t.toJSON().values,n.toJSON().values):rX(t)?r(e,t.toArray(),n):rX(n)?r(e,t,n.toArray()):rY(t)?r(e,t.toJSON().data,n):rY(n)?r(e,t,n.toJSON().data):Array.isArray(t)?Array.isArray(n)?i(e,t,n):r(e,t,[n]):r(e,[t],n)}(r,e,u))?s:sr()(f,c);if(f!==c)return sr()(f,c);if("Complex"===f){return a=e,o=u,a.re>o.re?1:a.re<o.re?-1:a.im>o.im?1:a.im<o.im?-1:0}if("Unit"===f)return e.equalBase(u)?r(e.value,u.value):i(r,e.formatUnits(),u.formatUnits());if("boolean"===f)return n(e,u);if("string"===f)return sr()(e,u);if("Object"===f)return function(r,e,t){var n=Object.keys(e),u=Object.keys(t);n.sort(sr()),u.sort(sr());var a=i(r,n,u);if(0!==a)return a;for(var o=0;o<n.length;o++){var s=r(e[n[o]],t[u[o]]);if(0!==s)return s}return 0}(r,e,u);if("null"===f||"undefined"===f)return 0;throw TypeError('Unsupported type of value "'+f+'"')}});function i(r,e,t){for(var n=0,i=Math.min(e.length,t.length);n<i;n++){var u=r(e[n],t[n]);if(0!==u)return u}return e.length>t.length?1:e.length<t.length?-1:0}}),sn="composition",si=(r=>{var{typed:e,addScalar:t,combinations:n,isPositive:i,isNegative:u,isInteger:a,larger:o}=r;return e(sn,{"number | BigNumber, number | BigNumber":function(r,e){if(a(r)&&i(r)&&a(e)&&i(e)){if(o(e,r))throw TypeError("k must be less than or equal to n in function composition")}else throw TypeError("Positive integer value expected in function composition");return n(t(r,-1),t(e,-1))}})},"cross"),su=(r=>{var{typed:e,matrix:t,subtract:n,multiply:i}=r;return e(si,{"Matrix, Matrix":function(r,e){return t(u(r.toArray(),e.toArray()))},"Matrix, Array":function(r,e){return t(u(r.toArray(),e))},"Array, Matrix":function(r,e){return t(u(r,e.toArray()))},"Array, Array":u});function u(r,e){var t=Math.max(tm(r).length,tm(e).length);r=tA(r),e=tA(e);var u=tm(r),a=tm(e);if(1!==u.length||1!==a.length||3!==u[0]||3!==a[0])throw RangeError("Vectors with length 3 expected (Size A = ["+u.join(", ")+"], B = ["+a.join(", ")+"])");var o=[n(i(r[1],e[2]),i(r[2],e[1])),n(i(r[2],e[0]),i(r[0],e[2])),n(i(r[0],e[1]),i(r[1],e[0]))];return t>1?[o]:o}},ey("det",["typed","matrix","subtractScalar","multiply","divideScalar","isZero","unaryMinus"],r=>{var{typed:e,matrix:t,subtractScalar:n,multiply:i,divideScalar:u,isZero:a,unaryMinus:o}=r;return e("det",{any:function(r){return em(r)},"Array | Matrix":function(r){var e;switch((e=rV(r)?r.size():Array.isArray(r)?(r=t(r)).size():[]).length){case 0:return em(r);case 1:if(1===e[0])return em(r.valueOf()[0]);if(0===e[0])return 1;throw RangeError("Matrix must be square (size: "+ts(e)+")");case 2:var s=e[0],f=e[1];if(s===f)return function(r,e,t){if(1===e)return em(r[0][0]);if(2===e)return n(i(r[0][0],r[1][1]),i(r[1][0],r[0][1]));for(var s=!1,f=Array(e).fill(0).map((r,e)=>e),c=0;c<e;c++){var l=f[c];if(a(r[l][c])){var h=void 0;for(h=c+1;h<e;h++)if(!a(r[f[h]][c])){l=f[h],f[h]=f[c],f[c]=l,s=!s;break}if(h===e)return r[l][c]}for(var p=r[l][c],m=0===c?1:r[f[c-1]][c-1],v=c+1;v<e;v++)for(var d=f[v],g=c+1;g<e;g++)r[d][g]=u(n(i(r[d][g],p),i(r[d][c],r[l][g])),m)}var y=r[f[e-1]][e-1];return s?o(y):y}(r.clone().valueOf(),s,0);if(0===f)return 1;throw RangeError("Matrix must be square (size: "+ts(e)+")");default:throw RangeError("Matrix must be two dimensional (size: "+ts(e)+")")}}})})),sa="dotMultiply",so=(r=>
1{var{typed:e,matrix:t,equalScalar:n,multiplyScalar:i,concat:u}=r,a=al({typed:e,equalScalar:n}),o=or({typed:e,equalScalar:n}),s=am({typed:e,equalScalar:n}),f=ab({typed:e,matrix:t,concat:u});return e(sa,f({elop:i,SS:o,DS:a,Ss:s}))},ey("FibonacciHeap",["smaller","larger"],r=>{var{smaller:e,larger:t}=r,n=1/Math.log((1+Math.sqrt(5))/2);function i(){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function u(r,e,t){e.left.right=e.right,e.right.left=e.left,t.degree--,t.child===e&&(t.child=e.right),0===t.degree&&(t.child=null),e.left=r,e.right=r.right,r.right=e,e.right.left=e,e.parent=null,e.mark=!1}i.prototype.type="FibonacciHeap",i.prototype.isFibonacciHeap=!0,i.prototype.insert=function(r,t){var n={key:r,value:t,degree:0};if(this._minimum){var i=this._minimum;n.left=i,n.right=i.right,i.right=n,n.right.left=n,e(r,i.key)&&(this._minimum=n)}else n.left=n,n.right=n,this._minimum=n;return this._size++,n},i.prototype.size=function(){return this._size},i.prototype.clear=function(){this._minimum=null,this._size=0},i.prototype.isEmpty=function(){return 0===this._size},i.prototype.extractMinimum=function(){var r=this._minimum;if(null===r)return r;for(var i=this._minimum,u=r.degree,o=r.child;u>0;){var s=o.right;o.left.right=o.right,o.right.left=o.left,o.left=i,o.right=i.right,i.right=o,o.right.left=o,o.parent=null,o=s,u--}return r.left.right=r.right,r.right.left=r.left,i=r===r.right?null:function(r,i){var u,o=Math.floor(Math.log(i)*n)+1,s=Array(o),f=0,c=r;if(c)for(f++,c=c.right;c!==r;)f++,c=c.right;for(;f>0;){for(var l=c.degree,h=c.right;u=s[l];){if(t(c.key,u.key)){var p=u;u=c,c=p}a(u,c),s[l]=null,l++}s[l]=c,c=h,f--}r=null;for(var m=0;m<o;m++)(u=s[m])&&(r?(u.left.right=u.right,u.right.left=u.left,u.left=r,u.right=r.right,r.right=u,u.right.left=u,e(u.key,r.key)&&(r=u)):r=u);return r}(i=r.right,this._size),this._size--,this._minimum=i,r},i.prototype.remove=function(r){var t,n,i,a;this._minimum=(t=this._minimum,i=-1,(n=r).key=-1,(a=n.parent)&&e(n.key,a.key)&&(u(t,n,a),function r(e,t){var n=t.parent;n&&(t.mark?(u(e,t,n),r(n)):t.mark=!0)}(t,a)),e(n.key,t.key)&&(t=n),t),this.extractMinimum()};var a=function(r,e){r.left.right=r.right,r.right.left=r.left,r.parent=e,e.child?(r.left=e.child,r.right=e.child.right,e.child.right=r,r.right.left=r):(e.child=r,r.right=r,r.left=r),e.degree++,r.mark=!1};return i},{isClass:!0})),ss=ey("fix",["typed","ceil","floor"],r=>{var{typed:e,ceil:t,floor:n}=r;return e("fix",{number:function(r){return r>0?n(r):t(r)},"number, number":function(r,e){return r>0?n(r,e):t(r,e)}})}),sf=ey("fix",["typed","Complex","matrix","ceil","floor","equalScalar","zeros","DenseMatrix"],r=>{var{typed:e,Complex:t,matrix:n,ceil:i,floor:u,equalScalar:a,zeros:o,DenseMatrix:s}=r,f=av({typed:e,DenseMatrix:s}),c=ag({typed:e}),l=ss({typed:e,ceil:i,floor:u});return e("fix",{number:l.signatures.number,"number, number | BigNumber":l.signatures["number,number"],Complex:function(r){return new t(r.re>0?Math.floor(r.re):Math.ceil(r.re),r.im>0?Math.floor(r.im):Math.ceil(r.im))},"Complex, number":function(r,e){return new t(r.re>0?u(r.re,e):i(r.re,e),r.im>0?u(r.im,e):i(r.im,e))},"Complex, BigNumber":function(r,e){var n=e.toNumber();return new t(r.re>0?u(r.re,n):i(r.re,n),r.im>0?u(r.im,n):i(r.im,n))},BigNumber:function(r){return r.isNegative()?i(r):u(r)},"BigNumber, number | BigNumber":function(r,e){return r.isNegative()?i(r,e):u(r,e)},Fraction:function(r){return r.s<0?r.ceil():r.floor()},"Fraction, number | BigNumber":function(r,e){return r.s<0?i(r,e):u(r,e)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r,!0)),"Array | Matrix, number | BigNumber":e.referToSelf(r=>(e,t)=>tQ(e,e=>r(e,t),!0)),"number | Complex | Fraction | BigNumber, Array":e.referToSelf(r=>(e,t)=>c(n(t),e,r,!0).valueOf()),"number | Complex | Fraction | BigNumber, Matrix":e.referToSelf(r=>(e,t)=>a(e,0)?o(t.size(),t.storage()):"dense"===t.storage()?c(t,e,r,!0):f(t,e,r,!0))})}),sc="index",sl=ey(sc,["typed","Index"],r=>{var{typed:e,Index:t}=r;return e(sc,{"...number | string | BigNumber | Range | Array | Matrix":function(r){var e=r.map(function(r){return rj(r)?r.toNumber():rG(r)||rV(r)?r.map(function(r){return rj(r)?r.toNumber():r}):r}),n=new t;return t.apply(n,e),n}})}),sh=(r=>{var{typed:e,config:t,abs:n,add:i,addScalar:u,matrix:a,multiply:o,multiplyScalar:s,divideScalar:f,subtract:c,smaller:l,equalScalar:h,flatten:p,isZero:m,isNumeric:v}=r;return e("intersect",{"Array, Array, Array":d,"Array, Array, Array, Array":g,"Matr
1ix, Matrix, Matrix":function(r,e,t){var n=d(r.valueOf(),e.valueOf(),t.valueOf());return null===n?null:a(n)},"Matrix, Matrix, Matrix, Matrix":function(r,e,t,n){var i=g(r.valueOf(),e.valueOf(),t.valueOf(),n.valueOf());return null===i?null:a(i)}});function d(r,e,t){var n,i,a,o,l,h,p,m,d,g,b,x,E,A,w,N,M,C;if(r=y(r),e=y(e),t=y(t),!D(r))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!D(e))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!(4===(n=t).length&&v(n[0])&&v(n[1])&&v(n[2])&&v(n[3])))throw TypeError("Array with 4 numbers expected as third argument");return i=r[0],a=r[1],o=r[2],l=e[0],h=e[1],p=e[2],m=t[0],d=t[1],g=t[2],b=t[3],x=s(i,m),E=s(l,m),A=s(a,d),w=s(h,d),N=s(o,g),M=s(p,g),C=f(c(c(c(b,x),A),N),c(c(c(u(u(E,w),M),x),A),N)),[u(i,s(C,c(l,i))),u(a,s(C,c(h,a))),u(o,s(C,c(p,o)))]}function g(r,e,a,p){if(r=y(r),e=y(e),a=y(a),p=y(p),2===r.length){if(!b(r))throw TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!b(e))throw TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!b(a))throw TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!b(p))throw TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(r,e,a,h){var p=c(r,e),v=c(a,h),d=c(s(p[0],v[1]),s(v[0],p[1]));if(m(d)||l(n(d),t.epsilon))return null;var g=s(v[0],r[1]),y=s(v[1],r[0]),b=s(v[0],a[1]),D=s(v[1],a[0]);return i(o(p,f(u(c(c(g,y),b),D),d)),r)}(r,e,a,p)}if(3===r.length){if(!D(r))throw TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!D(e))throw TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!D(a))throw TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!D(p))throw TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return function(r,e,t,n,i,a,o,l,p,v,d,g){var y=x(r,o,v,o,e,l,d,l,t,p,g,p),b=x(v,o,n,r,d,l,i,e,g,p,a,t),D=x(r,o,n,r,e,l,i,e,t,p,a,t),E=x(v,o,v,o,d,l,d,l,g,p,g,p),A=x(n,r,n,r,i,e,i,e,a,t,a,t),w=c(s(y,b),s(D,E)),N=c(s(A,E),s(b,b));if(m(N))return null;var M=f(w,N),C=f(u(y,s(M,b)),E),F=u(r,s(M,c(n,r))),S=u(e,s(M,c(i,e))),_=u(t,s(M,c(a,t))),B=u(o,s(C,c(v,o))),T=u(l,s(C,c(d,l))),O=u(p,s(C,c(g,p)));return h(F,B)&&h(S,T)&&h(_,O)?[F,S,_]:null}(r[0],r[1],r[2],e[0],e[1],e[2],a[0],a[1],a[2],p[0],p[1],p[2])}throw TypeError("Arrays with two or thee dimensional points expected")}function y(r){return 1===r.length?r[0]:r.length>1&&Array.isArray(r[0])&&r.every(r=>Array.isArray(r)&&1===r.length)?p(r):r}function b(r){return 2===r.length&&v(r[0])&&v(r[1])}function D(r){return 3===r.length&&v(r[0])&&v(r[1])&&v(r[2])}function x(r,e,t,n,i,a,o,f,l,h,p,m){var v=s(c(r,e),c(t,n)),d=s(c(i,a),c(o,f)),g=s(c(l,h),c(p,m));return u(u(v,d),g)}},"invmod"),sp=(r=>{var{typed:e,config:t,BigNumber:n,xgcd:i,equal:u,smaller:a,mod:o,add:s,isInteger:f}=r;return e(sh,{"number, number":c,"BigNumber, BigNumber":c});function c(r,e){if(!f(r)||!f(e))throw Error("Parameters in function invmod must be integer numbers");if(r=o(r,e),u(e,0))throw Error("Divisor must be non zero");var t=i(r,e),[c,l]=t=t.valueOf();return u(c,n(1))?(a(l=o(l,e),n(0))&&(l=s(l,e)),l):NaN}},"log1p"),sm=(r=>{var{typed:e,config:t,divideScalar:n,log:i,Complex:u}=r;return e(sp,{number:function(r){return r>=-1||t.predictable?eC(r):a(new u(r,0))},Complex:a,BigNumber:function(r){var e=r.plus(1);return!e.isNegative()||t.predictable?e.ln():a(new u(r.toNumber(),0))},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r)),"any, any":e.referToSelf(r=>(e,t)=>n(r(e),i(t)))});function a(r){var e=r.re+1;return new u(Math.log(Math.sqrt(e*e+r.im*r.im)),Math.atan2(r.im,e))}},ey("max",["typed","config","numeric","larger"],r=>{var{typed:e,config:t,numeric:n,larger:i}=r;return e("max",{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(r,e){return tK(r,e.valueOf(),u)},"...":function(r){if(tW(r))throw TypeError("Scalar values expected in function max");return a(r)}});function u(r,e){try{return i(r,e)?r:e}catch(r){throw uJ(r,"max",e)}}function a(r){var e;if(t$(r,function(r){try{isNaN(r)&&"number"==typeof r?e=NaN:(void 0===e||i(r,e))&&(e=r)}catch(e){throw uJ(e,"max",r)}}),void 0===e)throw Error("Cannot calculate max of an empty array");return"string"==typeof e&&(e=n(e,t.number)),e}})),sv="setCartesian",sd=(r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:u,DenseMatrix:a}=r;return e(sv,{"Array | Matrix, Array | Matrix":function(r,e){var o=[];if(0!==n(t(r),new u(0))&&0!==n(t(e),new u(0))){var s=tN(Array.isArray(r)?r:r.toArray()).sort(i),f=tN(Array.isArray(e)?e:e.toArray()).sort(i);o=[];for(var c=0;c<s.length;c++)for(var l=0;l<f.length;l++)o.push([s[c],f[l]])}return Array.isArray(r)&&Array.isArray(e)?o:new a(o)}})},"setDistinct"),sg=(r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:u,DenseMatrix:a}=r;return e(sd,{"Array | Matrix":function(r){var e;if(0===n(t(r),new u(0)))e=[];else{var o=tN(Array.isArray(r)?r:r.toArray()).sort(i);(e=[]).push(o[0]);for(var s=1;s<o.length;s++)0!==i(o[s],o[s-1])&&e.push(o[s])}return Array.isArray(r)?e:new a(e)}})},"setIsSubset"),sy=(r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:u}=r;return e(sg,{"Array | Matrix, Array | Matrix":function(r,e){if(0===n(t(r),new u(0)))return!0;
1if(0===n(t(e),new u(0)))return!1;for(var a,o=tC(tN(Array.isArray(r)?r:r.toArray()).sort(i)),s=tC(tN(Array.isArray(e)?e:e.toArray()).sort(i)),f=0;f<o.length;f++){a=!1;for(var c=0;c<s.length;c++)if(0===i(o[f].value,s[c].value)&&o[f].identifier===s[c].identifier){a=!0;break}if(!1===a)return!1}return!0}})},"setPowerset"),sb=(r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:u}=r;return e(sy,{"Array | Matrix":function(r){if(0===n(t(r),new u(0)))return[];for(var e=tN(Array.isArray(r)?r:r.toArray()).sort(i),a=[],o=0;o.toString(2).length<=e.length;)a.push(function(r,e){for(var t=[],n=0;n<e.length;n++)"1"===e[n]&&t.push(r[n]);return t}(e,o.toString(2).split("").reverse())),o++;for(var s=a,f=[],c=s.length-1;c>0;c--)for(var l=0;l<c;l++)s[l].length>s[l+1].length&&(f=s[l],s[l]=s[l+1],s[l+1]=f);return s}})},"smallerEq"),sD=ey(sb,["typed","config","matrix","DenseMatrix","concat"],r=>{var{typed:e,config:t,matrix:n,DenseMatrix:i,concat:u}=r,a=ah({typed:e}),o=ap({typed:e,DenseMatrix:i}),s=av({typed:e,DenseMatrix:i}),f=ab({typed:e,matrix:n,concat:u}),c=ia({typed:e});return e(sb,sx({typed:e,config:t}),{"boolean, boolean":(r,e)=>r<=e,"BigNumber, BigNumber":function(r,e){return r.lte(e)||iu(r,e,t.epsilon)},"Fraction, Fraction":(r,e)=>1!==r.compare(e),"Complex, Complex":function(){throw TypeError("No ordering relation is defined for complex numbers")}},c,f({SS:o,DS:a,Ss:s}))}),sx=ey(sb,["typed","config"],r=>{var{typed:e,config:t}=r;return e(sb,{"number, number":function(r,e){return r<=e||ej(r,e,t.epsilon)}})}),sE="sort",sA=(r=>{var{typed:e,matrix:t,compare:n,compareNatural:i}=r,u=(r,e)=>-n(r,e);return e(sE,{Array:function(r){return o(r),r.sort(n)},Matrix:function(r){return s(r),t(r.toArray().sort(n),r.storage())},"Array, function":function(r,e){return o(r),r.sort(e)},"Matrix, function":function(r,e){return s(r),t(r.toArray().sort(e),r.storage())},"Array, string":function(r,e){return o(r),r.sort(a(e))},"Matrix, string":function(r,e){return s(r),t(r.toArray().sort(a(e)),r.storage())}});function a(r){if("asc"===r)return n;if("desc"===r)return u;if("natural"===r)return i;throw Error('String "asc", "desc", or "natural" expected')}function o(r){if(1!==tm(r).length)throw Error("One dimensional array expected")}function s(r){if(1!==r.size().length)throw Error("One dimensional matrix expected")}},"range"),sw=ey(sA,["typed","config","?matrix","?bignumber","smaller","smallerEq","larger","largerEq","add","isPositive"],r=>{var{typed:e,config:t,matrix:n,bignumber:i,smaller:u,smallerEq:a,larger:o,largerEq:s,add:f,isPositive:c}=r;return e(sA,{string:h,"string, boolean":h,"number, number":function(r,e){return l(p(r,e,1,!1))},"number, number, number":function(r,e,t){return l(p(r,e,t,!1))},"number, number, boolean":function(r,e,t){return l(p(r,e,1,t))},"number, number, number, boolean":function(r,e,t,n){return l(p(r,e,t,n))},"BigNumber, BigNumber":function(r,e){var t=r.constructor;return l(p(r,e,new t(1),!1))},"BigNumber, BigNumber, BigNumber":function(r,e,t){return l(p(r,e,t,!1))},"BigNumber, BigNumber, boolean":function(r,e,t){var n=r.constructor;return l(p(r,e,new n(1),t))},"BigNumber, BigNumber, BigNumber, boolean":function(r,e,t,n){return l(p(r,e,t,n))},"Unit, Unit, Unit":function(r,e,t){return l(p(r,e,t,!1))},"Unit, Unit, Unit, boolean":function(r,e,t,n){return l(p(r,e,t,n))}});function l(r){return"Matrix"===t.matrix?n?n(r):uY():r}function h(r,e){var n=function(r){var e=r.split(":").map(function(r){return Number(r)});if(e.some(function(r){return isNaN(r)}))return null;switch(e.length){case 2:return{start:e[0],end:e[1],step:1};case 3:return{start:e[0],end:e[2],step:e[1]};default:return null}}(r);if(!n)throw SyntaxError('String "'+r+'" is no valid range');return"BigNumber"===t.number?(void 0===i&&uV(),l(p(i(n.start),i(n.end),i(n.step)),e)):l(p(n.start,n.end,n.step,e))}function p(r,e,t,n){for(var i=[],l=c(t)?n?a:u:n?s:o,h=r;l(h,e);)i.push(h),h=f(h,t);return i}}),sN=(r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e("row",{"Matrix, number":u,"Array, number":function(r,e){return u(n(em(r)),e).valueOf()}});function u(r,e){if(2!==r.size().length)throw Error("Only two dimensional matrix is supported");tg(e,r.size()[0]);var u=new t(e,i(0,r.size()[1])),a=r.subset(u);return rV(a)?a:n([[a]])}},"setDifference"),sM=ey(sN,["typed","size","subset","compareNatural","Index","DenseMatrix"],r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:u,DenseMatrix:a}=r;return e(sN,{"Array | Matrix, Array | Matrix":function(r,e){var o;if(0===n(t(r),new u(0)))o=[];else{if(0===n(t(e),new u(0)))return tN(r.toArray());var s,f=tC(tN(Array.isArray(r)?r:r.toArray()).sort(i)),c=tC(tN(Array.isArray(e)?e:e.toArray()).sort(i));o=[];for(var l=0;l<f.length;l++){s=!1;for(var h=0;h<c.length;h++)if(0===i(f[l].value,c[h].value)&&f[l].identifier===c[h].identifier){s=!0;break}s||o.push(f[l])}}return Array.isArray(r)&&Array.isArray(e)?tF(o):new a(tF(o))}})}),sC="setMultiplicity",sF=(r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:u}=r;return e(sC,{"number | BigNumber | Fraction | Complex, Array | Matrix":function(r,e){if(0===n(t(e),new u(0)))return 0;for(var a=tN(Array.isArray(e)?e:e.toArray()),o=0,s=0;s<a.length;s++)0===i(a[s],r)&&o++;return o}})},"setSymDifference"),sS=ey(sF,["typed","size","concat","subset","setDifference","Index"],r=>{var{typed:e,size:t,concat:n,subset:i,setDifference:u,Index:a}=r;return e(sF,{"Array | Matrix, Array | Matrix":function(r,e){if(0===i(t(r),new a(0)))return tN(e);if(0===i(t(e),new a(0)))return tN(r);var o=tN(r),s=tN(e);return n(u(o,s),u(s,o))}})}),s_=ey("Spa",["addScalar","equalScalar","FibonacciHeap"],r=>{var{addScalar:e,equalScalar:t,FibonacciHeap:n}=r;function i(){if(!(this instanceof i))throw SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new n}return i.prototype.type="Spa",i.prototype.isSpa=!0,i.prototype.set=function(r,e){if(this._values[r])this._values[r].value=e;else{var t=this._heap.insert(r,e);this._values[r]=t}},i.prototype.get=function(r){var e=this._values[r];return e?e.value:0},i.prototype.accumulate=function(r,t){var n=this._values[r];n?n.value=e(n.value,t):(n=this._heap.insert(r,t),this._values[r]=n)},i.prototype.forEach=function(r,e,n){var i=this._heap,u=this._values,a=[],o=i.extractMinimum();for(o&&a.push(o);o&&o.key<=e;)o.key>=r&&!t(o.value,0)&&n(o.key,o.value,this),(o=i.extractMinimum())&&a.push(o);for(var s=0;s<a.length;s++){var f=a[s];u[(o=i.insert(f.key,f.value)).key]=o}},i.prototype.swap=function(r,e){var t=this._values[r],n=this._values[e];if(!t&&n)t=this._heap.insert(r,n.value),this._heap.remove(n),this._values[r]=t,this._values[e]=void 0;else if(t&&!n)n=this._heap.insert(e,t.value),this._heap.remove(t),this._values[e]=n,this._values[r]=void 0;else if(t&&n){var i=t.value;
1t.value=n.value,n.value=i}},i},{isClass:!0}),sB="column",sT=ey(sB,["typed","Index","matrix","range"],r=>{var{typed:e,Index:t,matrix:n,range:i}=r;return e(sB,{"Matrix, number":u,"Array, number":function(r,e){return u(n(em(r)),e).valueOf()}});function u(r,e){if(2!==r.size().length)throw Error("Only two dimensional matrix is supported");tg(e,r.size()[1]);var u=new t(i(0,r.size()[0]),e),a=r.subset(u);return rV(a)?a:n([[a]])}}),sO=ey("inv",["typed","matrix","divideScalar","addScalar","multiply","unaryMinus","det","identity","abs"],r=>{var{typed:e,matrix:t,divideScalar:n,addScalar:i,multiply:u,unaryMinus:a,det:o,identity:s,abs:f}=r;return e("inv",{"Array | Matrix":function(r){var e=rV(r)?r.size():tm(r);switch(e.length){case 1:if(1===e[0])if(rV(r))return t([n(1,r.valueOf()[0])]);else return[n(1,r[0])];throw RangeError("Matrix must be square (size: "+ts(e)+")");case 2:var i=e[0],u=e[1];if(i===u)if(rV(r))return t(c(r.valueOf(),i,u),r.storage());else return c(r,i,u);throw RangeError("Matrix must be square (size: "+ts(e)+")");default:throw RangeError("Matrix must be two dimensional (size: "+ts(e)+")")}},any:function(r){return n(1,r)}});function c(r,e,t){if(1===e){if(0===(p=r[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[n(1,p)]]}if(2===e){var c,l,h,p,m,v=o(r);if(0===v)throw Error("Cannot calculate inverse, determinant is zero");return[[n(r[1][1],v),n(a(r[0][1]),v)],[n(a(r[1][0]),v),n(r[0][0],v)]]}var d=r.concat();for(c=0;c<e;c++)d[c]=d[c].concat();for(var g=s(e).valueOf(),y=0;y<t;y++){var b=f(d[y][y]),D=y;for(c=y+1;c<e;)f(d[c][y])>b&&(b=f(d[c][y]),D=c),c++;if(0===b)throw Error("Cannot calculate inverse, determinant is zero");(c=D)!==y&&(m=d[y],d[y]=d[c],d[c]=m,m=g[y],g[y]=g[c],g[c]=m);var x=d[y],E=g[y];for(c=0;c<e;c++){var A=d[c],w=g[c];if(c!==y){if(0!==A[y]){for(h=n(a(A[y]),x[y]),l=y;l<t;l++)A[l]=i(A[l],u(h,x[l]));for(l=0;l<t;l++)w[l]=i(w[l],u(h,E[l]))}}else{for(h=x[y],l=y;l<t;l++)A[l]=n(A[l],h);for(l=0;l<t;l++)w[l]=n(w[l],h)}}}return g}}),sz=ey("lup",["typed","matrix","abs","addScalar","divideScalar","multiplyScalar","subtractScalar","larger","equalScalar","unaryMinus","DenseMatrix","SparseMatrix","Spa"],r=>{var{typed:e,matrix:t,abs:n,addScalar:i,divideScalar:u,multiplyScalar:a,subtractScalar:o,larger:s,equalScalar:f,unaryMinus:c,DenseMatrix:l,SparseMatrix:h,Spa:p}=r;return e("lup",{DenseMatrix:function(r){return m(r)},SparseMatrix:function(r){return function(r){var e,t,i,o=r._size[0],l=r._size[1],m=Math.min(o,l),v=r._values,d=r._index,g=r._ptr,y=[],b=[],D=[],x=[o,m],E=[],A=[],w=[],N=[m,l],M=[],C=[];for(e=0;e<o;e++)M[e]=e,C[e]=e;var F=function(r,e){var t=C[r],n=C[e];M[t]=e,M[n]=r,C[r]=n,C[e]=t};for(t=0;t<l;t++)!function(){var r=new p;t<o&&(D.push(y.length),y.push(1),b.push(t)),w.push(E.length);var l=g[t],m=g[t+1];for(i=l;i<m;i++)e=d[i],r.set(M[e],v[i]);t>0&&r.forEach(0,t-1,function(e,t){h._forEachRow(e,y,b,D,function(n,i){n>e&&r.accumulate(n,c(a(i,t)))})});var C=t,S=r.get(t),_=n(S);r.forEach(t+1,o-1,function(r,e){var t=n(e);s(t,_)&&(C=r,_=t,S=e)}),t!==C&&(h._swapRows(t,C,x[1],y,b,D),h._swapRows(t,C,N[1],E,A,w),r.swap(t,C),F(t,C)),r.forEach(0,o-1,function(r,e){r<=t?(E.push(e),A.push(r)):f(e=u(e,S),0)||(y.push(e),b.push(r))})}();return w.push(E.length),D.push(y.length),{L:new h({values:y,index:b,ptr:D,size:x}),U:new h({values:E,index:A,ptr:w,size:N}),p:M,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}(r)},Array:function(r){var e=m(t(r));return{L:e.L.valueOf(),U:e.U.valueOf(),p:e.p}}});function m(r){var e,t,c,h=r._size[0],p=r._size[1],m=Math.min(h,p),v=em(r._data),d=[],g=[h,m],y=[],b=[m,p],D=[];for(e=0;e<h;e++)D[e]=e;for(t=0;t<p;t++){if(t>0)for(e=0;e<h;e++){var x=Math.min(e,t),E=0;for(c=0;c<x;c++)E=i(E,a(v[e][c],v[c][t]));v[e][t]=o(v[e][t],E)}var A=t,w=0,N=0;for(e=t;e<h;e++){var M=v[e][t],C=n(M);s(C,w)&&(A=e,w=C,N=M)}if(t!==A&&(D[t]=[D[A],D[A]=D[t]][0],l._swapRows(t,A,v)),t<h)for(e=t+1;e<h;e++)f(v[e][t],0)||(v[e][t]=u(v[e][t],N))}for(t=0;t<p;t++)for(e=0;e<h;e++){if(0===t&&(e<p&&(y[e]=[]),d[e]=[]),e<t){e<p&&(y[e][t]=v[e][t]),t<h&&(d[e][t]=0);continue}if(e===t){e<p&&(y[e][t]=v[e][t]),t<h&&(d[e][t]=1);continue}e<p&&(y[e][t]=0),t<h&&(d[e][t]=v[e][t])}var F=new l({data:d,size:g}),S=new l({data:y,size:b}),_=[];for(e=0,m=D.length;e<m;e++)_[D[e]]=e;return{L:F,U:S,p:_,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}}),sI="pinv",sR=(r=>{var{typed:e,matrix:t,inv:n,deepEqual:i,equal:u,dotDivide:a,dot:o,ctranspose:s,divideScalar:f,multiply:c,add:l,Complex:h}=r;return e(sI,{"Array | Matrix":function(r){var e=rV(r)?r.size():tm(r);switch(e.length){case 1:if(v(r))return s(r);if(1===e[0])return n(r);return a(s(r),o(r,r));case 2:if(v(r))return s(r);var i=e[0],u=e[1];if(i===u)try{return n(r)}catch(r){if(r instanceof Error&&r.message.match(/Cannot calculate inverse, determinant is zero/));else throw r}if(rV(r))return t(p(r.valueOf(),i,u),r.storage());return p(r,i,u);
1default:throw RangeError("Matrix must be two dimensional (size: "+ts(e)+")")}},any:function(r){return u(r,0)?em(r):f(1,r)}});function p(r,e,t){var i,u,f,{C:h,F:p}=(f=function(r,e,t){for(var n=em(r),i=0,u=0;u<e&&!(t<=i);u++){for(var o=u;m(n[o][i]);)if(e===++o&&(o=u,t===++i))return n;[n[o],n[u]]=[n[u],n[o]];for(var s=n[u][i],f=0;f<t;f++)n[u][f]=a(n[u][f],s);for(var h=0;h<e;h++)if(h!==u){s=n[h][i];for(var p=0;p<t;p++)n[h][p]=l(n[h][p],c(-1,c(s,n[u][p])))}i++}return n}(i=r,u=e,t),{C:i.map((r,e)=>r.filter((r,e)=>e<u&&!m(o(f[e],f[e])))),F:f.filter((r,e)=>!m(o(f[e],f[e])))}),v=c(n(c(s(h),h)),s(h)),d=c(s(p),n(c(p,s(p))));return c(d,v)}function m(r){return u(l(r,h(1,1)),l(0,h(1,1)))}function v(r){return i(l(r,h(1,1)),l(c(r,0),h(1,1)))}},ey("pow",["typed","config","identity","multiply","matrix","inv","fraction","number","Complex"],r=>{var{typed:e,config:t,identity:n,multiply:i,matrix:u,inv:a,number:o,fraction:s,Complex:f}=r;return e("pow",{"number, number":c,"Complex, Complex":function(r,e){return r.pow(e)},"BigNumber, BigNumber":function(r,e){return e.isInteger()||r>=0||t.predictable?r.pow(e):new f(r.toNumber(),0).pow(e.toNumber(),0)},"Fraction, Fraction":function(r,e){var n=r.pow(e);if(null!=n)return n;if(!t.predictable)return c(r.valueOf(),e.valueOf());throw Error("Result of pow is non-rational and cannot be expressed as a fraction")},"Array, number":l,"Array, BigNumber":function(r,e){return l(r,e.toNumber())},"Matrix, number":h,"Matrix, BigNumber":function(r,e){return h(r,e.toNumber())},"Unit, number | BigNumber":function(r,e){return r.pow(e)}});function c(r,e){if(t.predictable&&!eA(e)&&r<0)try{var n=s(e),i=o(n);if((e===i||1e-14>Math.abs((e-i)/e))&&n.d%2==1)return(n.n%2==0?1:-1)*Math.pow(-r,e)}catch(r){}return t.predictable&&(r<-1&&e===1/0||r>-1&&r<0&&e===-1/0)?NaN:eA(e)||r>=0||t.predictable?nf(r,e):r*r<1&&e===1/0||r*r>1&&e===-1/0?0:new f(r,0).pow(e,0)}function l(r,e){if(!eA(e))throw TypeError("For A^b, b must be an integer (value is "+e+")");var t=tm(r);if(2!==t.length)throw Error("For A^b, A must be 2 dimensional (A has "+t.length+" dimensions)");if(t[0]!==t[1])throw Error("For A^b, A must be square (size is "+t[0]+"x"+t[1]+")");if(e<0)try{return l(a(r),-e)}catch(r){if("Cannot calculate inverse, determinant is zero"===r.message)throw TypeError("For A^b, when A is not invertible, b must be a positive integer (value is "+e+")");throw r}for(var u=n(t[0]).valueOf(),o=r;e>=1;)(1&e)==1&&(u=i(o,u)),e>>=1,o=i(o,o);return u}function h(r,e){return u(l(r.valueOf(),e))}})),sU="setIntersect",sP=ey(sU,["typed","size","subset","compareNatural","Index","DenseMatrix"],r=>{var{typed:e,size:t,subset:n,compareNatural:i,Index:u,DenseMatrix:a}=r;return e(sU,{"Array | Matrix, Array | Matrix":function(r,e){var o;if(0===n(t(r),new u(0))||0===n(t(e),new u(0)))o=[];else{var s=tC(tN(Array.isArray(r)?r:r.toArray()).sort(i)),f=tC(tN(Array.isArray(e)?e:e.toArray()).sort(i));o=[];for(var c=0;c<s.length;c++)for(var l=0;l<f.length;l++)if(0===i(s[c].value,f[l].value)&&s[c].identifier===f[l].identifier){o.push(s[c]);break}}return Array.isArray(r)&&Array.isArray(e)?tF(o):new a(tF(o))}})}),sj="setUnion",sk=(r=>{var{typed:e,size:t,concat:n,subset:i,setIntersect:u,setSymDifference:a,Index:o}=r;return e(sj,{"Array | Matrix, Array | Matrix":function(r,e){if(0===i(t(r),new o(0)))return tN(e);if(0===i(t(e),new o(0)))return tN(r);var s=tN(r),f=tN(e);return n(a(s,f),u(s,f))}})},"sqrtm"),sq=(r=>{var{typed:e,abs:t,add:n,multiply:i,map:u,sqrt:a,subtract:o,inv:s,size:f,max:c,identity:l}=r;return e(sk,{"Array | Matrix":function(r){var e=rV(r)?r.size():tm(r);switch(e.length){case 1:if(1===e[0])return u(r,a);throw RangeError("Matrix must be square (size: "+ts(e)+")");case 2:if(e[0]===e[1])return function(r){var e,u=0,a=r,h=l(f(r));do{var p=a;if(a=i(.5,n(p,s(h))),h=i(.5,n(h,s(p))),(e=c(t(o(a,p))))>1e-6&&++u>1e3)throw Error("computing square root of matrix: iterative method could not converge")}while(e>1e-6);return a}(r);throw RangeError("Matrix must be square (size: "+ts(e)+")");default:throw RangeError("Matrix must be at most two dimensional (size: "+ts(e)+")")}}})},t(48021));function sL(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,n)}return t}function sH(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};
1e%2?sL(Object(t),!0).forEach(function(e){(0,sq.A)(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):sL(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}var sG=ey("Unit",["?on","config","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","abs","fix","round","equal","isNumeric","format","number","Complex","BigNumber","Fraction"],r=>{var e,t,i,{on:u,config:a,addScalar:o,subtractScalar:s,multiplyScalar:f,divideScalar:c,pow:l,abs:h,fix:p,round:m,equal:v,isNumeric:d,format:g,number:y,Complex:b,BigNumber:D,Fraction:x}=r;function E(r,e){if(!(this instanceof E))throw Error("Constructor must be called with the new operator");if(!(null==r||d(r)||rk(r)))throw TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(this.fixPrefix=!1,this.skipAutomaticSimplification=!0,void 0===e)this.units=[],this.dimensions=T.map(r=>0);else if("string"==typeof e){var t=E.parse(e);this.units=t.units,this.dimensions=t.dimensions}else if(rL(e)&&null===e.value)this.fixPrefix=e.fixPrefix,this.skipAutomaticSimplification=e.skipAutomaticSimplification,this.dimensions=e.dimensions.slice(0),this.units=e.units.map(r=>(0,n.A)({},r));else throw TypeError("Second parameter in Unit constructor must be a string or valueless Unit");this.value=this._normalize(r)}function A(){for(;" "===i||" "===i;)N()}function w(r){return r>="0"&&r<="9"}function N(){t++,i=e.charAt(t)}function M(r){t=r,i=e.charAt(t)}function C(){var r,e="",n=t;if("+"===i?N():"-"===i&&(e+=i,N()),!((r=i)>="0"&&r<="9"||"."===r))return M(n),null;if("."===i){if(e+=i,N(),!w(i))return M(n),null}else{for(;w(i);)e+=i,N();"."===i&&(e+=i,N())}for(;w(i);)e+=i,N();if("E"===i||"e"===i){var u="",a=t;if(u+=i,N(),("+"===i||"-"===i)&&(u+=i,N()),!w(i))return M(a),e;for(e+=u;w(i);)e+=i,N()}return e}function F(r){return i===r?(N(),r):null}Object.defineProperty(E,"name",{value:"Unit"}),E.prototype.constructor=E,E.prototype.type="Unit",E.prototype.isUnit=!0,E.parse=function(r,n){if(n=n||{},t=-1,i="","string"!=typeof(e=r))throw TypeError("Invalid argument in Unit.parse, string expected");var u=new E;u.units=[];var o=1,s=!1;N(),A();var f=C(),c=null;if(f){if("BigNumber"===a.number)c=new D(f);else if("Fraction"===a.number)try{c=new x(f)}catch(r){c=parseFloat(f)}else c=parseFloat(f);A(),F("*")?(o=1,s=!0):F("/")&&(o=-1,s=!0)}for(var l=[],h=1;;){for(A();"("===i;)l.push(o),h*=o,o=1,N(),A();var p=void 0;if(i){var m=i;if(null===(p=function(){for(var r="";w(i)||E.isValidAlpha(i);)r+=i,N();var e=r.charAt(0);return E.isValidAlpha(e)?r:null}()))throw SyntaxError('Unexpected "'+m+'" in "'+e+'" at index '+t.toString())}else break;var v=S(p);if(null===v)throw SyntaxError('Unit "'+p+'" not found.');var d=o*h;if(A(),F("^")){A();var g=C();if(null===g)throw SyntaxError('In "'+r+'", "^" must be followed by a floating-point number');d*=g}u.units.push({unit:v.unit,prefix:v.prefix,power:d});for(var y=0;y<T.length;y++)u.dimensions[y]+=(v.unit.dimensions[y]||0)*d;for(A();")"===i;){if(0===l.length)throw SyntaxError('Unmatched ")" in "'+e+'" at index '+t.toString());h/=l.pop(),N(),A()}if(s=!1,F("*")?(o=1,s=!0):F("/")?(o=-1,s=!0):o=1,v.unit.base){var b=v.unit.base.key;j.auto[b]={unit:v.unit,prefix:v.prefix}}}if(A(),i)throw SyntaxError('Could not parse: "'+r+'"');if(s)throw SyntaxError('Trailing characters: "'+r+'"');if(0!==l.length)throw SyntaxError('Unmatched "(" in "'+e+'"');if(0===u.units.length&&!n.allowNoUnits)throw SyntaxError('"'+r+'" contains
1no units');return u.value=void 0!==c?u._normalize(c):null,u},E.prototype.clone=function(){var r=new E;r.fixPrefix=this.fixPrefix,r.skipAutomaticSimplification=this.skipAutomaticSimplification,r.value=em(this.value),r.dimensions=this.dimensions.slice(0),r.units=[];for(var e=0;e<this.units.length;e++)for(var t in r.units[e]={},this.units[e])eg(this.units[e],t)&&(r.units[e][t]=this.units[e][t]);return r},E.prototype.valueType=function(){return ep(this.value)},E.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},E.prototype._normalize=function(r){if(null==r||0===this.units.length)return r;for(var e=r,t=E._getNumberConverter(ep(r)),n=0;n<this.units.length;n++){var i=t(this.units[n].unit.value),u=t(this.units[n].prefix.value),a=t(this.units[n].power);e=f(e,l(f(i,u),a))}return e},E.prototype._denormalize=function(r,e){if(null==r||0===this.units.length)return r;for(var t=r,n=E._getNumberConverter(ep(r)),i=0;i<this.units.length;i++){var u=n(this.units[i].unit.value),a=n(this.units[i].prefix.value),o=n(this.units[i].power);t=c(t,l(f(u,a),o))}return t};var S=eJ(r=>{if(eg(R,r)){var e=R[r],t=e.prefixes[""];return{unit:e,prefix:t}}for(var n in R)if(eg(R,n)&&function(r,e){var t=r.length-e.length,n=r.length;return r.substring(t,n)===e}(r,n)){var i=R[n],u=r.length-n.length,a=r.substring(0,u),o=eg(i.prefixes,a)?i.prefixes[a]:void 0;if(void 0!==o)return{unit:i,prefix:o}}return null},{hasher:r=>r[0],limit:100});function _(r){return r.equalBase(O.NONE)&&null!==r.value&&!a.predictable?r.value:r}E.isValuelessUnit=function(r){return null!==S(r)},E.prototype.hasBase=function(r){if("string"==typeof r&&(r=O[r]),!r)return!1;for(var e=0;e<T.length;e++)if(Math.abs((this.dimensions[e]||0)-(r.dimensions[e]||0))>1e-12)return!1;return!0},E.prototype.equalBase=function(r){for(var e=0;e<T.length;e++)if(Math.abs((this.dimensions[e]||0)-(r.dimensions[e]||0))>1e-12)return!1;return!0},E.prototype.equals=function(r){return this.equalBase(r)&&v(this.value,r.value)},E.prototype.multiply=function(r){for(var e=this.clone(),t=rL(r)?r:new E(r),n=0;n<T.length;n++)e.dimensions[n]=(this.dimensions[n]||0)+(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var u=sH({},t.units[i]);e.units.push(u)}return null!==this.value||null!==t.value?e.value=f(null===this.value?this._normalize(1):this.value,null===t.value?t._normalize(1):t.value):e.value=null,rL(r)&&(e.skipAutomaticSimplification=!1),_(e)},E.prototype.divideInto=function(r){return new E(r).divide(this)},E.prototype.divide=function(r){for(var e=this.clone(),t=rL(r)?r:new E(r),n=0;n<T.length;n++)e.dimensions[n]=(this.dimensions[n]||0)-(t.dimensions[n]||0);for(var i=0;i<t.units.length;i++){var u=sH(sH({},t.units[i]),{},{power:-t.units[i].power});e.units.push(u)}return null!==this.value||null!==t.value?e.value=c(null===this.value?this._normalize(1):this.value,null===t.value?t._normalize(1):t.value):e.value=null,rL(r)&&(e.skipAutomaticSimplification=!1),_(e)},E.prototype.pow=function(r){for(var e=this.clone(),t=0;t<T.length;t++)e.dimensions[t]=(this.dimensions[t]||0)*r;for(var n=0;n<e.units.length;n++)e.units[n].power*=r;return null!==e.value?e.value=l(e.value,r):e.value=null,e.skipAutomaticSimplification=!1,_(e)},E.prototype.abs=function(){var r=this.clone();if(null!==r.value)if(r._isDerived()||0===r.units.length||0===r.units[0].unit.offset)r.value=h(r.value);else{var e=r._numberConverter(),t=f(e(r.units[0].unit.value),e(r.units[0].unit.offset));r.value=s(h(o(r.value,t)),t)}for(var n in r.units)("VA"===r.units[n].unit.name||"VAR"===r.units[n].unit.name)&&(r.units[n].unit=R.W);return r},E.prototype.to=function(r){var e,t=null===this.value?this._normalize(1):this.value;if("string"==typeof r)e=E.parse(r);else if(rL(r))e=r.clone();else throw Error("String or Unit expected as parameter");if(!this.equalBase(e))throw Error("Units do not match ('".concat(e.toString(),"' != '").concat(this.toString(),"')"));if(null!==e.value)throw Error("Cannot convert to a unit with a value");if(null===this.value||this._isDerived()||0===this.units.length||0===e.units.length||this.units[0].unit.offset===e.units[0].unit.offset)e.value=em(t);else{var n=E._getNumberConverter(ep(t)),i=f(this.units[0].unit.value,this.units[0].unit.offset),u=f(e.units[0].unit.value,e.units[0].unit.offset);e.value=o(t,n(s(i,u)))}return e.fixPrefix=!0,e.skipAutomaticSimplification=!0,e},E.prototype.toNumber=function(r){return y(this.toNumeric(r))},E.prototype.toNumeric=function(r){var e;return(e=r?this.to(r):this.clone())._isDerived()||0===e.units.length?e._denormalize(e.value):e._denormalize(e.value,e.units[0].prefix.value)},E.prototype.toString=function(){return this.format()},E.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},E.fromJSON=function(r){var e=new E(r.value,r.unit);return e.fixPrefix=r.fixPrefix||!1,e},E.prototype.valueOf=E.prototype.toString,E.prototype.simplify=function(){var r,e,t=this.clone(),n=[];for(var i in k)if(eg(k,i)&&t.hasBase(O[i])){r=i;break}if("NONE"===r)t.units=[];else if(r&&eg(k,r)&&(e=k[r]),e)t.units=[{unit:e.unit,prefix:e.prefix,power:1}];else{for(var u=!1,a=0;a<T.length;a++){var o=T[a];Math.abs(t.dimensions[a]||0)>1e-12&&(eg(k,o)?n.push({unit:k[o].unit,prefix:k[o].prefix,power:t.dimensions[a]||0}):u=!0)}n.length<t.units.length&&!u&&(t.units=n)}return t},E.prototype.toSI=function(){for(var r=this.clone(),e=[],t=0;t<T.length;t++){var n=T[t];if(Math.abs(r.dimensions[t]||0)>1e-12)if(eg(j.si,n))e.push({unit:j.si[n].unit,prefix:j.si[n].prefix,power:r.dimensions[t]||0});else throw Error("Cannot express custom unit "+n+" in SI units")}
1return(r.units=e,r.fixPrefix=!0,r.skipAutomaticSimplification=!0,null!==this.value)?(r.value=null,this.to(r)):r},E.prototype.formatUnits=function(){for(var r="",e="",t=0,n=0,i=0;i<this.units.length;i++)this.units[i].power>0?(t++,r+=" "+this.units[i].prefix.name+this.units[i].unit.name,Math.abs(this.units[i].power-1)>1e-15&&(r+="^"+this.units[i].power)):this.units[i].power<0&&n++;if(n>0)for(var u=0;u<this.units.length;u++)this.units[u].power<0&&(t>0?(e+=" "+this.units[u].prefix.name+this.units[u].unit.name,Math.abs(this.units[u].power+1)>1e-15&&(e+="^"+-this.units[u].power)):(e+=" "+this.units[u].prefix.name+this.units[u].unit.name,e+="^"+this.units[u].power));r=r.substr(1),e=e.substr(1),t>1&&n>0&&(r="("+r+")"),n>1&&t>0&&(e="("+e+")");var a=r;return t>0&&n>0&&(a+=" / "),a+=e},E.prototype.format=function(r){var e=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),t=!1;for(var n in void 0!==e.value&&null!==e.value&&rk(e.value)&&(t=1e-14>Math.abs(e.value.re)),e.units)eg(e.units,n)&&e.units[n].unit&&("VA"===e.units[n].unit.name&&t?e.units[n].unit=R.VAR:"VAR"!==e.units[n].unit.name||t||(e.units[n].unit=R.VA));1===e.units.length&&!e.fixPrefix&&1e-14>Math.abs(e.units[0].power-Math.round(e.units[0].power))&&(e.units[0].prefix=e._bestPrefix());var i=e._denormalize(e.value),u=null!==e.value?g(i,r||{}):"",a=e.formatUnits();return e.value&&rk(e.value)&&(u="("+u+")"),a.length>0&&u.length>0&&(u+=" "),u+=a},E.prototype._bestPrefix=function(){if(1!==this.units.length||Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var r=null!==this.value?h(this.value):0,e=h(this.units[0].unit.value),t=this.units[0].prefix;if(0===r)return t;var n=this.units[0].power,i=Math.log(r/Math.pow(t.value*e,n))/Math.LN10-1.2;if(i>-2.200001&&i<1.800001)return t;i=Math.abs(i);var u=this.units[0].unit.prefixes;for(var a in u)if(eg(u,a)){var o=u[a];if(o.scientific){var s=Math.abs(Math.log(r/Math.pow(o.value*e,n))/Math.LN10-1.2);(s<i||s===i&&o.name.length<t.name.length)&&(t=o,i=s)}}return t},E.prototype.splitUnit=function(r){for(var e=this.clone(),t=[],n=0;n<r.length&&(e=e.to(r[n]),n!==r.length-1);n++){var i=e.toNumeric(),u=m(i),a=void 0,f=new E(v(u,i)?u:p(e.toNumeric()),r[n].toString());t.push(f),e=s(e,f)}for(var c=0,l=0;l<t.length;l++)c=o(c,t[l].value);return v(c,this.value)&&(e.value=0),t.push(e),t};var B={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}
1,pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0},ronto:{name:"ronto",value:1e-27,scientific:!0},quecto:{name:"quecto",value:1e-30,scientific:!0}},SQUARED:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:100,scientific:!1},h:{name:"h",value:1e4,scientific:!1},k:{name:"k",value:1e6,scientific:!0},M:{name:"M",value:1e12,scientific:!0},G:{name:"G",value:1e18,scientific:!0},T:{name:"T",value:1e24,scientific:!0},P:{name:"P",value:1e30,scientific:!0},E:{name:"E",value:1e36,scientific:!0},Z:{name:"Z",value:1e42,scientific:!0},Y:{name:"Y",value:1e48,scientific:!0},R:{name:"R",value:1e54,scientific:!0},Q:{name:"Q",value:1e60,scientific:!0},d:{name:"d",value:.01,scientific:!1},c:{name:"c",value:1e-4,scientific:!1},m:{name:"m",value:1e-6,scientific:!0},u:{name:"u",value:1e-12,scientific:!0},n:{name:"n",value:1e-18,scientific:!0},p:{name:"p",value:1e-24,scientific:!0},f:{name:"f",value:1e-30,scientific:!0},a:{name:"a",value:1e-36,scientific:!0},z:{name:"z",value:1e-42,scientific:!0},y:{name:"y",value:1e-48,scientific:!0},r:{name:"r",value:1e-54,scientific:!0},q:{name:"q",value:1e-60,scientific:!0}},CUBIC:{"":{name:"",value:1,scientific:!0},da:{name:"da",value:1e3,scientific:!1},h:{name:"h",value:1e6,scientific:!1},k:{name:"k",value:1e9,scientific:!0},M:{name:"M",value:1e18,scientific:!0},G:{name:"G",value:1e27,scientific:!0},T:{name:"T",value:1e36,scientific:!0},P:{name:"P",value:1e45,scientific:!0},E:{name:"E",value:1e54,scientific:!0},Z:{name:"Z",value:1e63,scientific:!0},Y:{name:"Y",value:1e72,scientific:!0},R:{name:"R",value:1e81,scientific:!0},Q:{name:"Q",value:1e90,scientific:!0},d:{name:"d",value:.001,scientific:!1},c:{name:"c",value:1e-6,scientific:!1},m:{name:"m",value:1e-9,scientific:!0},u:{name:"u",value:1e-18,scientific:!0},n:{name:"n",value:1e-27,scientific:!0},p:{name:"p",value:1e-36,scientific:!0},f:{name:"f",value:1e-45,scientific:!0},a:{name:"a",value:1e-54,scientific:!0},z:{name:"z",value:1e-63,scientific:!0},y:{name:"y",value:1e-72,scientific:!0},r:{name:"r",value:1e-81,scientific:!0},q:{name:"q",value:1e-90,scientific:!0}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:1048576,scientific:!0},Gi:{name:"Gi",value:0x40000000,scientific:!0},Ti:{name:"Ti",value:0x10000000000,scientific:!0},Pi:{name:"Pi",value:0x4000000000000,scientific:!0},Ei:{name:"Ei",value:0x1000000000000000,scientific:!0},Zi:{name:"Zi",value:11805916207174113e5,scientific:!0},Yi:{name:"Yi",value:12089258196146292e8,scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:1048576,scientific:!0},gibi:{name:"gibi",value:0x40000000,scientific:!0},tebi:{name:"tebi",value:0x10000000000,scientific:!0},pebi:{name:"pebi",value:0x4000000000000,scientific:!0},exi:{name:"exi",value:0x1000000000000000,scientific:!0},zebi:{name:"zebi",value:11805916207174113e5,scientific:!0},yobi:{name:"yobi",value:12089258196146292e8,scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};B.SHORTLONG=(0,n.A)({},B.SHORT,B.LONG),B.BINARY_SHORT=(0,n.A)({},B.BINARY_SHORT_SI,B.BINARY_SHORT_IEC),B.BINARY_LONG=(0,n.A)({},B.BINARY_LONG_SI,B.BINARY_LONG_IEC);var T=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],O={NONE:{dimensions:[0,0,0,0,0,0,0,0,0]},MASS:{dimensions:[1,0,0,0,0,0,0,0,0]},LENGTH:{dimensions:[0,1,0,0,0,0,0,0,0]},TIME:{dimensions:[0,0,1,0,0,0,0,0,0]},CURRENT:{dimensions:[0,0,0,1,0,0,0,0,0]},TEMPERATURE:{dimensions:[0,0,0,0,1,0,0,0,0]},LUMINOUS_INTENSITY:{dimensions:[0,0,0,0,0,1,0,0,0]},AMOUNT_OF_SUBSTANCE:{dimensions:[0,0,0,0,0,0,1,0,0]},FORCE:{dimensions:[1,1,-2,0,0,0,0,0,0]},SURFACE:{dimensions:[0,2,0,0,0,0,0,0,0]},VOLUME:{dimensions:[0,3,0,0,0,0,0,0,0]},ENERGY:{dimensions:[1,2,-2,0,0,0,0,0,0]},POWER:{dimensions:[1,2,-3,0,0,0,0,0,0]},PRESSURE:{dimensions:[1,-1,-2,0,0,0,0,0,0]},ELECTRIC_CHARGE:{dimensions:[0,0,1,1,0,0,0,0,0]},ELECTRIC_CAPACITANCE:{dimensions:[-1,-2,4,2,0,0,0,0,0]},ELECTRIC_POTENTIAL:{dimensions:[1,2,-3,-1,0,0,0,0,0]},ELECTRIC_RESISTANCE:{dimensions:[1,2,-3,-2,0,0,0,0,0]},ELECTRIC_INDUCTANCE:{dimensions:[1,2,-2,-2,0,0,0,0,0]},ELECTRIC_CONDUCTANCE:{dimensions:[-1,-2,3,2,0,0,0,0,0]},MAGNETIC_FLUX:{dimensions:[1,2,-2,-1,0,0,0,0,0]},MAGNETIC_FLUX_DENSITY:{dimensions:[1,0,-2,-1,0,0,0,0,0]},FREQUENCY:{dimensions:[0,0,-1,0,0,0,0,0,0]},ANGLE:{dimensions:[0,0,0,0,0,0,0,1,0]},BIT:{dimensions:[0,0,0,0,0,0,0,0,1]}};for(var z in O)eg(O,z)&&(O[z].key=z);var I={name:"",base:{},value:1,offset:0,dimensions:T.map(r=>0)},R={meter:{name:"meter",base:O.LENGTH,prefixes:B.LONG,value:1,offset:0},inch:{name:"inch",base:O.LENGTH,prefixes:B.NONE,value:.0254,offset:0},foot:{name:"foot",base:O.LENGTH,prefixes:B.NONE,value:.3048,offset:0},yard:{name:"yard",base:O.LENGTH,prefixes:B.NONE,value:.9144,offset:0},mile:{name:"mile",base:O.LENGTH,prefixes:B.NONE,value:1609.344,offset:0},link:{name:"link",base:O.LENGTH,prefixes:B.NONE,value:.201168,offset:0}
1,rod:{name:"rod",base:O.LENGTH,prefixes:B.NONE,value:5.0292,offset:0},chain:{name:"chain",base:O.LENGTH,prefixes:B.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:O.LENGTH,prefixes:B.NONE,value:1e-10,offset:0},m:{name:"m",base:O.LENGTH,prefixes:B.SHORT,value:1,offset:0},in:{name:"in",base:O.LENGTH,prefixes:B.NONE,value:.0254,offset:0},ft:{name:"ft",base:O.LENGTH,prefixes:B.NONE,value:.3048,offset:0},yd:{name:"yd",base:O.LENGTH,prefixes:B.NONE,value:.9144,offset:0},mi:{name:"mi",base:O.LENGTH,prefixes:B.NONE,value:1609.344,offset:0},li:{name:"li",base:O.LENGTH,prefixes:B.NONE,value:.201168,offset:0},rd:{name:"rd",base:O.LENGTH,prefixes:B.NONE,value:5.02921,offset:0},ch:{name:"ch",base:O.LENGTH,prefixes:B.NONE,value:20.1168,offset:0},mil:{name:"mil",base:O.LENGTH,prefixes:B.NONE,value:254e-7,offset:0},m2:{name:"m2",base:O.SURFACE,prefixes:B.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:O.SURFACE,prefixes:B.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:O.SURFACE,prefixes:B.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:O.SURFACE,prefixes:B.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:O.SURFACE,prefixes:B.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:O.SURFACE,prefixes:B.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:O.SURFACE,prefixes:B.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:O.SURFACE,prefixes:B.NONE,value:64516e-14,offset:0},acre:{name:"acre",base:O.SURFACE,prefixes:B.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:O.SURFACE,prefixes:B.NONE,value:1e4,offset:0},m3:{name:"m3",base:O.VOLUME,prefixes:B.CUBIC,value:1,offset:0},L:{name:"L",base:O.VOLUME,prefixes:B.SHORT,value:.001,offset:0},l:{name:"l",base:O.VOLUME,prefixes:B.SHORT,value:.001,offset:0},litre:{name:"litre",base:O.VOLUME,prefixes:B.LONG,value:.001,offset:0},cuin:{name:"cuin",base:O.VOLUME,prefixes:B.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:O.VOLUME,prefixes:B.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:O.VOLUME,prefixes:B.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:O.VOLUME,prefixes:B.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:O.VOLUME,prefixes:B.NONE,value:15e-6,offset:0},drop:{name:"drop",base:O.VOLUME,prefixes:B.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:O.VOLUME,prefixes:B.NONE,value:5e-8,offset:0},minim:{name:"minim",base:O.VOLUME,prefixes:B.NONE,value:6161152e-14,offset:0},fluiddram:{name:"fluiddram",base:O.VOLUME,prefixes:B.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:O.VOLUME,prefixes:B.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:O.VOLUME,prefixes:B.NONE,value:1182941e-10,offset:0},cc:{name:"cc",base:O.VOLUME,prefixes:B.NONE,value:1e-6,offset:0},cup:{name:"cup",base:O.VOLUME,prefixes:B.NONE,value:2365882e-10,offset:0},pint:{name:"pint",base:O.VOLUME,prefixes:B.NONE,value:4731765e-10,offset:0},quart:{name:"quart",base:O.VOLUME,prefixes:B.NONE,value:9463529e-10,offset:0},gallon:{name:"gallon",base:O.VOLUME,prefixes:B.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:O.VOLUME,prefixes:B.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:O.VOLUME,prefixes:B.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:O.VOLUME,prefixes:B.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:O.VOLUME,prefixes:B.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:O.VOLUME,prefixes:B.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:O.VOLUME,prefixes:B.NONE,value:1182941e-10,offset:0},cp:{name:"cp",base:O.VOLUME,prefixes:B.NONE,value:2365882e-10,offset:0},pt:{name:"pt",base:O.VOLUME,prefixes:B.NONE,value:4731765e-10,offset:0},qt:{name:"qt",base:O.VOLUME,prefixes:B.NONE,value:9463529e-10,offset:0},gal:{name:"gal",base:O.VOLUME,prefixes:B.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:O.VOLUME,prefixes:B.NONE,value:.1173478,offset:0},obl:{name:"obl",base:O.VOLUME,prefixes:B.NONE,value:.1589873,offset:0},g:{name:"g",base:O.MASS,prefixes:B.SHORT,value:.001,offset:0},gram:{name:"gram",base:O.MASS,prefixes:B.LONG,value:.001,offset:0},ton:{name:"ton",base:O.MASS,prefixes:B.SHORT,value:907.18474,offset:0},t:{name:"t",base:O.MASS,prefixes:B.SHORT,value:1e3,offset:0},tonne:{name:"tonne",base:O.MASS,prefixes:B.LONG,value:1e3,offset:0},grain:{name:"grain",base:O.MASS,prefixes:B.NONE,value:6479891e-11,offset:0}
1,dram:{name:"dram",base:O.MASS,prefixes:B.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:O.MASS,prefixes:B.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:O.MASS,prefixes:B.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:O.MASS,prefixes:B.NONE,value:45.359237,offset:0},stick:{name:"stick",base:O.MASS,prefixes:B.NONE,value:.115,offset:0},stone:{name:"stone",base:O.MASS,prefixes:B.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:O.MASS,prefixes:B.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:O.MASS,prefixes:B.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:O.MASS,prefixes:B.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:O.MASS,prefixes:B.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:O.MASS,prefixes:B.NONE,value:45.359237,offset:0},s:{name:"s",base:O.TIME,prefixes:B.SHORT,value:1,offset:0},min:{name:"min",base:O.TIME,prefixes:B.NONE,value:60,offset:0},h:{name:"h",base:O.TIME,prefixes:B.NONE,value:3600,offset:0},second:{name:"second",base:O.TIME,prefixes:B.LONG,value:1,offset:0},sec:{name:"sec",base:O.TIME,prefixes:B.LONG,value:1,offset:0},minute:{name:"minute",base:O.TIME,prefixes:B.NONE,value:60,offset:0},hour:{name:"hour",base:O.TIME,prefixes:B.NONE,value:3600,offset:0},day:{name:"day",base:O.TIME,prefixes:B.NONE,value:86400,offset:0},week:{name:"week",base:O.TIME,prefixes:B.NONE,value:604800,offset:0},month:{name:"month",base:O.TIME,prefixes:B.NONE,value:2629800,offset:0},year:{name:"year",base:O.TIME,prefixes:B.NONE,value:0x1e187e0,offset:0},decade:{name:"decade",base:O.TIME,prefixes:B.NONE,value:315576e3,offset:0},century:{name:"century",base:O.TIME,prefixes:B.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:O.TIME,prefixes:B.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:O.FREQUENCY,prefixes:B.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:O.FREQUENCY,prefixes:B.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:O.ANGLE,prefixes:B.SHORT,value:1,offset:0},radian:{name:"radian",base:O.ANGLE,prefixes:B.LONG,value:1,offset:0},deg:{name:"deg",base:O.ANGLE,prefixes:B.SHORT,value:null,offset:0},degree:{name:"degree",base:O.ANGLE,prefixes:B.LONG,value:null,offset:0},grad:{name:"grad",base:O.ANGLE,prefixes:B.SHORT,value:null,offset:0},gradian:{name:"gradian",base:O.ANGLE,prefixes:B.LONG,value:null,offset:0},cycle:{name:"cycle",base:O.ANGLE,prefixes:B.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:O.ANGLE,prefixes:B.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:O.ANGLE,prefixes:B.NONE,value:null,offset:0},A:{name:"A",base:O.CURRENT,prefixes:B.SHORT,value:1,offset:0},ampere:{name:"ampere",base:O.CURRENT,prefixes:B.LONG,value:1,offset:0}
1,K:{name:"K",base:O.TEMPERATURE,prefixes:B.SHORT,value:1,offset:0},degC:{name:"degC",base:O.TEMPERATURE,prefixes:B.SHORT,value:1,offset:273.15},degF:{name:"degF",base:O.TEMPERATURE,prefixes:B.SHORT,value:new x(5,9),offset:459.67},degR:{name:"degR",base:O.TEMPERATURE,prefixes:B.SHORT,value:new x(5,9),offset:0},kelvin:{name:"kelvin",base:O.TEMPERATURE,prefixes:B.LONG,value:1,offset:0},celsius:{name:"celsius",base:O.TEMPERATURE,prefixes:B.LONG,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:O.TEMPERATURE,prefixes:B.LONG,value:new x(5,9),offset:459.67},rankine:{name:"rankine",base:O.TEMPERATURE,prefixes:B.LONG,value:new x(5,9),offset:0},mol:{name:"mol",base:O.AMOUNT_OF_SUBSTANCE,prefixes:B.SHORT,value:1,offset:0},mole:{name:"mole",base:O.AMOUNT_OF_SUBSTANCE,prefixes:B.LONG,value:1,offset:0},cd:{name:"cd",base:O.LUMINOUS_INTENSITY,prefixes:B.SHORT,value:1,offset:0},candela:{name:"candela",base:O.LUMINOUS_INTENSITY,prefixes:B.LONG,value:1,offset:0},N:{name:"N",base:O.FORCE,prefixes:B.SHORT,value:1,offset:0},newton:{name:"newton",base:O.FORCE,prefixes:B.LONG,value:1,offset:0},dyn:{name:"dyn",base:O.FORCE,prefixes:B.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:O.FORCE,prefixes:B.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:O.FORCE,prefixes:B.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:O.FORCE,prefixes:B.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:O.FORCE,prefixes:B.LONG,value:4448.2216,offset:0},kilogramforce:{name:"kilogramforce",base:O.FORCE,prefixes:B.NONE,value:9.80665,offset:0},J:{name:"J",base:O.ENERGY,prefixes:B.SHORT,value:1,offset:0},joule:{name:"joule",base:O.ENERGY,prefixes:B.LONG,value:1,offset:0},erg:{name:"erg",base:O.ENERGY,prefixes:B.SHORTLONG,value:1e-7,offset:0},Wh:{name:"Wh",base:O.ENERGY,prefixes:B.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:O.ENERGY,prefixes:B.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:O.ENERGY,prefixes:B.SHORT,value:1602176565e-28,offset:0},electronvolt:{name:"electronvolt",base:O.ENERGY,prefixes:B.LONG,value:1602176565e-28,offset:0},W:{name:"W",base:O.POWER,prefixes:B.SHORT,value:1,offset:0},watt:{name:"watt",base:O.POWER,prefixes:B.LONG,value:1,offset:0},hp:{name:"hp",base:O.POWER,prefixes:B.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:O.POWER,prefixes:B.SHORT,value:b.I,offset:0},VA:{name:"VA",base:O.POWER,prefixes:B.SHORT,value:1,offset:0},Pa:{name:"Pa",base:O.PRESSURE,prefixes:B.SHORT,value:1,offset:0},psi:{name:"psi",base:O.PRESSURE,prefixes:B.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:O.PRESSURE,prefixes:B.NONE,value:101325,offset:0},bar:{name:"bar",base:O.PRESSURE,prefixes:B.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:O.PRESSURE,prefixes:B.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:O.PRESSURE,prefixes:B.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:O.PRESSURE,prefixes:B.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:O.PRESSURE,prefixes:B.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:O.ELECTRIC_CHARGE,prefixes:B.LONG,value:1,offset:0},C:{name:"C",base:O.ELECTRIC_CHARGE,prefixes:B.SHORT,value:1,offset:0},farad:{name:"farad",base:O.ELECTRIC_CAPACITANCE,prefixes:B.LONG,value:1,offset:0},F:{name:"F",base:O.ELECTRIC_CAPACITANCE,prefixes:B.SHORT,value:1,offset:0},volt:{name:"volt",base:O.ELECTRIC_POTENTIAL,prefixes:B.LONG,value:1,offset:0},V:{name:"V",base:O.ELECTRIC_POTENTIAL,prefixes:B.SHORT,value:1,offset:0},ohm:{name:"ohm",base:O.ELECTRIC_RESISTANCE,prefixes:B.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:O.ELECTRIC_INDUCTANCE,prefixes:B.LONG,value:1,offset:0},H:{name:"H",base:O.ELECTRIC_INDUCTANCE,prefixes:B.SHORT,value:1,offset:0},siemens:{name:"siemens",base:O.ELECTRIC_CONDUCTANCE,prefixes:B.LONG,value:1,offset:0},S:{name:"S",base:O.ELECTRIC_CONDUCTANCE,prefixes:B.SHORT,value:1,offset:0},weber:{name:"weber",base:O.MAGNETIC_FLUX,prefixes:B.LONG,value:1,offset:0},Wb:{name:"Wb",base:O.MAGNETIC_FLUX,prefixes:B.SHORT,value:1,offset:0},tesla:{name:"tesla",base:O.MAGNETIC_FLUX_DENSITY,prefixes:B.LONG,value:1,offset:0},T:{name:"T",base:O.MAGNETIC_FLUX_DENSITY,prefixes:B.SHORT,value:1,offset:0},b:{name:"b",base:O.BIT,prefixes:B.BINARY_SHORT,value:1,offset:0}
1,bits:{name:"bits",base:O.BIT,prefixes:B.BINARY_LONG,value:1,offset:0},B:{name:"B",base:O.BIT,prefixes:B.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:O.BIT,prefixes:B.BINARY_LONG,value:8,offset:0}},U={meters:"meter",inches:"inch",feet:"foot",yards:"yard",miles:"mile",links:"link",rods:"rod",chains:"chain",angstroms:"angstrom",lt:"l",litres:"litre",liter:"litre",liters:"litre",teaspoons:"teaspoon",tablespoons:"tablespoon",minims:"minim",fluiddrams:"fluiddram",fluidounces:"fluidounce",gills:"gill",cups:"cup",pints:"pint",quarts:"quart",gallons:"gallon",beerbarrels:"beerbarrel",oilbarrels:"oilbarrel",hogsheads:"hogshead",gtts:"gtt",grams:"gram",tons:"ton",tonnes:"tonne",grains:"grain",drams:"dram",ounces:"ounce",poundmasses:"poundmass",hundredweights:"hundredweight",sticks:"stick",lb:"lbm",lbs:"lbm",kips:"kip",kgf:"kilogramforce",acres:"acre",hectares:"hectare",sqfeet:"sqft",sqyard:"sqyd",sqmile:"sqmi",sqmiles:"sqmi",mmhg:"mmHg",mmh2o:"mmH2O",cmh2o:"cmH2O",seconds:"second",secs:"second",minutes:"minute",mins:"minute",hours:"hour",hr:"hour",hrs:"hour",days:"day",weeks:"week",months:"month",years:"year",decades:"decade",centuries:"century",millennia:"millennium",hertz:"hertz",radians:"radian",degrees:"degree",gradians:"gradian",cycles:"cycle",arcsecond:"arcsec",arcseconds:"arcsec",arcminute:"arcmin",arcminutes:"arcmin",BTUs:"BTU",watts:"watt",joules:"joule",amperes:"ampere",amps:"ampere",amp:"ampere",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole",bit:"bits",byte:"bytes"};function P(r){if("BigNumber"===r.number){var e=eK(D);R.rad.value=new D(1),R.deg.value=e.div(180),R.grad.value=e.div(200),R.cycle.value=e.times(2),R.arcsec.value=e.div(648e3),R.arcmin.value=e.div(10800)}else R.rad.value=1,R.deg.value=Math.PI/180,R.grad.value=Math.PI/200,R.cycle.value=2*Math.PI,R.arcsec.value=Math.PI/648e3,R.arcmin.value=Math.PI/10800;R.radian.value=R.rad.value,R.degree.value=R.deg.value,R.gradian.value=R.grad.value}P(a),u&&u("config",function(r,e){r.number!==e.number&&P(r)});var j={si:{NONE:{unit:I,prefix:B.NONE[""]},LENGTH:{unit:R.m,prefix:B.SHORT[""]},MASS:{unit:R.g,prefix:B.SHORT.k},TIME:{unit:R.s,prefix:B.SHORT[""]},CURRENT:{unit:R.A,prefix:B.SHORT[""]},TEMPERATURE:{unit:R.K,prefix:B.SHORT[""]},LUMINOUS_INTENSITY:{unit:R.cd,prefix:B.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:R.mol,prefix:B.SHORT[""]},ANGLE:{unit:R.rad,prefix:B.SHORT[""]},BIT:{unit:R.bits,prefix:B.SHORT[""]},FORCE:{unit:R.N,prefix:B.SHORT[""]},ENERGY:{unit:R.J,prefix:B.SHORT[""]},POWER:{unit:R.W,prefix:B.SHORT[""]},PRESSURE:{unit:R.Pa,prefix:B.SHORT[""]},ELECTRIC_CHARGE:{unit:R.C,prefix:B.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:R.F,prefix:B.SHORT[""]},ELECTRIC_POTENTIAL:{unit:R.V,prefix:B.SHORT[""]},ELECTRIC_RESISTANCE:{unit:R.ohm,prefix:B.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:R.H,prefix:B.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:R.S,prefix:B.SHORT[""]},MAGNETIC_FLUX:{unit:R.Wb,prefix:B.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:R.T,prefix:B.SHORT[""]},FREQUENCY:{unit:R.Hz,prefix:B.SHORT[""]}}};j.cgs=JSON.parse(JSON.stringify(j.si)),j.cgs.LENGTH={unit:R.m,prefix:B.SHORT.c},j.cgs.MASS={unit:R.g,prefix:B.SHORT[""]},j.cgs.FORCE={unit:R.dyn,prefix:B.SHORT[""]},j.cgs.ENERGY={unit:R.erg,prefix:B.NONE[""]},j.us=JSON.parse(JSON.stringify(j.si)),j.us.LENGTH={unit:R.ft,prefix:B.NONE[""]},j.us.MASS={unit:R.lbm,prefix:B.NONE[""]},j.us.TEMPERATURE={unit:R.degF,prefix:B.NONE[""]},j.us.FORCE={unit:R.lbf,prefix:B.NONE[""]},j.us.ENERGY={unit:R.BTU,prefix:B.BTU[""]},j.us.POWER={unit:R.hp,prefix:B.NONE[""]},j.us.PRESSURE={unit:R.psi,prefix:B.NONE[""]},j.auto=JSON.parse(JSON.stringify(j.si));var k=j.auto;for(var q in E.setUnitSystem=function(r){if(eg(j,r))k=j[r];else throw Error("Unit system "+r+" does not exist. Choices are: "+Object.keys(j).join(", "))},E.getUnitSystem=function(){for(var r in j)if(eg(j,r)&&j[r]===k)return r},E.typeConverters={BigNumber:function(r){return null!=r&&r.isFraction?new D(r.n).div(r.d).times(r.s):new D(r+"")},Fraction:function(r){return new x(r)},Complex:function(r){return r},number:function(r){return null!=r&&r.isFraction?y(r):r}},E.prototype._numberConverter=function(){var r=E.typeConverters[this.valueType()];if(r)return r;throw TypeError('Unsupported Unit value type "'+this.valueType()+'"')},E._getNumberConverter=function(r){if(!E.typeConverters[r])throw TypeError('Unsupported type "'+r+'"');return E.typeConverters[r]},R)if(eg(R,q)){var L=R[q];L.dimensions=L.base.dimensions}for(var H in U)if(eg(U,H)){var G=R[U[H]],V={};for(var Z in G)eg(G,Z)&&(V[Z]=G[Z]);V.name=H,R[H]=V}return E.isValidAlpha=function(r){return/^[a-zA-Z]$/.test(r)},E.createUnit=function(r,e){if("object"!=typeof r)throw TypeError("createUnit expects first parameter to be of type 'Object'");if(e&&e.override){for(var t in r)if(eg(r,t)&&E.deleteUnit(t),r[t].aliases)for(var n,i=0;i<r[t].aliases.length;i++)E.deleteUnit(r[t].aliases[i])}for(var u in r)eg(r,u)&&(n=E.createUnitSingle(u,r[u]));return n},E.createUnitSingle=function(r,e){if(null==e&&(e={}),"string"!=typeof r)throw TypeError("createUnitSingle expects first parameter to be of type 'string'");if(eg(R,r))throw Error('Cannot create unit "'+r+'": a unit with that name already exists');for(var t=0;t<r.length;t++){if(i=r.charAt(t),0===t&&!E.isValidAlpha(i))throw Error('Invalid unit name (must begin with alpha character): "'+r+'"');if(t>0&&!(E.isValidAlpha(i)||w(i)))throw Error('Invalid unit name (only alphanumeric characters are allowed): "'+r+'"')}var n,u,a,o=null,s=[],f=0;if(e&&"Unit"===e.type)o=e.clone();else if("string"==typeof e)""!==e&&(n=e);else if("object"==typeof e)n=e.definition,u=e.prefixes,f=e.offset,a=e.baseName,e.aliases&&(s=e.aliases.valueOf());else throw TypeError('Cannot create unit "'+r+'" from "'+e.toString()+'": expecting "string" or "Unit" or "Object"');if(s){for(var c=0;c<s.length;c++)if(eg(R,s[c]))throw Error('Cannot create alias "'+s[c]+'": a unit with that name already exists')}if(n&&"string"==typeof n&&!o)try{o=E.parse(n,{allowNoUnits:!0})}catch(e){throw e.message='Could not create unit "'+r+'" from "'+n+'": '+e.message,e}else n&&"Unit"===n.type&&(o=n.clone());s=s||[],f=f||0,u=u&&u.toUpperCase&&B[u.toUpperCase()]||B.NONE;var l={};if(o){l={name:r,value:o.value,dimensions:o.dimensions.slice(0),prefixes:u,offset:f};var h=!1;for(var p in O)if(eg(O,p)){for(var m=!0,v=0;v<T.length;v++)if(Math.abs((l.dimensions[v]||0)-(O[p].dimensions[v]||0))>1e-12){m=!1;break}if(m){h=!0,l.base=O[p];break}}if(!h){a=a||r+"_STUFF";var d={dimensions:o.dimensions.slice(0)};d.key=a,O[a]=d,k[a]={unit:l,prefix:B.NONE[""]},l.base=O[a]}}else{if(a=a||r+"_STUFF",T.indexOf(a)>=0)throw Error('Cannot create new base unit "'+r+'": a base unit with that name already exists (and cannot be overridden)');for(var g in T.push(a),O)eg(O,g)&&(O[g].dimensions[T.length-1]=0);for(var y={dimensions:[]},b=0;b<T.length;b++)y.dimensions[b]=0;y.dimensions[T.length-1]=1,y.key=a,O[a]=y,l={name:r,value:1,dimensions:O[a].dimensions.slice(0),prefixes:u,offset:f,base:O[a]},k[a]={unit:l,prefix:B.NONE[""]}}E.UNITS[r]=l;for(var D=0;D<s.length;D++){var x=s[D],A={};for(var N in l)eg(l,N)&&(A[N]=l[N]);A.name=x,E.UNITS[x]=A}return delete S.cache,new E(null,r)},E.deleteUnit=function(r){delete E.UNITS[r],delete S.cache},E.PREFIXES=B,E.BASE_DIMENSIONS=T,E.BASE_UNITS=O,E.UNIT_SYSTEMS=j,E.UNITS=R,E},{isClass:!0}),sV="dotPow",sZ=(r=>{var{typed:e,equalScalar:t,matrix:n,pow:i,DenseMatrix:u,concat:a}=r,o=ah({typed:e}),s=ap({typed:e,DenseMatrix:u}),f=am({typed:e,equalScalar:t}),c=av({typed:e,DenseMatrix:u}),l=ab({typed:e,matrix:n,concat:a}),h={};for(var p in i.signatures)!Object.prototype.hasOwnProperty.call(i.signatures,p)||p.includes("Matrix")||p.includes("Array")||(h[p]=i.signatures[p]);var m=e(h);return e(sV,l({elop:m,SS:s,DS:o,Ss:f,sS:c}))},"expm"),sY=(r=>{var{typed:e,abs:t,add:n,identity:i,inv:u,multiply:a}=r;return e(sZ,{Matrix:function(r){var e=r.size();if(2!==e.length||e[0]!==e[1])throw RangeError("Matrix must be square (size: "+ts(e)+")");for(var o=e[0],s=function(r,e){for(var t=0;t<30;t++)for(var n=0;n<=t;n++){var i=t-n;if(1e-15>function(r,e,t){for(var n=1,i=2;i<=e;i++)n*=i;for(var u=n,a=e+1;a<=2*e;a++)u*=a;var o=u*(2*e+1);return 8*Math.pow(r/Math.pow(2,t),2*e)*n*n/(u*o)}(r,n,i))return{q:n,j:i}}throw Error("Could not find acceptable parameters to compute the matrix exponential (try increasing maxSearchSize in expm.js)")}(function(r){for(var e=r.size()[0],n=0,i=0;i<e;i++){for(var u=0,a=0;a<e;a++)u+=t(r.get([i,a]));n=Math.max(u,n)}return n}(r),1e-15),f=s.q,c=s.j,l=a(r,Math.pow(2,-c)),h=i(o),p=i(o),m=1,v=l,d=-1,g=1;g<=f;g++)g>1&&(v=a(v,l),d=-d),h=n(h,a(m=m*(f-g+1)/((2*f-g+1)*g),v)),p=n(p,a(m*d,v));for(var y=a(u(p),h),b=0;b<c;b++)y=a(y,y);return rX(r)?r.createSparseMatrix(y):y}})},ey("fft",["typed","matrix","addScalar","multiplyScalar","divideScalar","exp","tau","i","dotDivide","conj","pow","ceil","log2"],r=>{var{typed:e,matrix:t,addScalar:n,multiplyScalar:i,divideScalar:u,exp:a,tau:o,i:s,dotDivide:f,conj:c,pow:l,ceil:h,log2:p}=r;return e("fft",{Array:m,Matrix:function(r){return r.create(m(r.toArray()))}});function m(r){var e=tm(r);return 1===e.length?v(r,e[0]):function r(e,t){var n=tm(e);if(0!==t)return Array(n[0]).fill(0).map((n,i)=>r(e[i],t-1));if(1===n.length)return v(e);function i(r){var e=tm(r);return Array(e[1]).fill(0).map((t,n)=>Array(e[0]).fill(0).map((e,t)=>r[t][n]))}return i(r(i(e),1))}(r.map(r=>m(r,e.slice(1))),0)}function v(r){var e=r.length;if(1===e)return[r[0]];if(e%2!=0)return function(r){for(var e=r.length,t=a(u(i(-1,i(s,o)),e)),n=[],d=1-e;d<e;d++)n.push(l(t,u(l(d,2),2)));for(var g=l(2,h(p(e+e-1))),y=[...Array(e).fill(0).map((t,u)=>i(r[u],n[e-1+u])),...Array(g-e).fill(0)],b=[...Array(e+e-1).fill(0).map((r,e)=>u(1,n[e])),...Array(g-(e+e-1)).fill(0)],D=v(y),x=v(b),E=f(c(m(c(Array(g).fill(0).map((r,e)=>i(D[e],x[e]))))),g),A=[],w=e-1;w<e+e-1;w++)A.push(i(E[w],n[w]));return A}(r);for(var t=[...v(r.filter((r,e)=>e%2==0),e/2),...v(r.filter((r,e)=>e%2==1),e/2)],d=0;d<e/2;d++){var g=t[d],y=i(t[d+e/2],a(i(i(o,s),u(-d,e))));
1t[d]=n(g,y),t[d+e/2]=n(g,i(-1,y))}return t}})),sX="gamma",sJ=ey(sX,["typed","config","multiplyScalar","pow","BigNumber","Complex"],r=>{var{typed:e,config:t,multiplyScalar:n,pow:i,BigNumber:u,Complex:a}=r;return e(sX,{number:ij,Complex:function r(e){if(0===e.im)return ij(e.re);if(e.re<.5){var t=new a(1-e.re,-e.im),n=new a(Math.PI*e.re,Math.PI*e.im);return new a(Math.PI).div(n.sin()).div(r(t))}e=new a(e.re-1,e.im);for(var i=new a(iq[0],0),u=1;u<iq.length;++u){var o=new a(iq[u],0);i=i.add(o.div(e.add(u)))}var s=new a(e.re+ik+.5,e.im),f=Math.sqrt(2*Math.PI),c=s.pow(e.add(.5)),l=s.neg().exp();return i.mul(f).mul(c).mul(l)},BigNumber:function(r){if(r.isInteger())return r.isNegative()||r.isZero()?new u(1/0):function r(e){if(e<8)return new u([1,1,2,6,24,120,720,5040][e]);var n=t.precision+(0|Math.log(e.toNumber())),i=u.clone({precision:n});if(e%2==1)return e.times(r(new u(e-1)));for(var a=e,o=new i(e),s=e.toNumber();a>2;)a-=2,s+=a,o=o.times(s);return new u(o.toPrecision(u.precision))}(r.minus(1));if(!r.isFinite())return new u(r.isNegative()?NaN:1/0);throw Error("Integer BigNumber expected")}})}),sW="ifft",s$=(r=>{var{typed:e,fft:t,dotDivide:n,conj:i}=r;return e(sW,{"Array | Matrix":function(r){var e=rV(r)?r.size():tm(r);return n(i(t(i(r))),e.reduce((r,e)=>r*e,1))}})},"createUnit"),sQ=(r=>{var{typed:e,Unit:t}=r;return e(s$,{"Object, Object":function(r,e){return t.createUnit(r,e)},Object:function(r){return t.createUnit(r,{})},"string, Unit | string | Object, Object":function(r,e,n){var i={};return i[r]=e,t.createUnit(i,n)},"string, Unit | string | Object":function(r,e){var n={};return n[r]=e,t.createUnit(n,{})},string:function(r){var e={};return e[r]={},t.createUnit(e,{})}})},ey("divide",["typed","matrix","multiply","equalScalar","divideScalar","inv"],r=>{var{typed:e,matrix:t,multiply:n,equalScalar:i,divideScalar:u,inv:a}=r,o=am({typed:e,equalScalar:i}),s=ag({typed:e});return e("divide",ev({"Array | Matrix, Array | Matrix":function(r,e){return n(r,a(e))},"DenseMatrix, any":function(r,e){return s(r,e,u,!1)},"SparseMatrix, any":function(r,e){return o(r,e,u,!1)},"Array, any":function(r,e){return s(t(r),e,u,!1).valueOf()},"any, Array | Matrix":function(r,e){return n(r,a(e))}},u.signatures))})),sK="factorial",s0=ey(sK,["typed","gamma"],r=>{var{typed:e,gamma:t}=r;return e(sK,{number:function(r){if(r<0)throw Error("Value must be non-negative");return t(r+1)},BigNumber:function(r){if(r.isNegative())throw Error("Value must be non-negative");return t(r.plus(1))},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})});function s1(r,e){var t,n=e.length,i=[];if(r)for(t=0;t<n;t++)i[r[t]]=e[t];else for(t=0;t<n;t++)i[t]=e[t];return i}var s2="lusolve",s3=ey(s2,["typed","matrix","lup","slu","usolve","lsolve","DenseMatrix"],r=>{var{typed:e,matrix:t,lup:n,slu:i,usolve:u,lsolve:a,DenseMatrix:o}=r,s=aj({DenseMatrix:o});return e(s2,{"Array, Array | Matrix":function(r,e){var i=n(r=t(r));return c(i.L,i.U,i.p,null,e).valueOf()},"DenseMatrix, Array | Matrix":function(r,e){var t=n(r);return c(t.L,t.U,t.p,null,e)},"SparseMatrix, Array | Matrix":function(r,e){var t=n(r);return c(t.L,t.U,t.p,null,e)},"SparseMatrix, Array | Matrix, number, number":function(r,e,t,n){var u=i(r,t,n);return c(u.L,u.U,u.p,u.q,e)},"Object, Array | Matrix":function(r,e){return c(r.L,r.U,r.p,r.q,e)}});function f(r){if(rV(r))return r;if(rG(r))return t(r);throw TypeError("Invalid Matrix LU decomposition")}function c(r,e,t,n,i){r=f(r),e=f(e),t&&((i=s(r,i,!0))._data=s1(t,i._data));var o=u(e,a(r,i));return n&&(o._data=s1(n,o._data)),o}}),s8="multinomial",s5=(r=>{var{typed:e,add:t,divide:n,multiply:i,factorial:u,isInteger:a,isPositive:o}=r;return e(s8,{"Array | Matrix":function(r){var e=0,s=1;return t$(r,function(r){if(!a(r)||!o(r))throw TypeError("Positive integer value expected in function multinomial");e=t(e,r),s=i(s,u(r))}),n(u(e),s)}})},"permutations");function s4(r){return r.isInteger()&&r.gte(0)}r=>{var{typed:e,factorial:t}=r;return e(s5,{"number | BigNumber":t,"number, number":function(r,e){if(!eA(r)||r<0||!eA(e)||e<0)throw TypeError("Positive integer value expected in function permutations");
1if(e>r)throw TypeError("second argument k must be less than or equal to first argument n");return n3(r-e+1,r)},"BigNumber, BigNumber":function(r,e){var t,n;if(!s4(r)||!s4(e))throw TypeError("Positive integer value expected in function permutations");if(e.gt(r))throw TypeError("second argument k must be less than or equal to first argument n");for(t=r.mul(0).add(1),n=r.minus(e).plus(1);n.lte(r);n=n.plus(1))t=t.times(n);return t}})};var s7="polynomialRoot",s9=(r=>{var{typed:e,isZero:t,equalScalar:n,add:i,subtract:u,multiply:a,divide:o,sqrt:s,unaryMinus:f,cbrt:c,typeOf:l,im:h,re:p}=r;return e(s7,{"number|Complex, ...number|Complex":(r,e)=>{for(var m=[r,...e];m.length>0&&t(m[m.length-1]);)m.pop();if(m.length<2)throw RangeError("Polynomial [".concat(r,", ").concat(e,"] must have a non-zero non-constant coefficient"));switch(m.length){case 2:return[f(o(m[0],m[1]))];case 3:var[v,d,g]=m,y=a(2,g),b=a(d,d),D=a(4,g,v);if(n(b,D))return[o(f(d),y)];var x=s(u(b,D));return[o(u(x,d),y),o(u(f(x),d),y)];case 4:var[E,A,w,N]=m,M=f(a(3,N)),C=a(w,w),F=a(3,N,A),S=i(a(2,w,w,w),a(27,N,N,E)),_=a(9,N,w,A);if(n(C,F)&&n(S,_))return[o(w,M)];var B=u(C,F),T=u(S,_);if(n(i(a(18,N,w,A,E),a(w,w,A,A)),i(a(4,w,w,w,E),a(4,N,A,A,A),a(27,N,N,E,E))))return[o(u(a(4,N,w,A),i(a(9,N,N,E),a(w,w,w))),a(N,B)),o(u(a(9,N,E),a(w,A)),a(2,B))];return c(n(C,F)?T:o(i(T,s(u(a(T,T),a(4,B,B,B)))),2),!0).toArray().map(r=>o(i(w,r,o(B,r)),M)).map(r=>"Complex"===l(r)&&n(p(r),p(r)+h(r))?p(r):r);default:throw RangeError("only implemented for cubic or lower-order polynomials, not ".concat(m))}}})},"setSize");function s6(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})),t.push.apply(t,n)}return t}r=>{var{typed:e,compareNatural:t}=r;return e(s9,{"Array | Matrix":function(r){return Array.isArray(r)?tN(r).length:tN(r.toArray()).length},"Array | Matrix, boolean":function(r,e){if(!1===e||0===r.length)return Array.isArray(r)?tN(r).length:tN(r.toArray()).length;for(var n=tN(Array.isArray(r)?r:r.toArray()).sort(t),i=1,u=1;u<n.length;u++)0!==t(n[u],n[u-1])&&i++;return i}})},r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:u,max:a,map:o,abs:s,isPositive:f,isNegative:c,larger:l,smaller:h,matrix:p,bignumber:m,unaryMinus:v}=r;function d(r){return function(e,p,d,g){if(!(2===p.length&&(p.every(D)||p.every(rL))))throw Error('"tspan" must be an Array of two numeric values or two units [tStart, tEnd]');var y,b=p[0],x=p[1],E=l(x,b),A=g.firstStep;if(void 0!==A&&!f(A))throw Error('"firstStep" must be positive');var w=g.maxStep;if(void 0!==w&&!f(w))throw Error('"maxStep" must be positive');var N=g.minStep;if(N&&c(N))throw Error('"minStep" must be positive or zero');var M=[b,x,A,N,w].filter(r=>void 0!==r);if(!(M.every(D)||M.every(rL)))throw Error('Inconsistent type of "t" dependant variables');for(var C=g.tol?g.tol:1e-4,F=g.minDelta?g.minDelta:.2,S=g.maxDelta?g.maxDelta:5,_=g.maxIter?g.maxIter:1e4,B=[b,x,...d,w,N].some(rj),[T,O,z,I]=B?[m(r.a),m(r.c),m(r.b),m(r.bp)]:[r.a,r.c,r.b,r.bp],R=A?E?A:v(A):u(n(x,b),1),U=[b],P=[d],j=n(z,I),k=0,q=0,L=E?h:l,H=(y=E?l:h,function(r,e,i){return y(t(r,i),e)?n(e,r):i});L(U[k],x);){var G=[];
1R=H(U[k],x,R),G.push(e(U[k],P[k]));for(var V=1;V<O.length;++V)G.push(e(t(U[k],i(O[V],R)),t(P[k],i(R,T[V],G))));var Z=a(s(o(i(j,G),r=>rL(r)?r.value:r)));Z<C&&C/Z>1/4&&(U.push(t(U[k],R)),P.push(t(P[k],i(R,z,G))),k++);var Y=.84*(C/Z)**.2;if(h(Y,F)?Y=F:l(Y,S)&&(Y=S),R=i(R,Y=B?m(Y):Y),w&&l(s(R),w)?R=E?w:v(w):N&&h(s(R),N)&&(R=E?N:v(N)),++q>_)throw Error("Maximum number of iterations reached, try changing options")}return{t:U,y:P}}}function g(r,e,t,n){return d({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]})(r,e,t,n)}function y(r,e,t,n){return d({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]})(r,e,t,n)}function b(r,e,t,n){var i=n.method?n.method:"RK45",u={RK23:g,RK45:y};if(i.toUpperCase()in u){var a=function(r){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?s6(Object(t),!0).forEach(function(e){(0,sq.A)(r,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):s6(Object(t)).forEach(function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(t,e))})}return r}({},n);return delete a.method,u[i.toUpperCase()](r,e,t,a)}var o=Object.keys(u).map(r=>'"'.concat(r,'"')),s="".concat(o.slice(0,-1).join(", ")," and ").concat(o.slice(-1));throw Error('Unavailable method "'.concat(i,'". Available methods are ').concat(s))}function D(r){return rj(r)||rP(r)}function x(r,e,t,n){var i=b(r,e.toArray(),t.toArray(),n);return{t:p(i.t),y:p(i.y)}}return e("solveODE",{"function, Array, Array, Object":b,"function, Matrix, Matrix, Object":x,"function, Array, Array":(r,e,t)=>b(r,e,t,{}),"function, Matrix, Matrix":(r,e,t)=>x(r,e,t,{}),"function, Array, number | BigNumber | Unit":(r,e,t)=>{var n=b(r,e,[t],{});return{t:n.t,y:n.y.map(r=>r[0])}},"function, Matrix, number | BigNumber | Unit":(r,e,t)=>{var n=b(r,e.toArray(),[t],{});return{t:p(n.t),y:p(n.y.map(r=>r[0]))}},"function, Array, number | BigNumber | Unit, Object":(r,e,t,n)=>{var i=b(r,e,[t],n);return{t:i.t,y:i.y.map(r=>r[0])}},"function, Matrix, number | BigNumber | Unit, Object":(r,e,t,n)=>{var i=b(r,e.toArray(),[t],n);return{t:p(i.t),y:p(i.y.map(r=>r[0]))}}})};var fr="stirlingS2",fe=ey(fr,["typed","addScalar","subtractScalar","multiplyScalar","divideScalar","pow","factorial","combinations","isNegative","isInteger","number","?bignumber","larger"],r=>{var{typed:e,addScalar:t,subtractScalar:n,multiplyScalar:i,divideScalar:u,pow:a,factorial:o,combinations:s,isNegative:f,isInteger:c,number:l,bignumber:h,larger:p}=r,m=[],v=[];return e(fr,{"number | BigNumber, number | BigNumber":function(r,e){if(!c(r)||f(r)||!c(e)||f(e))throw TypeError("Non-negative integer value expected in function stirlingS2");if(p(e,r))throw TypeError("k must be less than or equal to n in function stirlingS2");var n=!(rP(r)&&rP(e)),u=n?v:m,a=n?h:l,o=l(r),s=l(e);if(u[o]&&u[o].length>s)return u[o][s];for(var d=0;d<=o;++d)if(u[d]||(u[d]=[a(+(0===d))]),0!==d)for(var g=u[d],y=u[d-1],b=g.length;b<=d&&b<=s;++b)b===d?g[b]=1:g[b]=t(i(a(b),y[b]),y[b-1]);return u[o][s]}})}),ft="unit",fn=(r=>{var{typed:e,Unit:t}=r;return e(ft,{Unit:function(r){return r.clone()},string:function(r){return t.isValuelessUnit(r)?new t(null,r):t.parse(r,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string | Unit":function(r,e){return new t(r,e)},"number | BigNumber | Fraction":function(r){return new t(r)},"Array | Matrix":e.referToSelf(r=>e=>tQ(e,r))})},"bellNumbers"),fi=(r=>{var{typed:e,addScalar:t,isNegative:n,isInteger:i,stirlingS2:u}=r;return e(fn,{"number | BigNumber":function(r){if(!i(r)||n(r))throw TypeError("Non-negative integer value expected in function bellNumbers");for(var e=0,a=0;a<=r;a++)e=t(e,u(r,a));return e}})},ey("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"],r=>{var{config:e,typed:t,matrix:i,addScalar:u,subtract:a,equal:o,abs:s,atan:f,cos:c,sin:l,multiplyScalar:h,divideScalar:p,inv:m,bignumber:v,multiply:d,add:g,larger:y,column:b,flatten:D,number:x,complex:E,sqrt:A,diag:w,size:N,reshape:M,qr:C,usolve:F,usolveAll:S,im:_,re:B,smaller:T,matrixFromColumns:O,dot:z}=r,I=function(r){var{config:e,addScalar:t,subtract:n,abs:i,atan:u,cos:a,sin:o,multiplyScalar:s,inv:f,bignumber:c,multiply:l,add:h}=r;function p(r){for(var e=r.length,t=0,n=[0,1],i=0;i<e;i++)for(var u=i+1;u<e;u++)Math.abs(t)<Math.abs(r[i][u])&&(t=Math.abs(r[i][u]),n=[i,u]);return[n,t]}function m(r){for(var e=r.length,t=0,n=[0,1],u=0;u<e;u++)for(var a=u+1;a<e;a++)i(t)<i(r[u][a])&&(t=i(r[u][a]),n=[u,a]);return[n,t]}function v(r,e,t){var n,u=r.length,a=Array(u);if(t){n=Array(u);for(var o=0;o<u;o++)n[o]=Array(u)}for(var s=0;s<u;s++){for(var f=0,c=r[0],l=0;l<r.length;l++)i(r[l])<i(c)&&(c=r[f=l]);if(a[s]=r.splice(f,1)[0],t)for(var h=0;h<u;h++)n[s][h]=e[h][f],e[h].splice(f,1)}if(!t)return{values:a};var p=n.map((r,e)=>({value:a[e],vector:r}));return{values:a,eigenvectors:p}}return function(r,d){var g=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.epsilon,y=arguments.length>3?arguments[3]:void 0,b=arguments.length>4?arguments[4]:void 0;if("number"===y)return function(r,t,n){var i,u,a=r.length,o=Math.abs(t/a);if(n){u=Array(a);for(var s=0;s<a;s++)u[s]=Array(a).fill(0),u[s][s]=1}for(var f=p(r);Math.abs(f[1])>=Math.abs(o);){var c,l,h,m=f[0][0],d=f[0][1];c=r[m][m],l=r[d][d],h=r[m][d],r=function(r,e,t,n){for(var i=r.length,u=Math.cos(e),a=Math.sin(e),o=u*u,s=a*a,f=Array(i).fill(0),c=Array(i).fill(0),l=o*r[t][t]-2*u*a*r[t][n]+s*r[n][n],h=s*r[t][t]+2*u*a*r[t][n]+o*r[n][n],p=0;p<i;p++)f[p]=u*r[t][p]-a*r[n][p],c[p]=a*r[t][p]+u*r[n][p];r[t][t]=l,r[n][n]=h,r[t][n]=0,r[n][t]=0;for(var m=0;m<i;m++)m!==t&&m!==n&&(r[t][m]=f[m],r[m][t]=f[m],r[n][m]=c[m],r[m][n]=c[m]);return r}(r,i=Math.abs(l-c)<=e.epsilon?Math.PI/4:.5*Math.atan(2*h/(l-c)),m,d),n&&(u=function(r,e,t,n){for(var i=r.length,u=Math.cos(e),a=Math.sin(e),o=Array(i).fill(0),s=Array(i).fill(0),f=0;f<i;f++)o[f]=u*r[f][t]-a*r[f][n],s[f]=a*r[f][t]+u*r[f][n];for(var c=0;c<i;c++)r[c][t]=o[c],r[c][n]=s[c];return r}(u,i,m,d)),f=p(r)}for(var g=Array(a).fill(0),y=0;y<a;y++)g[y]=r[y][y];return v(em(g),u,n)}(r,g,b);if("BigNumber"===y)return function(r,p,d){var g,y,b=r.length,D=i(p/b);if(d){y=Array(b);for(var x=0;x<b;x++)y[x]=Array(b).fill(0),y[x][x]=1}for(var E=m(r);i(E[1])>=i(D);){var A=E[0][0],w=E[0][1];g=function(r,t,a){var o=n(t,r);return i(o)<=e.epsilon?c(-1).acos().div(4):s(.5,u(l(2,a,f(o))))}(r[A][A],r[w][w],r[A][w]),r=function(r,e,i,u){for(var f=r.length,p=c(a(e)),m=c(o(e)),v=s(p,p),d=s(m,m),g=Array(f).fill(c(0)),y=Array(f).fill(c(0)),b=l(c(2),p,m,r[i][u]),D=t(n(s(v,r[i][i]),b),s(d,r[u][u])),x=h(s(d,r[i][i]),b,s(v,r[u][u])),E=0;E<f;
1E++)g[E]=n(s(p,r[i][E]),s(m,r[u][E])),y[E]=t(s(m,r[i][E]),s(p,r[u][E]));r[i][i]=D,r[u][u]=x,r[i][u]=c(0),r[u][i]=c(0);for(var A=0;A<f;A++)A!==i&&A!==u&&(r[i][A]=g[A],r[A][i]=g[A],r[u][A]=y[A],r[A][u]=y[A]);return r}(r,g,A,w),d&&(y=function(r,e,i,u){for(var f=r.length,l=a(e),h=o(e),p=Array(f).fill(c(0)),m=Array(f).fill(c(0)),v=0;v<f;v++)p[v]=n(s(l,r[v][i]),s(h,r[v][u])),m[v]=t(s(h,r[v][i]),s(l,r[v][u]));for(var d=0;d<f;d++)r[d][i]=p[d],r[d][u]=m[d];return r}(y,g,A,w)),E=m(r)}for(var N=Array(b).fill(0),M=0;M<b;M++)N[M]=r[M][M];return v(em(N),y,d)}(r,g,b);throw TypeError("Unsupported data type: "+y)}}({config:e,addScalar:u,subtract:a,column:b,flatten:D,equal:o,abs:s,atan:f,cos:c,sin:l,multiplyScalar:h,inv:m,bignumber:v,complex:E,multiply:d,add:g}),R=function(r){var{addScalar:e,subtract:t,flatten:n,multiply:i,multiplyScalar:u,divideScalar:a,sqrt:o,abs:s,bignumber:f,diag:c,size:l,reshape:h,inv:p,qr:m,usolve:v,usolveAll:d,equal:g,complex:y,larger:b,smaller:D,matrixFromColumns:x,dot:E}=r;function A(r,e){for(var t=0;t<r.length;t++)r[t].push(...Array(e-r[t].length).fill(0));for(var n=r.length;n<e;n++)r.push(Array(e).fill(0)),r[n][n]=1;return r}function w(r,e){var n=l(r);for(var u of e)r=t(r,i(a(E(u=h(u,n),r),E(u,u)),u));return r}function N(r){return s(o(E(r,r)))}function M(r,e){return i(a("BigNumber"===e?f(1):"Complex"===e?y(1):1,N(r)),r)}return function(r,l,h,x){var E=!(arguments.length>4)||void 0===arguments[4]||arguments[4],C=function(r,t,n,i,o){var l,h="BigNumber"===i,p=h?f(0):0,m=h?f(1):"Complex"===i?y(1):1,v=h?f(1):1,d=h?f(10):2,x=u(d,d);o&&(l=Array(t).fill(m));for(var E=!1;!E;){E=!0;for(var A=0;A<t;A++){for(var w=p,N=p,M=0;M<t;M++)A!==M&&(w=e(w,s(r[M][A])),N=e(N,s(r[A][M])));if(!g(w,0)&&!g(N,0)){for(var C=v,F=w,S=a(N,d),_=u(N,d);D(F,S);)F=u(F,x),C=u(C,d);for(;b(F,_);)F=a(F,x),C=a(C,d);if(D(a(e(F,N),C),u(e(w,N),.95))){E=!1;for(var B=a(1,C),T=0;T<t;T++)A!==T&&(r[A][T]=u(r[A][T],B),r[T][A]=u(r[T][A],C));o&&(l[A]=u(l[A],B))}}}}return o?c(l):null}(r,l,0,x,E);!function(r,n,i,o,c,l){var h="BigNumber"===o,p=h?f(0):"Complex"===o?y(0):0;h&&(i=f(i));for(var m=0;m<n-2;m++){for(var v=0,d=p,g=m+1;g<n;g++){var b=r[g][m];D(s(d),s(b))&&(d=b,v=g)}if(!D(s(d),i)){if(v!==m+1){var x=r[v];r[v]=r[m+1],r[m+1]=x;for(var E=0;E<n;E++){var A=r[E][v];r[E][v]=r[E][m+1],r[E][m+1]=A}if(c){var w=l[v];l[v]=l[m+1],l[m+1]=w}}for(var N=m+2;N<n;N++){var M=a(r[N][m],d);if(0!==M){for(var C=0;C<n;C++)r[N][C]=t(r[N][C],u(M,r[m+1][C]));for(var F=0;F<n;F++)r[F][m+1]=e(r[F][m+1],u(M,r[F][N]));if(c)for(var S=0;S<n;S++)l[N][S]=t(l[N][S],u(M,l[m+1][S]))}}}}}(r,l,h,x,E,C);var{values:F,C:S}=function(r,n,a,l,h){var p="BigNumber"===l,v="Complex"===l,d=p?f(1):v?y(1):1;p&&(a=f(a));for(var g=em(r),x=[],E=n,w=[],N=h?c(Array(n).fill(d)):void 0,M=h?c(Array(E).fill(d)):void 0,C=0;C<=100;){C+=1;for(var F=g[E-1][E-1],S=0;S<E;S++)g[S][S]=t(g[S][S],F);var{Q:_,R:B}=m(g);g=i(B,_);for(var T=0;T<E;T++)g[T][T]=e(g[T][T],F);if(h&&(M=i(M,_)),1===E||D(s(g[E-1][E-2]),a)){C=0,x.push(g[E-1][E-1]),h&&(w.unshift([[1]]),A(M,n),N=i(N,M),E>1&&(M=c(Array(E-1).fill(d)))),E-=1,g.pop();for(var O=0;O<E;O++)g[O].pop()}else if(2===E||D(s(g[E-2][E-3]),a)){C=0;var z=function(r,n,i,a){var s=e(r,a),f=t(u(r,a),u(n,i)),c=u(s,.5),l=u(o(t(u(s,s),u(4,f))),.5);return[e(c,l),t(c,l)]}(g[E-2][E-2],g[E-2][E-1],g[E-1][E-2],g[E-1][E-1]);x.push(...z),h&&(w.unshift(function(r,e,n,i,u,a,o,c){var l="BigNumber"===c,h="Complex"===c,p=l?f(0):h?y(0):0,m=l?f(1):h?y(1):1;if(D(s(n),o))return[[m,p],[p,m]];if(b(s(t(u,a)),o))return[[t(u,i),t(a,i)],[n,n]];var v=t(r,u),d=t(i,u);return D(s(e),o)&&D(s(d),o)?[[v,m],[n,p]]:[[e,p],[d,m]]}(g[E-2][E-2],g[E-2][E-1],g[E-1][E-2],g[E-1][E-1],z[0],z[1],a,l)),A(M,n),N=i(N,M),E>2&&(M=c(Array(E-2).fill(d)))),E-=2,g.pop(),g.pop();for(var I=0;I<E;I++)g[I].pop(),g[I].pop()}if(0===E)break}if(x.sort((r,e)=>+t(s(r),s(e))),C>100){var R=Error("The eigenvalues failed to converge. Only found these eigenvalues: "+x.join(", "));throw R.values=x,R.vectors=[],R}return{values:x,C:h?i(N,function(r,e){for(var t=[],n=0;n<e;n++)t[n]=Array(e).fill(0);var i=0;for(var u of r){for(var a=u.length,o=0;o<a;o++)for(var s=0;s<a;s++)t[i+o][i+s]=u[o][s];i+=a}return t}(w,n)):void 0}}(r,l,h,x,E);if(E){var _=function(r,e,u,a,o,s,l){var h=i(p(u),r,u),m="BigNumber"===l,x="Complex"===l,E=m?f(0):x?
1y(0):0,A=m?f(1):x?y(1):1,C=[],F=[];for(var S of o){var _=function(r,e,t){for(var n=0;n<r.length;n++)if(t(r[n],e))return n;return -1}(C,S,g);-1===_?(C.push(S),F.push(1)):F[_]+=1}for(var B=[],T=C.length,O=Array(e).fill(E),z=c(Array(e).fill(A)),I=0;I<T;I++)!function(){var r=C[I],o=t(h,i(r,z)),c=d(o,O);for(c.shift();c.length<F[I];){var m=function(r,e,t,n,i){for(var u,a="BigNumber"===i?f(1e3):1e3,o=0;o<5;++o){u=function(r,e,t){var n="BigNumber"===t,i="Complex"===t,u=Array(r).fill(0).map(r=>2*Math.random()-1);return n&&(u=u.map(r=>f(r))),i&&(u=u.map(r=>y(r))),M(u=w(u,e),t)}(e,t,i);try{u=v(r,u)}catch(r){continue}if(b(N(u),a))break}if(o>=5)return null;for(o=0;;){var s=v(r,u);if(D(N(w(u,[s])),n))break;if(++o>=10)return null;u=M(s)}return u}(o,e,c,s,l);if(null===m)break;c.push(m)}var g=i(p(a),u);c=c.map(r=>i(g,r)),B.push(...c.map(e=>({value:r,vector:n(e)})))}();return B}(r,l,S,C,F,h,x);return{values:F,eigenvectors:_}}return{values:F}}}({config:e,addScalar:u,subtract:a,multiply:d,multiplyScalar:h,flatten:D,divideScalar:p,sqrt:A,abs:s,bignumber:v,diag:w,size:N,reshape:M,qr:C,inv:m,usolve:F,usolveAll:S,equal:o,complex:E,larger:y,smaller:T,matrixFromColumns:O,dot:z});return t("eigs",{Array:function(r){return U(i(r))},"Array, number|BigNumber":function(r,e){return U(i(r),{precision:e})},"Array, Object":(r,e)=>U(i(r),e),Matrix:function(r){return U(r,{matricize:!0})},"Matrix, number|BigNumber":function(r,e){return U(r,{precision:e,matricize:!0})},"Matrix, Object":function(r,e){var t={matricize:!0};return(0,n.A)(t,e),U(r,t)}});function U(r){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=!("eigenvectors"in n)||n.eigenvectors,o=function(r,e,t){var n=r.toArray(),i=r.size();if(2!==i.length||i[0]!==i[1])throw RangeError("Matrix must be square (size: ".concat(ts(i),")"));var u=i[0];if(function(r,e,t){for(var n=0;n<e;n++)for(var i=0;i<e;i++)if(y(v(s(_(r[n][i]))),t))return!1;return!0}(n,u,e)&&(function(r,e){for(var t=0;t<e;t++)for(var n=0;n<e;n++)r[t][n]=B(r[t][n])}(n,u),function(r,e,t){for(var n=0;n<e;n++)for(var i=n;i<e;i++)if(y(v(s(a(r[n][i],r[i][n]))),t))return!1;return!0}(n,u,e))){var o=P(r,n,u);return I(n,u,e,o,t)}var f=P(r,n,u);return R(n,u,e,f,t)}(r,null!=(t=n.precision)?t:e.epsilon,u);return n.matricize&&(o.values=i(o.values),u&&(o.eigenvectors=o.eigenvectors.map(r=>{var{value:e,vector:t}=r;return{value:e,vector:i(t)}}))),u&&Object.defineProperty(o,"vectors",{enumerable:!1,get:()=>{throw Error("eigs(M).vectors replaced with eigs(M).eigenvectors")}}),o}function P(r,e,t){var n=r.datatype();if("number"===n||"BigNumber"===n||"Complex"===n)return n;for(var i=!1,u=!1,a=!1,o=0;o<t;o++)for(var s=0;s<t;s++){var f=e[o][s];if(rP(f)||rq(f))i=!0;else if(rj(f))u=!0;else if(rk(f))a=!0;else throw TypeError("Unsupported type in Matrix: "+ep(f))}
1if(u&&a&&console.warn("Complex BigNumbers not supported, this operation will lose precission."),a){for(var c=0;c<t;c++)for(var l=0;l<t;l++)e[c][l]=E(e[c][l]);return"Complex"}if(u){for(var h=0;h<t;h++)for(var p=0;p<t;p++)e[h][p]=v(e[h][p]);return"BigNumber"}if(i){for(var m=0;m<t;m++)for(var d=0;d<t;d++)e[m][d]=x(e[m][d]);return"number"}throw TypeError("Matrix contains unsupported types only.")}})),fu="kldivergence",fa=(r=>{var{typed:e,matrix:t,divide:n,sum:i,multiply:u,map:a,dotDivide:o,log:s,isNumeric:f}=r;return e(fu,{"Array, Array":function(r,e){return c(t(r),t(e))},"Matrix, Array":function(r,e){return c(r,t(e))},"Array, Matrix":function(r,e){return c(t(r),e)},"Matrix, Matrix":function(r,e){return c(r,e)}});function c(r,e){var t=e.size().length,c=r.size().length;if(t>1)throw Error("first object must be one dimensional");if(c>1)throw Error("second object must be one dimensional");if(t!==c)throw Error("Length of two vectors must be equal");if(0===i(r))throw Error("Sum of elements in first object must be non zero");if(0===i(e))throw Error("Sum of elements in second object must be non zero");var l=n(r,i(r)),h=n(e,i(e)),p=i(u(l,a(o(l,h),r=>s(r))));return f(p)?p:Number.NaN}},"mean"),fo=ey(fa,["typed","add","divide"],r=>{var{typed:e,add:t,divide:n}=r;return e(fa,{"Array | Matrix":i,"Array | Matrix, number | BigNumber":function(r,e){try{var i=tK(r,e,t),u=Array.isArray(r)?tm(r):r.size();return n(i,u[e])}catch(r){throw uJ(r,"mean")}},"...":function(r){if(tW(r))throw TypeError("Scalar values expected in function mean");return i(r)}});function i(r){var e,i=0;if(t$(r,function(r){try{e=void 0===e?r:t(e,r),i++}catch(e){throw uJ(e,"mean",r)}}),0===i)throw Error("Cannot calculate the mean of an empty array");return n(e,i)}}),fs="quantileSeq",ff=(r=>{var{typed:e,bignumber:t,add:n,subtract:i,divide:u,multiply:a,partitionSelect:o,compare:s,isInteger:f,smaller:c,smallerEq:l,larger:h}=r,p=ub({typed:e,isInteger:f});return e(fs,{"Array | Matrix, number | BigNumber":(r,e)=>v(r,e,!1),"Array | Matrix, number | BigNumber, number":(r,e,t)=>m(r,e,!1,t,v),"Array | Matrix, number | BigNumber, boolean":v,"Array | Matrix, number | BigNumber, boolean, number":(r,e,t,n)=>m(r,e,t,n,v),"Array | Matrix, Array | Matrix":(r,e)=>d(r,e,!1),"Array | Matrix, Array | Matrix, number":(r,e,t)=>m(r,e,!1,t,d),"Array | Matrix, Array | Matrix, boolean":d,"Array | Matrix, Array | Matrix, boolean, number":(r,e,t,n)=>m(r,e,t,n,d)});function m(r,e,t,n,i){return p(r,n,r=>i(r,e,t))}function v(r,e,i){var a,o=r.valueOf();if(c(e,0))throw Error("N/prob must be non-negative");if(l(e,1))return rP(e)?g(o,e,i):t(g(o,e,i));if(h(e,1)){if(!f(e))throw Error("N must be a positive integer");if(h(e,0xffffffff))throw Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var s=n(e,1);a=[];for(var p=0;c(p,e);p++){var m=u(p+1,s);a.push(g(o,m,i))}return rP(e)?a:t(a)}}function d(r,e,t){for(var n=r.valueOf(),i=e.valueOf(),u=[],a=0;a<i.length;++a)u.push(g(n,i[a],t));return u}function g(r,e,t){var u,c,l=tN(r),h=l.length;if(0===h)throw Error("Cannot calculate quantile of an empty sequence");var p=rP(e)?e*(h-1):e.times(h-1),m=rP(e)?Math.floor(p):p.floor().toNumber(),v=rP(e)?p%1:p.minus(m);if(f(p))return t?l[p]:o(l,rP(e)?p:p.valueOf());if(t)u=l[m],c=l[m+1];else{c=o(l,m+1),u=l[m];for(var d=0;d<m;++d)s(l[d],u)>0&&(u=l[d])}return n(a(u,i(1,v)),a(c,v))}},"unbiased"),fc="variance",fl=ey(fc,["typed","add","subtract","multiply","divide","apply","isNaN"],r=>{var{typed:e,add:t,subtract:n,multiply:i,divide:u,apply:a,isNaN:o}=r;return e(fc,{"Array | Matrix":function(r){return s(r,ff)},"Array | Matrix, string":s,"Array | Matrix, number | BigNumber":function(r,e){return f(r,e,ff)},"Array | Matrix, number | BigNumber, string":f,"...":function(r){return s(r,ff)}});function s(r,e){var a,s=0;if(0===r.length)throw SyntaxError("Function variance requires one or more parameters (0 provided)");if(t$(r,function(r){try{a=void 0===a?r:t(a,r),s++}catch(e){throw uJ(e,"variance",r)}}),0===s)throw Error("Cannot calculate variance of an empty array");var f=u(a,s);if(a=void 0,t$(r,function(r){var e=n(r,f);a=void 0===a?i(e,e):t(a,i(e,e))}),o(a))return a;switch(e){case"uncorrected":return u(a,s);case"biased":return u(a,s+1);case"unbiased":var c=rj(a)?a.mul(0):0;return 1===s?c:u(a,s-1);default:throw Error('Unknown normalization "'+e+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function f(r,e,t){try{if(0===r.length)throw SyntaxError("Function variance requires one or more parameters (0 provided)");return a(r,e,r=>s(r,t))}catch(r){throw uJ(r,"variance")}}}),fh="median",fp=ey(fh,["typed","add","divide","compare","partitionSelect"],r=>{var{typed:e,add:t,divide:n,compare:i,partitionSelect:u}=r;function a(r){try{var e=(r=tN(r.valueOf())).length;if(0===e)throw Error("Cannot calculate median of an empty array");if(e%2==0){for(var t=e/2-1,n=u(r,t+1),a=r[t],f=0;f<t;++f)i(r[f],a)>0&&(a=r[f]);return s(a,n)}var c=u(r,(e-1)/2);return o(c)}catch(r){throw uJ(r,"median")}}var o=e({"number | BigNumber | Complex | Unit":function(r){return r}}),s=e({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(r,e){return n(t(r,e),2)}});return e(fh,{"Array | Matrix":a,"Array | Matrix, number | BigNumber":function(r,e){throw Error("median(A, dim) is not yet supported")},"...":function(r){if(tW(r))throw TypeError("Scalar values expected in function median");return a(r)}})}),fm="corr",fv=(r=>{var{typed:e,matrix:t,sqrt:n,sum:i,add:u,subtract:a,multiply:o,pow:s,divide:f}=r;return e(fm,{"Array, Array":function(r,e){return c(r,e)},"Matrix, Matrix":function(r,e){var n=c(r.toArray(),e.toArray());return Array.isArray(n)?t(n):n}});function c(r,e){var t=[];if(Array.isArray(r[0])&&Array.isArray(e[0])){if(r.length!==e.length)throw SyntaxError("Dimension mismatch. Array A and B must have the same length.");for(var n=0;n<r.length;n++){if(r[n].length!==e[n].length)throw SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");t.push(l(r[n],e[n]))}return t}if(r.length!==e.length)throw SyntaxError("Dimension mismatch. Array A and B must have the same number of elements.");return l(r,e)}function l(r,e){var t=r.length,c=i(r),l=i(e),h=r.reduce((r,t,n)=>u(r,o(t,e[n])),0),p=i(r.map(r=>s(r,2))),m=i(e.map(r=>s(r,2)));return f(a(o(t,h),o(c,l)),n(o(a(o(t,p),s(c,2)),a(o(t,m),s(l,2)))))}},"freqz"),fd=(r=>{var{typed:e,add:t,multiply:n,Complex:i,divide:u,matrix:a}=r;return e(fv,{"Array, Array":function(r,e){return o(r,e,s(512))},"Array, Array, Array":function(r,e,t){return o(r,e,t)},"Array, Array, number":function(r,e,t){if(t<0)throw Error("w must be a positive number");return o(r,e,s(t))},"Matrix, Matrix":function(r,e){var t=s(512),{w:n,h:i}=o(r.valueOf(),e.valueOf(),t);return{w:a(n),h:a(i)}},"Matrix, Matrix, Matrix":function(r,e,t){var{h:n}=o(r.valueOf(),e.valueOf(),t.valueOf());return{h:a(n),w:a(t)}},"Matrix, Matrix, number":function(r,e,t){if(t<0)throw Error("w must be a positive number");var n=s(t),{h:i}=o(r.valueOf(),e.valueOf(),n);return{h:a(i),w:a(n)}}});function o(r,e,a){for(var o=[],s=[],f=0;f<a.length;f++){for(var c=i(0,0),l=i(0,0),h=0;h<r.length;h++)c=t(c,n(r[h],i(Math.cos(-h*a[f]),Math.sin(-h*a[f]))));for(var p=0;p<e.length;p++)l=t(l,n(e[p],i(Math.cos(-p*a[f]),Math.sin(-p*a[f]))));o.push(c),s.push(l)}for(var m=[],v=0;v<o.length;v++)m.push(u(o[v],s[v]));return{h:m,w:a}}function s(r){for(var e=[],t=0;t<r;t++)e.push(t/r*Math.PI);return e}},"zeta"),fg=(r=>{var{typed:e,config:t,multiply:n,pow:i,divide:u,factorial:a,equal:o,smallerEq:s,isNegative:f,gamma:c,sin:l,subtract:h,add:p,Complex:m,BigNumber:v,pi:d}=r;return e(fd,{number:r=>g(r,r=>r,()=>20),BigNumber:r=>g(r,r=>new v(r),()=>Math.abs(Math.log10(t.epsilon))),Complex:function(r){return 0===r.re&&0===r.im?new m(-.5):1===r.re?new m(NaN,NaN):r.re===1/0&&0===r.im?new m(1):r.im===1/0||r.re===-1/0?new m
1(NaN,NaN):y(r,r=>r,r=>Math.round(19.5+.9*Math.abs(r.im)),r=>r.re)}});function g(r,e,t){return o(r,0)?e(-.5):o(r,1)?e(NaN):isFinite(r)?y(r,e,t,r=>r):e(f(r)?NaN:1)}function y(r,e,t,a){var o=t(r);if(a(r)>-(o-1)/2)return function(r,e,t){for(var a=u(1,n(b(t(0),e),h(1,i(2,h(1,r))))),o=t(0),f=t(1);s(f,e);f=p(f,1))o=p(o,u(n((-1)**(f-1),b(f,e)),i(f,r)));return n(a,o)}(r,e(o),e);var f=n(i(2,r),i(e(d),h(r,1)));return f=n(f,l(n(u(e(d),2),r))),f=n(f,c(h(1,r))),n(f,y(h(1,r),e,t,a))}function b(r,e){for(var t=r,o=r;s(o,e);o=p(o,1)){var f=u(n(a(p(e,h(o,1))),i(4,o)),n(a(h(e,o)),a(n(2,o))));t=p(t,f)}return n(e,t)}},"norm"),fy=ey(fg,["typed","abs","add","pow","conj","sqrt","multiply","equalScalar","larger","smaller","matrix","ctranspose","eigs"],r=>{var{typed:e,abs:t,add:n,pow:i,conj:u,sqrt:a,multiply:o,equalScalar:s,larger:f,smaller:c,matrix:l,ctranspose:h,eigs:p}=r;return e(fg,{number:Math.abs,Complex:function(r){return r.abs()},BigNumber:function(r){return r.abs()},boolean:function(r){return Math.abs(r)},Array:function(r){return m(l(r),2)},Matrix:function(r){return m(r,2)},"Array, number | BigNumber | string":function(r,e){return m(l(r),e)},"Matrix, number | BigNumber | string":function(r,e){return m(r,e)}});function m(r,e){var l,v,d=r.size();if(1===d.length){if(e===Number.POSITIVE_INFINITY||"inf"===e)return l=0,r.forEach(function(r){var e=t(r);f(e,l)&&(l=e)},!0),l;if(e===Number.NEGATIVE_INFINITY||"-inf"===e)return r.forEach(function(r){var e=t(r);(!v||c(e,v))&&(v=e)},!0),v||0;if("fro"===e)return m(r,2);if("number"==typeof e&&!isNaN(e)){if(!s(e,0)){var g=0;return r.forEach(function(r){g=n(i(t(r),e),g)},!0),i(g,1/e)}return Number.POSITIVE_INFINITY}throw Error("Unsupported parameter value")}if(2===d.length)if(d[0]&&d[1])return function(r,e){if(1===e)return i=[],s=0,r.forEach(function(r,e){var u=e[1],a=n(i[u]||0,t(r));f(a,s)&&(s=a),i[u]=a},!0),s;if(e===Number.POSITIVE_INFINITY||"inf"===e)return c=[],l=0,r.forEach(function(r,e){var i=e[0],u=n(c[i]||0,t(r));f(u,l)&&(l=u),c[i]=u},!0),l;if("fro"===e)return m=0,r.forEach(function(r,e){m=n(m,o(r,u(r)))}),t(a(m));if(2===e){var i,s,c,l,m,v=r.size();if(v[0]!==v[1])throw RangeError("Invalid matrix dimensions");var d=p(o(h(r),r)).values.toArray();return t(a(d[d.length-1]))}throw Error("Unsupported parameter value "+e)}(r,e);else throw RangeError("Invalid matrix dimensions")}}),fb="rotationMatrix",fD=ey(fb,["typed","config","multiplyScalar","addScalar","unaryMinus","norm","matrix","BigNumber","DenseMatrix","SparseMatrix","cos","sin"],r=>{var{typed:e,config:t,multiplyScalar:n,addScalar:i,unaryMinus:u,norm:a,BigNumber:o,matrix:s,DenseMatrix:f,SparseMatrix:c,cos:l,sin:h}=r;return e(fb,{"":function(){return"Matrix"===t.matrix?s([]):[]},string:function(r){return s(r)},"number | BigNumber | Complex | Unit":function(r){return p(r,"Matrix"===t.matrix?"dense":void 0)},"number | BigNumber | Complex | Unit, string":function(r,e){return p(r,e)},"number | BigNumber | Complex | Unit, Array":function(r,e){var t=s(e);return m(t),g(r,t,void 0)},"number | BigNumber | Complex | Unit, Matrix":function(r,e){m(e);var n=e.storage()||("Matrix"===t.matrix?"dense":void 0);return g(r,e,n)},"number | BigNumber | Complex | Unit, Array, string":function(r,e,t){var n=s(e);return m(n),g(r,n,t)},"number | BigNumber | Complex | Unit, Matrix, string":function(r,e,t){return m(e),g(r,e,t)}});function p(r,e){var t=rj(r)?new o(-1):-1,i=l(r),u=h(r);return d([[i,n(t,u)],[u,i]],e)}function m(r){var e=r.size();if(e.length<1||3!==e[0])throw RangeError("Vector must be of dimensions 1x3")}function v(r){return r.reduce((r,e)=>n(r,e))}function d(r,e){if(e){if("sparse"===e)return new c(r);if("dense"===e)return new f(r);throw TypeError('Unknown matrix type "'.concat(e,'"'))}return r}function g(r,e,t){var n=a(e);if(0===n)throw RangeError("Rotation around zero vector");var s=rj(r)?o:null,f=s?new s(1):1,c=s?new s(-1):-1,p=s?new s(e.get([0])/n):e.get([0])/n,m=s?new s(e.get([1])/n):e.get([1])/n,g=s?new s(e.get([2])/n):e.get([2])/n,y=l(r),b=i(f,u(y)),D=h(r);return d([[i(y,v([p,p,b])),i(v([p,m,b]),v([c,g,D])),i(v([p,g,b]),v([m,D]))],[i(v([p,m,b]),v([g,D])),i(y,v([m,m,b])),i(v([m,g,b]),v([c,p,D]))],[i(v([p,g,b]),v([c,m,D])),i(v([m,g,b]),v([p,D])),i(y,v([g,g,b]))]],t)}}),fx="schur",fE=ey(fx,["typed","matrix","identity","multiply","qr","norm","subtract"],r=>{var{typed:e,matrix:t,identity:n,multiply:i,qr:u,norm:a,subtract:o}=r;return e(fx,{Array:function(r){var e=s(t(r));return{U:e.U.valueOf(),T:e.T.valueOf()}},Matrix:function(r){return s(r)}});function s(r){var e,t=r.size()[0],s=r,f=n(t),c=0;do{e=s;var l=u(s),h=l.Q;if(s=i(l.R,h),f=i(f,h),c++>100)break}while(a(o(s,e))>1e-4);return{U:f,T:s}}}),fA="rotate",fw=(r=>{var{typed:e,multiply:t,rotationMatrix:n}=r;return e(fA,{"Array , number | BigNumber | Complex | Unit":function(r,e){return i(r,2),t(n(e),r).toArray()},"Matrix , number | BigNumber | Complex | Unit":function(r,e){return i(r,2),t(n(e),r)},"Array, number | BigNumber | Complex | Unit, Array | Matrix":function(r,e,u){return i(r,3),t(n(e,u),r)},"Matrix, number | BigNumber | Complex | Unit, Array | Matrix":function(r,e,u){return i(r,3),t(n(e,u),r)}});function i(r,e){var t=Array.isArray(r)?tm(r):r.size();if(t.length>2||2===t.length&&1!==t[1]||t[0]!==e)throw RangeError("Vector must be of dimensions 1x".concat(e))}},"sylvester"),fN=ey(fw,["typed","schur","matrixFromColumns","matrix","multiply","range","concat","transpose","index","subset","add","subtract","identity","lusolve","abs"],r=>{var{typed:e,schur:t,matrixFromColumns:n,matrix:i,multiply:u,range:a,concat:o,transpose:s,index:f,subset:c,add:l,subtract:h,identity:p,lusolve:m,abs:v}=r;return e(fw,{"Matrix, Matrix, Matrix":d,"Array, Matrix, Matrix":function(r,e,t){return d(i(r),e,t)},"Array, Array, Matrix":function(r,e,t){return d(i(r),i(e),t)},"Array, Matrix, Array":function(r,e,t){return d(i(r),e,i(t))},"Matrix, Array, Matrix":function(r,e,t){return d(r,i(e),t)},"Matrix, Array, Array":function(r,e,t){return d(r,i(e),i(t))},"Matrix, Matrix, Array":function(r,e,t){return d(r,e,i(t))},"Array, Array, Array":function(r,e,t){return d(i(r),i(e),i(t)).toArray()}});function d(r,e,d){for(var g=e.size()[0],y=r.size()[0],b=t(r),D=b.T,x=b.U,E=t(u(-1,e)),A=E.T,w=E.U,N=u(u(s(x),d),w),M=a(0,y),C=[],F=(r,e)=>o(r,e,1),S=(r,e)=>o(r,e,0),_=0;_<g;_++)if(_<g-1&&v(c(A,f(_+1,_)))>1e-5){for(var B=S(c(N,f(M,_)),c(N,f(M,_+1))),T=0;T<_;T++)B=l(B,S(u(C[T],c(A,f(T,_))),u(C[T],c(A,f(T,_+1)))));var O=u(p(y),u(-1,c(A,f(_,_)))),z=u(p(y),u(-1,c(A,f(_+1,_)))),I=u(p(y),u(-1,c(A,f(_,_+1)))),R=u(p(y),u(-1,c(A,f(_+1,_+1)))),U=m(S(F(l(D,O),z),F(I,l(D,R))),B);C[_]=U.subset(f(a(0,y),0)),C[_+1]=U.subset(f(a(y,2*y),0)),_++}else{for(var P=c(N,f(M,_)),j=0;j<_;j++)P=l(P,u(C[j],c(A,f(j,_))));var k=h(D,u(c(A,f(_,_)),p(y)));C[_]=m(k,P)}return u(x,u(i(n(...C)),s(w)))}}),fM="lyap",fC=(r=>{var{typed:e,matrix:t,sylvester:n,multiply:i,transpose:u}=r;return e(fM,{"Matrix, Matrix":function(r,e){return n(r,u(r),i(-1,e))},"Array, Matrix":function(r,e){return n(t(r),u(t(r)),i(-1,e))},"Matrix, Array":function(r,e){return n(r,u(t(r)),t(i(-1,e)))},"Array, Array":function(r,e){return n(t(r),u(t(r)),t(i(-1,e))).toArray()}})},eD({config:u})),fF=eX({}),fS=tn({}),f_=e7({Complex:fF}),fB=ti({}),fT=e4({BigNumber:fC,config:u}),fO=tO({Matrix:fB});var fz=tV({BigNumber:fC,Complex:fF,DenseMatrix:fO,Fraction:fS});var fI=np({typed:fz}),fR=nO({typed:fz}),fU=nI({typed:fz}),fP=nU({BigNumber:fC,typed:fz}),fj=n4({typed:fz}),fk=n9({Complex:fF,typed:fz}),fq=ir({typed:fz}),fL=it({typed:fz}),fH=is({config:u,typed:fz}),fG=iv({typed:fz}),fV=iE({typed:fz}),fZ=iw({typed:fz}),fY=iN({typed:fz}),fX=iC({typed:fz}),fJ=iz({typed:fz}),fW=iR({typed:fz}),f$=iP({typed:fz}),fQ=iY({Complex:fF,config:u,typed:fz}),fK=iW({typed:fz}),f0=i3({typed:fz}),f1=ui({typed:fz}),f2=ua({BigNumber:fC,Fraction:fS,complex:fk,typed:fz}),f3=uo({typed:fz}),f8=us({Matrix:fB,equalScalar:fH,typed:fz}),f5=up({typed:fz});var f4=ub({isInteger:fX,typed:fz}),f7=uC({typed:fz}),f9=uO({Complex:fF,config:u,typed:fz}),f6=uI({typed:fz}),cr=uP({Fraction:fS,typed:fz}),ce=uk({typed:fz}),ct=uL({DenseMatrix:fO,Matrix:fB,SparseMatrix:f8,typed:fz}),cn=uX({bignumber:fP,fraction:cr,number:f0}),ci=uK({isInteger:fX,matrix:ct,typed:fz}),cu=u1({matrix:ct,config:u,typed:fz}),ca=u8({matrix:ct,typed:fz}),co=u9({BigNumber:fC,config:u,matrix:ct,typed:fz});var cs=an({isInteger:fX,matrix:ct,typed:fz}),cf=aa({conj:fq,transpose:ca,typed:fz}),cc=as({DenseMatrix:fO,SparseMatrix:f8,matrix:ct,typed:fz}),cl=ac({numeric:cn,typed:fz}),ch=ax({DenseMatrix:fO,concat:cs,divideScalar:cl,equalScalar:fH,matrix:ct,typed:fz}),cp=aA({DenseMatrix:fO,concat:cs,equalScalar:fH,matrix:ct,typed:fz}),cm=aM({matrix:ct,typed:fz}),cv=aS({BigNumber:fC,DenseMatrix:fO,SparseMatrix:f8,config:u,matrix:ct,typed:fz}),cd=aT({DenseMatrix:fO,concat:cs,config:u,matrix:ct,typed:fz}),cg=aq({DenseMatrix:fO,divideScalar:cl,equalScalar:fH,matrix:ct,multiplyScalar:fK,subtractScalar:f5,typed:fz}),cy=aH({flatten:cm,matrix:ct,size:cu,typed:fz}),cb=aZ({addScalar:fR,complex:fk,conj:fq,divideScalar:cl,equal:cp,identity:cv,isZero:f$,matrix:ct,multiplyScalar:fK,sign:f2,sqrt:f9,subtractScalar:f5,typed:fz,unaryMinus:f6,zeros:co}),cD=a$({BigNumber:fC,DenseMatrix:fO,config:u,equalScalar:fH,matrix:ct,typed:fz,zeros:co}),cx=aK({DenseMatrix:fO,concat:cs,config:u,matrix:ct,typed:fz}),cE=a3({DenseMatrix:fO,concat:cs,equalScalar:fH,matrix:ct,subtractScalar:f5,typed:fz,unaryMinus:f6}),cA=a7({DenseMatrix:fO,divideScalar:cl,equalScalar:fH,matrix:ct,multiplyScalar:fK,subtractScalar:f5,typed:fz}),cw=a6({DenseMatrix:fO,SparseMatrix:f8,addScalar:fR,concat:cs,equalScalar:fH,matrix:ct,typed:fz}),cN=oo({BigNumber:fC,DenseMatrix:fO,Fraction:fS,concat:cs,config:u,equalScalar:fH,matrix:ct,typed:fz});var cM=od({addScalar:fR,conj:fq,multiplyScalar:fK,size:cu,typed:fz}),cC=oD({DenseMatrix:fO,config:u,equalScalar:fH,matrix:ct,round:cD,typed:fz,zeros:co}),cF=oC({ImmutableDenseMatrix:oM({DenseMatrix:fO,smaller:cx}),getMatrixDataType:fZ}),cS=o_({DenseMatrix:fO,concat:cs,config:u,matrix:ct,typed:fz});var c_=oR({addScalar:fR,dot:cM,equalScalar:fH,matrix:ct,multiplyScalar:fK,typed:fz}),cB=oj({compare:cN,isNaN:f7,isNumeric:ce,typed:fz}),cT=oJ({SparseMatrix:f8,abs:fI,add:cw,divideScalar:cl,larger:cS,largerEq:cd,multiply:c_,subtract:cE,transpose:ca,typed:fz}),cO=o$({add:cw,matrix:ct,typed:fz,zeros:co});var cz=o8({DenseMatrix:fO,divideScalar:cl,equalScalar:fH,matrix:ct,multiplyScalar:fK,subtractScalar:f5,typed:fz}),cI=o9({DenseMatrix:fO,config:u,equalScalar:fH,matrix:ct,round:cD,typed:fz,zeros:co}),cR=st({compare:cN,typed:fz}),cU=su({divideScalar:cl,isZero:f$,matrix:ct,multiply:c_,subtractScalar:f5,typed:fz,unaryMinus:f6}),cP=so({larger:cS,smaller:cx}),cj=sf({Complex:fF,DenseMatrix:fO,ceil:cI,equalScalar:fH,floor:cC,matrix:ct,typed:fz,zeros:co}),ck=sl({Index:cF,typed:fz});var cq=sD({DenseMatrix:fO,concat:cs,config:u,matrix:ct,typed:fz}),cL=sw({bignumber:fP,matrix:ct,add:cw,config:u,isPositive:fW,larger:cS,largerEq:cd,smaller:cx,smallerEq:cq,typed:fz}),cH=sM({DenseMatrix:fO,Index:cF,compareNatural:cR,size:cu,subset:cO,typed:fz});var cG=s_({FibonacciHeap:cP,addScalar:fR,equalScalar:fH}),cV=sT({Index:cF,matrix:ct,range:cL,typed:fz}),cZ=sO({abs:fI,addScalar:fR,det:cU,divideScalar:cl,identity:cv,matrix:ct,multiply:c_,typed:fz,unaryMinus:f6}),cY=sz({DenseMatrix:fO,Spa:cG,SparseMatrix:f8,abs:fI,addScalar:fR,divideScalar:cl,equalScalar:fH,larger:cS,matrix:ct,multiplyScalar:fK,subtractScalar:f5,typed:fz,unaryMinus:f6}),cX=sR({Complex:fF,config:u,fraction:cr,identity:cv,inv:cZ,matrix:ct,multiply:c_,number:f0,typed:fz});var cJ=sJ({BigNumber:fC,Complex:fF,config:u,multiplyScalar:fK,pow:cX,typed:fz}
1),cW=sQ({divideScalar:cl,equalScalar:fH,inv:cZ,matrix:ct,multiply:c_,typed:fz}),c$=s0({gamma:cJ,typed:fz}),cQ=s3({DenseMatrix:fO,lsolve:cg,lup:cY,matrix:ct,slu:cT,typed:fz,usolve:cA});var cK=fi({abs:fI,add:cw,addScalar:fR,atan:fU,bignumber:fP,column:cV,complex:fk,config:u,cos:fL,diag:cc,divideScalar:cl,dot:cM,equal:cp,flatten:cm,im:fY,inv:cZ,larger:cS,matrix:ct,matrixFromColumns:cy,multiply:c_,multiplyScalar:fK,number:f0,qr:cb,re:f1,reshape:ci,sin:f3,size:cu,smaller:cx,sqrt:f9,subtract:cE,typed:fz,usolve:cA,usolveAll:cz});var c0=fy({abs:fI,add:cw,conj:fq,ctranspose:cf,eigs:cK,equalScalar:fH,larger:cS,matrix:ct,multiply:c_,pow:cX,smaller:cx,sqrt:f9,typed:fz});var c1=fE({identity:cv,matrix:ct,multiply:c_,norm:c0,qr:cb,subtract:cE,typed:fz})},48021:(r,e,t)=>{"use strict";t.d(e,{A:()=>i});var n=t(25547);function i(r,e,t){return(e=(0,n.A)(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}},54652:(r,e,t)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),!function(r,e){for(var t in e)Object.defineProperty(r,t,{enumerable:!0,get:e[t]})}(e,{default:function(){return s},getImageProps:function(){return o}});let n=t(15351),i=t(75040),u=t(81356),a=n._(t(71124));function o(r){let{props:e}=(0,i.getImgProps)(r,{defaultLoader:a.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!0}});for(let[r,t]of Object.entries(e))void 0===t&&delete e[r];return{props:e}}let s=u.Image},57374:function(r,e,t){var n;!function(r,i,u){function a(r){var e=this;e.next=function(){var r,t,n=e.x,i=e.i;return r=n[i],r^=r>>>7,t=r^r<<24^((r=n[i+1&7])^r>>>10)^((r=n[i+3&7])^r>>>3)^((r=n[i+4&7])^r<<7),r=n[i+7&7],r^=r<<13,t^=r^r<<9,n[i]=t,e.i=i+1&7,t};var t,n=r,i=[];if(n===(0|n))i[0]=n;else for(t=0,n=""+n;t<n.length;++t)i[7&t]=i[7&t]<<15^n.charCodeAt(t)+i[t+1&7]<<13;for(;i.length<8;)i.push(0);for(t=0;t<8&&0===i[t];++t);for(8==t?i[7]=-1:i[t],e.x=i,e.i=0,t=256;t>0;--t)e.next()}function o(r,e){return e.x=r.x.slice(),e.i=r.i,e}function s(r,e){null==r&&(r=+new Date);var t=new a(r),n=e&&e.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var r=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===r);return r},i.int32=t.next,i.quick=i,n&&(n.x&&o(n,t),i.state=function(){return o(t,{})}),i}i&&i.exports?i.exports=s:t.amdD&&t.amdO?void 0===(n=(function(){return s}).call(e,t,e,i))||(i.exports=n):this.xorshift7=s}(0,r=t.nmd(r),t.amdD)},66988:(r,e,t)=>{"use strict";t.d(e,{b:()=>s});var n=t(95070),i=t(20426),u=t(24245),a=t(52362),o=t(4779),s=(0,n.gu)({chartName:"LineChart",GraphicalChild:i.N,axisComponents:[{axisType:"xAxis",AxisComp:u.W},{axisType:"yAxis",AxisComp:a.h}],formatAxisMap:o.pr})},68792:function(r,e,t){var n;!function(r,i,u){function a(r){var e=this,t="";e.next=function(){var r=e.b,t=e.c,n=e.d,i=e.a;return r=r<<25^r>>>7^t,t=t-n|0,n=n<<24^n>>>8^i,i=i-r|0,e.b=r=r<<20^r>>>12^t,e.c=t=t-n|0,e.d=n<<16^t>>>16^i,e.a=i-r|0},e.a=0,e.b=0,e.c=-0x61c88647,e.d=0x517cc1b7,r===Math.floor(r)?(e.a=r/0x100000000|0,e.b=0|r):t+=r;for(var n=0;n<t.length+20;n++)e.b^=t.charCodeAt(n),e.next()}function o(r,e){return e.a=r.a,e.b=r.b,e.c=r.c,e.d=r.d,e}function s(r,e){var t=new a(r),n=e&&e.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var r=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===r);return r},i.int32=t.next,i.quick=i,n&&("object"==typeof n&&o(n,t),i.state=function(){return o(t,{})}),i}i&&i.exports?i.exports=s:t.amdD&&t.amdO?void 0===(n=(function(){return s}).call(e,t,e,i))||(i.exports=n):this.tychei=s}(0,r=t.nmd(r),t.amdD)},81844:function(r,e,t){var n;!function(r,i,u){function a(r){var e=this;e.next=function(){var r,t,n=e.w,i=e.X,u=e.i;return e.w=n=n+0x61c88647|0,t=i[u+34&127],r=i[u=u+1&127],t^=t<<13,r^=r<<17,t^=t>>>15,r^=r>>>12,t=i[u]=t^r,e.i=u,t+(n^n>>>16)|0},!function(r,e){var t,n,i,u,a,o=[],s=128;for(e===(0|e)?(n=e,e=null):(e+="\0",n=0,s=Math.max(s,e.length)),i=0,u=-32;u<s;++u)e&&(n^=e.charCodeAt((u+32)%e.length)),0===u&&(a=n),n^=n<<10,n^=n>>>15,n^=n<<4,n^=n>>>13,u>=0&&(a=a+0x61c88647|0,i=0==(t=o[127&u]^=n+a)?i+1:0);for(i>=128&&(o[127&(e&&e.length||0)]=-1),i=127,u=512;u>0;--u)n=o[i+34&127],t=o[i=i+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,o[i]=n^t;r.w=a,r.X=o,r.i=i}(e,r)}function o(r,e){return e.i=r.i,e.w=r.w,e.X=r.X.slice(),e}function s(r,e){null==r&&(r=+new Date);var t=new a(r),n=e&&e.state,i=function(){return(t.next()>>>0)/0x100000000};return i.double=function(){do var r=((t.next()>>>11)+(t.next()>>>0)/0x100000000)/2097152;while(0===r);return r},i.int32=t.next,i.quick=i,n&&(n.X&&o(n,t),i.state=function(){return o(t,{})}),i}i&&i.exports?i.exports=s:t.amdD&&t.amdO?void 0===(n=(function(){return s}).call(e,t,e,i))||(i.exports=n):this.xor4096=s}(0,r=t.nmd(r),t.amdD)},92285:(r,e,t)=>{"use strict";t.d(e,{Mz:()=>G,UC:()=>Y,ZL:()=>Z,bL:()=>H,l9:()=>V});var n=t(12115),i=t(31499),u=t(73671),a=t(37143),o=t(77164),s=t(41799),f=t(4956
15),c=t(87123),l=t(4485),h=t(77632),p=t(90879),m=t(27289),v=t(99530),d=t(43971),g=t(14772),y=t(23691),b=t(95155),D="Popover",[x,E]=(0,a.A)(D,[l.Bk]),A=(0,l.Bk)(),[w,N]=x(D),M=r=>{let{__scopePopover:e,children:t,open:i,defaultOpen:u,onOpenChange:a,modal:o=!1}=r,s=A(e),f=n.useRef(null),[h,p]=n.useState(!1),[m,v]=(0,d.i)({prop:i,defaultProp:null!=u&&u,onChange:a,caller:D});return(0,b.jsx)(l.bL,{...s,children:(0,b.jsx)(w,{scope:e,contentId:(0,c.B)(),triggerRef:f,open:m,onOpenChange:v,onOpenToggle:n.useCallback(()=>v(r=>!r),[v]),hasCustomAnchor:h,onCustomAnchorAdd:n.useCallback(()=>p(!0),[]),onCustomAnchorRemove:n.useCallback(()=>p(!1),[]),modal:o,children:t})})};M.displayName=D;var C="PopoverAnchor",F=n.forwardRef((r,e)=>{let{__scopePopover:t,...i}=r,u=N(C,t),a=A(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=u;return n.useEffect(()=>(o(),()=>s()),[o,s]),(0,b.jsx)(l.Mz,{...a,...i,ref:e})});F.displayName=C;var S="PopoverTrigger",_=n.forwardRef((r,e)=>{let{__scopePopover:t,...n}=r,a=N(S,t),o=A(t),s=(0,u.s)(e,a.triggerRef),f=(0,b.jsx)(m.sG.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":L(a.open),...n,ref:s,onClick:(0,i.m)(r.onClick,a.onOpenToggle)});return a.hasCustomAnchor?f:(0,b.jsx)(l.Mz,{asChild:!0,...o,children:f})});_.displayName=S;var B="PopoverPortal",[T,O]=x(B,{forceMount:void 0}),z=r=>{let{__scopePopover:e,forceMount:t,children:n,container:i}=r,u=N(B,e);return(0,b.jsx)(T,{scope:e,forceMount:t,children:(0,b.jsx)(p.C,{present:t||u.open,children:(0,b.jsx)(h.Z,{asChild:!0,container:i,children:n})})})};z.displayName=B;var I="PopoverContent",R=n.forwardRef((r,e)=>{let t=O(I,r.__scopePopover),{forceMount:n=t.forceMount,...i}=r,u=N(I,r.__scopePopover);return(0,b.jsx)(p.C,{present:n||u.open,children:u.modal?(0,b.jsx)(P,{...i,ref:e}):(0,b.jsx)(j,{...i,ref:e})})});R.displayName=I;var U=(0,v.TL)("PopoverContent.RemoveScroll"),P=n.forwardRef((r,e)=>{let t=N(I,r.__scopePopover),a=n.useRef(null),o=(0,u.s)(e,a),s=n.useRef(!1);return n.useEffect(()=>{let r=a.current;if(r)return(0,g.Eq)(r)},[]),(0,b.jsx)(y.A,{as:U,allowPinchZoom:!0,children:(0,b.jsx)(k,{...r,ref:o,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,i.m)(r.onCloseAutoFocus,r=>{var e;r.preventDefault(),s.current||null==(e=t.triggerRef.current)||e.focus()}),onPointerDownOutside:(0,i.m)(r.onPointerDownOutside,r=>{let e=r.detail.originalEvent,t=0===e.button&&!0===e.ctrlKey;s.current=2===e.button||t},{checkForDefaultPrevented:!1}),onFocusOutside:(0,i.m)(r.onFocusOutside,r=>r.preventDefault(),{checkForDefaultPrevented:!1})})})}),j=n.forwardRef((r,e)=>{let t=N(I,r.__scopePopover),i=n.useRef(!1),u=n.useRef(!1);return(0,b.jsx)(k,{...r,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:e=>{var n,a;null==(n=r.onCloseAutoFocus)||n.call(r,e),e.defaultPrevented||(i.current||null==(a=t.triggerRef.current)||a.focus(),e.preventDefault()),i.current=!1,u.current=!1},onInteractOutside:e=>{var n,a;null==(n=r.onInteractOutside)||n.call(r,e),e.defaultPrevented||(i.current=!0,"pointerdown"===e.detail.originalEvent.type&&(u.current=!0));let o=e.target;(null==(a=t.triggerRef.current)?void 0:a.contains(o))&&e.preventDefault(),"focusin"===e.detail.originalEvent.type&&u.current&&e.preventDefault()}})}),k=n.forwardRef((r,e)=>{let{__scopePopover:t,trapFocus:n,onOpenAutoFocus:i,onCloseAutoFocus:u,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:m,...v}=r,d=N(I,t),g=A(t);return(0,s.Oh)(),(0,b.jsx)(f.n,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:i,onUnmountAutoFocus:u,children:(0,b.jsx)(o.qW,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:m,onEscapeKeyDown:c,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>d.onOpenChange(!1),children:(0,b.jsx)(l.UC,{"data-state":L(d.open),role:"dialog",id:d.contentId,...g,...v,ref:e,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),q="PopoverClose";function L(r){return r?"open":"closed"}n.forwardRef((r,e)=>{let{__scopePopover:t,...n}=r,u=N(q,t);return(0,b.jsx)(m.sG.button,{type:"button",...n,ref:e,onClick:(0,i.m)(r.onClick,()=>u.onOpenChange(!1))})}).displayName=q,n.forwardRef((r,e)=>{let{__scopePopover:t,...n}=r,i=A(t);return(0,b.jsx)(l.i3,{...i,...n,ref:e})}).displayName="PopoverArrow";var H=M,G=F,V=_,Z=z,Y=R},97721:function(r,e){var t;!function(n){"use strict";var i=Math.cosh||function(r){return 1e-9>Math.abs(r)?1-r:(Math.exp(r)+Math.exp(-r))*.5},u=Math.sinh||function(r){return 1e-9>Math.abs(r)?r:(Math.exp(r)-Math.exp(-r))*.5},a=function(r){var e=Math.PI/4;if(-e>r||r>e)return Math.cos(r)-1;var t=r*r;return t*(t*(t*(t*(t*(t*(t*(t/20922789888e3-1/0x144c3b2800)+1/0x1c8cfc00)-1/3628800)+1/40320)-1/720)+1/24)-.5)},o=function(r,e){var t=Math.abs(r),n=Math.abs(e);return t<3e3&&n<3e3?Math.sqrt(t*t+n*n):(t<n?(t=n,n=r/e):n=e/r,t*Math.sqrt(1+n*n))},s=function(){throw SyntaxError("Invalid Param")};function f(r,e){var t=Math.abs(r),n=Math.abs(e);return 0===r?Math.log(n):0===e?Math.log(t):t<3e3&&n<3e3?.5*Math.log(r*r+e*e):.5*Math.log((r/=2)*r+(e/=2)*e)+Math.LN2}var c=function(r,e){var t={re:0,im:0};if(null==r)t.re=t.im=0;else if(void 0!==e)t.re=r,t.im=e;else switch(typeof r){case"object":if("im"in r&&"re"in r)t.re=r.re,t.im=r.im;else if("abs"in r&&"arg"in r){if(!Number.isFinite(r.abs)&&Number.isFinite(r.arg))return l.INFINITY;t.re=r.abs*Math.cos(r.arg),t.im=r.abs*Math.sin(r.arg)}else if("r"in r&&"phi"in r){if(!Number.isFinite(r.r)&&Number.isFinite(r.phi))return l.INFINITY;t.re=r.r*Math.cos(r.phi),t.im=r.r*Math.sin(r.phi)}else 2===r.length?(t.re=r[0],t.im=r[1]):s();break;case"string":t.im=t.re=0;var n=r.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),i=1,u=0;null===n&&s();for(var a=0;a<n.length;a++){var o=n[a];" "===o||" "===o||"\n"===o||("+"===o?i++:"-"===o?u++:("i"===o||"I"===o?(i+u===0&&s()," "===n[a+1]||isNaN(n[a+1])?t.im+=parseFloat((u%2?"-":"")+"1"):(t.im+=parseFloat((u%2?"-":"")+n[a+1]),a++)):((i+u===0||isNaN(o))&&s(),"i"===n[a+1]||"I"===n[a+1]?(t.im+=parseFloat((u%2?"-":"")+o),a++):t.re+=parseFloat((u%2?"-":"")+o)),i=u=0))}i+u>0&&s();break;case"number":t.im=0,t.re=r;break;default:s()}return isNaN(t.re)||isNaN(t.im),t};function l(r,e){if(!(this instanceof l))return new l(r,e);var t=c(r,e);this.re=t.re,this.im=t.im}l.prototype={re:0,im:0,sign:function(){var r=this.abs();return new l(this.re/r,this.im/r)},add:function(r,e){var t=new l(r,e);return this.isInfinite()&&t.isInfinite()?l.NAN:this.isInfinite()||t.isInfinite()?l.INFINITY:new l(this.re+t.re,this.im+t.im)},sub:function(r,e){var t=new l(r,e);return this.isInfinite()&&t.isInfinite()?l.NAN:this.isInfinite()||t.isInfinite()?l.INFINITY:new l(this.re-t.re,this.im-t.im)},mul:function(r,e){var t=new l(r,e);return this.isInfinite()&&t.isZero()||this.isZero()&&t.isInfinite()?l.NAN:this.isInfinite()||t.isInfinite()?l.INFINITY:0===t.im&&0===this.im?new l(this.re*t.re,0):new l(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)},div:function(r,e){var t,n,i=new l(r,e);if(this.isZero()&&i.isZero()||this.isInfinite()&&i.isInfinite())return l.NAN;if(this.isInfinite()||i.isZero())return l.INFINITY;if(this.isZero()||i.isInfinite())return l.ZERO;r=this.re,e=this.im;var u=i.re,a=i.im;return 0===a?new l(r/u,e/u):Math.abs(u)<Math.abs(a)?(n=u/a,t=u*n+a,new l((r*n+e)/t,(e*n-r)/t)):(n=a/u,t=a*n+u,new l((r+e*n)/t,(e-r*n)/t))},pow:function(r,e){var t=new l(r,e);if(r=this.re,e=this.im,t.isZero())return l.ONE;if(0===t.im){if(0===e&&r>0)return new l(Math.pow(r,t.re),0);else if(0===r)switch((t.re%4+4)%4){case 0:return new l(Math.pow(e,t.re),0);case 1:return new l(0,Math.pow(e,t.re));case 2:return new l(-Math.pow(e,t.re),0);case 3:return new l(0,-Math.pow(e,t.re))}}if(0===r&&0===e&&t.re>0&&t.im>=0)return l.ZERO;var n=Math.atan2(e,r),i=f(r,e);return new l((r=Math.exp(t.re*i-t.im*n))*Math.cos(e=t.im*i+t.re*n),r*Math.sin(e))},sqrt:function(){var r,e,t=this.re,n=this.im,i=this.abs();if(t>
vendor: 4,828 bytes, line 1
1=0){if(0===n)return new l(Math.sqrt(t),0);r=.5*Math.sqrt(2*(i+t))}else r=Math.abs(n)/Math.sqrt(2*(i-t));return e=t<=0?.5*Math.sqrt(2*(i-t)):Math.abs(n)/Math.sqrt(2*(i+t)),new l(r,n<0?-e:e)},exp:function(){var r=Math.exp(this.re);return this.im,new l(r*Math.cos(this.im),r*Math.sin(this.im))},expm1:function(){var r=this.re,e=this.im;return new l(Math.expm1(r)*Math.cos(e)+a(e),Math.exp(r)*Math.sin(e))},log:function(){var r=this.re,e=this.im;return new l(f(r,e),Math.atan2(e,r))},abs:function(){return o(this.re,this.im)},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var r=this.re,e=this.im;return new l(Math.sin(r)*i(e),Math.cos(r)*u(e))},cos:function(){var r=this.re,e=this.im;return new l(Math.cos(r)*i(e),-Math.sin(r)*u(e))},tan:function(){var r=2*this.re,e=2*this.im,t=Math.cos(r)+i(e);return new l(Math.sin(r)/t,u(e)/t)},cot:function(){var r=2*this.re,e=2*this.im,t=Math.cos(r)-i(e);return new l(-Math.sin(r)/t,u(e)/t)},sec:function(){var r=this.re,e=this.im,t=.5*i(2*e)+.5*Math.cos(2*r);return new l(Math.cos(r)*i(e)/t,Math.sin(r)*u(e)/t)},csc:function(){var r=this.re,e=this.im,t=.5*i(2*e)-.5*Math.cos(2*r);return new l(Math.sin(r)*i(e)/t,-Math.cos(r)*u(e)/t)},asin:function(){var r=this.re,e=this.im,t=new l(e*e-r*r+1,-2*r*e).sqrt(),n=new l(t.re-e,t.im+r).log();return new l(n.im,-n.re)},acos:function(){var r=this.re,e=this.im,t=new l(e*e-r*r+1,-2*r*e).sqrt(),n=new l(t.re-e,t.im+r).log();return new l(Math.PI/2-n.im,n.re)},atan:function(){var r=this.re,e=this.im;if(0===r){if(1===e)return new l(0,1/0);if(-1===e)return new l(0,-1/0)}var t=r*r+(1-e)*(1-e),n=new l((1-e*e-r*r)/t,-2*r/t).log();return new l(-.5*n.im,.5*n.re)},acot:function(){var r=this.re,e=this.im;if(0===e)return new l(Math.atan2(1,r),0);var t=r*r+e*e;return 0!==t?new l(r/t,-e/t).atan():new l(0!==r?r/0:0,0!==e?-e/0:0).atan()},asec:function(){var r=this.re,e=this.im;if(0===r&&0===e)return new l(0,1/0);var t=r*r+e*e;return 0!==t?new l(r/t,-e/t).acos():new l(0!==r?r/0:0,0!==e?-e/0:0).acos()},acsc:function(){var r=this.re,e=this.im;if(0===r&&0===e)return new l(Math.PI/2,1/0);var t=r*r+e*e;return 0!==t?new l(r/t,-e/t).asin():new l(0!==r?r/0:0,0!==e?-e/0:0).asin()},sinh:function(){var r=this.re,e=this.im;return new l(u(r)*Math.cos(e),i(r)*Math.sin(e))},cosh:function(){var r=this.re,e=this.im;return new l(i(r)*Math.cos(e),u(r)*Math.sin(e))},tanh:function(){var r=2*this.re,e=2*this.im,t=i(r)+Math.cos(e);return new l(u(r)/t,Math.sin(e)/t)},coth:function(){var r=2*this.re,e=2*this.im,t=i(r)-Math.cos(e);return new l(u(r)/t,-Math.sin(e)/t)},csch:function(){var r=this.re,e=this.im,t=Math.cos(2*e)-i(2*r);return new l(-2*u(r)*Math.cos(e)/t,2*i(r)*Math.sin(e)/t)},sech:function(){var r=this.re,e=this.im,t=Math.cos(2*e)+i(2*r);return new l(2*i(r)*Math.cos(e)/t,-2*u(r)*Math.sin(e)/t)},asinh:function(){var r=this.im;this.im=-this.re,this.re=r;var e=this.asin();return this.re=-this.im,this.im=r,r=e.re,e.re=-e.im,e.im=r,e},acosh:function(){var r=this.acos();if(r.im<=0){var e=r.re;r.re=-r.im,r.im=e}else{var e=r.im;r.im=-r.re,r.re=e}return r},atanh:function(){var r=this.re,e=this.im,t=1-r,n=1+r,i=t*t+e*e,u=0!==i?new l((n*t-e*e)/i,(e*t+n*e)/i):new l(-1!==r?r/0:0,0!==e?e/0:0),a=u.re;return u.re=f(u.re,u.im)/2,u.im=Math.atan2(u.im,a)/2,r>1&&0===e&&(u.im=-u.im),u},acoth:function(){var r=this.re,e=this.im;if(0===r&&0===e)return new l(0,Math.PI/2);var t=r*r+e*e;return 0!==t?new l(r/t,-e/t).atanh():new l(0!==r?r/0:0,0!==e?-e/0:0).atanh()},acsch:function(){var r=this.re,e=this.im;if(0===e)return new l(0!==r?Math.log(r+Math.sqrt(r*r+1)):1/0,0);var t=r*r+e*e;return 0!==t?new l(r/t,-e/t).asinh():new l(0!==r?r/0:0,0!==e?-e/0:0).asinh()},asech:function(){var r=this.re,e=this.im;if(this.isZero())return l.INFINITY;var t=r*r+e*e;return 0!==t?new l(r/t,-e/t).acosh():new l(0!==r?r/0:0,0!==e?-e/0:0).acosh()},inverse:function(){if(this.isZero())return l.INFINITY;if(this.isInfinite())return l.ZERO;var r=this.re,e=this.im,t=r*r+e*e;return new l(r/t,-e/t)},conjugate:function(){return new l(this.re,-this.im)},neg:function(){return new l(-this.re,-this.im)},ceil:function(r){return r=Math.pow(10,r||0),new l(Math.ceil(this.re*r)/r,Math.ceil(this.im*r)/r)},floor:function(r){return r=Math.pow(10,r||0),new l(Math.floor(this.re*r)/r,Math.floor(this.im*r)/r)},round:function(r){return r=Math.pow(10,r||0),new l(Math.round(this.re*r)/r,Math.round(this.im*r)/r)},equals:function(r,e){var t=new l(r,e);return Math.abs(t.re-this.re)<=l.EPSILON&&Math.abs(t.im-this.im)<=l.EPSILON},clone:function(){return new l(this.re,this.im)},toString:function(){var r=this.re,e=this.im,t="";return this.isNaN()?"NaN":this.isInfinite()?"Infinity":(Math.abs(r)<l.EPSILON&&(r=0),Math.abs(e)<l.EPSILON&&(e=0),0===e)?t+r:(0!==r?(t+=r,t+=" ",e<0?(e=-e,t+="-"):t+="+",t+=" "):e<0&&(e=-e,t+="-"),1!==e&&(t+=e),t+"i")},toVector:function(){return[this.re,this.im]}
1,valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return 0===this.im&&0===this.re},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},l.ZERO=new l(0,0),l.ONE=new l(1,0),l.I=new l(0,1),l.PI=new l(Math.PI,0),l.E=new l(Math.E,0),l.INFINITY=new l(1/0,1/0),l.NAN=new l(NaN,NaN),l.EPSILON=1e-15,void 0===(t=(function(){return l}).apply(e,[]))||(r.exports=t)}(0)},99540:function(r){!function(e){"use strict";var t={s:1,n:0,d:1};function n(r,e){if(isNaN(r=parseInt(r,10)))throw c();return r*e}function i(r,e){if(0===e)throw f();var t=Object.create(s.prototype);t.s=r<0?-1:1;var n=o(r=r<0?-r:r,e);return t.n=r/n,t.d=e/n,t}function u(r){for(var e={},t=r,n=2,i=4;i<=t;){for(;t%n==0;)t/=n,e[n]=(e[n]||0)+1;i+=1+2*n++}return t!==r?t>1&&(e[t]=(e[t]||0)+1):e[r]=(e[r]||0)+1,e}var a=function(r,e){var i,u=0,a=1,o=1,s=0,h=0,p=0,m=1,v=1,d=0,g=1,y=1,b=1;if(null==r);else if(void 0!==e){if(o=(u=r)*(a=e),u%1!=0||a%1!=0)throw l()}else switch(typeof r){case"object":if("d"in r&&"n"in r)u=r.n,a=r.d,"s"in r&&(u*=r.s);else if(0 in r)u=r[0],1 in r&&(a=r[1]);else throw c();o=u*a;break;case"number":if(r<0&&(o=r,r=-r),r%1==0)u=r;else if(r>0){for(r>=1&&(v=Math.pow(10,Math.floor(1+Math.log(r)/Math.LN10)),r/=v);g<=1e7&&b<=1e7;){if(r===(i=(d+y)/(g+b))){g+b<=1e7?(u=d+y,a=g+b):b>g?(u=y,a=b):(u=d,a=g);break}r>i?(d+=y,g+=b):(y+=d,b+=g),g>1e7?(u=y,a=b):(u=d,a=g)}u*=v}else(isNaN(r)||isNaN(e))&&(a=u=NaN);break;case"string":if(null===(g=r.match(/\d+|./g)))throw c();if("-"===g[d]?(o=-1,d++):"+"===g[d]&&d++,g.length===d+1?h=n(g[d++],o):"."===g[d+1]||"."===g[d]?("."!==g[d]&&(s=n(g[d++],o)),(++d+1===g.length||"("===g[d+1]&&")"===g[d+3]||"'"===g[d+1]&&"'"===g[d+3])&&(h=n(g[d],o),m=Math.pow(10,g[d].length),d++),("("===g[d]&&")"===g[d+2]||"'"===g[d]&&"'"===g[d+2])&&(p=n(g[d+1],o),v=Math.pow(10,g[d+1].length)-1,d+=3)):"/"===g[d+1]||":"===g[d+1]?(h=n(g[d],o),m=n(g[d+2],1),d+=3):"/"===g[d+3]&&" "===g[d+1]&&(s=n(g[d],o),h=n(g[d+2],o),m=n(g[d+4],1),d+=5),g.length<=d){o=u=p+(a=m*v)*s+v*h;break}default:throw c()}if(0===a)throw f();t.s=o<0?-1:1,t.n=Math.abs(u),t.d=Math.abs(a)};function o(r,e){if(!r)return e;if(!e)return r;for(;;){if(!(r%=e))return e;if(!(e%=r))return r}}function s(r,e){if(a(r,e),!(this instanceof s))return i(t.s*t.n,t.d);r=o(t.d,t.n),this.s=t.s,this.n=t.n/r,this.d=t.d/r}var f=function(){return Error("Division by Zero")},c=function(){return Error("Invalid argument")},l=function(){return Error("Parameters must be integer")};s.prototype={s:1,n:0,d:1,abs:function(){return i(this.n,this.d)},neg:function(){return i(-this.s*this.n,this.d)},add:function(r,e){return a(r,e),i(this.s*this.n*t.d+t.s*this.d*t.n,this.d*t.d)},sub:function(r,e){return a(r,e),i(this.s*this.n*t.d-t.s*this.d*t.n,this.d*t.d)},mul:function(r,e){return a(r,e),i(this.s*t.s*this.n*t.n,this.d*t.d)},div:function(r,e){return a(r,e),i(this.s*t.s*this.n*t.d,this.d*t.n)},clone:function(){return i(this.s*this.n,this.d)},mod:function(r,e){if(isNaN(this.n)||isNaN(this.d))return new s(NaN);if(void 0===r)return i(this.s*this.n%this.d,1);if(a(r,e),0===t.n&&0===this.d)throw f();return i(this.s*(t.d*this.n)%(t.n*this.d),t.d*this.d)},gcd:function(r,e){return a(r,e),i(o(t.n,this.n)*o(t.d,this.d),t.d*this.d)},lcm:function(r,e){return(a(r,e),0===t.n&&0===this.n)?i(0,1):i(t.n*this.n,o(t.n,this.n)*o(t.d,this.d))},ceil:function(r){return(r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d))?new s(NaN):i(Math.ceil(r*this.s*this.n/this.d),r)},floor:function(r){return(r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d))?new s(NaN):i(Math.floor(r*this.s*this.n/this.d),r)},round:function(r){return(r=Math.pow(10,r||0),isNaN(this.n)||isNaN(this.d))?new s(NaN):i(Math.round(r*this.s*this.n/this.d),r)},inverse:function(){return i(this.s*this.d,this.n)},pow:function(r,e){if(a(r,e),1===t.d)if(t.s<0)return i(Math.pow(this.s*this.d,t.n),Math.pow(this.n,t.n));else return i(Math.pow(this.s*this.n,t.n),Math.pow(this.d,t.n));if(this.s<0)return null;var n=u(this.n),o=u(this.d),s=1,f=1;for(var c in n)if("1"!==c){if("0"===c){s=0;break}if(n[c]*=t.n,n[c]%t.d!=0)return null;n[c]/=t.d,s*=Math.pow(c,n[c])}for(var c in o)if("1"!==c){if(o[c]*=t.n,o[c]%t.d!=0)return null;o[c]/=t.d,f*=Math.pow(c,o[c])}return t.s<0?i(f,s):i(s,f)},equals:function(r,e){return a(r,e),this.s*this.n*t.d==t.s*t.n*this.d},compare:function(r,e){a(r,e);var n=this.s*this.n*t.d-t.s*t.n*this.d;return(0<n)-(n<0)},simplify:function(r){if(isNaN(this.n)||isNaN(this.d))return this;r=r||.001;for(var e=this.abs(),t=e.toContinued(),n=1;n<t.length;n++){for(var u=i(t[n-1],1),a=n-2;a>=0;
1a--)u=u.inverse().add(t[a]);if(Math.abs(u.sub(e).valueOf())<r)return u.mul(this.s)}return this},divisible:function(r,e){return a(r,e),!(!(t.n*this.d)||this.n*t.d%(t.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,t+=" ",n%=i),t+=n,t+="/",t+=i),t},toLatex:function(r){var e,t="",n=this.n,i=this.d;return this.s<0&&(t+="-"),1===i?t+=n:(r&&(e=Math.floor(n/i))>0&&(t+=e,n%=i),t+="\\frac{",t+=n,t+="}{",t+=i,t+="}"),t},toContinued:function(){var r,e=this.n,t=this.d,n=[];if(isNaN(e)||isNaN(t))return n;do n.push(Math.floor(e/t)),r=e%t,e=t,t=r;while(1!==e);return n},toString:function(r){var e=this.n,t=this.d;if(isNaN(e)||isNaN(t))return"NaN";r=r||15;var n=function(r,e){for(;e%2==0;e/=2);for(;e%5==0;e/=5);if(1===e)return 0;for(var t=10%e,n=1;1!==t;n++)if(t=10*t%e,n>2e3)return 0;return n}(0,t),i=function(r,e,t){for(var n=1,i=function(r,e,t){for(var n=1;e>0;r=r*r%t,e>>=1)1&e&&(n=n*r%t);return n}(10,t,e),u=0;u<300;u++){if(n===i)return u;n=10*n%e,i=10*i%e}return 0}(0,t,n),u=this.s<0?"-":"";if(u+=e/t|0,e%=t,(e*=10)&&(u+="."),n){for(var a=i;a--;)u+=e/t|0,e%=t,e*=10;u+="(";for(var a=n;a--;)u+=e/t|0,e%=t,e*=10;u+=")"}else for(var a=r;e&&a--;)u+=e/t|0,e%=t,e*=10;return u}},Object.defineProperty(s,"__esModule",{value:!0}),s.default=s,s.Fraction=s,r.exports=s}(0)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.