squiggle/packages/squiggle-lang/dist/index.js
2022-02-01 14:05:26 -05:00

1368 lines
1.0 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Tpli":[function(require,module,exports) {
"use strict";function r(r,n,t){for(var o=new Array(t),e=0,u=n;e<t;)o[e]=r[u],e=e+1|0,u=u+1|0;return o}function n(r,n){for(;;){var t=n,o=r;if(!t)return o;n=t.tl,r=t.hd.length+o|0}}function t(r,n,t){for(;;){var o=t,e=n;if(!o)return;for(var u=o.hd,f=u.length,i=e,a=0;a<f;)r[i]=u[a],i=i+1|0,a=a+1|0;t=o.tl,n=i}}function o(r){var o=n(0,r),e=new Array(o);return t(e,0,r),e}function e(r,n,t){if(n<0||n>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"index out of bounds",Error:new Error};r[n]=t}function u(r,n){if(n<0||n>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"index out of bounds",Error:new Error};return r[n]}function f(r,n){for(var t=new Array(r),o=0;o<r;++o)t[o]=n;return t}function i(r){for(var n=new Array(r),t=0;t<r;++t)n[t]=0;return n}function a(r,n,t,o,e){if(o<=n)for(var u=0;u<e;++u)t[u+o|0]=r[u+n|0];else for(var f=e-1|0;f>=0;--f)t[f+o|0]=r[f+n|0]}function s(r){return r.slice(0)}exports.dup=s,exports.sub=r,exports.concat=o,exports.make=f,exports.make_float=i,exports.blit=a,exports.get=u,exports.set=e;
},{}],"NSLD":[function(require,module,exports) {
"use strict";var r=require("./caml_array.js");function n(e,t){for(;;){var u=t,c=e,s=c.length,a=0===s?1:s,i=a-u.length|0;if(0===i)return c.apply(null,u);if(i>=0)return function(r,e){return function(t){return n(r,e.concat([t]))}}(c,u);t=r.sub(u,a,0|-i),e=c.apply(null,r.sub(u,0,a))}}function e(r,e){var t=r.length;if(1===t)return r(e);switch(t){case 1:return r(e);case 2:return function(n){return r(e,n)};case 3:return function(n,t){return r(e,n,t)};case 4:return function(n,t,u){return r(e,n,t,u)};case 5:return function(n,t,u,c){return r(e,n,t,u,c)};case 6:return function(n,t,u,c,s){return r(e,n,t,u,c,s)};case 7:return function(n,t,u,c,s,a){return r(e,n,t,u,c,s,a)};default:return n(r,[e])}}function t(r){return 1===r.length?r:function(n){return e(r,n)}}function u(r,e,t){var u=r.length;if(2===u)return r(e,t);switch(u){case 1:return n(r(e),[t]);case 2:return r(e,t);case 3:return function(n){return r(e,t,n)};case 4:return function(n,u){return r(e,t,n,u)};case 5:return function(n,u,c){return r(e,t,n,u,c)};case 6:return function(n,u,c,s){return r(e,t,n,u,c,s)};case 7:return function(n,u,c,s,a){return r(e,t,n,u,c,s,a)};default:return n(r,[e,t])}}function c(r){return 2===r.length?r:function(n,e){return u(r,n,e)}}function s(r,e,t,u){var c=r.length;if(3===c)return r(e,t,u);switch(c){case 1:return n(r(e),[t,u]);case 2:return n(r(e,t),[u]);case 3:return r(e,t,u);case 4:return function(n){return r(e,t,u,n)};case 5:return function(n,c){return r(e,t,u,n,c)};case 6:return function(n,c,s){return r(e,t,u,n,c,s)};case 7:return function(n,c,s,a){return r(e,t,u,n,c,s,a)};default:return n(r,[e,t,u])}}function a(r){return 3===r.length?r:function(n,e,t){return s(r,n,e,t)}}function i(r,e,t,u,c){var s=r.length;if(4===s)return r(e,t,u,c);switch(s){case 1:return n(r(e),[t,u,c]);case 2:return n(r(e,t),[u,c]);case 3:return n(r(e,t,u),[c]);case 4:return r(e,t,u,c);case 5:return function(n){return r(e,t,u,c,n)};case 6:return function(n,s){return r(e,t,u,c,n,s)};case 7:return function(n,s,a){return r(e,t,u,c,n,s,a)};default:return n(r,[e,t,u,c])}}function f(r){return 4===r.length?r:function(n,e,t,u){return i(r,n,e,t,u)}}function o(r,e,t,u,c,s){var a=r.length;if(5===a)return r(e,t,u,c,s);switch(a){case 1:return n(r(e),[t,u,c,s]);case 2:return n(r(e,t),[u,c,s]);case 3:return n(r(e,t,u),[c,s]);case 4:return n(r(e,t,u,c),[s]);case 5:return r(e,t,u,c,s);case 6:return function(n){return r(e,t,u,c,s,n)};case 7:return function(n,a){return r(e,t,u,c,s,n,a)};default:return n(r,[e,t,u,c,s])}}function l(r){return 5===r.length?r:function(n,e,t,u,c){return o(r,n,e,t,u,c)}}function h(r,e,t,u,c,s,a){var i=r.length;if(6===i)return r(e,t,u,c,s,a);switch(i){case 1:return n(r(e),[t,u,c,s,a]);case 2:return n(r(e,t),[u,c,s,a]);case 3:return n(r(e,t,u),[c,s,a]);case 4:return n(r(e,t,u,c),[s,a]);case 5:return n(r(e,t,u,c,s),[a]);case 6:return r(e,t,u,c,s,a);case 7:return function(n){return r(e,t,u,c,s,a,n)};default:return n(r,[e,t,u,c,s,a])}}function _(r){return 6===r.length?r:function(n,e,t,u,c,s){return h(r,n,e,t,u,c,s)}}function p(r,e,t,u,c,s,a,i){var f=r.length;if(7===f)return r(e,t,u,c,s,a,i);switch(f){case 1:return n(r(e),[t,u,c,s,a,i]);case 2:return n(r(e,t),[u,c,s,a,i]);case 3:return n(r(e,t,u),[c,s,a,i]);case 4:return n(r(e,t,u,c),[s,a,i]);case 5:return n(r(e,t,u,c,s),[a,i]);case 6:return n(r(e,t,u,c,s,a),[i]);case 7:return r(e,t,u,c,s,a,i);default:return n(r,[e,t,u,c,s,a,i])}}function g(r){return 7===r.length?r:function(n,e,t,u,c,s,a){return p(r,n,e,t,u,c,s,a)}}function x(r,e,t,u,c,s,a,i,f){var o=r.length;if(8===o)return r(e,t,u,c,s,a,i,f);switch(o){case 1:return n(r(e),[t,u,c,s,a,i,f]);case 2:return n(r(e,t),[u,c,s,a,i,f]);case 3:return n(r(e,t,u),[c,s,a,i,f]);case 4:return n(r(e,t,u,c),[s,a,i,f]);case 5:return n(r(e,t,u,c,s),[a,i,f]);case 6:return n(r(e,t,u,c,s,a),[i,f]);case 7:return n(r(e,t,u,c,s,a,i),[f]);default:return n(r,[e,t,u,c,s,a,i,f])}}function v(r){return 8===r.length?r:function(n,e,t,u,c,s,a,i){return x(r,n,e,t,u,c,s,a,i)}}exports.app=n,exports._1=e,exports.__1=t,exports._2=u,exports.__2=c,exports._3=s,exports.__3=a,exports._4=i,exports.__4=f,exports._5=o,exports.__5=l,exports._6=h,exports.__6=_,exports._7=p,exports.__7=g,exports._8=x,exports.__8=v;
},{"./caml_array.js":"Tpli"}],"gGFE":[function(require,module,exports) {
"use strict";function n(n,t){return n<t?-1:n===t?0:1}function t(n,t){return n?t?0:1:t?-1:0}function r(n,t){return n===t?0:n<t?-1:n>t||n==n?1:t==t?-1:0}function o(n,t){return n===t?0:n<t?-1:1}function e(n,t){return n?t:n}function i(n,t){return n<t?n:t}function u(n,t){return n<t?n:t}function c(n,t){return n<t?n:t}function _(n,t){return n<t?n:t}function m(n,t){return n||t}function a(n,t){return n>t?n:t}function x(n,t){return n>t?n:t}function s(n,t){return n>t?n:t}function p(n,t){return n>t?n:t}function f(n,t){return n[1]===t[1]&&n[0]===t[0]}function l(n,t){var r=t[0],o=n[0];return o>r||!(o<r)&&n[1]>=t[1]}function g(n,t){return!f(n,t)}function b(n,t){return!l(n,t)}function q(n,t){return n[0]>t[0]||!(n[0]<t[0])&&n[1]>t[1]}function v(n,t){return!q(n,t)}function d(n,t){return l(n,t)?t:n}function h(n,t){return q(n,t)?n:t}exports.caml_int_compare=n,exports.caml_bool_compare=t,exports.caml_float_compare=r,exports.caml_string_compare=o,exports.caml_bool_min=e,exports.caml_int_min=i,exports.caml_float_min=u,exports.caml_string_min=c,exports.caml_int32_min=_,exports.caml_bool_max=m,exports.caml_int_max=a,exports.caml_float_max=x,exports.caml_string_max=s,exports.caml_int32_max=p,exports.i64_eq=f,exports.i64_neq=g,exports.i64_lt=b,exports.i64_gt=q,exports.i64_le=v,exports.i64_ge=l,exports.i64_min=d,exports.i64_max=h;
},{}],"p3B5":[function(require,module,exports) {
"use strict";var r=require("./caml.js"),n=function(r,n){for(var e in r)n(e)},e=function(r){if(Array.isArray(r)){for(var n=r.length,e=new Array(n),t=0;t<n;++t)e[t]=r[t];return void 0!==r.TAG&&(e.TAG=r.TAG),e}return Object.assign({},r)},t=function(r,n){if(Array.isArray(n)){for(e=0;e<n.length;++e)r[e]=n[e];void 0!==n.TAG&&(r.TAG=n.TAG)}else for(var e in n)r[e]=n[e]};function a(n,e){if(n===e)return 0;var t=typeof n,o=typeof e;switch(t){case"boolean":if("boolean"===o)return r.caml_bool_compare(n,e);break;case"function":if("function"===o)throw{RE_EXN_ID:"Invalid_argument",_1:"compare: functional value",Error:new Error};break;case"number":if("number"===o)return r.caml_int_compare(n,e);break;case"string":return"string"===o?r.caml_string_compare(n,e):1;case"undefined":return-1}switch(o){case"string":return-1;case"undefined":return 1;default:if("boolean"===t)return 1;if("boolean"===o)return-1;if("function"===t)return 1;if("function"===o)return-1;if("number"===t)return null===e||void 0!==e.BS_PRIVATE_NESTED_SOME_NONE?1:-1;if("number"===o)return null===n||void 0!==n.BS_PRIVATE_NESTED_SOME_NONE?-1:1;if(null===n)return void 0!==e.BS_PRIVATE_NESTED_SOME_NONE?1:-1;if(null===e)return void 0!==n.BS_PRIVATE_NESTED_SOME_NONE?-1:1;if(void 0!==n.BS_PRIVATE_NESTED_SOME_NONE)return void 0!==e.BS_PRIVATE_NESTED_SOME_NONE?u(n,e):-1;var i=0|n.TAG,f=0|e.TAG;if(248===i)return r.caml_int_compare(n[1],e[1]);if(251===i)throw{RE_EXN_ID:"Invalid_argument",_1:"equal: abstract value",Error:new Error};if(i!==f)return i<f?-1:1;var c=0|n.length,l=0|e.length;if(c===l){if(!Array.isArray(n))return n instanceof Date&&e instanceof Date?n-e:u(n,e);for(var _=0;;){var s=_;if(s===c)return 0;var v=a(n[s],e[s]);if(0!==v)return v;_=s+1|0}}else if(c<l)for(var E=0;;){var m=E;if(m===c)return-1;var d=a(n[m],e[m]);if(0!==d)return d;E=m+1|0}else for(var p=0;;){var A=p;if(A===l)return 1;var N=a(n[A],e[A]);if(0!==N)return N;p=A+1|0}}}function u(e,t){var u={contents:void 0},o={contents:void 0},i=function(r,n){var e=r[2],t=r[1];if(!t.hasOwnProperty(n)||a(r[0][n],t[n])>0){var u=e.contents;return void 0!==u&&n>=u?void 0:void(e.contents=n)}},f=[e,t,o],c=[t,e,u];n(e,function(r){return i(f,r)}),n(t,function(r){return i(c,r)});var l=u.contents,_=o.contents;return void 0!==l?void 0!==_?r.caml_string_compare(l,_):-1:void 0!==_?1:0}function o(r,e){if(r===e)return!0;var t=typeof r;if("string"===t||"number"===t||"boolean"===t||"undefined"===t||null===r)return!1;var a=typeof e;if("function"===t||"function"===a)throw{RE_EXN_ID:"Invalid_argument",_1:"equal: functional value",Error:new Error};if("number"===a||"undefined"===a||null===e)return!1;var u=0|r.TAG,i=0|e.TAG;if(248===u)return r[1]===e[1];if(251===u)throw{RE_EXN_ID:"Invalid_argument",_1:"equal: abstract value",Error:new Error};if(u!==i)return!1;var f=0|r.length;if(f!==(0|e.length))return!1;if(!Array.isArray(r)){if(r instanceof Date&&e instanceof Date)return!(r>e||r<e);var c={contents:!0};return n(r,function(r){e.hasOwnProperty(r)||(c.contents=!1)}),c.contents&&n(e,function(n){r.hasOwnProperty(n)&&o(e[n],r[n])||(c.contents=!1)}),c.contents}for(var l=0;;){var _=l;if(_===f)return!0;if(!o(r[_],e[_]))return!1;l=_+1|0}}function i(r,n){return null!==n?o(r,n):r===n}function f(r,n){return void 0!==n?o(r,n):r===n}function c(r,n){return null==n?r===n:o(r,n)}function l(r,n){return!o(r,n)}function _(r,n){return a(r,n)>=0}function s(r,n){return a(r,n)>0}function v(r,n){return a(r,n)<=0}function E(r,n){return a(r,n)<0}function m(r,n){return a(r,n)<=0?r:n}function d(r,n){return a(r,n)>=0?r:n}exports.caml_obj_dup=e,exports.update_dummy=t,exports.caml_compare=a,exports.caml_equal=o,exports.caml_equal_null=i,exports.caml_equal_undefined=f,exports.caml_equal_nullable=c,exports.caml_notequal=l,exports.caml_greaterequal=_,exports.caml_greaterthan=s,exports.caml_lessthan=E,exports.caml_lessequal=v,exports.caml_min=m,exports.caml_max=d;
},{"./caml.js":"gGFE"}],"RiV8":[function(require,module,exports) {
"use strict";var t={contents:0};function n(n){return t.contents=t.contents+1|0,n+"/"+t.contents}function e(t){return null!=t&&"string"==typeof t.RE_EXN_ID}function o(t){return t.RE_EXN_ID}exports.id=t,exports.create=n,exports.caml_is_extension=e,exports.caml_exn_slot_name=o;
},{}],"dzFO":[function(require,module,exports) {
"use strict";function o(o){return void 0!==o.BS_PRIVATE_NESTED_SOME_NONE}function E(o){return void 0===o?{BS_PRIVATE_NESTED_SOME_NONE:0}:null!==o&&void 0!==o.BS_PRIVATE_NESTED_SOME_NONE?{BS_PRIVATE_NESTED_SOME_NONE:o.BS_PRIVATE_NESTED_SOME_NONE+1|0}:o}function _(o){return null==o?void 0:E(o)}function t(o){return void 0===o?void 0:E(o)}function n(o){return null===o?void 0:E(o)}function r(o){if(null===o||void 0===o.BS_PRIVATE_NESTED_SOME_NONE)return o;var E=o.BS_PRIVATE_NESTED_SOME_NONE;return 0===E?void 0:{BS_PRIVATE_NESTED_SOME_NONE:E-1|0}}function i(o){return void 0===o?void 0:r(o)}function u(o){return void 0!==o?o.VAL:o}exports.nullable_to_opt=_,exports.undefined_to_opt=t,exports.null_to_opt=n,exports.valFromOption=r,exports.some=E,exports.isNested=o,exports.option_get=i,exports.option_unwrap=u;
},{}],"yO2E":[function(require,module,exports) {
"use strict";var e=require("./caml_option.js"),r=require("./caml_exceptions.js"),t=r.create("Caml_js_exceptions.Error");function n(e){return r.caml_is_extension(e)?e:{RE_EXN_ID:t,_1:e}}function o(r){if(r.RE_EXN_ID===t)return e.some(r._1)}exports.$$Error=t,exports.internalToOCamlException=n,exports.caml_as_js_exn=o;
},{"./caml_option.js":"dzFO","./caml_exceptions.js":"RiV8"}],"d4B1":[function(require,module,exports) {
"use strict";var r=require("./curry.js"),t=require("./caml_obj.js"),e=require("./caml_array.js"),n=require("./caml_exceptions.js"),o=require("./caml_js_exceptions.js"),a=e.make_float,i={};function f(t,n){if(0===t)return[];if(t<0)throw{RE_EXN_ID:"Invalid_argument",_1:"Array.init",Error:new Error};for(var o=e.make(t,r._1(n,0)),a=1;a<t;++a)o[a]=r._1(n,a);return o}function u(r,t,n){for(var o=e.make(r,[]),a=0;a<r;++a)o[a]=e.make(t,n);return o}function _(r){var t=r.length;return 0===t?[]:e.sub(r,0,t)}function s(r,t){var n=r.length;return 0===n?_(t):0===t.length?e.sub(r,0,n):r.concat(t)}function l(r,t,n){if(t<0||n<0||t>(r.length-n|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Array.sub",Error:new Error};return e.sub(r,t,n)}function v(r,t,e,n){if(t<0||e<0||t>(r.length-e|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Array.fill",Error:new Error};for(var o=t,a=t+e|0;o<a;++o)r[o]=n}function g(r,t,n,o,a){if(a<0||t<0||t>(r.length-a|0)||o<0||o>(n.length-a|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Array.blit",Error:new Error};return e.blit(r,t,n,o,a)}function c(t,e){for(var n=0,o=e.length;n<o;++n)r._1(t,e[n])}function h(t,e,n){if(e.length!==n.length)throw{RE_EXN_ID:"Invalid_argument",_1:"Array.iter2: arrays must have the same length",Error:new Error};for(var o=0,a=e.length;o<a;++o)r._2(t,e[o],n[o])}function m(t,n){var o=n.length;if(0===o)return[];for(var a=e.make(o,r._1(t,n[0])),i=1;i<o;++i)a[i]=r._1(t,n[i]);return a}function p(t,n,o){var a=n.length;if(a!==o.length)throw{RE_EXN_ID:"Invalid_argument",_1:"Array.map2: arrays must have the same length",Error:new Error};if(0===a)return[];for(var i=e.make(a,r._2(t,n[0],o[0])),f=1;f<a;++f)i[f]=r._2(t,n[f],o[f]);return i}function E(t,e){for(var n=0,o=e.length;n<o;++n)r._2(t,n,e[n])}function x(t,n){var o=n.length;if(0===o)return[];for(var a=e.make(o,r._2(t,0,n[0])),i=1;i<o;++i)a[i]=r._2(t,i,n[i]);return a}function w(r){for(var t=r.length-1|0,e=0;;){var n=e,o=t;if(o<0)return n;e={hd:r[o],tl:n},t=o-1|0}}function y(r,t){for(;;){var e=r;if(!t)return e;t=t.tl,r=e+1|0}}function I(r){if(!r)return[];for(var t=e.make(y(0,r),r.hd),n=1,o=r.tl;;){var a=o,i=n;if(!a)return t;t[i]=a.hd,o=a.tl,n=i+1|0}}function d(t,e,n){for(var o=e,a=0,i=n.length;a<i;++a)o=r._2(t,o,n[a]);return o}function k(t,e,n){for(var o=n,a=e.length-1|0;a>=0;--a)o=r._2(t,e[a],o);return o}function b(t,e){for(var n=e.length,o=0;;){var a=o;if(a===n)return!1;if(r._1(t,e[a]))return!0;o=a+1|0}}function D(t,e){for(var n=e.length,o=0;;){var a=o;if(a===n)return!0;if(!r._1(t,e[a]))return!1;o=a+1|0}}function N(r,e){for(var n=e.length,o=0;;){var a=o;if(a===n)return!1;if(t.caml_equal(e[a],r))return!0;o=a+1|0}}function R(r,t){for(var e=t.length,n=0;;){var o=n;if(o===e)return!1;if(r===t[o])return!0;n=o+1|0}}var X=n.create("Array.Bottom");function A(t,n){for(var a=function(o,a){var i=1+((a+a|0)+a|0)|0,f=i;if((i+2|0)<o)return r._2(t,e.get(n,i),e.get(n,i+1|0))<0&&(f=i+1|0),r._2(t,e.get(n,f),e.get(n,i+2|0))<0&&(f=i+2|0),f;if((i+1|0)<o&&r._2(t,e.get(n,i),e.get(n,i+1|0))<0)return i+1|0;if(i<o)return i;throw{RE_EXN_ID:X,_1:a,Error:new Error}},i=function(i,f,u){try{for(var _=f;;){var s=_,l=a(i,s);if(r._2(t,e.get(n,l),u)<=0)return e.set(n,s,u);e.set(n,s,e.get(n,l)),_=l}}catch(g){var v=o.internalToOCamlException(g);if(v.RE_EXN_ID===X)return e.set(n,v._1,u);throw v}},f=function(r,t){try{for(var i=t;;){var f=i,u=a(r,f);e.set(n,f,e.get(n,u)),i=u}}catch(s){var _=o.internalToOCamlException(s);if(_.RE_EXN_ID===X)return _._1;throw _}},u=function(o,a){for(;;){var i=o,f=(i-1|0)/3|0;if(i===f)throw{RE_EXN_ID:"Assert_failure",_1:["array.ml",238,4],Error:new Error};if(r._2(t,e.get(n,f),a)>=0)return e.set(n,i,a);if(e.set(n,i,e.get(n,f)),f<=0)return e.set(n,0,a);o=f}},_=n.length,s=((_+1|0)/3|0)-1|0;s>=0;--s)i(_,s,e.get(n,s));for(var l=_-1|0;l>=2;--l){var v=e.get(n,l);e.set(n,l,e.get(n,0)),u(f(l,0),v)}if(!(_<=1)){var g=e.get(n,1);return e.set(n,1,e.get(n,0)),e.set(n,0,g)}}function j(t,n){var o=function(o,a,i,f,u,_,s){for(var l=o+a|0,v=f+u|0,c=o,h=e.get(n,o),m=f,p=e.get(i,f),E=s;;){var x=E,w=p,y=m,I=h,d=c;if(r._2(t,I,w)<=0){e.set(_,x,I);var k=d+1|0;if(k>=l)return g(i,y,_,x+1|0,v-y|0);E=x+1|0,h=e.get(n,k),c=k}else{e.set(_,x,w);var b=y+1|0;if(b>=v)return g(n,d,_,x+1|0,l-d|0);E=x+1|0,p=e.get(i,b),m=b}}},a=function(o,a,i,f){for(var u=0;u<f;++u){for(var _=e.get(n,o+u|0),s=(i+u|0)-1|0;s>=i&&r._2(t,e.get(a,s),_)>0;)e.set(a,s+1|0,e.get(a,s)),s=s-1|0;e.set(a,s+1|0,_)}},i=function(r,t,e,f){if(f<=5)return a(r,t,e,f);var u=f/2|0,_=f-u|0;return i(r+u|0,t,e+u|0,_),i(r,n,r+_|0,u),o(r+_|0,u,t,e+u|0,_,t,e)},f=n.length;if(f<=5)return a(0,n,0,f);var u=f/2|0,_=f-u|0,s=e.make(_,e.get(n,0));return i(u,s,0,_),i(0,n,_,u),o(_,u,s,0,_,n,0)}var q=u,C=e.concat,O=j;exports.make_float=a,exports.init=f,exports.make_matrix=u,exports.create_matrix=q,exports.append=s,exports.concat=C,exports.sub=l,exports.copy=_,exports.fill=v,exports.blit=g,exports.to_list=w,exports.of_list=I,exports.iter=c,exports.iteri=E,exports.map=m,exports.mapi=x,exports.fold_left=d,exports.fold_right=k,exports.iter2=h,exports.map2=p,exports.for_all=D,exports.exists=b,exports.mem=N,exports.memq=R,exports.sort=A,exports.stable_sort=j,exports.fast_sort=O,exports.Floatarray=i;
},{"./curry.js":"NSLD","./caml_obj.js":"p3B5","./caml_array.js":"Tpli","./caml_exceptions.js":"RiV8","./caml_js_exceptions.js":"yO2E"}],"rH1J":[function(require,module,exports) {
var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
},{}],"bJMn":[function(require,module,exports) {
var process = require("process");
var t,e=require("process"),r={buffer:"",output:function(t,r){var o=r.length-1|0;return void 0!==e&&e.stdout&&e.stdout.write?e.stdout.write(r):void("\n"===r[o]?console.log(r.slice(0,o)):console.log(r))}},o={buffer:"",output:function(t,e){var r=e.length-1|0;"\n"===e[r]?console.log(e.slice(0,r)):console.log(e)}};function u(t){if(""!==t.buffer)return t.output(t,t.buffer),void(t.buffer="")}function f(t,o,f,n){var s=0===f&&n===o.length?o:o.slice(f,n);if(void 0!==e&&e.stdout&&e.stdout.write&&t===r)return e.stdout.write(s);var l=s.lastIndexOf("\n");l<0?t.buffer=t.buffer+s:(t.buffer=t.buffer+s.slice(0,l+1|0),u(t),t.buffer=t.buffer+s.slice(l+1|0))}function n(t,e){return f(t,String.fromCharCode(e),0,1)}function s(t){return{hd:r,tl:{hd:o,tl:0}}}exports.stdin=t,exports.stdout=r,exports.stderr=o,exports.caml_ml_flush=u,exports.caml_ml_output=f,exports.caml_ml_output_char=n,exports.caml_ml_out_channels_list=s;
},{"process":"rH1J"}],"Juhd":[function(require,module,exports) {
var process = require("process");
var r=require("process");function o(o){if(void 0===r||void 0===r.env)throw{RE_EXN_ID:"Not_found",Error:new Error};var e=r.env[o];if(void 0!==e)return e;throw{RE_EXN_ID:"Not_found",Error:new Error}}var e=function(o){return void 0!==r&&"win32"===r.platform?"Win32":"Unix"};function t(o){return void 0===r||void 0===r.uptime?-1:r.uptime()}function i(r){return 127}var n=function(o){return void 0===r||void 0===r.cwd?"/":r.cwd()};function s(o){if(void 0===r)return["",[""]];var e=r.argv;return null==e?["",[""]]:[e[0],e]}function _(o){if(void 0!==r)return r.exit(o)}function c(r){throw{RE_EXN_ID:"Failure",_1:"caml_sys_is_directory not implemented",Error:new Error}}function u(r){throw{RE_EXN_ID:"Failure",_1:"caml_sys_file_exists not implemented",Error:new Error}}exports.caml_sys_getenv=o,exports.caml_sys_time=t,exports.os_type=e,exports.caml_sys_system_command=i,exports.caml_sys_getcwd=n,exports.caml_sys_get_argv=s,exports.caml_sys_exit=_,exports.caml_sys_is_directory=c,exports.caml_sys_file_exists=u;
},{"process":"rH1J"}],"gmRG":[function(require,module,exports) {
"use strict";function r(r,t,e){if(t<0||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"index out of bounds",Error:new Error};r[t]=e}function t(r,t){if(t<0||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"index out of bounds",Error:new Error};return r[t]}function e(r,t,e,n){if(!(e<=0))for(var o=t,a=e+t|0;o<a;++o)r[o]=n}function n(r){if(r<0)throw{RE_EXN_ID:"Invalid_argument",_1:"String.create",Error:new Error};for(var t=new Array(r),e=0;e<r;++e)t[e]=0;return t}function o(r,t,e,n,o){if(!(o<=0))if(r!==e){var a=r.length-t|0;if(o<=a)for(var f=0;f<o;++f)e[n+f|0]=r[t+f|0];else{for(var i=0;i<a;++i)e[n+i|0]=r[t+i|0];for(var u=a;u<o;++u)e[n+u|0]=0}}else{if(t<n){for(var l=(r.length-n|0)-1|0,s=o-1|0,_=l>s?s:l;_>=0;--_)r[n+_|0]=r[t+_|0];return}if(t<=n)return;for(var c=(r.length-t|0)-1|0,g=o-1|0,v=c>g?g:c,h=0;h<=v;++h)r[n+h|0]=r[t+h|0]}}function a(r){var t=r.length,e="",n=t;if(t<=4096&&t===r.length)return String.fromCharCode.apply(null,r);for(var o=0;n>0;){for(var a=n<1024?n:1024,f=new Array(a),i=0;i<a;++i)f[i]=r[i+o|0];e+=String.fromCharCode.apply(null,f),n=n-a|0,o=o+a|0}return e}function f(r,t,e,n,o){if(!(o<=0)){var a=r.length-t|0;if(o<=a)for(var f=0;f<o;++f)e[n+f|0]=r.charCodeAt(t+f|0);else{for(var i=0;i<a;++i)e[n+i|0]=r.charCodeAt(t+i|0);for(var u=a;u<o;++u)e[n+u|0]=0}}}function i(r){for(var t=r.length,e=new Array(t),n=0;n<t;++n)e[n]=r.charCodeAt(n);return e}function u(r,t,e,n,o){for(;;){var a=e;if(a>=n)return o;var f=r[a],i=t[a];if(f>i)return 1;if(f<i)return-1;e=a+1|0}}function l(r,t){var e=r.length,n=t.length;return e===n?u(r,t,0,e,0):e<n?u(r,t,0,e,-1):u(r,t,0,n,1)}function s(r,t){var e=r.length;if(e!==t.length)return!1;for(var n=0;;){var o=n;if(o===e)return!0;if(r[o]!==t[o])return!1;n=o+1|0}}function _(r,t){return l(r,t)>0}function c(r,t){return l(r,t)>=0}function g(r,t){return l(r,t)<0}function v(r,t){return l(r,t)<=0}exports.caml_create_bytes=n,exports.caml_fill_bytes=e,exports.get=t,exports.set=r,exports.bytes_to_string=a,exports.caml_blit_bytes=o,exports.caml_blit_string=f,exports.bytes_of_string=i,exports.caml_bytes_compare=l,exports.caml_bytes_greaterthan=_,exports.caml_bytes_greaterequal=c,exports.caml_bytes_lessthan=g,exports.caml_bytes_lessequal=v,exports.caml_bytes_equal=s;
},{}],"Phox":[function(require,module,exports) {
"use strict";var r=require("./caml.js");function t(r,t){return[t,r>>>0]}var n=[-2147483648,0],e=[2147483647,4294967295],i=[0,1],o=[0,0],u=[-1,4294967295];function f(r){return 0!=(-2147483648&r)}function a(r){return 0==(-2147483648&r)}function s(r){var t=r[1]+1|0;return[r[0]+(0===t?1:0)|0,t>>>0]}function c(r){var t=1+(-1^r[1])|0;return[(-1^r[0])+(0===t?1:0)|0,t>>>0]}function x(r,t,n){var e=r[1],i=e+t|0,o=f(e)&&(f(t)||a(i))||f(t)&&a(i)?1:0;return[r[0]+n+o|0,i>>>0]}function _(r,t){return x(r,t[1],t[0])}function l(t,n){return null!==n&&r.i64_eq(t,n)}function p(t,n){return void 0!==n&&r.i64_eq(t,n)}function v(t,n){return null!=n&&r.i64_eq(t,n)}function d(r,t,n){var e=1+(-1^t)>>>0;return x(r,e,(-1^n)+(0===e?1:0)|0)}function g(r,t){return d(r,t[1],t[0])}function h(r,t){if(0===t)return r;var n=r[1];return t>=32?[n<<(t-32|0),0]:[n>>>(32-t|0)|r[0]<<t,n<<t>>>0]}function q(r,t){if(0===t)return r;var n=r[0],e=t-32|0;return 0===e?[0,n>>>0]:e>0?[0,n>>>e]:[n>>>t,(n<<(0|-e)|r[1]>>>t)>>>0]}function m(r,t){if(0===t)return r;var n=r[0];return t<32?[n>>t,(n<<(32-t|0)|r[1]>>>t)>>>0]:[n>=0?0:-1,n>>(t-32|0)>>>0]}function M(r){return 0===r[0]&&0===r[1]}function b(r,t){for(;;){var e,i=t,u=r,f=u[0],a=0,s=0,x=0;if(0!==f)x=4;else{if(0===u[1])return o;x=4}if(4===x)if(0!==i[0])s=3;else{if(0===i[1])return o;s=3}if(3===s&&(-2147483648!==f||0!==u[1]?a=2:e=i[1]),2===a){var _=i[0],l=u[1],p=0;if(-2147483648!==_||0!==i[1]?p=3:e=l,3===p){var v=i[1];if(f<0){if(_>=0)return c(b(c(u),i));t=c(i),r=c(u);continue}if(_<0)return c(b(u,c(i)));var d=65535&f,g=l>>>16,h=65535&l,q=65535&_,m=v>>>16,M=65535&v,w=0,y=0,A=0,E=h*M;return w=(y=(y=(A=(E>>>16)+g*M)>>>16)+((A=(65535&A)+h*m)>>>16)+d*M)>>>16,w+=(y=(65535&y)+g*m)>>>16,w+=(y=(65535&y)+h*q)>>>16,[(y&=65535)|(w=w+((f>>>16)*M+d*m+g*q+h*(_>>>16))&65535)<<16,(65535&E|(65535&A)<<16)>>>0]}}return 0==(1&e)?o:n}}function w(r,t){return[r[0]^t[0],(r[1]^t[1])>>>0]}function y(r,t){return[r[0]|t[0],(r[1]|t[1])>>>0]}function A(r,t){return[r[0]&t[0],(r[1]&t[1])>>>0]}function E(r){return 4294967296*r[0]+r[1]}function N(r){return isNaN(r)||!isFinite(r)?o:r<=-0x8000000000000000?n:r+1>=0x8000000000000000?e:r<0?c(N(-r)):[r/4294967296|0,(r%4294967296|0)>>>0]}function S(r){var t=r[0],n=t>>21;return 0===n||-1===n&&!(0===r[1]&&-2097152===t)}function z(t){if(S(t))return String(E(t));if(t[0]<0)return r.i64_eq(t,n)?"-9223372036854775808":"-"+z(c(t));var e=N(Math.floor(E(t)/10)),i=e[1],o=e[0],u=d(d(t,i<<3,i>>>29|o<<3),i<<1,i>>>31|o<<1),f=u[1],a=u[0];if(0===f&&0===a)return z(e)+"0";if(a<0){var s=1+(-1^f)>>>0,_=Math.ceil(s/10),l=10*_-s;return z(d(e,0|_,0))+String(0|l)}var p=Math.floor(f/10),v=f-10*p;return z(x(e,0|p,0))+String(0|v)}function F(t,e){for(;;){var f=e,a=t,s=a[0],x=0;if(0===f[0]&&0===f[1])throw{RE_EXN_ID:"Division_by_zero",Error:new Error};if(2===2)if(-2147483648!==s)if(0!==s)x=1;else{if(0===a[1])return o;x=1}else if(0!==a[1])x=1;else{if(r.i64_eq(f,i)||r.i64_eq(f,u))return a;if(r.i64_eq(f,n))return i;var l=h(F(m(a,1),f),1),p=0;if(0!==l[0])p=3;else{if(0===l[1])return f[0]<0?i:c(i);p=3}if(3===p)return _(l,F(g(a,b(f,l)),f))}if(1===x){var v=f[0],d=0;if(-2147483648!==v)d=2;else{if(0===f[1])return o;d=2}if(2===d){if(s<0){if(v>=0)return c(F(c(a),f));e=c(f),t=c(a);continue}if(v<0)return c(F(a,c(f)));for(var q=o,w=a;r.i64_ge(w,f);){for(var y=Math.floor(E(w)/E(f)),A=1>y?1:y,S=Math.ceil(Math.log(A)/Math.LN2),z=S<=48?1:Math.pow(2,S-48),I=N(A),D=b(I,f);D[0]<0||r.i64_gt(D,w);)D=b(I=N(A-=z),f);M(I)&&(I=i),q=_(q,I),w=g(w,D)}return q}}}}function I(r,t){return g(r,b(F(r,t),t))}function D(r,t){var n=F(r,t);return[n,g(r,b(n,t))]}function j(r,t){var n=t[0],e=r[0],i=e<n?-1:e===n?0:1;if(0!==i)return i;var o=t[1],u=r[1];return u<o?-1:u===o?0:1}function k(r){return[r<0?-1:0,r>>>0]}function L(r){return 0|r[1]}function R(r){var t=r[1],n=r[0],e=function(r){return(r>>>0).toString(16)};if(0===n&&0===t)return"0";if(0===t)return e(n)+"00000000";if(0===n)return e(t);var i=e(t),o=8-i.length|0;return o<=0?e(n)+i:e(n)+("0".repeat(o)+i)}function X(r){return[2147483647&r[0],r[1]]}function B(r){return t=r[1],n=r[0],new Float64Array(new Int32Array([t,n]).buffer)[0];var t,n}function C(r){var t=function(r){return new Int32Array(new Float64Array([r]).buffer)}(r);return[t[1],t[0]>>>0]}exports.mk=t,exports.succ=s,exports.min_int=n,exports.max_int=e,exports.one=i,exports.zero=o,exports.neg_one=u,exports.of_int32=k,exports.to_int32=L,exports.add=_,exports.neg=c,exports.sub=g,exports.lsl_=h,exports.lsr_=q,exports.asr_=m,exports.is_zero=M,exports.mul=b,exports.xor=w,exports.or_=y,exports.and_=A,exports.equal_null=l,exports.equal_undefined=p,exports.equal_nullable=v,exports.to_float=E,exports.of_float=N,exports.div=F,exports.mod_=I,exports.compare=j,exports.float_of_bits=B,exports.bits_of_float=C,exports.div_mod=D,exports.to_hex=R,exports.discard_sign=X,exports.to_string=z;
},{"./caml.js":"gGFE"}],"Zve6":[function(require,module,exports) {
"use strict";var e=require("./caml.js"),r=require("./caml_int64.js");function a(e){return e>=65?e>=97?e>=123?-1:e-87|0:e>=91?-1:e-55|0:e>57||e<48?-1:e-48|0}function t(e){switch(e){case 0:return 8;case 1:return 16;case 2:return 10;case 3:return 2}}function i(e){var r=1,a=2,t=0;switch(e.charCodeAt(t)){case 43:t=t+1|0;break;case 44:break;case 45:r=-1,t=t+1|0}if("0"===e[t]){var i=e.charCodeAt(t+1|0);if(i>=89)if(i>=111){if(i<121)switch(i){case 111:a=0,t=t+2|0;break;case 117:t=t+2|0;break;case 112:case 113:case 114:case 115:case 116:case 118:case 119:break;case 120:a=1,t=t+2|0}}else 98===i&&(a=3,t=t+2|0);else if(66!==i){if(i>=79)switch(i){case 79:a=0,t=t+2|0;break;case 85:t=t+2|0;break;case 80:case 81:case 82:case 83:case 84:case 86:case 87:break;case 88:a=1,t=t+2|0}}else a=3,t=t+2|0}return[t,r,a]}function n(e){var r=i(e),n=r[0],s=t(r[2]),c=e.length,o=a(n<c?e.charCodeAt(n):0);if(o<0||o>=s)throw{RE_EXN_ID:"Failure",_1:"int_of_string",Error:new Error};var f=r[1]*function(r,t){for(;;){var i=t,n=r;if(i===c)return n;var o=e.charCodeAt(i);if(95!==o){var f=a(o);if(f<0||f>=s)throw{RE_EXN_ID:"Failure",_1:"int_of_string",Error:new Error};var _=s*n+f;if(_>4294967295)throw{RE_EXN_ID:"Failure",_1:"int_of_string",Error:new Error};t=i+1|0,r=_}else t=i+1|0}}(o,n+1|0),_=0|f;if(10===s&&f!==_)throw{RE_EXN_ID:"Failure",_1:"int_of_string",Error:new Error};return _}function s(n){var s,c=i(n),o=c[2],f=c[0],_=r.of_int32(t(o)),u=r.of_int32(c[1]);switch(o){case 0:s=[536870911,4294967295];break;case 1:s=[268435455,4294967295];break;case 2:s=[429496729,2576980377];break;case 3:s=r.max_int}var l=n.length,v=f<l?n.charCodeAt(f):0,g=r.of_int32(a(v));if(e.i64_lt(g,r.zero)||e.i64_ge(g,_))throw{RE_EXN_ID:"Failure",_1:"int64_of_string",Error:new Error};var d=r.mul(u,function(t,i){for(;;){var c=i,o=t;if(c===l)return o;var f=n.charCodeAt(c);if(95!==f){var u=r.of_int32(a(f));if(e.i64_lt(u,r.zero)||e.i64_ge(u,_)||e.i64_gt(o,s))throw{RE_EXN_ID:"Failure",_1:"int64_of_string",Error:new Error};i=c+1|0,t=r.add(r.mul(_,o),u)}else i=c+1|0}}(g,f+1|0)),h=r.or_(d,r.zero);if(e.i64_eq(_,[0,10])&&e.i64_neq(d,h))throw{RE_EXN_ID:"Failure",_1:"int64_of_string",Error:new Error};return h}function c(e){switch(e){case 0:return 8;case 1:return 16;case 2:return 10}}function o(e){return e>=65&&e<=90||e>=192&&e<=214||e>=216&&e<=222?e+32|0:e}function f(e){var r=e.length;if(r>31)throw{RE_EXN_ID:"Invalid_argument",_1:"format_int: format too long",Error:new Error};for(var a={justify:"+",signstyle:"-",filter:" ",alternate:!1,base:2,signedconv:!1,width:0,uppercase:!1,sign:1,prec:-1,conv:"f"},t=0;;){var i=t;if(i>=r)return a;var n=e.charCodeAt(i),s=0;if(n>=69)if(n>=88)if(n>=121)s=1;else switch(n){case 88:a.base=1,a.uppercase=!0,t=i+1|0;continue;case 101:case 102:case 103:s=5;break;case 100:case 105:s=4;break;case 111:a.base=0,t=i+1|0;continue;case 117:a.base=2,t=i+1|0;continue;case 89:case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:case 104:case 106:case 107:case 108:case 109:case 110:case 112:case 113:case 114:case 115:case 116:case 118:case 119:s=1;break;case 120:a.base=1,t=i+1|0;continue}else{if(!(n>=72)){a.signedconv=!0,a.uppercase=!0,a.conv=String.fromCharCode(o(n)),t=i+1|0;continue}s=1}else switch(n){case 35:a.alternate=!0,t=i+1|0;continue;case 32:case 43:s=2;break;case 45:a.justify="-",t=i+1|0;continue;case 46:a.prec=0;for(var c=i+1|0;function(r){return function(){var a=e.charCodeAt(r)-48|0;return a>=0&&a<=9}}(c)();)a.prec=(Math.imul(a.prec,10)+e.charCodeAt(c)|0)-48|0,c=c+1|0;t=c;continue;case 33:case 34:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 44:case 47:s=1;break;case 48:a.filter="0",t=i+1|0;continue;case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:s=3;break;default:s=1}switch(s){case 1:t=i+1|0;continue;case 2:a.signstyle=String.fromCharCode(n),t=i+1|0;continue;case 3:a.width=0;for(var f=i;function(r){return function(){var a=e.charCodeAt(r)-48|0;return a>=0&&a<=9}}(f)();)a.width=(Math.imul(a.width,10)+e.charCodeAt(f)|0)-48|0,f=f+1|0;t=f;continue;case 4:a.signedconv=!0,a.base=2,t=i+1|0;continue;case 5:a.signedconv=!0,a.conv=String.fromCharCode(n),t=i+1|0;continue}}}function _(e,r){var a=e.justify,t=e.signstyle,i=e.filter,n=e.alternate,s=e.base,c=e.signedconv,o=e.width,f=e.uppercase,_=e.sign,u=r.length;c&&(_<0||"-"!==t)&&(u=u+1|0),n&&(0===s?u=u+1|0:1===s&&(u=u+2|0));var l="";if("+"===a&&" "===i)for(var v=u;v<o;++v)l+=i;if(c&&(_<0?l+="-":"-"!==t&&(l+=t)),n&&0===s&&(l+="0"),n&&1===s&&(l+="0x"),"+"===a&&"0"===i)for(var g=u;g<o;++g)l+=i;if(l=f?l+r.toUpperCase():l+r,"-"===a)for(var d=u;d<o;++d)l+=" ";return l}function u(e,r){if("%d"===e)return String(r);var a=f(e),t=(r<0?a.signedconv?(a.sign=-1,-r>>>0):r>>>0:r).toString(c(a.base));if(a.prec>=0){a.filter=" ";var i=a.prec-t.length|0;i>0&&(t="0".repeat(i)+t)}return _(a,t)}function l(a){if(!e.i64_lt(a,r.zero))return r.to_string(a);var t=[0,10],i=r.discard_sign(a),n=r.div_mod(i,t),s=r.div_mod(r.add([0,8],n[1]),t),c=r.add(r.add([214748364,3435973836],n[0]),s[0]);return r.to_string(c)+"0123456789"[r.to_int32(s[1])]}function v(a){var t="",i=[0,8],n="01234567";if(e.i64_lt(a,r.zero)){var s=r.discard_sign(a),c=r.div_mod(s,i),o=r.add([268435456,0],c[0]),f=c[1];for(t=n[r.to_int32(f)]+t;e.i64_neq(o,r.zero);){var _=r.div_mod(o,i);o=_[0],f=_[1],t=n[r.to_int32(f)]+t}}else{var u=r.div_mod(a,i),l=u[0],v=u[1];for(t=n[r.to_int32(v)]+t;e.i64_neq(l,r.zero);){var g=r.div_mod(l,i);l=g[0],v=g[1],t=n[r.to_int32(v)]+t}}return t}function g(a,t){if("%d"===a)return r.to_string(t);var i,n,s=f(a),c=s.signedconv&&e.i64_lt(t,r.zero)?(s.sign=-1,r.neg(t)):t;switch(s.base){case 0:i=v(c);break;case 1:i=r.to_hex(c);break;case 2:i=l(c)}if(s.prec>=0){s.filter=" ";var o=s.prec-i.length|0;n=o>0?"0".repeat(o)+i:i}else n=i;return _(s,n)}function d(e,r){var a=f(e),t=a.prec<0?6:a.prec,i=r<0?(a.sign=-1,-r):r,n="";if(isNaN(i))n="nan",a.filter=" ";else if(isFinite(i)){switch(a.conv){case"e":var s=(n=i.toExponential(t)).length;"e"===n[s-3|0]&&(n=n.slice(0,s-1|0)+"0"+n.slice(s-1|0));break;case"f":n=i.toFixed(t);break;case"g":var c=0!==t?t:1,o=(n=i.toExponential(c-1|0)).indexOf("e"),u=0|Number(n.slice(o+1|0));if(u<-4||i>=1e21||i.toFixed().length>c){for(var l=o-1|0;"0"===n[l];)l=l-1|0;"."===n[l]&&(l=l-1|0);var v=(n=n.slice(0,l+1|0)+n.slice(o)).length;"e"===n[v-3|0]&&(n=n.slice(0,v-1|0)+"0"+n.slice(v-1|0))}else{var g=c;if(u<0)g=g-(u+1|0)|0,n=i.toFixed(g);else for(;(n=i.toFixed(g)).length>(c+1|0);)g=g-1|0;if(0!==g){for(var d=n.length-1|0;"0"===n[d];)d=d-1|0;"."===n[d]&&(d=d-1|0),n=n.slice(0,d+1|0)}}}}else n="inf",a.filter=" ";return _(a,n)}var h=function(e,r,a){if(!isFinite(e))return isNaN(e)?"nan":e>0?"infinity":"-infinity";var t=0==e&&1/e==-1/0?1:e>=0?0:1;t&&(e=-e);var i=0;if(0==e);else if(e<1)for(;e<1&&i>-1022;)e*=2,i--;else for(;e>=2;)e/=2,i++;var n=i<0?"":"+",s="";if(t)s="-";else switch(a){case 43:s="+";break;case 32:s=" "}if(r>=0&&r<13){var c=Math.pow(2,4*r);e=Math.round(e*c)/c}var o=e.toString(16);if(r>=0){var f=o.indexOf(".");if(f<0)o+="."+"0".repeat(r);else{var _=f+1+r;o.length<_?o+="0".repeat(_-o.length):o=o.substr(0,_)}}return s+"0x"+o+"p"+n+i.toString(10)},p=function(e,r){var a=+e;if(e.length>0&&a==a)return a;if(a=+(e=e.replace(/_/g,"")),e.length>0&&a==a||/^[+-]?nan$/i.test(e))return a;var t=/^ *([+-]?)0x([0-9a-f]+)\.?([0-9a-f]*)p([+-]?[0-9]+)/i.exec(e);if(t){var i=t[3].replace(/0+$/,""),n=parseInt(t[1]+t[2]+i,16),s=(0|t[4])-4*i.length;return a=n*Math.pow(2,s)}if(/^\+?inf(inity)?$/i.test(e))return 1/0;if(/^-inf(inity)?$/i.test(e))return-1/0;throw r};function m(e){return p(e,{RE_EXN_ID:"Failure",_1:"float_of_string"})}var w=u,E=u,b=n,x=n;exports.caml_format_float=d,exports.caml_hexstring_of_float=h,exports.caml_format_int=u,exports.caml_nativeint_format=w,exports.caml_int32_format=E,exports.caml_float_of_string=m,exports.caml_int64_format=g,exports.caml_int_of_string=n,exports.caml_int32_of_string=b,exports.caml_int64_of_string=s,exports.caml_nativeint_of_string=x;
},{"./caml.js":"gGFE","./caml_int64.js":"Phox"}],"GLny":[function(require,module,exports) {
"use strict";function r(r,t){if(t>=r.length||t<0)throw{RE_EXN_ID:"Invalid_argument",_1:"index out of bounds",Error:new Error};return r.charCodeAt(t)}function t(r,t){return String.fromCharCode(t).repeat(r)}exports.get=r,exports.make=t;
},{}],"FC4F":[function(require,module,exports) {
var global = arguments[3];
var e=arguments[3],r=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==e)return e;if(void 0!==this)return this;throw new Error("Unable to locate global `this`")},t=function(e){var t=r();if(void 0===t[e])throw new Error(e+" not polyfilled by ReScript yet\n");return t[e]},n=function(e,t){return r()[e]=t,0};exports.getGlobalThis=r,exports.resolve=t,exports.register=n;
},{}],"z22f":[function(require,module,exports) {
"use strict";var r=require("./curry.js"),t=require("./caml_io.js"),e=require("./caml_sys.js"),n=require("./caml_bytes.js"),o=require("./caml_format.js"),_=require("./caml_string.js"),l=require("./caml_exceptions.js"),u=require("./caml_js_exceptions.js"),i=require("./caml_external_polyfill.js");function s(r){throw{RE_EXN_ID:"Failure",_1:r,Error:new Error}}function a(r){throw{RE_EXN_ID:"Invalid_argument",_1:r,Error:new Error}}var c=l.create("Pervasives.Exit");function p(r){return r>=0?r:0|-r}function f(r){return-1^r}var m=-2147483648;function x(r){return isFinite(r)?Math.abs(r)>=2.2250738585072014e-308?0:0!==r?1:2:isNaN(r)?4:3}function h(r){if(r<0||r>255)throw{RE_EXN_ID:"Invalid_argument",_1:"char_of_int",Error:new Error};return r}function v(r){return r?"true":"false"}function d(r){switch(r){case"false":return!1;case"true":return!0;default:throw{RE_EXN_ID:"Invalid_argument",_1:"bool_of_string",Error:new Error}}}function E(r){switch(r){case"false":return!1;case"true":return!0;default:return}}function g(r){try{return o.caml_int_of_string(r)}catch(e){var t=u.internalToOCamlException(e);if("Failure"===t.RE_EXN_ID)return;throw t}}function y(r){for(var t=r.length,e=0;;){var n=e;if(n>=t)return r+".";var o=_.get(r,n);if(o>=48){if(o>=58)return r;e=n+1|0}else{if(45!==o)return r;e=n+1|0}}}function b(r){return y(o.caml_format_float("%.12g",r))}function w(r){try{return o.caml_float_of_string(r)}catch(e){var t=u.internalToOCamlException(e);if("Failure"===t.RE_EXN_ID)return;throw t}}function I(r,t){return r?{hd:r.hd,tl:I(r.tl,t)}:t}var N=t.stdin,D=t.stdout,R=t.stderr;function X(r,t,e){var n=i.resolve("caml_ml_open_descriptor_out")(i.resolve("caml_sys_open")(e,r,t));return i.resolve("caml_ml_set_channel_name")(n,e),n}function j(r){return X({hd:1,tl:{hd:3,tl:{hd:4,tl:{hd:7,tl:0}}}},438,r)}function q(r){return X({hd:1,tl:{hd:3,tl:{hd:4,tl:{hd:6,tl:0}}}},438,r)}function k(r){for(var e=t.caml_ml_out_channels_list(void 0);;){var n=e;if(!n)return;try{t.caml_ml_flush(n.hd)}catch(_){var o=u.internalToOCamlException(_);if("Sys_error"!==o.RE_EXN_ID)throw o}e=n.tl}}function F(r,t){return i.resolve("caml_ml_output_bytes")(r,t,0,t.length)}function z(r,e){return t.caml_ml_output(r,e,0,e.length)}function C(r,t,e,n){if(e<0||n<0||e>(t.length-n|0))throw{RE_EXN_ID:"Invalid_argument",_1:"output",Error:new Error};return i.resolve("caml_ml_output_bytes")(r,t,e,n)}function O(r,e,n,o){if(n<0||o<0||n>(e.length-o|0))throw{RE_EXN_ID:"Invalid_argument",_1:"output_substring",Error:new Error};return t.caml_ml_output(r,e,n,o)}function S(r,t){return i.resolve("caml_output_value")(r,t,0)}function T(r){return t.caml_ml_flush(r),i.resolve("caml_ml_close_channel")(r)}function L(r){try{t.caml_ml_flush(r)}catch(e){}try{return i.resolve("caml_ml_close_channel")(r)}catch(n){return}}function M(r,t,e){var n=i.resolve("caml_ml_open_descriptor_in")(i.resolve("caml_sys_open")(e,r,t));return i.resolve("caml_ml_set_channel_name")(n,e),n}function P(r){return M({hd:0,tl:{hd:7,tl:0}},0,r)}function $(r){return M({hd:0,tl:{hd:6,tl:0}},0,r)}function A(r,t,e,n){if(e<0||n<0||e>(t.length-n|0))throw{RE_EXN_ID:"Invalid_argument",_1:"input",Error:new Error};return i.resolve("caml_ml_input")(r,t,e,n)}function B(r,t,e,n){for(;;){var o=n,_=e;if(o<=0)return;var l=i.resolve("caml_ml_input")(r,t,_,o);if(0===l)throw{RE_EXN_ID:"End_of_file",Error:new Error};n=o-l|0,e=_+l|0}}function G(r,t,e,n){if(e<0||n<0||e>(t.length-n|0))throw{RE_EXN_ID:"Invalid_argument",_1:"really_input",Error:new Error};return B(r,t,e,n)}function H(r,t){var e=n.caml_create_bytes(t);return G(r,e,0,t),n.bytes_to_string(e)}function J(r){var t=function(r,t,e){for(;;){var o=e,_=t;if(!o)return r;var l=o.hd,u=l.length;n.caml_blit_bytes(l,0,r,_-u|0,u),e=o.tl,t=_-u|0}};return n.bytes_to_string(function(e,o){for(;;){var _=o,l=e,u=i.resolve("caml_ml_input_scan_line")(r);if(0===u){if(l)return t(n.caml_create_bytes(_),_,l);throw{RE_EXN_ID:"End_of_file",Error:new Error}}if(u>0){var s=n.caml_create_bytes(u-1|0);if(i.resolve("caml_ml_input")(r,s,0,u-1|0),i.resolve("caml_ml_input_char")(r),!l)return s;var a=(_+u|0)-1|0;return t(n.caml_create_bytes(a),a,{hd:s,tl:l})}var c=n.caml_create_bytes(0|-u);i.resolve("caml_ml_input")(r,c,0,0|-u),o=_-u|0,e={hd:c,tl:l}}}(0,0))}function K(r){try{return i.resolve("caml_ml_close_channel")(r)}catch(t){return}}function Q(r){return t.caml_ml_output_char(D,r)}function U(r){return z(D,r)}function V(r){return F(D,r)}function W(r){return z(D,String(r))}function Y(r){return z(D,y(o.caml_format_float("%.12g",r)))}function Z(r){return t.caml_ml_output_char(D,10),t.caml_ml_flush(D)}function rr(r){return t.caml_ml_output_char(R,r)}function tr(r){return z(R,r)}function er(r){return F(R,r)}function nr(r){return z(R,String(r))}function or(r){return z(R,y(o.caml_format_float("%.12g",r)))}function _r(r){return t.caml_ml_output_char(R,10),t.caml_ml_flush(R)}function lr(r){return t.caml_ml_flush(D),J(N)}function ur(r){return o.caml_int_of_string((t.caml_ml_flush(D),J(N)))}function ir(r){return g((t.caml_ml_flush(D),J(N)))}function sr(r){return o.caml_float_of_string((t.caml_ml_flush(D),J(N)))}function ar(r){return w((t.caml_ml_flush(D),J(N)))}function cr(r){return r._1}var pr={contents:k};function fr(t){var e=pr.contents;pr.contents=function(n){return r._1(t,void 0),r._1(e,void 0)}}function mr(t){return r._1(pr.contents,void 0)}function xr(r){return mr(void 0),e.caml_sys_exit(r)}var hr=2147483647,vr=1/0,dr=-1/0,Er=1.7976931348623157e308,gr=2.2250738585072014e-308,yr=2.220446049250313e-16,br=t.caml_ml_flush,wr=t.caml_ml_output_char,Ir=t.caml_ml_output_char;function Nr(r,t){return i.resolve("caml_ml_output_int")(r,t)}function Dr(r,t){return i.resolve("caml_ml_seek_out")(r,t)}function Rr(r){return i.resolve("caml_ml_pos_out")(r)}function Xr(r){return i.resolve("caml_ml_channel_size")(r)}function jr(r,t){return i.resolve("caml_ml_set_binary_mode")(r,t)}function qr(r){return i.resolve("caml_ml_input_char")(r)}function kr(r){return i.resolve("caml_ml_input_char")(r)}function Fr(r){return i.resolve("caml_ml_input_int")(r)}function zr(r){return i.resolve("caml_input_value")(r)}function Cr(r,t){return i.resolve("caml_ml_seek_in")(r,t)}function Or(r){return i.resolve("caml_ml_pos_in")(r)}function Sr(r){return i.resolve("caml_ml_channel_size")(r)}function Tr(r){return i.resolve("caml_ml_close_channel")(r)}function Lr(r,t){return i.resolve("caml_ml_set_binary_mode")(r,t)}function Mr(r,t){return i.resolve("caml_ml_seek_out_64")(r,t)}function Pr(r){return i.resolve("caml_ml_pos_out_64")(r)}function $r(r){return i.resolve("caml_ml_channel_size_64")(r)}function Ar(r,t){return i.resolve("caml_ml_seek_in_64")(r,t)}function Br(r){return i.resolve("caml_ml_pos_in_64")(r)}function Gr(r){return i.resolve("caml_ml_channel_size_64")(r)}var Hr={seek_out:Mr,pos_out:Pr,out_channel_length:$r,seek_in:Ar,pos_in:Br,in_channel_length:Gr};exports.invalid_arg=a,exports.failwith=s,exports.Exit=c,exports.abs=p,exports.max_int=hr,exports.min_int=m,exports.lnot=f,exports.infinity=vr,exports.neg_infinity=dr,exports.max_float=Er,exports.min_float=gr,exports.epsilon_float=yr,exports.classify_float=x,exports.char_of_int=h,exports.string_of_bool=v,exports.bool_of_string=d,exports.bool_of_string_opt=E,exports.int_of_string_opt=g,exports.string_of_float=b,exports.float_of_string_opt=w,exports.$at=I,exports.stdin=N,exports.stdout=D,exports.stderr=R,exports.print_char=Q,exports.print_string=U,exports.print_bytes=V,exports.print_int=W,exports.print_float=Y,exports.print_newline=Z,exports.prerr_char=rr,exports.prerr_string=tr,exports.prerr_bytes=er,exports.prerr_int=nr,exports.prerr_float=or,exports.prerr_newline=_r,exports.read_line=lr,exports.read_int=ur,exports.read_int_opt=ir,exports.read_float=sr,exports.read_float_opt=ar,exports.open_out=j,exports.open_out_bin=q,exports.open_out_gen=X,exports.flush=br,exports.flush_all=k,exports.output_char=wr,exports.output_string=z,exports.output_bytes=F,exports.output=C,exports.output_substring=O,exports.output_byte=Ir,exports.output_binary_int=Nr,exports.output_value=S,exports.seek_out=Dr,exports.pos_out=Rr,exports.out_channel_length=Xr,exports.close_out=T,exports.close_out_noerr=L,exports.set_binary_mode_out=jr,exports.open_in=P,exports.open_in_bin=$,exports.open_in_gen=M,exports.input_char=qr,exports.input_line=J,exports.input=A,exports.really_input=G,exports.really_input_string=H,exports.input_byte=kr,exports.input_binary_int=Fr,exports.input_value=zr,exports.seek_in=Cr,exports.pos_in=Or,exports.in_channel_length=Sr,exports.close_in=Tr,exports.close_in_noerr=K,exports.set_binary_mode_in=Lr,exports.LargeFile=Hr,exports.string_of_format=cr,exports.exit=xr,exports.at_exit=fr,exports.valid_float_lexem=y,exports.unsafe_really_input=B,exports.do_at_exit=mr;
},{"./curry.js":"NSLD","./caml_io.js":"bJMn","./caml_sys.js":"Juhd","./caml_bytes.js":"gmRG","./caml_format.js":"Zve6","./caml_string.js":"GLny","./caml_exceptions.js":"RiV8","./caml_js_exceptions.js":"yO2E","./caml_external_polyfill.js":"FC4F"}],"aYjQ":[function(require,module,exports) {
"use strict";var r=require("./curry.js"),t=require("./caml_obj.js"),n=require("./pervasives.js"),l=require("./caml_option.js");function e(r){for(var t=0,n=r;;){var l=t;if(!n)return l;n=n.tl,t=l+1|0}}function o(r,t){return{hd:r,tl:t}}function i(r){if(r)return r.hd;throw{RE_EXN_ID:"Failure",_1:"hd",Error:new Error}}function h(r){if(r)return r.tl;throw{RE_EXN_ID:"Failure",_1:"tl",Error:new Error}}function d(r,t){if(t<0)throw{RE_EXN_ID:"Invalid_argument",_1:"List.nth",Error:new Error};for(var n=r,l=t;;){var e=l,o=n;if(!o)throw{RE_EXN_ID:"Failure",_1:"nth",Error:new Error};if(0===e)return o.hd;l=e-1|0,n=o.tl}}function f(r,t){if(t<0)throw{RE_EXN_ID:"Invalid_argument",_1:"List.nth",Error:new Error};for(var n=r,e=t;;){var o=e,i=n;if(!i)return;if(0===o)return l.some(i.hd);e=o-1|0,n=i.tl}}function u(r,t){for(;;){var n=t,l=r;if(!l)return n;t={hd:l.hd,tl:n},r=l.tl}}function _(r){return u(r,0)}function a(t,n,l,e){for(;;){var o=n,i=t;if(o>=l)return i;n=o+1|0,t={hd:r._1(e,o),tl:i}}}function v(t,n,l){return t>=n?0:{hd:r._1(l,t),tl:v(t+1|0,n,l)}}function s(r,t){if(r<0)throw{RE_EXN_ID:"Invalid_argument",_1:"List.init",Error:new Error};return r>1e4?u(a(0,0,r,t),0):v(0,r,t)}function E(r){return r?n.$at(r.hd,E(r.tl)):0}function c(t,n){return n?{hd:r._1(t,n.hd),tl:c(t,n.tl)}:0}function p(t,n,l){return l?{hd:r._2(n,t,l.hd),tl:p(t+1|0,n,l.tl)}:0}function m(r,t){return p(0,r,t)}function x(t,n){for(var l=0,e=n;;){var o=e,i=l;if(!o)return i;e=o.tl,l={hd:r._1(t,o.hd),tl:i}}}function w(t,n){for(;;){var l=n;if(!l)return;r._1(t,l.hd),n=l.tl}}function I(t,n){for(var l=0,e=n;;){var o=e,i=l;if(!o)return;r._2(t,i,o.hd),e=o.tl,l=i+1|0}}function N(t,n,l){for(;;){var e=l,o=n;if(!e)return o;l=e.tl,n=r._2(t,o,e.hd)}}function g(t,n,l){return n?r._2(t,n.hd,g(t,n.tl,l)):l}function D(t,n,l){if(n){if(l)return{hd:r._2(t,n.hd,l.hd),tl:D(t,n.tl,l.tl)};throw{RE_EXN_ID:"Invalid_argument",_1:"List.map2",Error:new Error}}if(!l)return 0;throw{RE_EXN_ID:"Invalid_argument",_1:"List.map2",Error:new Error}}function R(t,n,l){for(var e=0,o=n,i=l;;){var h=i,d=o,f=e;if(d){if(h){i=h.tl,o=d.tl,e={hd:r._2(t,d.hd,h.hd),tl:f};continue}throw{RE_EXN_ID:"Invalid_argument",_1:"List.rev_map2",Error:new Error}}if(h)throw{RE_EXN_ID:"Invalid_argument",_1:"List.rev_map2",Error:new Error};return f}}function X(t,n,l){for(;;){var e=l,o=n;if(o){if(e){r._2(t,o.hd,e.hd),l=e.tl,n=o.tl;continue}throw{RE_EXN_ID:"Invalid_argument",_1:"List.iter2",Error:new Error}}if(!e)return;throw{RE_EXN_ID:"Invalid_argument",_1:"List.iter2",Error:new Error}}}function L(t,n,l,e){for(;;){var o=e,i=l,h=n;if(i){if(o){e=o.tl,l=i.tl,n=r._3(t,h,i.hd,o.hd);continue}throw{RE_EXN_ID:"Invalid_argument",_1:"List.fold_left2",Error:new Error}}if(o)throw{RE_EXN_ID:"Invalid_argument",_1:"List.fold_left2",Error:new Error};return h}}function q(t,n,l,e){if(n){if(l)return r._3(t,n.hd,l.hd,q(t,n.tl,l.tl,e));throw{RE_EXN_ID:"Invalid_argument",_1:"List.fold_right2",Error:new Error}}if(l)throw{RE_EXN_ID:"Invalid_argument",_1:"List.fold_right2",Error:new Error};return e}function b(t,n){for(;;){var l=n;if(!l)return!0;if(!r._1(t,l.hd))return!1;n=l.tl}}function j(t,n){for(;;){var l=n;if(!l)return!1;if(r._1(t,l.hd))return!0;n=l.tl}}function F(t,n,l){for(;;){var e=l,o=n;if(o){if(e){if(!r._2(t,o.hd,e.hd))return!1;l=e.tl,n=o.tl;continue}throw{RE_EXN_ID:"Invalid_argument",_1:"List.for_all2",Error:new Error}}if(!e)return!0;throw{RE_EXN_ID:"Invalid_argument",_1:"List.for_all2",Error:new Error}}}function $(t,n,l){for(;;){var e=l,o=n;if(o){if(e){if(r._2(t,o.hd,e.hd))return!0;l=e.tl,n=o.tl;continue}throw{RE_EXN_ID:"Invalid_argument",_1:"List.exists2",Error:new Error}}if(!e)return!1;throw{RE_EXN_ID:"Invalid_argument",_1:"List.exists2",Error:new Error}}}function y(r,n){for(;;){var l=n;if(!l)return!1;if(t.caml_equal(l.hd,r))return!0;n=l.tl}}function A(r,t){for(;;){var n=t;if(!n)return!1;if(n.hd===r)return!0;t=n.tl}}function k(r,n){for(;;){var l=n;if(!l)throw{RE_EXN_ID:"Not_found",Error:new Error};var e=l.hd;if(t.caml_equal(e[0],r))return e[1];n=l.tl}}function z(r,n){for(;;){var e=n;if(!e)return;var o=e.hd;if(t.caml_equal(o[0],r))return l.some(o[1]);n=e.tl}}function B(r,t){for(;;){var n=t;if(!n)throw{RE_EXN_ID:"Not_found",Error:new Error};var l=n.hd;if(l[0]===r)return l[1];t=n.tl}}function C(r,t){for(;;){var n=t;if(!n)return;var e=n.hd;if(e[0]===r)return l.some(e[1]);t=n.tl}}function G(r,n){for(;;){var l=n;if(!l)return!1;if(t.caml_equal(l.hd[0],r))return!0;n=l.tl}}function H(r,t){for(;;){var n=t;if(!n)return!1;if(n.hd[0]===r)return!0;t=n.tl}}function J(r,n){if(!n)return 0;var l=n.tl,e=n.hd;return t.caml_equal(e[0],r)?l:{hd:e,tl:J(r,l)}}function K(r,t){if(!t)return 0;var n=t.tl,l=t.hd;return l[0]===r?n:{hd:l,tl:K(r,n)}}function M(t,n){for(;;){var l=n;if(!l)throw{RE_EXN_ID:"Not_found",Error:new Error};var e=l.hd;if(r._1(t,e))return e;n=l.tl}}function O(t,n){for(;;){var e=n;if(!e)return;var o=e.hd;if(r._1(t,o))return l.some(o);n=e.tl}}function P(t){return function(n){for(var l=0,e=n;;){var o=e,i=l;if(!o)return u(i,0);var h=o.tl,d=o.hd;r._1(t,d)?(e=h,l={hd:d,tl:i}):e=h}}}function Q(t,n){for(var l=0,e=0,o=n;;){var i=o,h=e,d=l;if(!i)return[u(d,0),u(h,0)];var f=i.tl,_=i.hd;r._1(t,_)?(o=f,l={hd:_,tl:d}):(o=f,e={hd:_,tl:h})}}function S(r){if(!r)return[0,0];var t=r.hd,n=S(r.tl);return[{hd:t[0],tl:n[0]},{hd:t[1],tl:n[1]}]}function T(r,t){if(r){if(t)return{hd:[r.hd,t.hd],tl:T(r.tl,t.tl)};throw{RE_EXN_ID:"Invalid_argument",_1:"List.combine",Error:new Error}}if(!t)return 0;throw{RE_EXN_ID:"Invalid_argument",_1:"List.combine",Error:new Error}}function U(t,n,l){if(!n)return l;if(!l)return n;var e=l.hd,o=n.hd;return r._2(t,o,e)<=0?{hd:o,tl:U(t,n.tl,l)}:{hd:e,tl:U(t,n,l.tl)}}function V(r,t){for(;;){var n=t,l=r;if(0===l)return n;if(!n)throw{RE_EXN_ID:"Assert_failure",_1:["list.ml",262,11],Error:new Error};t=n.tl,r=l-1|0}}function W(t,n){var l=function(n,l){if(2!==n){if(3===n&&l){var e=l.tl;if(e){var i=e.tl;if(i){var h=i.hd,d=e.hd,f=l.hd;return r._2(t,f,d)<=0?r._2(t,d,h)<=0?{hd:f,tl:{hd:d,tl:{hd:h,tl:0}}}:r._2(t,f,h)<=0?{hd:f,tl:{hd:h,tl:{hd:d,tl:0}}}:{hd:h,tl:{hd:f,tl:{hd:d,tl:0}}}:r._2(t,f,h)<=0?{hd:d,tl:{hd:f,tl:{hd:h,tl:0}}}:r._2(t,d,h)<=0?{hd:d,tl:{hd:h,tl:{hd:f,tl:0}}}:{hd:h,tl:{hd:d,tl:{hd:f,tl:0}}}}}}}else if(l){var _=l.tl;if(_){var a=_.hd,v=l.hd;return r._2(t,v,a)<=0?{hd:v,tl:{hd:a,tl:0}}:{hd:a,tl:{hd:v,tl:0}}}}for(var s=n>>1,E=n-s|0,c=V(s,l),p=o(s,l),m=o(E,c),x=0;;){var w=x,I=m,N=p;if(!N)return u(I,w);if(!I)return u(N,w);var g=I.hd,D=N.hd;r._2(t,D,g)>0?(x={hd:D,tl:w},p=N.tl):(x={hd:g,tl:w},m=I.tl)}},o=function(n,e){if(2!==n){if(3===n&&e){var o=e.tl;if(o){var i=o.tl;if(i){var h=i.hd,d=o.hd,f=e.hd;return r._2(t,f,d)>0?r._2(t,d,h)>0?{hd:f,tl:{hd:d,tl:{hd:h,tl:0}}}:r._2(t,f,h)>0?{hd:f,tl:{hd:h,tl:{hd:d,tl:0}}}:{hd:h,tl:{hd:f,tl:{hd:d,tl:0}}}:r._2(t,f,h)>0?{hd:d,tl:{hd:f,tl:{hd:h,tl:0}}}:r._2(t,d,h)>0?{hd:d,tl:{hd:h,tl:{hd:f,tl:0}}}:{hd:h,tl:{hd:d,tl:{hd:f,tl:0}}}}}}}else if(e){var _=e.tl;if(_){var a=_.hd,v=e.hd;return r._2(t,v,a)>0?{hd:v,tl:{hd:a,tl:0}}:{hd:a,tl:{hd:v,tl:0}}}}for(var s=n>>1,E=n-s|0,c=V(s,e),p=l(s,e),m=l(E,c),x=0;;){var w=x,I=m,N=p;if(!N)return u(I,w);if(!I)return u(N,w);var g=I.hd,D=N.hd;r._2(t,D,g)<=0?(x={hd:D,tl:w},p=N.tl):(x={hd:g,tl:w},m=I.tl)}},i=e(n);return i<2?n:l(i,n)}function Y(t,n){var l=function(n,l){if(2!==n){if(3===n&&l){var e=l.tl;if(e){var i=e.tl;if(i){var h=i.hd,d=e.hd,f=l.hd,_=r._2(t,f,d);if(0===_){var a=r._2(t,d,h);return 0===a?{hd:d,tl:0}:a<0?{hd:d,tl:{hd:h,tl:0}}:{hd:h,tl:{hd:d,tl:0}}}if(_<0){var v=r._2(t,d,h);if(0===v)return{hd:f,tl:{hd:d,tl:0}};if(v<0)return{hd:f,tl:{hd:d,tl:{hd:h,tl:0}}};var s=r._2(t,f,h);return 0===s?{hd:f,tl:{hd:d,tl:0}}:s<0?{hd:f,tl:{hd:h,tl:{hd:d,tl:0}}}:{hd:h,tl:{hd:f,tl:{hd:d,tl:0}}}}var E=r._2(t,f,h);if(0===E)return{hd:d,tl:{hd:f,tl:0}};if(E<0)return{hd:d,tl:{hd:f,tl:{hd:h,tl:0}}};var c=r._2(t,d,h);return 0===c?{hd:d,tl:{hd:f,tl:0}}:c<0?{hd:d,tl:{hd:h,tl:{hd:f,tl:0}}}:{hd:h,tl:{hd:d,tl:{hd:f,tl:0}}}}}}}else if(l){var p=l.tl;if(p){var m=p.hd,x=l.hd,w=r._2(t,x,m);return 0===w?{hd:x,tl:0}:w<0?{hd:x,tl:{hd:m,tl:0}}:{hd:m,tl:{hd:x,tl:0}}}}for(var I=n>>1,N=n-I|0,g=V(I,l),D=o(I,l),R=o(N,g),X=0;;){var L=X,q=R,b=D;if(!b)return u(q,L);if(!q)return u(b,L);var j=q.tl,F=q.hd,$=b.tl,y=b.hd,A=r._2(t,y,F);0!==A?A>0?(X={hd:y,tl:L},D=$):(X={hd:F,tl:L},R=j):(X={hd:y,tl:L},R=j,D=$)}},o=function(n,e){if(2!==n){if(3===n&&e){var o=e.tl;if(o){var i=o.tl;if(i){var h=i.hd,d=o.hd,f=e.hd,_=r._2(t,f,d);if(0===_){var a=r._2(t,d,h);return 0===a?{hd:d,tl:0}:a>0?{hd:d,tl:{hd:h,tl:0}}:{hd:h,tl:{hd:d,tl:0}}}if(_>0){var v=r._2(t,d,h);if(0===v)return{hd:f,tl:{hd:d,tl:0}};if(v>0)return{hd:f,tl:{hd:d,tl:{hd:h,tl:0}}};var s=r._2(t,f,h);return 0===s?{hd:f,tl:{hd:d,tl:0}}:s>0?{hd:f,tl:{hd:h,tl:{hd:d,tl:0}}}:{hd:h,tl:{hd:f,tl:{hd:d,tl:0}}}}var E=r._2(t,f,h);if(0===E)return{hd:d,tl:{hd:f,tl:0}};if(E>0)return{hd:d,tl:{hd:f,tl:{hd:h,tl:0}}};var c=r._2(t,d,h);return 0===c?{hd:d,tl:{hd:f,tl:0}}:c>0?{hd:d,tl:{hd:h,tl:{hd:f,tl:0}}}:{hd:h,tl:{hd:d,tl:{hd:f,tl:0}}}}}}}else if(e){var p=e.tl;if(p){var m=p.hd,x=e.hd,w=r._2(t,x,m);return 0===w?{hd:x,tl:0}:w>0?{hd:x,tl:{hd:m,tl:0}}:{hd:m,tl:{hd:x,tl:0}}}}for(var I=n>>1,N=n-I|0,g=V(I,e),D=l(I,e),R=l(N,g),X=0;;){var L=X,q=R,b=D;if(!b)return u(q,L);if(!q)return u(b,L);var j=q.tl,F=q.hd,$=b.tl,y=b.hd,A=r._2(t,y,F);0!==A?A<0?(X={hd:y,tl:L},D=$):(X={hd:F,tl:L},R=j):(X={hd:y,tl:L},R=j,D=$)}},i=e(n);return i<2?n:l(i,n)}function Z(r,t){for(;;){var n=r;if(!n)return t?-1:0;if(!t)return 1;t=t.tl,r=n.tl}}function rr(r,t){for(;;){if(!r)return 0===t?0:t>0?-1:1;if(t<=0)return 1;t=t-1|0,r=r.tl}}var tr=n.$at,nr=E,lr=P,er=W,or=W;exports.length=e,exports.compare_lengths=Z,exports.compare_length_with=rr,exports.cons=o,exports.hd=i,exports.tl=h,exports.nth=d,exports.nth_opt=f,exports.rev=_,exports.init=s,exports.append=tr,exports.rev_append=u,exports.concat=nr,exports.flatten=E,exports.iter=w,exports.iteri=I,exports.map=c,exports.mapi=m,exports.rev_map=x,exports.fold_left=N,exports.fold_right=g,exports.iter2=X,exports.map2=D,exports.rev_map2=R,exports.fold_left2=L,exports.fold_right2=q,exports.for_all=b,exports.exists=j,exports.for_all2=F,exports.exists2=$,exports.mem=y,exports.memq=A,exports.find=M,exports.find_opt=O,exports.filter=lr,exports.find_all=P,exports.partition=Q,exports.assoc=k,exports.assoc_opt=z,exports.assq=B,exports.assq_opt=C,exports.mem_assoc=G,exports.mem_assq=H,exports.remove_assoc=J,exports.remove_assq=K,exports.split=S,exports.combine=T,exports.sort=er,exports.stable_sort=W,exports.fast_sort=or,exports.sort_uniq=Y,exports.merge=U;
},{"./curry.js":"NSLD","./caml_obj.js":"p3B5","./pervasives.js":"z22f","./caml_option.js":"dzFO"}],"eN7B":[function(require,module,exports) {
"use strict";var r=require("./curry.js");function e(r){return r}function a(e){var a=e.cmp;return{cmp:r.__2(a)}}function t(r){return{cmp:r}}function n(e){return{cmp:r.__2(e)}}function o(r){return r}function s(e){var a=e.hash,t=r.__1(a),n=e.eq;return{hash:t,eq:r.__2(n)}}function u(r,e){return{hash:r,eq:e}}function c(e,a){return{hash:r.__1(e),eq:r.__2(a)}}exports.MakeComparableU=e,exports.MakeComparable=a,exports.comparableU=t,exports.comparable=n,exports.MakeHashableU=o,exports.MakeHashable=s,exports.hashableU=u,exports.hashable=c;
},{"./curry.js":"NSLD"}],"NOig":[function(require,module,exports) {
"use strict";var r=require("./caml_option.js");function e(r){var e=typeof r;return"string"===e?{TAG:0,_0:r}:"number"===e?{TAG:1,_0:r}:"boolean"===e?!0===r?1:0:null===r?2:Array.isArray(r)?{TAG:3,_0:r}:{TAG:2,_0:r}}function n(r,e){switch(e){case 0:return"string"==typeof r;case 1:return"number"==typeof r;case 2:return null!==r&&"object"==typeof r&&!Array.isArray(r);case 3:return Array.isArray(r);case 4:return"boolean"==typeof r;case 5:return null===r}}function t(r){if("string"==typeof r)return r}function o(r){if("number"==typeof r)return r}function i(e){if("object"==typeof e&&!Array.isArray(e)&&null!==e)return r.some(e)}function u(r){if(Array.isArray(r))return r}function a(r){if("boolean"==typeof r)return r}function s(r){if(null===r)return null}var f=function(r){for(var e=[r],n=[{kind:0,i:0,parent:e}];0!==n.length;){var t=n[n.length-1];0===t.kind?(t.val=t.parent[t.i],++t.i===t.parent.length&&n.pop()):n.pop();var o=t.val;if("object"==typeof o)if(Array.isArray(o)&&0!==o.length)n.push({kind:0,i:0,parent:o,val:void 0});else for(var i in o)"RE_PRIVATE_NONE"!==i?n.push({kind:1,i:i,parent:o,val:o[i]}):0===t.kind?t.parent[t.i-1]=void 0:t.parent[t.i]=void 0}return e[0]};function p(r){return function(r){var e=JSON.stringify(r,function(r,e){return void 0===e?{RE_PRIVATE_NONE:!0}:e});if(void 0===e)throw new TypeError("output is undefined");return e}(r)}function c(r){return f(JSON.parse(r))}exports.classify=e,exports.test=n,exports.decodeString=t,exports.decodeNumber=o,exports.decodeObject=i,exports.decodeArray=u,exports.decodeBoolean=a,exports.decodeNull=s,exports.deserializeUnsafe=c,exports.serializeExn=p;
},{"./caml_option.js":"dzFO"}],"FisO":[function(require,module,exports) {
"use strict";function r(r,t){return r===t}var t=2147483647,e=-2147483648;exports.equal=r,exports.max=t,exports.min=e;
},{}],"MeLz":[function(require,module,exports) {
"use strict";var r=require("./js_int.js");function t(r){return Math.ceil(r)}function n(t){return t>r.max?r.max:t<r.min?r.min:Math.ceil(t)}function o(r){return Math.floor(r)}function e(t){return t>r.max?r.max:t<r.min?r.min:Math.floor(t)}function i(r,t){return e(Math.random()*(t-r|0))+r|0}var a=n,u=e;exports.unsafe_ceil=t,exports.ceil_int=n,exports.ceil=a,exports.unsafe_floor=o,exports.floor_int=e,exports.floor=u,exports.random_int=i;
},{"./js_int.js":"FisO"}],"yUxI":[function(require,module,exports) {
"use strict";var r=require("./caml.js"),n=require("./curry.js"),e=require("./js_math.js"),t=require("./caml_option.js");function o(r,n){if(n>=0&&n<r.length)return t.some(r[n])}function u(r,n){if(!(n>=0&&n<r.length))throw{RE_EXN_ID:"Assert_failure",_1:["belt_Array.ml",27,4],Error:new Error};return r[n]}function f(r,n,e){return n>=0&&n<r.length&&(r[n]=e,!0)}function i(r,n,e){if(!(n>=0&&n<r.length))throw{RE_EXN_ID:"Assert_failure",_1:["belt_Array.ml",33,2],Error:new Error};r[n]=e}function a(r,n,e){var t=r[n];r[n]=r[e],r[e]=t}function c(r){for(var n=r.length,t=0;t<n;++t)a(r,t,e.random_int(t,n))}function s(r){var n=r.slice(0);return c(n),n}function p(r){for(var n=r.length,e=0,t=n/2|0;e<t;++e)a(r,0+e|0,((0+n|0)-e|0)-1|0)}function l(r){for(var n=r.length,e=new Array(n),t=0;t<n;++t)e[t]=r[(n-1|0)-t|0];return e}function x(r,n){if(r<=0)return[];for(var e=new Array(r),t=0;t<r;++t)e[t]=n;return e}function v(r,n){if(r<=0)return[];for(var e=new Array(r),t=0;t<r;++t)e[t]=n(t);return e}function _(r,e){return v(r,n.__1(e))}function h(r,n){var e=v(r,n);return c(e),e}function g(r,e){return h(r,n.__1(e))}function m(r,n){var e=n-r|0;if(e<0)return[];for(var t=new Array(e+1|0),o=0;o<=e;++o)t[o]=r+o|0;return t}function y(r,n,e){var t=n-r|0;if(t<0||e<=0)return[];for(var o=1+(t/e|0)|0,u=new Array(o),f=r,i=0;i<o;++i)u[i]=f,f=f+e|0;return u}function A(r,n){for(var e=r.length,t=n.length,o=e<t?e:t,u=new Array(o),f=0;f<o;++f)u[f]=[r[f],n[f]];return u}function d(r,n,e){for(var t=r.length,o=n.length,u=t<o?t:o,f=new Array(u),i=0;i<u;++i)f[i]=e(r[i],n[i]);return f}function U(r,e,t){return d(r,e,n.__2(t))}function w(r,n){for(var e=r.length,t=n.length,o=new Array(e+t|0),u=0;u<e;++u)o[u]=r[u];for(var f=0;f<t;++f)o[e+f|0]=n[f];return o}function E(r){for(var n=r.length,e=0,t=0;t<n;++t)e=e+r[t].length|0;var o=new Array(e);e=0;for(var u=0;u<n;++u)for(var f=r[u],i=0,a=f.length;i<a;++i)o[e]=f[i],e=e+1|0;return o}function I(n,e,t){if(t<=0)return[];var o=n.length,u=e<0?r.caml_int_max(o+e|0,0):e,f=o-u|0,i=f<t?f:t;if(i<=0)return[];for(var a=new Array(i),c=0;c<i;++c)a[c]=n[u+c|0];return a}function k(n,e){for(var t=n.length,o=e<0?r.caml_int_max(t+e|0,0):e,u=t-o|0,f=new Array(u),i=0;i<u;++i)f[i]=n[o+i|0];return f}function B(n,e,t,o){if(!(t<=0)){var u=n.length,f=e<0?r.caml_int_max(u+e|0,0):e,i=u-f|0,a=i<t?i:t;if(!(a<=0))for(var c=f,s=f+a|0;c<s;++c)n[c]=o}}function W(r,n,e,t,o){if(t<=n)for(var u=0;u<o;++u)e[u+t|0]=r[u+n|0];else for(var f=o-1|0;f>=0;--f)e[f+t|0]=r[f+n|0]}function j(n,e,t,o,u){var f=n.length,i=t.length,a=e<0?r.caml_int_max(f+e|0,0):e,c=o<0?r.caml_int_max(i+o|0,0):o,s=r.caml_int_min(u,r.caml_int_min(f-a|0,i-c|0));if(c<=a)for(var p=0;p<s;++p)t[p+c|0]=n[p+a|0];else for(var l=s-1|0;l>=0;--l)t[l+c|0]=n[l+a|0]}function q(r,n){for(var e=0,t=r.length;e<t;++e)n(r[e])}function R(r,e){return q(r,n.__1(e))}function b(r,n){for(var e=r.length,t=new Array(e),o=0;o<e;++o)t[o]=n(r[o]);return t}function z(r,e){return b(r,n.__1(e))}function M(r,n){for(var e,o=r.length,u=0;void 0===e&&u<o;){var f=r[u];n(f)&&(e=t.some(f)),u=u+1|0}return e}function D(r,e){return M(r,n.__1(e))}function N(r,n){for(var e,t=r.length,o=0;void 0===e&&o<t;){n(r[o])&&(e=o),o=o+1|0}return e}function P(r,e){return N(r,n.__1(e))}function S(r,n){for(var e=r.length,t=new Array(e),o=0,u=0;u<e;++u){var f=r[u];n(f)&&(t[o]=f,o=o+1|0)}return t.length=o,t}function X(r,e){return S(r,n.__1(e))}function F(r,n){for(var e=r.length,t=new Array(e),o=0,u=0;u<e;++u){var f=r[u];n(f,u)&&(t[o]=f,o=o+1|0)}return t.length=o,t}function O(r,e){return F(r,n.__2(e))}function T(r,n){for(var e=r.length,o=new Array(e),u=0,f=0;f<e;++f){var i=n(r[f]);void 0!==i&&(o[u]=t.valFromOption(i),u=u+1|0)}return o.length=u,o}function C(r,e){return T(r,n.__1(e))}function G(r,n){for(var e=0,t=r.length;e<t;++e)n(e,r[e])}function H(r,e){return G(r,n.__2(e))}function J(r,n){for(var e=r.length,t=new Array(e),o=0;o<e;++o)t[o]=n(o,r[o]);return t}function K(r,e){return J(r,n.__2(e))}function L(r,n,e){for(var t=n,o=0,u=r.length;o<u;++o)t=e(t,r[o]);return t}function Q(r,e,t){return L(r,e,n.__2(t))}function V(r,n,e){for(var t=n,o=r.length-1|0;o>=0;--o)t=e(t,r[o]);return t}function Y(r,e,t){return V(r,e,n.__2(t))}function Z(n,e,t,o){for(var u=t,f=r.caml_int_min(n.length,e.length)-1|0;f>=0;--f)u=o(u,n[f],e[f]);return u}function $(r,e,t,o){return Z(r,e,t,n.__3(o))}function rr(r,n,e){for(var t=n,o=0,u=r.length;o<u;++o)t=e(t,r[o],o);return t}function nr(r,e,t){return rr(r,e,n.__3(t))}function er(r,n){for(var e=r.length,t=0;;){var o=t;if(o===e)return!0;if(!n(r[o]))return!1;t=o+1|0}}function tr(r,e){return er(r,n.__1(e))}function or(r,n){for(var e=r.length,t=0;;){var o=t;if(o===e)return!1;if(n(r[o]))return!0;t=o+1|0}}function ur(r,e){return or(r,n.__1(e))}function fr(r,n,e,t,o){for(;;){var u=e;if(u===o)return!0;if(!t(r[u],n[u]))return!1;e=u+1|0}}function ir(n,e,t){return fr(n,e,0,t,r.caml_int_min(n.length,e.length))}function ar(r,e,t){return ir(r,e,n.__2(t))}function cr(n,e,t){for(var o=0,u=r.caml_int_min(n.length,e.length);;){var f=o;if(f===u)return!1;if(t(n[f],e[f]))return!0;o=f+1|0}}function sr(r,e,t){return cr(r,e,n.__2(t))}function pr(r,n,e){var t=r.length;return t===n.length&&fr(r,n,0,e,t)}function lr(r,e,t){return pr(r,e,n.__2(t))}function xr(r,n,e){var t=r.length,o=n.length;if(t>o)return 1;if(t<o)return-1;for(var u=0;;){var f=u;if(f===t)return 0;var i=e(r[f],n[f]);if(0!==i)return i;u=f+1|0}}function vr(r,e,t){return xr(r,e,n.__2(t))}function _r(r,n){for(var e=r.length,t=0,o=0,u=new Array(e),f=new Array(e),i=0;i<e;++i){var a=r[i];n(a)?(u[t]=a,t=t+1|0):(f[o]=a,o=o+1|0)}return u.length=t,f.length=o,[u,f]}function hr(r,e){return _r(r,n.__1(e))}function gr(r){for(var n=r.length,e=new Array(n),t=new Array(n),o=0;o<n;++o){var u=r[o];e[o]=u[0],t[o]=u[1]}return[e,t]}function mr(r,n,e){var t=r.length;if(0===t)return"";for(var o=t-1|0,u=0,f="";;){var i=f,a=u;if(a===o)return i+e(r[a]);f=i+(e(r[a])+n),u=a+1|0}}function yr(r,e,t){return mr(r,e,n.__1(t))}exports.get=o,exports.getExn=u,exports.set=f,exports.setExn=i,exports.shuffleInPlace=c,exports.shuffle=s,exports.reverseInPlace=p,exports.reverse=l,exports.make=x,exports.range=m,exports.rangeBy=y,exports.makeByU=v,exports.makeBy=_,exports.makeByAndShuffleU=h,exports.makeByAndShuffle=g,exports.zip=A,exports.zipByU=d,exports.zipBy=U,exports.unzip=gr,exports.concat=w,exports.concatMany=E,exports.slice=I,exports.sliceToEnd=k,exports.fill=B,exports.blit=j,exports.blitUnsafe=W,exports.forEachU=q,exports.forEach=R,exports.mapU=b,exports.map=z,exports.getByU=M,exports.getBy=D,exports.getIndexByU=N,exports.getIndexBy=P,exports.keepU=S,exports.keep=X,exports.keepWithIndexU=F,exports.keepWithIndex=O,exports.keepMapU=T,exports.keepMap=C,exports.forEachWithIndexU=G,exports.forEachWithIndex=H,exports.mapWithIndexU=J,exports.mapWithIndex=K,exports.partitionU=_r,exports.partition=hr,exports.reduceU=L,exports.reduce=Q,exports.reduceReverseU=V,exports.reduceReverse=Y,exports.reduceReverse2U=Z,exports.reduceReverse2=$,exports.reduceWithIndexU=rr,exports.reduceWithIndex=nr,exports.joinWithU=mr,exports.joinWith=yr,exports.someU=or,exports.some=ur,exports.everyU=er,exports.every=tr,exports.every2U=ir,exports.every2=ar,exports.some2U=cr,exports.some2=sr,exports.cmpU=xr,exports.cmp=vr,exports.eqU=pr,exports.eq=lr;
},{"./caml.js":"gGFE","./curry.js":"NSLD","./js_math.js":"MeLz","./caml_option.js":"dzFO"}],"mJOW":[function(require,module,exports) {
"use strict";var r,t,e=require("./curry.js"),n=require("./belt_Array.js");function i(r,t,e,n,i){for(;;){var f=e,u=t;if(f>=n)return f;var a=r[f];if(!i(a,u))return f;e=f+1|0,t=a}}function f(r,t){var e=r.length;if(0===e||1===e)return e;var n=r[0],f=r[1];if(!t(n,f))return t(f,n)?0|-i(r,f,2,e,t):1;for(var u=f,a=2;;){var o=a,s=u;if(o>=e)return o;var v=r[o];if(!t(s,v))return o;a=o+1|0,u=v}}function u(r,t){return f(r,e.__2(t))}function a(r,t){var e=r.length;if(0===e)return!0;for(var n=0,i=e-1|0;;){var f=n;if(f===i)return!0;if(t(r[f],r[f+1|0])>0)return!1;n=f+1|0}}function o(r,t){return a(r,e.__2(t))}function s(r,t,e,i,f,u,a,o,s){for(var v=t+e|0,c=f+u|0,l=t,p=r[t],x=f,_=i[f],U=o;;){var b=U,y=_,S=x,h=p,g=l;if(s(h,y)<=0){a[b]=h;var d=g+1|0;if(d>=v)return n.blitUnsafe(i,S,a,b+1|0,c-S|0);U=b+1|0,p=r[d],l=d}else{a[b]=y;var B=S+1|0;if(B>=c)return n.blitUnsafe(r,g,a,b+1|0,v-g|0);U=b+1|0,_=i[B],x=B}}}function v(r,t,e,i,f,u,a,o,s){for(var v=t+e|0,c=f+u|0,l=t,p=r[t],x=f,_=i[f],U=o;;){var b=U,y=_,S=x,h=p,g=l,d=s(h,y);if(d<0){a[b]=h;var B=g+1|0,I=b+1|0;if(B<v){U=I,p=r[B],l=B;continue}return n.blitUnsafe(i,S,a,I,c-S|0),(I+c|0)-S|0}if(0!==d){a[b]=y;var j=S+1|0,q=b+1|0;if(!(j<c))return n.blitUnsafe(r,g,a,q,v-g|0),(q+v|0)-g|0;U=q,_=i[j],x=j}else{a[b]=h;var A=g+1|0,L=S+1|0,P=b+1|0;if(!(A<v&&L<c))return A===v?(n.blitUnsafe(i,L,a,P,c-L|0),(P+c|0)-L|0):(n.blitUnsafe(r,A,a,P,v-A|0),(P+v|0)-A|0);U=P,_=i[L],x=L,p=r[A],l=A}}}function c(r,t,n,i,f,u,a,o,s){return v(r,t,n,i,f,u,a,o,e.__2(s))}function l(r,t,e,n,i,f,u,a,o){for(var s=t+e|0,v=i+f|0,c=t,l=r[t],p=i,x=n[i],_=a;;){var U=_,b=p,y=l,S=c,h=o(y,x);if(h<0){var g=S+1|0;if(g>=s)return U;l=r[g],c=g}else if(0!==h){var d=b+1|0;if(d>=v)return U;x=n[d],p=d}else{u[U]=y;var B=S+1|0,I=b+1|0,j=U+1|0;if(!(B<s&&I<v))return j;_=j,x=n[I],p=I,l=r[B],c=B}}}function p(r,t,n,i,f,u,a,o,s){return l(r,t,n,i,f,u,a,o,e.__2(s))}function x(r,t,e,i,f,u,a,o,s){for(var v=t+e|0,c=f+u|0,l=t,p=r[t],x=f,_=i[f],U=o;;){var b=U,y=x,S=p,h=l,g=s(S,_);if(g<0){a[b]=S;var d=b+1|0,B=h+1|0;if(B>=v)return d;U=d,p=r[B],l=B}else if(0!==g){var I=y+1|0;if(!(I<c))return n.blitUnsafe(r,h,a,b,v-h|0),(b+v|0)-h|0;_=i[I],x=I}else{var j=h+1|0,q=y+1|0;if(!(j<v&&q<c))return j===v?b:(n.blitUnsafe(r,j,a,b,v-j|0),(b+v|0)-j|0);_=i[q],x=q,p=r[j],l=j}}}function _(r,t,n,i,f,u,a,o,s){return x(r,t,n,i,f,u,a,o,e.__2(s))}function U(r,t,e,n,i,f){for(var u=0;u<i;++u){for(var a=r[t+u|0],o=(n+u|0)-1|0;o>=n&&f(e[o],a)>0;)e[o+1|0]=e[o],o=o-1|0;e[o+1|0]=a}}function b(r,t,e,n,i,f){if(i<=5)return U(r,t,e,n,i,f);var u=i/2|0,a=i-u|0;return b(r,t+u|0,e,n+u|0,a,f),b(r,t,r,t+a|0,u,f),s(r,t+a|0,u,e,n+u|0,a,e,n,f)}function y(r,t){var e=r.length;if(e<=5)return U(r,0,r,0,e,t);var n=e/2|0,i=e-n|0,f=new Array(i);return b(r,n,f,0,i,t),b(r,0,r,i,n,t),s(r,i,n,f,0,i,r,0,t)}function S(r,t){return y(r,e.__2(t))}function h(r,t){var e=r.slice(0);return y(e,t),e}function g(r,t){return h(r,e.__2(t))}function d(r,t,e){var n=r.length;if(0===n)return-1;if(e(t,r[0])<0)return-1;if(e(t,r[n-1|0])>0)return 0|-(n+1|0);for(var i=0,f=n-1|0;;){var u=f,a=i,o=(a+u|0)/2|0,s=e(t,r[o]);if(0===s)return o;if(s<0){if(u===o)return 0===e(r[a],t)?a:0|-(u+1|0);f=o}else{if(a===o)return 0===e(r[u],t)?u:0|-(u+1|0);i=o}}}function B(r,t,n){return d(r,t,e.__2(n))}exports.Int=r,exports.$$String=t,exports.strictlySortedLengthU=f,exports.strictlySortedLength=u,exports.isSortedU=a,exports.isSorted=o,exports.stableSortInPlaceByU=y,exports.stableSortInPlaceBy=S,exports.stableSortByU=h,exports.stableSortBy=g,exports.binarySearchByU=d,exports.binarySearchBy=B,exports.unionU=v,exports.union=c,exports.intersectU=l,exports.intersect=p,exports.diffU=x,exports.diff=_;
},{"./curry.js":"NSLD","./belt_Array.js":"yUxI"}],"H9fU":[function(require,module,exports) {
"use strict";var r=require("./curry.js"),t=require("./belt_Array.js"),n=require("./caml_option.js"),e=require("./belt_SortArray.js");function o(r){if(r)return n.some(r.hd)}function u(r){if(r)return r.hd;throw{RE_EXN_ID:"Not_found",Error:new Error}}function f(r){if(r)return r.tl}function i(r){if(r)return r.tl;throw{RE_EXN_ID:"Not_found",Error:new Error}}function l(r,t){return{hd:t,tl:r}}function a(r,t){if(!(t<0))for(var e=r,o=t;;){var u=o,f=e;if(!f)return;if(0===u)return n.some(f.hd);o=u-1|0,e=f.tl}}function d(r,t){if(t<0)throw{RE_EXN_ID:"Not_found",Error:new Error};for(var n=r,e=t;;){var o=e,u=n;if(!u)throw{RE_EXN_ID:"Not_found",Error:new Error};if(0===o)return u.hd;e=o-1|0,n=u.tl}}function h(r,t,n,e){for(;;){var o=e,u=n,f=t;if(!f)return;var i=f.tl,l=f.hd,a={hd:l,tl:0};r(l)?(u.tl=a,n=a,t=i):(o.tl=a,e=a,t=i)}}function s(r,t,n){for(;;){var e=n,o=t,u=r;if(!u)return;var f=u.hd,i={hd:f[0],tl:0},l={hd:f[1],tl:0};o.tl=i,e.tl=l,n=l,t=i,r=u.tl}}function c(r,t){for(;;){var n=t,e=r;if(!e)return n;var o={hd:e.hd,tl:0};n.tl=o,t=o,r=e.tl}}function v(r,t,n){for(;;){var e=n,o=t;if(!o)return;var u=o.tl,f=o.hd;if(r(f)){var i={hd:f,tl:0};e.tl=i,n=i,t=u}else t=u}}function p(r,t,n,e){for(;;){var o=e,u=n,f=t;if(!f)return;var i=f.tl,l=f.hd;if(r(l,o)){var a={hd:l,tl:0};u.tl=a,e=o+1|0,n=a,t=i}else e=o+1|0,t=i}}function x(r,t,e){for(;;){var o=e,u=t;if(!u)return;var f=u.tl,i=r(u.hd);if(void 0===i)t=f;else{var l={hd:n.valFromOption(i),tl:0};o.tl=l,e=l,t=f}}}function _(r,t,n,e){for(;;){var o=n,u=r;if(!u)return!1;var f=u.tl,i=u.hd;if(e(i[0],t))return o.tl=f,!0;var l={hd:i,tl:0};o.tl=l,n=l,r=f}}function U(r,t,n,e,o){for(;;){var u=e,f=r;if(!f)return!1;var i=f.tl,l=f.hd;if(o(l[0],t))return u.tl={hd:[t,n],tl:i},!0;var a={hd:l,tl:0};u.tl=a,e=a,r=i}}function m(r,t,n){for(;;){var e=t,o=r;if(!o)return;var u={hd:n(o.hd),tl:0};e.tl=u,t=u,r=o.tl}}function E(r,t,n){for(;;){var e=n,o=t,u=r;if(!u)return;if(!o)return;var f={hd:[u.hd,o.hd],tl:0};e.tl=f,n=f,t=o.tl,r=u.tl}}function y(r,t,n,e){for(;;){var o=e,u=n,f=t;if(!f)return;if(!u)return;var i={hd:r(f.hd,u.hd),tl:0};o.tl=i,e=i,n=u.tl,t=f.tl}}function I(r,t,n,e){for(;;){var o=e,u=n,f=t;if(!u)return;var i={hd:r(f,u.hd),tl:0};o.tl=i,e=i,n=u.tl,t=f+1|0}}function A(r,t,n){for(;;){var e=n,o=t,u=r;if(0===u)return!0;if(!o)return!1;var f={hd:o.hd,tl:0};e.tl=f,n=f,t=o.tl,r=u-1|0}}function R(r,t,n){for(;;){var e=n,o=t,u=r;if(0===u)return o;if(!o)return;var f={hd:o.hd,tl:0};e.tl=f,n=f,t=o.tl,r=u-1|0}}function g(r,t){if(!(t<0)){if(0===t)return 0;if(r){var n={hd:r.hd,tl:0};return A(t-1|0,r.tl,n)?n:void 0}}}function k(r,t){if(!(t<0))for(var n=r,e=t;;){if(0===e)return n;if(!n)return;e=e-1|0,n=n.tl}}function w(r,t){if(!(t<0)){if(0===t)return[0,r];if(r){var n={hd:r.hd,tl:0},e=R(t-1|0,r.tl,n);return void 0!==e?[n,e]:void 0}}}function W(r,t){if(!r)return t;var n={hd:r.hd,tl:0};return c(r.tl,n).tl=t,n}function B(r,t){if(!r)return 0;var n={hd:t(r.hd),tl:0};return m(r.tl,n,t),n}function N(t,n){return B(t,r.__1(n))}function q(r,t,n){if(!r)return 0;if(!t)return 0;var e={hd:n(r.hd,t.hd),tl:0};return y(n,r.tl,t.tl,e),e}function z(t,n,e){return q(t,n,r.__2(e))}function j(r,t){if(!r)return 0;var n={hd:t(0,r.hd),tl:0};return I(t,1,r.tl,n),n}function D(t,n){return j(t,r.__2(n))}function X(r,t){if(r<=0)return 0;for(var n={hd:t(0),tl:0},e=n,o=1;o<r;){var u={hd:t(o),tl:0};e.tl=u,e=u,o=o+1|0}return n}function b(t,n){return X(t,r.__1(n))}function M(r,t){if(r<=0)return 0;for(var n={hd:t,tl:0},e=n,o=1;o<r;){var u={hd:t,tl:0};e.tl=u,e=u,o=o+1|0}return n}function F(r){for(var t=r,n=0;;){if(!t)return n;n=n+1|0,t=t.tl}}function O(r,t,n){for(;;){var e=n,o=t;if(!e)return;r[o]=e.hd,n=e.tl,t=o+1|0}}function P(r){for(var t=r.length-1|0,n=0;;){var e=n,o=t;if(o<0)return e;n={hd:r[o],tl:e},t=o-1|0}}function S(r){var t=F(r),n=new Array(t);return O(n,0,r),n}function C(r){var n=S(r);return t.shuffleInPlace(n),P(n)}function L(r,t){for(;;){var n=t,e=r;if(!e)return n;t={hd:e.hd,tl:n},r=e.tl}}function G(r){return L(r,0)}function H(r,t){for(;;){var n=t,e=r;if(!n)return void(e.tl=0);t=n.tl,r=c(n.hd,e)}}function J(r){for(;;){var t=r;if(!t)return 0;var n=t.hd;if(n){var e={hd:n.hd,tl:0};return H(c(n.tl,e),t.tl),e}r=t.tl}}function K(r){var t=r.length;if(1===t)return r[0];if(0===t)return 0;for(var n=r.length,e=r[n-1|0],o=n-2|0;o>=0;--o)e=W(r[o],e);return e}function Q(r,t){for(var n=0,e=r;;){var o=e,u=n;if(!o)return u;e=o.tl,n={hd:t(o.hd),tl:u}}}function T(t,n){return Q(t,r.__1(n))}function V(r,t){for(;;){var n=r;if(!n)return;t(n.hd),r=n.tl}}function Y(t,n){return V(t,r.__1(n))}function Z(r,t){for(var n=r,e=0;;){var o=e,u=n;if(!u)return;t(o,u.hd),e=o+1|0,n=u.tl}}function $(t,n){return Z(t,r.__2(n))}function rr(r,t,n){for(;;){var e=r;if(!e)return t;t=n(t,e.hd),r=e.tl}}function tr(t,n,e){return rr(t,n,r.__2(e))}function nr(r,t,n){return r?n(nr(r.tl,t,n),r.hd):t}function er(r,n,e){return F(r)<1e3?nr(r,n,e):t.reduceReverseU(S(r),n,e)}function or(t,n,e){return er(t,n,r.__2(e))}function ur(r,t,n){for(var e=r,o=t,u=0;;){var f=u,i=e;if(!i)return o;u=f+1|0,o=n(o,i.hd,f),e=i.tl}}function fr(t,n,e){return ur(t,n,r.__3(e))}function ir(r,t,n){for(var e=r,o=t,u=0;;){var f=u,i=o,l=e;if(!l)return f;if(!i)return f;u={hd:n(l.hd,i.hd),tl:f},o=i.tl,e=l.tl}}function lr(t,n,e){return ir(t,n,r.__2(e))}function ar(r,t,n){for(;;){var e=t,o=r;if(!o)return;if(!e)return;n(o.hd,e.hd),t=e.tl,r=o.tl}}function dr(t,n,e){return ar(t,n,r.__2(e))}function hr(r,t,n,e){for(;;){var o=t,u=r;if(!u)return n;if(!o)return n;n=e(n,u.hd,o.hd),t=o.tl,r=u.tl}}function sr(t,n,e,o){return hr(t,n,e,r.__3(o))}function cr(r,t,n,e){return r&&t?e(cr(r.tl,t.tl,n,e),r.hd,t.hd):n}function vr(r,n,e,o){return F(r)<1e3?cr(r,n,e,o):t.reduceReverse2U(S(r),S(n),e,o)}function pr(t,n,e,o){return vr(t,n,e,r.__3(o))}function xr(r,t){for(;;){var n=r;if(!n)return!0;if(!t(n.hd))return!1;r=n.tl}}function _r(t,n){return xr(t,r.__1(n))}function Ur(r,t){for(;;){var n=r;if(!n)return!1;if(t(n.hd))return!0;r=n.tl}}function mr(t,n){return Ur(t,r.__1(n))}function Er(r,t,n){for(;;){var e=t,o=r;if(!o)return!0;if(!e)return!0;if(!n(o.hd,e.hd))return!1;t=e.tl,r=o.tl}}function yr(t,n,e){return Er(t,n,r.__2(e))}function Ir(r,t){for(;;){var n=r;if(!n)return t?-1:0;if(!t)return 1;t=t.tl,r=n.tl}}function Ar(r,t,n){for(;;){var e=t,o=r;if(!o)return e?-1:0;if(!e)return 1;var u=n(o.hd,e.hd);if(0!==u)return u;t=e.tl,r=o.tl}}function Rr(t,n,e){return Ar(t,n,r.__2(e))}function gr(r,t,n){for(;;){var e=t,o=r;if(!o)return!e;if(!e)return!1;if(!n(o.hd,e.hd))return!1;t=e.tl,r=o.tl}}function kr(t,n,e){return gr(t,n,r.__2(e))}function wr(r,t,n){for(;;){var e=t,o=r;if(!o)return!1;if(!e)return!1;if(n(o.hd,e.hd))return!0;t=e.tl,r=o.tl}}function Wr(t,n,e){return wr(t,n,r.__2(e))}function Br(r,t,n){for(;;){var e=r;if(!e)return!1;if(n(e.hd,t))return!0;r=e.tl}}function Nr(t,n,e){return Br(t,n,r.__2(e))}function qr(r,t,e){for(;;){var o=r;if(!o)return;var u=o.hd;if(e(u[0],t))return n.some(u[1]);r=o.tl}}function zr(t,n,e){return qr(t,n,r.__2(e))}function jr(r,t,n){for(;;){var e=r;if(!e)return!1;if(n(e.hd[0],t))return!0;r=e.tl}}function Dr(t,n,e){return jr(t,n,r.__2(e))}function Xr(r,t,n){if(!r)return 0;var e=r.tl,o=r.hd;if(n(o[0],t))return e;var u={hd:o,tl:0};return _(e,t,u,n)?u:r}function br(t,n,e){return Xr(t,n,r.__2(e))}function Mr(r,t,n,e){if(!r)return{hd:[t,n],tl:0};var o=r.tl,u=r.hd;if(e(u[0],t))return{hd:[t,n],tl:o};var f={hd:u,tl:0};return U(o,t,n,f,e)?f:{hd:[t,n],tl:r}}function Fr(t,n,e,o){return Mr(t,n,e,r.__2(o))}function Or(r,t){var n=S(r);return e.stableSortInPlaceByU(n,t),P(n)}function Pr(t,n){return Or(t,r.__2(n))}function Sr(r,t){for(;;){var e=r;if(!e)return;var o=e.hd;if(t(o))return n.some(o);r=e.tl}}function Cr(t,n){return Sr(t,r.__1(n))}function Lr(r,t){for(;;){var n=r;if(!n)return 0;var e=n.tl,o=n.hd;if(t(o)){var u={hd:o,tl:0};return v(t,e,u),u}r=e}}function Gr(t,n){return Lr(t,r.__1(n))}function Hr(r,t){for(var n=r,e=0;;){var o=e,u=n;if(!u)return 0;var f=u.tl,i=u.hd;if(t(i,o)){var l={hd:i,tl:0};return p(t,f,l,o+1|0),l}e=o+1|0,n=f}}function Jr(t,n){return Hr(t,r.__2(n))}function Kr(r,t){for(;;){var e=r;if(!e)return 0;var o=e.tl,u=t(e.hd);if(void 0!==u){var f={hd:n.valFromOption(u),tl:0};return x(t,o,f),f}r=o}}function Qr(t,n){return Kr(t,r.__1(n))}function Tr(r,t){if(!r)return[0,0];var n=r.hd,e={hd:n,tl:0},o={hd:n,tl:0},u=t(n);return h(t,r.tl,e,o),u?[e,o.tl]:[e.tl,o]}function Vr(t,n){return Tr(t,r.__1(n))}function Yr(r){if(!r)return[0,0];var t=r.hd,n={hd:t[0],tl:0},e={hd:t[1],tl:0};return s(r.tl,n,e),[n,e]}function Zr(r,t){if(!r)return 0;if(!t)return 0;var n={hd:[r.hd,t.hd],tl:0};return E(r.tl,t.tl,n),n}var $r=F,rt=Gr,tt=Jr;exports.length=F,exports.size=$r,exports.head=o,exports.headExn=u,exports.tail=f,exports.tailExn=i,exports.add=l,exports.get=a,exports.getExn=d,exports.make=M,exports.makeByU=X,exports.makeBy=b,exports.shuffle=C,exports.drop=k,exports.take=g,exports.splitAt=w,exports.concat=W,exports.concatMany=K,exports.reverseConcat=L,exports.flatten=J,exports.mapU=B,exports.map=N,exports.zip=Zr,exports.zipByU=q,exports.zipBy=z,exports.mapWithIndexU=j,exports.mapWithIndex=D,exports.fromArray=P,exports.toArray=S,exports.reverse=G,exports.mapReverseU=Q,exports.mapReverse=T,exports.forEachU=V,exports.forEach=Y,exports.forEachWithIndexU=Z,exports.forEachWithIndex=$,exports.reduceU=rr,exports.reduce=tr,exports.reduceWithIndexU=ur,exports.reduceWithIndex=fr,exports.reduceReverseU=er,exports.reduceReverse=or,exports.mapReverse2U=ir,exports.mapReverse2=lr,exports.forEach2U=ar,exports.forEach2=dr,exports.reduce2U=hr,exports.reduce2=sr,exports.reduceReverse2U=vr,exports.reduceReverse2=pr,exports.everyU=xr,exports.every=_r,exports.someU=Ur,exports.some=mr,exports.every2U=Er,exports.every2=yr,exports.some2U=wr,exports.some2=Wr,exports.cmpByLength=Ir,exports.cmpU=Ar,exports.cmp=Rr,exports.eqU=gr,exports.eq=kr,exports.hasU=Br,exports.has=Nr,exports.getByU=Sr,exports.getBy=Cr,exports.keepU=Lr,exports.keep=Gr,exports.filter=rt,exports.keepWithIndexU=Hr,exports.keepWithIndex=Jr,exports.filterWithIndex=tt,exports.keepMapU=Kr,exports.keepMap=Qr,exports.partitionU=Tr,exports.partition=Vr,exports.unzip=Yr,exports.getAssocU=qr,exports.getAssoc=zr,exports.hasAssocU=jr,exports.hasAssoc=Dr,exports.removeAssocU=Xr,exports.removeAssoc=br,exports.setAssocU=Mr,exports.setAssoc=Fr,exports.sortU=Or,exports.sort=Pr;
},{"./curry.js":"NSLD","./belt_Array.js":"yUxI","./caml_option.js":"dzFO","./belt_SortArray.js":"mJOW"}],"tKwj":[function(require,module,exports) {
"use strict";var r=require("./curry.js");function t(r){if(0===r.TAG)return r._0;throw{RE_EXN_ID:"Not_found",Error:new Error}}function n(r,t,n){return 0===r.TAG?n(r._0):t}function e(t,e,u){return n(t,e,r.__1(u))}function u(r,t){return 0===r.TAG?{TAG:0,_0:t(r._0)}:{TAG:1,_0:r._0}}function o(t,n){return u(t,r.__1(n))}function _(r,t){return 0===r.TAG?t(r._0):{TAG:1,_0:r._0}}function i(t,n){return _(t,r.__1(n))}function p(r,t){return 0===r.TAG?r._0:t}function f(r){return 0===r.TAG}function s(r){return 0!==r.TAG}function c(r,t,n){return 0===r.TAG?0===t.TAG&&n(r._0,t._0):0!==t.TAG}function A(t,n,e){return c(t,n,r.__2(e))}function G(r,t,n){return 0===r.TAG?0===t.TAG?n(r._0,t._0):1:0===t.TAG?-1:0}function T(t,n,e){return G(t,n,r.__2(e))}exports.getExn=t,exports.mapWithDefaultU=n,exports.mapWithDefault=e,exports.mapU=u,exports.map=o,exports.flatMapU=_,exports.flatMap=i,exports.getWithDefault=p,exports.isOk=f,exports.isError=s,exports.eqU=c,exports.eq=A,exports.cmpU=G,exports.cmp=T;
},{"./curry.js":"NSLD"}],"ApXr":[function(require,module,exports) {
"use strict";var r=require("./curry.js"),t=require("./caml_option.js"),n=require("./belt_SortArray.js");function e(r){return void 0!==r?r.h:0}function o(r){return void 0!==r?{k:r.k,v:r.v,h:r.h,l:o(r.l),r:o(r.r)}:r}function i(r,t,n,o){var i=e(r),u=e(o);return{k:t,v:n,h:i>=u?i+1|0:u+1|0,l:r,r:o}}function u(r,t){return{k:r,v:t,h:1,l:void 0,r:void 0}}function v(r,t){return void 0===t||void 0!==r&&r.h>=t.h}function f(r,t){return r.v===t?r:{k:r.k,v:t,h:r.h,l:r.l,r:r.r}}function a(r,t,n,o){var u=void 0!==r?r.h:0,v=void 0!==o?o.h:0;if(u>(v+2|0)){var f=r.l,a=r.r;return e(f)>=e(a)?i(f,r.k,r.v,i(a,t,n,o)):i(i(f,r.k,r.v,a.l),a.k,a.v,i(a.r,t,n,o))}if(v<=(u+2|0))return{k:t,v:n,h:u>=v?u+1|0:v+1|0,l:r,r:o};var c=o.l,s=o.r;return e(s)>=e(c)?i(i(r,t,n,c),o.k,o.v,s):i(i(r,t,n,c.l),c.k,c.v,i(c.r,o.k,o.v,s))}function c(r){for(;;){var t=r,n=t.l;if(void 0===n)return t.k;r=n}}function s(r){if(void 0!==r)return t.some(c(r))}function d(r){if(void 0!==r)return c(r)}function l(r){for(;;){var t=r,n=t.r;if(void 0===n)return t.k;r=n}}function p(r){if(void 0!==r)return t.some(l(r))}function x(r){if(void 0!==r)return l(r)}function k(r){for(;;){var t=r,n=t.l;if(void 0===n)return[t.k,t.v];r=n}}function h(r){if(void 0!==r)return k(r)}function m(r){if(void 0!==r)return k(r)}function _(r){for(;;){var t=r,n=t.r;if(void 0===n)return[t.k,t.v];r=n}}function y(r){if(void 0!==r)return _(r)}function A(r){if(void 0!==r)return _(r)}function U(r,t,n){var e=r.l;return void 0!==e?a(U(e,t,n),r.k,r.v,r.r):(t.contents=r.k,n.contents=r.v,r.r)}function E(r){return void 0===r}function g(r,t){for(;;){if(void 0===r)return t;t={hd:r,tl:t},r=r.l}}function w(r,t){if(void 0!==r){var n=w(r.l,t);if(void 0!==n)return n;var e=r.k,o=r.v;if(t(e,o))return[e,o];var i=w(r.r,t);return void 0!==i?i:void 0}}function S(t,n){return w(t,r.__2(n))}function M(r,t){for(;;){var n=r;if(void 0===n)return;M(n.l,t),t(n.k,n.v),r=n.r}}function K(t,n){return M(t,r.__2(n))}function q(r,t){if(void 0!==r){var n=q(r.l,t),e=t(r.v),o=q(r.r,t);return{k:r.k,v:e,h:r.h,l:n,r:o}}}function R(t,n){return q(t,r.__1(n))}function W(r,t){if(void 0!==r){var n=r.k,e=W(r.l,t),o=t(n,r.v),i=W(r.r,t);return{k:n,v:o,h:r.h,l:e,r:i}}}function b(t,n){return W(t,r.__2(n))}function j(r,t,n){for(;;){var e=t,o=r;if(void 0===o)return e;var i=o.k,u=o.v,v=o.l,f=o.r;t=n(j(v,e,n),i,u),r=f}}function F(t,n,e){return j(t,n,r.__3(e))}function I(r,t){for(;;){var n=r;if(void 0===n)return!0;if(!t(n.k,n.v))return!1;if(!I(n.l,t))return!1;r=n.r}}function L(t,n){return I(t,r.__2(n))}function N(r,t){for(;;){var n=r;if(void 0===n)return!1;if(t(n.k,n.v))return!0;if(N(n.l,t))return!0;r=n.r}}function D(t,n){return N(t,r.__2(n))}function O(r,t,n){return void 0!==r?a(O(r.l,t,n),r.k,r.v,r.r):u(t,n)}function B(r,t,n){return void 0!==r?a(r.l,r.k,r.v,B(r.r,t,n)):u(t,n)}function T(r,t,n,e){if(void 0===r)return O(e,t,n);if(void 0===e)return B(r,t,n);var o=r.k,u=r.v,v=r.h,f=r.l,c=r.r,s=e.k,d=e.v,l=e.h,p=e.l,x=e.r;return v>(l+2|0)?a(f,o,u,T(c,t,n,e)):l>(v+2|0)?a(T(r,t,n,p),s,d,x):i(r,t,n,e)}function V(r,t){if(void 0===r)return t;if(void 0===t)return r;var n={contents:t.k},e={contents:t.v},o=U(t,n,e);return T(r,n.contents,e.contents,o)}function X(r,n,e,o){return void 0!==e?T(r,n,t.valFromOption(e),o):V(r,o)}function z(r,t){if(void 0!==r){var n=r.k,e=r.v,o=z(r.l,t),i=t(n,e),u=z(r.r,t);return i?T(o,n,e,u):V(o,u)}}function J(t,n){return z(t,r.__2(n))}function C(r,n){if(void 0!==r){var e=r.k,o=r.v,i=C(r.l,n),u=n(e,o),v=C(r.r,n);return void 0!==u?T(i,e,t.valFromOption(u),v):V(i,v)}}function G(t,n){return C(t,r.__2(n))}function H(r,t){if(void 0===r)return[void 0,void 0];var n=r.k,e=r.v,o=H(r.l,t),i=o[1],u=o[0],v=t(n,e),f=H(r.r,t),a=f[1],c=f[0];return v?[T(u,n,e,c),V(i,a)]:[V(u,c),T(i,n,e,a)]}function P(t,n){return H(t,r.__2(n))}function Q(r){var t=r.l,n=r.r;return(1+(void 0!==t?Q(t):0)|0)+(void 0!==n?Q(n):0)|0}function Y(r){return void 0!==r?Q(r):0}function Z(r,t){for(;;){var n=t,e=r;if(void 0===e)return n;var o=e.k,i=e.v,u=e.l;t={hd:[o,i],tl:Z(e.r,n)},r=u}}function $(r){return Z(r,0)}function rr(r){for(;;){var t=r;if(void 0===t)return;var n=t.l,o=t.r,i=e(n)-e(o)|0;if(!(i<=2&&i>=-2))throw{RE_EXN_ID:"Assert_failure",_1:["belt_internalAVLtree.ml",373,4],Error:new Error};rr(n),r=o}}function tr(r,t,n){for(;;){var e=t,o=r,i=o.k,u=o.l,v=o.r,f=void 0!==u?tr(u,e,n):e;n[f]=i;var a=f+1|0;if(void 0===v)return a;t=a,r=v}}function nr(r,t,n){for(;;){var e=t,o=r,i=o.l,u=o.r,v=void 0!==i?nr(i,e,n):e;n[v]=o.v;var f=v+1|0;if(void 0===u)return f;t=f,r=u}}function er(r,t,n){for(;;){var e=t,o=r,i=o.l,u=o.k,v=o.r,f=void 0!==i?er(i,e,n):e;n[f]=[u,o.v];var a=f+1|0;if(void 0===v)return a;t=a,r=v}}function or(r){if(void 0===r)return[];var t=Q(r),n=new Array(t);return er(r,0,n),n}function ir(r){if(void 0===r)return[];var t=Q(r),n=new Array(t);return tr(r,0,n),n}function ur(r){if(void 0===r)return[];var t=Q(r),n=new Array(t);return nr(r,0,n),n}function vr(r,t,n){switch(n){case 0:return;case 1:var e=r[t];return u(e[0],e[1]);case 2:var o=r[t],v=r[t-1|0],f=o;return{k:v[0],v:v[1],h:2,l:u(f[0],f[1]),r:void 0};case 3:var a=r[t],c=r[t-1|0],s=r[t-2|0],d=c,l=a;return{k:d[0],v:d[1],h:2,l:u(l[0],l[1]),r:u(s[0],s[1])};default:var p=n/2|0,x=vr(r,t,p),k=r[t-p|0],h=vr(r,(t-p|0)-1|0,(n-p|0)-1|0);return i(x,k[0],k[1],h)}}function fr(r,t,n){switch(n){case 0:return;case 1:var e=r[t];return u(e[0],e[1]);case 2:var o=r[t],v=r[t+1|0],f=o;return{k:v[0],v:v[1],h:2,l:u(f[0],f[1]),r:void 0};case 3:var a=r[t],c=r[t+1|0],s=r[t+2|0],d=c,l=a;return{k:d[0],v:d[1],h:2,l:u(l[0],l[1]),r:u(s[0],s[1])};default:var p=n/2|0,x=fr(r,t,p),k=r[t+p|0],h=fr(r,1+(t+p|0)|0,(n-p|0)-1|0);return i(x,k[0],k[1],h)}}function ar(r){return fr(r,0,r.length)}function cr(r,t,n,e){var o=Y(r),i=Y(t);if(o!==i)return o<i?-1:1;for(var u=g(r,0),v=g(t,0);;){var f=v,a=u;if(!a)return 0;if(!f)return 0;var c=f.hd,s=a.hd,d=n(s.k,c.k);if(0!==d)return d;var l=e(s.v,c.v);if(0!==l)return l;v=g(c.r,f.tl),u=g(s.r,a.tl)}}function sr(t,n,e,o){return cr(t,n,e,r.__2(o))}function dr(r,t,n,e){if(Y(r)!==Y(t))return!1;for(var o=g(r,0),i=g(t,0);;){var u=i,v=o;if(!v)return!0;if(!u)return!0;var f=u.hd,a=v.hd;if(0!==n(a.k,f.k)||!e(a.v,f.v))return!1;i=g(f.r,u.tl),o=g(a.r,v.tl)}}function lr(t,n,e,o){return dr(t,n,e,r.__2(o))}function pr(r,n,e){for(;;){var o=r;if(void 0===o)return;var i=e(n,o.k);if(0===i)return t.some(o.v);r=i<0?o.l:o.r}}function xr(r,t,n){for(;;){var e=r;if(void 0===e)return;var o=n(t,e.k);if(0===o)return e.v;r=o<0?e.l:e.r}}function kr(r,t,n){for(;;){var e=r;if(void 0===e)throw{RE_EXN_ID:"Not_found",Error:new Error};var o=n(t,e.k);if(0===o)return e.v;r=o<0?e.l:e.r}}function hr(r,t,n,e){for(;;){var o=r;if(void 0===o)return n;var i=e(t,o.k);if(0===i)return o.v;r=i<0?o.l:o.r}}function mr(r,t,n){for(;;){var e=r;if(void 0===e)return!1;var o=n(t,e.k);if(0===o)return!0;r=o<0?e.l:e.r}}function _r(r){var t=r.l;r.l=t.r,t.r=r;var n=e(r.l),o=e(r.r);r.h=(n>o?n:o)+1|0;var i=e(t.l),u=r.h;return t.h=(i>u?i:u)+1|0,t}function yr(r){var t=r.r;r.r=t.l,t.l=r;var n=e(r.l),o=e(r.r);r.h=(n>o?n:o)+1|0;var i=e(t.r),u=r.h;return t.h=(i>u?i:u)+1|0,t}function Ar(r){var t=yr(r.l);return r.l=t,_r(r)}function Ur(r){var t=_r(r.r);return r.r=t,yr(r)}function Er(r){var t=e(r.l),n=e(r.r);return r.h=(t>n?t:n)+1|0,r}function gr(r){var t=r.l,n=r.r,o=e(t),i=e(n);if(o>(2+i|0))return v(t.l,t.r)?Er(_r(r)):Er(Ar(r));if(i>(2+o|0)){var u=n.l;return v(n.r,u)?Er(yr(r)):Er(Ur(r))}return r.h=(o>i?o:i)+1|0,r}function wr(r,t,n,e){if(void 0===r)return u(t,n);var o=e(t,r.k);if(0===o)return r.v=n,r;var i=r.l,v=r.r;if(o<0){var f=wr(i,t,n,e);r.l=f}else r.r=wr(v,t,n,e);return gr(r)}function Sr(r,t){var e=r.length;if(0!==e){var o,i=n.strictlySortedLengthU(r,function(r,n){return t(r[0],n[0])<0});o=i>=0?fr(r,0,i):vr(r,(i=0|-i)-1|0,i);for(var u=i;u<e;++u){var v=r[u];o=wr(o,v[0],v[1],t)}return o}}function Mr(r,t){var n=t.r,e=t.l;return void 0!==e?(t.l=Mr(r,e),gr(t)):(r.k=t.k,r.v=t.v,n)}exports.copy=o,exports.create=i,exports.bal=a,exports.singleton=u,exports.updateValue=f,exports.minKey=s,exports.minKeyUndefined=d,exports.maxKey=p,exports.maxKeyUndefined=x,exports.minimum=h,exports.minUndefined=m,exports.maximum=y,exports.maxUndefined=A,exports.removeMinAuxWithRef=U,exports.isEmpty=E,exports.stackAllLeft=g,exports.findFirstByU=w,exports.findFirstBy=S,exports.forEachU=M,exports.forEach=K,exports.mapU=q,exports.map=R,exports.mapWithKeyU=W,exports.mapWithKey=b,exports.reduceU=j,exports.reduce=F,exports.everyU=I,exports.every=L,exports.someU=N,exports.some=D,exports.join=T,exports.concat=V,exports.concatOrJoin=X,exports.keepSharedU=z,exports.keepShared=J,exports.keepMapU=C,exports.keepMap=G,exports.partitionSharedU=H,exports.partitionShared=P,exports.lengthNode=Q,exports.size=Y,exports.toList=$,exports.checkInvariantInternal=rr,exports.fillArray=er,exports.toArray=or,exports.keysToArray=ir,exports.valuesToArray=ur,exports.fromSortedArrayAux=fr,exports.fromSortedArrayRevAux=vr,exports.fromSortedArrayUnsafe=ar,exports.cmpU=cr,exports.cmp=sr,exports.eqU=dr,exports.eq=lr,exports.get=pr,exports.getUndefined=xr,exports.getWithDefault=hr,exports.getExn=kr,exports.has=mr,exports.fromArray=Sr,exports.updateMutate=wr,exports.balMutate=gr,exports.removeMinAuxWithRootMutate=Mr;
},{"./curry.js":"NSLD","./caml_option.js":"dzFO","./belt_SortArray.js":"mJOW"}],"aHaK":[function(require,module,exports) {
"use strict";var t,r,e=require("./curry.js"),n=require("./caml_option.js"),a=require("./belt_internalAVLtree.js");function o(t,r,e){var n=e(r,t.k);if(0===n){var u=t.l,i=t.r;return void 0!==u?void 0!==i?(t.r=a.removeMinAuxWithRootMutate(t,i),a.balMutate(t)):u:void 0!==i?i:u}if(n<0){var d=t.l;return void 0!==d?(t.l=o(d,r,e),a.balMutate(t)):t}var c=t.r;return void 0!==c?(t.r=o(c,r,e),a.balMutate(t)):t}function u(t,r){var e=t.data;if(void 0!==e){var n=o(e,r,t.cmp);n===e||(t.data=n)}}function i(t,r,e,n,a){for(;;){var u=e;if(u>=n)return t;var i=o(t,r[u],a);if(void 0===i)return;e=u+1|0,t=i}}function d(t,r){var e=t.data;if(void 0!==e){var n=i(e,r,0,r.length,t.cmp);n===e||(t.data=n)}}function c(t,r,e,o){if(void 0!==t){var u=o(r,t.k);if(0===u){var i=e(n.some(t.v));if(void 0!==i)return t.v=n.valFromOption(i),t;var d=t.l,p=t.r;return void 0!==d?void 0!==p?(t.r=a.removeMinAuxWithRootMutate(t,p),a.balMutate(t)):d:void 0!==p?p:d}return u<0?t.l=c(t.l,r,e,o):t.r=c(t.r,r,e,o),a.balMutate(t)}var f=e(void 0);return void 0!==f?a.singleton(r,n.valFromOption(f)):t}function p(t,r,e){var n=t.data,a=c(n,r,e,t.cmp);a===n||(t.data=a)}function f(t,r,n){return p(t,r,e.__1(n))}function m(t){return{cmp:t.cmp,data:void 0}}function s(t){t.data=void 0}function x(t){return void 0===t.data}function v(t){return a.minKey(t.data)}function U(t){return a.minKeyUndefined(t.data)}function y(t){return a.maxKey(t.data)}function l(t){return a.maxKeyUndefined(t.data)}function _(t){return a.minimum(t.data)}function h(t){return a.minUndefined(t.data)}function g(t){return a.maximum(t.data)}function M(t){return a.maxUndefined(t.data)}function A(t,r){return a.forEachU(t.data,r)}function K(t,r){return a.forEachU(t.data,e.__2(r))}function k(t,r,e){return a.reduceU(t.data,r,e)}function E(t,r,n){return k(t,r,e.__3(n))}function W(t,r){return a.everyU(t.data,r)}function b(t,r){return a.everyU(t.data,e.__2(r))}function q(t,r){return a.someU(t.data,r)}function I(t,r){return a.someU(t.data,e.__2(r))}function T(t){return a.size(t.data)}function j(t){return a.toList(t.data)}function L(t){return a.toArray(t.data)}function z(t){return a.keysToArray(t.data)}function D(t){return a.valuesToArray(t.data)}function F(t){return a.checkInvariantInternal(t.data)}function O(t,r,e){return a.cmpU(t.data,r.data,t.cmp,e)}function R(t,r,n){return O(t,r,e.__2(n))}function $(t,r,e){return a.eqU(t.data,r.data,t.cmp,e)}function S(t,r,n){return $(t,r,e.__2(n))}function V(t,r){return{cmp:t.cmp,data:a.mapU(t.data,r)}}function w(t,r){return V(t,e.__1(r))}function B(t,r){return{cmp:t.cmp,data:a.mapWithKeyU(t.data,r)}}function C(t,r){return B(t,e.__2(r))}function G(t,r){return a.get(t.data,r,t.cmp)}function H(t,r){return a.getUndefined(t.data,r,t.cmp)}function J(t,r,e){return a.getWithDefault(t.data,r,e,t.cmp)}function N(t,r){return a.getExn(t.data,r,t.cmp)}function P(t,r){return a.has(t.data,r,t.cmp)}function Q(t,r){var e=r.cmp;return{cmp:e,data:a.fromArray(t,e)}}function X(t,r,e){var n=t.data,o=a.updateMutate(n,r,e,t.cmp);o===n||(t.data=o)}function Y(t,r,e){for(var n=t,o=0,u=r.length;o<u;++o){var i=r[o];n=a.updateMutate(n,i[0],i[1],e)}return n}function Z(t,r){var e=t.data,n=Y(e,r,t.cmp);n===e||(t.data=n)}exports.Int=t,exports.$$String=r,exports.make=m,exports.clear=s,exports.isEmpty=x,exports.has=P,exports.cmpU=O,exports.cmp=R,exports.eqU=$,exports.eq=S,exports.forEachU=A,exports.forEach=K,exports.reduceU=k,exports.reduce=E,exports.everyU=W,exports.every=b,exports.someU=q,exports.some=I,exports.size=T,exports.toList=j,exports.toArray=L,exports.fromArray=Q,exports.keysToArray=z,exports.valuesToArray=D,exports.minKey=v,exports.minKeyUndefined=U,exports.maxKey=y,exports.maxKeyUndefined=l,exports.minimum=_,exports.minUndefined=h,exports.maximum=g,exports.maxUndefined=M,exports.get=G,exports.getUndefined=H,exports.getWithDefault=J,exports.getExn=N,exports.checkInvariantInternal=F,exports.remove=u,exports.removeMany=d,exports.set=X,exports.updateU=p,exports.update=f,exports.mergeMany=Z,exports.mapU=V,exports.map=w,exports.mapWithKeyU=B,exports.mapWithKey=C;
},{"./curry.js":"NSLD","./caml_option.js":"dzFO","./belt_internalAVLtree.js":"ApXr"}],"cfqr":[function(require,module,exports) {
"use strict";var r=require("rescript/lib/js/curry.js"),e=require("rescript/lib/js/caml_obj.js"),t=e.caml_equal;function n(t,n,s){return e.caml_equal(r._1(t,n),r._1(t,s))}function s(r,e){return r===e}var i={contents:0};function c(r,e){var t=void 0!==r?r:"";return i.contents=i.contents+1|0,t+String(i.contents)}exports.eq=t,exports.eqBy=n,exports.identical=s,exports.idCounter=i,exports.uniqueId=c;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_obj.js":"p3B5"}],"QyI5":[function(require,module,exports) {
"use strict";var r=require("rescript/lib/js/list.js"),n=require("rescript/lib/js/curry.js");function t(t){var e=t.$$return,u=t.fmap,i="object"==typeof u?u.VAL:function(r,e){return n._2(t.bind,e,function(e){return n._1(t.$$return,n._1(r,e))})},o=t.bind,f=function(r,t){return n._2(o,r,function(r){return t})},c=function(t,u){if(!u)return n._1(e,r.rev(t));var i=u.tl;return n._2(o,u.hd,function(r){return c({hd:r,tl:t},i)})},a=function(r){if(!r)return n._1(e,void 0);var t=r.tl;return n._2(o,r.hd,function(r){return a(t)})};return{bind:t.bind,$$return:e,fmap:i,$great$great$eq:o,$less$$great:function(r,t){return n._2(i,t,r)},seq:f,$great$great:f,join:function(r){return n._2(o,r,function(r){return r})},all:function(r){return c(0,r)},all_ignore:a}}function e(t){var e=t.bind,u=t.$$return,i=t.fmap,o="object"==typeof i?i.VAL:function(r,t){return n._2(e,t,function(t){return n._1(u,n._1(r,t))})},f=function(r,t){return n._2(e,r,function(r){return t})},c=function(t,i){if(!i)return n._1(u,r.rev(t));var o=i.tl;return n._2(e,i.hd,function(r){return c({hd:r,tl:t},o)})},a=function(r){if(!r)return n._1(u,void 0);var t=r.tl;return n._2(e,r.hd,function(r){return a(t)})};return{bind:e,$$return:u,fmap:o,$great$great$eq:e,$less$$great:function(r,t){return n._2(o,t,r)},seq:f,$great$great:f,join:function(r){return n._2(e,r,function(r){return r})},all:function(r){return c(0,r)},all_ignore:a}}function u(t){var e=t.bind,u=t.$$return,i=t.fmap,o="object"==typeof i?i.VAL:function(r,t){return n._2(e,t,function(t){return n._1(u,n._1(r,t))})},f=function(r,t){return n._2(e,r,function(r){return t})},c=function(t,i){if(!i)return n._1(u,r.rev(t));var o=i.tl;return n._2(e,i.hd,function(r){return c({hd:r,tl:t},o)})},a=function(r){if(!r)return n._1(u,void 0);var t=r.tl;return n._2(e,r.hd,function(r){return a(t)})};return{bind:e,$$return:u,fmap:o,$great$great$eq:e,$less$$great:function(r,t){return n._2(o,t,r)},seq:f,$great$great:f,join:function(r){return n._2(e,r,function(r){return r})},all:function(r){return c(0,r)},all_ignore:a}}function i(t){var e=t.bind,u=t.$$return,i=t.fmap,o="object"==typeof i?i.VAL:function(r,t){return n._2(e,t,function(t){return n._1(u,n._1(r,t))})},f=function(r,t){return n._2(e,r,function(r){return t})},c=function(t,i){if(!i)return n._1(u,r.rev(t));var o=i.tl;return n._2(e,i.hd,function(r){return c({hd:r,tl:t},o)})},a=function(r){if(!r)return n._1(u,void 0);var t=r.tl;return n._2(e,r.hd,function(r){return a(t)})};return{bind:e,$$return:u,fmap:o,$great$great$eq:e,$less$$great:function(r,t){return n._2(o,t,r)},seq:f,$great$great:f,join:function(r){return n._2(e,r,function(r){return r})},all:function(r){return c(0,r)},all_ignore:a}}exports.MakeGeneral=t,exports.MakeBasic=e,exports.MakeBasic2=u,exports.MakeBasic3=i;
},{"rescript/lib/js/list.js":"aYjQ","rescript/lib/js/curry.js":"NSLD"}],"JPps":[function(require,module,exports) {
"use strict";var t=require("rescript/lib/js/curry.js"),n=require("rescript/lib/js/caml_option.js");function e(t,n){return t}function o(n,e,o){return t._1(n,t._1(e,o))}function i(n,e,o){return t._1(e,t._1(n,o))}function r(t){return!1}function s(t){return!0}function c(n,e,o){return t._2(n,o,e)}function u(t){return t}var p={$less$pipe$pipe:o,$pipe$pipe$great:i};function v(t,n){return setTimeout(t,n)}function a(e,o,i){var r=void 0!==e&&e,s={contents:void 0},c=function(t){s.contents=n.some(setTimeout(t,i))};return function(e){var i=s.contents;return r?void 0!==i?(clearTimeout(n.valFromOption(i)),c(function(t){s.contents=void 0})):(t._1(o,void 0),c(function(t){s.contents=void 0})):void 0!==i?(clearTimeout(n.valFromOption(i)),c(function(n){t._1(o,void 0),s.contents=void 0})):c(function(n){t._1(o,void 0),s.contents=void 0})}}function f(e,o){var i={contents:void 0},r={contents:0};return function(s){var c=i.contents;if(void 0===c)t._1(e,void 0),i.contents=n.some(setTimeout(function(t){i.contents=void 0},o)),r.contents=Date.now();else{clearTimeout(n.valFromOption(c));var u=Date.now(),p=o-(u-r.contents|0)|0;p<=0||p>o?(t._1(e,void 0),r.contents=Date.now()):i.contents=n.some(setTimeout(function(n){t._1(e,void 0),r.contents=Date.now()},p))}}}var d=o,l=i;exports.always=e,exports.compose=o,exports.pipe=i,exports.false_=r,exports.true_=s,exports.flip=c,exports.identity=u,exports.Infix=p,exports.$less$pipe$pipe=d,exports.$pipe$pipe$great=l,exports.delay=v,exports.debounce=a,exports.throttle=f;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_option.js":"dzFO"}],"tIKZ":[function(require,module,exports) {
"use strict";function e(e){return{apply:e.apply,pure:e.pure,alt:e.alt,empty:e.empty,$less$star$great:e.apply,$less$pipe$great:e.alt}}exports.MakeBasic=e;
},{}],"Ddhm":[function(require,module,exports) {
"use strict";var r=require("rescript/lib/js/curry.js"),t=require("rescript/lib/js/caml_option.js"),e=require("./Monad.bs.js"),o=require("./Function.bs.js"),n=require("./Alternative.bs.js");function i(r){return t.some(r)}function s(r){}function p(r){return void 0===r}function u(r){return void 0!==r}function a(r,e){return void 0!==e?t.valFromOption(e):r}function f(r){if(0===r.TAG)return t.some(r._0)}function l(r,e){if(void 0!==e)return t.valFromOption(e);throw{RE_EXN_ID:"Failure",_1:r,Error:new Error}}function $(r,t){return void 0!==r?r:t}function v(e){try{return t.some(r._1(e,void 0))}catch(o){return}}function c(e,o){if(void 0!==e)return r._1(o,t.valFromOption(e))}var x=e.MakeBasic({bind:c,$$return:i,fmap:"DefineWithBind"}),d=x.bind,m=x.$$return,_=x.$great$great$eq,F=x.$less$$great;function g(t,e){if(void 0!==t)return r._2(d,e,function(e){return r._1(m,r._1(t,e))})}function O(r,t){return void 0!==r?r:t}function q(r){}var y=n.MakeBasic({alt:O,empty:q,apply:g,pure:i}),b=y.alt;function j(r,t){return o.flip(F,r,t)}function h(e,o){if(void 0!==o)return r._1(e,t.valFromOption(o))}function E(e,o,n){return void 0!==n?r._2(e,o,t.valFromOption(n)):o}function M(e,o){if(void 0!==o&&r._1(e,t.valFromOption(o)))return o}function B(e,o){return void 0!==o&&r._1(e,t.valFromOption(o))}function k(r){if(void 0!==r)return t.valFromOption(r)}function w(r,t){return o.flip(_,r,t)}function A(e,o,n){return void 0!==o?void 0!==n?r._2(e,t.valFromOption(o),t.valFromOption(n)):1:void 0!==n?-1:0}function D(e,o,n){return void 0!==o?void 0!==n&&r._2(e,t.valFromOption(o),t.valFromOption(n)):void 0===n}function I(r){return void 0!==r?{hd:t.valFromOption(r),tl:0}:0}function L(r){if(r)return t.some(r.hd)}var N=x.fmap,R=y.$less$pipe$great,S=y.empty,W=y.apply,G=y.pure,T=y.$less$star$great,X={$great$great$eq:_,$less$$great:F,$less$star$great:T,$pipe$question:$,$less$pipe$great:b};exports.some=i,exports.none=s,exports.isNone=p,exports.isSome=u,exports.$$default=a,exports.default=a,exports.__esModule=!0,exports.ofResult=f,exports.toExn=l,exports.firstSome=$,exports.tryWith=v,exports.bind=d,exports.$great$great$eq=_,exports.$$return=m,exports.fmap=N,exports.$less$$great=F,exports.$less$pipe$great=R,exports.empty=S,exports.alt=b,exports.apply=W,exports.pure=G,exports.Infix=X,exports.map=j,exports.iter=h,exports.fold=E,exports.filter=M,exports.exists=B,exports.flatten=k,exports.flatMap=w,exports.compare=A,exports.equal=D,exports.toList=I,exports.ofList=L;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_option.js":"dzFO","./Monad.bs.js":"QyI5","./Function.bs.js":"JPps","./Alternative.bs.js":"tIKZ"}],"KUwe":[function(require,module,exports) {
"use strict";var r=require("rescript/lib/js/list.js"),t=require("rescript/lib/js/curry.js"),n=require("rescript/lib/js/caml_obj.js"),e=require("rescript/lib/js/pervasives.js"),u=require("rescript/lib/js/caml_option.js"),i=require("./Util.bs.js"),o=require("./Option.bs.js"),f=require("./Function.bs.js");function s(t){var n;try{n=r.hd(t)}catch(e){return}return u.some(n)}function a(t){var n;try{n=r.tl(t)}catch(e){return}return n}function c(t,n){var e;try{e=r.nth(n,t)}catch(i){return}return u.some(e)}function l(n){return t._2(o.$less$$great,a(r.rev(n)),r.rev)}function p(t){return s(r.rev(t))}function v(n,e){return r.fold_left(function(r,e){return r||t._1(n,e)},!1,e)}function d(n,e){return r.fold_left(function(r,e){return r?t._1(n,e):r},!0,e)}function x(t,n){return r.append(n,{hd:t,tl:0})}function h(t,n){return r.append(n,t)}function _(r,t){for(var n=r,e=t,u=0;;){var i=u,o=e,f=n;if(f<=0)return i;if(!o)return i;u=x(o.hd,i),e=o.tl,n=f-1|0}}function $(t,n){return r.rev(_(t,r.rev(n)))}function g(r,n){for(var e=n,u=0;;){var i=u,o=e;if(!o)return i;var f=o.hd;if(!t._1(r,f))return i;u=x(f,i),e=o.tl}}function q(t,n){return r.rev(g(t,r.rev(n)))}function j(r,t){for(;;){var n=r;if(!t)return 0;if(n<=0)return t;t=t.tl,r=n-1|0}}function m(t,n){return _(r.length(n)-t|0,n)}function W(r,n){for(;;){var e=n;if(!e)return 0;if(!t._1(r,e.hd))return e;n=e.tl}}function y(t,n){return r.rev(W(t,r.rev(n)))}function b(n,e){for(var u=e,i=0;;){var f=i,a=u;if(!a)return f;var c=a.tl,l=a.hd;0!==r.length(f)?o.$$default(!1,t._2(o.$less$$great,s(r.rev(f)),t._1(n,l)))?u=c:(i=x(l,f),u=c):(i=x(l,f),u=c)}}function I(r){return b(n.caml_equal,r)}function L(t,n){return[_(t,n),$(r.length(n)-t|0,n)]}function O(n,e,u){var i=L(e+1|0,u),a=i[1],c=i[0];return e<0||e>=r.length(u)?u:c?c.tl?o.$$default(u,t._2(o.$less$$great,t._2(o.$great$great$eq,l(c),function(e){return t._2(o.$less$$great,t._2(o.$less$$great,s(r.rev(c)),n),function(r){return f.flip(x,e,r)})}),function(t){return r.append(t,a)})):{hd:t._1(n,c.hd),tl:a}:a}function k(t,n){for(var e=n,u=0;;){var i=u,o=e;if(!o)return i;if(r.length(o)<t)return i;u=x(_(t,o),i),e=o.tl}}function F(t){return function(n){return r.exists(t,n)}}function w(t){return function(n){return r.exists(function(r){return i.eq(t,r)},n)}}function z(n,e){return o.$$default(!1,t._2(o.$less$$great,s(r.rev(e)),function(r){return i.eq(n,r)}))}function A(t,n){var e;try{e=r.find(t,n)}catch(i){return}return u.some(e)}function B(r,n){for(var e=n,u=0;;){var i=u,o=e;if(!o)return;if(t._1(r,o.hd))return i;u=i+1|0,e=o.tl}}function R(t,n){return A(t,r.rev(n))}function E(t,n){var e=B(t,r.rev(n));if(void 0!==e)return(r.length(n)-e|0)-1|0}function U(n,e){for(var u=0,i=e,f=0;;){var a=f,c=i,l=u;if(!c)return 0===r.length(a)?{hd:0,tl:0}:a;if(!c.tl)return x({hd:c.hd,tl:0},a);if(l>r.length(c))return x(c,a);var p=L(l+1|0,c),v=p[1],d=p[0];o.$$default(!0,t._2(o.Infix.$less$star$great,t._2(o.Infix.$less$star$great,n,s(r.rev(d))),s(v)))?u=l+1|0:(f=x(d,a),i=v,u=0)}}function C(r,t){return B(function(t){return n.caml_equal(r,t)},t)}function D(t,n,e){var u=L(t,e);return r.append(x(n,u[0]),u[1])}function G(t,n,e){var u=L(t,e);return r.append(r.append(u[0],n),u[1])}function H(t,n){return r.fold_left(function(n,e){return r.length(n)>0?x(e,x(t,n)):{hd:e,tl:0}},0,n)}function J(t){return function(n){return r.fold_left(function(r,n){return 0===r.length?n:r+(t+n)},"",n)}}function K(t,n){var e=C(t,r.rev(n));if(void 0!==e)return(r.length(n)-e|0)-1|0}function M(t,n){return!r.exists(t,n)}function N(n,e){return[r.filter(n)(e),r.filter(function(r){return!t._1(n,r)})(e)]}function P(e,u,i){for(var o=0;;){var f=o,s=r.rev(f);if(s){var a=s.hd;if(n.caml_greaterthan(t._1(e,a),i))return f;o=x(t._1(e,a),f)}else o={hd:u,tl:0}}}function Q(r){return function(t,n){return P(function(t){return t+r|0},t,n)}}function S(r){return function(t,n){return P(function(t){return t+r},t,n)}}function T(n,e,u,i){return r.fold_left(function(r,u){if(!r[0])return r;var i=r[1];return t._2(n,i,u)?[!0,t._2(e,i,u)]:[!1,i]},[!0,u],i)[1]}function V(n){return r.filter(function(r){return!t._1(n,r)})}function X(r,t,n){var u=L(r,n);return e.$at(u[0],j(t,u[1]))}function Y(r,t){for(var n=t,e=0;;){var u=n;if(0===u)return e;e=x(r,e),n=u-1|0}}function Z(n,e){var u={hd:e,tl:0};return function(e){return r.fold_left(function(e,u){return o.$$default(0,t._2(o.$less$$great,t._2(o.$less$$great,s(r.rev(e)),function(r){return f.flip(n,u,r)}),function(r){return f.flip(x,e,r)}))},u,e)}}function rr(r,t,n){return L(t,L(r,n)[1])[0]}function tr(r,t){for(var n=t,e=0;;){var u=e,i=n;if(!i)return u;e=x(_(r,i),u),n=j(r,i)}}function nr(r,t){var n=B(r,t);return void 0!==n?L(n,t):[t,0]}function er(r,t){var e=s(t);return void 0!==e&&n.caml_equal(u.valFromOption(e),r)}function ur(r,n){for(var e=0,u=0;;){var i=u,o=e;if(o>=n)return i;u=x(t._1(r,o),i),e=o+1|0}}function ir(n,e,u){return r.fold_left(function(u,i){var o=u[1],f=u[0],s=t._1(n,t._1(e,i));return r.exists(s,o)?[f,o]:[x(i,f),x(t._1(e,i),o)]},[0,0],u)[0]}function or(r,t){return ir(i.eq,r,t)}function fr(r,t){return ir(r,f.identity,t)}function sr(r){return ir(i.eq,f.identity,r)}function ar(t,n,e){var u=r.append(n,e);return ir(t,f.identity,u)}function cr(t,n){var e=r.append(t,n);return ir(i.eq,f.identity,e)}function lr(r,t,n){return O(function(t){return f.always(r,t)},t,n)}function pr(n,e){var u=function(r){return w(r)(n)};return r.filter(function(r){return!t._1(u,r)})(e)}function vr(r,n,e){for(var u=n,i=e,o=0;;){var f=o,s=i,a=u;if(!a)return f;if(!s)return f;o=x(t._2(r,a.hd,s.hd),f),i=s.tl,u=a.tl}}function dr(n,e,u,i){for(;;){var o=i,f=e;if(!f)return o;var s=f.tl,a=f.hd,c=t._1(n,a);r.exists(c,u)?e=s:(i=x(a,o),e=s)}}function xr(r,t,n){return e.$at(dr(r,t,n,0),dr(r,n,t,0))}function hr(r,t){return xr(i.eq,r,t)}function _r(r,t){for(var n=r,e=0;;){var u=e,i=n;if(!i)return u;var o=i.tl,f=i.hd;w(f)(t)?(e=x(f,u),n=o):n=o}}function $r(r,t){for(var n=r,e=t,u=0;;){var i=u,o=e,f=n;if(!f)return i;if(!o)return i;u=x([f.hd,o.hd],i),e=o.tl,n=f.tl}}function gr(r,n,e){for(var u=0,i=n,o=e;;){var f=o,s=i,a=u;if(!f)return s;o=f.tl,i=t._3(r,s,a,f.hd),u=a+1|0}}function qr(r){return gr(function(r,t,n){return{hd:[t,n],tl:r}},0,r)}function jr(n,e,u){return r.fold_left(function(r,e){return t._3(n,r,e[0],e[1])},e,qr(u))}function mr(r,n){for(var e=n,u=0,i=0;;){var o=i,f=u,s=e;if(!s)return o;var a=s.tl,c=s.hd;t._2(r,f,c)?(i=x(c,o),u=f+1|0,e=a):(u=f+1|0,e=a)}}function Wr(n,e,u){return r.fold_left(function(r,u){return t._1(n,u)?x(t._1(e,u),r):r},0,u)}function yr(r,n,e){return gr(function(e,u,i){return t._2(r,u,i)?x(t._2(n,u,i),e):e},0,e)}function br(r){return{hd:r,tl:0}}function Ir(r,n){if(n<0)return 0;for(var e=n,u=0;;){var i=u,o=e;if(0===o)return i;u={hd:t._1(r,o-1|0),tl:i},e=o-1|0}}function Lr(t){return r.rev(function(r,t){for(;;){var n=t,e=r;if(!e)return n;var i=e.tl,o=e.hd;void 0===o?r=i:(t={hd:u.valFromOption(o),tl:n},r=i)}}(t,0))}function Or(t,n){if(n)return u.some(r.fold_left(t,n.hd,n.tl))}function kr(n,e,u){for(var i=0,o=e,f=u;;){var s=f,a=o,c=i;if(!a)return r.rev_append(c,s);if(!s)return r.rev_append(c,a);var l=s.hd,p=a.hd;t._2(n,p,l)<=0?(o=a.tl,i={hd:p,tl:c}):(f=s.tl,i={hd:l,tl:c})}}exports.head=s,exports.tail=a,exports.nth=c,exports.init=l,exports.last=p,exports.any=v,exports.all=d,exports.append=x,exports.concat=h,exports.take=_,exports.takeLast=$,exports.takeWhile=g,exports.takeLastWhile=q,exports.drop=j,exports.dropLast=m,exports.dropLastWhile=y,exports.dropRepeatsWith=b,exports.dropRepeats=I,exports.dropWhile=W,exports.splitAt=L,exports.adjust=O,exports.aperture=k,exports.containsWith=F,exports.contains=w,exports.endsWith=z,exports.find=A,exports.findIndex=B,exports.findLast=R,exports.findLastIndex=E,exports.groupWith=U,exports.indexOf=C,exports.insert=D,exports.insertAll=G,exports.intersperse=H,exports.join=J,exports.lastIndexOf=K,exports.none=M,exports.partition=N,exports.range=P,exports.rangeInt=Q,exports.rangeFloat=S,exports.reduceWhile=T,exports.reject=V,exports.remove=X,exports.repeat=Y,exports.scan=Z,exports.slice=rr,exports.splitEvery=tr,exports.splitWhen=nr,exports.startsWith=er,exports.times=ur,exports.uniqWithBy=ir,exports.uniqBy=or,exports.uniqWith=fr,exports.uniq=sr,exports.unionWith=ar,exports.union=cr,exports.update=lr,exports.without=pr,exports.zipWith=vr,exports.differenceWith=xr,exports.difference=hr,exports.intersection=_r,exports.zip=$r,exports.pure=br,exports.fold_lefti=gr,exports.fold_righti=jr,exports.filteri=mr,exports.filter_map=Wr,exports.filter_mapi=yr,exports.create=Ir,exports.filter_opt=Lr,exports.reduce=Or,exports.merge=kr;
},{"rescript/lib/js/list.js":"aYjQ","rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_obj.js":"p3B5","rescript/lib/js/pervasives.js":"z22f","rescript/lib/js/caml_option.js":"dzFO","./Util.bs.js":"cfqr","./Option.bs.js":"Ddhm","./Function.bs.js":"JPps"}],"SRS9":[function(require,module,exports) {
"use strict";var r=require("rescript/lib/js/curry.js"),e=require("rescript/lib/js/caml_option.js"),t=require("./Monad.bs.js");function n(r){return{TAG:1,_0:r}}function o(r){return 0===r.TAG}function s(r){if(0===r.TAG)return e.some(r._0)}function i(r){return 0===r.TAG?void 0:e.some(r._0)}function u(r){return 0!==r.TAG}function a(r,t){return void 0!==t?{TAG:0,_0:e.valFromOption(t)}:{TAG:1,_0:r}}function p(e,t){return 0===e.TAG?{TAG:0,_0:r._1(e._0,t)}:{TAG:1,_0:e._0}}function $(e,t,n){return 0===n.TAG?r._1(e,n._0):r._1(t,n._0)}function _(e,t,n){return 0===n.TAG?{TAG:0,_0:r._1(e,n._0)}:{TAG:1,_0:r._1(t,n._0)}}function x(e,t){return 0===e.TAG?r._1(t,e._0):{TAG:1,_0:e._0}}function f(r){return{TAG:0,_0:r}}var c=t.MakeBasic2({bind:x,$$return:f,fmap:"DefineWithBind"}),g=c.$great$great$eq,l=c.$less$$great,A={$great$great$eq:g,$less$$great:l},G=c.bind,T=c.$$return,m=c.fmap,q=c.seq,b=c.$great$great,d=c.join,j=c.all,v=c.all_ignore;exports.fail=n,exports.isOk=o,exports.getOk=s,exports.getError=i,exports.isError=u,exports.ofOption=a,exports.ap=p,exports.result=$,exports.bimap=_,exports.bind=G,exports.$$return=T,exports.fmap=m,exports.$great$great$eq=g,exports.$less$$great=l,exports.seq=q,exports.$great$great=b,exports.join=d,exports.all=j,exports.all_ignore=v,exports.Infix=A;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_option.js":"dzFO","./Monad.bs.js":"QyI5"}],"xX5m":[function(require,module,exports) {
"use strict";function r(r,t,n){return t in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}var t=require("rescript/lib/js/caml.js"),n=require("rescript/lib/js/list.js"),e=require("rescript/lib/js/array.js"),i=require("rescript/lib/js/curry.js"),o=require("rescript/lib/js/belt_Id.js"),u=require("rescript/lib/js/js_json.js"),a=require("rescript/lib/js/js_math.js"),f=require("rescript/lib/js/caml_obj.js"),c=require("rescript/lib/js/belt_List.js"),s=require("rescript/lib/js/belt_Array.js"),l=require("rescript/lib/js/caml_array.js"),m=require("rescript/lib/js/belt_Result.js"),p=require("rescript/lib/js/caml_format.js"),_=require("rescript/lib/js/caml_option.js"),d=require("rescript/lib/js/belt_SortArray.js"),v=require("rescript/lib/js/belt_MutableMap.js"),g=require("rescript/lib/js/caml_exceptions.js"),b=require("rationale/src/RList.bs.js"),h=require("rationale/src/Option.bs.js"),y=require("rationale/src/Result.bs.js"),x=require("rationale/src/Function.bs.js"),j=t.caml_float_compare,S=o.MakeComparable({cmp:j});function E(r){return v.fromArray(r,S)}var A=v.toArray;function q(r){return v.make(S)}function $(r,t){return v.update(t,r,function(r){return void 0!==r?r+1:1})}function k(r,t){return v.get(t,r)}function I(r,t){return v.map(t,r)}var O={Id:S,fromArray:E,toArray:A,empty:q,increment:$,get:k,fmap:I};function T(r,t){return r>t?r:t}var B={max:T},F=f.caml_equal;function M(r){return[r]}function w(r){return r}var G={isEqual:F,toA:M,id:w};function R(r,t,n){return void 0!==n?i._1(r,_.valFromOption(n)):i._1(t,void 0)}function D(r,t){return h.flatten(i._2(h.apply,r,_.some(t)))}function L(r){return void 0!==r}function N(r,t){if(void 0!==t)return i._1(r,_.valFromOption(t))}function P(r){return void 0!==r?r:""}function W(t,n){return void 0!==n?r({TAG:0,_0:_.valFromOption(n)},Symbol.for("name"),"Ok"):r({TAG:1,_0:t},Symbol.for("name"),"Error")}function C(r,t,n){return void 0!==t?void 0!==n?i._2(r,t,n)?t:n:t:void 0!==n?n:void 0}function U(r,t){return C(function(r,t){return r<t},r,t)}function J(r,t){return C(function(r,t){return r>t},r,t)}var X={dimap:R,fmap:h.fmap,bind:h.bind,$$default:h.$$default,isSome:h.isSome,isNone:h.isNone,toExn:h.toExn,some:h.some,firstSome:h.firstSome,toExt:h.toExn,flatApply:D,toBool:L,ffmap:N,toString:P,toResult:W,compare:C,min:U,max:J};function z(r,t){return i._1(t,r)}function H(r,t,n){return i._1(r,function(r){return i._1(t,function(t){return i._2(n,r,t)})})}function V(r,t,n,e){return i._1(r,function(r){return i._1(t,function(t){return i._1(n,function(n){return i._3(e,r,t,n)})})})}function K(r,t,n,e,o){return i._1(r,function(r){return i._1(t,function(t){return i._1(n,function(n){return i._1(e,function(e){return i._4(o,r,t,n,e)})})})})}var Q={apply:z,flatten2Callbacks:H,flatten3Callbacks:V,flatten4Callbacks:K};function Y(r){return r?"TRUE":"FALSE"}function Z(r){return"TRUE"===r}function rr(r){return!(void 0===r||!r)}var tr={toBool:rr},nr={toString:Y,fromString:Z,O:tr};function er(r){return r.toPrecision(2)}function ir(r){return r.toPrecision(3)}function or(r){return r.toFixed()}function ur(r){return r.toString()}var ar={with2DigitsPrecision:er,with3DigitsPrecision:ir,toFixed:or,toString:ur};function fr(r){return r+1|0}function cr(r){return r-1|0}function sr(r){return r.toString()}var lr={increment:fr,decrement:cr,toString:sr};function mr(r){return y.result(w,w,r)}function pr(r,t){return 0===t.TAG?t._0:r}function _r(t,n){return 0===t.TAG?0===n.TAG?r({TAG:0,_0:[t._0,n._0]},Symbol.for("name"),"Ok"):r({TAG:1,_0:n._0},Symbol.for("name"),"Error"):r({TAG:1,_0:t._0},Symbol.for("name"),"Error")}function dr(r){if(0===r.TAG)return _.some(r._0)}function vr(t,n,e){return i._1(t,e)?r({TAG:1,_0:n},Symbol.for("name"),"Error"):r({TAG:0,_0:e},Symbol.for("name"),"Ok")}var gr={result:y.result,id:mr,fmap:y.fmap,bind:y.bind,toExn:m.getExn,$$default:pr,merge:_r,toOption:dr,errorIfCondition:vr};function br(r,t){try{return _.some(i._1(r,t))}catch(n){return}}function hr(r){return br(p.caml_float_of_string,r)}function yr(r){return br(p.caml_int_of_string,r)}function xr(r,t){return""===t?r:t}var jr={safe_float:hr,safe_int:yr,$$default:xr};function Sr(r){return h.$$default("",r)}function Er(r){return x.Infix.$pipe$pipe$great(u.decodeString,Sr,r)}function Ar(r){return r}function qr(r){return r}function $r(r){return""===r?void 0:_.some(r)}function kr(r){if(void 0!==r)return x.Infix.$pipe$pipe$great(u.decodeString,function(r){return h.$$default("",r)},_.valFromOption(r))}var Ir={fromString:$r,toString:kr},Or={toString:Er,fromString:Ar,fromNumber:qr,O:Ir};function Tr(r){return new Date(r)}function Br(r){return Date.now()}function Fr(r){return new Date}function Mr(r){return r.valueOf()}var wr={fromString:Tr,now:Br,make:Fr,valueOf:Mr},Gr={fmap:n.map,get:c.get,toArray:e.of_list,fmapi:n.mapi,concat:n.concat,drop:b.drop,remove:b.remove,find:n.find,filter:n.filter,for_all:n.for_all,exists:n.exists,sort:n.sort,length:n.length,filter_opt:b.filter_opt,uniqBy:b.uniqBy,join:b.join,head:b.head,uniq:b.uniq,flatten:n.flatten,last:b.last,append:n.append,getBy:c.getBy,dropLast:b.dropLast,contains:b.contains,without:b.without,update:b.update,iter:n.iter,findIndex:b.findIndex};function Rr(r){return r.length}function Dr(r,t){return r[t]}function Lr(r){return s.get(r,r.length-1|0)}function Nr(r){return s.get(r,0)}function Pr(r,t){return h.isSome(s.getBy(r,t))}function Wr(r){return r.length<1}function Cr(r){return i._2(h.fmap,function(t){return s.reduce(r,t,function(r,t){return f.caml_lessthan(r,t)?r:t})},s.get(r,0))}function Ur(r){return i._2(h.fmap,function(t){return s.reduce(r,t,function(r,t){return f.caml_greaterthan(r,t)?r:t})},s.get(r,0))}function Jr(t){var n=t.length;if(0===n||1===n)return r({TAG:1,_0:"Must be at least 2 elements"},Symbol.for("name"),"Error");var e=s.makeBy(n-1|0,function(r){return r});return i._1(y.$$return,s.map(e,function(r){return[t[r],t[r+1|0]]}))}function Xr(r,t){for(var n=T(r.length,t.length),e=new Array(n),i=0;i<n;++i)s.set(e,i,[s.get(r,i),s.get(t,i)]);return e}function zr(r,t){return e.of_list(i._1(r,e.to_list(t)))}function Hr(r){return e.of_list(b.uniq(e.to_list(r)))}function Vr(r,t){var n={contents:[]};return s.forEachWithIndex(r,function(r,i){var o=s.get(t,r);n.contents=void 0!==o?e.append(n.contents,[i,_.valFromOption(o)]):e.append(n.contents,[i])}),n.contents}function Kr(r,t){var n=t.length,e=s.make(n,t[0]);return s.forEachWithIndex(t,function(t,n){var o=0!==t?i._2(r,n,e[t-1|0]):n;s.set(e,t,o)}),e}function Qr(r,t){var n=t.findIndex(i.__1(r));if(-1!==n)return n}function Yr(r,t){return t.filter(i.__1(r))}function Zr(r){return r.filter(h.isSome).map(function(r){return h.toExn("Warning: This should not have happened",r)})}function rt(r){return void 0!==r?r:[]}var tt={concatSomes:Zr,defaultEmpty:rt};function nt(t){var n=s.getBy(t,m.isError),e=void 0!==n&&0!==n.TAG?r({TAG:1,_0:n._0},Symbol.for("name"),"Error"):r({TAG:0,_0:t},Symbol.for("name"),"Ok");return m.map(e,function(r){return s.map(r,m.getExn)})}var et={firstErrorOrOpen:nt};function it(r,t,n){var e=void 0!==r?r:Nr,o=void 0!==t?t:Lr,u=i._1(e,n),a=i._1(o,n);if(void 0!==u&&void 0!==a)return a-u}function ot(r,t){var n=d.binarySearchBy(r,t,f.caml_compare),e=n<0?Math.imul(n,-1)-1|0:n;return e>=r.length?"overMax":0===e?"underMin":{NAME:"firstHigher",VAL:e}}function ut(r,t){var n=s.concat(r,t);return e.fast_sort(f.caml_compare,n),n}function at(r){var t=s.concatMany(r);return e.fast_sort(f.caml_compare,t),t}function ft(r,t){var n=e.mapi(function(r,t){return t+r|0},l.make(1+(t-r|0)|0,r));return s.map(n,function(r){return r})}function ct(r,t){var n=e.mapi(function(r,t){return t-r|0},l.make(1+(r-t|0)|0,r));return s.map(n,function(r){return r})}function st(r){var t=[],n=v.make(S);return s.forEachWithIndex(r,function(e,i){var o=r.length-1|0,u=0!==e?e===o?[e-1|0]:[e-1|0,e+1|0]:[e+1|0],a=s.map(u,function(t){return l.get(r,t)});s.some(a,function(r){return r===i})?$(i,n):t.push(i)}),[t,n]}var lt={makeIncrementalUp:ft,makeIncrementalDown:ct,split:st},mt={min:Nr,max:Lr,range:it,binarySearchFirstElementGreaterIndex:ot,concat:ut,concatMany:at,Floats:lt};function pt(r){return s.reduce(r,0,function(r,t){return r+t})}function _t(r){return pt(r)/r.length}var dt=g.create("E-ProbExample.A.Floats.RangeError");function vt(r,t,n){switch(n){case 0:return[];case 1:return[r];case 2:return[r,t];default:if(r===t)return s.make(n,r);if(n<0)throw{RE_EXN_ID:dt,_1:"n must be greater than 0",Error:new Error};if(r>t)throw{RE_EXN_ID:dt,_1:"Min value is less then max value",Error:new Error};var e=(t-r)/(n-1|0);return s.makeBy(n,function(t){return r+t*e})}}var gt={sum:pt,mean:_t,random:a.random_int,$$RangeError:dt,range:vt},bt={fmap:e.map,fmapi:e.mapi,to_list:e.to_list,of_list:e.of_list,length:Rr,append:e.append,unsafe_get:Dr,get:s.get,getBy:s.getBy,last:Lr,first:Nr,hasBy:Pr,fold_left:e.fold_left,fold_right:e.fold_right,concatMany:s.concatMany,keepMap:s.keepMap,init:e.init,reduce:s.reduce,reducei:s.reduceWithIndex,isEmpty:Wr,min:Cr,max:Ur,stableSortBy:d.stableSortBy,toRanges:Jr,zipMaxLength:Xr,asList:zr,uniq:Hr,intersperse:Vr,accumulate:Kr,findIndex:Qr,filter:Yr,O:tt,R:et,Sorted:mt,Floats:gt};function ht(r){return r.filter(h.isSome).map(function(r){return h.toExn("Warning: This should not have happened",r)})}function yt(r,t){return t.filter(i.__1(r))}var xt={concatSomes:ht,filter:yt};exports.FloatFloatMap=O,exports.Int=B,exports.U=G,exports.O=X,exports.F=Q,exports.Bool=nr,exports.Float=ar,exports.I=lr,exports.R=gr,exports.safe_fn_of_string=br,exports.S=jr,exports.J=Or,exports.JsDate=wr,exports.L=Gr,exports.A=bt,exports.JsArray=xt;
},{"rescript/lib/js/caml.js":"gGFE","rescript/lib/js/list.js":"aYjQ","rescript/lib/js/array.js":"d4B1","rescript/lib/js/curry.js":"NSLD","rescript/lib/js/belt_Id.js":"eN7B","rescript/lib/js/js_json.js":"NOig","rescript/lib/js/js_math.js":"MeLz","rescript/lib/js/caml_obj.js":"p3B5","rescript/lib/js/belt_List.js":"H9fU","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_array.js":"Tpli","rescript/lib/js/belt_Result.js":"tKwj","rescript/lib/js/caml_format.js":"Zve6","rescript/lib/js/caml_option.js":"dzFO","rescript/lib/js/belt_SortArray.js":"mJOW","rescript/lib/js/belt_MutableMap.js":"aHaK","rescript/lib/js/caml_exceptions.js":"RiV8","rationale/src/RList.bs.js":"KUwe","rationale/src/Option.bs.js":"Ddhm","rationale/src/Result.bs.js":"SRS9","rationale/src/Function.bs.js":"JPps"}],"qeUV":[function(require,module,exports) {
"use strict";var r,t,e,n=require("./caml.js"),o=require("./curry.js"),i=require("./caml_option.js"),u=require("./belt_SortArray.js"),f=require("./belt_internalAVLtree.js");function v(r,t,e){if(void 0===r)return f.singleton(t,e);var n=r.k;if(t===n)return f.updateValue(r,e);var o=r.v;return t<n?f.bal(v(r.l,t,e),n,o,r.r):f.bal(r.l,n,o,v(r.r,t,e))}function a(r,t){for(;;){var e=r;if(void 0===e)return;var n=e.k;if(t===n)return i.some(e.v);r=t<n?e.l:e.r}}function s(r,t){for(;;){var e=r;if(void 0===e)return;var n=e.k;if(t===n)return e.v;r=t<n?e.l:e.r}}function l(r,t){for(;;){var e=r;if(void 0===e)throw{RE_EXN_ID:"Not_found",Error:new Error};var n=e.k;if(t===n)return e.v;r=t<n?e.l:e.r}}function c(r,t,e){for(;;){var n=r;if(void 0===n)return e;var o=n.k;if(t===o)return n.v;r=t<o?n.l:n.r}}function d(r,t){for(;;){var e=r;if(void 0===e)return!1;var n=e.k;if(t===n)return!0;r=t<n?e.l:e.r}}function p(r,t){if(void 0===r)return r;var e=r.k,n=r.l,o=r.r;if(t!==e)return t<e?f.bal(p(n,t),e,r.v,o):f.bal(n,e,r.v,p(o,t));if(void 0===n)return o;if(void 0===o)return n;var i={contents:o.k},u={contents:o.v},v=f.removeMinAuxWithRef(o,i,u);return f.bal(n,i.contents,u.contents,v)}function x(r,t){var e=t.k,n=t.v,o=t.l,u=t.r;if(r===e)return[o,i.some(n),u];if(r<e){if(void 0===o)return[void 0,void 0,t];var v=x(r,o);return[v[0],v[1],f.join(v[2],e,n,u)]}if(void 0===u)return[t,void 0,void 0];var a=x(r,u);return[f.join(o,e,n,a[0]),a[1],a[2]]}function k(r,t){return void 0!==t?x(r,t):[void 0,void 0,void 0]}function A(r,t,e){if(void 0!==r){if(r.h>=(void 0!==t?t.h:0)){var n=r.k,o=r.v,u=r.l,v=r.r,a=k(n,t);return f.concatOrJoin(A(u,a[0],e),n,e(n,i.some(o),a[1]),A(v,a[2],e))}}else if(void 0===t)return;var s=t.k,l=t.v,c=t.l,d=t.r,p=k(s,r);return f.concatOrJoin(A(p[0],c,e),s,e(s,p[1],i.some(l)),A(p[2],d,e))}function m(r,t,e){return A(r,t,o.__3(e))}function _(r,t,e){for(;;){var o=t,i=r;if(!i)return 0;if(!o)return 0;var u=o.hd,v=i.hd,a=n.caml_string_compare(v.k,u.k);if(0!==a)return a;var s=e(v.v,u.v);if(0!==s)return s;t=f.stackAllLeft(u.r,o.tl),r=f.stackAllLeft(v.r,i.tl)}}function h(r,t,e){var n=f.size(r),o=f.size(t);return n===o?_(f.stackAllLeft(r,0),f.stackAllLeft(t,0),e):n<o?-1:1}function g(r,t,e){return h(r,t,o.__2(e))}function L(r,t,e){for(;;){var n=t,o=r;if(!o)return!0;if(!n)return!0;var i=n.hd,u=o.hd;if(u.k!==i.k||!e(u.v,i.v))return!1;t=f.stackAllLeft(i.r,n.tl),r=f.stackAllLeft(u.r,o.tl)}}function b(r,t,e){return f.size(r)===f.size(t)&&L(f.stackAllLeft(r,0),f.stackAllLeft(t,0),e)}function q(r,t,e){return b(r,t,o.__2(e))}function j(r,t,e){if(void 0===r)return f.singleton(t,e);var n=r.k;if(t===n)return r.k=t,r.v=e,r;var o=r.l,i=r.r;if(t<n){var u=j(o,t,e);r.l=u}else r.r=j(i,t,e);return f.balMutate(r)}function y(r){var t=r.length;if(0!==t){var e,n=u.strictlySortedLengthU(r,function(r,t){return r[0]<t[0]});n>=0?e=f.fromSortedArrayAux(r,0,n):(n=0|-n,e=f.fromSortedArrayRevAux(r,n-1|0,n));for(var o=n;o<t;++o){var i=r[o];e=j(e,i[0],i[1])}return e}}exports.N=r,exports.A=t,exports.S=e,exports.add=v,exports.get=a,exports.getUndefined=s,exports.getExn=l,exports.getWithDefault=c,exports.has=d,exports.remove=p,exports.splitAux=x,exports.split=k,exports.mergeU=A,exports.merge=m,exports.compareAux=_,exports.cmpU=h,exports.cmp=g,exports.eqAux=L,exports.eqU=b,exports.eq=q,exports.addMutate=j,exports.fromArray=y;
},{"./caml.js":"gGFE","./curry.js":"NSLD","./caml_option.js":"dzFO","./belt_SortArray.js":"mJOW","./belt_internalAVLtree.js":"ApXr"}],"mO07":[function(require,module,exports) {
"use strict";var e,r=require("./curry.js"),t=require("./caml_option.js"),o=require("./belt_internalAVLtree.js"),n=require("./belt_internalMapString.js");function i(e,r,t){if(void 0===e)return o.singleton(r,t);var n=e.k;if(r===n)return o.updateValue(e,t);var s=e.v;return r<n?o.bal(i(e.l,r,t),n,s,e.r):o.bal(e.l,n,s,i(e.r,r,t))}function s(e,r,n){if(void 0!==e){var i=e.k;if(r===i){var a=n(t.some(e.v));if(void 0!==a)return o.updateValue(e,t.valFromOption(a));var p=e.l,x=e.r;if(void 0===p)return x;if(void 0===x)return p;var m={contents:x.k},v={contents:x.v},u=o.removeMinAuxWithRef(x,m,v);return o.bal(p,m.contents,v.contents,u)}var f=e.v,d=e.l,y=e.r;if(r<i){var U=s(d,r,n);return d===U?e:o.bal(U,i,f,y)}var c=s(y,r,n);return y===c?e:o.bal(d,i,f,c)}var l=n(void 0);return void 0!==l?o.singleton(r,t.valFromOption(l)):e}function a(e,t,o){return s(e,t,r.__1(o))}function p(e,r){var t=e.k,n=e.l,i=e.r;if(r===t){if(void 0===n)return i;if(void 0===i)return n;var s={contents:i.k},a={contents:i.v},x=o.removeMinAuxWithRef(i,s,a);return o.bal(n,s.contents,a.contents,x)}if(r<t){if(void 0===n)return e;var m=p(n,r);return m===n?e:o.bal(m,t,e.v,i)}if(void 0===i)return e;var v=p(i,r);return o.bal(n,t,e.v,v)}function x(e,r){if(void 0!==e)return p(e,r)}function m(e,r){var t=r.length;if(void 0!==e)for(var o=e,n=0;;){var i=n;if(i>=t)return o;var s=p(o,r[i]);if(void 0===s)return s;n=i+1|0,o=s}}function v(e,r){for(var t=r.length,o=e,n=0;n<t;++n){var s=r[n];o=i(o,s[0],s[1])}return o}var u=o.isEmpty,f=n.has,d=n.cmpU,y=n.cmp,U=n.eqU,c=n.eq,l=o.findFirstByU,h=o.findFirstBy,g=o.forEachU,k=o.forEach,K=o.reduceU,A=o.reduce,b=o.everyU,q=o.every,E=o.someU,W=o.some,F=o.size,M=o.toList,S=o.toArray,_=n.fromArray,j=o.keysToArray,B=o.valuesToArray,I=o.minKey,T=o.minKeyUndefined,L=o.maxKey,V=o.maxKeyUndefined,z=o.minimum,D=o.minUndefined,O=o.maximum,R=o.maxUndefined,w=n.get,C=n.getUndefined,G=n.getWithDefault,H=n.getExn,J=o.checkInvariantInternal,N=n.mergeU,P=n.merge,Q=o.keepSharedU,X=o.keepShared,Y=o.partitionSharedU,Z=o.partitionShared,$=n.split,ee=o.mapU,re=o.map,te=o.mapWithKeyU,oe=o.mapWithKey;exports.empty=e,exports.isEmpty=u,exports.has=f,exports.cmpU=d,exports.cmp=y,exports.eqU=U,exports.eq=c,exports.findFirstByU=l,exports.findFirstBy=h,exports.forEachU=g,exports.forEach=k,exports.reduceU=K,exports.reduce=A,exports.everyU=b,exports.every=q,exports.someU=E,exports.some=W,exports.size=F,exports.toList=M,exports.toArray=S,exports.fromArray=_,exports.keysToArray=j,exports.valuesToArray=B,exports.minKey=I,exports.minKeyUndefined=T,exports.maxKey=L,exports.maxKeyUndefined=V,exports.minimum=z,exports.minUndefined=D,exports.maximum=O,exports.maxUndefined=R,exports.get=w,exports.getUndefined=C,exports.getWithDefault=G,exports.getExn=H,exports.checkInvariantInternal=J,exports.remove=x,exports.removeMany=m,exports.set=i,exports.updateU=s,exports.update=a,exports.mergeU=N,exports.merge=P,exports.mergeMany=v,exports.keepU=Q,exports.keep=X,exports.partitionU=Y,exports.partition=Z,exports.split=$,exports.mapU=ee,exports.map=re,exports.mapWithKeyU=te,exports.mapWithKey=oe;
},{"./curry.js":"NSLD","./caml_option.js":"dzFO","./belt_internalAVLtree.js":"ApXr","./belt_internalMapString.js":"qeUV"}],"wWOr":[function(require,module,exports) {
"use strict";var r=require("./caml.js"),t=require("./caml_format.js"),e=require("./caml_js_exceptions.js");function n(r){return r+1|0}function o(r){return r-1|0}function i(r){return r>=0?r:0|-r}function s(r){return-1^r}function u(r){return t.caml_int32_format("%d",r)}function c(r){try{return t.caml_int32_of_string(r)}catch(o){var n=e.internalToOCamlException(o);if("Failure"===n.RE_EXN_ID)return;throw n}}var a=r.caml_int_compare;function p(r,t){return r===t}var _=0,x=1,m=-1,f=2147483647,l=-2147483648;exports.zero=_,exports.one=x,exports.minus_one=m,exports.succ=n,exports.pred=o,exports.abs=i,exports.max_int=f,exports.min_int=l,exports.lognot=s,exports.of_string_opt=c,exports.to_string=u,exports.compare=a,exports.equal=p;
},{"./caml.js":"gGFE","./caml_format.js":"Zve6","./caml_js_exceptions.js":"yO2E"}],"f266":[function(require,module,exports) {
"use strict";var r=require("./caml.js"),e=require("./caml_int64.js"),t=require("./caml_format.js"),n=require("./caml_js_exceptions.js");function o(r){return e.sub(r,e.one)}function s(t){return r.i64_ge(t,e.zero)?t:e.neg(t)}function i(r){return e.xor(r,e.neg_one)}function c(r){try{return t.caml_int64_of_string(r)}catch(o){var e=n.internalToOCamlException(o);if("Failure"===e.RE_EXN_ID)return;throw e}}var u=e.compare;function a(r,t){return 0===e.compare(r,t)}var _=e.zero,p=e.one,x=e.neg_one,m=e.succ,l=e.max_int,f=e.min_int,g=e.to_string;exports.zero=_,exports.one=p,exports.minus_one=x,exports.succ=m,exports.pred=o,exports.abs=s,exports.max_int=l,exports.min_int=f,exports.lognot=i,exports.of_string_opt=c,exports.to_string=g,exports.compare=u,exports.equal=a;
},{"./caml.js":"gGFE","./caml_int64.js":"Phox","./caml_format.js":"Zve6","./caml_js_exceptions.js":"yO2E"}],"cYhC":[function(require,module,exports) {
"use strict";var e=require("./caml_bytes.js");function r(e){if(e<0||e>255)throw{RE_EXN_ID:"Invalid_argument",_1:"Char.chr",Error:new Error};return e}function t(r){var t=0;if(r>=40){if(92===r)return"\\\\";t=r>=127?1:2}else if(r>=32){if(r>=39)return"\\'";t=2}else if(r>=14)t=1;else switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:t=1;break;case 13:return"\\r"}switch(t){case 1:var s=[0,0,0,0];return s[0]=92,s[1]=48+(r/100|0)|0,s[2]=48+(r/10|0)%10|0,s[3]=48+r%10|0,e.bytes_to_string(s);case 2:var c=[0];return c[0]=r,e.bytes_to_string(c)}}function s(e){return e>=65&&e<=90||e>=192&&e<=214||e>=216&&e<=222?e+32|0:e}function c(e){return e>=97&&e<=122||e>=224&&e<=246||e>=248&&e<=254?e-32|0:e}function n(e){return e>=65&&e<=90?e+32|0:e}function a(e){return e>=97&&e<=122?e-32|0:e}function u(e,r){return e-r|0}function i(e,r){return 0==(e-r|0)}exports.chr=r,exports.escaped=t,exports.lowercase=s,exports.uppercase=c,exports.lowercase_ascii=n,exports.uppercase_ascii=a,exports.compare=u,exports.equal=i;
},{"./caml_bytes.js":"gmRG"}],"JK9e":[function(require,module,exports) {
"use strict";var r=require("./caml.js"),t=require("./char.js"),e=require("./curry.js"),n=require("./caml_bytes.js"),o=require("./caml_js_exceptions.js");function i(r,t){var e=n.caml_create_bytes(r);return n.caml_fill_bytes(e,0,r,t),e}function a(r,t){for(var o=n.caml_create_bytes(r),i=0;i<r;++i)o[i]=e._1(t,i);return o}var _=[];function s(r){var t=r.length,e=n.caml_create_bytes(t);return n.caml_blit_bytes(r,0,e,0,t),e}function c(r){return n.bytes_to_string(s(r))}function u(r){return s(n.bytes_of_string(r))}function f(r,t,e){if(t<0||e<0||t>(r.length-e|0))throw{RE_EXN_ID:"Invalid_argument",_1:"String.sub / Bytes.sub",Error:new Error};var o=n.caml_create_bytes(e);return n.caml_blit_bytes(r,t,o,0,e),o}function l(r,t,e){return n.bytes_to_string(f(r,t,e))}function p(r,t){var e=r+t|0,n=t<0,o=e<0;if(r<0){if(!n)return e;if(o)return e;throw{RE_EXN_ID:"Invalid_argument",_1:"Bytes.extend",Error:new Error}}if(n)return e;if(o)throw{RE_EXN_ID:"Invalid_argument",_1:"Bytes.extend",Error:new Error};return e}function g(t,e,o){var i=p(p(t.length,e),o),a=n.caml_create_bytes(i),_=e<0?[0|-e,0]:[0,e],s=_[1],c=_[0],u=r.caml_int_min(t.length-c|0,i-s|0);return u>0&&n.caml_blit_bytes(t,c,a,s,u),a}function m(r,t,e,o){if(t<0||e<0||t>(r.length-e|0))throw{RE_EXN_ID:"Invalid_argument",_1:"String.fill / Bytes.fill",Error:new Error};return n.caml_fill_bytes(r,t,e,o)}function E(r,t,e,o,i){if(i<0||t<0||t>(r.length-i|0)||o<0||o>(e.length-i|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Bytes.blit",Error:new Error};return n.caml_blit_bytes(r,t,e,o,i)}function x(r,t,e,o,i){if(i<0||t<0||t>(r.length-i|0)||o<0||o>(e.length-i|0))throw{RE_EXN_ID:"Invalid_argument",_1:"String.blit / Bytes.blit_string",Error:new Error};return n.caml_blit_string(r,t,e,o,i)}function h(r,t){for(var n=0,o=t.length;n<o;++n)e._1(r,t[n])}function b(r,t){for(var n=0,o=t.length;n<o;++n)e._2(r,n,t[n])}function v(r,t){if(r>=t)return r;throw{RE_EXN_ID:"Invalid_argument",_1:"Bytes.concat",Error:new Error}}function y(r,t,e){for(;;){var n=e,o=r;if(!n)return o;var i=n.tl,a=n.hd;if(!i)return a.length+o|0;e=i,r=v((a.length+t|0)+o|0,o)}}function w(r,t){if(!t)return _;for(var e=r.length,o=n.caml_create_bytes(y(0,e,t)),i=0,a=t;;){var s=a,c=i;if(!s)return o;var u=s.tl,f=s.hd;if(!u)return n.caml_blit_bytes(f,0,o,c,f.length),o;n.caml_blit_bytes(f,0,o,c,f.length),n.caml_blit_bytes(r,0,o,c+f.length|0,e),a=u,i=(c+f.length|0)+e|0}}function d(r,t){var e=r.length,o=t.length,i=n.caml_create_bytes(e+o|0);return n.caml_blit_bytes(r,0,i,0,e),n.caml_blit_bytes(t,0,i,e,o),i}function I(r){return r>13||r<9?32===r:11!==r}function N(r){for(var t=r.length,e=0;e<t&&I(r[e]);)e=e+1|0;for(var n=t-1|0;n>=e&&I(r[n]);)n=n-1|0;return n>=e?f(r,e,1+(n-e|0)|0):_}function D(r){for(var t=0,e=0,o=r.length;e<o;++e){var i=r[e];t=t+(i>=32?i>92||i<34?i>=127?4:1:i>91||i<35?2:1:i>=11?13!==i?4:2:i>=8?2:4)|0}if(t===r.length)return s(r);var a=n.caml_create_bytes(t);t=0;for(var _=0,c=r.length;_<c;++_){var u=r[_],f=0;if(u>=35)92!==u?u>=127?f=1:a[t]=u:f=2;else if(u>=32)u>=34?f=2:a[t]=u;else if(u>=14)f=1;else switch(u){case 8:a[t]=92,a[t=t+1|0]=98;break;case 9:a[t]=92,a[t=t+1|0]=116;break;case 10:a[t]=92,a[t=t+1|0]=110;break;case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 11:case 12:f=1;break;case 13:a[t]=92,a[t=t+1|0]=114}switch(f){case 1:a[t]=92,a[t=t+1|0]=48+(u/100|0)|0,a[t=t+1|0]=48+(u/10|0)%10|0,a[t=t+1|0]=48+u%10|0;break;case 2:a[t]=92,a[t=t+1|0]=u}t=t+1|0}return a}function R(r,t){var o=t.length;if(0===o)return t;for(var i=n.caml_create_bytes(o),a=0;a<o;++a)i[a]=e._1(r,t[a]);return i}function X(r,t){var o=t.length;if(0===o)return t;for(var i=n.caml_create_bytes(o),a=0;a<o;++a)i[a]=e._2(r,a,t[a]);return i}function B(r){return R(t.uppercase_ascii,r)}function S(r){return R(t.lowercase_ascii,r)}function q(r,t){if(0===t.length)return t;var n=s(t);return n[0]=e._1(r,t[0]),n}function j(r){return q(t.uppercase_ascii,r)}function k(r){return q(t.lowercase_ascii,r)}function z(r,t,e,n){for(;;){var o=e;if(o>=t)throw{RE_EXN_ID:"Not_found",Error:new Error};if(r[o]===n)return o;e=o+1|0}}function C(r,t){return z(r,r.length,0,t)}function O(r,t,e,n){for(;;){var o=e;if(o>=t)return;if(r[o]===n)return o;e=o+1|0}}function T(r,t){return O(r,r.length,0,t)}function A(r,t,e){var n=r.length;if(t<0||t>n)throw{RE_EXN_ID:"Invalid_argument",_1:"String.index_from / Bytes.index_from",Error:new Error};return z(r,n,t,e)}function F(r,t,e){var n=r.length;if(t<0||t>n)throw{RE_EXN_ID:"Invalid_argument",_1:"String.index_from_opt / Bytes.index_from_opt",Error:new Error};return O(r,n,t,e)}function G(r,t,e){for(;;){var n=t;if(n<0)throw{RE_EXN_ID:"Not_found",Error:new Error};if(r[n]===e)return n;t=n-1|0}}function H(r,t){return G(r,r.length-1|0,t)}function J(r,t,e){if(t<-1||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"String.rindex_from / Bytes.rindex_from",Error:new Error};return G(r,t,e)}function K(r,t,e){for(;;){var n=t;if(n<0)return;if(r[n]===e)return n;t=n-1|0}}function L(r,t){return K(r,r.length-1|0,t)}function M(r,t,e){if(t<-1||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"String.rindex_from_opt / Bytes.rindex_from_opt",Error:new Error};return K(r,t,e)}function P(r,t,e){var n=r.length;if(t<0||t>n)throw{RE_EXN_ID:"Invalid_argument",_1:"String.contains_from / Bytes.contains_from",Error:new Error};try{return z(r,n,t,e),!0}catch(a){var i=o.internalToOCamlException(a);if("Not_found"===i.RE_EXN_ID)return!1;throw i}}function Q(r,t){return P(r,0,t)}function U(r,t,e){if(t<0||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"String.rcontains_from / Bytes.rcontains_from",Error:new Error};try{return G(r,t,e),!0}catch(i){var n=o.internalToOCamlException(i);if("Not_found"===n.RE_EXN_ID)return!1;throw n}}var V=n.caml_bytes_compare;function W(r){return R(t.uppercase,r)}function Y(r){return R(t.lowercase,r)}function Z(r){return q(t.uppercase,r)}function $(r){return q(t.lowercase,r)}var rr=n.caml_bytes_equal,tr=n.bytes_to_string,er=n.bytes_of_string;exports.make=i,exports.init=a,exports.empty=_,exports.copy=s,exports.of_string=u,exports.to_string=c,exports.sub=f,exports.sub_string=l,exports.extend=g,exports.fill=m,exports.blit=E,exports.blit_string=x,exports.concat=w,exports.cat=d,exports.iter=h,exports.iteri=b,exports.map=R,exports.mapi=X,exports.trim=N,exports.escaped=D,exports.index=C,exports.index_opt=T,exports.rindex=H,exports.rindex_opt=L,exports.index_from=A,exports.index_from_opt=F,exports.rindex_from=J,exports.rindex_from_opt=M,exports.contains=Q,exports.contains_from=P,exports.rcontains_from=U,exports.uppercase=W,exports.lowercase=Y,exports.capitalize=Z,exports.uncapitalize=$,exports.uppercase_ascii=B,exports.lowercase_ascii=S,exports.capitalize_ascii=j,exports.uncapitalize_ascii=k,exports.compare=V,exports.equal=rr,exports.unsafe_to_string=tr,exports.unsafe_of_string=er;
},{"./caml.js":"gGFE","./char.js":"cYhC","./curry.js":"NSLD","./caml_bytes.js":"gmRG","./caml_js_exceptions.js":"yO2E"}],"Vht3":[function(require,module,exports) {
"use strict";var r=require("./caml.js"),t=require("./bytes.js"),n=require("./curry.js"),e=require("./caml_bytes.js"),o=require("./caml_string.js"),i=require("./caml_js_exceptions.js");function _(r,n){return e.bytes_to_string(t.init(r,n))}function s(r,n,o){return e.bytes_to_string(t.sub(e.bytes_of_string(r),n,o))}function u(r,t){if(r>=t)return r;throw{RE_EXN_ID:"Invalid_argument",_1:"String.concat",Error:new Error}}function a(r,t,n){for(;;){var e=n,o=r;if(!e)return o;var i=e.tl,_=e.hd;if(!i)return _.length+o|0;n=i,r=u((_.length+t|0)+o|0,o)}}function f(r,t,n,o,i){for(;;){var _=i,s=t;if(!_)return r;var u=_.tl,a=_.hd;if(!u)return e.caml_blit_string(a,0,r,s,a.length),r;e.caml_blit_string(a,0,r,s,a.length),e.caml_blit_string(n,0,r,s+a.length|0,o),i=u,t=(s+a.length|0)+o|0}}function c(r,t){if(!t)return"";var n=r.length;return e.bytes_to_string(f(e.caml_create_bytes(a(0,n,t)),0,r,n,t))}function g(r,t){for(var e=0,o=t.length;e<o;++e)n._1(r,t.charCodeAt(e))}function p(r,t){for(var e=0,o=t.length;e<o;++e)n._2(r,e,t.charCodeAt(e))}function l(r,n){return e.bytes_to_string(t.map(r,e.bytes_of_string(n)))}function x(r,n){return e.bytes_to_string(t.mapi(r,e.bytes_of_string(n)))}function h(r){return r>13||r<9?32===r:11!==r}function m(r){return""===r||!h(r.charCodeAt(0))&&!h(r.charCodeAt(r.length-1|0))?r:e.bytes_to_string(t.trim(e.bytes_of_string(r)))}function d(r){return function(t){for(;;){var n=t;if(n>=r.length)return!1;var e=r.charCodeAt(n);if(e<32)return!0;if(e>92||e<34){if(e>=127)return!0;t=n+1|0}else{if(e>91||e<35)return!0;t=n+1|0}}}(0)?e.bytes_to_string(t.escaped(e.bytes_of_string(r))):r}function E(r,t,n,e){for(;;){var o=n;if(o>=t)throw{RE_EXN_ID:"Not_found",Error:new Error};if(r.charCodeAt(o)===e)return o;n=o+1|0}}function y(r,t){return E(r,r.length,0,t)}function b(r,t,n,e){for(;;){var o=n;if(o>=t)return;if(r.charCodeAt(o)===e)return o;n=o+1|0}}function v(r,t){return b(r,r.length,0,t)}function w(r,t,n){var e=r.length;if(t<0||t>e)throw{RE_EXN_ID:"Invalid_argument",_1:"String.index_from / Bytes.index_from",Error:new Error};return E(r,e,t,n)}function I(r,t,n){var e=r.length;if(t<0||t>e)throw{RE_EXN_ID:"Invalid_argument",_1:"String.index_from_opt / Bytes.index_from_opt",Error:new Error};return b(r,e,t,n)}function N(r,t,n){for(;;){var e=t;if(e<0)throw{RE_EXN_ID:"Not_found",Error:new Error};if(r.charCodeAt(e)===n)return e;t=e-1|0}}function C(r,t){return N(r,r.length-1|0,t)}function D(r,t,n){if(t<-1||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"String.rindex_from / Bytes.rindex_from",Error:new Error};return N(r,t,n)}function R(r,t,n){for(;;){var e=t;if(e<0)return;if(r.charCodeAt(e)===n)return e;t=e-1|0}}function X(r,t){return R(r,r.length-1|0,t)}function A(r,t,n){if(t<-1||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"String.rindex_from_opt / Bytes.rindex_from_opt",Error:new Error};return R(r,t,n)}function z(r,t,n){var e=r.length;if(t<0||t>e)throw{RE_EXN_ID:"Invalid_argument",_1:"String.contains_from / Bytes.contains_from",Error:new Error};try{return E(r,e,t,n),!0}catch(_){var o=i.internalToOCamlException(_);if("Not_found"===o.RE_EXN_ID)return!1;throw o}}function j(r,t){return z(r,0,t)}function q(r,t,n){if(t<0||t>=r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"String.rcontains_from / Bytes.rcontains_from",Error:new Error};try{return N(r,t,n),!0}catch(o){var e=i.internalToOCamlException(o);if("Not_found"===e.RE_EXN_ID)return!1;throw e}}function S(r){return e.bytes_to_string(t.uppercase_ascii(e.bytes_of_string(r)))}function B(r){return e.bytes_to_string(t.lowercase_ascii(e.bytes_of_string(r)))}function k(r){return e.bytes_to_string(t.capitalize_ascii(e.bytes_of_string(r)))}function O(r){return e.bytes_to_string(t.uncapitalize_ascii(e.bytes_of_string(r)))}var T=r.caml_string_compare;function F(r,t){for(var n=0,e=t.length,o=t.length-1|0;o>=0;--o)t.charCodeAt(o)===r&&(n={hd:s(t,o+1|0,(e-o|0)-1|0),tl:n},e=o);return{hd:s(t,0,e),tl:n}}function G(r){return e.bytes_to_string(t.uppercase(e.bytes_of_string(r)))}function H(r){return e.bytes_to_string(t.lowercase(e.bytes_of_string(r)))}function J(r){return e.bytes_to_string(t.capitalize(e.bytes_of_string(r)))}function K(r){return e.bytes_to_string(t.uncapitalize(e.bytes_of_string(r)))}var L=o.make,M=t.blit_string;function P(r,t){return r===t}exports.make=L,exports.init=_,exports.sub=s,exports.blit=M,exports.concat=c,exports.iter=g,exports.iteri=p,exports.map=l,exports.mapi=x,exports.trim=m,exports.escaped=d,exports.index=y,exports.index_opt=v,exports.rindex=C,exports.rindex_opt=X,exports.index_from=w,exports.index_from_opt=I,exports.rindex_from=D,exports.rindex_from_opt=A,exports.contains=j,exports.contains_from=z,exports.rcontains_from=q,exports.uppercase=G,exports.lowercase=H,exports.capitalize=J,exports.uncapitalize=K,exports.uppercase_ascii=S,exports.lowercase_ascii=B,exports.capitalize_ascii=k,exports.uncapitalize_ascii=O,exports.compare=T,exports.equal=P,exports.split_on_char=F;
},{"./caml.js":"gGFE","./bytes.js":"JK9e","./curry.js":"NSLD","./caml_bytes.js":"gmRG","./caml_string.js":"GLny","./caml_js_exceptions.js":"yO2E"}],"VSaX":[function(require,module,exports) {
"use strict";function r(r,t,n,o,a,e){var c=((t+r|0)+o|0)+e|0;return(c<<a|c>>>(32-a|0)|0)+n|0}function t(t,n,o,a,e,c,f){return r(n&o|(-1^n)&a,t,n,e,c,f)}function n(t,n,o,a,e,c,f){return r(n&a|o&(-1^a),t,n,e,c,f)}function o(t,n,o,a,e,c,f){return r(n^o^a,t,n,e,c,f)}function a(t,n,o,a,e,c,f){return r(o^(n|-1^a),t,n,e,c,f)}function e(r,e){var c=r[0],f=r[1],u=r[2],i=r[3];c=t(c,f,u,i,e[0],7,-680876936),i=t(i,c,f,u,e[1],12,-389564586),u=t(u,i,c,f,e[2],17,606105819),f=t(f,u,i,c,e[3],22,-1044525330),c=t(c,f,u,i,e[4],7,-176418897),i=t(i,c,f,u,e[5],12,1200080426),u=t(u,i,c,f,e[6],17,-1473231341),f=t(f,u,i,c,e[7],22,-45705983),c=t(c,f,u,i,e[8],7,1770035416),i=t(i,c,f,u,e[9],12,-1958414417),u=t(u,i,c,f,e[10],17,-42063),f=t(f,u,i,c,e[11],22,-1990404162),c=t(c,f,u,i,e[12],7,1804603682),i=t(i,c,f,u,e[13],12,-40341101),u=t(u,i,c,f,e[14],17,-1502002290),c=n(c,f=t(f,u,i,c,e[15],22,1236535329),u,i,e[1],5,-165796510),i=n(i,c,f,u,e[6],9,-1069501632),u=n(u,i,c,f,e[11],14,643717713),f=n(f,u,i,c,e[0],20,-373897302),c=n(c,f,u,i,e[5],5,-701558691),i=n(i,c,f,u,e[10],9,38016083),u=n(u,i,c,f,e[15],14,-660478335),f=n(f,u,i,c,e[4],20,-405537848),c=n(c,f,u,i,e[9],5,568446438),i=n(i,c,f,u,e[14],9,-1019803690),u=n(u,i,c,f,e[3],14,-187363961),f=n(f,u,i,c,e[8],20,1163531501),c=n(c,f,u,i,e[13],5,-1444681467),i=n(i,c,f,u,e[2],9,-51403784),u=n(u,i,c,f,e[7],14,1735328473),c=o(c,f=n(f,u,i,c,e[12],20,-1926607734),u,i,e[5],4,-378558),i=o(i,c,f,u,e[8],11,-2022574463),u=o(u,i,c,f,e[11],16,1839030562),f=o(f,u,i,c,e[14],23,-35309556),c=o(c,f,u,i,e[1],4,-1530992060),i=o(i,c,f,u,e[4],11,1272893353),u=o(u,i,c,f,e[7],16,-155497632),f=o(f,u,i,c,e[10],23,-1094730640),c=o(c,f,u,i,e[13],4,681279174),i=o(i,c,f,u,e[0],11,-358537222),u=o(u,i,c,f,e[3],16,-722521979),f=o(f,u,i,c,e[6],23,76029189),c=o(c,f,u,i,e[9],4,-640364487),i=o(i,c,f,u,e[12],11,-421815835),u=o(u,i,c,f,e[15],16,530742520),c=a(c,f=o(f,u,i,c,e[2],23,-995338651),u,i,e[0],6,-198630844),i=a(i,c,f,u,e[7],10,1126891415),u=a(u,i,c,f,e[14],15,-1416354905),f=a(f,u,i,c,e[5],21,-57434055),c=a(c,f,u,i,e[12],6,1700485571),i=a(i,c,f,u,e[3],10,-1894986606),u=a(u,i,c,f,e[10],15,-1051523),f=a(f,u,i,c,e[1],21,-2054922799),c=a(c,f,u,i,e[8],6,1873313359),i=a(i,c,f,u,e[15],10,-30611744),u=a(u,i,c,f,e[6],15,-1560198380),f=a(f,u,i,c,e[13],21,1309151649),c=a(c,f,u,i,e[4],6,-145523070),i=a(i,c,f,u,e[11],10,-1120210379),u=a(u,i,c,f,e[2],15,718787259),f=a(f,u,i,c,e[9],21,-343485551),r[0]=c+r[0]|0,r[1]=f+r[1]|0,r[2]=u+r[2]|0,r[3]=i+r[3]|0}var c=[1732584193,-271733879,-1732584194,271733878],f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];function u(r,t,n){var o=r.slice(t,n),a=o.length;c[0]=1732584193,c[1]=-271733879,c[2]=-1732584194,c[3]=271733878;for(var u=0;u<=15;++u)f[u]=0;for(var i=a/64|0,v=1;v<=i;++v){for(var h=0;h<=15;++h){var d=((v<<6)-64|0)+(h<<2)|0;f[h]=((o.charCodeAt(d)+(o.charCodeAt(d+1|0)<<8)|0)+(o.charCodeAt(d+2|0)<<16)|0)+(o.charCodeAt(d+3|0)<<24)|0}e(c,f)}for(var C=o.slice(i<<6),s=0;s<=15;++s)f[s]=0;for(var l=C.length-1|0,A=0;A<=l;++A)f[A/4|0]=f[A/4|0]|C.charCodeAt(A)<<(A%4<<3);var g=l+1|0;if(f[g/4|0]=f[g/4|0]|128<<(g%4<<3),g>55){e(c,f);for(var m=0;m<=15;++m)f[m]=0}return f[14]=a<<3,e(c,f),String.fromCharCode(255&c[0],c[0]>>8&255,c[0]>>16&255,c[0]>>24&255,255&c[1],c[1]>>8&255,c[1]>>16&255,c[1]>>24&255,255&c[2],c[2]>>8&255,c[2]>>16&255,c[2]>>24&255,255&c[3],c[3]>>8&255,c[3]>>16&255,c[3]>>24&255)}exports.caml_md5_string=u;
},{}],"ZLPc":[function(require,module,exports) {
"use strict";var r=require("./char.js"),e=require("./string.js"),t=require("./caml_md5.js"),n=require("./caml_bytes.js"),o=require("./pervasives.js"),_=require("./caml_string.js"),i=require("./caml_external_polyfill.js");function s(r){return t.caml_md5_string(r,0,r.length)}function u(r){return s(n.bytes_to_string(r))}function a(r,e,n){if(e<0||n<0||e>(r.length-n|0))throw{RE_EXN_ID:"Invalid_argument",_1:"Digest.substring",Error:new Error};return t.caml_md5_string(r,e,n)}function l(r,e,t){return a(n.bytes_to_string(r),e,t)}function c(r){var e,t=o.open_in_bin(r);try{e=i.resolve("caml_md5_chan")(t,-1)}catch(n){throw i.resolve("caml_ml_close_channel")(t),n}return i.resolve("caml_ml_close_channel")(t),e}var g=o.output_string;function m(r){return o.really_input_string(r,16)}function f(r){return r+(r<10?48:87)|0}function h(r){if(16!==r.length)throw{RE_EXN_ID:"Invalid_argument",_1:"Digest.to_hex",Error:new Error};for(var e=n.caml_create_bytes(32),t=0;t<=15;++t){var o=_.get(r,t);e[t<<1]=f(o>>>4),e[1+(t<<1)|0]=f(15&o)}return n.bytes_to_string(e)}function E(e){if(32!==e.length)throw{RE_EXN_ID:"Invalid_argument",_1:"Digest.from_hex",Error:new Error};for(var t=function(r){if(r>=65){if(r>=97){if(r>=103)throw{RE_EXN_ID:"Invalid_argument",_1:"Digest.from_hex",Error:new Error};return 10+(r-97|0)|0}if(r>=71)throw{RE_EXN_ID:"Invalid_argument",_1:"Digest.from_hex",Error:new Error};return 10+(r-65|0)|0}if(r>57||r<48)throw{RE_EXN_ID:"Invalid_argument",_1:"Digest.from_hex",Error:new Error};return r-48|0},o=function(r){return(t(_.get(e,r))<<4)+t(_.get(e,r+1|0))|0},i=n.caml_create_bytes(16),s=0;s<=15;++s)n.set(i,s,r.chr(o(s<<1)));return n.bytes_to_string(i)}var p=e.compare,x=e.equal;exports.compare=p,exports.equal=x,exports.string=s,exports.bytes=u,exports.substring=a,exports.subbytes=l,exports.file=c,exports.output=g,exports.input=m,exports.to_hex=h,exports.from_hex=E;
},{"./char.js":"cYhC","./string.js":"Vht3","./caml_md5.js":"VSaX","./caml_bytes.js":"gmRG","./pervasives.js":"z22f","./caml_string.js":"GLny","./caml_external_polyfill.js":"FC4F"}],"l4ED":[function(require,module,exports) {
"use strict";var t=require("./caml.js"),r=require("./array.js"),n=require("./int32.js"),i=require("./int64.js"),e=require("./digest.js"),o=require("./caml_array.js"),u=require("./caml_int64.js"),s=require("./caml_string.js");function f(t){return[Math.floor(2147483647*Math.random())]}function a(t,n){r.blit(n.st,0,t.st,0,55),t.idx=n.idx}function _(t,r){for(var n=function(t,r){return e.string(t+String(r))},i=0===r.length?[0]:r,u=i.length,f=0;f<=54;++f)o.set(t.st,f,f);for(var a,_="x",c=0,x=54+(55>u?55:u)|0;c<=x;++c){var d=c%55,l=c%u;_=n(_,o.get(i,l)),o.set(t.st,d,1073741823&(o.get(t.st,d)^(a=_,((s.get(a,0)+(s.get(a,1)<<8)|0)+(s.get(a,2)<<16)|0)+(s.get(a,3)<<24)|0)))}t.idx=0}function c(t){var r={st:o.make(55,0),idx:0};return _(r,t),r}function x(t){return c(f(void 0))}function d(t){var r={st:o.make(55,0),idx:0};return a(r,t),r}function l(t){t.idx=(t.idx+1|0)%55;var r=o.get(t.st,t.idx),n=1073741823&(o.get(t.st,(t.idx+24|0)%55)+(r^r>>>25&31)|0);return o.set(t.st,t.idx,n),n}function g(t,r){if(r>1073741823||r<=0)throw{RE_EXN_ID:"Invalid_argument",_1:"Random.int",Error:new Error};for(;;){var n=l(t),i=n%r;if((n-i|0)<=(1+(1073741823-r|0)|0))return i}}function m(t,r){if(r<=0)throw{RE_EXN_ID:"Invalid_argument",_1:"Random.int32",Error:new Error};for(;;){var i=l(t)|(1&l(t))<<30,e=i%r;if((i-e|0)<=(1+(n.max_int-r|0)|0))return e}}function v(r,n){if(t.i64_le(n,u.zero))throw{RE_EXN_ID:"Invalid_argument",_1:"Random.int64",Error:new Error};for(;;){var e=u.of_int32(l(r)),o=u.lsl_(u.of_int32(l(r)),30),s=u.lsl_(u.of_int32(7&l(r)),60),f=u.or_(e,u.or_(o,s)),a=u.mod_(f,n);if(!t.i64_gt(u.sub(f,a),u.add(u.sub(i.max_int,n),u.one)))return a}}function p(t){return(l(t)/1073741824+l(t))/1073741824}function E(t,r){return p(t)*r}function j(t){return 0==(1&l(t))}var q={st:[987910699,495797812,364182224,414272206,318284740,990407751,383018966,270373319,840823159,24560019,536292337,512266505,189156120,730249596,143776328,51606627,140166561,366354223,1003410265,700563762,981890670,913149062,526082594,1021425055,784300257,667753350,630144451,949649812,48546892,415514493,258888527,511570777,89983870,283659902,308386020,242688715,482270760,865188196,1027664170,207196989,193777847,619708188,671350186,149669678,257044018,87658204,558145612,183450813,28133145,901332182,710253903,510646120,652377910,409934019,801085050],idx:0};function $(t){return l(q)}function b(t){return g(q,t)}function h(t){return m(q,t)}function w(t){return v(q,t)}function I(t){return p(q)*t}function R(t){return j(q)}function k(t){return _(q,t)}function y(t){return _(q,[t])}function D(t){return k(f(void 0))}function N(t){return d(q)}function X(t){return a(q,t)}var M={make:c,make_self_init:x,copy:d,bits:l,$$int:g,int32:m,int64:v,$$float:E,bool:j};exports.init=y,exports.full_init=k,exports.self_init=D,exports.bits=$,exports.$$int=b,exports.int32=h,exports.int64=w,exports.$$float=I,exports.bool=R,exports.State=M,exports.get_state=N,exports.set_state=X;
},{"./caml.js":"gGFE","./array.js":"d4B1","./int32.js":"wWOr","./int64.js":"f266","./digest.js":"ZLPc","./caml_array.js":"Tpli","./caml_int64.js":"Phox","./caml_string.js":"GLny"}],"QbOX":[function(require,module,exports) {
"use strict";var o=require("./curry.js"),r=require("./caml_option.js");function t(o,t){if(void 0!==o&&t(r.valFromOption(o)))return o}function n(r,n){return t(r,o.__1(n))}function i(o,t){if(void 0!==o)return t(r.valFromOption(o))}function e(r,t){return i(r,o.__1(t))}function u(o){if(void 0!==o)return r.valFromOption(o);throw{RE_EXN_ID:"Not_found",Error:new Error}}function p(o,t,n){return void 0!==o?n(r.valFromOption(o)):t}function f(r,t,n){return p(r,t,o.__1(n))}function v(o,t){if(void 0!==o)return r.some(t(r.valFromOption(o)))}function a(r,t){return v(r,o.__1(t))}function c(o,t){if(void 0!==o)return t(r.valFromOption(o))}function s(r,t){return c(r,o.__1(t))}function m(o,t){return void 0!==o?r.valFromOption(o):t}function x(o){return void 0!==o}function _(o){return void 0===o}function l(o,t,n){return void 0!==o?void 0!==t&&n(r.valFromOption(o),r.valFromOption(t)):void 0===t}function d(r,t,n){return l(r,t,o.__2(n))}function F(o,t,n){return void 0!==o?void 0!==t?n(r.valFromOption(o),r.valFromOption(t)):1:void 0!==t?-1:0}function O(r,t,n){return F(r,t,o.__2(n))}exports.keepU=t,exports.keep=n,exports.forEachU=i,exports.forEach=e,exports.getExn=u,exports.mapWithDefaultU=p,exports.mapWithDefault=f,exports.mapU=v,exports.map=a,exports.flatMapU=c,exports.flatMap=s,exports.getWithDefault=m,exports.isSome=x,exports.isNone=_,exports.eqU=l,exports.eq=d,exports.cmpU=F,exports.cmp=O;
},{"./curry.js":"NSLD","./caml_option.js":"dzFO"}],"Lf2V":[function(require,module,exports) {
"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}var r=require("rescript/lib/js/array.js"),n=require("rescript/lib/js/curry.js"),e=require("rescript/lib/js/caml_obj.js"),s=require("rescript/lib/js/belt_Array.js"),o=require("rescript/lib/js/caml_array.js"),u=require("rescript/lib/js/pervasives.js"),i=require("rescript/lib/js/belt_Option.js"),a=require("../utility/E.bs.js");function f(t,r,n,e,s){return n*((r-s)/(r-t))+e*((s-t)/(r-t))}var c=n._1(a.O.toExt,"Tried to perform an operation on an empty XYShape.");function p(t){return t}function l(t){return t.xs}function g(t){return t.ys}function y(t){return a.A.length(t.xs)}var x=[],v=[],m={xs:x,ys:v};function _(t){return 0===a.A.length(t.xs)}function A(t){return n._1(c,n._1(a.A.Sorted.min,t.xs))}function h(t){return n._1(c,n._1(a.A.Sorted.max,t.xs))}function d(t){return n._1(c,a.A.first(t.ys))}function b(t){return n._1(c,a.A.last(t.ys))}function S(t){return h(t)-A(t)}function X(t,r){return{xs:n._2(a.A.fmap,t,r.xs),ys:r.ys}}function j(t,r){return{xs:r.xs,ys:n._2(a.A.fmap,t,r.ys)}}function M(t){return s.zip(t.xs,t.ys)}function O(t){return{xs:t[0],ys:t[1]}}function q(t,r){return{xs:t,ys:r}}function w(t,r){return O([r.xs,a.A.accumulate(t,r.ys)])}function B(t,n){return{xs:r.concat({hd:t.xs,tl:{hd:n.xs,tl:0}}),ys:r.concat({hd:t.ys,tl:{hd:n.ys,tl:0}})}}function T(t){return O(s.unzip(t))}function Y(t,r){return n._3(a.A.Floats.range,A(t),h(t),r)}function z(t){return{xs:t.xs,ys:t.ys}}var E={toXyShape:p,xs:l,ys:g,length:y,empty:m,isEmpty:_,minX:A,maxX:h,firstY:d,lastY:b,xTotalRange:S,mapX:X,mapY:j,zip:M,fromArray:O,fromArrays:q,accumulateYs:w,concat:B,fromZippedArray:T,equallyDividedXs:Y,toJs:z};function I(t){return n._1(c,a.A.min(n._2(a.A.fmap,A,t)))}function L(t){return n._1(c,a.A.max(n._2(a.A.fmap,h,t)))}function R(t,r){return n._3(a.A.Floats.range,I(t),L(t),r)}function C(t){return n._1(a.A.Sorted.concatMany,n._2(a.A.fmap,l,t))}var F={minX:I,maxX:L,equallyDividedXs:R,allXs:C};function P(t){return t[0]}function D(t){return t[1]}function V(t){return[A(t),d(t)]}function Z(t){return[h(t),b(t)]}function G(t,r){var e=M(t);return n._2(a.A.getBy,e,r)}function U(t,r){var n=M(r),e=s.getIndexBy(n,function(r){return r[0]>t}),o=void 0!==e?0!==e?e-1|0:void 0:n.length-1|0;return i.flatMap(o,function(t){return s.get(n,t)})}var W={x:P,y:D,first:V,last:Z,getBy:G,firstAtOrBeforeXValue:U};function $(r,e){var s=n._2(a.A.Sorted.binarySearchFirstElementGreaterIndex,e.ys,r);if("object"!==t(s))return"overMax"===s?h(e):A(e);var u=s.VAL,i=(u-1|0)<0?0:u-1|0,c=e.xs,p=e.ys;return o.get(p,i)!==r?f(o.get(p,i),o.get(p,u),o.get(c,i),o.get(c,u),r):o.get(c,i)}var k={linear:$};function J(t,r){return n._2(a.O.fmap,D,U(t,r))}function H(t,r){return n._2(a.O.fmap,D,G(r,function(r){return r[0]===t}))}function K(r,e){var s=n._2(a.A.Sorted.binarySearchFirstElementGreaterIndex,e.xs,r);if("object"!==t(s))return"overMax"===s?b(e):d(e);var u=s.VAL,i=(u-1|0)<0?0:u-1|0,c=e.xs,p=e.ys;return o.get(c,i)!==r?f(o.get(c,i),o.get(c,u),o.get(p,i),o.get(p,u),r):o.get(p,i)}function N(t,r){return"Linear"===t?"UseZero"===r?function(t,r,n){if(r<0)return 0;if(r>=(a.A.length(t.xs)-1|0))return 0;var e=o.get(t.xs,r),s=(n-e)/(o.get(t.xs,r+1|0)-e);return o.get(t.ys,r)*(1-s)+o.get(t.ys,r+1|0)*s}:function(t,r,n){if(r<0)return o.get(t.ys,0);if(r>=(a.A.length(t.xs)-1|0))return o.get(t.ys,a.A.length(t.xs)-1|0);var e=o.get(t.xs,r),s=(n-e)/(o.get(t.xs,r+1|0)-e);return o.get(t.ys,r)*(1-s)+o.get(t.ys,r+1|0)*s}:"UseZero"===r?function(t,r,n){return r<0?0:r>=(a.A.length(t.xs)-1|0)?0:o.get(t.ys,r)}:function(t,r,n){return r<0?o.get(t.ys,0):r>=(a.A.length(t.xs)-1|0)?o.get(t.ys,a.A.length(t.xs)-1|0):o.get(t.ys,r)}}function Q(t,r,n){return 0}var tt={stepwiseIncremental:J,stepwiseIfAtX:H,linear:K,continuousInterpolator:N,discreteInterpolator:Q};function rt(t,r){return{xs:t,ys:s.map(t,function(t){return K(t,r)})}}function nt(t,r){return n._2(a.A.fmap,function(t){return $(t,r)},n._3(a.A.Floats.range,0,1,t))}function et(t,r){return rt(Y(r,t),r)}function st(t,r,n){return rt(nt(t,r),n)}var ot={_replaceWithXs:rt,equallyDivideXByMass:nt,proportionEquallyOverX:et,proportionByProbabilityMass:st};function ut(t,r){return e.caml_greaterthan(t[1],r[1])?1:0}function it(t,r){return e.caml_greaterthan(t[0],r[0])?1:0}function at(t){return n._2(a.A.stableSortBy,t,ut)}function ft(t){return n._2(a.A.stableSortBy,t,it)}function ct(t,r){return a.A.filter(function(r){return n._1(t,r[0])},r)}var pt={compareYs:ut,compareXs:it,sortByY:at,sortByX:ft,filterByX:ct},lt=function(t,r,n,e){for(var s=n.xs.length,o=e.xs.length,u=[],i=[],a=-1,f=-1;a<=s-1&&f<=o-1;){var c=void 0,p=void 0,l=void 0;if(f==o-1&&a<s-1||n.xs[a+1]<e.xs[f+1])a++,c=n.xs[a],p=n.ys[a],l=r(e,f,c);else if(a==s-1&&f<o-1||n.xs[a+1]>e.xs[f+1])f++,c=e.xs[f],l=e.ys[f],p=r(n,a,c);else if(a<s-1&&f<o&&n.xs[a+1]===e.xs[f+1])a++,f++,c=n.xs[a],p=n.ys[a],l=e.ys[f];else{if(a===s-1&&f===o-1){a=s,f=o;continue}console.log("Error!",a,f)}u.push(c),i.push(t(p,l))}return{xs:u,ys:i}};function gt(t,r,e,s,o){var u=a.A.length(s.xs),i=a.A.length(o.xs);if(0===u)return 0!==i?o:m;if(0===i)return s;var f=R([s,o],e);return{xs:f,ys:n._2(a.A.fmap,function(e){return n._2(t,n._2(r,e,s),n._2(r,e,o))},f)}}function yt(t,r){var n=a.A.intersperse(M(t),M(r));return O(s.unzip(n))}var xt={combine:lt,combineEvenXs:gt,intersperse:yt};function vt(t){return t[1][0]}function mt(t){return[t[1][0],t[0][1]]}function _t(t){var r=t[1],n=t[0];return(r[0]-n[0])*(n[1]+r[1])/2}function At(t){var r=t[1],n=r[1],e=t[0],s=e[1];return(r[0]-e[0])*(Math.min(s,n)+(s+n)/2)}function ht(t){var r=t[1],n=t[0];return(r[1]-n[1])/(r[0]-n[0])}function dt(t,r){return n._2(a.O.fmap,function(r){return s.map(r,function(r){return[vt(r),n._1(t,r)]})},a.R.toOption(a.A.toRanges(s.zip(r.xs,r.ys))))}function bt(t){for(var r=t.ys,n=t.xs,e=a.A.length(n),u=s.make(e,0),i=0,f=a.A.length(n)-2|0;i<=f;++i)s.set(u,i+1|0,(o.get(n,i+1|0)-o.get(n,i))*((o.get(r,i)+o.get(r,i+1|0))/2)+o.get(u,i));return{xs:n,ys:u}}function St(t){return dt(ht,t)}function Xt(t){var r=t.ys,n=t.xs,e=a.A.length(n),i=new Array(e<<1),f=new Array(e<<1);s.set(i,0,o.get(n,0)-u.epsilon_float),s.set(f,0,0),s.set(i,1,o.get(n,0)),s.set(f,1,o.get(r,0));for(var c=1,p=a.A.length(n);c<p;++c)s.set(i,c<<1,o.get(n,c)-u.epsilon_float),s.set(f,c<<1,o.get(r,c-1|0)),s.set(i,1+(c<<1)|0,o.get(n,c)),s.set(f,1+(c<<1)|0,o.get(r,c));return{xs:i,ys:f}}function jt(t){var r,e=1e-5*S(t),o=a.A.toRanges(s.zip(t.xs,t.ys));if(0===o.TAG){var u=s.map(o._0,mt);r=yt(X(function(t){return t+e},t),O(s.unzip(u)))}else r=t;var i=n._2(a.O.fmap,M,r),f=n._2(a.O.bind,i,function(t){return n._2(a.A.get,t,0)});if(void 0!==r&&void 0!==f){var c=f[0];if(0===c)return r;var p=n._2(a.A.append,[[c,0]],M(r));return n._1(a.O.some,O(s.unzip(p)))}}var Mt={toT:T,nextX:vt,rangePointAssumingSteps:mt,rangeAreaAssumingTriangles:_t,rangeAreaAssumingTrapezoids:At,delta_y_over_delta_x:ht,mapYsBasedOnRanges:dt,integrateWithTriangles:bt,derivative:St,stepwiseToLinear:Xt,stepsToContinuous:jt};function Ot(t,r){return 0!==r?r*Math.log2(Math.abs(t/r)):0}function qt(t,r,e){return n._2(a.O.fmap,D,n._2(a.O.fmap,Z,n._2(a.O.fmap,function(t){return w(function(t,r){return t+r},t)},bt(gt(Ot,K,t,r,e)))))}function wt(t,r,e){var s=void 0!==t?t:function(t,r){return r*t},u=void 0!==r?r:function(t,r,n){return r*t+n*Math.pow(t,2)/2},i=e.xyShape.xs,f=e.xyShape.ys;return n._3(a.A.reducei,i,0,function(t,r,a){var c,p=e.interpolation;if(0!==a)if("Linear"===p){var l=o.get(i,a-1|0),g=o.get(i,a);if(l===g)c=0;else{var y=o.get(f,a-1|0),x=(y-o.get(f,a))/(l-g),v=y-x*l;c=n._3(u,g,v,x)-n._3(u,l,v,x)}}else c=n._2(s,o.get(i,a),o.get(f,a-1|0))-n._2(s,o.get(i,a-1|0),o.get(f,a-1|0));else c=0;return t+c})}function Bt(t){return wt(function(t,r){return r*Math.pow(t,3)/3},function(t,r,n){return r*Math.pow(t,3)/3+n*Math.pow(t,4)/4},t)}function Tt(t,r,e){var s=Math.pow(n._1(r,t),2);return n._1(e,t)-s}function Yt(t){return X(function(t){return Math.pow(t,2)},t)}var zt={integrateContinuousShape:wt,getMeanOfSquaresContinuousShape:Bt,getVarianceDangerously:Tt,squareXYShape:Yt};exports.interpolate=f,exports.extImp=c,exports.T=E,exports.Ts=F,exports.Pairs=W,exports.YtoX=k,exports.XtoY=tt,exports.XsConversion=ot,exports.Zipped=pt,exports.PointwiseCombination=xt,exports.$$Range=Mt,exports.pointLogScore=Ot,exports.logScorePoint=qt,exports.Analysis=zt;
},{"rescript/lib/js/array.js":"d4B1","rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_obj.js":"p3B5","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_array.js":"Tpli","rescript/lib/js/pervasives.js":"z22f","rescript/lib/js/belt_Option.js":"QbOX","../utility/E.bs.js":"xX5m"}],"qr1b":[function(require,module,exports) {
"use strict";var r=require("./caml_option.js");function n(r){return null===r}function t(r){if(null!==r)return r;throw new Error("Js.Null.getExn")}function o(r,n){return null!==r?n(r):null}function e(r,n){if(null!==r)return n(r)}function u(n){return void 0!==n?r.valFromOption(n):null}var l=u;exports.test=n,exports.getExn=t,exports.bind=o,exports.iter=e,exports.fromOption=u,exports.from_opt=l;
},{"./caml_option.js":"dzFO"}],"r7Vb":[function(require,module,exports) {
"use strict";function n(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}var r=require("rescript/lib/js/curry.js"),e=require("rescript/lib/js/js_null.js");function i(e,i){switch(0|e.TAG){case 0:return n({TAG:0,_0:r._1(i[0],e._0)},Symbol.for("name"),"Mixed");case 1:return n({TAG:1,_0:r._1(i[1],e._0)},Symbol.for("name"),"Discrete");case 2:return n({TAG:2,_0:r._1(i[2],e._0)},Symbol.for("name"),"Continuous")}}var t={fmap:i};function u(n){return e.fromOption(void 0)}var o={toJson:u};function s(n){if("number"==typeof n)return 0;switch(0|n.TAG){case 0:case 1:return n._0.excludingProbabilityMass;case 2:return n._0.excludingProbabilityMass+n._1.excludingProbabilityMass}}function c(n){return 1-s(n)}function a(n){if("number"==typeof n)return 0;switch(0|n.TAG){case 1:return 0;case 0:case 2:return n._0.excludingProbabilityMass}}function b(n){return 1/s(n)}function l(n,r){if("number"==typeof n)return r;switch(0|n.TAG){case 0:var e=n._0.excludingProbabilityMass;return r<e||r<e?void 0:(r-e)/(1-s(n));case 1:var i=n._0.excludingProbabilityMass;return r>1-i||r>1-i?void 0:r/(1-s(n));case 2:var t=n._0.excludingProbabilityMass;return r<t||r>1-n._1.excludingProbabilityMass?void 0:(r-t)/(1-s(n))}}var d={excludedProbabilityMass:s,includedProbabilityMass:c,initialProbabilityMass:a,normalizeProbabilityMass:b,yPointToSubYPoint:l};function f(n){return n.continuous}function _(n){return n.discrete}function y(n){return{continuous:n,discrete:0}}function m(n){return{continuous:0,discrete:n}}function P(n,e){return{continuous:r._1(n,e.continuous),discrete:r._1(n,e.discrete)}}function x(n,e,i){return{continuous:r._2(n,e.continuous,i.continuous),discrete:r._2(n,e.discrete,i.discrete)}}function M(n,r){return x(function(n,r){return n+r},n,r)}var p={toContinuousValue:f,toDiscreteValue:_,makeContinuous:y,makeDiscrete:m,fmap:P,combine2:x,add:M};exports.ShapeMonad=t,exports.DistributionUnit=o,exports.Domain=d,exports.MixedPoint=p;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/js_null.js":"qr1b"}],"S4ET":[function(require,module,exports) {
"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(t)}function t(n,t,r){return t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n}var r=require("rescript/lib/js/curry.js"),e=require("../utility/E.bs.js");function o(n){return"Divide"===n?function(n,t){return n/t}:"Multiply"===n?function(n,t){return n*t}:"Add"===n?function(n,t){return n+t}:"Exponentiate"===n?function(n,t){return Math.pow(n,t)}:function(n,t){return n-t}}function i(n,r,e){return"Divide"===n&&0===e?t({TAG:1,_0:"Cannot divide $v1 by zero."},Symbol.for("name"),"Error"):t({TAG:0,_0:o(n)(r,e)},Symbol.for("name"),"Ok")}function u(n){return"Divide"===n?"/":"Multiply"===n?"*":"Add"===n?"+":"Exponentiate"===n?"**":"-"}function a(n,t,r){return t+" "+u(n)+" "+r}var f={toFn:o,applyFn:i,toString:u,format:a};function c(n){return"Add"===n?"+":"Exponentiate"===n?"^":"*"}function l(n,t,r){return t+" "+c(n)+" "+r}var p={toString:c,format:l};function m(t,r){if("object"!==n(t))return"Mean"===t?"mean($value)":"sample($value)";var e=t.NAME;return"Inv"===e?"inv(x="+t.VAL+","+r+")":"Pdf"===e?"pdf(x="+t.VAL+","+r+")":"cdf(x="+t.VAL+","+r+")"}var v={format:m};function y(n){return"Log"===n?function(n,t){return Math.log(n)/Math.log(t)}:"Exponentiate"===n?function(n,t){return Math.pow(n,t)}:function(n,t){return n*t}}function b(n,t,r){return"Log"===n?"verticalLog("+t+", "+r+") ":"Exponentiate"===n?"verticalExponentiate("+t+", "+r+") ":"verticalMultiply("+t+", "+r+") "}function s(n){return"Log"===n?function(n,t){}:"Exponentiate"===n?function(n,t){}:function(n,t){return n*t}}function g(n){return"Log"===n?function(n,t){}:"Exponentiate"===n?function(n,t){}:function(n,t){}}var A={toFn:y,format:b,toIntegralSumCacheFn:s,toIntegralCacheFn:g};function d(n,t,r){return"truncate("+r+", "+e.O.dimap(function(n){return n.toString()},function(n){return"-inf"},n)+", "+e.O.dimap(function(n){return n.toString()},function(n){return"inf"},t)+")"}function x(t,e){if("object"!==n(e))return"";var o=e.NAME;if("Normalize"===o)return"normalize(k"+r._1(t,e.VAL)+")";if("AlgebraicCombination"===o){var i=e.VAL;return a(i[0],r._1(t,i[1]),r._1(t,i[2]))}if("FloatFromDist"===o){var u=e.VAL;return m(u[0],r._1(t,u[1]))}if("PointwiseCombination"===o){var f=e.VAL;return l(f[0],r._1(t,f[1]),r._1(t,f[2]))}if("Truncate"===o){var c=e.VAL;return d(c[0],c[1],r._1(t,c[2]))}if("VerticalScaling"!==o)return"Render"===o?r._1(t,e.VAL):"";var p=e.VAL;return b(p[0],r._1(t,p[1]),r._1(t,p[2]))}var S={truncateToString:d,toString:x};exports.Algebraic=f,exports.Pointwise=p,exports.DistToFloat=v,exports.Scale=A,exports.T=S;
},{"rescript/lib/js/curry.js":"NSLD","../utility/E.bs.js":"xX5m"}],"eTMD":[function(require,module,exports) {
"use strict";var t=require("rescript/lib/js/curry.js");function e(e){var n=e.minX,r=e.maxX,a={get:e.integral,xToY:e.integralXtoY,yToX:e.integralYtoX,sum:e.integralEndY};return{minX:n,maxX:r,integral:e.integral,xTotalRange:function(e){return t._1(r,e)-t._1(n,e)},mapY:e.mapY,xToY:e.xToY,downsample:e.downsample,toShape:e.toShape,toDiscreteProbabilityMassFraction:e.toDiscreteProbabilityMassFraction,toContinuous:e.toContinuous,toDiscrete:e.toDiscrete,normalize:e.normalize,truncate:e.truncate,mean:e.mean,variance:e.variance,updateIntegralCache:e.updateIntegralCache,Integral:a}}function n(e,n,r){if(void 0!==n&&void 0!==r)return t._2(e,n,r)}function r(e,n,r){if(void 0!==n&&void 0!==r)return t._2(e,n,r)}var a={combineIntegralSums:n,combineIntegrals:r};exports.Dist=e,exports.Common=a;
},{"rescript/lib/js/curry.js":"NSLD"}],"YXLi":[function(require,module,exports) {
"use strict";var e=require("rescript/lib/js/curry.js"),t=require("rescript/lib/js/belt_Array.js"),r=require("rescript/lib/js/caml_array.js"),n=require("rescript/lib/js/pervasives.js"),s=require("../utility/E.bs.js"),a=require("./XYShape.bs.js"),i=require("../expressionTree/Operation.bs.js");function o(e,n){var i=void 0!==e&&e,o=a.T.length(n),g=n.ys,u=n.xs;u.unshift(r.get(u,0)),g.unshift(r.get(g,0)),u.push(r.get(u,o-1|0)),g.push(r.get(g,o-1|0));for(var f=s.A.length(u),c=new Array(f),h=new Array(f-1|0),l=new Array(f-2|0),p=0;p<f;++p)t.set(c,p,r.get(u,p)*r.get(u,p));for(var v=0,y=f-2|0;v<=y;++v)t.set(h,v,r.get(u,v)*r.get(u,v+1|0));for(var m=0,M=f-3|0;m<=M;++m)t.set(l,m,r.get(u,m)*r.get(u,m+2|0));var A=new Array(f-2|0),w=new Array(f-2|0),x=new Array(f-2|0);if(i){for(var b=1,d=f-2|0;b<=d;++b){t.set(A,b-1|0,(r.get(u,b+1|0)-r.get(u,b-1|0))*r.get(g,b)/2);var j=r.get(u,b-1|0),_=r.get(u,b),q=r.get(u,b+1|0),T=2*(j*Math.log(j/_)/(j-_)+q*Math.log(_/q)/(q-_))/(j-q),D=2*(Math.log(_/j)/(j-_)+q*Math.log(q/_)/(q-_))/(j-q)-Math.pow(T,2);t.set(w,b-1|0,T),t.set(x,b-1|0,D)}return{n:f-2|0,masses:A,means:w,variances:x}}for(var k=1,C=f-2|0;k<=C;++k)t.set(A,k-1|0,(r.get(u,k+1|0)-r.get(u,k-1|0))*r.get(g,k)/2),t.set(w,k-1|0,(r.get(u,k-1|0)+r.get(u,k)+r.get(u,k+1|0))/3),t.set(x,k-1|0,(r.get(c,k-1|0)+r.get(c,k)+r.get(c,k+1|0)-r.get(h,k-1|0)-r.get(h,k)-r.get(l,k-1|0))/18);return{n:f-2|0,masses:A,means:w,variances:x}}function g(i,g,u){a.T.length(g),a.T.length(u);for(var f=o(void 0,g),c=o("Divide"===i,u),h="Divide"===i?function(e,t){return e*t}:"Multiply"===i?function(e,t){return e*t}:"Add"===i?function(e,t){return e+t}:"Exponentiate"===i?function(e,t){return Math.pow(e,t)}:function(e,t){return e-t},l="Divide"===i?function(e,t,r,n){return e*t+e*Math.pow(n,2)+t*Math.pow(r,2)}:"Multiply"===i?function(e,t,r,n){return e*t+e*Math.pow(n,2)+t*Math.pow(r,2)}:"Add"===i?function(e,t,r,n){return e+t}:"Exponentiate"===i?function(e,t,r,n){return e*t+e*Math.pow(n,2)+t*Math.pow(r,2)}:function(e,t,r,n){return e+t},p=n.infinity,v=n.neg_infinity,y=new Array(Math.imul(f.n,c.n)),m=new Array(Math.imul(f.n,c.n)),M=new Array(Math.imul(f.n,c.n)),A=0,w=f.n;A<w;++A)for(var x=0,b=c.n;x<b;++x){var d=Math.imul(A,c.n)+x|0;t.set(y,d,r.get(f.masses,A)*r.get(c.masses,x));var j=e._2(h,r.get(f.means,A),r.get(c.means,x)),_=e._4(l,r.get(f.variances,A),r.get(c.variances,x),r.get(f.means,A),r.get(c.means,x));t.set(m,d,j),t.set(M,d,_);var q=j-2*Math.sqrt(_)*1.644854,T=j+2*Math.sqrt(_)*1.644854;q<p&&(p=q),T>v&&(v=T)}for(var D=e._3(s.A.Floats.range,p,v,300),k=t.make(300,0),C=0,E=s.A.length(y);C<E;++C)if(r.get(M,C)>0&&r.get(y,C)>0)for(var F=0,B=s.A.length(D);F<B;++F){var P=r.get(D,F)-r.get(m,C),S=r.get(y,C)*Math.exp(-Math.pow(P,2)/(2*r.get(M,C)))/Math.sqrt(6.28318552*r.get(M,C));t.set(k,F,r.get(k,F)+S)}return{xs:D,ys:k}}function u(e){var n=e.ys,a=e.xs,i=s.A.length(a);return{n:i,masses:t.makeBy(i,function(e){return r.get(n,e)}),means:t.makeBy(i,function(e){return r.get(a,e)}),variances:t.makeBy(i,function(e){return 0})}}function f(n,o,g){var u=a.T.length(o),f=a.T.length(g),c=i.Algebraic.toFn(n),h=new Array(f);if("Exponentiate"===n||"Multiply"===n||"Divide"===n)for(var l=0;l<f;++l){for(var p=new Array(u),v=0;v<u;++v)t.set(p,v,[e._2(c,r.get(o.xs,v),r.get(g.xs,l)),r.get(o.ys,v)*r.get(g.ys,l)/r.get(g.xs,l)]);t.set(h,l,p)}else for(var y=0;y<f;++y){for(var m=new Array(u),M=0;M<u;++M)t.set(m,M,[e._2(c,r.get(o.xs,M),r.get(g.xs,y)),r.get(o.ys,M)*r.get(g.ys,y)]);t.set(h,y,m)}var A=a.XtoY.continuousInterpolator("Linear","UseZero");return e._3(s.A.fold_left,function(e,t){return a.PointwiseCombination.combine(function(e,t){return e+t},A,e,t)},a.T.empty,e._2(s.A.fmap,a.T.fromZippedArray,h))}exports.toDiscretePointMassesFromTriangulars=o,exports.combineShapesContinuousContinuous=g,exports.toDiscretePointMassesFromDiscrete=u,exports.combineShapesContinuousDiscrete=f;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_array.js":"Tpli","rescript/lib/js/pervasives.js":"z22f","../utility/E.bs.js":"xX5m","./XYShape.bs.js":"Lf2V","../expressionTree/Operation.bs.js":"S4ET"}],"CVcq":[function(require,module,exports) {
"use strict";function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var n=require("rescript/lib/js/curry.js"),t=require("rescript/lib/js/pervasives.js"),i=require("rescript/lib/js/caml_option.js"),r=require("../utility/E.bs.js"),a=require("./XYShape.bs.js"),o=require("./DistTypes.bs.js"),u=require("./Distributions.bs.js"),p=require("./AlgebraicShapeCombination.bs.js");function c(e){return e.xyShape}function s(e){return e.interpolation}function l(e,n,t,r){return{xyShape:r,interpolation:void 0!==e?e:"Linear",integralSumCache:void 0!==n?i.valFromOption(n):void 0,integralCache:void 0!==t?i.valFromOption(t):void 0}}function h(e,t){return{xyShape:n._1(e,t.xyShape),interpolation:t.interpolation,integralSumCache:t.integralSumCache,integralCache:t.integralCache}}function m(e){return a.T.lastY(e.xyShape)}function f(e,t){var a=i.some(t.integralCache),o=i.some(t.integralSumCache),u=t.interpolation;return n._2(r.O.fmap,function(e){return l(u,o,a,e)},n._1(e,t.xyShape))}var S={xs:[t.neg_infinity],ys:[0]},g=0,y={xyShape:S,interpolation:"Linear",integralSumCache:g,integralCache:void 0},v=a.T.empty,x=0,d=y,C={xyShape:v,interpolation:"Linear",integralSumCache:x,integralCache:d};function b(e){return l(void 0,i.some(e.integralSumCache),i.some(e.integralCache),a.$$Range.stepwiseToLinear(e.xyShape))}function _(e,n,t,r,o,p){var c=void 0!==e?e:function(e,n){},s=void 0!==t?t:"PDF",h=u.Common.combineIntegralSums(c,o.integralSumCache,p.integralSumCache),m=o.interpolation,f=p.interpolation,S="Linear"===m?"Linear"===f?[o,p]:[o,b(p)]:"Linear"===f?[b(o),p]:[o,p],g=S[0],y="PDF"===s?"UseZero":"UseOutermostPoints",v=a.XtoY.continuousInterpolator(g.interpolation,y);return l(void 0,i.some(h),void 0,a.PointwiseCombination.combine(r,v,g.xyShape,S[1].xyShape))}function T(e){if("Linear"===e.interpolation)return e;var t=i.some(e.integralSumCache),o=i.some(e.integralCache);return n._2(r.O.fmap,function(e){return l(void 0,t,o,e)},a.$$Range.stepsToContinuous(e.xyShape))}function O(e,t){return n._1(e,t.xyShape)}function Y(e,n){return{xyShape:n.xyShape,interpolation:n.interpolation,integralSumCache:e,integralCache:n.integralCache}}function X(e,n){return{xyShape:n.xyShape,interpolation:n.interpolation,integralSumCache:n.integralSumCache,integralCache:e}}function $(e,t,i,a){var o=void 0!==t?t:function(e,n){},u=void 0!==e?e:function(e,n){};return n._3(r.A.fold_left,function(e,n){return _(u,o,void 0,i,e,n)},C,a)}function j(e,t,o,u){var p=void 0!==e?e:function(e){},c=void 0!==t?t:function(e){},s=u.integralSumCache,h=u.integralCache;return l(u.interpolation,i.some(n._2(r.O.bind,s,p)),i.some(n._2(r.O.bind,h,c)),a.T.mapY(o,u.xyShape))}function L(e,t){var i=void 0!==e?e:1,a=n._2(r.O.bind,t.integralSumCache,function(e){return i*e});return X(n._2(r.O.bind,t.integralCache,function(e){return L(i,e)}),Y(a,j(void 0,void 0,function(e){return e*i},t)))}function D(e){return a.T.minX(e.xyShape)}function M(e){return a.T.maxX(e.xyShape)}function w(e){return 0}function A(n){return e({TAG:2,_0:n},Symbol.for("name"),"Continuous")}function q(e,t){var i=t.xyShape;return o.MixedPoint.makeContinuous("Linear"===t.interpolation?a.XtoY.linear(e,i):n._2(r.O.$$default,0,a.XtoY.stepwiseIncremental(e,i)))}function I(e,i,o){var u=n._2(r.O.$$default,t.neg_infinity,e),p=n._2(r.O.$$default,t.infinity,i),c=a.Zipped.filterByX(function(e){return e>=u&&e<=p},a.T.zip(o.xyShape)),s=r.O.dimap(function(e){return[[e-t.epsilon_float,0]]},function(e){return[]},e),h=r.O.dimap(function(e){return[[e+t.epsilon_float,0]]},function(e){return[]},i),m=n._1(r.A.concatMany,[s,c,h]);return l(void 0,void 0,void 0,a.T.fromZippedArray(m))}function P(e){var t=a.T.isEmpty(e.xyShape),i=e.integralCache;return t?y:void 0!==i?i:l(void 0,void 0,void 0,n._2(r.O.toExt,"This should not have happened",a.$$Range.integrateWithTriangles(e.xyShape)))}function E(e,n){var t=P(n).xyShape;return h(function(n){return a.XsConversion.proportionByProbabilityMass(e,t,n)},n)}function F(e){var t=P(e);return n._2(r.O.$$default,a.T.lastY(t.xyShape),e.integralSumCache)}function B(e,n){var t=P(n);return a.XtoY.linear(e,t.xyShape)}function R(e,n){var t=P(n);return a.YtoX.linear(e,t.xyShape)}function Z(e){return i.some(e)}function k(e){}function z(e){return Y(1,L(1/F(e),X(P(e),e)))}function U(e){return a.Analysis.integrateContinuousShape(function(e,n){return n*Math.pow(e,2)/2},function(e,n,t){return n*Math.pow(e,2)/2+t*Math.pow(e,3)/3},e)}function W(e){return a.Analysis.getVarianceDangerously(e,U,a.Analysis.getMeanOfSquaresContinuousShape)}var G=u.Dist({minX:D,maxX:M,mapY:j,xToY:q,toShape:A,toContinuous:Z,toDiscrete:k,normalize:z,toDiscreteProbabilityMassFraction:w,downsample:E,truncate:I,updateIntegralCache:X,integral:P,integralEndY:F,integralXtoY:B,integralYtoX:R,mean:U,variance:W});function V(e,n,t){var r=n.xyShape,o=t.xyShape;if(a.T.isEmpty(r)||a.T.isEmpty(o))return C;var c="Linear"===n.interpolation?n:b(n),s=p.combineShapesContinuousDiscrete(e,c.xyShape,o),h="Multiply"===e||"Divide"===e?u.Common.combineIntegralSums(function(e,n){return e*n},n.integralSumCache,t.integralSumCache):void 0;return l(n.interpolation,i.some(h),void 0,s)}function H(e,n,t){var r=n.xyShape,o=t.xyShape,c=a.T.length(r),s=a.T.length(o);if(0===c||0===s)return C;var h=p.combineShapesContinuousContinuous(e,r,o),m=u.Common.combineIntegralSums(function(e,n){return e*n},n.integralSumCache,t.integralSumCache);return l(void 0,i.some(m),void 0,h)}exports.getShape=c,exports.interpolation=s,exports.make=l,exports.shapeMap=h,exports.lastY=m,exports.oShapeMap=f,exports.emptyIntegral=y,exports.empty=C,exports.stepwiseToLinear=b,exports.combinePointwise=_,exports.toLinear=T,exports.shapeFn=O,exports.updateIntegralSumCache=Y,exports.updateIntegralCache=X,exports.reduce=$,exports.mapY=j,exports.scaleBy=L,exports.T=G,exports.combineAlgebraicallyWithDiscrete=V,exports.combineAlgebraically=H;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/pervasives.js":"z22f","rescript/lib/js/caml_option.js":"dzFO","../utility/E.bs.js":"xX5m","./XYShape.bs.js":"Lf2V","./DistTypes.bs.js":"r7Vb","./Distributions.bs.js":"eTMD","./AlgebraicShapeCombination.bs.js":"YXLi"}],"Ms6F":[function(require,module,exports) {
"use strict";function e(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var r=require("rescript/lib/js/curry.js"),t=require("rescript/lib/js/belt_Array.js"),n=require("rescript/lib/js/caml_array.js"),i=require("rescript/lib/js/pervasives.js"),a=require("rescript/lib/js/caml_option.js"),o=require("../utility/E.bs.js"),u=require("rescript/lib/js/belt_MutableMap.js"),c=require("./XYShape.bs.js"),s=require("./DistTypes.bs.js"),p=require("../expressionTree/Operation.bs.js"),l=require("./Continuous.bs.js"),f=require("./Distributions.bs.js");function h(e,r,t){return{xyShape:t,integralSumCache:void 0!==e?a.valFromOption(e):void 0,integralCache:void 0!==r?a.valFromOption(r):void 0}}function m(e,t){return{xyShape:r._1(e,t.xyShape),integralSumCache:t.integralSumCache,integralCache:t.integralCache}}function y(e){return e.xyShape}function g(e,t){var n=a.some(t.integralCache),i=a.some(t.integralSumCache);return r._2(o.O.fmap,function(e){return h(i,n,e)},r._1(e,t.xyShape))}var S={xs:[i.neg_infinity],ys:[0]},x=0,d={xyShape:S,interpolation:"Stepwise",integralSumCache:x,integralCache:void 0},v=c.T.empty,C=0,b=d,_={xyShape:v,integralSumCache:C,integralCache:b};function T(e,t){return r._1(e,t.xyShape)}function j(e){return c.T.lastY(e.xyShape)}function Y(e,r,t,n,i){var o=void 0!==e?e:function(e,r){},u=f.Common.combineIntegralSums(o,n.integralSumCache,i.integralSumCache);return h(a.some(u),void 0,c.PointwiseCombination.combine(function(e,r){return e+r},c.XtoY.discreteInterpolator,n.xyShape,i.xyShape))}function X(e,t,n,i){var a=void 0!==t?t:function(e,r){},u=void 0!==e?e:function(e,r){};return r._3(o.A.fold_left,function(e,r){return Y(u,a,n,e,r)},_,i)}function O(e,r){return{xyShape:r.xyShape,integralSumCache:e,integralCache:r.integralCache}}function q(e,r){return{xyShape:r.xyShape,integralSumCache:r.integralSumCache,integralCache:e}}function A(e,t,i){for(var s=t.xyShape,l=i.xyShape,m=c.T.length(s),y=c.T.length(l),g=f.Common.combineIntegralSums(function(e,r){return e*r},t.integralSumCache,i.integralSumCache),S=p.Algebraic.toFn(e),x=o.FloatFloatMap.empty(void 0),d=0;d<m;++d)for(var v=0;v<y;++v){var C=r._2(S,n.get(s.xs,d),n.get(l.xs,v)),b=r._2(o.O.$$default,0,o.FloatFloatMap.get(C,x)),_=n.get(s.ys,d)*n.get(l.ys,v);u.set(x,C,b+_)}var T=c.Zipped.sortByX(o.FloatFloatMap.toArray(x)),j=c.T.fromZippedArray(T);return h(a.some(g),void 0,j)}function F(e,t,n,i){var u=void 0!==e?e:function(e){},s=void 0!==t?t:function(e){},p=i.integralSumCache,l=i.integralCache;return h(a.some(r._2(o.O.bind,p,u)),a.some(r._2(o.O.bind,l,s)),c.T.mapY(n,i.xyShape))}function $(e,t){var n=void 0!==e?e:1,i=r._2(o.O.fmap,function(e){return n*e},t.integralSumCache),a=n;return q(r._2(o.O.fmap,function(e){return l.scaleBy(a,e)},t.integralCache),O(i,F(void 0,void 0,function(e){return e*n},t)))}function M(e){var r=c.T.isEmpty(e.xyShape),t=e.integralCache;if(r)return d;if(void 0!==t)return t;var n=e.xyShape,a={xs:[c.T.minX(n)-i.epsilon_float],ys:[0]},o=c.T.accumulateYs(function(e,r){return e+r},c.T.concat(a,n));return l.make("Stepwise",void 0,void 0,o)}function D(e){return r._2(o.O.$$default,l.lastY(M(e)),e.integralSumCache)}function I(e){return c.T.minX(e.xyShape)}function w(e){return c.T.maxX(e.xyShape)}function Z(e){return 1}function B(r){return e({TAG:1,_0:r},Symbol.for("name"),"Discrete")}function P(e){}function k(e){return a.some(e)}function z(e){return O(1,$(1/D(e),e))}function E(e,r){var n=c.T.length(r.xyShape);return e<n&&e>=1&&n>1?h(void 0,void 0,c.T.fromZippedArray(c.Zipped.sortByX(t.slice(t.reverse(c.Zipped.sortByY(c.T.zip(r.xyShape))),0,e)))):r}function G(e,t,n){return h(void 0,void 0,c.T.fromZippedArray(c.Zipped.filterByX(function(n){return n>=r._2(o.O.$$default,i.neg_infinity,e)&&n<=r._2(o.O.$$default,i.infinity,t)},c.T.zip(n.xyShape))))}function V(e,t){return s.MixedPoint.makeDiscrete(r._2(o.O.$$default,0,c.XtoY.stepwiseIfAtX(e,t.xyShape)))}function H(e,r){return c.XtoY.linear(e,l.getShape(M(r)))}function J(e,r){return c.YtoX.linear(e,l.getShape(M(r)))}function K(e){var t=e.xyShape;return r._3(o.A.reducei,t.xs,0,function(e,r,i){return e+r*n.get(t.ys,i)})}function L(e){return c.Analysis.getVarianceDangerously(e,K,function(e){return K(m(c.Analysis.squareXYShape,e))})}var N=f.Dist({minX:I,maxX:w,mapY:F,xToY:V,toShape:B,toContinuous:P,toDiscrete:k,normalize:z,toDiscreteProbabilityMassFraction:Z,downsample:E,truncate:G,updateIntegralCache:q,integral:M,integralEndY:D,integralXtoY:H,integralYtoX:J,mean:K,variance:L});exports.make=h,exports.shapeMap=m,exports.getShape=y,exports.oShapeMap=g,exports.emptyIntegral=d,exports.empty=_,exports.shapeFn=T,exports.lastY=j,exports.combinePointwise=Y,exports.reduce=X,exports.updateIntegralSumCache=O,exports.updateIntegralCache=q,exports.combineAlgebraically=A,exports.mapY=F,exports.scaleBy=$,exports.T=N;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_array.js":"Tpli","rescript/lib/js/pervasives.js":"z22f","rescript/lib/js/caml_option.js":"dzFO","../utility/E.bs.js":"xX5m","rescript/lib/js/belt_MutableMap.js":"aHaK","./XYShape.bs.js":"Lf2V","./DistTypes.bs.js":"r7Vb","../expressionTree/Operation.bs.js":"S4ET","./Continuous.bs.js":"CVcq","./Distributions.bs.js":"eTMD"}],"XMuZ":[function(require,module,exports) {
"use strict";function e(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var n=require("rescript/lib/js/caml.js"),t=require("rescript/lib/js/curry.js"),r=require("rescript/lib/js/caml_option.js"),i=require("../utility/E.bs.js"),a=require("./XYShape.bs.js"),o=require("./Discrete.bs.js"),u=require("./DistTypes.bs.js"),c=require("./Continuous.bs.js"),s=require("./Distributions.bs.js");function l(e,n,t,i){return{continuous:t,discrete:i,integralSumCache:void 0!==e?r.valFromOption(e):void 0,integralCache:void 0!==n?r.valFromOption(n):void 0}}function m(e){return a.T.length(c.getShape(e.continuous))+a.T.length(o.getShape(e.discrete))|0}function d(e,n){var a=void 0!==e?e:1,u=o.scaleBy(a,n.discrete),s=c.scaleBy(a,n.continuous),m=t._2(i.O.bind,n.integralCache,function(e){return c.scaleBy(a,e)}),d=t._2(i.O.bind,n.integralSumCache,function(e){return e*a});return l(r.some(d),r.some(m),s,u)}function g(e){return e.continuous}function h(e){return e.discrete}function p(e,n){return{continuous:n.continuous,discrete:n.discrete,integralSumCache:n.integralSumCache,integralCache:e}}function _(e){return n.caml_float_min(t._1(c.T.minX,e.continuous),t._1(o.T.minX,e.discrete))}function C(e){return n.caml_float_max(t._1(c.T.maxX,e.continuous),t._1(o.T.maxX,e.discrete))}function v(n){return e({TAG:0,_0:n},Symbol.for("name"),"Mixed")}function f(e,n,i){var a=t._3(c.T.truncate,e,n,i.continuous),u=t._3(o.T.truncate,e,n,i.discrete);return l(r.some(void 0),r.some(void 0),a,u)}function b(e){var n=t._1(c.T.Integral.get,e.continuous),i=t._1(o.T.Integral.get,e.discrete),a=c.updateIntegralCache(n,e.continuous),u=o.updateIntegralCache(i,e.discrete),s=t._1(c.T.Integral.sum,a),m=t._1(o.T.Integral.sum,u),d=s+m,g=s/d,h=m/d,p=c.updateIntegralSumCache(g,c.scaleBy(g/s,a)),_=o.updateIntegralSumCache(h,o.scaleBy(h/m,u));return l(1,r.some(void 0),p,_)}function T(e,n){var r=b(n),i=t._2(c.T.xToY,e,r.continuous),a=t._2(o.T.xToY,e,r.discrete);return u.MixedPoint.add(i,a)}function S(e){var n=t._1(o.T.Integral.sum,e.discrete);return n/(n+t._1(c.T.Integral.sum,e.continuous))}function I(e,n){var r=t._1(o.T.Integral.sum,n.discrete),i=t._1(c.T.Integral.sum,n.continuous),a=r+i,u=t._2(o.T.downsample,e*(r/a)|0,n.discrete);return{continuous:t._2(c.T.downsample,e*(i/a)|0,n.continuous),discrete:u,integralSumCache:n.integralSumCache,integralCache:n.integralCache}}function y(e){var n=e.integralCache;if(void 0!==n)return n;var r=t._1(c.T.Integral.get,e.continuous),i=c.stepwiseToLinear(t._1(o.T.Integral.get,e.discrete));return c.make(void 0,void 0,void 0,a.PointwiseCombination.combine(function(e,n){return e+n},a.XtoY.continuousInterpolator("Linear","UseOutermostPoints"),c.getShape(r),c.getShape(i)))}function x(e){return c.lastY(y(e))}function O(e,n){return a.XtoY.linear(e,c.getShape(y(n)))}function Y(e,n){return a.YtoX.linear(e,c.getShape(y(n)))}function j(e,n,r,a){var u=void 0!==e?e:function(e){},s=void 0!==n?n:function(e){},l=o.T.mapY,m=o.updateIntegralCache(t._2(i.O.bind,a.discrete.integralCache,s),o.updateIntegralSumCache(t._2(i.O.bind,a.discrete.integralSumCache,u),t._4(l,void 0,void 0,r,a.discrete))),d=c.T.mapY;return{continuous:c.updateIntegralCache(t._2(i.O.bind,a.continuous.integralCache,s),c.updateIntegralSumCache(t._2(i.O.bind,a.continuous.integralSumCache,u),t._4(d,void 0,void 0,r,a.continuous))),discrete:m,integralSumCache:t._2(i.O.bind,a.integralSumCache,u),integralCache:t._2(i.O.bind,a.integralCache,s)}}function A(e){var n=e.discrete,r=e.continuous,i=t._1(o.T.mean,n),a=t._1(c.T.mean,r),u=t._1(o.T.Integral.sum,n),s=t._1(c.T.Integral.sum,r);return(i*u+a*s)/(u+s)}function X(e){var n=e.discrete,r=e.continuous,i=t._1(o.T.Integral.sum,n),u=t._1(c.T.Integral.sum,r),s=i+u,l=i/s;return 0!==l?1!==l?a.Analysis.getVarianceDangerously(e,A,function(e){var n=t._1(o.T.mean,o.shapeMap(a.Analysis.squareXYShape,e.discrete)),r=a.Analysis.getMeanOfSquaresContinuousShape(e.continuous);return(n*i+r*u)/s}):t._1(o.T.variance,n):t._1(c.T.variance,r)}var q=s.Dist({minX:_,maxX:C,mapY:j,xToY:T,toShape:v,toContinuous:g,toDiscrete:h,normalize:b,toDiscreteProbabilityMassFraction:S,downsample:I,truncate:f,updateIntegralCache:p,integral:y,integralEndY:x,integralXtoY:O,integralYtoX:Y,mean:A,variance:X});function D(e,n,t){var r=c.combineAlgebraically(e,n.continuous,t.continuous),i=c.combineAlgebraicallyWithDiscrete(e,t.continuous,n.discrete),a=c.combineAlgebraicallyWithDiscrete(e,n.continuous,t.discrete);return{continuous:c.reduce(void 0,void 0,function(e,n){return e+n},[r,i,a]),discrete:o.combineAlgebraically(e,n.discrete,t.discrete),integralSumCache:s.Common.combineIntegralSums(function(e,n){return e*n},n.integralSumCache,t.integralSumCache),integralCache:void 0}}function w(e,n,a,u,m){var d=void 0!==e?e:function(e,n){},p=void 0!==n?n:function(e,n){},_=o.reduce(d,p,a,t._1(i.A.O.concatSomes,t._2(i.A.fmap,h,[u,m]))),C=c.reduce(d,p,a,t._1(i.A.O.concatSomes,t._2(i.A.fmap,g,[u,m]))),v=s.Common.combineIntegralSums(d,u.integralSumCache,m.integralSumCache),f=s.Common.combineIntegrals(p,u.integralCache,m.integralCache);return l(r.some(v),r.some(f),C,_)}exports.make=l,exports.totalLength=m,exports.scaleBy=d,exports.toContinuous=g,exports.toDiscrete=h,exports.updateIntegralCache=p,exports.T=q,exports.combineAlgebraically=D,exports.combinePointwise=w;
},{"rescript/lib/js/caml.js":"gGFE","rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_option.js":"dzFO","../utility/E.bs.js":"xX5m","./XYShape.bs.js":"Lf2V","./Discrete.bs.js":"Ms6F","./DistTypes.bs.js":"r7Vb","./Continuous.bs.js":"CVcq","./Distributions.bs.js":"eTMD"}],"wbI6":[function(require,module,exports) {
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}var t=require("rescript/lib/js/curry.js"),n=require("rescript/lib/js/random.js"),a=require("rescript/lib/js/belt_Array.js"),o=require("rescript/lib/js/caml_option.js"),i=require("./Mixed.bs.js"),c=require("./Discrete.bs.js"),u=require("./Continuous.bs.js"),s=require("./Distributions.bs.js");function l(e,r){switch(0|r.TAG){case 0:return t._1(e[0],r._0);case 1:return t._1(e[1],r._0);case 2:return t._1(e[2],r._0)}}function T(e,n){switch(0|n.TAG){case 0:return r({TAG:0,_0:t._1(e[0],n._0)},Symbol.for("name"),"Mixed");case 1:return r({TAG:1,_0:t._1(e[1],n._0)},Symbol.for("name"),"Discrete");case 2:return r({TAG:2,_0:t._1(e[2],n._0)},Symbol.for("name"),"Continuous")}}function _(e){return e}function m(e){return i.make(o.some(e.integralSumCache),o.some(e.integralCache),u.empty,e)}function f(e){return i.make(o.some(e.integralSumCache),o.some(e.integralCache),e,c.empty)}var b=[_,m,f];function p(e){return l(b,e)}function g(e,r,n){switch(0|r.TAG){case 0:break;case 1:var a=r._0;switch(0|n.TAG){case 0:break;case 1:return t._1(c.T.toShape,c.combineAlgebraically(e,a,n._0));case 2:return t._1(u.T.toShape,u.combineAlgebraicallyWithDiscrete(e,n._0,a))}break;case 2:var o=r._0;switch(0|n.TAG){case 0:break;case 1:return t._1(u.T.toShape,u.combineAlgebraicallyWithDiscrete(e,o,n._0));case 2:return t._1(u.T.toShape,u.combineAlgebraically(e,o,n._0))}}return t._1(i.T.toShape,i.combineAlgebraically(e,p(r),p(n)))}function y(e,t,n,a,o){var s=void 0!==e?e:function(e,r){},l=void 0!==t?t:function(e,r){};switch(0|a.TAG){case 0:break;case 1:switch(0|o.TAG){case 1:return r({TAG:1,_0:c.combinePointwise(s,l,n,a._0,o._0)},Symbol.for("name"),"Discrete")}break;case 2:switch(0|o.TAG){case 0:case 1:break;case 2:return r({TAG:2,_0:u.combinePointwise(s,l,void 0,n,a._0,o._0)},Symbol.for("name"),"Continuous")}}return r({TAG:0,_0:i.combinePointwise(s,l,n,p(a),p(o))},Symbol.for("name"),"Mixed")}function v(e){var r=[t._1(i.T.xToY,e),t._1(c.T.xToY,e),t._1(u.T.xToY,e)];return function(e){return l(r,e)}}function x(e){return e}function h(e,r){return T([t._1(i.T.downsample,e),t._1(c.T.downsample,e),t._1(u.T.downsample,e)],r)}function d(e,r,n){return T([t._2(i.T.truncate,e,r),t._2(c.T.truncate,e,r),t._2(u.T.truncate,e,r)],n)}var A=i.T.normalize,I=c.T.normalize,w=u.T.normalize,S=[A,I,w];function G(e){return T(S,e)}function C(e,r){return T([t._1(i.T.updateIntegralCache,e),t._1(c.T.updateIntegralCache,e),t._1(u.T.updateIntegralCache,e)],r)}var Y=i.T.toContinuous,D=c.T.toContinuous,X=u.T.toContinuous,j=[Y,D,X];function k(e){return l(j,e)}var M=i.T.toDiscrete,P=c.T.toDiscrete,q=u.T.toDiscrete,F=[M,P,q];function z(e){return l(F,e)}var N=i.T.toDiscreteProbabilityMassFraction,E=c.T.toDiscreteProbabilityMassFraction,L=u.T.toDiscreteProbabilityMassFraction,V=[N,E,L];function W(e){return l(V,e)}var $=i.T.minX,O=c.T.minX,R=u.T.minX,B=[$,O,R];function H(e){return l(B,e)}var J=i.T.Integral.get,K=c.T.Integral.get,Q=u.T.Integral.get,U=[J,K,Q];function Z(e){return l(U,e)}var ee=i.T.Integral.sum,re=c.T.Integral.sum,te=u.T.Integral.sum,ne=[ee,re,te];function ae(e){return l(ne,e)}function oe(e){var r=[t._1(i.T.Integral.xToY,e),t._1(c.T.Integral.xToY,e),t._1(u.T.Integral.xToY,e)];return function(e){return l(r,e)}}function ie(e){var r=[t._1(i.T.Integral.yToX,e),t._1(c.T.Integral.yToX,e),t._1(u.T.Integral.yToX,e)];return function(e){return l(r,e)}}var ce=i.T.maxX,ue=c.T.maxX,se=u.T.maxX,le=[ce,ue,se];function Te(e){return l(le,e)}function _e(e,r,n){var a=void 0!==e?e:function(e){},o=void 0!==r?r:function(e){},s=[t._3(i.T.mapY,a,o,n),t._3(c.T.mapY,a,o,n),t._3(u.T.mapY,a,o,n)];return function(e){return T(s,e)}}function me(e){switch(0|e.TAG){case 0:return t._1(i.T.mean,e._0);case 1:return t._1(c.T.mean,e._0);case 2:return t._1(u.T.mean,e._0)}}function fe(e){switch(0|e.TAG){case 0:return t._1(i.T.variance,e._0);case 1:return t._1(c.T.variance,e._0);case 2:return t._1(u.T.variance,e._0)}}var be=s.Dist({minX:H,maxX:Te,mapY:_e,xToY:v,toShape:x,toContinuous:k,toDiscrete:z,normalize:G,toDiscreteProbabilityMassFraction:W,downsample:h,truncate:d,updateIntegralCache:C,integral:Z,integralEndY:ae,integralXtoY:oe,integralYtoX:ie,mean:me,variance:fe});function pe(e,r){var n=t._2(be.xToY,e,r);return n.continuous+n.discrete}var ge=be.Integral.yToX,ye=be.Integral.xToY;function ve(e,r){for(var n=a.make(e,0),o=0;o<e;++o)a.set(n,o,t._1(r,void 0));return n}function xe(e){var r=n.$$float(1);return t._2(be.Integral.yToX,r,e)}function he(e){switch(0|e.TAG){case 1:var r=e._0.xyShape;if(1!==r.xs.length)return!1;var t=r.ys;return 1===t.length&&1===t[0];case 0:case 2:return!1}}function de(e,r){var n=t._1(be.Integral.get,r),a=t._2(be.updateIntegralCache,n,r);return ve(e,function(e){return xe(a)})}function Ae(r,n){return"object"===e(r)?"Inv"===r.NAME?t._2(ge,r.VAL,n):pe(r.VAL,n):"Mean"===r?t._1(be.mean,n):xe(n)}exports.mapToAll=l,exports.fmap=T,exports.toMixed=p,exports.combineAlgebraically=g,exports.combinePointwise=y,exports.T=be,exports.pdf=pe,exports.inv=ge,exports.cdf=ye,exports.doN=ve,exports.sample=xe,exports.isFloat=he,exports.sampleNRendered=de,exports.operate=Ae;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/random.js":"l4ED","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_option.js":"dzFO","./Mixed.bs.js":"XMuZ","./Discrete.bs.js":"Ms6F","./Continuous.bs.js":"CVcq","./Distributions.bs.js":"eTMD"}],"A9pM":[function(require,module,exports) {
"use strict";function n(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}var t=require("rescript/lib/js/curry.js"),e=require("../utility/E.bs.js"),r=require("./Shape.bs.js"),i=require("./DistTypes.bs.js"),a=require("./Distributions.bs.js");function u(n){return t._1(r.T.Integral.get,n)}function o(n,e,i,a,u){var o=void 0!==a?a:0;return{shape:n,domain:void 0!==i?i:0,integralCache:t._1(r.T.Integral.get,n),unit:o,squiggleString:e}}function s(n,r,i,a,u,o){return{shape:t._2(e.O.$$default,o.shape,n),domain:t._2(e.O.$$default,o.domain,i),integralCache:t._2(e.O.$$default,o.integralCache,r),unit:t._2(e.O.$$default,o.unit,a),squiggleString:t._2(e.O.$$default,o.squiggleString,u)}}function c(n,e){return s(n,t._1(r.T.Integral.get,n),void 0,void 0,void 0,e)}function l(n){return i.Domain.includedProbabilityMass(n.domain)}function d(n,t){return t*i.Domain.includedProbabilityMass(n.domain)}function f(n){return n.shape}function p(n,e){return t._1(n,e.shape)}function g(n){return p(r.T.toContinuous,n)}function m(n){return p(r.T.toDiscrete,n)}function T(n){return c(t._1(r.T.normalize,f(n)),n)}function b(n,e,i){return c(t._3(r.T.truncate,n,e,f(i)),i)}function _(n,e){return i.MixedPoint.fmap(function(n){return d(e,n)},t._2(r.T.xToY,n,f(e)))}function h(n){return p(r.T.minX,n)}function v(n){return p(r.T.maxX,n)}function x(n){return p(r.T.toDiscreteProbabilityMassFraction,n)}function y(t){return c(n({TAG:2,_0:t.integralCache},Symbol.for("name"),"Continuous"),t)}function $(n,r){return s(void 0,t._2(e.O.$$default,r.integralCache,n),void 0,void 0,void 0,r)}function I(n,e){return c(t._2(r.T.downsample,n,f(e)),e)}function C(n,e,i,a){var u=void 0!==n?n:function(n){};return c(t._4(r.T.mapY,u,void 0,i,a.shape),a)}function D(n){return t._1(r.T.Integral.sum,f(n))}function j(n,e){return d(e,t._2(r.T.Integral.xToY,n,f(e)))}function q(n,e){return t._2(r.T.Integral.yToX,n,f(e))}function P(n){return t._1(r.T.mean,n.shape)}function S(n){return t._1(r.T.variance,n.shape)}var Y=a.Dist({minX:h,maxX:v,mapY:C,xToY:_,toShape:f,toContinuous:g,toDiscrete:m,normalize:T,toDiscreteProbabilityMassFraction:x,downsample:I,truncate:b,updateIntegralCache:$,integral:y,integralEndY:D,integralXtoY:j,integralYtoX:q,mean:P,variance:S});exports.shapeIntegral=u,exports.make=o,exports.update=s,exports.updateShape=c,exports.domainIncludedProbabilityMass=l,exports.domainIncludedProbabilityMassAdjustment=d,exports.toShape=f,exports.shapeFn=p,exports.T=Y;
},{"rescript/lib/js/curry.js":"NSLD","../utility/E.bs.js":"xX5m","./Shape.bs.js":"wbI6","./DistTypes.bs.js":"r7Vb","./Distributions.bs.js":"eTMD"}],"GWKE":[function(require,module,exports) {
"use strict";var r=require("./caml_option.js");function e(e,t){if(t in e)return r.some(e[t])}var t=function(r,e){delete r[e]};function n(r){for(var e=Object.keys(r),t=e.length,n=new Array(t),o=0;o<t;++o){var a=e[o];n[o]=[a,r[a]]}return n}function o(r){for(var e=Object.keys(r),t=e.length,n=new Array(t),o=0;o<t;++o)n[o]=r[e[o]];return n}function a(r){for(var e={},t=r;;){var n=t;if(!n)return e;var o=n.hd;e[o[0]]=o[1],t=n.tl}}function s(r){for(var e={},t=r.length,n=0;n<t;++n){var o=r[n];e[o[0]]=o[1]}return e}function f(r,e){for(var t={},n=Object.keys(e),o=n.length,a=0;a<o;++a){var s=n[a];t[s]=r(e[s])}return t}exports.get=e,exports.unsafeDeleteKey=t,exports.entries=n,exports.values=o,exports.fromList=a,exports.fromArray=s,exports.map=f;
},{"./caml_option.js":"dzFO"}],"kurU":[function(require,module,exports) {
"use strict";var r=require("rescript/lib/js/list.js"),t=require("rescript/lib/js/array.js"),e=require("rescript/lib/js/curry.js"),o=require("rescript/lib/js/js_dict.js"),n=require("rescript/lib/js/caml_option.js"),i=require("rescript/lib/js/caml_string.js"),E=require("rescript/lib/js/caml_exceptions.js"),a=require("rescript/lib/js/caml_js_exceptions.js");function _(r){return!!Number.isFinite(r)&&Math.floor(r)===r}var c=E.create("Json_decode.DecodeError");function l(r){return r}function f(r){if("boolean"==typeof r)return r;throw{RE_EXN_ID:c,_1:"Expected boolean, got "+JSON.stringify(r),Error:new Error}}function s(r){if("number"==typeof r)return r;throw{RE_EXN_ID:c,_1:"Expected number, got "+JSON.stringify(r),Error:new Error}}function u(r){var t=s(r);if(_(t))return t;throw{RE_EXN_ID:c,_1:"Expected integer, got "+JSON.stringify(r),Error:new Error}}function p(r){if("string"==typeof r)return r;throw{RE_EXN_ID:c,_1:"Expected string, got "+JSON.stringify(r),Error:new Error}}function h(r){var t=p(r);if(1===t.length)return i.get(t,0);throw{RE_EXN_ID:c,_1:"Expected single-character string, got "+JSON.stringify(r),Error:new Error}}function w(r){return new Date(p(r))}function y(r,t){return null===t?null:e._1(r,t)}function x(r,t){if(null===t)return r;throw{RE_EXN_ID:c,_1:"Expected null, got "+JSON.stringify(t),Error:new Error}}function g(r,t){if(Array.isArray(t)){for(var o=t.length,n=new Array(o),i=0;i<o;++i){var E;try{E=e._1(r,t[i])}catch(l){var _=a.internalToOCamlException(l);if(_.RE_EXN_ID===c)throw{RE_EXN_ID:c,_1:_._1+"\n\tin array at index "+String(i),Error:new Error};throw _}n[i]=E}return n}throw{RE_EXN_ID:c,_1:"Expected array, got "+JSON.stringify(t),Error:new Error}}function N(r,e){return t.to_list(g(r,e))}function d(r,t,o){if(!Array.isArray(o))throw{RE_EXN_ID:c,_1:"Expected array, got "+JSON.stringify(o),Error:new Error};var n=o.length;if(2!==n)throw{RE_EXN_ID:c,_1:"Expected array of length 2, got array of length "+n,Error:new Error};try{return[e._1(r,o[0]),e._1(t,o[1])]}catch(E){var i=a.internalToOCamlException(E);if(i.RE_EXN_ID===c)throw{RE_EXN_ID:c,_1:i._1+"\n\tin pair/tuple2",Error:new Error};throw i}}function D(r,t,o,n){if(!Array.isArray(n))throw{RE_EXN_ID:c,_1:"Expected array, got "+JSON.stringify(n),Error:new Error};var i=n.length;if(3!==i)throw{RE_EXN_ID:c,_1:"Expected array of length 3, got array of length "+i,Error:new Error};try{return[e._1(r,n[0]),e._1(t,n[1]),e._1(o,n[2])]}catch(_){var E=a.internalToOCamlException(_);if(E.RE_EXN_ID===c)throw{RE_EXN_ID:c,_1:E._1+"\n\tin tuple3",Error:new Error};throw E}}function I(r,t,o,n,i){if(!Array.isArray(i))throw{RE_EXN_ID:c,_1:"Expected array, got "+JSON.stringify(i),Error:new Error};var E=i.length;if(4!==E)throw{RE_EXN_ID:c,_1:"Expected array of length 4, got array of length "+E,Error:new Error};try{return[e._1(r,i[0]),e._1(t,i[1]),e._1(o,i[2]),e._1(n,i[3])]}catch(l){var _=a.internalToOCamlException(l);if(_.RE_EXN_ID===c)throw{RE_EXN_ID:c,_1:_._1+"\n\tin tuple4",Error:new Error};throw _}}function v(r,t){if("object"==typeof t&&!Array.isArray(t)&&null!==t){for(var o=Object.keys(t),n=o.length,i={},E=0;E<n;++E){var _,l=o[E];try{_=e._1(r,t[l])}catch(s){var f=a.internalToOCamlException(s);if(f.RE_EXN_ID===c)throw{RE_EXN_ID:c,_1:f._1+"\n\tin dict",Error:new Error};throw f}i[l]=_}return i}throw{RE_EXN_ID:c,_1:"Expected object, got "+JSON.stringify(t),Error:new Error}}function R(r,t,i){if("object"!=typeof i||Array.isArray(i)||null===i)throw{RE_EXN_ID:c,_1:"Expected object, got "+JSON.stringify(i),Error:new Error};var E=o.get(i,r);if(void 0===E)throw{RE_EXN_ID:c,_1:"Expected field '"+r+"'",Error:new Error};try{return e._1(t,n.valFromOption(E))}catch(l){var _=a.internalToOCamlException(l);if(_.RE_EXN_ID===c)throw{RE_EXN_ID:c,_1:_._1+"\n\tat field '"+r+"'",Error:new Error};throw _}}function X(r,t){if(r){var e=r.tl,o=r.hd;if(!e)return function(r){return R(o,t,r)};var n=X(e,t);return function(r){return R(o,n,r)}}throw{RE_EXN_ID:"Invalid_argument",_1:"Expected key_path to contain at least one element",Error:new Error}}function O(r,t){try{return n.some(e._1(r,t))}catch(i){var o=a.internalToOCamlException(i);if(o.RE_EXN_ID===c)return;throw o}}function j(t,o){for(var n=t,i=0;;){var E=i,_=n;if(!_){var l=r.rev(E);throw{RE_EXN_ID:c,_1:"All decoders given to oneOf failed. Here are all the errors: "+l+". And the JSON being decoded: "+JSON.stringify(o),Error:new Error}}try{return e._1(_.hd,o)}catch(s){var f=a.internalToOCamlException(s);if(f.RE_EXN_ID===c){i={hd:f._1,tl:E},n=_.tl;continue}throw f}}}function b(r,t){var e={hd:r,tl:{hd:t,tl:0}};return function(r){return j(e,r)}}function m(r,t,o){try{return e._1(t,o)}catch(i){var n=a.internalToOCamlException(i);if(n.RE_EXN_ID===c)return r;throw n}}function A(r,t,o){return e._1(r,e._1(t,o))}function J(r,t,o){return e._2(r,e._1(t,o),o)}var S=d;exports.DecodeError=c,exports.id=l,exports.bool=f,exports.$$float=s,exports.$$int=u,exports.string=p,exports.$$char=h,exports.date=w,exports.nullable=y,exports.nullAs=x,exports.array=g,exports.list=N,exports.pair=d,exports.tuple2=S,exports.tuple3=D,exports.tuple4=I,exports.dict=v,exports.field=R,exports.at=X,exports.optional=O,exports.oneOf=j,exports.either=b,exports.withDefault=m,exports.map=A,exports.andThen=J;
},{"rescript/lib/js/list.js":"aYjQ","rescript/lib/js/array.js":"d4B1","rescript/lib/js/curry.js":"NSLD","rescript/lib/js/js_dict.js":"GWKE","rescript/lib/js/caml_option.js":"dzFO","rescript/lib/js/caml_string.js":"GLny","rescript/lib/js/caml_exceptions.js":"RiV8","rescript/lib/js/caml_js_exceptions.js":"yO2E"}],"XrLb":[function(require,module,exports) {
"use strict";var r=require("./caml_js_exceptions.js"),e=r.internalToOCamlException;function o(r){throw new Error(r)}function n(r){throw new EvalError(r)}function t(r){throw new RangeError(r)}function s(r){throw new ReferenceError(r)}function a(r){throw new SyntaxError(r)}function i(r){throw new TypeError(r)}function E(r){throw new URIError(r)}var w=r.$$Error;exports.$$Error=w,exports.anyToExnInternal=e,exports.raiseError=o,exports.raiseEvalError=n,exports.raiseRangeError=t,exports.raiseReferenceError=s,exports.raiseSyntaxError=a,exports.raiseTypeError=i,exports.raiseUriError=E;
},{"./caml_js_exceptions.js":"yO2E"}],"zHU1":[function(require,module,exports) {
"use strict";Number.isFinite=Number.isFinite||function(i){return"number"==typeof i&&isFinite(i)},Number.isNaN=Number.isNaN||function(i){return i!=i};
},{}],"NR2f":[function(require,module,exports) {
"use strict";module.exports=function(t){return t&&t.constructor.prototype.isBigNumber||!1};
},{}],"FcSp":[function(require,module,exports) {
"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(e)}function e(t){return(e="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(e){return r(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)})(t)}var t=require("./bignumber/isBigNumber");exports.clone=function r(n){var o=e(n);if("number"===o||"string"===o||"boolean"===o||null==n)return n;if("function"==typeof n.clone)return n.clone();if(Array.isArray(n))return n.map(function(e){return r(e)});if(n instanceof Date)return new Date(n.valueOf());if(t(n))return n;if(n instanceof RegExp)throw new TypeError("Cannot clone "+n);return exports.map(n,r)},exports.map=function(r,e){var t={};for(var n in r)exports.hasOwnProperty(r,n)&&(t[n]=e(r[n]));return t},exports.extend=function(r,e){for(var t in e)exports.hasOwnProperty(e,t)&&(r[t]=e[t]);return r},exports.deepExtend=function r(e,t){if(Array.isArray(t))throw new TypeError("Arrays are not supported by deepExtend");for(var n in t)if(exports.hasOwnProperty(t,n))if(t[n]&&t[n].constructor===Object)void 0===e[n]&&(e[n]={}),e[n].constructor===Object?r(e[n],t[n]):e[n]=t[n];else{if(Array.isArray(t[n]))throw new TypeError("Arrays are not supported by deepExtend");e[n]=t[n]}return e},exports.deepEqual=function(r,e){var t,n,o;if(Array.isArray(r)){if(!Array.isArray(e))return!1;if(r.length!==e.length)return!1;for(n=0,o=r.length;n<o;n++)if(!exports.deepEqual(r[n],e[n]))return!1;return!0}if(r instanceof Object){if(Array.isArray(e)||!(e instanceof Object))return!1;for(t in r)if(!exports.deepEqual(r[t],e[t]))return!1;for(t in e)if(!exports.deepEqual(r[t],e[t]))return!1;return!0}return r===e},exports.canDefineProperty=function(){try{if(Object.defineProperty)return Object.defineProperty({},"x",{get:function(){}}),!0}catch(r){}return!1},exports.lazy=function(r,e,t){if(exports.canDefineProperty()){var n,o=!0;Object.defineProperty(r,e,{get:function(){return o&&(n=t(),o=!1),n},set:function(r){n=r,o=!1},configurable:!0,enumerable:!0})}else r[e]=t()},exports.traverse=function(r,e){var t=r;if(e)for(var n=e.split("."),o=0;o<n.length;o++){var i=n[o];i in t||(t[i]={}),t=t[i]}return t},exports.hasOwnProperty=function(r,e){return r&&Object.hasOwnProperty.call(r,e)},exports.isFactory=function(r){return r&&"function"==typeof r.factory};
},{"./bignumber/isBigNumber":"NR2f"}],"Qbfe":[function(require,module,exports) {
var define;
var n;function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}!function(r,e){"function"==typeof n&&n.amd?n([],e):"object"===("undefined"==typeof exports?"undefined":t(exports))?module.exports=e():r.typed=e()}(this,function(){function n(){return!0}function r(){return!1}function e(){}return function a(){var o=[{name:"number",test:function(n){return"number"==typeof n}},{name:"string",test:function(n){return"string"==typeof n}},{name:"boolean",test:function(n){return"boolean"==typeof n}},{name:"Function",test:function(n){return"function"==typeof n}},{name:"Array",test:Array.isArray},{name:"Date",test:function(n){return n instanceof Date}},{name:"RegExp",test:function(n){return n instanceof RegExp}},{name:"Object",test:function(n){return"object"===t(n)&&n.constructor===Object}},{name:"null",test:function(n){return null===n}},{name:"undefined",test:function(n){return void 0===n}}],u={name:"any",test:n},i=[],f=[],s={types:o,conversions:f,ignore:i};function p(n){var t=N(s.types,function(t){return t.name===n});if(t)return t;if("any"===n)return u;var r=N(s.types,function(t){return t.name.toLowerCase()===n.toLowerCase()});throw new TypeError('Unknown type "'+n+'"'+(r?'. Did you mean "'+r.name+'"?':""))}function c(n){return n===u?999:s.types.indexOf(n)}function l(n){var t=N(s.types,function(t){return t.test(n)});if(t)return t.name;throw new TypeError("Value has unknown type. Value: "+n)}function m(n){return n.map(function(n){var t=n.types.map(b);return(n.restParam?"...":"")+t.join("|")}).join(",")}function g(n,t){var r=0===n.indexOf("..."),e=(r?n.length>3?n.slice(3):"any":n).split("|").map(I).filter(C).filter(k),a=function(n,t){var r={};return n.forEach(function(n){-1!==t.indexOf(n.from)||-1===t.indexOf(n.to)||r[n.from]||(r[n.from]=n)}),Object.keys(r).map(function(n){return r[n]})}(t,e),o=e.map(function(n){var t=p(n);return{name:n,typeIndex:c(t),test:t.test,conversion:null,conversionIndex:-1}}),u=a.map(function(n){var r=p(n.from);return{name:n.from,typeIndex:c(r),test:r.test,conversion:n,conversionIndex:t.indexOf(n)}});return{types:o.concat(u),restParam:r}}function y(n){var t=U(n);return!!t&&t.restParam}function h(n){return n.types.some(function(n){return null!=n.conversion})}function v(t){if(t&&0!==t.types.length){if(1===t.types.length)return p(t.types[0].name).test;if(2===t.types.length){var r=p(t.types[0].name).test,e=p(t.types[1].name).test;return function(n){return r(n)||e(n)}}var a=t.types.map(function(n){return p(n.name).test});return function(n){for(var t=0;t<a.length;t++)if(a[t](n))return!0;return!1}}return n}function d(n){var t,r,e,a;if(y(n)){var o=(t=(a=n,a.slice(0,a.length-1)).map(v)).length,u=v(U(n));return function(n){for(var r=0;r<t.length;r++)if(!t[r](n[r]))return!1;return function(n){for(var t=o;t<n.length;t++)if(!u(n[t]))return!1;return!0}(n)&&n.length>=o+1}}return 0===n.length?function(n){return 0===n.length}:1===n.length?(r=v(n[0]),function(n){return r(n[0])&&1===n.length}):2===n.length?(r=v(n[0]),e=v(n[1]),function(n){return r(n[0])&&e(n[1])&&2===n.length}):(t=n.map(v),function(n){for(var r=0;r<t.length;r++)if(!t[r](n[r]))return!1;return n.length===t.length})}function w(n,t){return t<n.params.length?n.params[t]:y(n.params)?U(n.params):null}function x(n,t,r){var e=w(n,t);return(e?r?e.types.filter(E):e.types:[]).map(b)}function b(n){return n.name}function E(n){return null===n.conversion||void 0===n.conversion}function j(n,t){var r=function(n){for(var t={},r=0;r<n.length;r++)t[n[r]]=!0;return Object.keys(t)}(q(n,function(n){return x(n,t,!1)}));return-1!==r.indexOf("any")?["any"]:r}function O(n){for(var t=999,r=0;r<n.types.length;r++)E(n.types[r])&&(t=Math.min(t,n.types[r].typeIndex));return t}function T(n){for(var t=999,r=0;r<n.types.length;r++)E(n.types[r])||(t=Math.min(t,n.types[r].conversionIndex));return t}function P(n,t){var r;return 0!=(r=n.restParam-t.restParam)?r:0!=(r=h(n)-h(t))?r:0!=(r=O(n)-O(t))?r:T(n)-T(t)}function A(n,t){var r,e,a=Math.min(n.params.length,t.params.length);if(0!=(e=n.params.some(h)-t.params.some(h)))return e;for(r=0;r<a;r++)if(0!=(e=h(n.params[r])-h(t.params[r])))return e;for(r=0;r<a;r++)if(0!==(e=P(n.params[r],t.params[r])))return e;return n.params.length-t.params.length}function S(n){var t,r,e,a,o=[],u=[];switch(n.types.forEach(function(n){n.conversion&&(o.push(p(n.conversion.from).test),u.push(n.conversion.convert))}),u.length){case 0:return function(n){return n};case 1:return t=o[0],e=u[0],function(n){return t(n)?e(n):n};case 2:return t=o[0],r=o[1],e=u[0],a=u[1],function(n){return t(n)?e(n):r(n)?a(n):n};default:return function(n){for(var t=0;t<u.length;t++)if(o[t](n))return u[t](n);return n}}}function F(n,t){return function n(r,e,a){if(e<r.length){var o,u=r[e],i=t?u.types.filter(E):u.types;if(u.restParam){var f=i.filter(E);o=f.length<i.length?[f,i]:[i]}else o=i.map(function(n){return[n]});return q(o,function(t){return n(r,e+1,a.concat([t]))})}return[a.map(function(n,t){return{types:n,restParam:t===r.length-1&&y(r)}})]}(n,0,[])}function M(n,t){if(0===Object.keys(t).length)throw new SyntaxError("No signatures provided");var a=[];Object.keys(t).map(function(n){return function(n,t,r){var e=[];return""!==n.trim()&&(e=n.split(",").map(I).map(function(n,t,e){var a=g(n,r);if(a.restParam&&t!==e.length-1)throw new SyntaxError('Unexpected rest parameter "'+n+'": only allowed for the last parameter');return a})),e.some(L)?null:{params:e,fn:t}}(n,t[n],s.conversions)}).filter(D).forEach(function(n){var t=N(a,function(t){return function(n,t){for(var r=Math.max(n.params.length,t.params.length),e=0;e<r;e++)if(!V(x(n,e,!0),x(t,e,!0)))return!1;var a=n.params.length,o=t.params.length,u=y(n.params),i=y(t.params);return u?i?a===o:o>=a:i?a>=o:a===o}(t,n)});if(t)throw new TypeError('Conflicting signatures "'+m(t.params)+'" and "'+m(n.params)+'".');a.push(n)});var o=q(a,function(n){return(n?F(n.params,!1):[]).map(function(t){return{params:t,fn:n.fn}})}).filter(D);o.sort(A);var u=o[0]&&o[0].params.length<=2&&!y(o[0].params),i=o[1]&&o[1].params.length<=2&&!y(o[1].params),f=o[2]&&o[2].params.length<=2&&!y(o[2].params),p=o[3]&&o[3].params.length<=2&&!y(o[3].params),c=o[4]&&o[4].params.length<=2&&!y(o[4].params),b=o[5]&&o[5].params.length<=2&&!y(o[5].params),E=u&&i&&f&&p&&c&&b,O=o.map(function(n){return d(n.params)}),T=u?v(o[0].params[0]):r,P=i?v(o[1].params[0]):r,M=f?v(o[2].params[0]):r,k=p?v(o[3].params[0]):r,C=c?v(o[4].params[0]):r,U=b?v(o[5].params[0]):r,z=u?v(o[0].params[1]):r,B=i?v(o[1].params[1]):r,G=f?v(o[2].params[1]):r,H=p?v(o[3].params[1]):r,J=c?v(o[4].params[1]):r,K=b?v(o[5].params[1]):r,Q=o.map(function(n){return function(n,t){var r=t;if(n.some(h)){var e=y(n),a=n.map(S);r=function(){for(var n=[],r=e?arguments.length-1:arguments.length,o=0;o<r;o++)n[o]=a[o](arguments[o]);return e&&(n[r]=arguments[r].map(a[r])),t.apply(null,n)}}var o=r;if(y(n)){var u=n.length-1;o=function(){return r.apply(null,R(arguments,0,u).concat([R(arguments,u)]))}}return o}(n.params,n.fn)}),W=u?Q[0]:e,X=i?Q[1]:e,Y=f?Q[2]:e,Z=p?Q[3]:e,$=c?Q[4]:e,_=b?Q[5]:e,nn=u?o[0].params.length:-1,tn=i?o[1].params.length:-1,rn=f?o[2].params.length:-1,en=p?o[3].params.length:-1,an=c?o[4].params.length:-1,on=b?o[5].params.length:-1,un=E?6:0,fn=o.length,sn=function(){"use strict";for(var t=un;t<fn;t++)if(O[t](arguments))return Q[t].apply(null,arguments);throw function(n,t,r){var e,a,o,u=n||"unnamed",i=r;for(o=0;o<t.length;o++){var f=i.filter(function(n){var r=v(w(n,o));return(o<n.params.length||y(n.params))&&r(t[o])});if(0===f.length){if((a=j(i,o)).length>0){var s=l(t[o]);return(e=new TypeError("Unexpected type of argument in function "+u+" (expected: "+a.join(" or ")+", actual: "+s+", index: "+o+")")).data={category:"wrongType",fn:u,index:o,actual:s,expected:a},e}}else i=f}var p=i.map(function(n){return y(n.params)?1/0:n.params.length});if(t.length<Math.min.apply(null,p))return a=j(i,o),(e=new TypeError("Too few arguments in function "+u+" (expected: "+a.join(" or ")+", index: "+t.length+")")).data={category:"tooFewArgs",fn:u,index:t.length,expected:a},e;var c=Math.max.apply(null,p);return t.length>c?((e=new TypeError("Too many arguments in function "+u+" (expected: "+c+", actual: "+t.length+")")).data={category:"tooManyArgs",fn:u,index:t.length,expectedLength:c},e):((e=new TypeError('Arguments of type "'+t.join(", ")+'" do not match any of the defined signatures of function '+u+".")).data={category:"mismatch",actual:t.map(l)},e)}(n,arguments,o)},pn=function(n,t){"use strict";return arguments.length===nn&&T(n)&&z(t)?W.apply(null,arguments):arguments.length===tn&&P(n)&&B(t)?X.apply(null,arguments):arguments.length===rn&&M(n)&&G(t)?Y.apply(null,arguments):arguments.length===en&&k(n)&&H(t)?Z.apply(null,arguments):arguments.length===an&&C(n)&&J(t)?$.apply(null,arguments):arguments.length===on&&U(n)&&K(t)?_.apply(null,arguments):sn.apply(null,arguments)};try{Object.defineProperty(pn,"name",{value:n})}catch(cn){}return pn.signatures=function(n){var t={};return n.forEach(function(n){n.params.some(h)||F(n.params,!0).forEach(function(r){t[m(r)]=n.fn})}),t}(o),pn}function k(n){return-1===s.ignore.indexOf(n)}function I(n){return n.trim()}function C(n){return!!n}function D(n){return null!==n}function L(n){return 0===n.types.length}function U(n){return n[n.length-1]}function R(n,t,r){return Array.prototype.slice.call(n,t,r)}function V(n,t){for(var r=0;r<n.length;r++)if(e=t,a=n[r],-1!==e.indexOf(a))return!0;var e,a;return!1}function N(n,t){for(var r=0;r<n.length;r++)if(t(n[r]))return n[r]}function q(n,t){return Array.prototype.concat.apply([],n.map(t))}function z(n){for(var r="",e=0;e<n.length;e++){var a=n[e];if(("object"===t(a.signatures)||"string"==typeof a.signature)&&""!==a.name)if(""===r)r=a.name;else if(r!==a.name){var o=new Error("Function names do not match (expected: "+r+", actual: "+a.name+")");throw o.data={actual:a.name,expected:r},o}}return r}function B(n){var r,e={};function a(n,t){if(e.hasOwnProperty(n)&&t!==e[n])throw(r=new Error('Signature "'+n+'" is defined twice')).data={signature:n},r}for(var o=0;o<n.length;o++){var u=n[o];if("object"===t(u.signatures))for(var i in u.signatures)u.signatures.hasOwnProperty(i)&&(a(i,u.signatures[i]),e[i]=u.signatures[i]);else{if("string"!=typeof u.signature)throw(r=new TypeError("Function is no typed-function (index: "+o+")")).data={index:o},r;a(u.signature,u),e[u.signature]=u}}return e}return(s=M("typed",{"string, Object":M,Object:function(n){var t=[];for(var r in n)n.hasOwnProperty(r)&&t.push(n[r]);return M(z(t),n)},"...Function":function(n){return M(z(n),B(n))},"string, ...Function":function(n,t){return M(n,B(t))}})).create=a,s.types=o,s.conversions=f,s.ignore=i,s.convert=function(n,t){var r=l(n);if(t===r)return n;for(var e=0;e<s.conversions.length;e++){var a=s.conversions[e];if(a.from===r&&a.to===t)return a.convert(n)}throw new Error("Cannot convert from "+r+" to "+t)},s.find=function(n,t){if(!n.signatures)throw new TypeError("Function is no typed-function");var r;if("string"==typeof t){r=t.split(",");for(var e=0;e<r.length;e++)r[e]=r[e].trim()}else{if(!Array.isArray(t))throw new TypeError("String array or a comma separated string expected");r=t}var a=r.join(","),o=n.signatures[a];if(o)return o;throw new TypeError("Signature not found (signature: "+(n.name||"unnamed")+"("+r.join(", ")+"))")},s.addType=function(n,t){if(!n||"string"!=typeof n.name||"function"!=typeof n.test)throw new TypeError("Object with properties {name: string, test: function} expected");if(!1!==t)for(var r=0;r<s.types.length;r++)if("Object"===s.types[r].name)return void s.types.splice(r,0,n);s.types.push(n)},s.addConversion=function(n){if(!n||"string"!=typeof n.from||"string"!=typeof n.to||"function"!=typeof n.convert)throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");s.conversions.push(n)},s}()});
},{}],"uqMu":[function(require,module,exports) {
"use strict";var e=require("./object");function n(e){for(var n=[],t=0;t<e;t++)n.push(0);return n}exports.isNumber=function(e){return"number"==typeof e},exports.isInteger=function(e){return"boolean"==typeof e||!!isFinite(e)&&e===Math.round(e)},exports.sign=Math.sign||function(e){return e>0?1:e<0?-1:0},exports.format=function(n,t){if("function"==typeof t)return t(n);if(n===1/0)return"Infinity";if(n===-1/0)return"-Infinity";if(isNaN(n))return"NaN";var r,i="auto";switch(t&&(t.notation&&(i=t.notation),exports.isNumber(t)?r=t:exports.isNumber(t.precision)&&(r=t.precision)),i){case"fixed":return exports.toFixed(n,r);case"exponential":return exports.toExponential(n,r);case"engineering":return exports.toEngineering(n,r);case"auto":if(t&&t.exponential&&(void 0!==t.exponential.lower||void 0!==t.exponential.upper)){var o=e.map(t,function(e){return e});return o.exponential=void 0,void 0!==t.exponential.lower&&(o.lowerExp=Math.round(Math.log(t.exponential.lower)/Math.LN10)),void 0!==t.exponential.upper&&(o.upperExp=Math.round(Math.log(t.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+JSON.stringify(t)+" with "+JSON.stringify(o)),exports.toPrecision(n,r,o)}return exports.toPrecision(n,r,t&&t).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],n=arguments[4];return"."!==e?e+n:n});default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", or "fixed".')}},exports.splitNumber=function(e){var n=String(e).toLowerCase().match(/^0*?(-?)(\d+\.?\d*)(e([+-]?\d+))?$/);if(!n)throw new SyntaxError("Invalid number "+e);var t=n[1],r=n[2],i=parseFloat(n[4]||"0"),o=r.indexOf(".");i+=-1!==o?o-1:r.length-1;var p=r.replace(".","").replace(/^0*/,function(e){return i-=e.length,""}).replace(/0*$/,"").split("").map(function(e){return parseInt(e)});return 0===p.length&&(p.push(0),i++),{sign:t,coefficients:p,exponent:i}},exports.toEngineering=function(e,n){if(isNaN(e)||!isFinite(e))return String(e);var t=exports.roundDigits(exports.splitNumber(e),n),r=t.exponent,i=t.coefficients,o=r%3==0?r:r<0?r-3-r%3:r-r%3;if(exports.isNumber(n))for(;n>i.length||r-o+1>i.length;)i.push(0);else for(var p=r>=0?r:Math.abs(o);i.length-1<p;)i.push(0);for(var s=Math.abs(r-o),a=1;s>0;)a++,s--;var u=i.slice(a).join(""),l=exports.isNumber(n)&&u.length||u.match(/[1-9]/)?"."+u:"",x=i.slice(0,a).join("")+l+"e"+(r>=0?"+":"")+o.toString();return t.sign+x},exports.toFixed=function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=exports.splitNumber(e),i="number"==typeof t?exports.roundDigits(r,r.exponent+1+t):r,o=i.coefficients,p=i.exponent+1,s=p+(t||0);return o.length<s&&(o=o.concat(n(s-o.length))),p<0&&(o=n(1-p).concat(o),p=1),p<o.length&&o.splice(p,0,0===p?"0.":"."),i.sign+o.join("")},exports.toExponential=function(e,t){if(isNaN(e)||!isFinite(e))return String(e);var r=exports.splitNumber(e),i=t?exports.roundDigits(r,t):r,o=i.coefficients,p=i.exponent;o.length<t&&(o=o.concat(n(t-o.length)));var s=o.shift();return i.sign+s+(o.length>0?"."+o.join(""):"")+"e"+(p>=0?"+":"")+p},exports.toPrecision=function(e,t,r){if(isNaN(e)||!isFinite(e))return String(e);var i=r&&void 0!==r.lowerExp?r.lowerExp:-3,o=r&&void 0!==r.upperExp?r.upperExp:5,p=exports.splitNumber(e);if(p.exponent<i||p.exponent>=o)return exports.toExponential(e,t);var s=t?exports.roundDigits(p,t):p,a=s.coefficients,u=s.exponent;a.length<t&&(a=a.concat(n(t-a.length))),a=a.concat(n(u-a.length+1+(a.length<t?t-a.length:0)));var l=u>0?u:0;return l<(a=n(-u).concat(a)).length-1&&a.splice(l+1,0,"."),s.sign+a.join("")},exports.roundDigits=function(e,n){for(var t={sign:e.sign,coefficients:e.coefficients,exponent:e.exponent},r=t.coefficients;n<=0;)r.unshift(0),t.exponent++,n++;if(r.length>n&&r.splice(n,r.length-n)[0]>=5){var i=n-1;for(r[i]++;10===r[i];)r.pop(),0===i&&(r.unshift(0),t.exponent++,i++),r[--i]++}return t},exports.digits=function(e){return e.toExponential().replace(/e.*$/,"").replace(/^0\.?0*|\./,"").length},exports.DBL_EPSILON=Number.EPSILON||2.220446049250313e-16,exports.nearlyEqual=function(e,n,t){if(null==t)return e===n;if(e===n)return!0;if(isNaN(e)||isNaN(n))return!1;if(isFinite(e)&&isFinite(n)){var r=Math.abs(e-n);return r<exports.DBL_EPSILON||r<=Math.max(Math.abs(e),Math.abs(n))*t}return!1};
},{"./object":"FcSp"}],"gfmG":[function(require,module,exports) {
"use strict";module.exports=function(t){return t&&t.constructor.prototype.isMatrix||!1};
},{}],"ybZj":[function(require,module,exports) {
"use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(o){return(n="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(n){return t(n)}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":t(n)})(o)}var o=require("typed-function"),e=require("./../utils/number").digits,r=require("./../utils/bignumber/isBigNumber"),i=require("./../utils/collection/isMatrix"),s=function(){return s=o.create,o};exports.create=function(t){t.isNumber=function(t){return"number"==typeof t},t.isComplex=function(n){return t.Complex&&n instanceof t.Complex||!1},t.isBigNumber=r,t.isFraction=function(n){return t.Fraction&&n instanceof t.Fraction||!1},t.isUnit=function(t){return t&&t.constructor.prototype.isUnit||!1},t.isString=function(t){return"string"==typeof t},t.isArray=Array.isArray,t.isMatrix=i,t.isDenseMatrix=function(t){return t&&t.isDenseMatrix&&t.constructor.prototype.isMatrix||!1},t.isSparseMatrix=function(t){return t&&t.isSparseMatrix&&t.constructor.prototype.isMatrix||!1},t.isRange=function(t){return t&&t.constructor.prototype.isRange||!1},t.isIndex=function(t){return t&&t.constructor.prototype.isIndex||!1},t.isBoolean=function(t){return"boolean"==typeof t},t.isResultSet=function(t){return t&&t.constructor.prototype.isResultSet||!1},t.isHelp=function(t){return t&&t.constructor.prototype.isHelp||!1},t.isFunction=function(t){return"function"==typeof t},t.isDate=function(t){return t instanceof Date},t.isRegExp=function(t){return t instanceof RegExp},t.isObject=function(o){return"object"===n(o)&&o.constructor===Object&&!t.isComplex(o)&&!t.isFraction(o)},t.isNull=function(t){return null===t},t.isUndefined=function(t){return void 0===t},t.isAccessorNode=function(t){return t&&t.isAccessorNode&&t.constructor.prototype.isNode||!1},t.isArrayNode=function(t){return t&&t.isArrayNode&&t.constructor.prototype.isNode||!1},t.isAssignmentNode=function(t){return t&&t.isAssignmentNode&&t.constructor.prototype.isNode||!1},t.isBlockNode=function(t){return t&&t.isBlockNode&&t.constructor.prototype.isNode||!1},t.isConditionalNode=function(t){return t&&t.isConditionalNode&&t.constructor.prototype.isNode||!1},t.isConstantNode=function(t){return t&&t.isConstantNode&&t.constructor.prototype.isNode||!1},t.isFunctionAssignmentNode=function(t){return t&&t.isFunctionAssignmentNode&&t.constructor.prototype.isNode||!1},t.isFunctionNode=function(t){return t&&t.isFunctionNode&&t.constructor.prototype.isNode||!1},t.isIndexNode=function(t){return t&&t.isIndexNode&&t.constructor.prototype.isNode||!1},t.isNode=function(t){return t&&t.isNode&&t.constructor.prototype.isNode||!1},t.isObjectNode=function(t){return t&&t.isObjectNode&&t.constructor.prototype.isNode||!1},t.isOperatorNode=function(t){return t&&t.isOperatorNode&&t.constructor.prototype.isNode||!1},t.isParenthesisNode=function(t){return t&&t.isParenthesisNode&&t.constructor.prototype.isNode||!1},t.isRangeNode=function(t){return t&&t.isRangeNode&&t.constructor.prototype.isNode||!1},t.isSymbolNode=function(t){return t&&t.isSymbolNode&&t.constructor.prototype.isNode||!1},t.isChain=function(t){return t&&t.constructor.prototype.isChain||!1};var o=s();return o.types=[{name:"number",test:t.isNumber},{name:"Complex",test:t.isComplex},{name:"BigNumber",test:t.isBigNumber},{name:"Fraction",test:t.isFraction},{name:"Unit",test:t.isUnit},{name:"string",test:t.isString},{name:"Array",test:t.isArray},{name:"Matrix",test:t.isMatrix},{name:"DenseMatrix",test:t.isDenseMatrix},{name:"SparseMatrix",test:t.isSparseMatrix},{name:"Range",test:t.isRange},{name:"Index",test:t.isIndex},{name:"boolean",test:t.isBoolean},{name:"ResultSet",test:t.isResultSet},{name:"Help",test:t.isHelp},{name:"function",test:t.isFunction},{name:"Date",test:t.isDate},{name:"RegExp",test:t.isRegExp},{name:"null",test:t.isNull},{name:"undefined",test:t.isUndefined},{name:"OperatorNode",test:t.isOperatorNode},{name:"ConstantNode",test:t.isConstantNode},{name:"SymbolNode",test:t.isSymbolNode},{name:"ParenthesisNode",test:t.isParenthesisNode},{name:"FunctionNode",test:t.isFunctionNode},{name:"FunctionAssignmentNode",test:t.isFunctionAssignmentNode},{name:"ArrayNode",test:t.isArrayNode},{name:"AssignmentNode",test:t.isAssignmentNode},{name:"BlockNode",test:t.isBlockNode},{name:"ConditionalNode",test:t.isConditionalNode},{name:"IndexNode",test:t.isIndexNode},{name:"RangeNode",test:t.isRangeNode},{name:"Node",test:t.isNode},{name:"Object",test:t.isObject}],o.conversions=[{from:"number",to:"BigNumber",convert:function(n){if(e(n)>15)throw new TypeError("Cannot implicitly convert a number with >15 significant digits to BigNumber (value: "+n+"). Use function bignumber(x) to convert to BigNumber.");return new t.BigNumber(n)}},{from:"number",to:"Complex",convert:function(n){return new t.Complex(n,0)}},{from:"number",to:"string",convert:function(t){return t+""}},{from:"BigNumber",to:"Complex",convert:function(n){return new t.Complex(n.toNumber(),0)}},{from:"Fraction",to:"BigNumber",convert:function(t){throw new TypeError("Cannot implicitly convert a Fraction to BigNumber or vice versa. Use function bignumber(x) to convert to BigNumber or fraction(x) to convert to Fraction.")}},{from:"Fraction",to:"Complex",convert:function(n){return new t.Complex(n.valueOf(),0)}},{from:"number",to:"Fraction",convert:function(n){if(new t.Fraction(n).valueOf()!==n)throw new TypeError("Cannot implicitly convert a number to a Fraction when there will be a loss of precision (value: "+n+"). Use function fraction(x) to convert to Fraction.");return new t.Fraction(n)}},{from:"string",to:"number",convert:function(t){var n=Number(t);if(isNaN(n))throw new Error('Cannot convert "'+t+'" to a number');return n}},{from:"string",to:"BigNumber",convert:function(n){try{return new t.BigNumber(n)}catch(o){throw new Error('Cannot convert "'+n+'" to BigNumber')}}},{from:"string",to:"Fraction",convert:function(n){try{return new t.Fraction(n)}catch(o){throw new Error('Cannot convert "'+n+'" to Fraction')}}},{from:"string",to:"Complex",convert:function(n){try{return new t.Complex(n)}catch(o){throw new Error('Cannot convert "'+n+'" to Complex')}}},{from:"boolean",to:"number",convert:function(t){return+t}},{from:"boolean",to:"BigNumber",convert:function(n){return new t.BigNumber(+n)}},{from:"boolean",to:"Fraction",convert:function(n){return new t.Fraction(+n)}},{from:"boolean",to:"string",convert:function(t){return+t}},{from:"Array",to:"Matrix",convert:function(n){return new t.DenseMatrix(n)}},{from:"Matrix",to:"Array",convert:function(t){return t.valueOf()}}],o};
},{"typed-function":"Qbfe","./../utils/number":"uqMu","./../utils/bignumber/isBigNumber":"NR2f","./../utils/collection/isMatrix":"gfmG"}],"e2Zi":[function(require,module,exports) {
function t(){}t.prototype={on:function(t,n,e){var i=this.e||(this.e={});return(i[t]||(i[t]=[])).push({fn:n,ctx:e}),this},once:function(t,n,e){var i=this;function o(){i.off(t,o),n.apply(e,arguments)}return o._=n,this.on(t,o,e)},emit:function(t){for(var n=[].slice.call(arguments,1),e=((this.e||(this.e={}))[t]||[]).slice(),i=0,o=e.length;i<o;i++)e[i].fn.apply(e[i].ctx,n);return this},off:function(t,n){var e=this.e||(this.e={}),i=e[t],o=[];if(i&&n)for(var r=0,f=i.length;r<f;r++)i[r].fn!==n&&i[r].fn._!==n&&o.push(i[r]);return o.length?e[t]=o:delete e[t],this}},module.exports=t,module.exports.TinyEmitter=t;
},{}],"GJvY":[function(require,module,exports) {
"use strict";var n=require("tiny-emitter");exports.mixin=function(i){var e=new n;return i.on=e.on.bind(e),i.off=e.off.bind(e),i.once=e.once.bind(e),i.emit=e.emit.bind(e),i};
},{"tiny-emitter":"e2Zi"}],"h0xI":[function(require,module,exports) {
"use strict";function t(r,o,e,n){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.fn=r,this.count=o,this.min=e,this.max=n,this.message="Wrong number of arguments in function "+r+" ("+o+" provided, "+e+(null!=n?"-"+n:"")+" expected)",this.stack=(new Error).stack}t.prototype=new Error,t.prototype.constructor=Error,t.prototype.name="ArgumentsError",t.prototype.isArgumentsError=!0,module.exports=t;
},{}],"pvAU":[function(require,module,exports) {
"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(t)}function t(o){return(t="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(t){return r(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)})(o)}var o=require("../../utils/object").lazy,e=require("../../utils/object").isFactory,n=require("../../utils/object").traverse,i=require("../../error/ArgumentsError");function s(r,s,a,f,u){function p(r,t,o){if(o.wrap&&"function"==typeof t&&(t=function(r){var t=function(){for(var t=[],o=0,e=arguments.length;o<e;o++){var n=arguments[o];t[o]=n&&n.valueOf()}return r.apply(u,t)};r.transform&&(t.transform=r.transform);return t}(t)),h(u[r])&&h(t))return t=o.override?f(r,t.signatures):f(u[r],t),u[r]=t,m(r,t),void u.emit("import",r,function(){return t});if(void 0===u[r]||o.override)return u[r]=t,m(r,t),void u.emit("import",r,function(){return t});if(!o.silent)throw new Error('Cannot import "'+r+'": already exists')}function m(r,t){t&&"function"==typeof t.transform?(u.expression.transform[r]=t.transform,b(r)&&(u.expression.mathWithTransform[r]=t.transform)):(delete u.expression.transform[r],b(r)&&(u.expression.mathWithTransform[r]=t))}function c(r){delete u.expression.transform[r],b(r)?u.expression.mathWithTransform[r]=u[r]:delete u.expression.mathWithTransform[r]}function y(r,t){if("string"==typeof r.name){var e=r.name,i=e in u.expression.transform,s=r.path?n(u,r.path):u,p=s.hasOwnProperty(e)?s[e]:void 0,m=function(){var o=a(r);if(o&&"function"==typeof o.transform)throw new Error('Transforms cannot be attached to factory functions. Please create a separate function for it with exports.path="expression.transform"');if(h(p)&&h(o))return t.override||(o=f(p,o)),o;if(void 0===p||t.override)return o;if(!t.silent)throw new Error('Cannot import "'+e+'": already exists')};!1!==r.lazy?(o(s,e,m),i?c(e):("expression.transform"===r.path||x(r))&&o(u.expression.mathWithTransform,e,m)):(s[e]=m(),i?c(e):("expression.transform"===r.path||x(r))&&(u.expression.mathWithTransform[e]=m())),u.emit("import",e,m,r.path)}else a(r)}function l(t){return"function"==typeof t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t||null===t||t&&r.isUnit(t)||t&&r.isComplex(t)||t&&r.isBigNumber(t)||t&&r.isFraction(t)||t&&r.isMatrix(t)||t&&Array.isArray(t)}function h(r){return"function"==typeof r&&"object"===t(r.signatures)}function b(r){return!v.hasOwnProperty(r)}function x(r){return void 0===r.path&&!v.hasOwnProperty(r.name)}var v={expression:!0,type:!0,docs:!0,error:!0,json:!0,chain:!0};return function r(o,n){var s=arguments.length;if(1!==s&&2!==s)throw new i("import",s,1,2);if(n||(n={}),e(o))y(o,n);else if(Array.isArray(o))o.forEach(function(t){r(t,n)});else if("object"===t(o)){for(var a in o)if(o.hasOwnProperty(a)){var f=o[a];l(f)?p(a,f,n):e(o)?y(o,n):r(f,n)}}else if(!n.silent)throw new TypeError("Factory, Object, or Array expected")}}exports.math=!0,exports.name="import",exports.factory=s,exports.lazy=!0;
},{"../../utils/object":"FcSp","../../error/ArgumentsError":"h0xI"}],"hwiE":[function(require,module,exports) {
"use strict";var n=require("../../utils/object");function o(o,r,e,t,a){var u=["Matrix","Array"],c=["number","BigNumber","Fraction"];function f(o){if(o){var e=n.map(r,n.clone);i(o,"matrix",u),i(o,"number",c),n.deepExtend(r,o);var t=n.map(r,n.clone),f=n.map(o,n.clone);return a.emit("config",t,e,f),t}return n.map(r,n.clone)}return f.MATRIX=u,f.NUMBER=c,f}function r(n,o){return-1!==n.indexOf(o)}function e(n,o){return n.map(function(n){return n.toLowerCase()}).indexOf(o.toLowerCase())}function i(n,o,i){if(void 0!==n[o]&&!r(i,n[o])){var t=e(i,n[o]);-1!==t?(console.warn('Warning: Wrong casing for configuration option "'+o+'", should be "'+i[t]+'" instead of "'+n[o]+'".'),n[o]=i[t]):console.warn('Warning: Unknown value "'+n[o]+'" for configuration option "'+o+'". Available options: '+i.map(JSON.stringify).join(", ")+".")}}exports.name="config",exports.math=!0,exports.factory=o;
},{"../../utils/object":"FcSp"}],"MP6P":[function(require,module,exports) {
"use strict";require("./../utils/polyfills");var e=require("./../utils/object").isFactory,r=require("./typed"),t=require("./../utils/emitter"),i=require("./function/import"),o=require("./function/config");exports.create=function(n){if("function"!=typeof Object.create)throw new Error("ES5 not supported by this JavaScript engine. Please load the es5-shim and es5-sham library for compatibility.");var a=[],p=[],c=t.mixin({});c.type={},c.expression={transform:{},mathWithTransform:{}},c.typed=r.create(c.type);var s={epsilon:1e-12,matrix:"Matrix",number:"number",precision:64,predictable:!1,randomSeed:null};function u(r){if(!e(r))throw new Error("Factory object with properties `type`, `name`, and `factory` expected");var t,i=a.indexOf(r);return-1===i?(t=!0===r.math?r.factory(c.type,s,u,c.typed,c):r.factory(c.type,s,u,c.typed),a.push(r),p.push(t)):t=p[i],t}return c.import=u(i),c.config=u(o),c.expression.mathWithTransform.config=c.config,n&&c.config(n),c};
},{"./../utils/polyfills":"zHU1","./../utils/object":"FcSp","./typed":"ybZj","./../utils/emitter":"GJvY","./function/import":"pvAU","./function/config":"hwiE"}],"c8f9":[function(require,module,exports) {
var define;
var n;!function(e){"use strict";var i,t,r,s,o=9e15,u=1e9,c="0123456789abcdef",f="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",a="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",h={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-o,maxE:o,crypto:!1},l=!0,d="[DecimalError] ",p=d+"Invalid argument: ",g=d+"Precision limit exceeded",m=d+"crypto unavailable",w=Math.floor,v=Math.pow,N=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,b=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,E=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,x=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=1e7,M=7,q=f.length-1,O=a.length-1,D={name:"[object Decimal]"};function F(n){var e,i,t,r=n.length-1,s="",o=n[0];if(r>0){for(s+=o,e=1;e<r;e++)t=n[e]+"",(i=M-t.length)&&(s+=C(i)),s+=t;o=n[e],(i=M-(t=o+"").length)&&(s+=C(i))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function A(n,e,i){if(n!==~~n||n<e||n>i)throw Error(p+n)}function S(n,e,i,t){var r,s,o,u;for(s=n[0];s>=10;s/=10)--e;return--e<0?(e+=M,r=0):(r=Math.ceil((e+1)/M),e%=M),s=v(10,M-e),u=n[r]%s|0,null==t?e<3?(0==e?u=u/100|0:1==e&&(u=u/10|0),o=i<4&&99999==u||i>3&&49999==u||5e4==u||0==u):o=(i<4&&u+1==s||i>3&&u+1==s/2)&&(n[r+1]/s/100|0)==v(10,e-2)-1||(u==s/2||0==u)&&0==(n[r+1]/s/100|0):e<4?(0==e?u=u/1e3|0:1==e?u=u/100|0:2==e&&(u=u/10|0),o=(t||i<4)&&9999==u||!t&&i>3&&4999==u):o=((t||i<4)&&u+1==s||!t&&i>3&&u+1==s/2)&&(n[r+1]/s/1e3|0)==v(10,e-3)-1,o}function Z(n,e,i){for(var t,r,s=[0],o=0,u=n.length;o<u;){for(r=s.length;r--;)s[r]*=e;for(s[0]+=c.indexOf(n.charAt(o++)),t=0;t<s.length;t++)s[t]>i-1&&(void 0===s[t+1]&&(s[t+1]=0),s[t+1]+=s[t]/i|0,s[t]%=i)}return s.reverse()}D.absoluteValue=D.abs=function(){var n=new this.constructor(this);return n.s<0&&(n.s=1),R(n)},D.ceil=function(){return R(new this.constructor(this),this.e+1,2)},D.comparedTo=D.cmp=function(n){var e,i,t,r,s=this,o=s.d,u=(n=new s.constructor(n)).d,c=s.s,f=n.s;if(!o||!u)return c&&f?c!==f?c:o===u?0:!o^c<0?1:-1:NaN;if(!o[0]||!u[0])return o[0]?c:u[0]?-f:0;if(c!==f)return c;if(s.e!==n.e)return s.e>n.e^c<0?1:-1;for(e=0,i=(t=o.length)<(r=u.length)?t:r;e<i;++e)if(o[e]!==u[e])return o[e]>u[e]^c<0?1:-1;return t===r?0:t>r^c<0?1:-1},D.cosine=D.cos=function(){var n,e,i=this,t=i.constructor;return i.d?i.d[0]?(n=t.precision,e=t.rounding,t.precision=n+Math.max(i.e,i.sd())+M,t.rounding=1,i=function(n,e){var i,t,r=e.d.length;r<32?(i=Math.ceil(r/3),t=(1/G(4,i)).toString()):(i=16,t="2.3283064365386962890625e-10");n.precision+=i,e=z(n,1,e.times(t),new n(1));for(var s=i;s--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=i,e}(t,K(t,i)),t.precision=n,t.rounding=e,R(2==s||3==s?i.neg():i,n,e,!0)):new t(1):new t(NaN)},D.cubeRoot=D.cbrt=function(){var n,e,i,t,r,s,o,u,c,f,a=this,h=a.constructor;if(!a.isFinite()||a.isZero())return new h(a);for(l=!1,(s=a.s*v(a.s*a,1/3))&&Math.abs(s)!=1/0?t=new h(s.toString()):(i=F(a.d),(s=((n=a.e)-i.length+1)%3)&&(i+=1==s||-2==s?"0":"00"),s=v(i,1/3),n=w((n+1)/3)-(n%3==(n<0?-1:2)),(t=new h(i=s==1/0?"5e"+n:(i=s.toExponential()).slice(0,i.indexOf("e")+1)+n)).s=a.s),o=(n=h.precision)+3;;)if(f=(c=(u=t).times(u).times(u)).plus(a),t=P(f.plus(a).times(u),f.plus(c),o+2,1),F(u.d).slice(0,o)===(i=F(t.d)).slice(0,o)){if("9999"!=(i=i.slice(o-3,o+1))&&(r||"4999"!=i)){+i&&(+i.slice(1)||"5"!=i.charAt(0))||(R(t,n+1,1),e=!t.times(t).times(t).eq(a));break}if(!r&&(R(u,n+1,0),u.times(u).times(u).eq(a))){t=u;break}o+=4,r=1}return l=!0,R(t,n,h.rounding,e)},D.decimalPlaces=D.dp=function(){var n,e=this.d,i=NaN;if(e){if(i=((n=e.length-1)-w(this.e/M))*M,n=e[n])for(;n%10==0;n/=10)i--;i<0&&(i=0)}return i},D.dividedBy=D.div=function(n){return P(this,new this.constructor(n))},D.dividedToIntegerBy=D.divToInt=function(n){var e=this.constructor;return R(P(this,new e(n),0,1,1),e.precision,e.rounding)},D.equals=D.eq=function(n){return 0===this.cmp(n)},D.floor=function(){return R(new this.constructor(this),this.e+1,3)},D.greaterThan=D.gt=function(n){return this.cmp(n)>0},D.greaterThanOrEqualTo=D.gte=function(n){var e=this.cmp(n);return 1==e||0===e},D.hyperbolicCosine=D.cosh=function(){var n,e,i,t,r,s=this,o=s.constructor,u=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return u;i=o.precision,t=o.rounding,o.precision=i+Math.max(s.e,s.sd())+4,o.rounding=1,(r=s.d.length)<32?e=(1/G(4,n=Math.ceil(r/3))).toString():(n=16,e="2.3283064365386962890625e-10"),s=z(o,1,s.times(e),new o(1),!0);for(var c,f=n,a=new o(8);f--;)c=s.times(s),s=u.minus(c.times(a.minus(c.times(a))));return R(s,o.precision=i,o.rounding=t,!0)},D.hyperbolicSine=D.sinh=function(){var n,e,i,t,r=this,s=r.constructor;if(!r.isFinite()||r.isZero())return new s(r);if(e=s.precision,i=s.rounding,s.precision=e+Math.max(r.e,r.sd())+4,s.rounding=1,(t=r.d.length)<3)r=z(s,2,r,r,!0);else{n=(n=1.4*Math.sqrt(t))>16?16:0|n,r=z(s,2,r=r.times(1/G(5,n)),r,!0);for(var o,u=new s(5),c=new s(16),f=new s(20);n--;)o=r.times(r),r=r.times(u.plus(o.times(c.times(o).plus(f))))}return s.precision=e,s.rounding=i,R(r,e,i,!0)},D.hyperbolicTangent=D.tanh=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+7,t.rounding=1,P(i.sinh(),i.cosh(),t.precision=n,t.rounding=e)):new t(i.s)},D.inverseCosine=D.acos=function(){var n,e=this,i=e.constructor,t=e.abs().cmp(1),r=i.precision,s=i.rounding;return-1!==t?0===t?e.isNeg()?_(i,r,s):new i(0):new i(NaN):e.isZero()?_(i,r+4,s).times(.5):(i.precision=r+6,i.rounding=1,e=e.asin(),n=_(i,r+4,s).times(.5),i.precision=r,i.rounding=s,n.minus(e))},D.inverseHyperbolicCosine=D.acosh=function(){var n,e,i=this,t=i.constructor;return i.lte(1)?new t(i.eq(1)?0:NaN):i.isFinite()?(n=t.precision,e=t.rounding,t.precision=n+Math.max(Math.abs(i.e),i.sd())+4,t.rounding=1,l=!1,i=i.times(i).minus(1).sqrt().plus(i),l=!0,t.precision=n,t.rounding=e,i.ln()):new t(i)},D.inverseHyperbolicSine=D.asinh=function(){var n,e,i=this,t=i.constructor;return!i.isFinite()||i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+2*Math.max(Math.abs(i.e),i.sd())+6,t.rounding=1,l=!1,i=i.times(i).plus(1).sqrt().plus(i),l=!0,t.precision=n,t.rounding=e,i.ln())},D.inverseHyperbolicTangent=D.atanh=function(){var n,e,i,t,r=this,s=r.constructor;return r.isFinite()?r.e>=0?new s(r.abs().eq(1)?r.s/0:r.isZero()?r:NaN):(n=s.precision,e=s.rounding,t=r.sd(),Math.max(t,n)<2*-r.e-1?R(new s(r),n,e,!0):(s.precision=i=t-r.e,r=P(r.plus(1),new s(1).minus(r),i+n,1),s.precision=n+4,s.rounding=1,r=r.ln(),s.precision=n,s.rounding=e,r.times(.5))):new s(NaN)},D.inverseSine=D.asin=function(){var n,e,i,t,r=this,s=r.constructor;return r.isZero()?new s(r):(e=r.abs().cmp(1),i=s.precision,t=s.rounding,-1!==e?0===e?((n=_(s,i+4,t).times(.5)).s=r.s,n):new s(NaN):(s.precision=i+6,s.rounding=1,r=r.div(new s(1).minus(r.times(r)).sqrt().plus(1)).atan(),s.precision=i,s.rounding=t,r.times(2)))},D.inverseTangent=D.atan=function(){var n,e,i,t,r,s,o,u,c,f=this,a=f.constructor,h=a.precision,d=a.rounding;if(f.isFinite()){if(f.isZero())return new a(f);if(f.abs().eq(1)&&h+4<=O)return(o=_(a,h+4,d).times(.25)).s=f.s,o}else{if(!f.s)return new a(NaN);if(h+4<=O)return(o=_(a,h+4,d).times(.5)).s=f.s,o}for(a.precision=u=h+10,a.rounding=1,n=i=Math.min(28,u/M+2|0);n;--n)f=f.div(f.times(f).plus(1).sqrt().plus(1));for(l=!1,e=Math.ceil(u/M),t=1,c=f.times(f),o=new a(f),r=f;-1!==n;)if(r=r.times(c),s=o.minus(r.div(t+=2)),r=r.times(c),void 0!==(o=s.plus(r.div(t+=2))).d[e])for(n=e;o.d[n]===s.d[n]&&n--;);return i&&(o=o.times(2<<i-1)),l=!0,R(o,a.precision=h,a.rounding=d,!0)},D.isFinite=function(){return!!this.d},D.isInteger=D.isInt=function(){return!!this.d&&w(this.e/M)>this.d.length-2},D.isNaN=function(){return!this.s},D.isNegative=D.isNeg=function(){return this.s<0},D.isPositive=D.isPos=function(){return this.s>0},D.isZero=function(){return!!this.d&&0===this.d[0]},D.lessThan=D.lt=function(n){return this.cmp(n)<0},D.lessThanOrEqualTo=D.lte=function(n){return this.cmp(n)<1},D.logarithm=D.log=function(n){var e,i,t,r,s,o,u,c,f=this.constructor,a=f.precision,h=f.rounding;if(null==n)n=new f(10),e=!0;else{if(i=(n=new f(n)).d,n.s<0||!i||!i[0]||n.eq(1))return new f(NaN);e=n.eq(10)}if(i=this.d,this.s<0||!i||!i[0]||this.eq(1))return new f(i&&!i[0]?-1/0:1!=this.s?NaN:i?0:1/0);if(e)if(i.length>1)s=!0;else{for(r=i[0];r%10==0;)r/=10;s=1!==r}if(l=!1,o=j(this,u=a+5),t=e?U(f,u+10):j(n,u),S((c=P(o,t,u,1)).d,r=a,h))do{if(o=j(this,u+=10),t=e?U(f,u+10):j(n,u),c=P(o,t,u,1),!s){+F(c.d).slice(r+1,r+15)+1==1e14&&(c=R(c,a+1,0));break}}while(S(c.d,r+=10,h));return l=!0,R(c,a,h)},D.minus=D.sub=function(n){var e,i,t,r,s,o,u,c,f,a,h,d,p=this,g=p.constructor;if(n=new g(n),!p.d||!n.d)return p.s&&n.s?p.d?n.s=-n.s:n=new g(n.d||p.s!==n.s?p:NaN):n=new g(NaN),n;if(p.s!=n.s)return n.s=-n.s,p.plus(n);if(f=p.d,d=n.d,u=g.precision,c=g.rounding,!f[0]||!d[0]){if(d[0])n.s=-n.s;else{if(!f[0])return new g(3===c?-0:0);n=new g(p)}return l?R(n,u,c):n}if(i=w(n.e/M),a=w(p.e/M),f=f.slice(),s=a-i){for((h=s<0)?(e=f,s=-s,o=d.length):(e=d,i=a,o=f.length),s>(t=Math.max(Math.ceil(u/M),o)+2)&&(s=t,e.length=1),e.reverse(),t=s;t--;)e.push(0);e.reverse()}else{for((h=(t=f.length)<(o=d.length))&&(o=t),t=0;t<o;t++)if(f[t]!=d[t]){h=f[t]<d[t];break}s=0}for(h&&(e=f,f=d,d=e,n.s=-n.s),o=f.length,t=d.length-o;t>0;--t)f[o++]=0;for(t=d.length;t>s;){if(f[--t]<d[t]){for(r=t;r&&0===f[--r];)f[r]=y-1;--f[r],f[t]+=y}f[t]-=d[t]}for(;0===f[--o];)f.pop();for(;0===f[0];f.shift())--i;return f[0]?(n.d=f,n.e=T(f,i),l?R(n,u,c):n):new g(3===c?-0:0)},D.modulo=D.mod=function(n){var e,i=this,t=i.constructor;return n=new t(n),!i.d||!n.s||n.d&&!n.d[0]?new t(NaN):!n.d||i.d&&!i.d[0]?R(new t(i),t.precision,t.rounding):(l=!1,9==t.modulo?(e=P(i,n.abs(),0,3,1)).s*=n.s:e=P(i,n,0,t.modulo,1),e=e.times(n),l=!0,i.minus(e))},D.naturalExponential=D.exp=function(){return V(this)},D.naturalLogarithm=D.ln=function(){return j(this)},D.negated=D.neg=function(){var n=new this.constructor(this);return n.s=-n.s,R(n)},D.plus=D.add=function(n){var e,i,t,r,s,o,u,c,f,a,h=this,d=h.constructor;if(n=new d(n),!h.d||!n.d)return h.s&&n.s?h.d||(n=new d(n.d||h.s===n.s?h:NaN)):n=new d(NaN),n;if(h.s!=n.s)return n.s=-n.s,h.minus(n);if(f=h.d,a=n.d,u=d.precision,c=d.rounding,!f[0]||!a[0])return a[0]||(n=new d(h)),l?R(n,u,c):n;if(s=w(h.e/M),t=w(n.e/M),f=f.slice(),r=s-t){for(r<0?(i=f,r=-r,o=a.length):(i=a,t=s,o=f.length),r>(o=(s=Math.ceil(u/M))>o?s+1:o+1)&&(r=o,i.length=1),i.reverse();r--;)i.push(0);i.reverse()}for((o=f.length)-(r=a.length)<0&&(r=o,i=a,a=f,f=i),e=0;r;)e=(f[--r]=f[r]+a[r]+e)/y|0,f[r]%=y;for(e&&(f.unshift(e),++t),o=f.length;0==f[--o];)f.pop();return n.d=f,n.e=T(f,t),l?R(n,u,c):n},D.precision=D.sd=function(n){var e,i=this;if(void 0!==n&&n!==!!n&&1!==n&&0!==n)throw Error(p+n);return i.d?(e=k(i.d),n&&i.e+1>e&&(e=i.e+1)):e=NaN,e},D.round=function(){var n=this,e=n.constructor;return R(new e(n),n.e+1,e.rounding)},D.sine=D.sin=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+Math.max(i.e,i.sd())+M,t.rounding=1,i=function(n,e){var i,t=e.d.length;if(t<3)return z(n,2,e,e);i=(i=1.4*Math.sqrt(t))>16?16:0|i,e=e.times(1/G(5,i)),e=z(n,2,e,e);for(var r,s=new n(5),o=new n(16),u=new n(20);i--;)r=e.times(e),e=e.times(s.plus(r.times(o.times(r).minus(u))));return e}(t,K(t,i)),t.precision=n,t.rounding=e,R(s>2?i.neg():i,n,e,!0)):new t(NaN)},D.squareRoot=D.sqrt=function(){var n,e,i,t,r,s,o=this,u=o.d,c=o.e,f=o.s,a=o.constructor;if(1!==f||!u||!u[0])return new a(!f||f<0&&(!u||u[0])?NaN:u?o:1/0);for(l=!1,0==(f=Math.sqrt(+o))||f==1/0?(((e=F(u)).length+c)%2==0&&(e+="0"),f=Math.sqrt(e),c=w((c+1)/2)-(c<0||c%2),t=new a(e=f==1/0?"1e"+c:(e=f.toExponential()).slice(0,e.indexOf("e")+1)+c)):t=new a(f.toString()),i=(c=a.precision)+3;;)if(t=(s=t).plus(P(o,s,i+2,1)).times(.5),F(s.d).slice(0,i)===(e=F(t.d)).slice(0,i)){if("9999"!=(e=e.slice(i-3,i+1))&&(r||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(R(t,c+1,1),n=!t.times(t).eq(o));break}if(!r&&(R(s,c+1,0),s.times(s).eq(o))){t=s;break}i+=4,r=1}return l=!0,R(t,c,a.rounding,n)},D.tangent=D.tan=function(){var n,e,i=this,t=i.constructor;return i.isFinite()?i.isZero()?new t(i):(n=t.precision,e=t.rounding,t.precision=n+10,t.rounding=1,(i=i.sin()).s=1,i=P(i,new t(1).minus(i.times(i)).sqrt(),n+10,0),t.precision=n,t.rounding=e,R(2==s||4==s?i.neg():i,n,e,!0)):new t(NaN)},D.times=D.mul=function(n){var e,i,t,r,s,o,u,c,f,a=this,h=a.constructor,d=a.d,p=(n=new h(n)).d;if(n.s*=a.s,!(d&&d[0]&&p&&p[0]))return new h(!n.s||d&&!d[0]&&!p||p&&!p[0]&&!d?NaN:d&&p?0*n.s:n.s/0);for(i=w(a.e/M)+w(n.e/M),(c=d.length)<(f=p.length)&&(s=d,d=p,p=s,o=c,c=f,f=o),s=[],t=o=c+f;t--;)s.push(0);for(t=f;--t>=0;){for(e=0,r=c+t;r>t;)u=s[r]+p[t]*d[r-t-1]+e,s[r--]=u%y|0,e=u/y|0;s[r]=(s[r]+e)%y|0}for(;!s[--o];)s.pop();return e?++i:s.shift(),n.d=s,n.e=T(s,i),l?R(n,h.precision,h.rounding):n},D.toBinary=function(n,e){return Q(this,2,n,e)},D.toDecimalPlaces=D.toDP=function(n,e){var i=this,t=i.constructor;return i=new t(i),void 0===n?i:(A(n,0,u),void 0===e?e=t.rounding:A(e,0,8),R(i,n+i.e+1,e))},D.toExponential=function(n,e){var i,t=this,r=t.constructor;return void 0===n?i=L(t,!0):(A(n,0,u),void 0===e?e=r.rounding:A(e,0,8),i=L(t=R(new r(t),n+1,e),!0,n+1)),t.isNeg()&&!t.isZero()?"-"+i:i},D.toFixed=function(n,e){var i,t,r=this,s=r.constructor;return void 0===n?i=L(r):(A(n,0,u),void 0===e?e=s.rounding:A(e,0,8),i=L(t=R(new s(r),n+r.e+1,e),!1,n+t.e+1)),r.isNeg()&&!r.isZero()?"-"+i:i},D.toFraction=function(n){var e,i,t,r,s,o,u,c,f,a,h,d,g=this,m=g.d,w=g.constructor;if(!m)return new w(g);if(f=i=new w(1),t=c=new w(0),o=(s=(e=new w(t)).e=k(m)-g.e-1)%M,e.d[0]=v(10,o<0?M+o:o),null==n)n=s>0?e:f;else{if(!(u=new w(n)).isInt()||u.lt(f))throw Error(p+u);n=u.gt(e)?s>0?e:f:u}for(l=!1,u=new w(F(m)),a=w.precision,w.precision=s=m.length*M*2;h=P(u,e,0,1,1),1!=(r=i.plus(h.times(t))).cmp(n);)i=t,t=r,r=f,f=c.plus(h.times(r)),c=r,r=e,e=u.minus(h.times(r)),u=r;return r=P(n.minus(i),t,0,1,1),c=c.plus(r.times(f)),i=i.plus(r.times(t)),c.s=f.s=g.s,d=P(f,t,s,1).minus(g).abs().cmp(P(c,i,s,1).minus(g).abs())<1?[f,t]:[c,i],w.precision=a,l=!0,d},D.toHexadecimal=D.toHex=function(n,e){return Q(this,16,n,e)},D.toNearest=function(n,e){var i=this,t=i.constructor;if(i=new t(i),null==n){if(!i.d)return i;n=new t(1),e=t.rounding}else{if(n=new t(n),void 0===e?e=t.rounding:A(e,0,8),!i.d)return n.s?i:n;if(!n.d)return n.s&&(n.s=i.s),n}return n.d[0]?(l=!1,i=P(i,n,0,e,1).times(n),l=!0,R(i)):(n.s=i.s,i=n),i},D.toNumber=function(){return+this},D.toOctal=function(n,e){return Q(this,8,n,e)},D.toPower=D.pow=function(n){var e,i,t,r,s,o,u=this,c=u.constructor,f=+(n=new c(n));if(!(u.d&&n.d&&u.d[0]&&n.d[0]))return new c(v(+u,f));if((u=new c(u)).eq(1))return u;if(t=c.precision,s=c.rounding,n.eq(1))return R(u,t,s);if((e=w(n.e/M))>=n.d.length-1&&(i=f<0?-f:f)<=9007199254740991)return r=I(c,u,i,t),n.s<0?new c(1).div(r):R(r,t,s);if((o=u.s)<0){if(e<n.d.length-1)return new c(NaN);if(0==(1&n.d[e])&&(o=1),0==u.e&&1==u.d[0]&&1==u.d.length)return u.s=o,u}return(e=0!=(i=v(+u,f))&&isFinite(i)?new c(i+"").e:w(f*(Math.log("0."+F(u.d))/Math.LN10+u.e+1)))>c.maxE+1||e<c.minE-1?new c(e>0?o/0:0):(l=!1,c.rounding=u.s=1,i=Math.min(12,(e+"").length),(r=V(n.times(j(u,t+i)),t)).d&&S((r=R(r,t+5,1)).d,t,s)&&(e=t+10,+F((r=R(V(n.times(j(u,e+i)),e),e+5,1)).d).slice(t+1,t+15)+1==1e14&&(r=R(r,t+1,0))),r.s=o,l=!0,c.rounding=s,R(r,t,s))},D.toPrecision=function(n,e){var i,t=this,r=t.constructor;return void 0===n?i=L(t,t.e<=r.toExpNeg||t.e>=r.toExpPos):(A(n,1,u),void 0===e?e=r.rounding:A(e,0,8),i=L(t=R(new r(t),n,e),n<=t.e||t.e<=r.toExpNeg,n)),t.isNeg()&&!t.isZero()?"-"+i:i},D.toSignificantDigits=D.toSD=function(n,e){var i=this.constructor;return void 0===n?(n=i.precision,e=i.rounding):(A(n,1,u),void 0===e?e=i.rounding:A(e,0,8)),R(new i(this),n,e)},D.toString=function(){var n=this,e=n.constructor,i=L(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()&&!n.isZero()?"-"+i:i},D.truncated=D.trunc=function(){return R(new this.constructor(this),this.e+1,1)},D.valueOf=D.toJSON=function(){var n=this,e=n.constructor,i=L(n,n.e<=e.toExpNeg||n.e>=e.toExpPos);return n.isNeg()?"-"+i:i};var P=function(){function n(n,e,i){var t,r=0,s=n.length;for(n=n.slice();s--;)t=n[s]*e+r,n[s]=t%i|0,r=t/i|0;return r&&n.unshift(r),n}function e(n,e,i,t){var r,s;if(i!=t)s=i>t?1:-1;else for(r=s=0;r<i;r++)if(n[r]!=e[r]){s=n[r]>e[r]?1:-1;break}return s}function i(n,e,i,t){for(var r=0;i--;)n[i]-=r,r=n[i]<e[i]?1:0,n[i]=r*t+n[i]-e[i];for(;!n[0]&&n.length>1;)n.shift()}return function(r,s,o,u,c,f){var a,h,l,d,p,g,m,v,N,b,E,x,q,O,D,F,A,S,Z,P,L=r.constructor,T=r.s==s.s?1:-1,U=r.d,_=s.d;if(!(U&&U[0]&&_&&_[0]))return new L(r.s&&s.s&&(U?!_||U[0]!=_[0]:_)?U&&0==U[0]||!_?0*T:T/0:NaN);for(f?(p=1,h=r.e-s.e):(f=y,p=M,h=w(r.e/p)-w(s.e/p)),Z=_.length,A=U.length,b=(N=new L(T)).d=[],l=0;_[l]==(U[l]||0);l++);if(_[l]>(U[l]||0)&&h--,null==o?(O=o=L.precision,u=L.rounding):O=c?o+(r.e-s.e)+1:o,O<0)b.push(1),g=!0;else{if(O=O/p+2|0,l=0,1==Z){for(d=0,_=_[0],O++;(l<A||d)&&O--;l++)D=d*f+(U[l]||0),b[l]=D/_|0,d=D%_|0;g=d||l<A}else{for((d=f/(_[0]+1)|0)>1&&(_=n(_,d,f),U=n(U,d,f),Z=_.length,A=U.length),F=Z,x=(E=U.slice(0,Z)).length;x<Z;)E[x++]=0;(P=_.slice()).unshift(0),S=_[0],_[1]>=f/2&&++S;do{d=0,(a=e(_,E,Z,x))<0?(q=E[0],Z!=x&&(q=q*f+(E[1]||0)),(d=q/S|0)>1?(d>=f&&(d=f-1),1==(a=e(m=n(_,d,f),E,v=m.length,x=E.length))&&(d--,i(m,Z<v?P:_,v,f))):(0==d&&(a=d=1),m=_.slice()),(v=m.length)<x&&m.unshift(0),i(E,m,x,f),-1==a&&(a=e(_,E,Z,x=E.length))<1&&(d++,i(E,Z<x?P:_,x,f)),x=E.length):0===a&&(d++,E=[0]),b[l++]=d,a&&E[0]?E[x++]=U[F]||0:(E=[U[F]],x=1)}while((F++<A||void 0!==E[0])&&O--);g=void 0!==E[0]}b[0]||b.shift()}if(1==p)N.e=h,t=g;else{for(l=1,d=b[0];d>=10;d/=10)l++;N.e=l+h*p-1,R(N,c?o+N.e+1:o,u,g)}return N}}();function R(n,e,i,t){var r,s,o,u,c,f,a,h,d,p=n.constructor;n:if(null!=e){if(!(h=n.d))return n;for(r=1,u=h[0];u>=10;u/=10)r++;if((s=e-r)<0)s+=M,o=e,c=(a=h[d=0])/v(10,r-o-1)%10|0;else if((d=Math.ceil((s+1)/M))>=(u=h.length)){if(!t)break n;for(;u++<=d;)h.push(0);a=c=0,r=1,o=(s%=M)-M+1}else{for(a=u=h[d],r=1;u>=10;u/=10)r++;c=(o=(s%=M)-M+r)<0?0:a/v(10,r-o-1)%10|0}if(t=t||e<0||void 0!==h[d+1]||(o<0?a:a%v(10,r-o-1)),f=i<4?(c||t)&&(0==i||i==(n.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(s>0?o>0?a/v(10,r-o):0:h[d-1])%10&1||i==(n.s<0?8:7)),e<1||!h[0])return h.length=0,f?(e-=n.e+1,h[0]=v(10,(M-e%M)%M),n.e=-e||0):h[0]=n.e=0,n;if(0==s?(h.length=d,u=1,d--):(h.length=d+1,u=v(10,M-s),h[d]=o>0?(a/v(10,r-o)%v(10,o)|0)*u:0),f)for(;;){if(0==d){for(s=1,o=h[0];o>=10;o/=10)s++;for(o=h[0]+=u,u=1;o>=10;o/=10)u++;s!=u&&(n.e++,h[0]==y&&(h[0]=1));break}if(h[d]+=u,h[d]!=y)break;h[d--]=0,u=1}for(s=h.length;0===h[--s];)h.pop()}return l&&(n.e>p.maxE?(n.d=null,n.e=NaN):n.e<p.minE&&(n.e=0,n.d=[0])),n}function L(n,e,i){if(!n.isFinite())return $(n);var t,r=n.e,s=F(n.d),o=s.length;return e?(i&&(t=i-o)>0?s=s.charAt(0)+"."+s.slice(1)+C(t):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(n.e<0?"e":"e+")+n.e):r<0?(s="0."+C(-r-1)+s,i&&(t=i-o)>0&&(s+=C(t))):r>=o?(s+=C(r+1-o),i&&(t=i-r-1)>0&&(s=s+"."+C(t))):((t=r+1)<o&&(s=s.slice(0,t)+"."+s.slice(t)),i&&(t=i-o)>0&&(r+1===o&&(s+="."),s+=C(t))),s}function T(n,e){var i=n[0];for(e*=M;i>=10;i/=10)e++;return e}function U(n,e,i){if(e>q)throw l=!0,i&&(n.precision=i),Error(g);return R(new n(f),e,1,!0)}function _(n,e,i){if(e>O)throw Error(g);return R(new n(a),e,i,!0)}function k(n){var e=n.length-1,i=e*M+1;if(e=n[e]){for(;e%10==0;e/=10)i--;for(e=n[0];e>=10;e/=10)i++}return i}function C(n){for(var e="";n--;)e+="0";return e}function I(n,e,i,t){var r,s=new n(1),o=Math.ceil(t/M+4);for(l=!1;;){if(i%2&&X((s=s.times(e)).d,o)&&(r=!0),0===(i=w(i/2))){i=s.d.length-1,r&&0===s.d[i]&&++s.d[i];break}X((e=e.times(e)).d,o)}return l=!0,s}function H(n){return 1&n.d[n.d.length-1]}function B(n,e,i){for(var t,r=new n(e[0]),s=0;++s<e.length;){if(!(t=new n(e[s])).s){r=t;break}r[i](t)&&(r=t)}return r}function V(n,e){var i,t,r,s,o,u,c,f=0,a=0,h=0,d=n.constructor,p=d.rounding,g=d.precision;if(!n.d||!n.d[0]||n.e>17)return new d(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==e?(l=!1,c=g):c=e,u=new d(.03125);n.e>-2;)n=n.times(u),h+=5;for(c+=t=Math.log(v(2,h))/Math.LN10*2+5|0,i=s=o=new d(1),d.precision=c;;){if(s=R(s.times(n),c,1),i=i.times(++a),F((u=o.plus(P(s,i,c,1))).d).slice(0,c)===F(o.d).slice(0,c)){for(r=h;r--;)o=R(o.times(o),c,1);if(null!=e)return d.precision=g,o;if(!(f<3&&S(o.d,c-t,p,f)))return R(o,d.precision=g,p,l=!0);d.precision=c+=10,i=s=u=new d(1),a=0,f++}o=u}}function j(n,e){var i,t,r,s,o,u,c,f,a,h,d,p=1,g=n,m=g.d,w=g.constructor,v=w.rounding,N=w.precision;if(g.s<0||!m||!m[0]||!g.e&&1==m[0]&&1==m.length)return new w(m&&!m[0]?-1/0:1!=g.s?NaN:m?0:g);if(null==e?(l=!1,a=N):a=e,w.precision=a+=10,t=(i=F(m)).charAt(0),!(Math.abs(s=g.e)<15e14))return f=U(w,a+2,N).times(s+""),g=j(new w(t+"."+i.slice(1)),a-10).plus(f),w.precision=N,null==e?R(g,N,v,l=!0):g;for(;t<7&&1!=t||1==t&&i.charAt(1)>3;)t=(i=F((g=g.times(n)).d)).charAt(0),p++;for(s=g.e,t>1?(g=new w("0."+i),s++):g=new w(t+"."+i.slice(1)),h=g,c=o=g=P(g.minus(1),g.plus(1),a,1),d=R(g.times(g),a,1),r=3;;){if(o=R(o.times(d),a,1),F((f=c.plus(P(o,new w(r),a,1))).d).slice(0,a)===F(c.d).slice(0,a)){if(c=c.times(2),0!==s&&(c=c.plus(U(w,a+2,N).times(s+""))),c=P(c,new w(p),a,1),null!=e)return w.precision=N,c;if(!S(c.d,a-10,v,u))return R(c,w.precision=N,v,l=!0);w.precision=a+=10,f=o=g=P(h.minus(1),h.plus(1),a,1),d=R(g.times(g),a,1),r=u=1}c=f,r+=2}}function $(n){return String(n.s*n.s/0)}function W(n,e){var i,t,r;for((i=e.indexOf("."))>-1&&(e=e.replace(".","")),(t=e.search(/e/i))>0?(i<0&&(i=t),i+=+e.slice(t+1),e=e.substring(0,t)):i<0&&(i=e.length),t=0;48===e.charCodeAt(t);t++);for(r=e.length;48===e.charCodeAt(r-1);--r);if(e=e.slice(t,r)){if(r-=t,n.e=i=i-t-1,n.d=[],t=(i+1)%M,i<0&&(t+=M),t<r){for(t&&n.d.push(+e.slice(0,t)),r-=M;t<r;)n.d.push(+e.slice(t,t+=M));e=e.slice(t),t=M-e.length}else t-=r;for(;t--;)e+="0";n.d.push(+e),l&&(n.e>n.constructor.maxE?(n.d=null,n.e=NaN):n.e<n.constructor.minE&&(n.e=0,n.d=[0]))}else n.e=0,n.d=[0];return n}function J(n,e){var t,r,s,o,u,c,f,a,h;if("Infinity"===e||"NaN"===e)return+e||(n.s=NaN),n.e=NaN,n.d=null,n;if(b.test(e))t=16,e=e.toLowerCase();else if(N.test(e))t=2;else{if(!E.test(e))throw Error(p+e);t=8}for((o=e.search(/p/i))>0?(f=+e.slice(o+1),e=e.substring(2,o)):e=e.slice(2),u=(o=e.indexOf("."))>=0,r=n.constructor,u&&(o=(c=(e=e.replace(".","")).length)-o,s=I(r,new r(t),o,2*o)),o=h=(a=Z(e,t,y)).length-1;0===a[o];--o)a.pop();return o<0?new r(0*n.s):(n.e=T(a,h),n.d=a,l=!1,u&&(n=P(n,s,4*c)),f&&(n=n.times(Math.abs(f)<54?v(2,f):i.pow(2,f))),l=!0,n)}function z(n,e,i,t,r){var s,o,u,c,f=n.precision,a=Math.ceil(f/M);for(l=!1,c=i.times(i),u=new n(t);;){if(o=P(u.times(c),new n(e++*e++),f,1),u=r?t.plus(o):t.minus(o),t=P(o.times(c),new n(e++*e++),f,1),void 0!==(o=u.plus(t)).d[a]){for(s=a;o.d[s]===u.d[s]&&s--;);if(-1==s)break}s=u,u=t,t=o,o=s,0}return l=!0,o.d.length=a+1,o}function G(n,e){for(var i=n;--e;)i*=n;return i}function K(n,e){var i,t=e.s<0,r=_(n,n.precision,1),o=r.times(.5);if((e=e.abs()).lte(o))return s=t?4:1,e;if((i=e.divToInt(r)).isZero())s=t?3:2;else{if((e=e.minus(i.times(r))).lte(o))return s=H(i)?t?2:3:t?4:1,e;s=H(i)?t?1:4:t?3:2}return e.minus(r).abs()}function Q(n,e,i,r){var s,o,f,a,h,l,d,p,g,m=n.constructor,w=void 0!==i;if(w?(A(i,1,u),void 0===r?r=m.rounding:A(r,0,8)):(i=m.precision,r=m.rounding),n.isFinite()){for(w?(s=2,16==e?i=4*i-3:8==e&&(i=3*i-2)):s=e,(f=(d=L(n)).indexOf("."))>=0&&(d=d.replace(".",""),(g=new m(1)).e=d.length-f,g.d=Z(L(g),10,s),g.e=g.d.length),o=h=(p=Z(d,10,s)).length;0==p[--h];)p.pop();if(p[0]){if(f<0?o--:((n=new m(n)).d=p,n.e=o,p=(n=P(n,g,i,r,0,s)).d,o=n.e,l=t),f=p[i],a=s/2,l=l||void 0!==p[i+1],l=r<4?(void 0!==f||l)&&(0===r||r===(n.s<0?3:2)):f>a||f===a&&(4===r||l||6===r&&1&p[i-1]||r===(n.s<0?8:7)),p.length=i,l)for(;++p[--i]>s-1;)p[i]=0,i||(++o,p.unshift(1));for(h=p.length;!p[h-1];--h);for(f=0,d="";f<h;f++)d+=c.charAt(p[f]);if(w){if(h>1)if(16==e||8==e){for(f=16==e?4:3,--h;h%f;h++)d+="0";for(h=(p=Z(d,s,e)).length;!p[h-1];--h);for(f=1,d="1.";f<h;f++)d+=c.charAt(p[f])}else d=d.charAt(0)+"."+d.slice(1);d=d+(o<0?"p":"p+")+o}else if(o<0){for(;++o;)d="0"+d;d="0."+d}else if(++o>h)for(o-=h;o--;)d+="0";else o<h&&(d=d.slice(0,o)+"."+d.slice(o))}else d=w?"0p+0":"0";d=(16==e?"0x":2==e?"0b":8==e?"0o":"")+d}else d=$(n);return n.s<0?"-"+d:d}function X(n,e){if(n.length>e)return n.length=e,!0}function Y(n){return new this(n).abs()}function nn(n){return new this(n).acos()}function en(n){return new this(n).acosh()}function tn(n,e){return new this(n).plus(e)}function rn(n){return new this(n).asin()}function sn(n){return new this(n).asinh()}function on(n){return new this(n).atan()}function un(n){return new this(n).atanh()}function cn(n,e){n=new this(n),e=new this(e);var i,t=this.precision,r=this.rounding,s=t+4;return n.s&&e.s?n.d||e.d?!e.d||n.isZero()?(i=e.s<0?_(this,t,r):new this(0)).s=n.s:!n.d||e.isZero()?(i=_(this,s,1).times(.5)).s=n.s:e.s<0?(this.precision=s,this.rounding=1,i=this.atan(P(n,e,s,1)),e=_(this,s,1),this.precision=t,this.rounding=r,i=n.s<0?i.minus(e):i.plus(e)):i=this.atan(P(n,e,s,1)):(i=_(this,s,1).times(e.s>0?.25:.75)).s=n.s:i=new this(NaN),i}function fn(n){return new this(n).cbrt()}function an(n){return R(n=new this(n),n.e+1,2)}function hn(n){if(!n||"object"!=typeof n)throw Error(d+"Object expected");var e,i,t,r=!0===n.defaults,s=["precision",1,u,"rounding",0,8,"toExpNeg",-o,0,"toExpPos",0,o,"maxE",0,o,"minE",-o,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(i=s[e],r&&(this[i]=h[i]),void 0!==(t=n[i])){if(!(w(t)===t&&t>=s[e+1]&&t<=s[e+2]))throw Error(p+i+": "+t);this[i]=t}if(i="crypto",r&&(this[i]=h[i]),void 0!==(t=n[i])){if(!0!==t&&!1!==t&&0!==t&&1!==t)throw Error(p+i+": "+t);if(t){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(m);this[i]=!0}else this[i]=!1}return this}function ln(n){return new this(n).cos()}function dn(n){return new this(n).cosh()}function pn(n,e){return new this(n).div(e)}function gn(n){return new this(n).exp()}function mn(n){return R(n=new this(n),n.e+1,3)}function wn(){var n,e,i=new this(0);for(l=!1,n=0;n<arguments.length;)if((e=new this(arguments[n++])).d)i.d&&(i=i.plus(e.times(e)));else{if(e.s)return l=!0,new this(1/0);i=e}return l=!0,i.sqrt()}function vn(n){return n instanceof i||n&&"[object Decimal]"===n.name||!1}function Nn(n){return new this(n).ln()}function bn(n,e){return new this(n).log(e)}function En(n){return new this(n).log(2)}function xn(n){return new this(n).log(10)}function yn(){return B(this,arguments,"lt")}function Mn(){return B(this,arguments,"gt")}function qn(n,e){return new this(n).mod(e)}function On(n,e){return new this(n).mul(e)}function Dn(n,e){return new this(n).pow(e)}function Fn(n){var e,i,t,r,s=0,o=new this(1),c=[];if(void 0===n?n=this.precision:A(n,1,u),t=Math.ceil(n/M),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(t));s<t;)(r=e[s])>=429e7?e[s]=crypto.getRandomValues(new Uint32Array(1))[0]:c[s++]=r%1e7;else{if(!crypto.randomBytes)throw Error(m);for(e=crypto.randomBytes(t*=4);s<t;)(r=e[s]+(e[s+1]<<8)+(e[s+2]<<16)+((127&e[s+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,s):(c.push(r%1e7),s+=4);s=t/4}else for(;s<t;)c[s++]=1e7*Math.random()|0;for(t=c[--s],n%=M,t&&n&&(r=v(10,M-n),c[s]=(t/r|0)*r);0===c[s];s--)c.pop();if(s<0)i=0,c=[0];else{for(i=-1;0===c[0];i-=M)c.shift();for(t=1,r=c[0];r>=10;r/=10)t++;t<M&&(i-=M-t)}return o.e=i,o.d=c,o}function An(n){return R(n=new this(n),n.e+1,this.rounding)}function Sn(n){return(n=new this(n)).d?n.d[0]?n.s:0*n.s:n.s||NaN}function Zn(n){return new this(n).sin()}function Pn(n){return new this(n).sinh()}function Rn(n){return new this(n).sqrt()}function Ln(n,e){return new this(n).sub(e)}function Tn(n){return new this(n).tan()}function Un(n){return new this(n).tanh()}function _n(n){return R(n=new this(n),n.e+1,1)}(i=function n(e){var i,t,r;function s(n){var e,i,t,r=this;if(!(r instanceof s))return new s(n);if(r.constructor=s,n instanceof s)return r.s=n.s,void(l?!n.d||n.e>s.maxE?(r.e=NaN,r.d=null):n.e<s.minE?(r.e=0,r.d=[0]):(r.e=n.e,r.d=n.d.slice()):(r.e=n.e,r.d=n.d?n.d.slice():n.d));if("number"==(t=typeof n)){if(0===n)return r.s=1/n<0?-1:1,r.e=0,void(r.d=[0]);if(n<0?(n=-n,r.s=-1):r.s=1,n===~~n&&n<1e7){for(e=0,i=n;i>=10;i/=10)e++;return void(l?e>s.maxE?(r.e=NaN,r.d=null):e<s.minE?(r.e=0,r.d=[0]):(r.e=e,r.d=[n]):(r.e=e,r.d=[n]))}return 0*n!=0?(n||(r.s=NaN),r.e=NaN,void(r.d=null)):W(r,n.toString())}if("string"!==t)throw Error(p+n);return 45===(i=n.charCodeAt(0))?(n=n.slice(1),r.s=-1):(43===i&&(n=n.slice(1)),r.s=1),x.test(n)?W(r,n):J(r,n)}if(s.prototype=D,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=hn,s.clone=n,s.isDecimal=vn,s.abs=Y,s.acos=nn,s.acosh=en,s.add=tn,s.asin=rn,s.asinh=sn,s.atan=on,s.atanh=un,s.atan2=cn,s.cbrt=fn,s.ceil=an,s.cos=ln,s.cosh=dn,s.div=pn,s.exp=gn,s.floor=mn,s.hypot=wn,s.ln=Nn,s.log=bn,s.log10=xn,s.log2=En,s.max=yn,s.min=Mn,s.mod=qn,s.mul=On,s.pow=Dn,s.random=Fn,s.round=An,s.sign=Sn,s.sin=Zn,s.sinh=Pn,s.sqrt=Rn,s.sub=Ln,s.tan=Tn,s.tanh=Un,s.trunc=_n,void 0===e&&(e={}),e&&!0!==e.defaults)for(r=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<r.length;)e.hasOwnProperty(t=r[i++])||(e[t]=this[t]);return s.config(e),s}(h)).default=i.Decimal=i,f=new i(f),a=new i(a),"function"==typeof n&&n.amd?n(function(){return i}):"undefined"!=typeof module&&module.exports?("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(D[Symbol.for("nodejs.util.inspect.custom")]=D.toString,D[Symbol.toStringTag]="Decimal"),module.exports=i):(e||(e="undefined"!=typeof self&&self&&self.self==self?self:window),r=e.Decimal,i.noConflict=function(){return e.Decimal=r,i},e.Decimal=i)}(this);
},{}],"dbYS":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.factory=t,exports.math=exports.path=exports.name=void 0;var e=r(require("decimal.js"));function r(e){return e&&e.__esModule?e:{default:e}}function t(r,t,o,i,n){var p=e.default.clone({precision:t.precision});return p.prototype.type="BigNumber",p.prototype.isBigNumber=!0,p.prototype.toJSON=function(){return{mathjs:"BigNumber",value:this.toString()}},p.fromJSON=function(e){return new p(e.value)},n.on("config",function(e,r){e.precision!==r.precision&&p.config({precision:e.precision})}),p}var o="BigNumber";exports.name=o;var i="type";exports.path=i;var n=!0;exports.math=n;
},{"decimal.js":"c8f9"}],"lOYo":[function(require,module,exports) {
"use strict";module.exports=function t(n,u,e){return n&&"function"==typeof n.map?n.map(function(n){return t(n,u,e)}):u(n)};
},{}],"ejiJ":[function(require,module,exports) {
"use strict";var r=require("../../../utils/collection/deepMap");function n(n,e,t,u){var i=u("bignumber",{"":function(){return new n.BigNumber(0)},number:function(r){return new n.BigNumber(r+"")},string:function(r){return new n.BigNumber(r)},BigNumber:function(r){return r},Fraction:function(r){return new n.BigNumber(r.n).div(r.d).times(r.s)},null:function(r){return new n.BigNumber(0)},"Array | Matrix":function(n){return r(n,i)}});return i.toTex={0:"0",1:"\\left(${args[0]}\\right)"},i}exports.name="bignumber",exports.factory=n;
},{"../../../utils/collection/deepMap":"lOYo"}],"glkd":[function(require,module,exports) {
"use strict";module.exports=[require("./BigNumber"),require("./function/bignumber")];
},{"./BigNumber":"dbYS","./function/bignumber":"ejiJ"}],"ff5w":[function(require,module,exports) {
"use strict";var r=require("./../utils/collection/deepMap");function n(n,t,e,o){var u=o("bool",{"":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 n=r.toLowerCase();if("true"===n)return!0;if("false"===n)return!1;var t=Number(r);if(""!==r&&!isNaN(t))return!!t;throw new Error('Cannot convert "'+r+'" to a boolean')},"Array | Matrix":function(n){return r(n,u)}});return u}exports.name="boolean",exports.factory=n;
},{"./../utils/collection/deepMap":"lOYo"}],"bm1W":[function(require,module,exports) {
"use strict";var e=require("../object");exports.format=function(n,t){if("function"==typeof t)return t(n);if(!n.isFinite())return n.isNaN()?"NaN":n.gt(0)?"Infinity":"-Infinity";var o,i="auto";switch(void 0!==t&&(t.notation&&(i=t.notation),"number"==typeof t?o=t:t.precision&&(o=t.precision)),i){case"fixed":return exports.toFixed(n,o);case"exponential":return exports.toExponential(n,o);case"engineering":return exports.toEngineering(n,o);case"auto":if(t&&t.exponential&&(void 0!==t.exponential.lower||void 0!==t.exponential.upper)){var r=e.map(t,function(e){return e});return r.exponential=void 0,void 0!==t.exponential.lower&&(r.lowerExp=Math.round(Math.log(t.exponential.lower)/Math.LN10)),void 0!==t.exponential.upper&&(r.upperExp=Math.round(Math.log(t.exponential.upper)/Math.LN10)),console.warn("Deprecation warning: Formatting options exponential.lower and exponential.upper (minimum and maximum value) are replaced with exponential.lowerExp and exponential.upperExp (minimum and maximum exponent) since version 4.0.0. Replace "+JSON.stringify(t)+" with "+JSON.stringify(r)),exports.format(n,r)}var a=t&&void 0!==t.lowerExp?t.lowerExp:-3,p=t&&void 0!==t.upperExp?t.upperExp:5;if(n.isZero())return"0";var x=n.e;return(x>=a&&x<p?n.toSignificantDigits(o).toFixed():exports.toExponential(n,o)).replace(/((\.\d*?)(0+))($|e)/,function(){var e=arguments[2],n=arguments[4];return"."!==e?e+n:n});default:throw new Error('Unknown notation "'+i+'". Choose "auto", "exponential", or "fixed".')}},exports.toEngineering=function(e,n){var t=e.e,o=t%3==0?t:t<0?t-3-t%3:t-t%3,i=e.mul(Math.pow(10,-o)),r=i.toPrecision(n);return-1!==r.indexOf("e")&&(r=i.toString()),r+"e"+(t>=0?"+":"")+o.toString()},exports.toExponential=function(e,n){return void 0!==n?e.toExponential(n-1):e.toExponential()},exports.toFixed=function(e,n){return e.toFixed(n)};
},{"../object":"FcSp"}],"PshC":[function(require,module,exports) {
"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(t)}function t(n){return(t="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(t){return r(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)})(n)}var n=require("./number").format,e=require("./bignumber/formatter").format,o=require("./bignumber/isBigNumber");function i(r,t){if(Array.isArray(r)){for(var n="[",e=r.length,o=0;o<e;o++)0!==o&&(n+=", "),n+=i(r[o],t);return n+="]"}return exports.format(r,t)}function u(r){return r&&"object"===t(r)&&"number"==typeof r.s&&"number"==typeof r.n&&"number"==typeof r.d||!1}exports.isString=function(r){return"string"==typeof r},exports.endsWith=function(r,t){var n=r.length-t.length,e=r.length;return r.substring(n,e)===t},exports.format=function(r,f){if("number"==typeof r)return n(r,f);if(o(r))return e(r,f);if(u(r))return f&&"decimal"===f.fraction?r.toString():r.s*r.n+"/"+r.d;if(Array.isArray(r))return i(r,f);if(exports.isString(r))return'"'+r+'"';if("function"==typeof r)return r.syntax?String(r.syntax):"function";if(r&&"object"===t(r)){if("function"==typeof r.format)return r.format(f);if(r&&r.toString()!=={}.toString())return r.toString();var y=[];for(var c in r)r.hasOwnProperty(c)&&y.push('"'+c+'": '+exports.format(r[c],f));return"{"+y.join(", ")+"}"}return String(r)},exports.stringify=function(r){for(var t=String(r),n="",e=0;e<t.length;){var o=t.charAt(e);"\\"===o?(n+=o,e++,""!==(o=t.charAt(e))&&-1!=='"\\/bfnrtu'.indexOf(o)||(n+="\\"),n+=o):n+='"'===o?'\\"':o,e++}return'"'+n+'"'},exports.escape=function(r){var t=String(r);return t=t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")};
},{"./number":"uqMu","./bignumber/formatter":"bm1W","./bignumber/isBigNumber":"NR2f"}],"Dlkx":[function(require,module,exports) {
"use strict";var t=require("../../utils/string").format,e=require("../../utils/object").lazy;function n(n,r,o,i,u){function a(t){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");n.isChain(t)?this.value=t.value:this.value=t}function p(t,e){"function"==typeof e&&(a.prototype[t]=f(e))}function f(t){return function(){for(var e=[this.value],n=0;n<arguments.length;n++)e[n+1]=arguments[n];return new a(t.apply(t,e))}}return a.prototype.type="Chain",a.prototype.isChain=!0,a.prototype.done=function(){return this.value},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return t(this.value)},a.prototype.toJSON=function(){return{mathjs:"Chain",value:this.value}},a.fromJSON=function(t){return new a(t.value)},a.createProxy=function(t,e){if("string"==typeof t)p(t,e);else for(var n in t)t.hasOwnProperty(n)&&p(n,t[n])},a.createProxy(u),u.on("import",function(t,n,r){void 0===r&&function(t,n){e(a.prototype,t,function(){var t=n();if("function"==typeof t)return f(t)})}(t,n)}),a}exports.name="Chain",exports.path="type",exports.factory=n,exports.math=!0,exports.lazy=!1;
},{"../../utils/string":"PshC","../../utils/object":"FcSp"}],"LxM2":[function(require,module,exports) {
"use strict";function n(n,t,r,e){return e("chain",{"":function(){return new n.Chain},any:function(t){return new n.Chain(t)}})}exports.name="chain",exports.factory=n;
},{}],"YdmQ":[function(require,module,exports) {
"use strict";module.exports=[require("./Chain"),require("./function/chain")];
},{"./Chain":"Dlkx","./function/chain":"LxM2"}],"LEuu":[function(require,module,exports) {
var define;
var i;!function(t){"use strict";var n=function(i){return.5*(Math.exp(i)+Math.exp(-i))},e=function(i){return.5*(Math.exp(i)-Math.exp(-i))},r=function(){throw SyntaxError("Invalid Param")};function s(i,t){var n=Math.abs(i),e=Math.abs(t);return 0===i?Math.log(e):0===t?Math.log(n):n<3e3&&e<3e3?.5*Math.log(i*i+t*t):Math.log(i/Math.cos(Math.atan2(t,i)))}var a=function(i,t){var n={re:0,im:0};if(null==i)n.re=n.im=0;else if(void 0!==t)n.re=i,n.im=t;else switch(typeof i){case"object":if("im"in i&&"re"in i)n.re=i.re,n.im=i.im;else if("abs"in i&&"arg"in i){if(!Number.isFinite(i.abs)&&Number.isFinite(i.arg))return h.INFINITY;n.re=i.abs*Math.cos(i.arg),n.im=i.abs*Math.sin(i.arg)}else if("r"in i&&"phi"in i){if(!Number.isFinite(i.r)&&Number.isFinite(i.phi))return h.INFINITY;n.re=i.r*Math.cos(i.phi),n.im=i.r*Math.sin(i.phi)}else 2===i.length?(n.re=i[0],n.im=i[1]):r();break;case"string":n.im=n.re=0;var e=i.match(/\d+\.?\d*e[+-]?\d+|\d+\.?\d*|\.\d+|./g),s=1,a=0;null===e&&r();for(var u=0;u<e.length;u++){var o=e[u];" "===o||"\t"===o||"\n"===o||("+"===o?s++:"-"===o?a++:"i"===o||"I"===o?(s+a===0&&r()," "===e[u+1]||isNaN(e[u+1])?n.im+=parseFloat((a%2?"-":"")+"1"):(n.im+=parseFloat((a%2?"-":"")+e[u+1]),u++),s=a=0):((s+a===0||isNaN(o))&&r(),"i"===e[u+1]||"I"===e[u+1]?(n.im+=parseFloat((a%2?"-":"")+o),u++):n.re+=parseFloat((a%2?"-":"")+o),s=a=0))}s+a>0&&r();break;case"number":n.im=0,n.re=i;break;default:r()}return isNaN(n.re)||isNaN(n.im),n};function h(i,t){if(!(this instanceof h))return new h(i,t);var n=a(i,t);this.re=n.re,this.im=n.im}h.prototype={re:0,im:0,sign:function(){var i=this.abs();return new h(this.re/i,this.im/i)},add:function(i,t){var n=new h(i,t);return this.isInfinite()&&n.isInfinite()?h.NAN:this.isInfinite()||n.isInfinite()?h.INFINITY:new h(this.re+n.re,this.im+n.im)},sub:function(i,t){var n=new h(i,t);return this.isInfinite()&&n.isInfinite()?h.NAN:this.isInfinite()||n.isInfinite()?h.INFINITY:new h(this.re-n.re,this.im-n.im)},mul:function(i,t){var n=new h(i,t);return this.isInfinite()&&n.isZero()||this.isZero()&&n.isInfinite()?h.NAN:this.isInfinite()||n.isInfinite()?h.INFINITY:0===n.im&&0===this.im?new h(this.re*n.re,0):new h(this.re*n.re-this.im*n.im,this.re*n.im+this.im*n.re)},div:function(i,t){var n=new h(i,t);if(this.isZero()&&n.isZero()||this.isInfinite()&&n.isInfinite())return h.NAN;if(this.isInfinite()||n.isZero())return h.INFINITY;if(this.isZero()||n.isInfinite())return h.ZERO;i=this.re,t=this.im;var e,r,s=n.re,a=n.im;return 0===a?new h(i/s,t/s):Math.abs(s)<Math.abs(a)?new h((i*(r=s/a)+t)/(e=s*r+a),(t*r-i)/e):new h((i+t*(r=a/s))/(e=a*r+s),(t-i*r)/e)},pow:function(i,t){var n=new h(i,t);if(i=this.re,t=this.im,n.isZero())return h.ONE;if(0===n.im){if(0===t&&i>=0)return new h(Math.pow(i,n.re),0);if(0===i)switch((n.re%4+4)%4){case 0:return new h(Math.pow(t,n.re),0);case 1:return new h(0,Math.pow(t,n.re));case 2:return new h(-Math.pow(t,n.re),0);case 3:return new h(0,-Math.pow(t,n.re))}}if(0===i&&0===t&&n.re>0&&n.im>=0)return h.ZERO;var e=Math.atan2(t,i),r=s(i,t);return i=Math.exp(n.re*r-n.im*e),t=n.im*r+n.re*e,new h(i*Math.cos(t),i*Math.sin(t))},sqrt:function(){var i,t,n=this.re,e=this.im,r=this.abs();if(n>=0){if(0===e)return new h(Math.sqrt(n),0);i=.5*Math.sqrt(2*(r+n))}else i=Math.abs(e)/Math.sqrt(2*(r-n));return t=n<=0?.5*Math.sqrt(2*(r-n)):Math.abs(e)/Math.sqrt(2*(r+n)),new h(i,e<0?-t:t)},exp:function(){var i=Math.exp(this.re);return this.im,new h(i*Math.cos(this.im),i*Math.sin(this.im))},expm1:function(){var i=this.re,t=this.im;return new h(Math.expm1(i)*Math.cos(t)+function(i){var t=Math.PI/4;if(i<-t||i>t)return Math.cos(i)-1;var n=i*i;return n*(n*(1/24+n*(-1/720+n*(1/40320+n*(-1/3628800+n*(1/4790014600+n*(-1/87178291200+n*(1/20922789888e3)))))))-.5)}(t),Math.exp(i)*Math.sin(t))},log:function(){var i=this.re,t=this.im;return new h(s(i,t),Math.atan2(t,i))},abs:function(){return i=this.re,t=this.im,n=Math.abs(i),e=Math.abs(t),n<3e3&&e<3e3?Math.sqrt(n*n+e*e):(n<e?(n=e,e=i/t):e=t/i,n*Math.sqrt(1+e*e));var i,t,n,e},arg:function(){return Math.atan2(this.im,this.re)},sin:function(){var i=this.re,t=this.im;return new h(Math.sin(i)*n(t),Math.cos(i)*e(t))},cos:function(){var i=this.re,t=this.im;return new h(Math.cos(i)*n(t),-Math.sin(i)*e(t))},tan:function(){var i=2*this.re,t=2*this.im,r=Math.cos(i)+n(t);return new h(Math.sin(i)/r,e(t)/r)},cot:function(){var i=2*this.re,t=2*this.im,r=Math.cos(i)-n(t);return new h(-Math.sin(i)/r,e(t)/r)},sec:function(){var i=this.re,t=this.im,r=.5*n(2*t)+.5*Math.cos(2*i);return new h(Math.cos(i)*n(t)/r,Math.sin(i)*e(t)/r)},csc:function(){var i=this.re,t=this.im,r=.5*n(2*t)-.5*Math.cos(2*i);return new h(Math.sin(i)*n(t)/r,-Math.cos(i)*e(t)/r)},asin:function(){var i=this.re,t=this.im,n=new h(t*t-i*i+1,-2*i*t).sqrt(),e=new h(n.re-t,n.im+i).log();return new h(e.im,-e.re)},acos:function(){var i=this.re,t=this.im,n=new h(t*t-i*i+1,-2*i*t).sqrt(),e=new h(n.re-t,n.im+i).log();return new h(Math.PI/2-e.im,e.re)},atan:function(){var i=this.re,t=this.im;if(0===i){if(1===t)return new h(0,1/0);if(-1===t)return new h(0,-1/0)}var n=i*i+(1-t)*(1-t),e=new h((1-t*t-i*i)/n,-2*i/n).log();return new h(-.5*e.im,.5*e.re)},acot:function(){var i=this.re,t=this.im;if(0===t)return new h(Math.atan2(1,i),0);var n=i*i+t*t;return 0!==n?new h(i/n,-t/n).atan():new h(0!==i?i/0:0,0!==t?-t/0:0).atan()},asec:function(){var i=this.re,t=this.im;if(0===i&&0===t)return new h(0,1/0);var n=i*i+t*t;return 0!==n?new h(i/n,-t/n).acos():new h(0!==i?i/0:0,0!==t?-t/0:0).acos()},acsc:function(){var i=this.re,t=this.im;if(0===i&&0===t)return new h(Math.PI/2,1/0);var n=i*i+t*t;return 0!==n?new h(i/n,-t/n).asin():new h(0!==i?i/0:0,0!==t?-t/0:0).asin()},sinh:function(){var i=this.re,t=this.im;return new h(e(i)*Math.cos(t),n(i)*Math.sin(t))},cosh:function(){var i=this.re,t=this.im;return new h(n(i)*Math.cos(t),e(i)*Math.sin(t))},tanh:function(){var i=2*this.re,t=2*this.im,r=n(i)+Math.cos(t);return new h(e(i)/r,Math.sin(t)/r)},coth:function(){var i=2*this.re,t=2*this.im,r=n(i)-Math.cos(t);return new h(e(i)/r,-Math.sin(t)/r)},csch:function(){var i=this.re,t=this.im,r=Math.cos(2*t)-n(2*i);return new h(-2*e(i)*Math.cos(t)/r,2*n(i)*Math.sin(t)/r)},sech:function(){var i=this.re,t=this.im,r=Math.cos(2*t)+n(2*i);return new h(2*n(i)*Math.cos(t)/r,-2*e(i)*Math.sin(t)/r)},asinh:function(){var i=this.im;this.im=-this.re,this.re=i;var t=this.asin();return this.re=-this.im,this.im=i,i=t.re,t.re=-t.im,t.im=i,t},acosh:function(){var i=this.acos();if(i.im<=0){var t=i.re;i.re=-i.im,i.im=t}else{t=i.im;i.im=-i.re,i.re=t}return i},atanh:function(){var i=this.re,t=this.im,n=i>1&&0===t,e=1-i,r=1+i,a=e*e+t*t,u=0!==a?new h((r*e-t*t)/a,(t*e+r*t)/a):new h(-1!==i?i/0:0,0!==t?t/0:0),o=u.re;return u.re=s(u.re,u.im)/2,u.im=Math.atan2(u.im,o)/2,n&&(u.im=-u.im),u},acoth:function(){var i=this.re,t=this.im;if(0===i&&0===t)return new h(0,Math.PI/2);var n=i*i+t*t;return 0!==n?new h(i/n,-t/n).atanh():new h(0!==i?i/0:0,0!==t?-t/0:0).atanh()},acsch:function(){var i=this.re,t=this.im;if(0===t)return new h(0!==i?Math.log(i+Math.sqrt(i*i+1)):1/0,0);var n=i*i+t*t;return 0!==n?new h(i/n,-t/n).asinh():new h(0!==i?i/0:0,0!==t?-t/0:0).asinh()},asech:function(){var i=this.re,t=this.im;if(this.isZero())return h.INFINITY;var n=i*i+t*t;return 0!==n?new h(i/n,-t/n).acosh():new h(0!==i?i/0:0,0!==t?-t/0:0).acosh()},inverse:function(){if(this.isZero())return h.INFINITY;if(this.isInfinite())return h.ZERO;var i=this.re,t=this.im,n=i*i+t*t;return new h(i/n,-t/n)},conjugate:function(){return new h(this.re,-this.im)},neg:function(){return new h(-this.re,-this.im)},ceil:function(i){return i=Math.pow(10,i||0),new h(Math.ceil(this.re*i)/i,Math.ceil(this.im*i)/i)},floor:function(i){return i=Math.pow(10,i||0),new h(Math.floor(this.re*i)/i,Math.floor(this.im*i)/i)},round:function(i){return i=Math.pow(10,i||0),new h(Math.round(this.re*i)/i,Math.round(this.im*i)/i)},equals:function(i,t){var n=new h(i,t);return Math.abs(n.re-this.re)<=h.EPSILON&&Math.abs(n.im-this.im)<=h.EPSILON},clone:function(){return new h(this.re,this.im)},toString:function(){var i=this.re,t=this.im,n="";return this.isNaN()?"NaN":this.isZero()?"0":this.isInfinite()?"Infinity":(0!==i&&(n+=i),0!==t&&(0!==i?n+=t<0?" - ":" + ":t<0&&(n+="-"),1!==(t=Math.abs(t))&&(n+=t),n+="i"),n||"0")},toVector:function(){return[this.re,this.im]},valueOf:function(){return 0===this.im?this.re:null},isNaN:function(){return isNaN(this.re)||isNaN(this.im)},isZero:function(){return!(0!==this.re&&-0!==this.re||0!==this.im&&-0!==this.im)},isFinite:function(){return isFinite(this.re)&&isFinite(this.im)},isInfinite:function(){return!(this.isNaN()||this.isFinite())}},h.ZERO=new h(0,0),h.ONE=new h(1,0),h.I=new h(0,1),h.PI=new h(Math.PI,0),h.E=new h(Math.E,0),h.INFINITY=new h(1/0,1/0),h.NAN=new h(NaN,NaN),h.EPSILON=1e-16,"function"==typeof i&&i.amd?i([],function(){return h}):"object"==typeof exports?(Object.defineProperty(exports,"__esModule",{value:!0}),h.default=h,h.Complex=h,module.exports=h):t.Complex=h}(this);
},{}],"dh9O":[function(require,module,exports) {
"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function r(o){return(r="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(r){return t(r)}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":t(r)})(o)}var o=require("complex.js"),e=require("../../utils/number").format,n=require("../../utils/number").isNumber;function i(t,i,u,p,s){return o.prototype.type="Complex",o.prototype.isComplex=!0,o.prototype.toJSON=function(){return{mathjs:"Complex",re:this.re,im:this.im}},o.prototype.toPolar=function(){return{r:this.abs(),phi:this.arg()}},o.prototype.format=function(t){var r=this.im,o=this.re,i=e(this.re,t),u=e(this.im,t),p=n(t)?t:t?t.precision:null;if(null!==p){var s=Math.pow(10,-p);Math.abs(o/r)<s&&(o=0),Math.abs(r/o)<s&&(r=0)}return 0===r?i:0===o?1===r?"i":-1===r?"-i":u+"i":r<0?-1===r?i+" - i":i+" - "+u.substring(1)+"i":1===r?i+" + i":i+" + "+u+"i"},o.fromPolar=function(e){switch(arguments.length){case 1:var i=arguments[0];if("object"===r(i))return o(i);throw new TypeError("Input has to be an object with r and phi keys.");case 2:var u=arguments[0],p=arguments[1];if(n(u)){if(t.isUnit(p)&&p.hasBase("ANGLE")&&(p=p.toNumber("rad")),n(p))return new o({r:u,phi:p});throw new TypeError("Phi is not a number nor an angle unit.")}throw new TypeError("Radius r is not a number.");default:throw new SyntaxError("Wrong number of arguments in function fromPolar")}},o.prototype.valueOf=o.prototype.toString,o.fromJSON=function(t){return new o(t)},o.EPSILON=i.epsilon,s.on("config",function(t,r){t.epsilon!==r.epsilon&&(o.EPSILON=t.epsilon)}),o.compare=function(t,r){return t.re>r.re?1:t.re<r.re?-1:t.im>r.im?1:t.im<r.im?-1:0},o}exports.name="Complex",exports.path="type",exports.factory=i,exports.math=!0;
},{"complex.js":"LEuu","../../utils/number":"uqMu"}],"gC7Z":[function(require,module,exports) {
"use strict";var e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t={"{":"\\{","}":"\\}","\\":"\\textbackslash{}","#":"\\#",$:"\\$","%":"\\%","&":"\\&","^":"\\textasciicircum{}",_:"\\_","~":"\\textasciitilde{}"},n={"":"\\--","—":"\\---"," ":"~","\t":"\\qquad{}","\r\n":"\\newline{}","\n":"\\newline{}"},r=function(t,n){return e({},t,n)};module.exports=function(i){for(var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},l=c.preserveFormatting,a=void 0!==l&&l,o=c.escapeMapFn,s=void 0===o?r:o,u=String(i),g="",h=s(e({},t),a?e({},n):{}),v=Object.keys(h),f=function(){var e=!1;v.forEach(function(t,n){e||u.length>=t.length&&u.slice(0,t.length)===t&&(g+=h[v[n]],u=u.slice(t.length,u.length),e=!0)}),e||(g+=u.slice(0,1),u=u.slice(1,u.length))};u;)f();return g};
},{}],"H1Mr":[function(require,module,exports) {
"use strict";var a=require("escape-latex");exports.symbols={Alpha:"A",alpha:"\\alpha",Beta:"B",beta:"\\beta",Gamma:"\\Gamma",gamma:"\\gamma",Delta:"\\Delta",delta:"\\delta",Epsilon:"E",epsilon:"\\epsilon",varepsilon:"\\varepsilon",Zeta:"Z",zeta:"\\zeta",Eta:"H",eta:"\\eta",Theta:"\\Theta",theta:"\\theta",vartheta:"\\vartheta",Iota:"I",iota:"\\iota",Kappa:"K",kappa:"\\kappa",varkappa:"\\varkappa",Lambda:"\\Lambda",lambda:"\\lambda",Mu:"M",mu:"\\mu",Nu:"N",nu:"\\nu",Xi:"\\Xi",xi:"\\xi",Omicron:"O",omicron:"o",Pi:"\\Pi",pi:"\\pi",varpi:"\\varpi",Rho:"P",rho:"\\rho",varrho:"\\varrho",Sigma:"\\Sigma",sigma:"\\sigma",varsigma:"\\varsigma",Tau:"T",tau:"\\tau",Upsilon:"\\Upsilon",upsilon:"\\upsilon",Phi:"\\Phi",phi:"\\phi",varphi:"\\varphi",Chi:"X",chi:"\\chi",Psi:"\\Psi",psi:"\\psi",Omega:"\\Omega",omega:"\\omega",true:"\\mathrm{True}",false:"\\mathrm{False}",i:"i",inf:"\\infty",Inf:"\\infty",infinity:"\\infty",Infinity:"\\infty",oo:"\\infty",lim:"\\lim",undefined:"\\mathbf{?}"},exports.operators={transpose:"^\\top",ctranspose:"^H",factorial:"!",pow:"^",dotPow:".^\\wedge",unaryPlus:"+",unaryMinus:"-",bitNot:"\\~",not:"\\neg",multiply:"\\cdot",divide:"\\frac",dotMultiply:".\\cdot",dotDivide:".:",mod:"\\mod",add:"+",subtract:"-",to:"\\rightarrow",leftShift:"<<",rightArithShift:">>",rightLogShift:">>>",equal:"=",unequal:"\\neq",smaller:"<",larger:">",smallerEq:"\\leq",largerEq:"\\geq",bitAnd:"\\&",bitXor:"\\underline{|}",bitOr:"|",and:"\\wedge",xor:"\\veebar",or:"\\vee"},exports.defaultTemplate="\\mathrm{${name}}\\left(${args}\\right)";var t={deg:"^\\circ"};exports.escape=function(t){return a(t,{preserveFormatting:!0})},exports.toSymbol=function(a,e){return(e=void 0!==e&&e)?t.hasOwnProperty(a)?t[a]:"\\mathrm{"+exports.escape(a)+"}":exports.symbols.hasOwnProperty(a)?exports.symbols[a]:exports.escape(a)};
},{"escape-latex":"gC7Z"}],"V5uf":[function(require,module,exports) {
"use strict";var r=require("../../../utils/collection/deepMap");function e(e,n,t,i){var o=require("../../../utils/latex"),u=i("complex",{"":function(){return e.Complex.ZERO},number:function(r){return new e.Complex(r,0)},"number, number":function(r,n){return new e.Complex(r,n)},"BigNumber, BigNumber":function(r,n){return new e.Complex(r.toNumber(),n.toNumber())},Complex:function(r){return r.clone()},string:function(r){return e.Complex(r)},null:function(r){return e.Complex(0)},Object:function(r){if("re"in r&&"im"in r)return new e.Complex(r.re,r.im);if("r"in r&&"phi"in r||"abs"in r&&"arg"in r)return new e.Complex(r);throw new Error("Expected object with properties (re and im) or (r and phi) or (abs and arg)")},"Array | Matrix":function(e){return r(e,u)}});return u.toTex={0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)+".concat(o.symbols.i,"\\cdot\\left(${args[1]}\\right)\\right)")},u}exports.name="complex",exports.factory=e;
},{"../../../utils/collection/deepMap":"lOYo","../../../utils/latex":"H1Mr"}],"Oad0":[function(require,module,exports) {
"use strict";module.exports=[require("./Complex"),require("./function/complex")];
},{"./Complex":"dh9O","./function/complex":"V5uf"}],"TToH":[function(require,module,exports) {
var define;
var t;!function(n){"use strict";var i=2e3,s={s:1,n:0,d:1};function r(t){function n(){var n=Error.apply(this,arguments);n.name=this.name=t,this.stack=n.stack,this.message=n.message}function i(){}return i.prototype=Error.prototype,n.prototype=new i,n}var e=d.DivisionByZero=r("DivisionByZero"),h=d.InvalidParameter=r("InvalidParameter");function o(t,n){return isNaN(t=parseInt(t,10))&&a(),t*n}function a(){throw new h}var u=function(t,n){var i,r=0,h=1,u=1,f=0,d=0,c=0,N=1,l=1,w=0,p=1,v=1,M=1,b=1e7;if(null==t);else if(void 0!==n)u=(r=t)*(h=n);else switch(typeof t){case"object":"d"in t&&"n"in t?(r=t.n,h=t.d,"s"in t&&(r*=t.s)):0 in t?(r=t[0],1 in t&&(h=t[1])):a(),u=r*h;break;case"number":if(t<0&&(u=t,t=-t),t%1==0)r=t;else if(t>0){for(t>=1&&(t/=l=Math.pow(10,Math.floor(1+Math.log(t)/Math.LN10)));p<=b&&M<=b;){if(t===(i=(w+v)/(p+M))){p+M<=b?(r=w+v,h=p+M):M>p?(r=v,h=M):(r=w,h=p);break}t>i?(w+=v,p+=M):(v+=w,M+=p),p>b?(r=v,h=M):(r=w,h=p)}r*=l}else(isNaN(t)||isNaN(n))&&(h=r=NaN);break;case"string":if(null===(p=t.match(/\d+|./g))&&a(),"-"===p[w]?(u=-1,w++):"+"===p[w]&&w++,p.length===w+1?d=o(p[w++],u):"."===p[w+1]||"."===p[w]?("."!==p[w]&&(f=o(p[w++],u)),(++w+1===p.length||"("===p[w+1]&&")"===p[w+3]||"'"===p[w+1]&&"'"===p[w+3])&&(d=o(p[w],u),N=Math.pow(10,p[w].length),w++),("("===p[w]&&")"===p[w+2]||"'"===p[w]&&"'"===p[w+2])&&(c=o(p[w+1],u),l=Math.pow(10,p[w+1].length)-1,w+=3)):"/"===p[w+1]||":"===p[w+1]?(d=o(p[w],u),N=o(p[w+2],1),w+=3):"/"===p[w+3]&&" "===p[w+1]&&(f=o(p[w],u),d=o(p[w+2],u),N=o(p[w+4],1),w+=5),p.length<=w){u=r=c+(h=N*l)*f+l*d;break}default:a()}if(0===h)throw new e;s.s=u<0?-1:1,s.n=Math.abs(r),s.d=Math.abs(h)};function f(t,n){if(!t)return n;if(!n)return t;for(;;){if(!(t%=n))return n;if(!(n%=t))return t}}function d(t,n){if(!(this instanceof d))return new d(t,n);u(t,n),t=d.REDUCE?f(s.d,s.n):1,this.s=s.s,this.n=s.n/t,this.d=s.d/t}d.REDUCE=1,d.prototype={s:1,n:0,d:1,abs:function(){return new d(this.n,this.d)},neg:function(){return new d(-this.s*this.n,this.d)},add:function(t,n){return u(t,n),new d(this.s*this.n*s.d+s.s*this.d*s.n,this.d*s.d)},sub:function(t,n){return u(t,n),new d(this.s*this.n*s.d-s.s*this.d*s.n,this.d*s.d)},mul:function(t,n){return u(t,n),new d(this.s*s.s*this.n*s.n,this.d*s.d)},div:function(t,n){return u(t,n),new d(this.s*s.s*this.n*s.d,this.d*s.n)},clone:function(){return new d(this)},mod:function(t,n){return isNaN(this.n)||isNaN(this.d)?new d(NaN):void 0===t?new d(this.s*this.n%this.d,1):(u(t,n),0===s.n&&0===this.d&&d(0,0),new d(this.s*(s.d*this.n)%(s.n*this.d),s.d*this.d))},gcd:function(t,n){return u(t,n),new d(f(s.n,this.n)*f(s.d,this.d),s.d*this.d)},lcm:function(t,n){return u(t,n),0===s.n&&0===this.n?new d:new d(s.n*this.n,f(s.n,this.n)*f(s.d,this.d))},ceil:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new d(NaN):new d(Math.ceil(t*this.s*this.n/this.d),t)},floor:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new d(NaN):new d(Math.floor(t*this.s*this.n/this.d),t)},round:function(t){return t=Math.pow(10,t||0),isNaN(this.n)||isNaN(this.d)?new d(NaN):new d(Math.round(t*this.s*this.n/this.d),t)},inverse:function(){return new d(this.s*this.d,this.n)},pow:function(t){return t<0?new d(Math.pow(this.s*this.d,-t),Math.pow(this.n,-t)):new d(Math.pow(this.s*this.n,t),Math.pow(this.d,t))},equals:function(t,n){return u(t,n),this.s*this.n*s.d==s.s*s.n*this.d},compare:function(t,n){u(t,n);var i=this.s*this.n*s.d-s.s*s.n*this.d;return(0<i)-(i<0)},simplify:function(t){if(isNaN(this.n)||isNaN(this.d))return this;var n=this.abs().toContinued();function i(t){return 1===t.length?new d(t[0]):i(t.slice(1)).inverse().add(t[0])}t=t||.001;for(var s=0;s<n.length;s++){var r=i(n.slice(0,s+1));if(r.sub(this.abs()).abs().valueOf()<t)return r.mul(this.s)}return this},divisible:function(t,n){return u(t,n),!(!(s.n*this.d)||this.n*s.d%(s.n*this.d))},valueOf:function(){return this.s*this.n/this.d},toFraction:function(t){var n,i="",s=this.n,r=this.d;return this.s<0&&(i+="-"),1===r?i+=s:(t&&(n=Math.floor(s/r))>0&&(i+=n,i+=" ",s%=r),i+=s,i+="/",i+=r),i},toLatex:function(t){var n,i="",s=this.n,r=this.d;return this.s<0&&(i+="-"),1===r?i+=s:(t&&(n=Math.floor(s/r))>0&&(i+=n,s%=r),i+="\\frac{",i+=s,i+="}{",i+=r,i+="}"),i},toContinued:function(){var t,n=this.n,i=this.d,s=[];if(isNaN(this.n)||isNaN(this.d))return s;do{s.push(Math.floor(n/i)),t=n%i,n=i,i=t}while(1!==n);return s},toString:function(t){var n,s=this.n,r=this.d;if(isNaN(s)||isNaN(r))return"NaN";d.REDUCE||(s/=n=f(s,r),r/=n),t=t||15;var e=function(t,n){for(;n%2==0;n/=2);for(;n%5==0;n/=5);if(1===n)return 0;for(var s=10%n,r=1;1!==s;r++)if(s=10*s%n,r>i)return 0;return r}(0,r),h=function(t,n,i){for(var s=1,r=function(t,n,i){for(var s=1;n>0;t=t*t%i,n>>=1)1&n&&(s=s*t%i);return s}(10,i,n),e=0;e<300;e++){if(s===r)return e;s=10*s%n,r=10*r%n}return 0}(0,r,e),o=-1===this.s?"-":"";if(o+=s/r|0,s%=r,(s*=10)&&(o+="."),e){for(var a=h;a--;)o+=s/r|0,s%=r,s*=10;o+="(";for(a=e;a--;)o+=s/r|0,s%=r,s*=10;o+=")"}else for(a=t;s&&a--;)o+=s/r|0,s%=r,s*=10;return o}},"function"==typeof t&&t.amd?t([],function(){return d}):"object"==typeof exports?(Object.defineProperty(exports,"__esModule",{value:!0}),d.default=d,d.Fraction=d,module.exports=d):n.Fraction=d}(this);
},{}],"ibo9":[function(require,module,exports) {
"use strict";var t=require("fraction.js");function r(r,o,n,e){return t}t.prototype.type="Fraction",t.prototype.isFraction=!0,t.prototype.toJSON=function(){return{mathjs:"Fraction",n:this.s*this.n,d:this.d}},t.fromJSON=function(r){return new t(r)},exports.name="Fraction",exports.path="type",exports.factory=r;
},{"fraction.js":"TToH"}],"CouR":[function(require,module,exports) {
"use strict";var n=require("../../../utils/collection/deepMap");function r(r,t,e,i){var o=i("fraction",{number:function(n){if(!isFinite(n)||isNaN(n))throw new Error(n+" cannot be represented as a fraction");return new r.Fraction(n)},string:function(n){return new r.Fraction(n)},"number, number":function(n,t){return new r.Fraction(n,t)},null:function(n){return new r.Fraction(0)},BigNumber:function(n){return new r.Fraction(n.toString())},Fraction:function(n){return n},Object:function(n){return new r.Fraction(n)},"Array | Matrix":function(r){return n(r,o)}});return o}exports.name="fraction",exports.factory=r;
},{"../../../utils/collection/deepMap":"lOYo"}],"sfyz":[function(require,module,exports) {
"use strict";module.exports=[require("./Fraction"),require("./function/fraction")];
},{"./Fraction":"ibo9","./function/fraction":"CouR"}],"YiAw":[function(require,module,exports) {
"use strict";function r(t,o,e){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this.actual=t,this.expected=o,this.relation=e,this.message="Dimension mismatch ("+(Array.isArray(t)?"["+t.join(", ")+"]":t)+" "+(this.relation||"!=")+" "+(Array.isArray(o)?"["+o.join(", ")+"]":o)+")",this.stack=(new Error).stack}r.prototype=new RangeError,r.prototype.constructor=RangeError,r.prototype.name="DimensionError",r.prototype.isDimensionError=!0,module.exports=r;
},{}],"tfOV":[function(require,module,exports) {
"use strict";function t(e,i,s){if(!(this instanceof t))throw new SyntaxError("Constructor must be called with the new operator");this.index=e,arguments.length<3?(this.min=0,this.max=i):(this.min=i,this.max=s),void 0!==this.min&&this.index<this.min?this.message="Index out of range ("+this.index+" < "+this.min+")":void 0!==this.max&&this.index>=this.max?this.message="Index out of range ("+this.index+" > "+(this.max-1)+")":this.message="Index out of range ("+this.index+")",this.stack=(new Error).stack}t.prototype=new RangeError,t.prototype.constructor=RangeError,t.prototype.name="IndexError",t.prototype.isIndexError=!0,module.exports=t;
},{}],"j2lF":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.size=i,exports.validate=f,exports.validateIndex=u,exports.resize=l,exports.reshape=h,exports.squeeze=p,exports.unsqueeze=A,exports.flatten=d,exports.map=v,exports.forEach=w,exports.filter=x,exports.filterRegExp=E,exports.join=m,exports.identify=z,exports.generalize=b;var r=o(require("./number")),e=o(require("./string")),t=o(require("../error/DimensionError")),n=o(require("../error/IndexError"));function o(r){return r&&r.__esModule?r:{default:r}}function i(r){for(var e=[];Array.isArray(r);)e.push(r.length),r=r[0];return e}function a(r,e,n){var o,i=r.length;if(i!==e[n])throw new t.default(i,e[n]);if(n<e.length-1){var f=n+1;for(o=0;o<i;o++){var u=r[o];if(!Array.isArray(u))throw new t.default(e.length-1,e.length,"<");a(r[o],e,f)}}else for(o=0;o<i;o++)if(Array.isArray(r[o]))throw new t.default(e.length+1,e.length,">")}function f(r,e){if(0===e.length){if(Array.isArray(r))throw new t.default(r.length,0)}else a(r,e,0)}function u(e,t){if(!r.default.isNumber(e)||!r.default.isInteger(e))throw new TypeError("Index must be an integer (value: "+e+")");if(e<0||"number"==typeof t&&e>=t)throw new n.default(e,t)}function l(t,n,o){if(!Array.isArray(t)||!Array.isArray(n))throw new TypeError("Array expected");if(0===n.length)throw new Error("Resizing to scalar is not supported");return n.forEach(function(t){if(!r.default.isNumber(t)||!r.default.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+e.default.format(n)+")")}),s(t,n,0,void 0!==o?o:0),t}function s(r,e,t,n){var o,i,a=r.length,f=e[t],u=Math.min(a,f);if(r.length=f,t<e.length-1){var l=t+1;for(o=0;o<u;o++)i=r[o],Array.isArray(i)||(i=[i],r[o]=i),s(i,e,l,n);for(o=u;o<f;o++)i=[],r[o]=i,s(i,e,l,n)}else{for(o=0;o<u;o++)for(;Array.isArray(r[o]);)r[o]=r[o][0];for(o=u;o<f;o++)r[o]=n}}function h(r,e){var n,o=d(r);function a(r){return r.reduce(function(r,e){return r*e})}if(!Array.isArray(r)||!Array.isArray(e))throw new TypeError("Array expected");if(0===e.length)throw new t.default(0,a(i(r)),"!=");for(var f=1,u=0;u<e.length;u++)f*=e[u];if(o.length!==f)throw new t.default(a(e),a(i(r)),"!=");try{n=y(o,e)}catch(l){if(l instanceof t.default)throw new t.default(a(e),a(i(r)),"!=");throw l}return n}function y(r,e){for(var t,n=r,o=e.length-1;o>0;o--){var i=e[o];t=[];for(var a=n.length/i,f=0;f<a;f++)t.push(n.slice(f*i,(f+1)*i));n=t}return n}function p(r,e){for(var t=e||i(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=c(r,n,0),t.length=n),r}function c(r,e,t){var n,o;if(t<e){var i=t+1;for(n=0,o=r.length;n<o;n++)r[n]=c(r[n],e,i)}else for(;Array.isArray(r);)r=r[0];return r}function A(r,e,t,n){var o=n||i(r);if(t)for(var a=0;a<t;a++)r=[r],o.unshift(1);for(r=g(r,e,0);o.length<e;)o.push(1);return r}function g(r,e,t){var n,o;if(Array.isArray(r)){var i=t+1;for(n=0,o=r.length;n<o;n++)r[n]=g(r[n],e,i)}else for(var a=t;a<e;a++)r=[r];return r}function d(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 v(r,e){return Array.prototype.map.call(r,e)}function w(r,e){Array.prototype.forEach.call(r,e)}function x(r,e){if(1!==i(r).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,e)}function E(r,e){if(1!==i(r).length)throw new Error("Only one dimensional matrices supported");return Array.prototype.filter.call(r,function(r){return e.test(r)})}function m(r,e){return Array.prototype.join.call(r,e)}function z(r){if(!Array.isArray(r))throw new 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 b(r){if(!Array.isArray(r))throw new 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}
},{"./number":"uqMu","./string":"PshC","../error/DimensionError":"YiAw","../error/IndexError":"tfOV"}],"UaI8":[function(require,module,exports) {
"use strict";exports.isBoolean=function(o){return"boolean"==typeof o};
},{}],"woyg":[function(require,module,exports) {
"use strict";function t(n){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(n)}function n(o){return(n="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(n){return t(n)}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":t(n)})(o)}exports.memoize=function(t,o){return function e(){"object"!==n(e.cache)&&(e.cache={});for(var r=[],c=0;c<arguments.length;c++)r[c]=arguments[c];var u=o?o(r):JSON.stringify(r);return u in e.cache||(e.cache[u]=t.apply(t,r)),e.cache[u]}},exports.maxArgumentCount=function(t){return Object.keys(t.signatures||{}).reduce(function(t,n){var o=(n.match(/,/g)||[]).length+1;return Math.max(t,o)},-1)},exports.callWithRightArgumentCount=function(t,n,o){return Object.keys(t.signatures||{}).reduce(function(t,n){var o=(n.match(/,/g)||[]).length+1;return Math.max(t,o)},-1)};
},{}],"fsXI":[function(require,module,exports) {
"use strict";exports.array=require("./array"),exports.boolean=require("./boolean"),exports.function=require("./function"),exports.number=require("./number"),exports.object=require("./object"),exports.string=require("./string"),exports.emitter=require("./emitter");
},{"./array":"j2lF","./boolean":"UaI8","./function":"woyg","./number":"uqMu","./object":"FcSp","./string":"PshC","./emitter":"GJvY"}],"w7z6":[function(require,module,exports) {
"use strict";var t=require("../../utils/index"),r=t.string,o=r.isString;function n(t,r,n,e){function a(){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator")}return a.prototype.type="Matrix",a.prototype.isMatrix=!0,a.storage=function(t){if(!o(t))throw new TypeError("format must be a string value");var r=a._storage[t];if(!r)throw new SyntaxError("Unsupported matrix storage format: "+t);return r},a._storage={},a.prototype.storage=function(){throw new Error("Cannot invoke storage on a Matrix interface")},a.prototype.datatype=function(){throw new Error("Cannot invoke datatype on a Matrix interface")},a.prototype.create=function(t,r){throw new Error("Cannot invoke create on a Matrix interface")},a.prototype.subset=function(t,r,o){throw new Error("Cannot invoke subset on a Matrix interface")},a.prototype.get=function(t){throw new Error("Cannot invoke get on a Matrix interface")},a.prototype.set=function(t,r,o){throw new Error("Cannot invoke set on a Matrix interface")},a.prototype.resize=function(t,r){throw new Error("Cannot invoke resize on a Matrix interface")},a.prototype.reshape=function(t,r){throw new Error("Cannot invoke reshape on a Matrix interface")},a.prototype.clone=function(){throw new Error("Cannot invoke clone on a Matrix interface")},a.prototype.size=function(){throw new Error("Cannot invoke size on a Matrix interface")},a.prototype.map=function(t,r){throw new Error("Cannot invoke map on a Matrix interface")},a.prototype.forEach=function(t){throw new Error("Cannot invoke forEach on a Matrix interface")},a.prototype.toArray=function(){throw new Error("Cannot invoke toArray on a Matrix interface")},a.prototype.valueOf=function(){throw new Error("Cannot invoke valueOf on a Matrix interface")},a.prototype.format=function(t){throw new Error("Cannot invoke format on a Matrix interface")},a.prototype.toString=function(){throw new Error("Cannot invoke toString on a Matrix interface")},a}exports.name="Matrix",exports.path="type",exports.factory=n;
},{"../../utils/index":"fsXI"}],"LZTG":[function(require,module,exports) {
"use strict";function t(o){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(o)}function o(n){return(o="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(o){return t(o)}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":t(o)})(n)}function n(t,n,e,r){var i=r("_typeof",{any:function(n){var e=o(n);return"object"===e?null===n?"null":Array.isArray(n)?"Array":n instanceof Date?"Date":n instanceof RegExp?"RegExp":t.isBigNumber(n)?"BigNumber":t.isComplex(n)?"Complex":t.isFraction(n)?"Fraction":t.isMatrix(n)?"Matrix":t.isUnit(n)?"Unit":t.isIndex(n)?"Index":t.isRange(n)?"Range":t.isResultSet(n)?"ResultSet":t.isNode(n)?n.type:t.isChain(n)?"Chain":t.isHelp(n)?"Help":"Object":"function"===e?"Function":e}});return i.toTex=void 0,i}exports.name="typeof",exports.factory=n;
},{}],"XmtI":[function(require,module,exports) {
"use strict";function r(r,t,e,n){var i=e(require("../../../function/utils/typeof"));return function r(t){for(var e,n=0,u=0;u<t.length;u++){var f=t[u],o=Array.isArray(f);if(0===u&&o&&(n=f.length),o&&f.length!==n)return;var a=o?r(f):i(f);if(void 0===e)e=a;else if(e!==a)return"mixed"}return e}}exports.factory=r;
},{"../../../function/utils/typeof":"LZTG"}],"bZ8L":[function(require,module,exports) {
"use strict";var t=require("../../utils/index"),e=require("../../error/DimensionError"),r=t.string,i=t.array,n=t.object,a=t.number,o=Array.isArray,s=a.isNumber,h=a.isInteger,u=r.isString,p=i.validateIndex;function f(a,f,l,d){var c=l(require("./utils/getArrayDataType")),y=l(require("./Matrix"));function _(e,r){if(!(this instanceof _))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!u(r))throw new Error("Invalid datatype: "+r);if(a.isMatrix(e))"DenseMatrix"===e.type?(this._data=n.clone(e._data),this._size=n.clone(e._size),this._datatype=r||e._datatype):(this._data=e.toArray(),this._size=e.size(),this._datatype=r||e._datatype);else if(e&&o(e.data)&&o(e.size))this._data=e.data,this._size=e.size,this._datatype=r||e.datatype;else if(o(e))this._data=function t(e){for(var r=0,i=e.length;r<i;r++){var n=e[r];o(n)?e[r]=t(n):n&&!0===n.isMatrix&&(e[r]=t(n.valueOf()))}return e}(e),this._size=i.size(this._data),i.validate(this._data,this._size),this._datatype=r;else{if(e)throw new TypeError("Unsupported type of data ("+t.types.type(e)+")");this._data=[],this._size=[0],this._datatype=r}}function g(t,e,r){if(0===e.length){for(var n=t._data;o(n);)n=n[0];return n}return t._size=e.slice(0),t._data=i.resize(t._data,t._size,r),t}function w(t,e,r){for(var i=t._size.slice(0),n=!1;i.length<e.length;)i.push(0),n=!0;for(var a=0,o=e.length;a<o;a++)e[a]>i[a]&&(i[a]=e[a],n=!0);n&&g(t,i,r)}return _.prototype=new y,_.prototype.type="DenseMatrix",_.prototype.isDenseMatrix=!0,_.prototype.getDataType=function(){return c(this._data)},_.prototype.storage=function(){return"dense"},_.prototype.datatype=function(){return this._datatype},_.prototype.create=function(t,e){return new _(t,e)},_.prototype.subset=function(t,r,o){switch(arguments.length){case 1:return function(t,r){if(!a.isIndex(r))throw new TypeError("Invalid index");if(r.isScalar())return t.get(r.min());var i=r.size();if(i.length!==t._size.length)throw new e(i.length,t._size.length);for(var n=r.min(),o=r.max(),s=0,h=t._size.length;s<h;s++)p(n[s],t._size[s]),p(o[s],t._size[s]);return new _(function t(e,r,i,n){var a=n===i-1;var o=r.dimension(n);return a?o.map(function(t){return p(t,e.length),e[t]}).valueOf():o.map(function(a){p(a,e.length);var o=e[a];return t(o,r,i,n+1)}).valueOf()}(t._data,r,i.length,0),t._datatype)}(this,t);case 2:case 3:return function(t,r,o,s){if(!r||!0!==r.isIndex)throw new TypeError("Invalid index");var h,u=r.size(),f=r.isScalar();a.isMatrix(o)?(h=o.size(),o=o.valueOf()):h=i.size(o);if(f){if(0!==h.length)throw new TypeError("Scalar expected");t.set(r.min(),o,s)}else{if(u.length<t._size.length)throw new e(u.length,t._size.length,"<");if(h.length<u.length){for(var l=0,d=0;1===u[l]&&1===h[l];)l++;for(;1===u[l];)d++,l++;o=i.unsqueeze(o,u.length,d,h)}if(!n.deepEqual(u,h))throw new e(u,h,">");var c=r.max().map(function(t){return t+1});w(t,c,s);var y=u.length;!function t(e,r,i,n,a){var o=a===n-1;var s=r.dimension(a);o?s.forEach(function(t,r){p(t),e[t]=i[r[0]]}):s.forEach(function(o,s){p(o),t(e[o],r,i[s[0]],n,a+1)})}(t._data,r,o,y,0)}return t}(this,t,r,o);default:throw new SyntaxError("Wrong number of arguments")}},_.prototype.get=function(t){if(!o(t))throw new TypeError("Array expected");if(t.length!==this._size.length)throw new e(t.length,this._size.length);for(var r=0;r<t.length;r++)p(t[r],this._size[r]);for(var i=this._data,n=0,a=t.length;n<a;n++){var s=t[n];p(s,i.length),i=i[s]}return i},_.prototype.set=function(t,r,i){if(!o(t))throw new TypeError("Array expected");if(t.length<this._size.length)throw new e(t.length,this._size.length,"<");var n,a,s;w(this,t.map(function(t){return t+1}),i);var h=this._data;for(n=0,a=t.length-1;n<a;n++)s=t[n],p(s,h.length),h=h[s];return s=t[t.length-1],p(s,h.length),h[s]=r,this},_.prototype.resize=function(t,e,r){if(!o(t))throw new TypeError("Array expected");return g(r?this.clone():this,t,e)},_.prototype.reshape=function(t,e){var r=e?this.clone():this;return r._data=i.reshape(r._data,t),r._size=t.slice(0),r},_.prototype.clone=function(){return new _({data:n.clone(this._data),size:n.clone(this._size),datatype:this._datatype})},_.prototype.size=function(){return this._size.slice(0)},_.prototype.map=function(t){var e=this;return new _({data:function r(i,n){return o(i)?i.map(function(t,e){return r(t,n.concat(e))}):t(i,n,e)}(this._data,[]),size:n.clone(this._size),datatype:this._datatype})},_.prototype.forEach=function(t){var e=this;!function r(i,n){o(i)?i.forEach(function(t,e){r(t,n.concat(e))}):t(i,n,e)}(this._data,[])},_.prototype.toArray=function(){return n.clone(this._data)},_.prototype.valueOf=function(){return this._data},_.prototype.format=function(t){return r.format(this._data,t)},_.prototype.toString=function(){return r.format(this._data)},_.prototype.toJSON=function(){return{mathjs:"DenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},_.prototype.diagonal=function(t){if(t){if(a.isBigNumber(t)&&(t=t.toNumber()),!s(t)||!h(t))throw new TypeError("The parameter k must be an integer number")}else t=0;for(var e=t>0?t:0,r=t<0?-t:0,i=this._size[0],n=this._size[1],o=Math.min(i-r,n-e),u=[],p=0;p<o;p++)u[p]=this._data[p+r][p+e];return new _({data:u,size:[o],datatype:this._datatype})},_.diagonal=function(t,e,r,n,p){if(!o(t))throw new TypeError("Array expected, size parameter");if(2!==t.length)throw new Error("Only two dimensions matrix are supported");if(t=t.map(function(t){if(a.isBigNumber(t)&&(t=t.toNumber()),!s(t)||!h(t)||t<1)throw new Error("Size values must be positive integers");return t}),r){if(a.isBigNumber(r)&&(r=r.toNumber()),!s(r)||!h(r))throw new TypeError("The parameter k must be an integer number")}else r=0;n&&u(p)&&(n=d.convert(n,p));var f,l=r>0?r:0,c=r<0?-r:0,y=t[0],g=t[1],w=Math.min(y-c,g-l);if(o(e)){if(e.length!==w)throw new Error("Invalid value array length");f=function(t){return e[t]}}else if(a.isMatrix(e)){var z=e.size();if(1!==z.length||z[0]!==w)throw new Error("Invalid matrix length");f=function(t){return e.get([t])}}else f=function(){return e};n||(n=a.isBigNumber(f(0))?new a.BigNumber(0):0);var m=[];if(t.length>0){m=i.resize(m,t,n);for(var v=0;v<w;v++)m[v+c][v+l]=f(v)}return new _({data:m,size:[y,g]})},_.fromJSON=function(t){return new _(t)},_.prototype.swapRows=function(t,e){if(!(s(t)&&h(t)&&s(e)&&h(e)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return p(t,this._size[0]),p(e,this._size[0]),_._swapRows(t,e,this._data),this},_._swapRows=function(t,e,r){var i=r[t];r[t]=r[e],r[e]=i},a.Matrix._storage.dense=_,a.Matrix._storage.default=_,_}exports.name="DenseMatrix",exports.path="type",exports.factory=f,exports.lazy=!1;
},{"../../utils/index":"fsXI","../../error/DimensionError":"YiAw","./utils/getArrayDataType":"XmtI","./Matrix":"w7z6"}],"Uu9K":[function(require,module,exports) {
"use strict";module.exports=function(r,i,e){if(null==e)return r.eq(i);if(r.eq(i))return!0;if(r.isNaN()||i.isNaN())return!1;if(r.isFinite()&&i.isFinite()){var t=r.minus(i).abs();if(t.isZero())return!0;var s=r.constructor.max(r.abs(),i.abs());return t.lte(s.times(e))}return!1};
},{}],"QvIw":[function(require,module,exports) {
"use strict";var e=require("../../utils/number").nearlyEqual,n=require("../../utils/bignumber/nearlyEqual");function r(r,u,t,i){var a=i("equalScalar",{"boolean, boolean":function(e,n){return e===n},"number, number":function(n,r){return n===r||e(n,r,u.epsilon)},"BigNumber, BigNumber":function(e,r){return e.eq(r)||n(e,r,u.epsilon)},"Fraction, Fraction":function(e,n){return e.equals(n)},"Complex, Complex":function(e,n){return e.equals(n)},"Unit, Unit":function(e,n){if(!e.equalBase(n))throw new Error("Cannot compare units with different base");return a(e.value,n.value)}});return a}exports.factory=r;
},{"../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K"}],"armw":[function(require,module,exports) {
"use strict";var e=require("../../utils/index"),t=require("../../error/DimensionError"),r=e.array,i=e.object,n=e.string,s=e.number,a=Array.isArray,o=s.isNumber,h=s.isInteger,p=n.isString,_=r.validateIndex;function u(u,l,f,v){var d=f(require("./Matrix")),c=f(require("../../function/relational/equalScalar")),y=f(require("./utils/getArrayDataType"));function w(t,r){if(!(this instanceof w))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!p(r))throw new Error("Invalid datatype: "+r);if(u.isMatrix(t))!function(e,t,r){"SparseMatrix"===t.type?(e._values=t._values?i.clone(t._values):void 0,e._index=i.clone(t._index),e._ptr=i.clone(t._ptr),e._size=i.clone(t._size),e._datatype=r||t._datatype):x(e,t.valueOf(),r||t._datatype)}(this,t,r);else if(t&&a(t.index)&&a(t.ptr)&&a(t.size))this._values=t.values,this._index=t.index,this._ptr=t.ptr,this._size=t.size,this._datatype=r||t.datatype;else if(a(t))x(this,t,r);else{if(t)throw new TypeError("Unsupported type of data ("+e.types.type(t)+")");this._values=[],this._index=[],this._ptr=[0],this._size=[0,0],this._datatype=r}}function x(e,t,r){e._values=[],e._index=[],e._ptr=[],e._datatype=r;var i=t.length,n=0,s=c,o=0;if(p(r)&&(s=v.find(c,[r,r])||c,o=v.convert(0,r)),i>0){var h=0;do{e._ptr.push(e._index.length);for(var _=0;_<i;_++){var u=t[_];if(a(u)){if(0===h&&n<u.length&&(n=u.length),h<u.length){var l=u[h];s(l,o)||(e._values.push(l),e._index.push(_))}}else 0===h&&n<1&&(n=1),s(u,o)||(e._values.push(u),e._index.push(_))}h++}while(h<n)}e._ptr.push(e._index.length),e._size=[i,n]}function g(e,t,r,i){if(r-t==0)return r;for(var n=t;n<r;n++)if(i[n]===e)return n;return t}function z(e,t,r,i,n,s,a){n.splice(e,0,i),s.splice(e,0,t);for(var o=r+1;o<a.length;o++)a[o]++}function m(e,t,r,i){var n=i||0,s=c,a=0;p(e._datatype)&&(s=v.find(c,[e._datatype,e._datatype])||c,a=v.convert(0,e._datatype),n=v.convert(n,e._datatype));var o,h,_,u=!s(n,a),l=e._size[0],f=e._size[1];if(r>f){for(h=f;h<r;h++)if(e._ptr[h]=e._values.length,u)for(o=0;o<l;o++)e._values.push(n),e._index.push(o);e._ptr[r]=e._values.length}else r<f&&(e._ptr.splice(r+1,f-r),e._values.splice(e._ptr[r],e._values.length),e._index.splice(e._ptr[r],e._index.length));if(f=r,t>l){if(u){var d=0;for(h=0;h<f;h++){e._ptr[h]=e._ptr[h]+d,_=e._ptr[h+1]+d;var y=0;for(o=l;o<t;o++,y++)e._values.splice(_+y,0,n),e._index.splice(_+y,0,o),d++}e._ptr[f]=e._values.length}}else if(t<l){var w=0;for(h=0;h<f;h++){e._ptr[h]=e._ptr[h]-w;var x=e._ptr[h],g=e._ptr[h+1]-w;for(_=x;_<g;_++)(o=e._index[_])>t-1&&(e._values.splice(_,1),e._index.splice(_,1),w++)}e._ptr[h]=e._values.length}return e._size[0]=t,e._size[1]=r,e}function E(e,t,r,n,s){var a,o,h=n[0],p=n[1],_=[];for(a=0;a<h;a++)for(_[a]=[],o=0;o<p;o++)_[a][o]=0;for(o=0;o<p;o++)for(var u=r[o],l=r[o+1],f=u;f<l;f++)_[a=t[f]][o]=e?s?i.clone(e[f]):e[f]:1;return _}return w.prototype=new d,w.prototype.type="SparseMatrix",w.prototype.isSparseMatrix=!0,w.prototype.getDataType=function(){return y(this._values)},w.prototype.storage=function(){return"sparse"},w.prototype.datatype=function(){return this._datatype},w.prototype.create=function(e,t){return new w(e,t)},w.prototype.density=function(){var e=this._size[0],t=this._size[1];return 0!==e&&0!==t?this._index.length/(e*t):0},w.prototype.subset=function(e,n,s){if(!this._values)throw new Error("Cannot invoke subset on a Pattern only matrix");switch(arguments.length){case 1:return function(e,r){if(!u.isIndex(r))throw new TypeError("Invalid index");if(r.isScalar())return e.get(r.min());var i,n,s,a,o=r.size();if(o.length!==e._size.length)throw new t(o.length,e._size.length);var h=r.min(),p=r.max();for(i=0,n=e._size.length;i<n;i++)_(h[i],e._size[i]),_(p[i],e._size[i]);var l=e._values,f=e._index,v=e._ptr,d=r.dimension(0),c=r.dimension(1),y=[],x=[];d.forEach(function(e,t){x[e]=t[0],y[e]=!0});var g=l?[]:void 0,z=[],m=[];return c.forEach(function(e){for(m.push(z.length),s=v[e],a=v[e+1];s<a;s++)i=f[s],!0===y[i]&&(z.push(x[i]),g&&g.push(l[s]))}),m.push(z.length),new w({values:g,index:z,ptr:m,size:o,datatype:e._datatype})}(this,e);case 2:case 3:return function(e,n,s,a){if(!n||!0!==n.isIndex)throw new TypeError("Invalid index");var o,h=n.size(),p=n.isScalar();u.isMatrix(s)?(o=s.size(),s=s.toArray()):o=r.size(s);if(p){if(0!==o.length)throw new TypeError("Scalar expected");e.set(n.min(),s,a)}else{if(1!==h.length&&2!==h.length)throw new t(h.length,e._size.length,"<");if(o.length<h.length){for(var _=0,l=0;1===h[_]&&1===o[_];)_++;for(;1===h[_];)l++,_++;s=r.unsqueeze(s,h.length,l,o)}if(!i.deepEqual(h,o))throw new t(h,o,">");for(var f=n.min()[0],v=n.min()[1],d=o[0],c=o[1],y=0;y<d;y++)for(var w=0;w<c;w++){var x=s[y][w];e.set([y+f,w+v],x,a)}}return e}(this,e,n,s);default:throw new SyntaxError("Wrong number of arguments")}},w.prototype.get=function(e){if(!a(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new t(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke get on a Pattern only matrix");var r=e[0],i=e[1];_(r,this._size[0]),_(i,this._size[1]);var n=g(r,this._ptr[i],this._ptr[i+1],this._index);return n<this._ptr[i+1]&&this._index[n]===r?this._values[n]:0},w.prototype.set=function(e,r,i){if(!a(e))throw new TypeError("Array expected");if(e.length!==this._size.length)throw new t(e.length,this._size.length);if(!this._values)throw new Error("Cannot invoke set on a Pattern only matrix");var n=e[0],s=e[1],o=this._size[0],h=this._size[1],u=c,l=0;p(this._datatype)&&(u=v.find(c,[this._datatype,this._datatype])||c,l=v.convert(0,this._datatype)),(n>o-1||s>h-1)&&(m(this,Math.max(n+1,o),Math.max(s+1,h),i),o=this._size[0],h=this._size[1]),_(n,o),_(s,h);var f=g(n,this._ptr[s],this._ptr[s+1],this._index);return f<this._ptr[s+1]&&this._index[f]===n?u(r,l)?function(e,t,r,i,n){r.splice(e,1),i.splice(e,1);for(var s=t+1;s<n.length;s++)n[s]--}(f,s,this._values,this._index,this._ptr):this._values[f]=r:z(f,n,s,r,this._values,this._index,this._ptr),this},w.prototype.resize=function(e,t,r){if(!a(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");return e.forEach(function(t){if(!s.isNumber(t)||!s.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+n.format(e)+")")}),m(r?this.clone():this,e[0],e[1],t)},w.prototype.reshape=function(e,t){if(!a(e))throw new TypeError("Array expected");if(2!==e.length)throw new Error("Sparse matrices can only be reshaped in two dimensions");if(e.forEach(function(t){if(!s.isNumber(t)||!s.isInteger(t)||t<0)throw new TypeError("Invalid size, must contain positive integers (size: "+n.format(e)+")")}),this._size[0]*this._size[1]!=e[0]*e[1])throw new Error("Reshaping sparse matrix will result in the wrong number of elements");var r=t?this.clone():this;if(this._size[0]===e[0]&&this._size[1]===e[1])return r;for(var i=[],o=0;o<r._ptr.length;o++)for(var h=0;h<r._ptr[o+1]-r._ptr[o];h++)i.push(o);for(var p=r._values.slice(),_=r._index.slice(),u=0;u<r._index.length;u++){var l=_[u],f=i[u],v=l*r._size[1]+f;i[u]=v%e[1],_[u]=Math.floor(v/e[1])}r._values.length=0,r._index.length=0,r._ptr.length=e[1]+1,r._size=e.slice();for(var d=0;d<r._ptr.length;d++)r._ptr[d]=0;for(var c=0;c<p.length;c++){var y=_[c],w=i[c],x=p[c];z(g(y,r._ptr[w],r._ptr[w+1],r._index),y,w,x,r._values,r._index,r._ptr)}return r},w.prototype.clone=function(){return new w({values:this._values?i.clone(this._values):void 0,index:i.clone(this._index),ptr:i.clone(this._ptr),size:i.clone(this._size),datatype:this._datatype})},w.prototype.size=function(){return this._size.slice(0)},w.prototype.map=function(e,t){if(!this._values)throw new Error("Cannot invoke map on a Pattern only matrix");var r=this;return function(e,t,r,i,n,s,a){var o=[],h=[],_=[],u=c,l=0;p(e._datatype)&&(u=v.find(c,[e._datatype,e._datatype])||c,l=v.convert(0,e._datatype));for(var f=function(e,t,r){e=s(e,t,r),u(e,l)||(o.push(e),h.push(t))},d=i;d<=n;d++){_.push(o.length);var y=e._ptr[d],x=e._ptr[d+1];if(a)for(var g=y;g<x;g++){var z=e._index[g];z>=t&&z<=r&&f(e._values[g],z-t,d-i)}else{for(var m={},E=y;E<x;E++){var b=e._index[E];m[b]=e._values[E]}for(var S=t;S<=r;S++){var T=S in m?m[S]:0;f(T,S-t,d-i)}}}return _.push(o.length),new w({values:o,index:h,ptr:_,size:[r-t+1,n-i+1]})}(this,0,this._size[0]-1,0,this._size[1]-1,function(t,i,n){return e(t,[i,n],r)},t)},w.prototype.forEach=function(e,t){if(!this._values)throw new Error("Cannot invoke forEach on a Pattern only matrix");for(var r=this._size[0],i=this._size[1],n=0;n<i;n++){var s=this._ptr[n],a=this._ptr[n+1];if(t)for(var o=s;o<a;o++){var h=this._index[o];e(this._values[o],[h,n],this)}else{for(var p={},_=s;_<a;_++){p[this._index[_]]=this._values[_]}for(var u=0;u<r;u++){e(u in p?p[u]:0,[u,n],this)}}}},w.prototype.toArray=function(){return E(this._values,this._index,this._ptr,this._size,!0)},w.prototype.valueOf=function(){return E(this._values,this._index,this._ptr,this._size,!1)},w.prototype.format=function(e){for(var t=this._size[0],r=this._size[1],i=this.density(),s="Sparse Matrix ["+n.format(t,e)+" x "+n.format(r,e)+"] density: "+n.format(i,e)+"\n",a=0;a<r;a++)for(var o=this._ptr[a],h=this._ptr[a+1],p=o;p<h;p++){var _=this._index[p];s+="\n ("+n.format(_,e)+", "+n.format(a,e)+") ==> "+(this._values?n.format(this._values[p],e):"X")}return s},w.prototype.toString=function(){return n.format(this.toArray())},w.prototype.toJSON=function(){return{mathjs:"SparseMatrix",values:this._values,index:this._index,ptr:this._ptr,size:this._size,datatype:this._datatype}},w.prototype.diagonal=function(e){if(e){if(u.isBigNumber(e)&&(e=e.toNumber()),!o(e)||!h(e))throw new TypeError("The parameter k must be an integer number")}else e=0;var t=e>0?e:0,r=e<0?-e:0,i=this._size[0],n=this._size[1],s=Math.min(i-r,n-t),a=[],p=[],_=[];_[0]=0;for(var l=t;l<n&&a.length<s;l++)for(var f=this._ptr[l],v=this._ptr[l+1],d=f;d<v;d++){var c=this._index[d];if(c===l-t+r){a.push(this._values[d]),p[a.length-1]=c-r;break}}return _.push(a.length),new w({values:a,index:p,ptr:_,size:[s,1]})},w.fromJSON=function(e){return new w(e)},w.diagonal=function(e,t,r,i,n){if(!a(e))throw new TypeError("Array expected, size parameter");if(2!==e.length)throw new Error("Only two dimensions matrix are supported");if(e=e.map(function(e){if(u.isBigNumber(e)&&(e=e.toNumber()),!o(e)||!h(e)||e<1)throw new Error("Size values must be positive integers");return e}),r){if(u.isBigNumber(r)&&(r=r.toNumber()),!o(r)||!h(r))throw new TypeError("The parameter k must be an integer number")}else r=0;var s=c,_=0;p(n)&&(s=v.find(c,[n,n])||c,_=v.convert(0,n));var l,f=r>0?r:0,d=r<0?-r:0,y=e[0],x=e[1],g=Math.min(y-d,x-f);if(a(t)){if(t.length!==g)throw new Error("Invalid value array length");l=function(e){return t[e]}}else if(u.isMatrix(t)){var z=t.size();if(1!==z.length||z[0]!==g)throw new Error("Invalid matrix length");l=function(e){return t.get([e])}}else l=function(){return t};for(var m=[],E=[],b=[],S=0;S<x;S++){b.push(m.length);var T=S-f;if(T>=0&&T<g){var M=l(T);s(M,_)||(E.push(T+d),m.push(M))}}return b.push(m.length),new w({values:m,index:E,ptr:b,size:[y,x]})},w.prototype.swapRows=function(e,t){if(!(o(e)&&h(e)&&o(t)&&h(t)))throw new Error("Row index must be positive integers");if(2!==this._size.length)throw new Error("Only two dimensional matrix is supported");return _(e,this._size[0]),_(t,this._size[0]),w._swapRows(e,t,this._size[1],this._values,this._index,this._ptr),this},w._forEachRow=function(e,t,r,i,n){for(var s=i[e],a=i[e+1],o=s;o<a;o++)n(r[o],t[o])},w._swapRows=function(e,t,r,i,n,s){for(var a=0;a<r;a++){var o=s[a],h=s[a+1],p=g(e,o,h,n),_=g(t,o,h,n);if(p<h&&_<h&&n[p]===e&&n[_]===t){if(i){var u=i[p];i[p]=i[_],i[_]=u}}else if(p<h&&n[p]===e&&(_>=h||n[_]!==t)){var l=i?i[p]:void 0;n.splice(_,0,t),i&&i.splice(_,0,l),n.splice(_<=p?p+1:p,1),i&&i.splice(_<=p?p+1:p,1)}else if(_<h&&n[_]===t&&(p>=h||n[p]!==e)){var f=i?i[_]:void 0;n.splice(p,0,e),i&&i.splice(p,0,f),n.splice(p<=_?_+1:_,1),i&&i.splice(p<=_?_+1:_,1)}}},u.Matrix._storage.sparse=w,w}exports.name="SparseMatrix",exports.path="type",exports.factory=u,exports.lazy=!1;
},{"../../utils/index":"fsXI","../../error/DimensionError":"YiAw","./Matrix":"w7z6","../../function/relational/equalScalar":"QvIw","./utils/getArrayDataType":"XmtI"}],"vzj5":[function(require,module,exports) {
"use strict";function r(r,t,n,i){var e=i("matrix",{"":function(){return a([])},string:function(r){return a([],r)},"string, string":function(r,t){return a([],r,t)},Array:function(r){return a(r)},Matrix:function(r){return a(r,r.storage())},"Array | Matrix, string":a,"Array | Matrix, string, string":a});return e.toTex={0:"\\begin{bmatrix}\\end{bmatrix}",1:"\\left(${args[0]}\\right)",2:"\\left(${args[0]}\\right)"},e;function a(t,n,i){return new(r.Matrix.storage(n||"default"))(t,i)}}exports.name="matrix",exports.factory=r;
},{}],"ZM3O":[function(require,module,exports) {
"use strict";function n(n,r,e,t){var u=t("add",{"number, number":function(n,r){return n+r},"Complex, Complex":function(n,r){return n.add(r)},"BigNumber, BigNumber":function(n,r){return n.plus(r)},"Fraction, Fraction":function(n,r){return n.add(r)},"Unit, Unit":function(n,r){if(null===n.value||void 0===n.value)throw new Error("Parameter x contains a unit with undefined value");if(null===r.value||void 0===r.value)throw new Error("Parameter y contains a unit with undefined value");if(!n.equalBase(r))throw new Error("Units do not match");var e=n.clone();return e.value=u(e.value,r.value),e.fixPrefix=!1,e}});return u}exports.factory=n;
},{}],"q1c8":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function t(t,e,a,n){var i=t.DenseMatrix;return function(t,e,a,o){var s=t._data,f=t._size,h=t._datatype,p=e._values,d=e._index,m=e._ptr,u=e._size,v=e._datatype;if(f.length!==u.length)throw new r(f.length,u.length);if(f[0]!==u[0]||f[1]!==u[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+u+")");if(!p)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var x,_,g=f[0],w=f[1],c="string"==typeof h&&h===v?h:void 0,l=c?n.find(a,[c,c]):a,y=[];for(x=0;x<g;x++)y[x]=[];var M=[],D=[];for(_=0;_<w;_++){for(var z=_+1,E=m[_],q=m[_+1],A=E;A<q;A++)M[x=d[A]]=o?l(p[A],s[x][_]):l(s[x][_],p[A]),D[x]=z;for(x=0;x<g;x++)D[x]===z?y[x][_]=M[x]:y[x][_]=s[x][_]}return new i({data:y,size:[g,w],datatype:c})}}exports.name="algorithm01",exports.factory=t;
},{"../../../error/DimensionError":"YiAw"}],"m7Qa":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function e(e,t,i,n){var a=i(require("../../../function/relational/equalScalar")),o=e.SparseMatrix;return function(e,t,i){var s=e._values,l=e._index,f=e._ptr,u=e._size,h=e._datatype,v=t._values,p=t._index,d=t._ptr,c=t._size,g=t._datatype;if(u.length!==c.length)throw new r(u.length,c.length);if(u[0]!==c[0]||u[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+c+")");var _,m=u[0],x=u[1],w=a,y=0,q=i;"string"==typeof h&&h===g&&(_=h,w=n.find(a,[_,_]),y=n.convert(0,_),q=n.find(i,[_,_]));var z,M,D,E,S,A=s&&v?[]:void 0,B=[],R=[],b=new o({values:A,index:B,ptr:R,size:[m,x],datatype:_}),j=s&&v?[]:void 0,k=s&&v?[]:void 0,C=[],F=[];for(M=0;M<x;M++){R[M]=B.length;var G=M+1;for(E=f[M],S=f[M+1],D=E;D<S;D++)z=l[D],B.push(z),C[z]=G,j&&(j[z]=s[D]);for(E=d[M],S=d[M+1],D=E;D<S;D++)if(C[z=p[D]]===G){if(j){var H=q(j[z],v[D]);w(H,y)?C[z]=null:j[z]=H}}else B.push(z),F[z]=G,k&&(k[z]=v[D]);if(j&&k)for(D=R[M];D<B.length;)C[z=B[D]]===G?(A[D]=j[z],D++):F[z]===G?(A[D]=k[z],D++):B.splice(D,1)}return R[x]=B.length,b}}exports.name="algorithm04",exports.factory=e;
},{"../../../error/DimensionError":"YiAw","../../../function/relational/equalScalar":"QvIw"}],"H0xb":[function(require,module,exports) {
"use strict";function r(r,a,t,e){var n=r.DenseMatrix;return function(r,a,t,o){var i=r._values,f=r._index,s=r._ptr,v=r._size,p=r._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var u,c=v[0],d=v[1],x=t;"string"==typeof p&&(u=p,a=e.convert(a,u),x=e.find(t,[u,u]));for(var _=[],l=new n({data:_,size:[c,d],datatype:u}),y=[],m=[],w=0;w<d;w++){for(var g=w+1,h=s[w],z=s[w+1],M=h;M<z;M++){var S=f[M];y[S]=i[M],m[S]=g}for(var C=0;C<c;C++)0===w&&(_[C]=[]),m[C]===g?_[C][w]=o?x(a,y[C]):x(y[C],a):_[C][w]=a}return l}}exports.name="algorithm10",exports.factory=r;
},{}],"NS7U":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function t(t,e,a,n){var i=t.DenseMatrix;return function(t,e,a){var o,s=t._data,f=t._size,h=t._datatype,g=e._data,l=e._size,u=e._datatype,v=[];if(f.length!==l.length)throw new r(f.length,l.length);for(var m=0;m<f.length;m++){if(f[m]!==l[m])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+l+")");v[m]=f[m]}var c=a;"string"==typeof h&&h===u&&(o=h,c=n.find(a,[o,o]));var d=v.length>0?function r(t,e,a,n,i,o){var s=[];if(e===a.length-1)for(var f=0;f<n;f++)s[f]=t(i[f],o[f]);else for(var h=0;h<n;h++)s[h]=r(t,e+1,a,a[e+1],i[h],o[h]);return s}(c,0,v,v[0],s,g):[];return new i({data:d,size:v,datatype:o})}}exports.name="algorithm13",exports.factory=t;
},{"../../../error/DimensionError":"YiAw"}],"S2eB":[function(require,module,exports) {
"use strict";var t=require("../../../utils/object").clone;function r(r,e,a,n){var i=r.DenseMatrix;return function(r,e,a,o){var s,f=r._data,u=r._size,c=r._datatype,v=a;"string"==typeof c&&(s=c,e=n.convert(e,s),v=n.find(a,[s,s]));var l=u.length>0?function t(r,e,a,n,i,o,s){var f=[];if(e===a.length-1)for(var u=0;u<n;u++)f[u]=s?r(o,i[u]):r(i[u],o);else for(var c=0;c<n;c++)f[c]=t(r,e+1,a,a[e+1],i[c],o,s);return f}(v,0,u,u[0],f,e,o):[];return new i({data:l,size:t(u),datatype:s})}}exports.name="algorithm14",exports.factory=r;
},{"../../../utils/object":"FcSp"}],"zf2Z":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").extend;function t(t,e,a,n){var i=a(require("../../type/matrix/function/matrix")),u=a(require("./addScalar")),o=require("../../utils/latex.js"),s=a(require("../../type/matrix/utils/algorithm01")),x=a(require("../../type/matrix/utils/algorithm04")),y=a(require("../../type/matrix/utils/algorithm10")),c=a(require("../../type/matrix/utils/algorithm13")),f=a(require("../../type/matrix/utils/algorithm14")),l=n("add",r({"DenseMatrix, DenseMatrix":function(r,t){return c(r,t,u)},"DenseMatrix, SparseMatrix":function(r,t){return s(r,t,u,!1)},"SparseMatrix, DenseMatrix":function(r,t){return s(t,r,u,!0)},"SparseMatrix, SparseMatrix":function(r,t){return x(r,t,u)},"Array, Array":function(r,t){return l(i(r),i(t)).valueOf()},"Array, Matrix":function(r,t){return l(i(r),t)},"Matrix, Array":function(r,t){return l(r,i(t))},"DenseMatrix, any":function(r,t){return f(r,t,u,!1)},"SparseMatrix, any":function(r,t){return y(r,t,u,!1)},"any, DenseMatrix":function(r,t){return f(t,r,u,!0)},"any, SparseMatrix":function(r,t){return y(t,r,u,!0)},"Array, any":function(r,t){return f(i(r),t,u,!1).valueOf()},"any, Array":function(r,t){return f(i(t),r,u,!0).valueOf()},"any, any":u,"any, any, ...any":function(r,t,e){for(var a=l(r,t),n=0;n<e.length;n++)a=l(a,e[n]);return a}},u.signatures));return l.toTex={2:"\\left(${args[0]}".concat(o.operators.add,"${args[1]}\\right)")},l}exports.name="add",exports.factory=t;
},{"../../utils/object":"FcSp","../../type/matrix/function/matrix":"vzj5","./addScalar":"ZM3O","../../utils/latex.js":"H1Mr","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm04":"m7Qa","../../type/matrix/utils/algorithm10":"H0xb","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"e3fS":[function(require,module,exports) {
"use strict";function e(e,t,a){var i=a(require("../../function/arithmetic/add")),s=a(require("../../function/relational/equalScalar"));function r(){if(!(this instanceof r))throw new SyntaxError("Constructor must be called with the new operator");this._values=[],this._heap=new e.FibonacciHeap}return r.prototype.type="Spa",r.prototype.isSpa=!0,r.prototype.set=function(e,t){if(this._values[e])this._values[e].value=t;else{var a=this._heap.insert(e,t);this._values[e]=a}},r.prototype.get=function(e){var t=this._values[e];return t?t.value:0},r.prototype.accumulate=function(e,t){var a=this._values[e];a?a.value=i(a.value,t):(a=this._heap.insert(e,t),this._values[e]=a)},r.prototype.forEach=function(e,t,a){var i=this._heap,r=this._values,u=[],o=i.extractMinimum();for(o&&u.push(o);o&&o.key<=t;)o.key>=e&&(s(o.value,0)||a(o.key,o.value,this)),(o=i.extractMinimum())&&u.push(o);for(var h=0;h<u.length;h++){var v=u[h];r[(o=i.insert(v.key,v.value)).key]=o}},r.prototype.swap=function(e,t){var a=this._values[e],i=this._values[t];if(!a&&i)a=this._heap.insert(e,i.value),this._heap.remove(i),this._values[e]=a,this._values[t]=void 0;else if(a&&!i)i=this._heap.insert(t,a.value),this._heap.remove(a),this._values[t]=i,this._values[e]=void 0;else if(a&&i){var s=a.value;a.value=i.value,i.value=s}},r}exports.name="Spa",exports.path="type",exports.factory=e;
},{"../../function/arithmetic/add":"zf2Z","../../function/relational/equalScalar":"QvIw"}],"oR02":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function t(t,e,a,n){var o=t.DenseMatrix;return function(t,e,a,i){var s=t._data,f=t._size,v=t._datatype,h=e._values,p=e._index,m=e._ptr,d=e._size,u=e._datatype;if(f.length!==d.length)throw new r(f.length,d.length);if(f[0]!==d[0]||f[1]!==d[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+d+")");if(!h)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var x,_=f[0],c=f[1],g=0,w=a;"string"==typeof v&&v===u&&(x=v,g=n.convert(0,x),w=n.find(a,[x,x]));for(var l=[],y=0;y<_;y++)l[y]=[];for(var M=[],D=[],z=0;z<c;z++){for(var E=z+1,q=m[z],A=m[z+1],B=q;B<A;B++){var C=p[B];M[C]=i?w(h[B],s[C][z]):w(s[C][z],h[B]),D[C]=E}for(var P=0;P<_;P++)D[P]===E?l[P][z]=M[P]:l[P][z]=i?w(g,s[P][z]):w(s[P][z],g)}return new o({data:l,size:[_,c],datatype:x})}}exports.name="algorithm03",exports.factory=t;
},{"../../../error/DimensionError":"YiAw"}],"u44a":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function t(t,e,a,n){var i=t.DenseMatrix;function o(r,t,e,a,n){for(var i=r._values,o=r._index,s=r._ptr,f=s[t],v=s[t+1];f<v;f++){var h=o[f];e[h]=n,a[h]=i[f]}}return function(t,e,a){var s=t._size,f=t._datatype,v=e._size,h=e._datatype;if(s.length!==v.length)throw new r(s.length,v.length);if(s[0]!==v[0]||s[1]!==v[1])throw new RangeError("Dimension mismatch. Matrix A ("+s+") must match Matrix B ("+v+")");var u,c,m,g=s[0],p=s[1],_=0,d=a;"string"==typeof f&&f===h&&(u=f,_=n.convert(0,u),d=n.find(a,[u,u]));var l=[];for(c=0;c<g;c++)l[c]=[];var x=new i({data:l,size:[g,p],datatype:u}),w=[],y=[],z=[],D=[];for(m=0;m<p;m++){var M=m+1;for(o(t,m,z,w,M),o(e,m,D,y,M),c=0;c<g;c++){var E=z[c]===M?w[c]:_,q=D[c]===M?y[c]:_;l[c][m]=d(E,q)}}return x}}exports.name="algorithm07",exports.factory=t;
},{"../../../error/DimensionError":"YiAw"}],"Pn2O":[function(require,module,exports) {
"use strict";function r(r,a,t,e){var n=r.DenseMatrix;return function(r,a,t,o){var i=r._values,f=r._index,s=r._ptr,v=r._size,p=r._datatype;if(!i)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var u,c=v[0],d=v[1],x=t;"string"==typeof p&&(u=p,a=e.convert(a,u),x=e.find(t,[u,u]));for(var _=[],l=new n({data:_,size:[c,d],datatype:u}),y=[],m=[],w=0;w<d;w++){for(var g=w+1,h=s[w],z=s[w+1],M=h;M<z;M++){var S=f[M];y[S]=i[M],m[S]=g}for(var C=0;C<c;C++)0===w&&(_[C]=[]),m[C]===g?_[C][w]=o?x(a,y[C]):x(y[C],a):_[C][w]=o?x(a,0):x(0,a)}return l}}exports.name="algorithm12",exports.factory=r;
},{}],"Q7ag":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").nearlyEqual,e=require("../../utils/bignumber/nearlyEqual");function t(t,n,i,a){var u=i(require("../../type/matrix/function/matrix")),o=i(require("../../type/matrix/utils/algorithm03")),l=i(require("../../type/matrix/utils/algorithm07")),s=i(require("../../type/matrix/utils/algorithm12")),f=i(require("../../type/matrix/utils/algorithm13")),c=i(require("../../type/matrix/utils/algorithm14")),m=require("../../utils/latex"),x=a("smaller",{"boolean, boolean":function(r,e){return r<e},"number, number":function(e,t){return e<t&&!r(e,t,n.epsilon)},"BigNumber, BigNumber":function(r,t){return r.lt(t)&&!e(r,t,n.epsilon)},"Fraction, Fraction":function(r,e){return-1===r.compare(e)},"Complex, Complex":function(r,e){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(r,e){if(!r.equalBase(e))throw new Error("Cannot compare units with different base");return x(r.value,e.value)},"SparseMatrix, SparseMatrix":function(r,e){return l(r,e,x)},"SparseMatrix, DenseMatrix":function(r,e){return o(e,r,x,!0)},"DenseMatrix, SparseMatrix":function(r,e){return o(r,e,x,!1)},"DenseMatrix, DenseMatrix":function(r,e){return f(r,e,x)},"Array, Array":function(r,e){return x(u(r),u(e)).valueOf()},"Array, Matrix":function(r,e){return x(u(r),e)},"Matrix, Array":function(r,e){return x(r,u(e))},"SparseMatrix, any":function(r,e){return s(r,e,x,!1)},"DenseMatrix, any":function(r,e){return c(r,e,x,!1)},"any, SparseMatrix":function(r,e){return s(e,r,x,!0)},"any, DenseMatrix":function(r,e){return c(e,r,x,!0)},"Array, any":function(r,e){return c(u(r),e,x,!1).valueOf()},"any, Array":function(r,e){return c(u(e),r,x,!0).valueOf()}});return x.toTex={2:"\\left(${args[0]}".concat(m.operators.smaller,"${args[1]}\\right)")},x}exports.name="smaller",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB","../../utils/latex":"H1Mr"}],"SrDl":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").nearlyEqual,e=require("../../utils/bignumber/nearlyEqual");function t(t,n,i,a){var u=i(require("../../type/matrix/function/matrix")),o=i(require("../../type/matrix/utils/algorithm03")),l=i(require("../../type/matrix/utils/algorithm07")),s=i(require("../../type/matrix/utils/algorithm12")),f=i(require("../../type/matrix/utils/algorithm13")),c=i(require("../../type/matrix/utils/algorithm14")),x=require("../../utils/latex"),m=a("larger",{"boolean, boolean":function(r,e){return r>e},"number, number":function(e,t){return e>t&&!r(e,t,n.epsilon)},"BigNumber, BigNumber":function(r,t){return r.gt(t)&&!e(r,t,n.epsilon)},"Fraction, Fraction":function(r,e){return 1===r.compare(e)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(r,e){if(!r.equalBase(e))throw new Error("Cannot compare units with different base");return m(r.value,e.value)},"SparseMatrix, SparseMatrix":function(r,e){return l(r,e,m)},"SparseMatrix, DenseMatrix":function(r,e){return o(e,r,m,!0)},"DenseMatrix, SparseMatrix":function(r,e){return o(r,e,m,!1)},"DenseMatrix, DenseMatrix":function(r,e){return f(r,e,m)},"Array, Array":function(r,e){return m(u(r),u(e)).valueOf()},"Array, Matrix":function(r,e){return m(u(r),e)},"Matrix, Array":function(r,e){return m(r,u(e))},"SparseMatrix, any":function(r,e){return s(r,e,m,!1)},"DenseMatrix, any":function(r,e){return c(r,e,m,!1)},"any, SparseMatrix":function(r,e){return s(e,r,m,!0)},"any, DenseMatrix":function(r,e){return c(e,r,m,!0)},"Array, any":function(r,e){return c(u(r),e,m,!1).valueOf()},"any, Array":function(r,e){return c(u(e),r,m,!0).valueOf()}});return m.toTex={2:"\\left(${args[0]}".concat(x.operators.larger,"${args[1]}\\right)")},m}exports.name="larger",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB","../../utils/latex":"H1Mr"}],"ifbV":[function(require,module,exports) {
"use strict";function t(t,i,r,e){var h=r(require("../../function/relational/smaller")),n=r(require("../../function/relational/larger")),l=1/Math.log((1+Math.sqrt(5))/2);function o(){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this._minimum=null,this._size=0}function f(t,i,r){i.left.right=i.right,i.right.left=i.left,r.degree--,r.child===i&&(r.child=i.right),0===r.degree&&(r.child=null),i.left=t,i.right=t.right,t.right=i,i.right.left=i,i.parent=null,i.mark=!1}o.prototype.type="FibonacciHeap",o.prototype.isFibonacciHeap=!0,o.prototype.insert=function(t,i){var r={key:t,value:i,degree:0};if(this._minimum){var e=this._minimum;r.left=e,r.right=e.right,e.right=r,r.right.left=r,h(t,e.key)&&(this._minimum=r)}else r.left=r,r.right=r,this._minimum=r;return this._size++,r},o.prototype.size=function(){return this._size},o.prototype.clear=function(){this._minimum=null,this._size=0},o.prototype.isEmpty=function(){return 0===this._size},o.prototype.extractMinimum=function(){var t=this._minimum;if(null===t)return t;for(var i=this._minimum,r=t.degree,e=t.child;r>0;){var o=e.right;e.left.right=e.right,e.right.left=e.left,e.left=i,e.right=i.right,i.right=e,e.right.left=e,e.parent=null,e=o,r--}return t.left.right=t.right,t.right.left=t.left,i=t===t.right?null:function(t,i){var r,e=Math.floor(Math.log(i)*l)+1,o=new Array(e),f=0,u=t;if(u)for(f++,u=u.right;u!==t;)f++,u=u.right;for(;f>0;){for(var a=u.degree,m=u.right;r=o[a];){if(n(u.key,r.key)){var s=r;r=u,u=s}g(r,u),o[a]=null,a++}o[a]=u,u=m,f--}t=null;for(var c=0;c<e;c++)(r=o[c])&&(t?(r.left.right=r.right,r.right.left=r.left,r.left=t,r.right=t.right,t.right=r,r.right.left=r,h(r.key,t.key)&&(t=r)):t=r);return t}(i=t.right,this._size),this._size--,this._minimum=i,t},o.prototype.remove=function(t){this._minimum=function(t,i,r){i.key=r;var e=i.parent;e&&h(i.key,e.key)&&(f(t,i,e),function t(i,r){var e=r.parent;if(!e)return;r.mark?(f(i,r,e),t(e)):r.mark=!0}(t,e));h(i.key,t.key)&&(t=i);return t}(this._minimum,t,-1),this.extractMinimum()};var g=function(t,i){t.left.right=t.right,t.right.left=t.left,t.parent=i,i.child?(t.left=i.child,t.right=i.child.right,i.child.right=t,t.right.left=t):(i.child=t,t.right=t,t.left=t),i.degree++,t.mark=!1};return o}exports.name="FibonacciHeap",exports.path="type",exports.factory=t;
},{"../../function/relational/smaller":"Q7ag","../../function/relational/larger":"SrDl"}],"B6L6":[function(require,module,exports) {
"use strict";var t=require("../../utils/index"),e=t.string,n=t.object,a=Array.isArray,i=e.isString;function r(e,r,o){var s=o(require("./DenseMatrix")),u=o(require("../../function/relational/smaller"));function p(n,r){if(!(this instanceof p))throw new SyntaxError("Constructor must be called with the new operator");if(r&&!i(r))throw new Error("Invalid datatype: "+r);if(e.isMatrix(n)||a(n)){var o=new s(n,r);this._data=o._data,this._size=o._size,this._datatype=o._datatype,this._min=null,this._max=null}else if(n&&a(n.data)&&a(n.size))this._data=n.data,this._size=n.size,this._datatype=n.datatype,this._min=void 0!==n.min?n.min:null,this._max=void 0!==n.max?n.max:null;else{if(n)throw new TypeError("Unsupported type of data ("+t.types.type(n)+")");this._data=[],this._size=[0],this._datatype=r,this._min=null,this._max=null}}return p.prototype=new s,p.prototype.type="ImmutableDenseMatrix",p.prototype.isImmutableDenseMatrix=!0,p.prototype.subset=function(t){switch(arguments.length){case 1:var n=s.prototype.subset.call(this,t);return e.isMatrix(n)?new p({data:n._data,size:n._size,datatype:n._datatype}):n;case 2:case 3:throw new Error("Cannot invoke set subset on an Immutable Matrix instance");default:throw new SyntaxError("Wrong number of arguments")}},p.prototype.set=function(){throw new Error("Cannot invoke set on an Immutable Matrix instance")},p.prototype.resize=function(){throw new Error("Cannot invoke resize on an Immutable Matrix instance")},p.prototype.reshape=function(){throw new Error("Cannot invoke reshape on an Immutable Matrix instance")},p.prototype.clone=function(){return new p({data:n.clone(this._data),size:n.clone(this._size),datatype:this._datatype})},p.prototype.toJSON=function(){return{mathjs:"ImmutableDenseMatrix",data:this._data,size:this._size,datatype:this._datatype}},p.fromJSON=function(t){return new p(t)},p.prototype.swapRows=function(){throw new Error("Cannot invoke swapRows on an Immutable Matrix instance")},p.prototype.min=function(){if(null===this._min){var t=null;this.forEach(function(e){(null===t||u(e,t))&&(t=e)}),this._min=null!==t?t:void 0}return this._min},p.prototype.max=function(){if(null===this._max){var t=null;this.forEach(function(e){(null===t||u(t,e))&&(t=e)}),this._max=null!==t?t:void 0}return this._max},p}exports.name="ImmutableDenseMatrix",exports.path="type",exports.factory=r;
},{"../../utils/index":"fsXI","./DenseMatrix":"bZ8L","../../function/relational/smaller":"Q7ag"}],"SL3U":[function(require,module,exports) {
"use strict";var t=require("../../utils/object").clone,n=require("../../utils/number").isInteger;function i(i){function e(t){if(!(this instanceof e))throw new SyntaxError("Constructor must be called with the new operator");this._dimensions=[],this._isScalar=!0;for(var n=0,s=arguments.length;n<s;n++){var o=arguments[n];if(i.isRange(o))this._dimensions.push(o),this._isScalar=!1;else if(Array.isArray(o)||i.isMatrix(o)){var a=r(o.valueOf());this._dimensions.push(a);var p=a.size();1===p.length&&1===p[0]||(this._isScalar=!1)}else if("number"==typeof o)this._dimensions.push(r([o]));else{if("string"!=typeof o)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");this._dimensions.push(o)}}}function r(t){for(var e=0,r=t.length;e<r;e++)if("number"!=typeof t[e]||!n(t[e]))throw new TypeError("Index parameters must be positive integer numbers");return new i.ImmutableDenseMatrix(t)}return e.prototype.type="Index",e.prototype.isIndex=!0,e.prototype.clone=function(){var n=new e;return n._dimensions=t(this._dimensions),n._isScalar=this._isScalar,n},e.create=function(t){var n=new e;return e.apply(n,t),n},e.prototype.size=function(){for(var t=[],n=0,i=this._dimensions.length;n<i;n++){var e=this._dimensions[n];t[n]="string"==typeof e?1:e.size()[0]}return t},e.prototype.max=function(){for(var t=[],n=0,i=this._dimensions.length;n<i;n++){var e=this._dimensions[n];t[n]="string"==typeof e?e:e.max()}return t},e.prototype.min=function(){for(var t=[],n=0,i=this._dimensions.length;n<i;n++){var e=this._dimensions[n];t[n]="string"==typeof e?e:e.min()}return t},e.prototype.forEach=function(t){for(var n=0,i=this._dimensions.length;n<i;n++)t(this._dimensions[n],n,this)},e.prototype.dimension=function(t){return this._dimensions[t]||null},e.prototype.isObjectProperty=function(){return 1===this._dimensions.length&&"string"==typeof this._dimensions[0]},e.prototype.getObjectProperty=function(){return this.isObjectProperty()?this._dimensions[0]:null},e.prototype.isScalar=function(){return this._isScalar},e.prototype.toArray=function(){for(var t=[],n=0,i=this._dimensions.length;n<i;n++){var e=this._dimensions[n];t.push("string"==typeof e?e:e.toArray())}return t},e.prototype.valueOf=e.prototype.toArray,e.prototype.toString=function(){for(var t=[],n=0,i=this._dimensions.length;n<i;n++){var e=this._dimensions[n];"string"==typeof e?t.push(JSON.stringify(e)):t.push(e.toString())}return"["+t.join(", ")+"]"},e.prototype.toJSON=function(){return{mathjs:"Index",dimensions:this._dimensions}},e.fromJSON=function(t){return e.create(t.dimensions)},e}exports.name="Index",exports.path="type",exports.factory=i;
},{"../../utils/object":"FcSp","../../utils/number":"uqMu"}],"rRNx":[function(require,module,exports) {
"use strict";var t=require("../../utils/number");function r(r,e,n,s){function i(t,e,n){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");var s=null!=t,o=null!=e,a=null!=n;if(s)if(r.isBigNumber(t))t=t.toNumber();else if("number"!=typeof t)throw new TypeError("Parameter start must be a number");if(o)if(r.isBigNumber(e))e=e.toNumber();else if("number"!=typeof e)throw new TypeError("Parameter end must be a number");if(a)if(r.isBigNumber(n))n=n.toNumber();else if("number"!=typeof n)throw new TypeError("Parameter step must be a number");this.start=s?parseFloat(t):0,this.end=o?parseFloat(e):0,this.step=a?parseFloat(n):1}return i.prototype.type="Range",i.prototype.isRange=!0,i.parse=function(t){if("string"!=typeof t)return null;var r=t.split(":").map(function(t){return parseFloat(t)});if(r.some(function(t){return isNaN(t)}))return null;switch(r.length){case 2:return new i(r[0],r[1]);case 3:return new i(r[0],r[2],r[1]);default:return null}},i.prototype.clone=function(){return new i(this.start,this.end,this.step)},i.prototype.size=function(){var r=0,e=this.start,n=this.step,s=this.end-e;return t.sign(n)===t.sign(s)?r=Math.ceil(s/n):0===s&&(r=0),isNaN(r)&&(r=0),[r]},i.prototype.min=function(){var t=this.size()[0];return t>0?this.step>0?this.start:this.start+(t-1)*this.step:void 0},i.prototype.max=function(){var t=this.size()[0];return t>0?this.step>0?this.start+(t-1)*this.step:this.start:void 0},i.prototype.forEach=function(t){var r=this.start,e=this.step,n=this.end,s=0;if(e>0)for(;r<n;)t(r,[s],this),r+=e,s++;else if(e<0)for(;r>n;)t(r,[s],this),r+=e,s++},i.prototype.map=function(t){var r=[];return this.forEach(function(e,n,s){r[n[0]]=t(e,n,s)}),r},i.prototype.toArray=function(){var t=[];return this.forEach(function(r,e){t[e[0]]=r}),t},i.prototype.valueOf=function(){return this.toArray()},i.prototype.format=function(r){var e=t.format(this.start,r);return 1!==this.step&&(e+=":"+t.format(this.step,r)),e+=":"+t.format(this.end,r)},i.prototype.toString=function(){return this.format()},i.prototype.toJSON=function(){return{mathjs:"Range",start:this.start,end:this.end,step:this.step}},i.fromJSON=function(t){return new i(t.start,t.end,t.step)},i}exports.name="Range",exports.path="type",exports.factory=r;
},{"../../utils/number":"uqMu"}],"ChhM":[function(require,module,exports) {
"use strict";function r(r,n,e,t){return t("index",{"...number | string | BigNumber | Range | Array | Matrix":function(n){var e=n.map(function(n){return r.isBigNumber(n)?n.toNumber():Array.isArray(n)||r.isMatrix(n)?n.map(function(n){return r.isBigNumber(n)?n.toNumber():n}):n}),t=new r.Index;return r.Index.apply(t,e),t}})}exports.name="index",exports.factory=r;
},{}],"GmPR":[function(require,module,exports) {
"use strict";function r(r,n,t,e){var s=r.SparseMatrix,a=e("sparse",{"":function(){return new s([])},string:function(r){return new s([],r)},"Array | Matrix":function(r){return new s(r)},"Array | Matrix, string":function(r,n){return new s(r,n)}});return a.toTex={0:"\\begin{bsparse}\\end{bsparse}",1:"\\left(${args[0]}\\right)"},a}exports.name="sparse",exports.factory=r;
},{}],"Xhzw":[function(require,module,exports) {
"use strict";module.exports=[require("./Matrix"),require("./DenseMatrix"),require("./SparseMatrix"),require("./Spa"),require("./FibonacciHeap"),require("./ImmutableDenseMatrix"),require("./MatrixIndex"),require("./Range"),require("./function/index"),require("./function/matrix"),require("./function/sparse"),require("./utils/getArrayDataType")];
},{"./Matrix":"w7z6","./DenseMatrix":"bZ8L","./SparseMatrix":"armw","./Spa":"e3fS","./FibonacciHeap":"ifbV","./ImmutableDenseMatrix":"B6L6","./MatrixIndex":"SL3U","./Range":"rRNx","./function/index":"ChhM","./function/matrix":"vzj5","./function/sparse":"GmPR","./utils/getArrayDataType":"XmtI"}],"lESm":[function(require,module,exports) {
"use strict";var r=require("./../utils/collection/deepMap");function n(n,t,e,u){var i=u("number",{"":function(){return 0},number:function(r){return r},string:function(r){if("NaN"===r)return NaN;var n=Number(r);if(isNaN(n))throw new SyntaxError('String "'+r+'" is no valid number');return n},BigNumber:function(r){return r.toNumber()},Fraction:function(r){return r.valueOf()},Unit:function(r){throw new Error("Second argument with valueless unit expected")},null:function(r){return 0},"Unit, string | Unit":function(r,n){return r.toNumber(n)},"Array | Matrix":function(n){return r(n,i)}});return i.toTex={0:"0",1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},i}exports.name="number",exports.factory=n;
},{"./../utils/collection/deepMap":"lOYo"}],"aA7E":[function(require,module,exports) {
"use strict";function r(r,e,t,n){var i=t(require("../function/utils/typeof")),o={string:!0,number:!0,BigNumber:!0,Fraction:!0},u={number:t(require("./number")),BigNumber:t(require("./bignumber/function/bignumber")),Fraction:t(require("./fraction/function/fraction"))},c=function(r,e){var t=i(r);if(!(t in o))throw new TypeError("Cannot convert "+r+' of type "'+t+'"; valid input types are '+Object.keys(o).join(", "));if(!(e in u))throw new TypeError("Cannot convert "+r+' to type "'+e+'"; valid output types are '+Object.keys(u).join(", "));return e===t?r:u[e](r)};return c.toTex=function(r,e){return r.args[0].toTex()},c}exports.path="type",exports.name="_numeric",exports.factory=r;
},{"../function/utils/typeof":"LZTG","./number":"lESm","./bignumber/function/bignumber":"ejiJ","./fraction/function/fraction":"CouR"}],"hpV8":[function(require,module,exports) {
"use strict";function t(t,e,r,n){function o(t){if(!(this instanceof o))throw new SyntaxError("Constructor must be called with the new operator");this.entries=t||[]}return o.prototype.type="ResultSet",o.prototype.isResultSet=!0,o.prototype.valueOf=function(){return this.entries},o.prototype.toString=function(){return"["+this.entries.join(", ")+"]"},o.prototype.toJSON=function(){return{mathjs:"ResultSet",entries:this.entries}},o.fromJSON=function(t){return new o(t.entries)},o}exports.name="ResultSet",exports.path="type",exports.factory=t;
},{}],"seRb":[function(require,module,exports) {
"use strict";module.exports=[require("./ResultSet")];
},{"./ResultSet":"hpV8"}],"QilD":[function(require,module,exports) {
"use strict";var r=require("./../utils/collection/deepMap"),t=require("../utils/number");function n(n,e,u,i){var o=i("string",{"":function(){return""},number:t.format,null:function(r){return"null"},boolean:function(r){return r+""},string:function(r){return r},"Array | Matrix":function(t){return r(t,o)},any:function(r){return String(r)}});return o.toTex={0:'\\mathtt{""}',1:"\\mathrm{string}\\left(${args[0]}\\right)"},o}exports.name="string",exports.factory=n;
},{"./../utils/collection/deepMap":"lOYo","../utils/number":"uqMu"}],"JQPe":[function(require,module,exports) {
"use strict";var e=require("../function").memoize;function n(e){return e[0].precision}exports.e=e(function(e){return new e(1).exp()},n),exports.phi=e(function(e){return new e(1).plus(new e(5).sqrt()).div(2)},n),exports.pi=e(function(e){return e.acos(-1)},n),exports.tau=e(function(e){return exports.pi(e).times(2)},n);
},{"../function":"woyg"}],"q5A1":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function n(n,e,t,u){var i=require("../../utils/latex"),o=u("unaryMinus",{number:function(r){return-r},Complex:function(r){return r.neg()},BigNumber:function(r){return r.neg()},Fraction:function(r){return r.neg()},Unit:function(r){var n=r.clone();return n.value=o(r.value),n},"Array | Matrix":function(n){return r(n,o,!0)}});return o.toTex={1:"".concat(i.operators.unaryMinus,"\\left(${args[0]}\\right)")},o}exports.name="unaryMinus",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo","../../utils/latex":"H1Mr"}],"JNXe":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function e(e,t,i,a){var n=i(require("../../../function/relational/equalScalar")),o=e.SparseMatrix;return function(e,t,i){var s=e._values,l=e._index,u=e._ptr,f=e._size,h=e._datatype,v=t._values,p=t._index,d=t._ptr,c=t._size,g=t._datatype;if(f.length!==c.length)throw new r(f.length,c.length);if(f[0]!==c[0]||f[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+c+")");var _,m=f[0],x=f[1],w=n,y=0,q=i;"string"==typeof h&&h===g&&(_=h,w=a.find(n,[_,_]),y=a.convert(0,_),q=a.find(i,[_,_]));var z,M,D,E,S=s&&v?[]:void 0,A=[],B=[],R=new o({values:S,index:A,ptr:B,size:[m,x],datatype:_}),b=S?[]:void 0,j=S?[]:void 0,k=[],C=[];for(M=0;M<x;M++){B[M]=A.length;var F=M+1;for(D=u[M],E=u[M+1];D<E;D++)z=l[D],A.push(z),k[z]=F,b&&(b[z]=s[D]);for(D=d[M],E=d[M+1];D<E;D++)k[z=p[D]]!==F&&A.push(z),C[z]=F,j&&(j[z]=v[D]);if(S)for(D=B[M];D<A.length;){var G=k[z=A[D]],H=C[z];if(G===F||H===F){var I=q(G===F?b[z]:y,H===F?j[z]:y);w(I,y)?A.splice(D,1):(S.push(I),D++)}}}return B[x]=A.length,R}}exports.name="algorithm05",exports.factory=e;
},{"../../../error/DimensionError":"YiAw","../../../function/relational/equalScalar":"QvIw"}],"m78R":[function(require,module,exports) {
"use strict";var r=require("../../error/DimensionError");function t(r,t,n,i){var u=require("../../utils/latex"),a=n(require("../../type/matrix/function/matrix")),o=n(require("./addScalar")),s=n(require("./unaryMinus")),l=n(require("../../type/matrix/utils/algorithm01")),c=n(require("../../type/matrix/utils/algorithm03")),f=n(require("../../type/matrix/utils/algorithm05")),x=n(require("../../type/matrix/utils/algorithm10")),m=n(require("../../type/matrix/utils/algorithm13")),y=n(require("../../type/matrix/utils/algorithm14")),h=i("subtract",{"number, number":function(r,t){return r-t},"Complex, Complex":function(r,t){return r.sub(t)},"BigNumber, BigNumber":function(r,t){return r.minus(t)},"Fraction, Fraction":function(r,t){return r.sub(t)},"Unit, Unit":function(r,t){if(null===r.value)throw new Error("Parameter x contains a unit with undefined value");if(null===t.value)throw new Error("Parameter y contains a unit with undefined value");if(!r.equalBase(t))throw new Error("Units do not match");var e=r.clone();return e.value=h(e.value,t.value),e.fixPrefix=!1,e},"SparseMatrix, SparseMatrix":function(r,t){return e(r,t),f(r,t,h)},"SparseMatrix, DenseMatrix":function(r,t){return e(r,t),c(t,r,h,!0)},"DenseMatrix, SparseMatrix":function(r,t){return e(r,t),l(r,t,h,!1)},"DenseMatrix, DenseMatrix":function(r,t){return e(r,t),m(r,t,h)},"Array, Array":function(r,t){return h(a(r),a(t)).valueOf()},"Array, Matrix":function(r,t){return h(a(r),t)},"Matrix, Array":function(r,t){return h(r,a(t))},"SparseMatrix, any":function(r,t){return x(r,s(t),o)},"DenseMatrix, any":function(r,t){return y(r,t,h)},"any, SparseMatrix":function(r,t){return x(t,r,h,!0)},"any, DenseMatrix":function(r,t){return y(t,r,h,!0)},"Array, any":function(r,t){return y(a(r),t,h,!1).valueOf()},"any, Array":function(r,t){return y(a(t),r,h,!0).valueOf()}});return h.toTex={2:"\\left(${args[0]}".concat(u.operators.subtract,"${args[1]}\\right)")},h}function e(t,e){var n=t.size(),i=e.size();if(n.length!==i.length)throw new r(n.length,i.length)}exports.name="subtract",exports.factory=t;
},{"../../error/DimensionError":"YiAw","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","./addScalar":"ZM3O","./unaryMinus":"q5A1","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm05":"JNXe","../../type/matrix/utils/algorithm10":"H0xb","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"obRw":[function(require,module,exports) {
"use strict";function n(n,r,u,e){var t=e("multiplyScalar",{"number, number":function(n,r){return n*r},"Complex, Complex":function(n,r){return n.mul(r)},"BigNumber, BigNumber":function(n,r){return n.times(r)},"Fraction, Fraction":function(n,r){return n.mul(r)},"number | Fraction | BigNumber | Complex, Unit":function(n,r){var u=r.clone();return u.value=null===u.value?u._normalize(n):t(u.value,n),u},"Unit, number | Fraction | BigNumber | Complex":function(n,r){var u=n.clone();return u.value=null===u.value?u._normalize(r):t(u.value,r),u},"Unit, Unit":function(n,r){return n.multiply(r)}});return t}exports.factory=n;
},{}],"R3aq":[function(require,module,exports) {
"use strict";function n(n,r,e,u){var i=e(require("../../type/numeric")),t=e(require("../../function/utils/typeof")),o=u("divide",{"number, number":function(n,r){return n/r},"Complex, Complex":function(n,r){return n.div(r)},"BigNumber, BigNumber":function(n,r){return n.div(r)},"Fraction, Fraction":function(n,r){return n.div(r)},"Unit, number | Fraction | BigNumber":function(n,r){var e=n.clone(),u=i(1,t(r));return e.value=o(null===e.value?e._normalize(u):e.value,r),e},"number | Fraction | BigNumber, Unit":function(n,r){var e=r.clone();e=e.pow(-1);var u=i(1,t(n));return e.value=o(n,null===r.value?r._normalize(u):r.value),e},"Unit, Unit":function(n,r){return n.divide(r)}});return o}exports.factory=n;
},{"../../type/numeric":"aA7E","../../function/utils/typeof":"LZTG"}],"zJUT":[function(require,module,exports) {
"use strict";var r=require("../../utils/array"),e=require("../../utils/number").isInteger;function t(t,i,n,u){var a=n(require("../../type/matrix/function/matrix")),o=u("identity",{"":function(){return"Matrix"===i.matrix?a([]):[]},string:function(r){return a(r)},"number | BigNumber":function(r){return m(r,r,"Matrix"===i.matrix?"default":void 0)},"number | BigNumber, string":function(r,e){return m(r,r,e)},"number | BigNumber, number | BigNumber":function(r,e){return m(r,e,"Matrix"===i.matrix?"default":void 0)},"number | BigNumber, number | BigNumber, string":function(r,e,t){return m(r,e,t)},Array:function(r){return s(r)},"Array, string":function(r,e){return s(r,e)},Matrix:function(r){return s(r.valueOf(),r.storage())},"Matrix, string":function(r,e){return s(r.valueOf(),e)}});return o.toTex=void 0,o;function s(r,e){switch(r.length){case 0:return e?a(e):[];case 1:return m(r[0],r[0],e);case 2:return m(r[0],r[1],e);default:throw new Error("Vector containing two values expected")}}function m(i,n,u){var a=t.isBigNumber(i)||t.isBigNumber(n)?t.BigNumber:null;if(t.isBigNumber(i)&&(i=i.toNumber()),t.isBigNumber(n)&&(n=n.toNumber()),!e(i)||i<1)throw new Error("Parameters in function identity must be positive integers");if(!e(n)||n<1)throw new Error("Parameters in function identity must be positive integers");var o=a?new t.BigNumber(1):1,s=a?new a(0):0,m=[i,n];if(u)return t.Matrix.storage(u).diagonal(m,o,0,s);for(var f=r.resize([],m,s),c=i<n?i:n,g=0;g<c;g++)f[g][g]=o;return f}}exports.name="identity",exports.factory=t;
},{"../../utils/array":"j2lF","../../utils/number":"uqMu","../../type/matrix/function/matrix":"vzj5"}],"dpKK":[function(require,module,exports) {
"use strict";function r(r,a,e,t){var n=e(require("../../../function/relational/equalScalar")),o=r.SparseMatrix;return function(r,a,e,i){var p=r._values,s=r._index,u=r._ptr,f=r._size,l=r._datatype;if(!p)throw new Error("Cannot perform operation on Pattern Sparse Matrix and Scalar value");var v,c=f[0],d=f[1],h=n,x=0,_=e;"string"==typeof l&&(v=l,h=t.find(n,[v,v]),x=t.convert(0,v),a=t.convert(a,v),_=t.find(e,[v,v]));for(var g=[],y=[],S=[],m=new o({values:g,index:y,ptr:S,size:[c,d],datatype:v}),w=0;w<d;w++){S[w]=y.length;for(var q=u[w],z=u[w+1],M=q;M<z;M++){var C=s[M],E=i?_(a,p[M]):_(p[M],a);h(E,x)||(y.push(C),g.push(E))}}return S[d]=y.length,m}}exports.name="algorithm11",exports.factory=r;
},{"../../../function/relational/equalScalar":"QvIw"}],"k7By":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").extend,t=require("../../utils/array");function a(a,e,n,i){var o=require("../../utils/latex"),s=n(require("../../type/matrix/function/matrix")),u=n(require("./addScalar")),l=n(require("./multiplyScalar")),f=n(require("../relational/equalScalar")),d=n(require("../../type/matrix/utils/algorithm11")),p=n(require("../../type/matrix/utils/algorithm14")),y=a.DenseMatrix,v=a.SparseMatrix,c=i("multiply",r({"Array, Array":function(r,e){m(t.size(r),t.size(e));var n=c(s(r),s(e));return a.isMatrix(n)?n.valueOf():n},"Matrix, Matrix":function(r,t){var a=r.size(),e=t.size();return m(a,e),1===a.length?1===e.length?function(r,t,a){if(0===a)throw new Error("Cannot multiply two empty vectors");var e,n=r._data,o=r._datatype,s=t._data,f=t._datatype,d=u,p=l;o&&f&&o===f&&"string"==typeof o&&(e=o,d=i.find(u,[e,e]),p=i.find(l,[e,e]));for(var y=p(n[0],s[0]),v=1;v<a;v++)y=d(y,p(n[v],s[v]));return y}(r,t,a[0]):function(r,t){if("dense"!==t.storage())throw new Error("Support for SparseMatrix not implemented");return function(r,t){var a,e=r._data,n=r._size,o=r._datatype,s=t._data,f=t._size,d=t._datatype,p=n[0],v=f[1],c=u,m=l;o&&d&&o===d&&"string"==typeof o&&(a=o,c=i.find(u,[a,a]),m=i.find(l,[a,a]));for(var h=[],x=0;x<v;x++){for(var _=m(e[0],s[0][x]),g=1;g<p;g++)_=c(_,m(e[g],s[g][x]));h[x]=_}return new y({data:h,size:[v],datatype:a})}(r,t)}(r,t):1===e.length?h(r,t):x(r,t)},"Matrix, Array":function(r,t){return c(r,s(t))},"Array, Matrix":function(r,t){return c(s(r,t.storage()),t)},"SparseMatrix, any":function(r,t){return d(r,t,l,!1)},"DenseMatrix, any":function(r,t){return p(r,t,l,!1)},"any, SparseMatrix":function(r,t){return d(t,r,l,!0)},"any, DenseMatrix":function(r,t){return p(t,r,l,!0)},"Array, any":function(r,t){return p(s(r),t,l,!1).valueOf()},"any, Array":function(r,t){return p(s(t),r,l,!0).valueOf()},"any, any":l,"any, any, ...any":function(r,t,a){for(var e=c(r,t),n=0;n<a.length;n++)e=c(e,a[n]);return e}},l.signatures));function m(r,t){switch(r.length){case 1:switch(t.length){case 1:if(r[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vectors must have the same length");break;case 2:if(r[0]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Vector length ("+r[0]+") must match Matrix rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;case 2:switch(t.length){case 1:if(r[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix columns ("+r[1]+") must match Vector length ("+t[0]+")");break;case 2:if(r[1]!==t[0])throw new RangeError("Dimension mismatch in multiplication. Matrix A columns ("+r[1]+") must match Matrix B rows ("+t[0]+")");break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix B has "+t.length+" dimensions)")}break;default:throw new Error("Can only multiply a 1 or 2 dimensional matrix (Matrix A has "+r.length+" dimensions)")}}var h=i("_multiplyMatrixVector",{"DenseMatrix, any":function(r,t){var a,e=r._data,n=r._size,o=r._datatype,s=t._data,f=t._datatype,d=n[0],p=n[1],v=u,c=l;o&&f&&o===f&&"string"==typeof o&&(a=o,v=i.find(u,[a,a]),c=i.find(l,[a,a]));for(var m=[],h=0;h<d;h++){for(var x=e[h],_=c(x[0],s[0]),g=1;g<p;g++)_=v(_,c(x[g],s[g]));m[h]=_}return new y({data:m,size:[d],datatype:a})},"SparseMatrix, any":function(r,t){var a=r._values,e=r._index,n=r._ptr,o=r._datatype;if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var s,d=t._data,p=t._datatype,y=r._size[0],c=t._size[0],m=[],h=[],x=[],_=u,g=l,M=f,w=0;o&&p&&o===p&&"string"==typeof o&&(s=o,_=i.find(u,[s,s]),g=i.find(l,[s,s]),M=i.find(f,[s,s]),w=i.convert(0,s));var z=[],D=[];x[0]=0;for(var S=0;S<c;S++){var E=d[S];if(!M(E,w))for(var q=n[S],A=n[S+1],b=q;b<A;b++){var C=e[b];D[C]?z[C]=_(z[C],g(E,a[b])):(D[C]=!0,h.push(C),z[C]=g(E,a[b]))}}for(var k=h.length,R=0;R<k;R++){var V=h[R];m[R]=z[V]}return x[1]=h.length,new v({values:m,index:h,ptr:x,size:[y,1],datatype:s})}}),x=i("_multiplyMatrixMatrix",{"DenseMatrix, DenseMatrix":function(r,t){var a,e=r._data,n=r._size,o=r._datatype,s=t._data,f=t._size,d=t._datatype,p=n[0],v=n[1],c=f[1],m=u,h=l;o&&d&&o===d&&"string"==typeof o&&(a=o,m=i.find(u,[a,a]),h=i.find(l,[a,a]));for(var x=[],_=0;_<p;_++){var g=e[_];x[_]=[];for(var M=0;M<c;M++){for(var w=h(g[0],s[0][M]),z=1;z<v;z++)w=m(w,h(g[z],s[z][M]));x[_][M]=w}}return new y({data:x,size:[p,c],datatype:a})},"DenseMatrix, SparseMatrix":function(r,t){var a=r._data,e=r._size,n=r._datatype,o=t._values,s=t._index,d=t._ptr,p=t._size,y=t._datatype;if(!o)throw new Error("Cannot multiply Dense Matrix times Pattern only Matrix");var c,m=e[0],h=p[1],x=u,_=l,g=f,M=0;n&&y&&n===y&&"string"==typeof n&&(c=n,x=i.find(u,[c,c]),_=i.find(l,[c,c]),g=i.find(f,[c,c]),M=i.convert(0,c));for(var w=[],z=[],D=[],S=new v({values:w,index:z,ptr:D,size:[m,h],datatype:c}),E=0;E<h;E++){D[E]=z.length;var q=d[E],A=d[E+1];if(A>q)for(var b=0,C=0;C<m;C++){for(var k=C+1,R=void 0,V=q;V<A;V++){var B=s[V];b!==k?(R=_(a[C][B],o[V]),b=k):R=x(R,_(a[C][B],o[V]))}b!==k||g(R,M)||(z.push(C),w.push(R))}}return D[h]=z.length,S},"SparseMatrix, DenseMatrix":function(r,t){var a=r._values,e=r._index,n=r._ptr,o=r._datatype;if(!a)throw new Error("Cannot multiply Pattern only Matrix times Dense Matrix");var s,d=t._data,p=t._datatype,y=r._size[0],c=t._size[0],m=t._size[1],h=u,x=l,_=f,g=0;o&&p&&o===p&&"string"==typeof o&&(s=o,h=i.find(u,[s,s]),x=i.find(l,[s,s]),_=i.find(f,[s,s]),g=i.convert(0,s));for(var M=[],w=[],z=[],D=new v({values:M,index:w,ptr:z,size:[y,m],datatype:s}),S=[],E=[],q=0;q<m;q++){z[q]=w.length;for(var A=q+1,b=0;b<c;b++){var C=d[b][q];if(!_(C,g))for(var k=n[b],R=n[b+1],V=k;V<R;V++){var B=e[V];E[B]!==A?(E[B]=A,w.push(B),S[B]=x(C,a[V])):S[B]=h(S[B],x(C,a[V]))}}for(var O=z[q],P=w.length,$=O;$<P;$++){var j=w[$];M[$]=S[j]}}return z[m]=w.length,D},"SparseMatrix, SparseMatrix":function(r,t){var a,e=r._values,n=r._index,o=r._ptr,s=r._datatype,f=t._values,d=t._index,p=t._ptr,y=t._datatype,c=r._size[0],m=t._size[1],h=e&&f,x=u,_=l;s&&y&&s===y&&"string"==typeof s&&(a=s,x=i.find(u,[a,a]),_=i.find(l,[a,a]));for(var g,M,w,z,D,S,E,q,A=h?[]:void 0,b=[],C=[],k=new v({values:A,index:b,ptr:C,size:[c,m],datatype:a}),R=h?[]:void 0,V=[],B=0;B<m;B++){C[B]=b.length;var O=B+1;for(D=p[B],S=p[B+1],z=D;z<S;z++)if(q=d[z],h)for(M=o[q],w=o[q+1],g=M;g<w;g++)E=n[g],V[E]!==O?(V[E]=O,b.push(E),R[E]=_(f[z],e[g])):R[E]=x(R[E],_(f[z],e[g]));else for(M=o[q],w=o[q+1],g=M;g<w;g++)E=n[g],V[E]!==O&&(V[E]=O,b.push(E));if(h)for(var P=C[B],$=b.length,j=P;j<$;j++){var T=b[j];A[j]=R[T]}}return C[m]=b.length,k}});return c.toTex={2:"\\left(${args[0]}".concat(o.operators.multiply,"${args[1]}\\right)")},c}exports.name="multiply",exports.factory=a;
},{"../../utils/object":"FcSp","../../utils/array":"j2lF","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","./addScalar":"ZM3O","./multiplyScalar":"obRw","../relational/equalScalar":"QvIw","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm14":"S2eB"}],"CsUv":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,e=require("../../utils/array").size;function t(t,n,i,o){var u=require("../../utils/latex"),a=i(require("../matrix/identity")),p=i(require("./multiply")),f=i(require("../../type/matrix/function/matrix")),m=i(require("../../type/fraction/function/fraction")),s=i(require("../../type/number")),b=o("pow",{"number, number":c,"Complex, Complex":function(r,e){return r.pow(e)},"BigNumber, BigNumber":function(r,e){return e.isInteger()||r>=0||n.predictable?r.pow(e):new t.Complex(r.toNumber(),0).pow(e.toNumber(),0)},"Fraction, Fraction":function(r,e){if(1!==e.d){if(n.predictable)throw new Error("Function pow does not support non-integer exponents for fractions.");return c(r.valueOf(),e.valueOf())}return r.pow(e)},"Array, number":l,"Array, BigNumber":function(r,e){return l(r,e.toNumber())},"Matrix, number":w,"Matrix, BigNumber":function(r,e){return w(r,e.toNumber())},"Unit, number | BigNumber":function(r,e){return r.pow(e)}});function c(e,i){if(n.predictable&&!r(i)&&e<0)try{var o=m(i),u=s(o);if((i===u||Math.abs((i-u)/i)<1e-14)&&o.d%2==1)return(o.n%2==0?1:-1)*Math.pow(-e,i)}catch(a){}return e*e<1&&i===1/0||e*e>1&&i===-1/0?0:n.predictable&&(e<-1&&i===1/0||e>-1&&e<0&&i===-1/0)?NaN:r(i)||e>=0||n.predictable?Math.pow(e,i):new t.Complex(e,0).pow(i,0)}function l(t,n){if(!r(n)||n<0)throw new TypeError("For A^b, b must be a positive integer (value is "+n+")");var i=e(t);if(2!==i.length)throw new Error("For A^b, A must be 2 dimensional (A has "+i.length+" dimensions)");if(i[0]!==i[1])throw new Error("For A^b, A must be square (size is "+i[0]+"x"+i[1]+")");for(var o=a(i[0]).valueOf(),u=t;n>=1;)1==(1&n)&&(o=p(u,o)),n>>=1,u=p(u,u);return o}function w(r,e){return f(l(r.valueOf(),e))}return b.toTex={2:"\\left(${args[0]}\\right)".concat(u.operators.pow,"{${args[1]}}")},b}exports.name="pow",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/array":"j2lF","../../utils/latex":"H1Mr","../matrix/identity":"zJUT","./multiply":"k7By","../../type/matrix/function/matrix":"vzj5","../../type/fraction/function/fraction":"CouR","../../type/number":"lESm"}],"K5X1":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,n,e,a){var u=a("abs",{number:Math.abs,Complex:function(r){return r.abs()},BigNumber:function(r){return r.abs()},Fraction:function(r){return r.abs()},"Array | Matrix":function(t){return r(t,u,!0)},Unit:function(r){return r.abs()}});return u.toTex={1:"\\left|${args[0]}\\right|"},u}exports.name="abs",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"BAjv":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,e=require("../../utils/array").resize;function t(t,n,i,u){var a=i(require("../../type/matrix/function/matrix")),o=u("zeros",{"":function(){return"Array"===n.matrix?f([]):f([],"default")},"...number | BigNumber | string":function(r){if("string"==typeof r[r.length-1]){var e=r.pop();return f(r,e)}return"Array"===n.matrix?f(r):f(r,"default")},Array:f,Matrix:function(r){var e=r.storage();return f(r.valueOf(),e)},"Array | Matrix, string":function(r,e){return f(r.valueOf(),e)}});return o.toTex=void 0,o;function f(n,i){var u=function(r){var e=!1;return r.forEach(function(r,n,i){t.isBigNumber(r)&&(e=!0,i[n]=r.toNumber())}),e}(n)?new t.BigNumber(0):0;if(function(e){e.forEach(function(e){if("number"!=typeof e||!r(e)||e<0)throw new Error("Parameters in function zeros must be positive integers")})}(n),i){var o=a(i);return n.length>0?o.resize(n,u):o}var f=[];return n.length>0?e(f,n,u):f}}exports.name="zeros",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5"}],"f25u":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,e=require("../../utils/number").toFixed,n=require("../../utils/collection/deepMap"),t="Number of decimals in function round must be an integer";function u(e,u,o,m){var a=o(require("../../type/matrix/function/matrix")),c=o(require("../relational/equalScalar")),f=o(require("../matrix/zeros")),l=o(require("../../type/matrix/utils/algorithm11")),b=o(require("../../type/matrix/utils/algorithm12")),s=o(require("../../type/matrix/utils/algorithm14")),g=m("round",{number:function(r){return i(r,0)},"number, number":function(e,n){if(!r(n))throw new TypeError(t);if(n<0||n>15)throw new Error("Number of decimals in function round must be in te range of 0-15");return i(e,n)},Complex:function(r){return r.round()},"Complex, number":function(r,e){if(e%1)throw new TypeError(t);return r.round(e)},"Complex, BigNumber":function(r,e){if(!e.isInteger())throw new TypeError(t);var n=e.toNumber();return r.round(n)},"number, BigNumber":function(r,n){if(!n.isInteger())throw new TypeError(t);return new e.BigNumber(r).toDecimalPlaces(n.toNumber())},BigNumber:function(r){return r.toDecimalPlaces(0)},"BigNumber, BigNumber":function(r,e){if(!e.isInteger())throw new TypeError(t);return r.toDecimalPlaces(e.toNumber())},Fraction:function(r){return r.round()},"Fraction, number":function(r,e){if(e%1)throw new TypeError(t);return r.round(e)},"Array | Matrix":function(r){return n(r,g,!0)},"SparseMatrix, number | BigNumber":function(r,e){return l(r,e,g,!1)},"DenseMatrix, number | BigNumber":function(r,e){return s(r,e,g,!1)},"number | Complex | BigNumber, SparseMatrix":function(r,e){return c(r,0)?f(e.size(),e.storage()):b(e,r,g,!0)},"number | Complex | BigNumber, DenseMatrix":function(r,e){return c(r,0)?f(e.size(),e.storage()):s(e,r,g,!0)},"Array, number | BigNumber":function(r,e){return s(a(r),e,g,!1).valueOf()},"number | Complex | BigNumber, Array":function(r,e){return s(a(e),r,g,!0).valueOf()}});return g.toTex={1:"\\left\\lfloor${args[0]}\\right\\rceil",2:void 0},g}function i(r,n){return parseFloat(e(r,n))}exports.name="round",exports.factory=u;
},{"../../utils/number":"uqMu","../../utils/collection/deepMap":"lOYo","../../type/matrix/function/matrix":"vzj5","../relational/equalScalar":"QvIw","../matrix/zeros":"BAjv","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm14":"S2eB"}],"CkRk":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap"),r=require("../../utils/number").nearlyEqual,i=require("../../utils/bignumber/nearlyEqual");function n(n,t,u,l){var c=u(require("../../function/arithmetic/round")),o=l("ceil",{number:function(e){return r(e,c(e),t.epsilon)?c(e):Math.ceil(e)},Complex:function(e){return e.ceil()},BigNumber:function(e){return i(e,c(e),t.epsilon)?c(e):e.ceil()},Fraction:function(e){return e.ceil()},"Array | Matrix":function(r){return e(r,o,!0)}});return o.toTex={1:"\\left\\lceil${args[0]}\\right\\rceil"},o}exports.name="ceil",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo","../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../function/arithmetic/round":"f25u"}],"Wigz":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap"),o=require("../../utils/number").nearlyEqual,e=require("../../utils/bignumber/nearlyEqual");function n(n,t,u,i){var l=u(require("../../function/arithmetic/round")),f=i("floor",{number:function(r){return o(r,l(r),t.epsilon)?l(r):Math.floor(r)},Complex:function(r){return r.floor()},BigNumber:function(r){return e(r,l(r),t.epsilon)?l(r):r.floor()},Fraction:function(r){return r.floor()},"Array | Matrix":function(o){return r(o,f,!0)}});return f.toTex={1:"\\left\\lfloor${args[0]}\\right\\rfloor"},f}exports.name="floor",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo","../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../function/arithmetic/round":"f25u"}],"Pk2X":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,i,n){var o=i(require("../../function/arithmetic/ceil")),u=i(require("../../function/arithmetic/floor")),c=n("fix",{number:function(r){return r>0?u(r):o(r)},Complex:function(r){return new e.Complex(r.re>0?Math.floor(r.re):Math.ceil(r.re),r.im>0?Math.floor(r.im):Math.ceil(r.im))},BigNumber:function(r){return r.isNegative()?o(r):u(r)},Fraction:function(r){return r.s<0?r.ceil():r.floor()},"Array | Matrix":function(e){return r(e,c,!0)}});return c.toTex={1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},c}exports.name="fix",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo","../../function/arithmetic/ceil":"CkRk","../../function/arithmetic/floor":"Wigz"}],"IviB":[function(require,module,exports) {
"use strict";function r(r,t,e,n){var a=e(require("../../type/matrix/function/matrix")),i=e(require("./equalScalar")),u=e(require("../../type/matrix/utils/algorithm03")),o=e(require("../../type/matrix/utils/algorithm07")),l=e(require("../../type/matrix/utils/algorithm12")),s=e(require("../../type/matrix/utils/algorithm13")),x=e(require("../../type/matrix/utils/algorithm14")),c=require("../../utils/latex"),f=n("equal",{"any, any":function(r,t){return null===r?null===t:null===t?null===r:void 0===r?void 0===t:void 0===t?void 0===r:i(r,t)},"SparseMatrix, SparseMatrix":function(r,t){return o(r,t,i)},"SparseMatrix, DenseMatrix":function(r,t){return u(t,r,i,!0)},"DenseMatrix, SparseMatrix":function(r,t){return u(r,t,i,!1)},"DenseMatrix, DenseMatrix":function(r,t){return s(r,t,i)},"Array, Array":function(r,t){return f(a(r),a(t)).valueOf()},"Array, Matrix":function(r,t){return f(a(r),t)},"Matrix, Array":function(r,t){return f(r,a(t))},"SparseMatrix, any":function(r,t){return l(r,t,i,!1)},"DenseMatrix, any":function(r,t){return x(r,t,i,!1)},"any, SparseMatrix":function(r,t){return l(t,r,i,!0)},"any, DenseMatrix":function(r,t){return x(t,r,i,!0)},"Array, any":function(r,t){return x(a(r),t,i,!1).valueOf()},"any, Array":function(r,t){return x(a(t),r,i,!0).valueOf()}});return f.toTex={2:"\\left(${args[0]}".concat(c.operators.equal,"${args[1]}\\right)")},f}exports.name="equal",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","./equalScalar":"QvIw","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB","../../utils/latex":"H1Mr"}],"Rv38":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,n,t,i){var u=i("isNumeric",{"number | BigNumber | Fraction | boolean":function(){return!0},"Complex | Unit | string | null | undefined | Node":function(){return!1},"Array | Matrix":function(e){return r(e,u)}});return u}exports.name="isNumeric",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"A04Q":[function(require,module,exports) {
"use strict";var r=require("../../utils/string");function t(t,o,a,e){var n=e("format",{any:r.format,"any, Object | function | number":r.format});return n.toTex=void 0,n}exports.name="format",exports.factory=t;
},{"../../utils/string":"PshC"}],"zikE":[function(require,module,exports) {
"use strict";function e(i){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(i)}function i(n){return(i="function"==typeof Symbol&&"symbol"===e(Symbol.iterator)?function(i){return e(i)}:function(i){return i&&"function"==typeof Symbol&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":e(i)})(n)}function n(){return(n=Object.assign||function(e){for(var i=1;i<arguments.length;i++){var n=arguments[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(this,arguments)}var a=require("../../utils/string").endsWith,t=require("../../utils/object").clone,s=require("../../utils/bignumber/constants");function r(e,r,f,o,u){var l,m,c,p=f(require("../../function/arithmetic/addScalar")),v=f(require("../../function/arithmetic/subtract")),E=f(require("../../function/arithmetic/multiplyScalar")),N=f(require("../../function/arithmetic/divideScalar")),h=f(require("../../function/arithmetic/pow")),O=f(require("../../function/arithmetic/abs")),b=f(require("../../function/arithmetic/fix")),x=f(require("../../function/arithmetic/round")),d=f(require("../../function/relational/equal")),T=f(require("../../function/utils/isNumeric")),S=f(require("../../function/string/format")),R=f(require("../../function/utils/typeof")),g=f(require("../../type/number")),y=f(require("../../type/complex/Complex"));function C(i,n){if(!(this instanceof C))throw new Error("Constructor must be called with the new operator");if(null!=i&&!T(i)&&!e.isComplex(i))throw new TypeError("First parameter in Unit constructor must be number, BigNumber, Fraction, Complex, or undefined");if(void 0!==n&&("string"!=typeof n||""===n))throw new TypeError("Second parameter in Unit constructor must be a string");if(void 0!==n){var a=C.parse(n);this.units=a.units,this.dimensions=a.dimensions}else{this.units=[{unit:q,prefix:P.NONE,power:0}],this.dimensions=[];for(var t=0;t<k.length;t++)this.dimensions[t]=0}this.value=null!=i?this._normalize(i):null,this.fixPrefix=!1,this.skipAutomaticSimplification=!0}function U(){for(;" "===c||"\t"===c;)M()}function w(e){return e>="0"&&e<="9"}function M(){m++,c=l.charAt(m)}function A(e){m=e,c=l.charAt(m)}function L(){var e,i="";if(e=m,"+"===c?M():"-"===c&&(i+=c,M()),!function(e){return e>="0"&&e<="9"||"."===e}(c))return A(e),null;if("."===c){if(i+=c,M(),!w(c))return A(e),null}else{for(;w(c);)i+=c,M();"."===c&&(i+=c,M())}for(;w(c);)i+=c,M();if("E"===c||"e"===c){var n="",a=m;if(n+=c,M(),"+"!==c&&"-"!==c||(n+=c,M()),!w(c))return A(a),i;for(i+=n;w(c);)i+=c,M()}return i}function I(){for(var e="",i=l.charCodeAt(m);i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122;)e+=c,M(),i=l.charCodeAt(m);return((i=e.charCodeAt(0))>=65&&i<=90||i>=97&&i<=122)&&e||null}function H(e){return c===e?(M(),e):null}function G(e){if(V.hasOwnProperty(e)){var i=V[e];return{unit:i,prefix:i.prefixes[""]}}for(var n in V)if(V.hasOwnProperty(n)&&a(e,n)){var t=V[n],s=e.length-n.length,r=e.substring(0,s),f=t.prefixes.hasOwnProperty(r)?t.prefixes[r]:void 0;if(void 0!==f)return{unit:t,prefix:f}}return null}function _(e){return e.equalBase(F.NONE)&&null!==e.value&&!r.predictable?e.value:e}C.prototype.type="Unit",C.prototype.isUnit=!0,C.parse=function(i,n){if(n=n||{},m=-1,c="","string"!=typeof(l=i))throw new TypeError("Invalid argument in Unit.parse, string expected");var a=new C;a.units=[];var t=1,s=!1;M(),U();var f=L(),o=null;f&&(o="BigNumber"===r.number?new e.BigNumber(f):"Fraction"===r.number?new e.Fraction(f):parseFloat(f),U(),H("*")?(t=1,s=!0):H("/")&&(t=-1,s=!0));for(var u=[],p=1;;){for(U();"("===c;)u.push(t),p*=t,t=1,M(),U();var v=void 0;if(!c)break;var E=c;if(null===(v=I()))throw new SyntaxError('Unexpected "'+E+'" in "'+l+'" at index '+m.toString());var N=G(v);if(null===N)throw new SyntaxError('Unit "'+v+'" not found.');var h=t*p;if(U(),H("^")){U();var O=L();if(null===O)throw new SyntaxError('In "'+i+'", "^" must be followed by a floating-point number');h*=O}a.units.push({unit:N.unit,prefix:N.prefix,power:h});for(var b=0;b<k.length;b++)a.dimensions[b]+=(N.unit.dimensions[b]||0)*h;for(U();")"===c;){if(0===u.length)throw new SyntaxError('Unmatched ")" in "'+l+'" at index '+m.toString());p/=u.pop(),M(),U()}if(s=!1,H("*")?(t=1,s=!0):H("/")?(t=-1,s=!0):t=1,N.unit.base){var x=N.unit.base.key;D.auto[x]={unit:N.unit,prefix:N.prefix}}}if(U(),c)throw new SyntaxError('Could not parse: "'+i+'"');if(s)throw new SyntaxError('Trailing characters: "'+i+'"');if(0!==u.length)throw new SyntaxError('Unmatched "(" in "'+l+'"');if(0===a.units.length&&!n.allowNoUnits)throw new SyntaxError('"'+i+'" contains no units');return a.value=void 0!==o?a._normalize(o):null,a},C.prototype.clone=function(){var e=new C;e.fixPrefix=this.fixPrefix,e.skipAutomaticSimplification=this.skipAutomaticSimplification,e.value=t(this.value),e.dimensions=this.dimensions.slice(0),e.units=[];for(var i=0;i<this.units.length;i++)for(var n in e.units[i]={},this.units[i])this.units[i].hasOwnProperty(n)&&(e.units[i][n]=this.units[i][n]);return e},C.prototype._isDerived=function(){return 0!==this.units.length&&(this.units.length>1||Math.abs(this.units[0].power-1)>1e-15)},C.prototype._normalize=function(e){var i,n,a,t,s;if(null==e||0===this.units.length)return e;if(this._isDerived()){var r=e;s=C._getNumberConverter(R(e));for(var f=0;f<this.units.length;f++)i=s(this.units[f].unit.value),t=s(this.units[f].prefix.value),a=s(this.units[f].power),r=E(r,h(E(i,t),a));return r}return i=(s=C._getNumberConverter(R(e)))(this.units[0].unit.value),n=s(this.units[0].unit.offset),t=s(this.units[0].prefix.value),E(p(e,n),E(i,t))},C.prototype._denormalize=function(e,i){var n,a,t,s,r;if(null==e||0===this.units.length)return e;if(this._isDerived()){var f=e;r=C._getNumberConverter(R(e));for(var o=0;o<this.units.length;o++)n=r(this.units[o].unit.value),s=r(this.units[o].prefix.value),t=r(this.units[o].power),f=N(f,h(E(n,s),t));return f}return n=(r=C._getNumberConverter(R(e)))(this.units[0].unit.value),s=r(this.units[0].prefix.value),a=r(this.units[0].unit.offset),v(N(N(e,n),null==i?s:i),a)},C.isValuelessUnit=function(e){return null!==G(e)},C.prototype.hasBase=function(e){if("string"==typeof e&&(e=F[e]),!e)return!1;for(var i=0;i<k.length;i++)if(Math.abs((this.dimensions[i]||0)-(e.dimensions[i]||0))>1e-12)return!1;return!0},C.prototype.equalBase=function(e){for(var i=0;i<k.length;i++)if(Math.abs((this.dimensions[i]||0)-(e.dimensions[i]||0))>1e-12)return!1;return!0},C.prototype.equals=function(e){return this.equalBase(e)&&d(this.value,e.value)},C.prototype.multiply=function(e){for(var i=this.clone(),n=0;n<k.length;n++)i.dimensions[n]=(this.dimensions[n]||0)+(e.dimensions[n]||0);for(var a=0;a<e.units.length;a++){var t={};for(var s in e.units[a])t[s]=e.units[a][s];i.units.push(t)}if(null!==this.value||null!==e.value){var r=null===this.value?this._normalize(1):this.value,f=null===e.value?e._normalize(1):e.value;i.value=E(r,f)}else i.value=null;return i.skipAutomaticSimplification=!1,_(i)},C.prototype.divide=function(e){for(var i=this.clone(),n=0;n<k.length;n++)i.dimensions[n]=(this.dimensions[n]||0)-(e.dimensions[n]||0);for(var a=0;a<e.units.length;a++){var t={};for(var s in e.units[a])t[s]=e.units[a][s];t.power=-t.power,i.units.push(t)}if(null!==this.value||null!==e.value){var r=null===this.value?this._normalize(1):this.value,f=null===e.value?e._normalize(1):e.value;i.value=N(r,f)}else i.value=null;return i.skipAutomaticSimplification=!1,_(i)},C.prototype.pow=function(e){for(var i=this.clone(),n=0;n<k.length;n++)i.dimensions[n]=(this.dimensions[n]||0)*e;for(var a=0;a<i.units.length;a++)i.units[a].power*=e;return null!==i.value?i.value=h(i.value,e):i.value=null,i.skipAutomaticSimplification=!1,_(i)},C.prototype.abs=function(){var e=this.clone();for(var i in e.value=null!==e.value?O(e.value):null,e.units)"VA"!==e.units[i].unit.name&&"VAR"!==e.units[i].unit.name||(e.units[i].unit=V.W);return e},C.prototype.to=function(i){var n,a=null===this.value?this._normalize(1):this.value;if("string"==typeof i){if(n=C.parse(i),!this.equalBase(n))throw new Error("Units do not match ('".concat(n.toString(),"' != '").concat(this.toString(),"')"));if(null!==n.value)throw new Error("Cannot convert to a unit with a value");return n.value=t(a),n.fixPrefix=!0,n.skipAutomaticSimplification=!0,n}if(e.isUnit(i)){if(!this.equalBase(i))throw new Error("Units do not match ('".concat(i.toString(),"' != '").concat(this.toString(),"')"));if(null!==i.value)throw new Error("Cannot convert to a unit with a value");return(n=i.clone()).value=t(a),n.fixPrefix=!0,n.skipAutomaticSimplification=!0,n}throw new Error("String or Unit expected as parameter")},C.prototype.toNumber=function(e){return g(this.toNumeric(e))},C.prototype.toNumeric=function(e){var i;return(i=e?this.to(e):this.clone())._isDerived()?i._denormalize(i.value):i._denormalize(i.value,i.units[0].prefix.value)},C.prototype.toString=function(){return this.format()},C.prototype.toJSON=function(){return{mathjs:"Unit",value:this._denormalize(this.value),unit:this.formatUnits(),fixPrefix:this.fixPrefix}},C.fromJSON=function(e){var i=new C(e.value,e.unit);return i.fixPrefix=e.fixPrefix||!1,i},C.prototype.valueOf=C.prototype.toString,C.prototype.simplify=function(){var e,i,n=this.clone(),a=[];for(var t in W)if(n.hasBase(F[t])){e=t;break}if("NONE"===e)n.units=[];else if(e&&W.hasOwnProperty(e)&&(i=W[e]),i)n.units=[{unit:i.unit,prefix:i.prefix,power:1}];else{for(var s=!1,r=0;r<k.length;r++){var f=k[r];Math.abs(n.dimensions[r]||0)>1e-12&&(W.hasOwnProperty(f)?a.push({unit:W[f].unit,prefix:W[f].prefix,power:n.dimensions[r]||0}):s=!0)}a.length<n.units.length&&!s&&(n.units=a)}return n},C.prototype.toSI=function(){for(var e=this.clone(),i=[],n=0;n<k.length;n++){var a=k[n];if(Math.abs(e.dimensions[n]||0)>1e-12){if(!D.si.hasOwnProperty(a))throw new Error("Cannot express custom unit "+a+" in SI units");i.push({unit:D.si[a].unit,prefix:D.si[a].prefix,power:e.dimensions[n]||0})}}return e.units=i,e.fixPrefix=!0,e.skipAutomaticSimplification=!0,e},C.prototype.formatUnits=function(){for(var e="",i="",n=0,a=0,t=0;t<this.units.length;t++)this.units[t].power>0?(n++,e+=" "+this.units[t].prefix.name+this.units[t].unit.name,Math.abs(this.units[t].power-1)>1e-15&&(e+="^"+this.units[t].power)):this.units[t].power<0&&a++;if(a>0)for(var s=0;s<this.units.length;s++)this.units[s].power<0&&(n>0?(i+=" "+this.units[s].prefix.name+this.units[s].unit.name,Math.abs(this.units[s].power+1)>1e-15&&(i+="^"+-this.units[s].power)):(i+=" "+this.units[s].prefix.name+this.units[s].unit.name,i+="^"+this.units[s].power));e=e.substr(1),i=i.substr(1),n>1&&a>0&&(e="("+e+")"),a>1&&n>0&&(i="("+i+")");var r=e;return n>0&&a>0&&(r+=" / "),r+=i},C.prototype.format=function(i){var n=this.skipAutomaticSimplification||null===this.value?this.clone():this.simplify(),a=!1;for(var t in void 0!==n.value&&null!==n.value&&e.isComplex(n.value)&&(a=Math.abs(n.value.re)<1e-14),n.units)n.units[t].unit&&("VA"===n.units[t].unit.name&&a?n.units[t].unit=V.VAR:"VAR"!==n.units[t].unit.name||a||(n.units[t].unit=V.VA));1!==n.units.length||n.fixPrefix||Math.abs(n.units[0].power-Math.round(n.units[0].power))<1e-14&&(n.units[0].prefix=n._bestPrefix());var s=n._denormalize(n.value),r=null!==n.value?S(s,i||{}):"",f=n.formatUnits();return n.value&&e.isComplex(n.value)&&(r="("+r+")"),f.length>0&&r.length>0&&(r+=" "),r+=f},C.prototype._bestPrefix=function(){if(1!==this.units.length)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");if(Math.abs(this.units[0].power-Math.round(this.units[0].power))>=1e-14)throw new Error("Can only compute the best prefix for single units with integer powers, like kg, s^2, N^-1, and so forth!");var e=null!==this.value?O(this.value):0,i=O(this.units[0].unit.value),n=this.units[0].prefix;if(0===e)return n;var a=this.units[0].power,t=Math.log(e/Math.pow(n.value*i,a))/Math.LN10-1.2;if(t>-2.200001&&t<1.800001)return n;t=Math.abs(t);var s=this.units[0].unit.prefixes;for(var r in s)if(s.hasOwnProperty(r)){var f=s[r];if(f.scientific){var o=Math.abs(Math.log(e/Math.pow(f.value*i,a))/Math.LN10-1.2);(o<t||o===t&&f.name.length<n.name.length)&&(n=f,t=o)}}return n},C.prototype.splitUnit=function(e){for(var i=this.clone(),n=[],a=0;a<e.length&&(i=i.to(e[a]),a!==e.length-1);a++){var t=i.toNumeric(),s=x(t),r=new C(d(s,t)?s:b(i.toNumeric()),e[a].toString());n.push(r),i=v(i,r)}for(var f=0,o=0;o<n.length;o++)f=p(f,n[o].value);return d(f,this.value)&&(i.value=0),n.push(i),n};var P={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},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}},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},deci:{name:"deci",value:.1,scientific:!1},centi:{name:"centi",value:.01,scientific:!1},milli:{name:"milli",value:.001,scientific:!0},micro:{name:"micro",value:1e-6,scientific:!0},nano:{name:"nano",value:1e-9,scientific:!0},pico:{name:"pico",value:1e-12,scientific:!0},femto:{name:"femto",value:1e-15,scientific:!0},atto:{name:"atto",value:1e-18,scientific:!0},zepto:{name:"zepto",value:1e-21,scientific:!0},yocto:{name:"yocto",value:1e-24,scientific:!0}},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},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}},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},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}},BINARY_SHORT_SI:{"":{name:"",value:1,scientific:!0},k:{name:"k",value:1e3,scientific:!0},M:{name:"M",value:1e6,scientific:!0},G:{name:"G",value:1e9,scientific:!0},T:{name:"T",value:1e12,scientific:!0},P:{name:"P",value:1e15,scientific:!0},E:{name:"E",value:1e18,scientific:!0},Z:{name:"Z",value:1e21,scientific:!0},Y:{name:"Y",value:1e24,scientific:!0}},BINARY_SHORT_IEC:{"":{name:"",value:1,scientific:!0},Ki:{name:"Ki",value:1024,scientific:!0},Mi:{name:"Mi",value:Math.pow(1024,2),scientific:!0},Gi:{name:"Gi",value:Math.pow(1024,3),scientific:!0},Ti:{name:"Ti",value:Math.pow(1024,4),scientific:!0},Pi:{name:"Pi",value:Math.pow(1024,5),scientific:!0},Ei:{name:"Ei",value:Math.pow(1024,6),scientific:!0},Zi:{name:"Zi",value:Math.pow(1024,7),scientific:!0},Yi:{name:"Yi",value:Math.pow(1024,8),scientific:!0}},BINARY_LONG_SI:{"":{name:"",value:1,scientific:!0},kilo:{name:"kilo",value:1e3,scientific:!0},mega:{name:"mega",value:1e6,scientific:!0},giga:{name:"giga",value:1e9,scientific:!0},tera:{name:"tera",value:1e12,scientific:!0},peta:{name:"peta",value:1e15,scientific:!0},exa:{name:"exa",value:1e18,scientific:!0},zetta:{name:"zetta",value:1e21,scientific:!0},yotta:{name:"yotta",value:1e24,scientific:!0}},BINARY_LONG_IEC:{"":{name:"",value:1,scientific:!0},kibi:{name:"kibi",value:1024,scientific:!0},mebi:{name:"mebi",value:Math.pow(1024,2),scientific:!0},gibi:{name:"gibi",value:Math.pow(1024,3),scientific:!0},tebi:{name:"tebi",value:Math.pow(1024,4),scientific:!0},pebi:{name:"pebi",value:Math.pow(1024,5),scientific:!0},exi:{name:"exi",value:Math.pow(1024,6),scientific:!0},zebi:{name:"zebi",value:Math.pow(1024,7),scientific:!0},yobi:{name:"yobi",value:Math.pow(1024,8),scientific:!0}},BTU:{"":{name:"",value:1,scientific:!0},MM:{name:"MM",value:1e6,scientific:!0}}};P.SHORTLONG=n(P.SHORT,P.LONG),P.BINARY_SHORT=n(P.BINARY_SHORT_SI,P.BINARY_SHORT_IEC),P.BINARY_LONG=n(P.BINARY_LONG_SI,P.BINARY_LONG_IEC);var k=["MASS","LENGTH","TIME","CURRENT","TEMPERATURE","LUMINOUS_INTENSITY","AMOUNT_OF_SUBSTANCE","ANGLE","BIT"],F={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 B in F)F[B].key=B;var q={name:"",base:{},value:1,offset:0,dimensions:k.map(function(e){return 0})},V={meter:{name:"meter",base:F.LENGTH,prefixes:P.LONG,value:1,offset:0},inch:{name:"inch",base:F.LENGTH,prefixes:P.NONE,value:.0254,offset:0},foot:{name:"foot",base:F.LENGTH,prefixes:P.NONE,value:.3048,offset:0},yard:{name:"yard",base:F.LENGTH,prefixes:P.NONE,value:.9144,offset:0},mile:{name:"mile",base:F.LENGTH,prefixes:P.NONE,value:1609.344,offset:0},link:{name:"link",base:F.LENGTH,prefixes:P.NONE,value:.201168,offset:0},rod:{name:"rod",base:F.LENGTH,prefixes:P.NONE,value:5.0292,offset:0},chain:{name:"chain",base:F.LENGTH,prefixes:P.NONE,value:20.1168,offset:0},angstrom:{name:"angstrom",base:F.LENGTH,prefixes:P.NONE,value:1e-10,offset:0},m:{name:"m",base:F.LENGTH,prefixes:P.SHORT,value:1,offset:0},in:{name:"in",base:F.LENGTH,prefixes:P.NONE,value:.0254,offset:0},ft:{name:"ft",base:F.LENGTH,prefixes:P.NONE,value:.3048,offset:0},yd:{name:"yd",base:F.LENGTH,prefixes:P.NONE,value:.9144,offset:0},mi:{name:"mi",base:F.LENGTH,prefixes:P.NONE,value:1609.344,offset:0},li:{name:"li",base:F.LENGTH,prefixes:P.NONE,value:.201168,offset:0},rd:{name:"rd",base:F.LENGTH,prefixes:P.NONE,value:5.02921,offset:0},ch:{name:"ch",base:F.LENGTH,prefixes:P.NONE,value:20.1168,offset:0},mil:{name:"mil",base:F.LENGTH,prefixes:P.NONE,value:254e-7,offset:0},m2:{name:"m2",base:F.SURFACE,prefixes:P.SQUARED,value:1,offset:0},sqin:{name:"sqin",base:F.SURFACE,prefixes:P.NONE,value:64516e-8,offset:0},sqft:{name:"sqft",base:F.SURFACE,prefixes:P.NONE,value:.09290304,offset:0},sqyd:{name:"sqyd",base:F.SURFACE,prefixes:P.NONE,value:.83612736,offset:0},sqmi:{name:"sqmi",base:F.SURFACE,prefixes:P.NONE,value:2589988.110336,offset:0},sqrd:{name:"sqrd",base:F.SURFACE,prefixes:P.NONE,value:25.29295,offset:0},sqch:{name:"sqch",base:F.SURFACE,prefixes:P.NONE,value:404.6873,offset:0},sqmil:{name:"sqmil",base:F.SURFACE,prefixes:P.NONE,value:6.4516e-10,offset:0},acre:{name:"acre",base:F.SURFACE,prefixes:P.NONE,value:4046.86,offset:0},hectare:{name:"hectare",base:F.SURFACE,prefixes:P.NONE,value:1e4,offset:0},m3:{name:"m3",base:F.VOLUME,prefixes:P.CUBIC,value:1,offset:0},L:{name:"L",base:F.VOLUME,prefixes:P.SHORT,value:.001,offset:0},l:{name:"l",base:F.VOLUME,prefixes:P.SHORT,value:.001,offset:0},litre:{name:"litre",base:F.VOLUME,prefixes:P.LONG,value:.001,offset:0},cuin:{name:"cuin",base:F.VOLUME,prefixes:P.NONE,value:16387064e-12,offset:0},cuft:{name:"cuft",base:F.VOLUME,prefixes:P.NONE,value:.028316846592,offset:0},cuyd:{name:"cuyd",base:F.VOLUME,prefixes:P.NONE,value:.764554857984,offset:0},teaspoon:{name:"teaspoon",base:F.VOLUME,prefixes:P.NONE,value:5e-6,offset:0},tablespoon:{name:"tablespoon",base:F.VOLUME,prefixes:P.NONE,value:15e-6,offset:0},drop:{name:"drop",base:F.VOLUME,prefixes:P.NONE,value:5e-8,offset:0},gtt:{name:"gtt",base:F.VOLUME,prefixes:P.NONE,value:5e-8,offset:0},minim:{name:"minim",base:F.VOLUME,prefixes:P.NONE,value:6.161152e-8,offset:0},fluiddram:{name:"fluiddram",base:F.VOLUME,prefixes:P.NONE,value:36966911e-13,offset:0},fluidounce:{name:"fluidounce",base:F.VOLUME,prefixes:P.NONE,value:2957353e-11,offset:0},gill:{name:"gill",base:F.VOLUME,prefixes:P.NONE,value:.0001182941,offset:0},cc:{name:"cc",base:F.VOLUME,prefixes:P.NONE,value:1e-6,offset:0},cup:{name:"cup",base:F.VOLUME,prefixes:P.NONE,value:.0002365882,offset:0},pint:{name:"pint",base:F.VOLUME,prefixes:P.NONE,value:.0004731765,offset:0},quart:{name:"quart",base:F.VOLUME,prefixes:P.NONE,value:.0009463529,offset:0},gallon:{name:"gallon",base:F.VOLUME,prefixes:P.NONE,value:.003785412,offset:0},beerbarrel:{name:"beerbarrel",base:F.VOLUME,prefixes:P.NONE,value:.1173478,offset:0},oilbarrel:{name:"oilbarrel",base:F.VOLUME,prefixes:P.NONE,value:.1589873,offset:0},hogshead:{name:"hogshead",base:F.VOLUME,prefixes:P.NONE,value:.238481,offset:0},fldr:{name:"fldr",base:F.VOLUME,prefixes:P.NONE,value:36966911e-13,offset:0},floz:{name:"floz",base:F.VOLUME,prefixes:P.NONE,value:2957353e-11,offset:0},gi:{name:"gi",base:F.VOLUME,prefixes:P.NONE,value:.0001182941,offset:0},cp:{name:"cp",base:F.VOLUME,prefixes:P.NONE,value:.0002365882,offset:0},pt:{name:"pt",base:F.VOLUME,prefixes:P.NONE,value:.0004731765,offset:0},qt:{name:"qt",base:F.VOLUME,prefixes:P.NONE,value:.0009463529,offset:0},gal:{name:"gal",base:F.VOLUME,prefixes:P.NONE,value:.003785412,offset:0},bbl:{name:"bbl",base:F.VOLUME,prefixes:P.NONE,value:.1173478,offset:0},obl:{name:"obl",base:F.VOLUME,prefixes:P.NONE,value:.1589873,offset:0},g:{name:"g",base:F.MASS,prefixes:P.SHORT,value:.001,offset:0},gram:{name:"gram",base:F.MASS,prefixes:P.LONG,value:.001,offset:0},ton:{name:"ton",base:F.MASS,prefixes:P.SHORT,value:907.18474,offset:0},tonne:{name:"tonne",base:F.MASS,prefixes:P.SHORT,value:1e3,offset:0},grain:{name:"grain",base:F.MASS,prefixes:P.NONE,value:6479891e-11,offset:0},dram:{name:"dram",base:F.MASS,prefixes:P.NONE,value:.0017718451953125,offset:0},ounce:{name:"ounce",base:F.MASS,prefixes:P.NONE,value:.028349523125,offset:0},poundmass:{name:"poundmass",base:F.MASS,prefixes:P.NONE,value:.45359237,offset:0},hundredweight:{name:"hundredweight",base:F.MASS,prefixes:P.NONE,value:45.359237,offset:0},stick:{name:"stick",base:F.MASS,prefixes:P.NONE,value:.115,offset:0},stone:{name:"stone",base:F.MASS,prefixes:P.NONE,value:6.35029318,offset:0},gr:{name:"gr",base:F.MASS,prefixes:P.NONE,value:6479891e-11,offset:0},dr:{name:"dr",base:F.MASS,prefixes:P.NONE,value:.0017718451953125,offset:0},oz:{name:"oz",base:F.MASS,prefixes:P.NONE,value:.028349523125,offset:0},lbm:{name:"lbm",base:F.MASS,prefixes:P.NONE,value:.45359237,offset:0},cwt:{name:"cwt",base:F.MASS,prefixes:P.NONE,value:45.359237,offset:0},s:{name:"s",base:F.TIME,prefixes:P.SHORT,value:1,offset:0},min:{name:"min",base:F.TIME,prefixes:P.NONE,value:60,offset:0},h:{name:"h",base:F.TIME,prefixes:P.NONE,value:3600,offset:0},second:{name:"second",base:F.TIME,prefixes:P.LONG,value:1,offset:0},sec:{name:"sec",base:F.TIME,prefixes:P.LONG,value:1,offset:0},minute:{name:"minute",base:F.TIME,prefixes:P.NONE,value:60,offset:0},hour:{name:"hour",base:F.TIME,prefixes:P.NONE,value:3600,offset:0},day:{name:"day",base:F.TIME,prefixes:P.NONE,value:86400,offset:0},week:{name:"week",base:F.TIME,prefixes:P.NONE,value:604800,offset:0},month:{name:"month",base:F.TIME,prefixes:P.NONE,value:2629800,offset:0},year:{name:"year",base:F.TIME,prefixes:P.NONE,value:31557600,offset:0},decade:{name:"decade",base:F.TIME,prefixes:P.NONE,value:315576e3,offset:0},century:{name:"century",base:F.TIME,prefixes:P.NONE,value:315576e4,offset:0},millennium:{name:"millennium",base:F.TIME,prefixes:P.NONE,value:315576e5,offset:0},hertz:{name:"Hertz",base:F.FREQUENCY,prefixes:P.LONG,value:1,offset:0,reciprocal:!0},Hz:{name:"Hz",base:F.FREQUENCY,prefixes:P.SHORT,value:1,offset:0,reciprocal:!0},rad:{name:"rad",base:F.ANGLE,prefixes:P.SHORT,value:1,offset:0},radian:{name:"radian",base:F.ANGLE,prefixes:P.LONG,value:1,offset:0},deg:{name:"deg",base:F.ANGLE,prefixes:P.SHORT,value:null,offset:0},degree:{name:"degree",base:F.ANGLE,prefixes:P.LONG,value:null,offset:0},grad:{name:"grad",base:F.ANGLE,prefixes:P.SHORT,value:null,offset:0},gradian:{name:"gradian",base:F.ANGLE,prefixes:P.LONG,value:null,offset:0},cycle:{name:"cycle",base:F.ANGLE,prefixes:P.NONE,value:null,offset:0},arcsec:{name:"arcsec",base:F.ANGLE,prefixes:P.NONE,value:null,offset:0},arcmin:{name:"arcmin",base:F.ANGLE,prefixes:P.NONE,value:null,offset:0},A:{name:"A",base:F.CURRENT,prefixes:P.SHORT,value:1,offset:0},ampere:{name:"ampere",base:F.CURRENT,prefixes:P.LONG,value:1,offset:0},K:{name:"K",base:F.TEMPERATURE,prefixes:P.NONE,value:1,offset:0},degC:{name:"degC",base:F.TEMPERATURE,prefixes:P.NONE,value:1,offset:273.15},degF:{name:"degF",base:F.TEMPERATURE,prefixes:P.NONE,value:1/1.8,offset:459.67},degR:{name:"degR",base:F.TEMPERATURE,prefixes:P.NONE,value:1/1.8,offset:0},kelvin:{name:"kelvin",base:F.TEMPERATURE,prefixes:P.NONE,value:1,offset:0},celsius:{name:"celsius",base:F.TEMPERATURE,prefixes:P.NONE,value:1,offset:273.15},fahrenheit:{name:"fahrenheit",base:F.TEMPERATURE,prefixes:P.NONE,value:1/1.8,offset:459.67},rankine:{name:"rankine",base:F.TEMPERATURE,prefixes:P.NONE,value:1/1.8,offset:0},mol:{name:"mol",base:F.AMOUNT_OF_SUBSTANCE,prefixes:P.SHORT,value:1,offset:0},mole:{name:"mole",base:F.AMOUNT_OF_SUBSTANCE,prefixes:P.LONG,value:1,offset:0},cd:{name:"cd",base:F.LUMINOUS_INTENSITY,prefixes:P.NONE,value:1,offset:0},candela:{name:"candela",base:F.LUMINOUS_INTENSITY,prefixes:P.NONE,value:1,offset:0},N:{name:"N",base:F.FORCE,prefixes:P.SHORT,value:1,offset:0},newton:{name:"newton",base:F.FORCE,prefixes:P.LONG,value:1,offset:0},dyn:{name:"dyn",base:F.FORCE,prefixes:P.SHORT,value:1e-5,offset:0},dyne:{name:"dyne",base:F.FORCE,prefixes:P.LONG,value:1e-5,offset:0},lbf:{name:"lbf",base:F.FORCE,prefixes:P.NONE,value:4.4482216152605,offset:0},poundforce:{name:"poundforce",base:F.FORCE,prefixes:P.NONE,value:4.4482216152605,offset:0},kip:{name:"kip",base:F.FORCE,prefixes:P.LONG,value:4448.2216,offset:0},J:{name:"J",base:F.ENERGY,prefixes:P.SHORT,value:1,offset:0},joule:{name:"joule",base:F.ENERGY,prefixes:P.SHORT,value:1,offset:0},erg:{name:"erg",base:F.ENERGY,prefixes:P.NONE,value:1e-7,offset:0},Wh:{name:"Wh",base:F.ENERGY,prefixes:P.SHORT,value:3600,offset:0},BTU:{name:"BTU",base:F.ENERGY,prefixes:P.BTU,value:1055.05585262,offset:0},eV:{name:"eV",base:F.ENERGY,prefixes:P.SHORT,value:1.602176565e-19,offset:0},electronvolt:{name:"electronvolt",base:F.ENERGY,prefixes:P.LONG,value:1.602176565e-19,offset:0},W:{name:"W",base:F.POWER,prefixes:P.SHORT,value:1,offset:0},watt:{name:"watt",base:F.POWER,prefixes:P.LONG,value:1,offset:0},hp:{name:"hp",base:F.POWER,prefixes:P.NONE,value:745.6998715386,offset:0},VAR:{name:"VAR",base:F.POWER,prefixes:P.SHORT,value:y.I,offset:0},VA:{name:"VA",base:F.POWER,prefixes:P.SHORT,value:1,offset:0},Pa:{name:"Pa",base:F.PRESSURE,prefixes:P.SHORT,value:1,offset:0},psi:{name:"psi",base:F.PRESSURE,prefixes:P.NONE,value:6894.75729276459,offset:0},atm:{name:"atm",base:F.PRESSURE,prefixes:P.NONE,value:101325,offset:0},bar:{name:"bar",base:F.PRESSURE,prefixes:P.SHORTLONG,value:1e5,offset:0},torr:{name:"torr",base:F.PRESSURE,prefixes:P.NONE,value:133.322,offset:0},mmHg:{name:"mmHg",base:F.PRESSURE,prefixes:P.NONE,value:133.322,offset:0},mmH2O:{name:"mmH2O",base:F.PRESSURE,prefixes:P.NONE,value:9.80665,offset:0},cmH2O:{name:"cmH2O",base:F.PRESSURE,prefixes:P.NONE,value:98.0665,offset:0},coulomb:{name:"coulomb",base:F.ELECTRIC_CHARGE,prefixes:P.LONG,value:1,offset:0},C:{name:"C",base:F.ELECTRIC_CHARGE,prefixes:P.SHORT,value:1,offset:0},farad:{name:"farad",base:F.ELECTRIC_CAPACITANCE,prefixes:P.LONG,value:1,offset:0},F:{name:"F",base:F.ELECTRIC_CAPACITANCE,prefixes:P.SHORT,value:1,offset:0},volt:{name:"volt",base:F.ELECTRIC_POTENTIAL,prefixes:P.LONG,value:1,offset:0},V:{name:"V",base:F.ELECTRIC_POTENTIAL,prefixes:P.SHORT,value:1,offset:0},ohm:{name:"ohm",base:F.ELECTRIC_RESISTANCE,prefixes:P.SHORTLONG,value:1,offset:0},henry:{name:"henry",base:F.ELECTRIC_INDUCTANCE,prefixes:P.LONG,value:1,offset:0},H:{name:"H",base:F.ELECTRIC_INDUCTANCE,prefixes:P.SHORT,value:1,offset:0},siemens:{name:"siemens",base:F.ELECTRIC_CONDUCTANCE,prefixes:P.LONG,value:1,offset:0},S:{name:"S",base:F.ELECTRIC_CONDUCTANCE,prefixes:P.SHORT,value:1,offset:0},weber:{name:"weber",base:F.MAGNETIC_FLUX,prefixes:P.LONG,value:1,offset:0},Wb:{name:"Wb",base:F.MAGNETIC_FLUX,prefixes:P.SHORT,value:1,offset:0},tesla:{name:"tesla",base:F.MAGNETIC_FLUX_DENSITY,prefixes:P.LONG,value:1,offset:0},T:{name:"T",base:F.MAGNETIC_FLUX_DENSITY,prefixes:P.SHORT,value:1,offset:0},b:{name:"b",base:F.BIT,prefixes:P.BINARY_SHORT,value:1,offset:0},bits:{name:"bits",base:F.BIT,prefixes:P.BINARY_LONG,value:1,offset:0},B:{name:"B",base:F.BIT,prefixes:P.BINARY_SHORT,value:8,offset:0},bytes:{name:"bytes",base:F.BIT,prefixes:P.BINARY_LONG,value:8,offset:0}},Y={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",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",coulombs:"coulomb",volts:"volt",ohms:"ohm",farads:"farad",webers:"weber",teslas:"tesla",electronvolts:"electronvolt",moles:"mole"};function z(i){if("BigNumber"===i.number){var n=s.pi(e.BigNumber);V.rad.value=new e.BigNumber(1),V.deg.value=n.div(180),V.grad.value=n.div(200),V.cycle.value=n.times(2),V.arcsec.value=n.div(648e3),V.arcmin.value=n.div(10800)}else V.rad.value=1,V.deg.value=Math.PI/180,V.grad.value=Math.PI/200,V.cycle.value=2*Math.PI,V.arcsec.value=Math.PI/648e3,V.arcmin.value=Math.PI/10800;V.radian.value=V.rad.value,V.degree.value=V.deg.value,V.gradian.value=V.grad.value}z(r),u.on("config",function(e,i){e.number!==i.number&&z(e)});var D={si:{NONE:{unit:q,prefix:P.NONE[""]},LENGTH:{unit:V.m,prefix:P.SHORT[""]},MASS:{unit:V.g,prefix:P.SHORT.k},TIME:{unit:V.s,prefix:P.SHORT[""]},CURRENT:{unit:V.A,prefix:P.SHORT[""]},TEMPERATURE:{unit:V.K,prefix:P.SHORT[""]},LUMINOUS_INTENSITY:{unit:V.cd,prefix:P.SHORT[""]},AMOUNT_OF_SUBSTANCE:{unit:V.mol,prefix:P.SHORT[""]},ANGLE:{unit:V.rad,prefix:P.SHORT[""]},BIT:{unit:V.bit,prefix:P.SHORT[""]},FORCE:{unit:V.N,prefix:P.SHORT[""]},ENERGY:{unit:V.J,prefix:P.SHORT[""]},POWER:{unit:V.W,prefix:P.SHORT[""]},PRESSURE:{unit:V.Pa,prefix:P.SHORT[""]},ELECTRIC_CHARGE:{unit:V.C,prefix:P.SHORT[""]},ELECTRIC_CAPACITANCE:{unit:V.F,prefix:P.SHORT[""]},ELECTRIC_POTENTIAL:{unit:V.V,prefix:P.SHORT[""]},ELECTRIC_RESISTANCE:{unit:V.ohm,prefix:P.SHORT[""]},ELECTRIC_INDUCTANCE:{unit:V.H,prefix:P.SHORT[""]},ELECTRIC_CONDUCTANCE:{unit:V.S,prefix:P.SHORT[""]},MAGNETIC_FLUX:{unit:V.Wb,prefix:P.SHORT[""]},MAGNETIC_FLUX_DENSITY:{unit:V.T,prefix:P.SHORT[""]},FREQUENCY:{unit:V.Hz,prefix:P.SHORT[""]}}};D.cgs=JSON.parse(JSON.stringify(D.si)),D.cgs.LENGTH={unit:V.m,prefix:P.SHORT.c},D.cgs.MASS={unit:V.g,prefix:P.SHORT[""]},D.cgs.FORCE={unit:V.dyn,prefix:P.SHORT[""]},D.cgs.ENERGY={unit:V.erg,prefix:P.NONE[""]},D.us=JSON.parse(JSON.stringify(D.si)),D.us.LENGTH={unit:V.ft,prefix:P.NONE[""]},D.us.MASS={unit:V.lbm,prefix:P.NONE[""]},D.us.TEMPERATURE={unit:V.degF,prefix:P.NONE[""]},D.us.FORCE={unit:V.lbf,prefix:P.NONE[""]},D.us.ENERGY={unit:V.BTU,prefix:P.BTU[""]},D.us.POWER={unit:V.hp,prefix:P.NONE[""]},D.us.PRESSURE={unit:V.psi,prefix:P.NONE[""]},D.auto=JSON.parse(JSON.stringify(D.si));var W=D.auto;for(var j in C.setUnitSystem=function(e){if(!D.hasOwnProperty(e))throw new Error("Unit system "+e+" does not exist. Choices are: "+Object.keys(D).join(", "));W=D[e]},C.getUnitSystem=function(){for(var e in D)if(D[e]===W)return e},C.typeConverters={BigNumber:function(i){return new e.BigNumber(i+"")},Fraction:function(i){return new e.Fraction(i)},Complex:function(e){return e},number:function(e){return e}},C._getNumberConverter=function(e){if(!C.typeConverters[e])throw new TypeError('Unsupported type "'+e+'"');return C.typeConverters[e]},V){var J=V[j];J.dimensions=J.base.dimensions}for(var Z in Y)if(Y.hasOwnProperty(Z)){var X=V[Y[Z]],Q={};for(var K in X)X.hasOwnProperty(K)&&(Q[K]=X[K]);Q.name=Z,V[Z]=Q}return C.createUnit=function(e,n){if("object"!==i(e))throw new TypeError("createUnit expects first parameter to be of type 'Object'");if(n&&n.override)for(var a in e)if(e.hasOwnProperty(a)&&C.deleteUnit(a),e[a].aliases)for(var t=0;t<e[a].aliases.length;t++)C.deleteUnit(e[a].aliases[t]);var s;for(var r in e)e.hasOwnProperty(r)&&(s=C.createUnitSingle(r,e[r]));return s},C.createUnitSingle=function(e,n,a){if(null==n&&(n={}),"string"!=typeof e)throw new TypeError("createUnitSingle expects first parameter to be of type 'string'");if(V.hasOwnProperty(e))throw new Error('Cannot create unit "'+e+'": a unit with that name already exists');!function(e){for(var i=0;i<e.length;i++){var n=e.charAt(i),a=function(e){return/^[a-zA-Z]$/.test(e)};if(0===i&&!a(n))throw new Error('Invalid unit name (must begin with alpha character): "'+e+'"');if(i>0&&!(a(n)||(t=n,t>="0"&&t<="9")))throw new Error('Invalid unit name (only alphanumeric characters are allowed): "'+e+'"')}var t}(e);var t,s,r=null,f=[],o=0;if(n&&"Unit"===n.type)r=n.clone();else if("string"==typeof n)""!==n&&(t=n);else{if("object"!==i(n))throw new TypeError('Cannot create unit "'+e+'" from "'+n.toString()+'": expecting "string" or "Unit" or "Object"');t=n.definition,s=n.prefixes,o=n.offset,n.aliases&&(f=n.aliases.valueOf())}if(f)for(var u=0;u<f.length;u++)if(V.hasOwnProperty(f[u]))throw new Error('Cannot create alias "'+f[u]+'": a unit with that name already exists');if(t&&"string"==typeof t&&!r)try{r=C.parse(t,{allowNoUnits:!0})}catch(g){throw g.message='Could not create unit "'+e+'" from "'+t+'": '+g.message,g}else t&&"Unit"===t.type&&(r=t.clone());f=f||[],o=o||0,s=s&&s.toUpperCase&&P[s.toUpperCase()]||P.NONE;var l={};if(r){l={name:e,value:r.value,dimensions:r.dimensions.slice(0),prefixes:s,offset:o};var m=!1;for(var c in F)if(F.hasOwnProperty(c)){for(var p=!0,v=0;v<k.length;v++)if(Math.abs((l.dimensions[v]||0)-(F[c].dimensions[v]||0))>1e-12){p=!1;break}if(p){m=!0,l.base=F[c];break}}if(!m){var E=e+"_STUFF",N={dimensions:r.dimensions.slice(0)};N.key=E,F[E]=N,W[E]={unit:l,prefix:P.NONE[""]},l.base=F[E]}}else{var h=e+"_STUFF";if(k.indexOf(h)>=0)throw new Error('Cannot create new base unit "'+e+'": a base unit with that name already exists (and cannot be overridden)');for(var O in k.push(h),F)F.hasOwnProperty(O)&&(F[O].dimensions[k.length-1]=0);for(var b={dimensions:[]},x=0;x<k.length;x++)b.dimensions[x]=0;b.dimensions[k.length-1]=1,b.key=h,F[h]=b,l={name:e,value:1,dimensions:F[h].dimensions.slice(0),prefixes:s,offset:o,base:F[h]},W[h]={unit:l,prefix:P.NONE[""]}}C.UNITS[e]=l;for(var d=0;d<f.length;d++){var T=f[d],S={};for(var R in l)l.hasOwnProperty(R)&&(S[R]=l[R]);S.name=T,C.UNITS[T]=S}return new C(null,e)},C.deleteUnit=function(e){delete C.UNITS[e]},C.PREFIXES=P,C.BASE_DIMENSIONS=k,C.BASE_UNITS=F,C.UNIT_SYSTEMS=D,C.UNITS=V,C}exports.name="Unit",exports.path="type",exports.factory=r,exports.math=!0;
},{"../../utils/string":"PshC","../../utils/object":"FcSp","../../utils/bignumber/constants":"JQPe","../../function/arithmetic/addScalar":"ZM3O","../../function/arithmetic/subtract":"m78R","../../function/arithmetic/multiplyScalar":"obRw","../../function/arithmetic/divideScalar":"R3aq","../../function/arithmetic/pow":"CsUv","../../function/arithmetic/abs":"K5X1","../../function/arithmetic/fix":"Pk2X","../../function/arithmetic/round":"f25u","../../function/relational/equal":"IviB","../../function/utils/isNumeric":"Rv38","../../function/string/format":"A04Q","../../function/utils/typeof":"LZTG","../../type/number":"lESm","../../type/complex/Complex":"dh9O"}],"plO6":[function(require,module,exports) {
"use strict";var t=require("../../../utils/collection/deepMap");function n(n,r,e,i){var u=i("unit",{Unit:function(t){return t.clone()},string:function(t){return n.Unit.isValuelessUnit(t)?new n.Unit(null,t):n.Unit.parse(t,{allowNoUnits:!0})},"number | BigNumber | Fraction | Complex, string":function(t,r){return new n.Unit(t,r)},"Array | Matrix":function(n){return t(n,u)}});return u.toTex={1:"\\left(${args[0]}\\right)",2:"\\left(\\left(${args[0]}\\right)${args[1]}\\right)"},u}exports.name="unit",exports.factory=n;
},{"../../../utils/collection/deepMap":"lOYo"}],"uOlB":[function(require,module,exports) {
"use strict";function t(t,n,r,e){return e("createUnit",{"Object, Object":function(n,r){return t.Unit.createUnit(n,r)},Object:function(n){return t.Unit.createUnit(n,{})},"string, Unit | string | Object, Object":function(n,r,e){var i={};return i[n]=r,t.Unit.createUnit(i,e)},"string, Unit | string | Object":function(n,r){var e={};return e[n]=r,t.Unit.createUnit(e,{})},string:function(n){var r={};return r[n]={},t.Unit.createUnit(r,{})}})}exports.name="createUnit",exports.factory=t;
},{}],"PBZa":[function(require,module,exports) {
"use strict";function t(t,n,i,r){return r("splitUnit",{"Unit, Array":function(t,n){return t.splitUnit(n)}})}exports.name="splitUnit",exports.factory=t;
},{}],"OfMK":[function(require,module,exports) {
"use strict";var n=require("../../utils/object").lazy;function t(n,t,e,u,o){function i(t){var r=n.Unit.parse(t);return r.fixPrefix=!0,r}r(o,"speedOfLight",function(){return i("299792458 m s^-1")}),r(o,"gravitationConstant",function(){return i("6.6738480e-11 m^3 kg^-1 s^-2")}),r(o,"planckConstant",function(){return i("6.626069311e-34 J s")}),r(o,"reducedPlanckConstant",function(){return i("1.05457172647e-34 J s")}),r(o,"magneticConstant",function(){return i("1.2566370614e-6 N A^-2")}),r(o,"electricConstant",function(){return i("8.854187817e-12 F m^-1")}),r(o,"vacuumImpedance",function(){return i("376.730313461 ohm")}),r(o,"coulomb",function(){return i("8.9875517873681764e9 N m^2 C^-2")}),r(o,"elementaryCharge",function(){return i("1.60217656535e-19 C")}),r(o,"bohrMagneton",function(){return i("9.2740096820e-24 J T^-1")}),r(o,"conductanceQuantum",function(){return i("7.748091734625e-5 S")}),r(o,"inverseConductanceQuantum",function(){return i("12906.403721742 ohm")}),r(o,"magneticFluxQuantum",function(){return i("2.06783375846e-15 Wb")}),r(o,"nuclearMagneton",function(){return i("5.0507835311e-27 J T^-1")}),r(o,"klitzing",function(){return i("25812.807443484 ohm")}),r(o,"bohrRadius",function(){return i("5.291772109217e-11 m")}),r(o,"classicalElectronRadius",function(){return i("2.817940326727e-15 m")}),r(o,"electronMass",function(){return i("9.1093829140e-31 kg")}),r(o,"fermiCoupling",function(){return i("1.1663645e-5 GeV^-2")}),r(o,"fineStructure",function(){return.007297352569824}),r(o,"hartreeEnergy",function(){return i("4.3597443419e-18 J")}),r(o,"protonMass",function(){return i("1.67262177774e-27 kg")}),r(o,"deuteronMass",function(){return i("3.3435830926e-27 kg")}),r(o,"neutronMass",function(){return i("1.6749271613e-27 kg")}),r(o,"quantumOfCirculation",function(){return i("3.636947552024e-4 m^2 s^-1")}),r(o,"rydberg",function(){return i("10973731.56853955 m^-1")}),r(o,"thomsonCrossSection",function(){return i("6.65245873413e-29 m^2")}),r(o,"weakMixingAngle",function(){return.222321}),r(o,"efimovFactor",function(){return 22.7}),r(o,"atomicMass",function(){return i("1.66053892173e-27 kg")}),r(o,"avogadro",function(){return i("6.0221412927e23 mol^-1")}),r(o,"boltzmann",function(){return i("1.380648813e-23 J K^-1")}),r(o,"faraday",function(){return i("96485.336521 C mol^-1")}),r(o,"firstRadiation",function(){return i("3.7417715317e-16 W m^2")}),r(o,"loschmidt",function(){return i("2.686780524e25 m^-3")}),r(o,"gasConstant",function(){return i("8.314462175 J K^-1 mol^-1")}),r(o,"molarPlanckConstant",function(){return i("3.990312717628e-10 J s mol^-1")}),r(o,"molarVolume",function(){return i("2.241396820e-10 m^3 mol^-1")}),r(o,"sackurTetrode",function(){return-1.164870823}),r(o,"secondRadiation",function(){return i("1.438777013e-2 m K")}),r(o,"stefanBoltzmann",function(){return i("5.67037321e-8 W m^-2 K^-4")}),r(o,"wienDisplacement",function(){return i("2.897772126e-3 m K")}),r(o,"molarMass",function(){return i("1e-3 kg mol^-1")}),r(o,"molarMassC12",function(){return i("1.2e-2 kg mol^-1")}),r(o,"gravity",function(){return i("9.80665 m s^-2")}),r(o,"planckLength",function(){return i("1.61619997e-35 m")}),r(o,"planckMass",function(){return i("2.1765113e-8 kg")}),r(o,"planckTime",function(){return i("5.3910632e-44 s")}),r(o,"planckCharge",function(){return i("1.87554595641e-18 C")}),r(o,"planckTemperature",function(){return i("1.41683385e+32 K")})}function r(t,r,e){n(t,r,e),n(t.expression.mathWithTransform,r,e)}exports.factory=t,exports.lazy=!1,exports.math=!0;
},{"../../utils/object":"FcSp"}],"NhzN":[function(require,module,exports) {
"use strict";module.exports=[require("./Unit"),require("./function/unit"),require("./function/createUnit"),require("./function/splitUnit"),require("./physicalConstants")];
},{"./Unit":"zikE","./function/unit":"plO6","./function/createUnit":"uOlB","./function/splitUnit":"PBZa","./physicalConstants":"OfMK"}],"And3":[function(require,module,exports) {
"use strict";module.exports=[require("./bignumber"),require("./boolean"),require("./chain"),require("./complex"),require("./fraction"),require("./matrix"),require("./number"),require("./numeric"),require("./resultset"),require("./string"),require("./unit")];
},{"./bignumber":"glkd","./boolean":"ff5w","./chain":"YdmQ","./complex":"Oad0","./fraction":"sfyz","./matrix":"Xhzw","./number":"lESm","./numeric":"aA7E","./resultset":"seRb","./string":"QilD","./unit":"NhzN"}],"gliU":[function(require,module,exports) {
"use strict";module.exports="5.10.3";
},{}],"GTWZ":[function(require,module,exports) {
"use strict";var n=require("./utils/object"),e=require("./utils/bignumber/constants");function i(n,u,o,a,N){N.on("config",function(e,r){e.number!==r.number&&i(n,u,o,a,N)}),r(N,"true",!0),r(N,"false",!1),r(N,"null",null),r(N,"uninitialized","Error: Constant uninitialized is removed since v4.0.0. Use null instead"),"BigNumber"===u.number?(r(N,"Infinity",new n.BigNumber(1/0)),r(N,"NaN",new n.BigNumber(NaN)),t(N,"pi",function(){return e.pi(n.BigNumber)}),t(N,"tau",function(){return e.tau(n.BigNumber)}),t(N,"e",function(){return e.e(n.BigNumber)}),t(N,"phi",function(){return e.phi(n.BigNumber)}),t(N,"E",function(){return N.e}),t(N,"LN2",function(){return new n.BigNumber(2).ln()}),t(N,"LN10",function(){return new n.BigNumber(10).ln()}),t(N,"LOG2E",function(){return new n.BigNumber(1).div(new n.BigNumber(2).ln())}),t(N,"LOG10E",function(){return new n.BigNumber(1).div(new n.BigNumber(10).ln())}),t(N,"PI",function(){return N.pi}),t(N,"SQRT1_2",function(){return new n.BigNumber("0.5").sqrt()}),t(N,"SQRT2",function(){return new n.BigNumber(2).sqrt()})):(r(N,"Infinity",1/0),r(N,"NaN",NaN),r(N,"pi",Math.PI),r(N,"tau",2*Math.PI),r(N,"e",Math.E),r(N,"phi",1.618033988749895),r(N,"E",N.e),r(N,"LN2",Math.LN2),r(N,"LN10",Math.LN10),r(N,"LOG2E",Math.LOG2E),r(N,"LOG10E",Math.LOG10E),r(N,"PI",N.pi),r(N,"SQRT1_2",Math.SQRT1_2),r(N,"SQRT2",Math.SQRT2)),n.Complex&&r(N,"i",n.Complex.I),r(N,"version",require("./version"))}function r(n,e,i){n[e]=i,n.expression.mathWithTransform[e]=i}function t(e,i,r){n.lazy(e,i,r),n.lazy(e.expression.mathWithTransform,i,r)}exports.factory=i,exports.lazy=!1,exports.math=!0;
},{"./utils/object":"FcSp","./utils/bignumber/constants":"JQPe","./version":"gliU"}],"PAPk":[function(require,module,exports) {
"use strict";function t(o){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(o)}function o(r){return(o="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(o){return t(o)}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":t(o)})(r)}var r=require("./object").hasOwnProperty;function e(t,o){if(p(t)&&c(t,o))return t[o];if("function"==typeof t[o]&&f(t,o))throw new Error('Cannot access method "'+o+'" as a property');throw new Error('No access to property "'+o+'"')}function n(t,o,r){if(p(t)&&c(t,o))return t[o]=r,r;throw new Error('No access to property "'+o+'"')}function c(t,e){return!(!t||"object"!==o(t))&&(!!r(y,e)||!(e in Object.prototype)&&!(e in Function.prototype))}function i(t,o){if(!f(t,o))throw new Error('No access to method "'+o+'"')}function f(t,o){return!(!t||"function"!=typeof t[o])&&(!(r(t,o)&&Object.getPrototypeOf&&o in Object.getPrototypeOf(t))&&(!!r(u,o)||!(o in Object.prototype)&&!(o in Function.prototype)))}function p(t){return"object"===o(t)&&t&&t.constructor===Object}var y={length:!0,name:!0},u={toString:!0,valueOf:!0,toLocaleString:!0};exports.getSafeProperty=e,exports.setSafeProperty=n,exports.isSafeProperty=c,exports.validateSafeMethod=i,exports.isSafeMethod=f,exports.isPlainObject=p;
},{"./object":"FcSp"}],"psm5":[function(require,module,exports) {
"use strict";module.exports={end:!0};
},{}],"dnbo":[function(require,module,exports) {
"use strict";function t(o){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(o)}function o(e){return(o="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(o){return t(o)}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":t(o)})(e)}var e=require("../keywords"),r=require("../../utils/object").deepEqual,n=require("../../utils/object").hasOwnProperty;function i(t,i,c,p,u){function a(){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator")}return a.prototype.eval=function(t){return this.compile().eval(t)},a.prototype.type="Node",a.prototype.isNode=!0,a.prototype.comment="",a.prototype.compile=function(){var t=this._compile(u.expression.mathWithTransform,{}),o={};return{eval:function(r){var i=r||{};return function(t){for(var o in t)if(n(t,o)&&o in e)throw new Error('Scope contains an illegal symbol, "'+o+'" is a reserved keyword')}(i),t(i,o,null)}}},a.prototype._compile=function(t,o){throw new Error("Method _compile should be implemented by type "+this.type)},a.prototype.forEach=function(t){throw new Error("Cannot run forEach on a Node interface")},a.prototype.map=function(t){throw new Error("Cannot run map on a Node interface")},a.prototype._ifNode=function(o){if(!t.isNode(o))throw new TypeError("Callback function must return a Node");return o},a.prototype.traverse=function(t){t(this,null,null),function t(o,e){o.forEach(function(o,r,n){e(o,r,n),t(o,e)})}(this,t)},a.prototype.transform=function(t){return function t(o,e){return o.map(function(o,r,n){return t(e(o,r,n),e)})}(t(this,null,null),t)},a.prototype.filter=function(t){var o=[];return this.traverse(function(e,r,n){t(e,r,n)&&o.push(e)}),o},a.prototype.find=function(){throw new Error("Function Node.find is deprecated. Use Node.filter instead.")},a.prototype.match=function(){throw new Error("Function Node.match is deprecated. See functions Node.filter, Node.transform, Node.traverse.")},a.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},a.prototype.cloneDeep=function(){return this.map(function(t){return t.cloneDeep()})},a.prototype.equals=function(t){return!!t&&r(this,t)},a.prototype.toString=function(t){var e;if(t&&"object"===o(t))switch(o(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toString(t)},a.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},a.prototype.toHTML=function(t){var e;if(t&&"object"===o(t))switch(o(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this.toHTML(t)},a.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},a.prototype.toTex=function(t){var e;if(t&&"object"===o(t))switch(o(t.handler)){case"object":case"undefined":break;case"function":e=t.handler(this,t);break;default:throw new TypeError("Object or function expected as callback")}return void 0!==e?e:this._toTex(t)},a.prototype._toTex=function(t){throw new Error("_toTex not implemented for "+this.type)},a.prototype.getIdentifier=function(){return this.type},a.prototype.getContent=function(){return this},a}exports.name="Node",exports.path="expression.node",exports.math=!0,exports.factory=i;
},{"../keywords":"psm5","../../utils/object":"FcSp"}],"Bjol":[function(require,module,exports) {
"use strict";var r=require("../../error/IndexError");exports.transform=function(e){return e&&e.isIndexError?new r(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e};
},{"../../error/IndexError":"tfOV"}],"ZWbZ":[function(require,module,exports) {
"use strict";var e=require("../../utils/object").clone,r=require("../../utils/array").validateIndex,n=require("../../utils/customs").getSafeProperty,t=require("../../utils/customs").setSafeProperty,i=require("../../error/DimensionError");function o(n,t,o,u){var f=o(require("../../type/matrix/function/matrix")),c=u("subset",{"Array, Index":function(e,r){var n=f(e).subset(r);return r.isScalar()?n:n.valueOf()},"Matrix, Index":function(e,r){return e.subset(r)},"Object, Index":s,"string, Index":function(e,t){if(!n.isIndex(t))throw new TypeError("Index expected");if(1!==t.size().length)throw new i(t.size().length,1);var o=e.length;r(t.min()[0],o),r(t.max()[0],o);var s=t.dimension(0),a="";return s.forEach(function(r){a+=e.charAt(r)}),a},"Array, Index, any":function(r,n,t){return f(e(r)).subset(n,t,void 0).valueOf()},"Array, Index, any, any":function(r,n,t,i){return f(e(r)).subset(n,t,i).valueOf()},"Matrix, Index, any":function(e,r,n){return e.clone().subset(r,n)},"Matrix, Index, any, any":function(e,r,n,t){return e.clone().subset(r,n,t)},"string, Index, string":x,"string, Index, string, string":x,"Object, Index, any":a});return c.toTex=void 0,c;function x(e,n,t,o){if(!n||!0!==n.isIndex)throw new TypeError("Index expected");if(1!==n.size().length)throw new i(n.size().length,1);if(void 0!==o){if("string"!=typeof o||1!==o.length)throw new TypeError("Single character expected as defaultValue")}else o=" ";var s=n.dimension(0);if(s.size()[0]!==t.length)throw new i(s.size()[0],t.length);var a=e.length;r(n.min()[0]),r(n.max()[0]);for(var u=[],f=0;f<a;f++)u[f]=e.charAt(f);if(s.forEach(function(e,r){u[e]=t.charAt(r[0])}),u.length>a)for(var c=a-1,x=u.length;c<x;c++)u[c]||(u[c]=o);return u.join("")}}function s(e,r){if(1!==r.size().length)throw new i(r.size(),1);var t=r.dimension(0);if("string"!=typeof t)throw new TypeError("String expected as index to retrieve an object property");return n(e,t)}function a(r,n,o){if(1!==n.size().length)throw new i(n.size(),1);var s=n.dimension(0);if("string"!=typeof s)throw new TypeError("String expected as index to retrieve an object property");var a=e(r);return t(a,s,o),a}exports.name="subset",exports.factory=o;
},{"../../utils/object":"FcSp","../../utils/array":"j2lF","../../utils/customs":"PAPk","../../error/DimensionError":"YiAw","../../type/matrix/function/matrix":"vzj5"}],"oT9r":[function(require,module,exports) {
"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function r(o){return(r="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(r){return t(r)}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":t(r)})(o)}var o=require("../../transform/error.transform").transform,e=require("../../../utils/customs").getSafeProperty;function n(t,n,u,y){var f=u(require("../../../function/matrix/subset"));return function(t,n){try{if(Array.isArray(t))return f(t,n);if(t&&"function"==typeof t.subset)return t.subset(n);if("string"==typeof t)return f(t,n);if("object"===r(t)){if(!n.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return e(t,n.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(u){throw o(u)}}}exports.factory=n;
},{"../../transform/error.transform":"Bjol","../../../utils/customs":"PAPk","../../../function/matrix/subset":"ZWbZ"}],"vZNf":[function(require,module,exports) {
"use strict";var t=require("../../utils/customs").getSafeProperty;function e(e,o,r,i){var n=r(require("./Node")),s=r(require("./utils/access"));function c(t,o){if(!(this instanceof c))throw new SyntaxError("Constructor must be called with the new operator");if(!e.isNode(t))throw new TypeError('Node expected for parameter "object"');if(!e.isIndexNode(o))throw new TypeError('IndexNode expected for parameter "index"');this.object=t||null,this.index=o,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function h(t){return!(e.isAccessorNode(t)||e.isArrayNode(t)||e.isConstantNode(t)||e.isFunctionNode(t)||e.isObjectNode(t)||e.isParenthesisNode(t)||e.isSymbolNode(t))}return c.prototype=new n,c.prototype.type="AccessorNode",c.prototype.isAccessorNode=!0,c.prototype._compile=function(e,o){var r=this.object._compile(e,o),i=this.index._compile(e,o);if(this.index.isObjectProperty()){var n=this.index.getObjectProperty();return function(e,o,i){return t(r(e,o,i),n)}}return function(t,e,o){var n=r(t,e,o),c=i(t,e,n);return s(n,c)}},c.prototype.forEach=function(t){t(this.object,"object",this),t(this.index,"index",this)},c.prototype.map=function(t){return new c(this._ifNode(t(this.object,"object",this)),this._ifNode(t(this.index,"index",this)))},c.prototype.clone=function(){return new c(this.object,this.index)},c.prototype._toString=function(t){var e=this.object.toString(t);return h(this.object)&&(e="("+e+")"),e+this.index.toString(t)},c.prototype.toHTML=function(t){var e=this.object.toHTML(t);return h(this.object)&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+this.index.toHTML(t)},c.prototype._toTex=function(t){var e=this.object.toTex(t);return h(this.object)&&(e="\\left(' + object + '\\right)"),e+this.index.toTex(t)},c.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},c.fromJSON=function(t){return new c(t.object,t.index)},c}exports.name="AccessorNode",exports.path="expression.node",exports.factory=e;
},{"../../utils/customs":"PAPk","./Node":"dnbo","./utils/access":"oT9r"}],"onTs":[function(require,module,exports) {
"use strict";var t=require("../../utils/array").map;function r(r,e,n,i){var o=n(require("./Node"));function s(t){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=t||[],!Array.isArray(this.items)||!this.items.every(r.isNode))throw new TypeError("Array containing Nodes expected");var e=function(){throw new Error("Property `ArrayNode.nodes` is deprecated, use `ArrayNode.items` instead")};Object.defineProperty(this,"nodes",{get:e,set:e})}return s.prototype=new o,s.prototype.type="ArrayNode",s.prototype.isArrayNode=!0,s.prototype._compile=function(r,e){var n=t(this.items,function(t){return t._compile(r,e)});if("Array"!==r.config().matrix){var i=r.matrix;return function(r,e,o){return i(t(n,function(t){return t(r,e,o)}))}}return function(r,e,i){return t(n,function(t){return t(r,e,i)})}},s.prototype.forEach=function(t){for(var r=0;r<this.items.length;r++){t(this.items[r],"items["+r+"]",this)}},s.prototype.map=function(t){for(var r=[],e=0;e<this.items.length;e++)r[e]=this._ifNode(t(this.items[e],"items["+e+"]",this));return new s(r)},s.prototype.clone=function(){return new s(this.items.slice(0))},s.prototype._toString=function(t){return"["+this.items.map(function(r){return r.toString(t)}).join(", ")+"]"},s.prototype.toJSON=function(){return{mathjs:"ArrayNode",items:this.items}},s.fromJSON=function(t){return new s(t.items)},s.prototype.toHTML=function(t){return'<span class="math-parenthesis math-square-parenthesis">[</span>'+this.items.map(function(r){return r.toHTML(t)}).join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},s.prototype._toTex=function(t){var r="\\begin{bmatrix}";return this.items.forEach(function(e){e.items?r+=e.items.map(function(r){return r.toTex(t)}).join("&"):r+=e.toTex(t),r+="\\\\"}),r+="\\end{bmatrix}"},s}exports.name="ArrayNode",exports.path="expression.node",exports.factory=r;
},{"../../utils/array":"j2lF","./Node":"dnbo"}],"ft5y":[function(require,module,exports) {
"use strict";function t(r){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(r)}function r(o){return(r="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(r){return t(r)}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":t(r)})(o)}var o=require("../../transform/error.transform").transform,e=require("../../../utils/customs").setSafeProperty;function n(t,n,u,y){var i=u(require("../../../function/matrix/subset")),f=u(require("../../../type/matrix/function/matrix"));return function(t,n,u){try{if(Array.isArray(t))return f(t).subset(n,u).valueOf();if(t&&"function"==typeof t.subset)return t.subset(n,u);if("string"==typeof t)return i(t,n,u);if("object"===r(t)){if(!n.isObjectProperty())throw TypeError("Cannot apply a numeric index as object property");return e(t,n.getObjectProperty(),u),t}throw new TypeError("Cannot apply index: unsupported type of object")}catch(y){throw o(y)}}}exports.factory=n;
},{"../../transform/error.transform":"Bjol","../../../utils/customs":"PAPk","../../../function/matrix/subset":"ZWbZ","../../../type/matrix/function/matrix":"vzj5"}],"Huid":[function(require,module,exports) {
"use strict";var t=[{AssignmentNode:{},FunctionAssignmentNode:{}},{ConditionalNode:{latexLeftParens:!1,latexRightParens:!1,latexParens:!1}},{"OperatorNode:or":{associativity:"left",associativeWith:[]}},{"OperatorNode:xor":{associativity:"left",associativeWith:[]}},{"OperatorNode:and":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitOr":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitXor":{associativity:"left",associativeWith:[]}},{"OperatorNode:bitAnd":{associativity:"left",associativeWith:[]}},{"OperatorNode:equal":{associativity:"left",associativeWith:[]},"OperatorNode:unequal":{associativity:"left",associativeWith:[]},"OperatorNode:smaller":{associativity:"left",associativeWith:[]},"OperatorNode:larger":{associativity:"left",associativeWith:[]},"OperatorNode:smallerEq":{associativity:"left",associativeWith:[]},"OperatorNode:largerEq":{associativity:"left",associativeWith:[]},RelationalNode:{associativity:"left",associativeWith:[]}},{"OperatorNode:leftShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightArithShift":{associativity:"left",associativeWith:[]},"OperatorNode:rightLogShift":{associativity:"left",associativeWith:[]}},{"OperatorNode:to":{associativity:"left",associativeWith:[]}},{RangeNode:{}},{"OperatorNode:add":{associativity:"left",associativeWith:["OperatorNode:add","OperatorNode:subtract"]},"OperatorNode:subtract":{associativity:"left",associativeWith:[]}},{"OperatorNode:multiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","Operator:dotMultiply","Operator:dotDivide"]},"OperatorNode:divide":{associativity:"left",associativeWith:[],latexLeftParens:!1,latexRightParens:!1,latexParens:!1},"OperatorNode:dotMultiply":{associativity:"left",associativeWith:["OperatorNode:multiply","OperatorNode:divide","OperatorNode:dotMultiply","OperatorNode:doDivide"]},"OperatorNode:dotDivide":{associativity:"left",associativeWith:[]},"OperatorNode:mod":{associativity:"left",associativeWith:[]}},{"OperatorNode:unaryPlus":{associativity:"right"},"OperatorNode:unaryMinus":{associativity:"right"},"OperatorNode:bitNot":{associativity:"right"},"OperatorNode:not":{associativity:"right"}},{"OperatorNode:pow":{associativity:"right",associativeWith:[],latexRightParens:!1},"OperatorNode:dotPow":{associativity:"right",associativeWith:[]}},{"OperatorNode:factorial":{associativity:"left"}},{"OperatorNode:transpose":{associativity:"left"}}];function i(i,e){var a=i;"keep"!==e&&(a=i.getContent());for(var o=a.getIdentifier(),r=0;r<t.length;r++)if(o in t[r])return r;return null}function e(e,a){var o=e;"keep"!==a&&(o=e.getContent());var r=o.getIdentifier(),s=i(o,a);if(null===s)return null;var v=t[s][r];if(v.hasOwnProperty("associativity")){if("left"===v.associativity)return"left";if("right"===v.associativity)return"right";throw Error("'"+r+"' has the invalid associativity '"+v.associativity+"'.")}return null}function a(e,a,o){var r="keep"!==o?e.getContent():e,s="keep"!==o?e.getContent():a,v=r.getIdentifier(),l=s.getIdentifier(),c=i(r,o);if(null===c)return null;var d=t[c][v];if(d.hasOwnProperty("associativeWith")&&d.associativeWith instanceof Array){for(var n=0;n<d.associativeWith.length;n++)if(d.associativeWith[n]===l)return!0;return!1}return null}module.exports.properties=t,module.exports.getPrecedence=i,module.exports.getAssociativity=e,module.exports.isAssociativeWith=a;
},{}],"yw4P":[function(require,module,exports) {
"use strict";var e=require("../../utils/customs").getSafeProperty,t=require("../../utils/customs").setSafeProperty;function i(i,o,n,r){var s=n(require("./Node")),a=n(require("./utils/assign")),h=n(require("./utils/access")),c=require("../operators");function u(e,t,o){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if(this.object=e,this.index=o?t:null,this.value=o||t,!i.isSymbolNode(e)&&!i.isAccessorNode(e))throw new TypeError('SymbolNode or AccessorNode expected as "object"');if(i.isSymbolNode(e)&&"end"===e.name)throw new Error('Cannot assign to symbol "end"');if(this.index&&!i.isIndexNode(this.index))throw new TypeError('IndexNode expected as "index"');if(!i.isNode(this.value))throw new TypeError('Node expected as "value"');Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function p(e,t){t||(t="keep");var i=c.getPrecedence(e,t),o=c.getPrecedence(e.value,t);return"all"===t||null!==o&&o<=i}return u.prototype=new s,u.prototype.type="AssignmentNode",u.prototype.isAssignmentNode=!0,u.prototype._compile=function(o,n){var r=this.object._compile(o,n),s=this.index?this.index._compile(o,n):null,c=this.value._compile(o,n),u=this.object.name;if(this.index){if(this.index.isObjectProperty()){var p=this.index.getObjectProperty();return function(e,i,o){var n=r(e,i,o),s=c(e,i,o);return t(n,p,s)}}if(i.isSymbolNode(this.object))return function(e,i,o){var n=r(e,i,o),h=c(e,i,o),p=s(e,i,n);return t(e,u,a(n,p,h)),h};var d=this.object.object._compile(o,n);if(this.object.index.isObjectProperty()){var l=this.object.index.getObjectProperty();return function(i,o,n){var r=d(i,o,n),h=e(r,l),u=s(i,o,h),p=c(i,o,n);return t(r,l,a(h,u,p)),p}}var x=this.object.index._compile(o,n);return function(e,t,i){var o=d(e,t,i),n=x(e,t,o),r=h(o,n),u=s(e,t,r),p=c(e,t,i);return a(o,n,a(r,u,p)),p}}if(!i.isSymbolNode(this.object))throw new TypeError("SymbolNode expected as object");return function(e,i,o){return t(e,u,c(e,i,o))}},u.prototype.forEach=function(e){e(this.object,"object",this),this.index&&e(this.index,"index",this),e(this.value,"value",this)},u.prototype.map=function(e){return new u(this._ifNode(e(this.object,"object",this)),this.index?this._ifNode(e(this.index,"index",this)):null,this._ifNode(e(this.value,"value",this)))},u.prototype.clone=function(){return new u(this.object,this.index,this.value)},u.prototype._toString=function(e){var t=this.object.toString(e),i=this.index?this.index.toString(e):"",o=this.value.toString(e);return p(this,e&&e.parenthesis)&&(o="("+o+")"),t+i+" = "+o},u.prototype.toJSON=function(){return{mathjs:"AssignmentNode",object:this.object,index:this.index,value:this.value}},u.fromJSON=function(e){return new u(e.object,e.index,e.value)},u.prototype.toHTML=function(e){var t=this.object.toHTML(e),i=this.index?this.index.toHTML(e):"",o=this.value.toHTML(e);return p(this,e&&e.parenthesis)&&(o='<span class="math-paranthesis math-round-parenthesis">(</span>'+o+'<span class="math-paranthesis math-round-parenthesis">)</span>'),t+i+'<span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+o},u.prototype._toTex=function(e){var t=this.object.toTex(e),i=this.index?this.index.toTex(e):"",o=this.value.toTex(e);return p(this,e&&e.parenthesis)&&(o="\\left(".concat(o,"\\right)")),t+i+":="+o},u}exports.name="AssignmentNode",exports.path="expression.node",exports.factory=i;
},{"../../utils/customs":"PAPk","./Node":"dnbo","./utils/assign":"ft5y","./utils/access":"oT9r","../operators":"Huid"}],"QBkn":[function(require,module,exports) {
"use strict";var o=require("../../utils/array").forEach,e=require("../../utils/array").map;function t(t,r,n,i){var s=n(require("./Node")),p=n(require("../../type/resultset/ResultSet"));function a(o){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(o))throw new Error("Array expected");this.blocks=o.map(function(o){var e=o&&o.node,r=!o||void 0===o.visible||o.visible;if(!t.isNode(e))throw new TypeError('Property "node" must be a Node');if("boolean"!=typeof r)throw new TypeError('Property "visible" must be a boolean');return{node:e,visible:r}})}return a.prototype=new s,a.prototype.type="BlockNode",a.prototype.isBlockNode=!0,a.prototype._compile=function(t,r){var n=e(this.blocks,function(o){return{eval:o.node._compile(t,r),visible:o.visible}});return function(e,t,r){var i=[];return o(n,function(o){var n=o.eval(e,t,r);o.visible&&i.push(n)}),new p(i)}},a.prototype.forEach=function(o){for(var e=0;e<this.blocks.length;e++)o(this.blocks[e].node,"blocks["+e+"].node",this)},a.prototype.map=function(o){for(var e=[],t=0;t<this.blocks.length;t++){var r=this.blocks[t],n=this._ifNode(o(r.node,"blocks["+t+"].node",this));e[t]={node:n,visible:r.visible}}return new a(e)},a.prototype.clone=function(){return new a(this.blocks.map(function(o){return{node:o.node,visible:o.visible}}))},a.prototype._toString=function(o){return this.blocks.map(function(e){return e.node.toString(o)+(e.visible?"":";")}).join("\n")},a.prototype.toJSON=function(){return{mathjs:"BlockNode",blocks:this.blocks}},a.fromJSON=function(o){return new a(o.blocks)},a.prototype.toHTML=function(o){return this.blocks.map(function(e){return e.node.toHTML(o)+(e.visible?"":'<span class="math-separator">;</span>')}).join('<span class="math-separator"><br /></span>')},a.prototype._toTex=function(o){return this.blocks.map(function(e){return e.node.toTex(o)+(e.visible?"":";")}).join("\\;\\;\n")},a}exports.name="BlockNode",exports.path="expression.node",exports.factory=t;
},{"../../utils/array":"j2lF","./Node":"dnbo","../../type/resultset/ResultSet":"hpV8"}],"uzAW":[function(require,module,exports) {
"use strict";var t=require("../operators");function e(e,r,o,i){var n=o(require("./Node")),s=o(require("../../function/utils/typeof"));function p(t,r,o){if(!(this instanceof p))throw new SyntaxError("Constructor must be called with the new operator");if(!e.isNode(t))throw new TypeError("Parameter condition must be a Node");if(!e.isNode(r))throw new TypeError("Parameter trueExpr must be a Node");if(!e.isNode(o))throw new TypeError("Parameter falseExpr must be a Node");this.condition=t,this.trueExpr=r,this.falseExpr=o}return p.prototype=new n,p.prototype.type="ConditionalNode",p.prototype.isConditionalNode=!0,p.prototype._compile=function(t,r){var o=this.condition._compile(t,r),i=this.trueExpr._compile(t,r),n=this.falseExpr._compile(t,r);return function(t,r,p){return function(t){if("number"==typeof t||"boolean"==typeof t||"string"==typeof t)return!!t;if(t){if(e.isBigNumber(t))return!t.isZero();if(e.isComplex(t))return!(!t.re&&!t.im);if(e.isUnit(t))return!!t.value}if(null==t)return!1;throw new TypeError('Unsupported type of condition "'+s(t)+'"')}(o(t,r,p))?i(t,r,p):n(t,r,p)}},p.prototype.forEach=function(t){t(this.condition,"condition",this),t(this.trueExpr,"trueExpr",this),t(this.falseExpr,"falseExpr",this)},p.prototype.map=function(t){return new p(this._ifNode(t(this.condition,"condition",this)),this._ifNode(t(this.trueExpr,"trueExpr",this)),this._ifNode(t(this.falseExpr,"falseExpr",this)))},p.prototype.clone=function(){return new p(this.condition,this.trueExpr,this.falseExpr)},p.prototype._toString=function(e){var r=e&&e.parenthesis?e.parenthesis:"keep",o=t.getPrecedence(this,r),i=this.condition.toString(e),n=t.getPrecedence(this.condition,r);("all"===r||"OperatorNode"===this.condition.type||null!==n&&n<=o)&&(i="("+i+")");var s=this.trueExpr.toString(e),p=t.getPrecedence(this.trueExpr,r);("all"===r||"OperatorNode"===this.trueExpr.type||null!==p&&p<=o)&&(s="("+s+")");var a=this.falseExpr.toString(e),h=t.getPrecedence(this.falseExpr,r);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==h&&h<=o)&&(a="("+a+")"),i+" ? "+s+" : "+a},p.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},p.fromJSON=function(t){return new p(t.condition,t.trueExpr,t.falseExpr)},p.prototype.toHTML=function(e){var r=e&&e.parenthesis?e.parenthesis:"keep",o=t.getPrecedence(this,r),i=this.condition.toHTML(e),n=t.getPrecedence(this.condition,r);("all"===r||"OperatorNode"===this.condition.type||null!==n&&n<=o)&&(i='<span class="math-parenthesis math-round-parenthesis">(</span>'+i+'<span class="math-parenthesis math-round-parenthesis">)</span>');var s=this.trueExpr.toHTML(e),p=t.getPrecedence(this.trueExpr,r);("all"===r||"OperatorNode"===this.trueExpr.type||null!==p&&p<=o)&&(s='<span class="math-parenthesis math-round-parenthesis">(</span>'+s+'<span class="math-parenthesis math-round-parenthesis">)</span>');var a=this.falseExpr.toHTML(e),h=t.getPrecedence(this.falseExpr,r);return("all"===r||"OperatorNode"===this.falseExpr.type||null!==h&&h<=o)&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),i+'<span class="math-operator math-conditional-operator">?</span>'+s+'<span class="math-operator math-conditional-operator">:</span>'+a},p.prototype._toTex=function(t){return"\\begin{cases} {"+this.trueExpr.toTex(t)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(t)+"}\\\\{"+this.falseExpr.toTex(t)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},p}exports.name="ConditionalNode",exports.path="expression.node",exports.factory=e;
},{"../operators":"Huid","./Node":"dnbo","../../function/utils/typeof":"LZTG"}],"MNuy":[function(require,module,exports) {
"use strict";var t=require("../../utils/string").format,e=require("../../utils/latex").escape;function n(n,r,o,a){var s=o(require("./Node")),u=o(require("../../function/utils/typeof"));function i(t){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(2===arguments.length)throw new SyntaxError("new ConstantNode(valueStr, valueType) is not supported anymore since math v4.0.0. Use new ConstantNode(value) instead, where value is a non-stringified value.");this.value=t}return i.prototype=new s,i.prototype.type="ConstantNode",i.prototype.isConstantNode=!0,i.prototype._compile=function(t,e){var n=this.value;return function(){return n}},i.prototype.forEach=function(t){},i.prototype.map=function(t){return this.clone()},i.prototype.clone=function(){return new i(this.value)},i.prototype._toString=function(e){return t(this.value,e)},i.prototype.toHTML=function(t){var e=this._toString(t);switch(u(this.value)){case"number":case"BigNumber":case"Fraction":return'<span class="math-number">'+e+"</span>";case"string":return'<span class="math-string">'+e+"</span>";case"boolean":return'<span class="math-boolean">'+e+"</span>";case"null":return'<span class="math-null-symbol">'+e+"</span>";case"undefined":return'<span class="math-undefined">'+e+"</span>";default:return'<span class="math-symbol">'+e+"</span>"}},i.prototype.toJSON=function(){return{mathjs:"ConstantNode",value:this.value}},i.fromJSON=function(t){return new i(t.value)},i.prototype._toTex=function(t){var n=this._toString(t);switch(u(this.value)){case"string":return"\\mathtt{"+e(n)+"}";case"number":case"BigNumber":var r=n.toLowerCase().indexOf("e");return-1!==r?n.substring(0,r)+"\\cdot10^{"+n.substring(r+1)+"}":n;case"Fraction":return this.value.toLatex();default:return n}},i}exports.name="ConstantNode",exports.path="expression.node",exports.factory=n;
},{"../../utils/string":"PshC","../../utils/latex":"H1Mr","./Node":"dnbo","../../function/utils/typeof":"LZTG"}],"PrPs":[function(require,module,exports) {
"use strict";var e=require("../keywords"),t=require("../../utils/string").escape,r=require("../../utils/array").forEach,a=require("../../utils/array").join,s=require("../../utils/latex"),n=require("../operators"),i=require("../../utils/customs").setSafeProperty;function o(o,p,h,m){var u=h(require("./Node"));function c(t,r,a){if(!(this instanceof c))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('String expected for parameter "name"');if(!Array.isArray(r))throw new TypeError('Array containing strings or objects expected for parameter "params"');if(!o.isNode(a))throw new TypeError('Node expected for parameter "expr"');if(t in e)throw new Error('Illegal function name, "'+t+'" is a reserved keyword');this.name=t,this.params=r.map(function(e){return e&&e.name||e}),this.types=r.map(function(e){return e&&e.type||"any"}),this.expr=a}function f(e,t){var r=n.getPrecedence(e,t),a=n.getPrecedence(e.expr,t);return"all"===t||null!==a&&a<=r}return c.prototype=new u,c.prototype.type="FunctionAssignmentNode",c.prototype.isFunctionAssignmentNode=!0,c.prototype._compile=function(e,t){var s=Object.create(t);r(this.params,function(e){s[e]=!0});var n=this.expr._compile(e,s),o=this.name,p=this.params,h=a(this.types,","),u=o+"("+a(this.params,", ")+")";return function(e,t,r){var a={};a[h]=function(){for(var a=Object.create(t),s=0;s<p.length;s++)a[p[s]]=arguments[s];return n(e,a,r)};var s=m(o,a);return s.syntax=u,i(e,o,s),s}},c.prototype.forEach=function(e){e(this.expr,"expr",this)},c.prototype.map=function(e){var t=this._ifNode(e(this.expr,"expr",this));return new c(this.name,this.params.slice(0),t)},c.prototype.clone=function(){return new c(this.name,this.params.slice(0),this.expr)},c.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toString(e);return f(this,t)&&(r="("+r+")"),this.name+"("+this.params.join(", ")+") = "+r},c.prototype.toJSON=function(){var e=this.types;return{mathjs:"FunctionAssignmentNode",name:this.name,params:this.params.map(function(t,r){return{name:t,type:e[r]}}),expr:this.expr}},c.fromJSON=function(e){return new c(e.name,e.params,e.expr)},c.prototype.toHTML=function(e){for(var r=e&&e.parenthesis?e.parenthesis:"keep",a=[],s=0;s<this.params.length;s++)a.push('<span class="math-symbol math-parameter">'+t(this.params[s])+"</span>");var n=this.expr.toHTML(e);return f(this,r)&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),'<span class="math-function">'+t(this.name)+'</span><span class="math-parenthesis math-round-parenthesis">(</span>'+a.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-round-parenthesis">)</span><span class="math-operator math-assignment-operator math-variable-assignment-operator math-binary-operator">=</span>'+n},c.prototype._toTex=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",r=this.expr.toTex(e);return f(this,t)&&(r="\\left(".concat(r,"\\right)")),"\\mathrm{"+this.name+"}\\left("+this.params.map(s.toSymbol).join(",")+"\\right):="+r},c}exports.name="FunctionAssignmentNode",exports.path="expression.node",exports.factory=o;
},{"../keywords":"psm5","../../utils/string":"PshC","../../utils/array":"j2lF","../../utils/latex":"H1Mr","../operators":"Huid","../../utils/customs":"PAPk","./Node":"dnbo"}],"SN5L":[function(require,module,exports) {
"use strict";var t=require("../../utils/array").map,e=require("../../utils/string").escape;function n(n,o,r,i){var s=r(require("./Node")),a=r(require("../../type/matrix/Range")),p=Array.isArray;function c(t,e){if(!(this instanceof c))throw new SyntaxError("Constructor must be called with the new operator");if(this.dimensions=t,this.dotNotation=e||!1,!p(t)||!t.every(n.isNode))throw new TypeError('Array containing Nodes expected for parameter "dimensions"');if(this.dotNotation&&!this.isObjectProperty())throw new Error("dotNotation only applicable for object properties");var o=function(){throw new Error("Property `IndexNode.object` is deprecated, use `IndexNode.fn` instead")};Object.defineProperty(this,"object",{get:o,set:o})}function u(t,e,o){return new a(n.isBigNumber(t)?t.toNumber():t,n.isBigNumber(e)?e.toNumber():e,n.isBigNumber(o)?o.toNumber():o)}return c.prototype=new s,c.prototype.type="IndexNode",c.prototype.isIndexNode=!0,c.prototype._compile=function(e,o){var r=t(this.dimensions,function(t,r){if(n.isRangeNode(t)){if(t.needsEnd()){var i=Object.create(o);i.end=!0;var s=t.start._compile(e,i),a=t.end._compile(e,i),p=t.step?t.step._compile(e,i):function(){return 1};return function(t,n,o){var i=e.size(o).valueOf(),c=Object.create(n);return c.end=i[r],u(s(t,c,o),a(t,c,o),p(t,c,o))}}var c=t.start._compile(e,o),d=t.end._compile(e,o),h=t.step?t.step._compile(e,o):function(){return 1};return function(t,e,n){return u(c(t,e,n),d(t,e,n),h(t,e,n))}}if(n.isSymbolNode(t)&&"end"===t.name){var m=Object.create(o);m.end=!0;var f=t._compile(e,m);return function(t,n,o){var i=e.size(o).valueOf(),s=Object.create(n);return s.end=i[r],f(t,s,o)}}var y=t._compile(e,o);return function(t,e,n){return y(t,e,n)}});return function(n,o,i){var s=t(r,function(t){return t(n,o,i)});return e.index.apply(e,s)}},c.prototype.forEach=function(t){for(var e=0;e<this.dimensions.length;e++)t(this.dimensions[e],"dimensions["+e+"]",this)},c.prototype.map=function(t){for(var e=[],n=0;n<this.dimensions.length;n++)e[n]=this._ifNode(t(this.dimensions[n],"dimensions["+n+"]",this));return new c(e)},c.prototype.clone=function(){return new c(this.dimensions.slice(0))},c.prototype.isObjectProperty=function(){return 1===this.dimensions.length&&n.isConstantNode(this.dimensions[0])&&"string"==typeof this.dimensions[0].value},c.prototype.getObjectProperty=function(){return this.isObjectProperty()?this.dimensions[0].value:null},c.prototype._toString=function(t){return this.dotNotation?"."+this.getObjectProperty():"["+this.dimensions.join(", ")+"]"},c.prototype.toJSON=function(){return{mathjs:"IndexNode",dimensions:this.dimensions,dotNotation:this.dotNotation}},c.fromJSON=function(t){return new c(t.dimensions,t.dotNotation)},c.prototype.toHTML=function(t){for(var n=[],o=0;o<this.dimensions.length;o++)n[o]=this.dimensions[o].toHTML();return this.dotNotation?'<span class="math-operator math-accessor-operator">.</span><span class="math-symbol math-property">'+e(this.getObjectProperty())+"</span>":'<span class="math-parenthesis math-square-parenthesis">[</span>'+n.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-square-parenthesis">]</span>'},c.prototype._toTex=function(t){var e=this.dimensions.map(function(e){return e.toTex(t)});return this.dotNotation?"."+this.getObjectProperty():"_{"+e.join(",")+"}"},c}exports.name="IndexNode",exports.path="expression.node",exports.factory=n;
},{"../../utils/array":"j2lF","../../utils/string":"PshC","./Node":"dnbo","../../type/matrix/Range":"rRNx"}],"UI2T":[function(require,module,exports) {
"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(t)}function t(e){return(t="function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?function(t){return r(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":r(t)})(e)}var e=require("../../utils/string").stringify,o=require("../../utils/string").escape,p=require("../../utils/customs").isSafeProperty,s=require("../../utils/object").hasOwnProperty;function i(r,i,n,a){var h=n(require("./Node"));function u(e){if(!(this instanceof u))throw new SyntaxError("Constructor must be called with the new operator");if(this.properties=e||{},e&&("object"!==t(e)||!Object.keys(e).every(function(t){return r.isNode(e[t])})))throw new TypeError("Object containing Nodes expected")}return u.prototype=new h,u.prototype.type="ObjectNode",u.prototype.isObjectNode=!0,u.prototype._compile=function(r,t){var o={};for(var i in this.properties)if(s(this.properties,i)){var n=e(i),a=JSON.parse(n);if(!p(this.properties,a))throw new Error('No access to property "'+a+'"');o[a]=this.properties[i]._compile(r,t)}return function(r,t,e){var p={};for(var i in o)s(o,i)&&(p[i]=o[i](r,t,e));return p}},u.prototype.forEach=function(r){for(var t in this.properties)this.properties.hasOwnProperty(t)&&r(this.properties[t],"properties["+e(t)+"]",this)},u.prototype.map=function(r){var t={};for(var o in this.properties)this.properties.hasOwnProperty(o)&&(t[o]=this._ifNode(r(this.properties[o],"properties["+e(o)+"]",this)));return new u(t)},u.prototype.clone=function(){var r={};for(var t in this.properties)this.properties.hasOwnProperty(t)&&(r[t]=this.properties[t]);return new u(r)},u.prototype._toString=function(r){var t=[];for(var o in this.properties)this.properties.hasOwnProperty(o)&&t.push(e(o)+": "+this.properties[o].toString(r));return"{"+t.join(", ")+"}"},u.prototype.toJSON=function(){return{mathjs:"ObjectNode",properties:this.properties}},u.fromJSON=function(r){return new u(r.properties)},u.prototype.toHTML=function(r){var t=[];for(var e in this.properties)this.properties.hasOwnProperty(e)&&t.push('<span class="math-symbol math-property">'+o(e)+'</span><span class="math-operator math-assignment-operator math-property-assignment-operator math-binary-operator">:</span>'+this.properties[e].toHTML(r));return'<span class="math-parenthesis math-curly-parenthesis">{</span>'+t.join('<span class="math-separator">,</span>')+'<span class="math-parenthesis math-curly-parenthesis">}</span>'},u.prototype._toTex=function(r){var t=[];for(var e in this.properties)this.properties.hasOwnProperty(e)&&t.push("\\mathbf{"+e+":} & "+this.properties[e].toTex(r)+"\\\\");return"\\left\\{\\begin{array}{ll}".concat(t.join("\n"),"\\end{array}\\right\\}")},u}exports.name="ObjectNode",exports.path="expression.node",exports.factory=i;
},{"../../utils/string":"PshC","../../utils/customs":"PAPk","../../utils/object":"FcSp","./Node":"dnbo"}],"F3sc":[function(require,module,exports) {
"use strict";var t=require("../../utils/latex"),e=require("../../utils/array").map,r=require("../../utils/string").escape,i=require("../../utils/customs").isSafeMethod,n=require("../../utils/customs").getSafeProperty,a=require("../operators");function s(s,o,p,h){var c=p(require("./Node"));function l(t,e,r,i){if(!(this instanceof l))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('string expected for parameter "op"');if("string"!=typeof e)throw new TypeError('string expected for parameter "fn"');if(!Array.isArray(r)||!r.every(s.isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.implicit=!0===i,this.op=t,this.fn=e,this.args=r||[]}function f(t,e,r,i,n){var s,o=a.getPrecedence(t,e),p=a.getAssociativity(t,e);if("all"===e||i.length>2&&"OperatorNode:add"!==t.getIdentifier()&&"OperatorNode:multiply"!==t.getIdentifier())return i.map(function(t){switch(t.getContent().type){case"ArrayNode":case"ConstantNode":case"SymbolNode":case"ParenthesisNode":return!1;default:return!0}});switch(i.length){case 0:s=[];break;case 1:var h=a.getPrecedence(i[0],e);if(n&&null!==h){var c,l;if("keep"===e?(c=i[0].getIdentifier(),l=t.getIdentifier()):(c=i[0].getContent().getIdentifier(),l=t.getContent().getIdentifier()),!1===a.properties[o][l].latexLeftParens){s=[!1];break}if(!1===a.properties[h][c].latexParens){s=[!1];break}}if(null===h){s=[!1];break}if(h<=o){s=[!0];break}s=[!1];break;case 2:var f,u,d=a.getPrecedence(i[0],e),g=a.isAssociativeWith(t,i[0],e);f=null!==d&&(d===o&&"right"===p&&!g||d<o);var m,y,v,N=a.getPrecedence(i[1],e),I=a.isAssociativeWith(t,i[1],e);if(u=null!==N&&(N===o&&"left"===p&&!I||N<o),n)"keep"===e?(m=t.getIdentifier(),y=t.args[0].getIdentifier(),v=t.args[1].getIdentifier()):(m=t.getContent().getIdentifier(),y=t.args[0].getContent().getIdentifier(),v=t.args[1].getContent().getIdentifier()),null!==d&&(!1===a.properties[o][m].latexLeftParens&&(f=!1),!1===a.properties[d][y].latexParens&&(f=!1)),null!==N&&(!1===a.properties[o][m].latexRightParens&&(u=!1),!1===a.properties[N][v].latexParens&&(u=!1));s=[f,u];break;default:"OperatorNode:add"!==t.getIdentifier()&&"OperatorNode:multiply"!==t.getIdentifier()||(s=i.map(function(r){var i=a.getPrecedence(r,e),n=a.isAssociativeWith(t,r,e),s=a.getAssociativity(r,e);return null!==i&&(o===i&&p===s&&!n||i<o)}))}return i.length>=2&&"OperatorNode:multiply"===t.getIdentifier()&&t.implicit&&"auto"===e&&"hide"===r&&(s=i.map(function(t,e){var r="ParenthesisNode"===t.getIdentifier();return!(!s[e]&&!r)})),s}return l.prototype=new c,l.prototype.type="OperatorNode",l.prototype.isOperatorNode=!0,l.prototype._compile=function(t,r){if("string"!=typeof this.fn||!i(t,this.fn))throw t[this.fn]?new Error('No access to function "'+this.fn+'"'):new Error("Function "+this.fn+' missing in provided namespace "math"');var a=n(t,this.fn),s=e(this.args,function(e){return e._compile(t,r)});if(1===s.length){var o=s[0];return function(t,e,r){return a(o(t,e,r))}}if(2===s.length){var p=s[0],h=s[1];return function(t,e,r){return a(p(t,e,r),h(t,e,r))}}return function(t,r,i){return a.apply(null,e(s,function(e){return e(t,r,i)}))}},l.prototype.forEach=function(t){for(var e=0;e<this.args.length;e++)t(this.args[e],"args["+e+"]",this)},l.prototype.map=function(t){for(var e=[],r=0;r<this.args.length;r++)e[r]=this._ifNode(t(this.args[r],"args["+r+"]",this));return new l(this.op,this.fn,e,this.implicit)},l.prototype.clone=function(){return new l(this.op,this.fn,this.args.slice(0),this.implicit)},l.prototype.isUnary=function(){return 1===this.args.length},l.prototype.isBinary=function(){return 2===this.args.length},l.prototype._toString=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",r=t&&t.implicit?t.implicit:"hide",i=this.args,n=f(this,e,r,i,!1);if(1===i.length){var s=a.getAssociativity(this,e),o=i[0].toString(t);n[0]&&(o="("+o+")");var p=/[a-zA-Z]+/.test(this.op);return"right"===s?this.op+(p?" ":"")+o:"left"===s?o+(p?" ":"")+this.op:o+this.op}if(2===i.length){var h=i[0].toString(t),c=i[1].toString(t);return n[0]&&(h="("+h+")"),n[1]&&(c="("+c+")"),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?h+" "+c:h+" "+this.op+" "+c}if(i.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var l=i.map(function(e,r){return e=e.toString(t),n[r]&&(e="("+e+")"),e});return this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===r?l.join(" "):l.join(" "+this.op+" ")}return this.fn+"("+this.args.join(", ")+")"},l.prototype.toJSON=function(){return{mathjs:"OperatorNode",op:this.op,fn:this.fn,args:this.args,implicit:this.implicit}},l.fromJSON=function(t){return new l(t.op,t.fn,t.args,t.implicit)},l.prototype.toHTML=function(t){var e=t&&t.parenthesis?t.parenthesis:"keep",i=t&&t.implicit?t.implicit:"hide",n=this.args,s=f(this,e,i,n,!1);if(1===n.length){var o=a.getAssociativity(this,e),p=n[0].toHTML(t);return s[0]&&(p='<span class="math-parenthesis math-round-parenthesis">(</span>'+p+'<span class="math-parenthesis math-round-parenthesis">)</span>'),"right"===o?'<span class="math-operator math-unary-operator math-lefthand-unary-operator">'+r(this.op)+"</span>"+p:p+'<span class="math-operator math-unary-operator math-righthand-unary-operator">'+r(this.op)+"</span>"}if(2===n.length){var h=n[0].toHTML(t),c=n[1].toHTML(t);return s[0]&&(h='<span class="math-parenthesis math-round-parenthesis">(</span>'+h+'<span class="math-parenthesis math-round-parenthesis">)</span>'),s[1]&&(c='<span class="math-parenthesis math-round-parenthesis">(</span>'+c+'<span class="math-parenthesis math-round-parenthesis">)</span>'),this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===i?h+'<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'+c:h+'<span class="math-operator math-binary-operator math-explicit-binary-operator">'+r(this.op)+"</span>"+c}var l=n.map(function(e,r){return e=e.toHTML(t),s[r]&&(e='<span class="math-parenthesis math-round-parenthesis">(</span>'+e+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e});return n.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())?this.implicit&&"OperatorNode:multiply"===this.getIdentifier()&&"hide"===i?l.join('<span class="math-operator math-binary-operator math-implicit-binary-operator"></span>'):l.join('<span class="math-operator math-binary-operator math-explicit-binary-operator">'+r(this.op)+"</span>"):'<span class="math-function">'+r(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+l.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'},l.prototype._toTex=function(e){var r=e&&e.parenthesis?e.parenthesis:"keep",i=e&&e.implicit?e.implicit:"hide",n=this.args,s=f(this,r,i,n,!0),o=t.operators[this.fn];if(o=void 0===o?this.op:o,1===n.length){var p=a.getAssociativity(this,r),h=n[0].toTex(e);return s[0]&&(h="\\left(".concat(h,"\\right)")),"right"===p?o+h:h+o}if(2===n.length){var c=n[0],l=c.toTex(e);s[0]&&(l="\\left(".concat(l,"\\right)"));var u,d=n[1].toTex(e);switch(s[1]&&(d="\\left(".concat(d,"\\right)")),u="keep"===r?c.getIdentifier():c.getContent().getIdentifier(),this.getIdentifier()){case"OperatorNode:divide":return o+"{"+l+"}{"+d+"}";case"OperatorNode:pow":switch(l="{"+l+"}",d="{"+d+"}",u){case"ConditionalNode":case"OperatorNode:divide":l="\\left(".concat(l,"\\right)")}break;case"OperatorNode:multiply":if(this.implicit&&"hide"===i)return l+"~"+d}return l+o+d}if(n.length>2&&("OperatorNode:add"===this.getIdentifier()||"OperatorNode:multiply"===this.getIdentifier())){var g=n.map(function(t,r){return t=t.toTex(e),s[r]&&(t="\\left(".concat(t,"\\right)")),t});return"OperatorNode:multiply"===this.getIdentifier()&&this.implicit?g.join("~"):g.join(o)}return"\\mathrm{"+this.fn+"}\\left("+n.map(function(t){return t.toTex(e)}).join(",")+"\\right)"},l.prototype.getIdentifier=function(){return this.type+":"+this.fn},l}exports.name="OperatorNode",exports.path="expression.node",exports.factory=s;
},{"../../utils/latex":"H1Mr","../../utils/array":"j2lF","../../utils/string":"PshC","../../utils/customs":"PAPk","../operators":"Huid","./Node":"dnbo"}],"Mj7c":[function(require,module,exports) {
"use strict";function t(t,e,n,o){var r=n(require("./Node"));function s(e){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(!t.isNode(e))throw new TypeError('Node expected for parameter "content"');this.content=e}return s.prototype=new r,s.prototype.type="ParenthesisNode",s.prototype.isParenthesisNode=!0,s.prototype._compile=function(t,e){return this.content._compile(t,e)},s.prototype.getContent=function(){return this.content.getContent()},s.prototype.forEach=function(t){t(this.content,"content",this)},s.prototype.map=function(t){return new s(t(this.content,"content",this))},s.prototype.clone=function(){return new s(this.content)},s.prototype._toString=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"("+this.content.toString(t)+")":this.content.toString(t)},s.prototype.toJSON=function(){return{mathjs:"ParenthesisNode",content:this.content}},s.fromJSON=function(t){return new s(t.content)},s.prototype.toHTML=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?'<span class="math-parenthesis math-round-parenthesis">(</span>'+this.content.toHTML(t)+'<span class="math-parenthesis math-round-parenthesis">)</span>':this.content.toHTML(t)},s.prototype._toTex=function(t){return!t||t&&!t.parenthesis||t&&"keep"===t.parenthesis?"\\left(".concat(this.content.toTex(t),"\\right)"):this.content.toTex(t)},s}exports.name="ParenthesisNode",exports.path="expression.node",exports.factory=t;
},{"./Node":"dnbo"}],"RtSa":[function(require,module,exports) {
"use strict";var t=require("../../utils/latex"),n=require("../../utils/string").escape,e=require("../../utils/object").hasOwnProperty,o=require("../../utils/customs").getSafeProperty;function r(r,s,a,i,m){var p=a(require("./Node"));function u(t){return!!r.Unit&&r.Unit.isValuelessUnit(t)}function l(t){if(!(this instanceof l))throw new SyntaxError("Constructor must be called with the new operator");if("string"!=typeof t)throw new TypeError('String expected for parameter "name"');this.name=t}return l.prototype=new p,l.prototype.type="SymbolNode",l.prototype.isSymbolNode=!0,l.prototype._compile=function(t,n){var s=this.name;if(e(n,s))return function(t,n,e){return n[s]};if(s in t)return function(n,e,r){return o(s in n?n:t,s)};var a=u(s);return function(t,n,e){return s in t?o(t,s):a?new r.Unit(null,s):function(t){throw new Error("Undefined symbol "+t)}(s)}},l.prototype.forEach=function(t){},l.prototype.map=function(t){return this.clone()},l.prototype.clone=function(){return new l(this.name)},l.prototype._toString=function(t){return this.name},l.prototype.toHTML=function(t){var e=n(this.name);return"true"===e||"false"===e?'<span class="math-symbol math-boolean">'+e+"</span>":"i"===e?'<span class="math-symbol math-imaginary-symbol">'+e+"</span>":"Infinity"===e?'<span class="math-symbol math-infinity-symbol">'+e+"</span>":"NaN"===e?'<span class="math-symbol math-nan-symbol">'+e+"</span>":"null"===e?'<span class="math-symbol math-null-symbol">'+e+"</span>":"undefined"===e?'<span class="math-symbol math-undefined-symbol">'+e+"</span>":'<span class="math-symbol">'+e+"</span>"},l.prototype.toJSON=function(){return{mathjs:"SymbolNode",name:this.name}},l.fromJSON=function(t){return new l(t.name)},l.prototype._toTex=function(n){var e=!1;void 0===m[this.name]&&u(this.name)&&(e=!0);var o=t.toSymbol(this.name,e);return"\\"===o[0]?o:" "+o},l}exports.name="SymbolNode",exports.path="expression.node",exports.math=!0,exports.factory=r;
},{"../../utils/latex":"H1Mr","../../utils/string":"PshC","../../utils/object":"FcSp","../../utils/customs":"PAPk","./Node":"dnbo"}],"ZLEq":[function(require,module,exports) {
"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(r){return(e="function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?function(e){return t(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":t(e)})(r)}function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var n=require("../../utils/latex"),o=require("../../utils/string").escape,i=require("../../utils/object").hasOwnProperty,s=require("../../utils/array").map,a=require("../../utils/customs").validateSafeMethod,u=require("../../utils/customs").getSafeProperty;function f(t,f,c,p,h){var y=c(require("./Node")),l=c(require("./SymbolNode"));function d(e,r){if(!(this instanceof d))throw new SyntaxError("Constructor must be called with the new operator");if("string"==typeof e&&(e=new l(e)),!t.isNode(e))throw new TypeError('Node expected as parameter "fn"');if(!Array.isArray(r)||!r.every(t.isNode))throw new TypeError('Array containing Nodes expected for parameter "args"');this.fn=e,this.args=r||[],Object.defineProperty(this,"name",{get:function(){return this.fn.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}});var n=function(){throw new Error("Property `FunctionNode.object` is deprecated, use `FunctionNode.fn` instead")};Object.defineProperty(this,"object",{get:n,set:n})}d.prototype=new y,d.prototype.type="FunctionNode",d.prototype.isFunctionNode=!0,d.prototype._compile=function(e,n){if(!(this instanceof d))throw new TypeError("No valid FunctionNode");var o=s(this.args,function(t){return t._compile(e,n)});if(t.isSymbolNode(this.fn)){var i=this.fn.name,f=i in e?u(e,i):void 0;if("function"==typeof f&&!0===f.rawArgs){var c=this.args;return function(t,n,o){return(i in t?u(t,i):f)(c,e,r({},t,n))}}if(1===o.length){var p=o[0];return function(t,e,r){return(i in t?u(t,i):f)(p(t,e,r))}}if(2===o.length){var h=o[0],y=o[1];return function(t,e,r){return(i in t?u(t,i):f)(h(t,e,r),y(t,e,r))}}return function(t,e,r){return(i in t?u(t,i):f).apply(null,s(o,function(n){return n(t,e,r)}))}}if(t.isAccessorNode(this.fn)&&t.isIndexNode(this.fn.index)&&this.fn.index.isObjectProperty()){var l=this.fn.object._compile(e,n),m=this.fn.index.getObjectProperty(),g=this.args;return function(t,n,i){var u=l(t,n,i);return a(u,m),u[m]&&u[m].rawArgs?u[m](g,e,r({},t,n)):u[m].apply(u,s(o,function(e){return e(t,n,i)}))}}var b=this.fn._compile(e,n),w=this.args;return function(t,n,i){var a=b(t,n,i);return a&&a.rawArgs?a(w,e,r({},t,n)):a.apply(a,s(o,function(e){return e(t,n,i)}))}},d.prototype.forEach=function(t){t(this.fn,"fn",this);for(var e=0;e<this.args.length;e++)t(this.args[e],"args["+e+"]",this)},d.prototype.map=function(t){for(var e=this._ifNode(t(this.fn,"fn",this)),r=[],n=0;n<this.args.length;n++)r[n]=this._ifNode(t(this.args[n],"args["+n+"]",this));return new d(e,r)},d.prototype.clone=function(){return new d(this.fn,this.args.slice(0))};var m=d.prototype.toString;function g(r,n,o){for(var i,s="",a=new RegExp("\\$(?:\\{([a-z_][a-z_0-9]*)(?:\\[([0-9]+)\\])?\\}|\\$)","ig"),u=0;null!==(i=a.exec(r));)if(s+=r.substring(u,i.index),u=i.index,"$$"===i[0])s+="$",u++;else{u+=i[0].length;var f=n[i[1]];if(!f)throw new ReferenceError("Template: Property "+i[1]+" does not exist.");if(void 0===i[2])switch(e(f)){case"string":s+=f;break;case"object":if(t.isNode(f))s+=f.toTex(o);else{if(!Array.isArray(f))throw new TypeError("Template: "+i[1]+" has to be a Node, String or array of Nodes");s+=f.map(function(e,r){if(t.isNode(e))return e.toTex(o);throw new TypeError("Template: "+i[1]+"["+r+"] is not a Node.")}).join(",")}break;default:throw new TypeError("Template: "+i[1]+" has to be a Node, String or array of Nodes")}else{if(!t.isNode(f[i[2]]&&f[i[2]]))throw new TypeError("Template: "+i[1]+"["+i[2]+"] is not a Node.");s+=f[i[2]].toTex(o)}}return s+=r.slice(u)}d.prototype.toString=function(t){var r,n=this.fn.toString(t);return t&&"object"===e(t.handler)&&i(t.handler,n)&&(r=t.handler[n](this,t)),void 0!==r?r:m.call(this,t)},d.prototype._toString=function(e){var r=this.args.map(function(t){return t.toString(e)});return(t.isFunctionAssignmentNode(this.fn)?"("+this.fn.toString(e)+")":this.fn.toString(e))+"("+r.join(", ")+")"},d.prototype.toJSON=function(){return{mathjs:"FunctionNode",fn:this.fn,args:this.args}},d.fromJSON=function(t){return new d(t.fn,t.args)},d.prototype.toHTML=function(t){var e=this.args.map(function(e){return e.toHTML(t)});return'<span class="math-function">'+o(this.fn)+'</span><span class="math-paranthesis math-round-parenthesis">(</span>'+e.join('<span class="math-separator">,</span>')+'<span class="math-paranthesis math-round-parenthesis">)</span>'};var b=d.prototype.toTex;return d.prototype.toTex=function(t){var r;return t&&"object"===e(t.handler)&&i(t.handler,this.name)&&(r=t.handler[this.name](this,t)),void 0!==r?r:b.call(this,t)},d.prototype._toTex=function(t){var r,o,i=this.args.map(function(e){return e.toTex(t)});switch(!h[this.name]||"function"!=typeof h[this.name].toTex&&"object"!==e(h[this.name].toTex)&&"string"!=typeof h[this.name].toTex||(r=h[this.name].toTex),e(r)){case"function":o=r(this,t);break;case"string":o=g(r,this,t);break;case"object":switch(e(r[i.length])){case"function":o=r[i.length](this,t);break;case"string":o=g(r[i.length],this,t)}}return void 0!==o?o:g(n.defaultTemplate,this,t)},d.prototype.getIdentifier=function(){return this.type+":"+this.name},d}exports.name="FunctionNode",exports.path="expression.node",exports.math=!0,exports.factory=f;
},{"../../utils/latex":"H1Mr","../../utils/string":"PshC","../../utils/object":"FcSp","../../utils/array":"j2lF","../../utils/customs":"PAPk","./Node":"dnbo","./SymbolNode":"RtSa"}],"tJPg":[function(require,module,exports) {
"use strict";var t=require("../operators");function e(e,s,r,n){var a=r(require("./Node"));function i(t,s,r){if(!(this instanceof i))throw new SyntaxError("Constructor must be called with the new operator");if(!e.isNode(t))throw new TypeError("Node expected");if(!e.isNode(s))throw new TypeError("Node expected");if(r&&!e.isNode(r))throw new TypeError("Node expected");if(arguments.length>3)throw new Error("Too many arguments");this.start=t,this.end=s,this.step=r||null}function o(e,s){var r=t.getPrecedence(e,s),n={},a=t.getPrecedence(e.start,s);if(n.start=null!==a&&a<=r||"all"===s,e.step){var i=t.getPrecedence(e.step,s);n.step=null!==i&&i<=r||"all"===s}var o=t.getPrecedence(e.end,s);return n.end=null!==o&&o<=r||"all"===s,n}return i.prototype=new a,i.prototype.type="RangeNode",i.prototype.isRangeNode=!0,i.prototype.needsEnd=function(){return this.filter(function(t){return e.isSymbolNode(t)&&"end"===t.name}).length>0},i.prototype._compile=function(t,e){var s=t.range,r=this.start._compile(t,e),n=this.end._compile(t,e);if(this.step){var a=this.step._compile(t,e);return function(t,e,i){return s(r(t,e,i),n(t,e,i),a(t,e,i))}}return function(t,e,a){return s(r(t,e,a),n(t,e,a))}},i.prototype.forEach=function(t){t(this.start,"start",this),t(this.end,"end",this),this.step&&t(this.step,"step",this)},i.prototype.map=function(t){return new i(this._ifNode(t(this.start,"start",this)),this._ifNode(t(this.end,"end",this)),this.step&&this._ifNode(t(this.step,"step",this)))},i.prototype.clone=function(){return new i(this.start,this.end,this.step&&this.step)},i.prototype._toString=function(t){var e,s=o(this,t&&t.parenthesis?t.parenthesis:"keep"),r=this.start.toString(t);if(s.start&&(r="("+r+")"),e=r,this.step){var n=this.step.toString(t);s.step&&(n="("+n+")"),e+=":"+n}var a=this.end.toString(t);return s.end&&(a="("+a+")"),e+=":"+a},i.prototype.toJSON=function(){return{mathjs:"RangeNode",start:this.start,end:this.end,step:this.step}},i.fromJSON=function(t){return new i(t.start,t.end,t.step)},i.prototype.toHTML=function(t){var e,s=o(this,t&&t.parenthesis?t.parenthesis:"keep"),r=this.start.toHTML(t);if(s.start&&(r='<span class="math-parenthesis math-round-parenthesis">(</span>'+r+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e=r,this.step){var n=this.step.toHTML(t);s.step&&(n='<span class="math-parenthesis math-round-parenthesis">(</span>'+n+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+='<span class="math-operator math-range-operator">:</span>'+n}var a=this.end.toHTML(t);return s.end&&(a='<span class="math-parenthesis math-round-parenthesis">(</span>'+a+'<span class="math-parenthesis math-round-parenthesis">)</span>'),e+='<span class="math-operator math-range-operator">:</span>'+a},i.prototype._toTex=function(t){var e=o(this,t&&t.parenthesis?t.parenthesis:"keep"),s=this.start.toTex(t);if(e.start&&(s="\\left(".concat(s,"\\right)")),this.step){var r=this.step.toTex(t);e.step&&(r="\\left(".concat(r,"\\right)")),s+=":"+r}var n=this.end.toTex(t);return e.end&&(n="\\left(".concat(n,"\\right)")),s+=":"+n},i}exports.name="RangeNode",exports.path="expression.node",exports.factory=e;
},{"../operators":"Huid","./Node":"dnbo"}],"E94o":[function(require,module,exports) {
"use strict";var t=require("../operators"),r=require("../../utils/latex"),e=require("../../utils/string").escape;function a(a,n,o,i){var s=o(require("./Node")),p=require("../../utils/customs").getSafeProperty;function l(t,r){if(!(this instanceof l))throw new SyntaxError("Constructor must be called with the new operator");if(!Array.isArray(t))throw new TypeError("Parameter conditionals must be an array");if(!Array.isArray(r))throw new TypeError("Parameter params must be an array");if(t.length!==r.length-1)throw new TypeError("Parameter params must contain exactly one more element than parameter conditionals");this.conditionals=t,this.params=r}return l.prototype=new s,l.prototype.type="RelationalNode",l.prototype.isRelationalNode=!0,l.prototype._compile=function(t,r){var e=this,a=this.params.map(function(e){return e._compile(t,r)});return function(r,n,o){for(var i,s=a[0](r,n,o),l=0;l<e.conditionals.length;l++){if(i=s,s=a[l+1](r,n,o),!p(t,e.conditionals[l])(i,s))return!1}return!0}},l.prototype.forEach=function(t){var r=this;this.params.forEach(function(e,a){return t(e,"params["+a+"]",r)},this)},l.prototype.map=function(t){var r=this;return new l(this.conditionals.slice(),this.params.map(function(e,a){return r._ifNode(t(e,"params["+a+"]",r))},this))},l.prototype.clone=function(){return new l(this.conditionals,this.params)},l.prototype._toString=function(r){for(var e=r&&r.parenthesis?r.parenthesis:"keep",a=t.getPrecedence(this,e),n=this.params.map(function(n,o){var i=t.getPrecedence(n,e);return"all"===e||null!==i&&i<=a?"("+n.toString(r)+")":n.toString(r)}),o={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},i=n[0],s=0;s<this.conditionals.length;s++)i+=" "+o[this.conditionals[s]]+" "+n[s+1];return i},l.prototype.toJSON=function(){return{mathjs:"RelationalNode",conditionals:this.conditionals,params:this.params}},l.fromJSON=function(t){return new l(t.conditionals,t.params)},l.prototype.toHTML=function(r){for(var a=r&&r.parenthesis?r.parenthesis:"keep",n=t.getPrecedence(this,a),o=this.params.map(function(e,o){var i=t.getPrecedence(e,a);return"all"===a||null!==i&&i<=n?'<span class="math-parenthesis math-round-parenthesis">(</span>'+e.toHTML(r)+'<span class="math-parenthesis math-round-parenthesis">)</span>':e.toHTML(r)}),i={equal:"==",unequal:"!=",smaller:"<",larger:">",smallerEq:"<=",largerEq:">="},s=o[0],p=0;p<this.conditionals.length;p++)s+='<span class="math-operator math-binary-operator math-explicit-binary-operator">'+e(i[this.conditionals[p]])+"</span>"+o[p+1];return s},l.prototype._toTex=function(e){for(var a=e&&e.parenthesis?e.parenthesis:"keep",n=t.getPrecedence(this,a),o=this.params.map(function(r,o){var i=t.getPrecedence(r,a);return"all"===a||null!==i&&i<=n?"\\left("+r.toTex(e)+"\right)":r.toTex(e)}),i=o[0],s=0;s<this.conditionals.length;s++)i+=r.operators[this.conditionals[s]]+o[s+1];return i},l}exports.name="RelationalNode",exports.path="expression.node",exports.factory=a;
},{"../operators":"Huid","../../utils/latex":"H1Mr","../../utils/string":"PshC","./Node":"dnbo","../../utils/customs":"PAPk"}],"EUvE":[function(require,module,exports) {
"use strict";function e(){return(e=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}var n=require("../error/ArgumentsError"),t=require("../utils/collection/deepMap");function o(o,r,i,u){var a=i(require("../type/numeric")),f=i(require("./node/AccessorNode")),s=i(require("./node/ArrayNode")),k=i(require("./node/AssignmentNode")),c=i(require("./node/BlockNode")),d=i(require("./node/ConditionalNode")),p=i(require("./node/ConstantNode")),l=i(require("./node/FunctionAssignmentNode")),h=i(require("./node/IndexNode")),w=i(require("./node/ObjectNode")),v=i(require("./node/OperatorNode")),D=i(require("./node/ParenthesisNode")),y=i(require("./node/FunctionNode")),m=i(require("./node/RangeNode")),g=i(require("./node/RelationalNode")),x=i(require("./node/SymbolNode"));function N(e,r){if(1!==arguments.length&&2!==arguments.length)throw new n("parse",arguments.length,1,2);var i=r&&r.nodes?r.nodes:{};if("string"==typeof e)return F(e,i);if(Array.isArray(e)||e instanceof o.Matrix)return t(e,function(e){if("string"!=typeof e)throw new TypeError("String expected");return F(e,i)});throw new TypeError("String or matrix expected")}var E={NULL:0,DELIMITER:1,NUMBER:2,SYMBOL:3,UNKNOWN:4},L={",":!0,"(":!0,")":!0,"[":!0,"]":!0,"{":!0,"}":!0,'"':!0,"'":!0,";":!0,"+":!0,"-":!0,"*":!0,".*":!0,"/":!0,"./":!0,"%":!0,"^":!0,".^":!0,"~":!0,"!":!0,"&":!0,"|":!0,"^|":!0,"=":!0,":":!0,"?":!0,"==":!0,"!=":!0,"<":!0,">":!0,"<=":!0,">=":!0,"<<":!0,">>":!0,">>>":!0},T={mod:!0,to:!0,in:!0,and:!0,xor:!0,or:!0,not:!0},M={true:!0,false:!1,null:null,undefined:void 0},O=["NaN","Infinity"];function b(e,n){return e.expression.substr(e.index,n)}function A(e){return b(e,1)}function C(e){e.index++}function S(e){return e.expression.charAt(e.index-1)}function I(e){return e.expression.charAt(e.index+1)}function q(e){for(e.tokenType=E.NULL,e.token="",e.comment="";N.isWhitespace(A(e),e.nestingLevel);)C(e);if("#"===A(e))for(;"\n"!==A(e)&&""!==A(e);)e.comment+=A(e),C(e);if(""!==A(e)){if("\n"===A(e)&&!e.nestingLevel)return e.tokenType=E.DELIMITER,e.token=A(e),void C(e);var n=A(e),t=b(e,2),o=b(e,3);if(3===o.length&&L[o])return e.tokenType=E.DELIMITER,e.token=o,C(e),C(e),void C(e);if(2===t.length&&L[t])return e.tokenType=E.DELIMITER,e.token=t,C(e),void C(e);if(L[n])return e.tokenType=E.DELIMITER,e.token=n,void C(e);if(N.isDigitDot(n)){if(e.tokenType=E.NUMBER,"."===A(e))e.token+=A(e),C(e),N.isDigit(A(e))||(e.tokenType=E.DELIMITER);else{for(;N.isDigit(A(e));)e.token+=A(e),C(e);N.isDecimalMark(A(e),I(e))&&(e.token+=A(e),C(e))}for(;N.isDigit(A(e));)e.token+=A(e),C(e);if("E"===A(e)||"e"===A(e))if(N.isDigit(I(e))||"-"===I(e)||"+"===I(e)){if(e.token+=A(e),C(e),"+"!==A(e)&&"-"!==A(e)||(e.token+=A(e),C(e)),!N.isDigit(A(e)))throw ie(e,'Digit expected, got "'+A(e)+'"');for(;N.isDigit(A(e));)e.token+=A(e),C(e);if(N.isDecimalMark(A(e),I(e)))throw ie(e,'Digit expected, got "'+A(e)+'"')}else if("."===I(e))throw C(e),ie(e,'Digit expected, got "'+A(e)+'"')}else{if(!N.isAlpha(A(e),S(e),I(e))){for(e.tokenType=E.UNKNOWN;""!==A(e);)e.token+=A(e),C(e);throw ie(e,'Syntax error in part "'+e.token+'"')}for(;N.isAlpha(A(e),S(e),I(e))||N.isDigit(A(e));)e.token+=A(e),C(e);T.hasOwnProperty(e.token)?e.tokenType=E.DELIMITER:e.tokenType=E.SYMBOL}}else e.tokenType=E.DELIMITER}function P(e){do{q(e)}while("\n"===e.token)}function B(e){e.nestingLevel++}function R(e){e.nestingLevel--}function F(n,t){var o={extraNodes:{},expression:"",comment:"",index:0,token:"",tokenType:E.NULL,nestingLevel:0,conditionalLevel:null};e(o,{expression:n,extraNodes:t}),q(o);var r=function(e){var n,t,o=[];""!==e.token&&"\n"!==e.token&&";"!==e.token&&((n=U(e)).comment=e.comment);for(;"\n"===e.token||";"===e.token;)0===o.length&&n&&(t=";"!==e.token,o.push({node:n,visible:t})),q(e),"\n"!==e.token&&";"!==e.token&&""!==e.token&&((n=U(e)).comment=e.comment,t=";"!==e.token,o.push({node:n,visible:t}));return o.length>0?new c(o):(n||((n=new p(void 0)).comment=e.comment),n)}(o);if(""!==o.token)throw o.tokenType===E.DELIMITER?ue(o,"Unexpected operator "+o.token):ie(o,'Unexpected part "'+o.token+'"');return r}function U(e){var n,t,r,i,u=function(e){var n=function(e){var n=Y(e);for(;"or"===e.token;)P(e),n=new v("or","or",[n,Y(e)]);return n}(e);for(;"?"===e.token;){var t=e.conditionalLevel;e.conditionalLevel=e.nestingLevel,P(e);var o=n,r=U(e);if(":"!==e.token)throw ie(e,"False part of conditional expression expected");e.conditionalLevel=null,P(e);var i=U(e);n=new d(o,r,i),e.conditionalLevel=t}return n}(e);if("="===e.token){if(o.isSymbolNode(u))return n=u.name,P(e),r=U(e),new k(new x(n),r);if(o.isAccessorNode(u))return P(e),r=U(e),new k(u.object,u.index,r);if(o.isFunctionNode(u)&&o.isSymbolNode(u.fn)&&(i=!0,t=[],n=u.name,u.args.forEach(function(e,n){o.isSymbolNode(e)?t[n]=e.name:i=!1}),i))return P(e),r=U(e),new l(n,t,r);throw ie(e,"Invalid left hand side of assignment operator =")}return u}function Y(e){for(var n=j(e);"xor"===e.token;)P(e),n=new v("xor","xor",[n,j(e)]);return n}function j(e){for(var n=V(e);"and"===e.token;)P(e),n=new v("and","and",[n,V(e)]);return n}function V(e){for(var n=$(e);"|"===e.token;)P(e),n=new v("|","bitOr",[n,$(e)]);return n}function $(e){for(var n=W(e);"^|"===e.token;)P(e),n=new v("^|","bitXor",[n,W(e)]);return n}function W(e){for(var n=G(e);"&"===e.token;)P(e),n=new v("&","bitAnd",[n,G(e)]);return n}function G(e){for(var n=[J(e)],t=[],o={"==":"equal","!=":"unequal","<":"smaller",">":"larger","<=":"smallerEq",">=":"largerEq"};o.hasOwnProperty(e.token);){var r={name:e.token,fn:o[e.token]};t.push(r),P(e),n.push(J(e))}return 1===n.length?n[0]:2===n.length?new v(t[0].name,t[0].fn,n):new g(t.map(function(e){return e.fn}),n)}function J(e){var n,t,o,r,i;for(n=K(e),t={"<<":"leftShift",">>":"rightArithShift",">>>":"rightLogShift"};t.hasOwnProperty(e.token);)r=t[o=e.token],P(e),i=[n,K(e)],n=new v(o,r,i);return n}function K(e){var n,t,o,r,i;for(n=z(e),t={to:"to",in:"to"};t.hasOwnProperty(e.token);)r=t[o=e.token],P(e),"in"===o&&""===e.token?n=new v("*","multiply",[n,new x("in")],!0):(i=[n,z(e)],n=new v(o,r,i));return n}function z(e){var n,t=[];if(n=":"===e.token?new p(1):X(e),":"===e.token&&e.conditionalLevel!==e.nestingLevel){for(t.push(n);":"===e.token&&t.length<3;)P(e),")"===e.token||"]"===e.token||","===e.token||""===e.token?t.push(new x("end")):t.push(X(e));n=3===t.length?new m(t[0],t[2],t[1]):new m(t[0],t[1])}return n}function X(e){var n,t,o,r,i;for(n=Z(e),t={"+":"add","-":"subtract"};t.hasOwnProperty(e.token);)r=t[o=e.token],P(e),i=[n,Z(e)],n=new v(o,r,i);return n}function Z(e){var n,t,o,r,i;for(t=n=_(e),o={"*":"multiply",".*":"dotMultiply","/":"divide","./":"dotDivide","%":"mod",mod:"mod"};o.hasOwnProperty(e.token);)i=o[r=e.token],P(e),t=_(e),n=new v(r,i,[n,t]);return n}function _(e){var n,t;for(t=n=H(e);e.tokenType===E.SYMBOL||"in"===e.token&&o.isConstantNode(n)||!(e.tokenType!==E.NUMBER||o.isConstantNode(t)||o.isOperatorNode(t)&&"!"!==t.op)||"("===e.token;)t=H(e),n=new v("*","multiply",[n,t],!0);return n}function H(n){for(var t=Q(n),r=t,i=[];"/"===n.token&&o.isConstantNode(r);){if(i.push(e({},n)),P(n),n.tokenType!==E.NUMBER){e(n,i.pop());break}if(i.push(e({},n)),P(n),n.tokenType!==E.SYMBOL&&"("!==n.token){i.pop(),e(n,i.pop());break}e(n,i.pop()),i.pop(),r=Q(n),t=new v("/","divide",[t,r])}return t}function Q(e){var n,t,o,i={"-":"unaryMinus","+":"unaryPlus","~":"bitNot",not:"not"};return i.hasOwnProperty(e.token)?(o=i[e.token],n=e.token,P(e),t=[Q(e)],new v(n,o,t)):function(e){var n,t,o,i;n=function(e){var n,t,o,i;for(n=function(e){var n=[];if(e.tokenType===E.SYMBOL&&e.extraNodes.hasOwnProperty(e.token)){var t=e.extraNodes[e.token];if(q(e),"("===e.token){if(n=[],B(e),q(e),")"!==e.token)for(n.push(U(e));","===e.token;)q(e),n.push(U(e));if(")"!==e.token)throw ie(e,"Parenthesis ) expected");R(e),q(e)}return new t(n)}return function(e){var n,t;return e.tokenType===E.SYMBOL||e.tokenType===E.DELIMITER&&e.token in T?(t=e.token,q(e),n=M.hasOwnProperty(t)?new p(M[t]):-1!==O.indexOf(t)?new p(a(t,"number")):new x(t),n=ee(e,n)):function(e){var n,t;return'"'===e.token?(t=ne(e),n=new p(t),n=ee(e,n)):function(e){var n,t;return"'"===e.token?(t=te(e),n=new p(t),n=ee(e,n)):function(e){var n,t,o,i;if("["===e.token){if(B(e),q(e),"]"!==e.token){var u=oe(e);if(";"===e.token){for(o=1,t=[u];";"===e.token;)q(e),t[o]=oe(e),o++;if("]"!==e.token)throw ie(e,"End of matrix ] expected");R(e),q(e),i=t[0].items.length;for(var f=1;f<o;f++)if(t[f].items.length!==i)throw ue(e,"Column dimensions mismatch ("+t[f].items.length+" !== "+i+")");n=new s(t)}else{if("]"!==e.token)throw ie(e,"End of matrix ] expected");R(e),q(e),n=u}}else R(e),q(e),n=new s([]);return ee(e,n)}return function(e){if("{"===e.token){var n;B(e);var t={};do{if(q(e),"}"!==e.token){if('"'===e.token)n=ne(e);else if("'"===e.token)n=te(e);else{if(e.tokenType!==E.SYMBOL)throw ie(e,"Symbol or string expected as object key");n=e.token,q(e)}if(":"!==e.token)throw ie(e,"Colon : expected after object key");q(e),t[n]=U(e)}}while(","===e.token);if("}"!==e.token)throw ie(e,"Comma , or bracket } expected after object value");R(e),q(e);var o=new w(t);return o=ee(e,o)}return function(e){var n;return e.tokenType===E.NUMBER?(n=e.token,q(e),new p(a(n,r.number))):function(e){var n;if("("===e.token){if(B(e),q(e),n=U(e),")"!==e.token)throw ie(e,"Parenthesis ) expected");return R(e),q(e),n=new D(n),n=ee(e,n)}return function(e){throw""===e.token?ie(e,"Unexpected end of expression"):ie(e,"Value expected")}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e)}(e),t={"!":"factorial","'":"ctranspose"};t.hasOwnProperty(e.token);)o=e.token,i=t[o],q(e),n=new v(o,i,[n]),n=ee(e,n);return n}(e),("^"===e.token||".^"===e.token)&&(t=e.token,o="^"===t?"pow":"dotPow",P(e),i=[n,Q(e)],n=new v(t,o,i));return n}(e)}function ee(e,n,t){for(var r;!("("!==e.token&&"["!==e.token&&"."!==e.token||t&&-1===t.indexOf(e.token));)if(r=[],"("===e.token){if(!o.isSymbolNode(n)&&!o.isAccessorNode(n))return n;if(B(e),q(e),")"!==e.token)for(r.push(U(e));","===e.token;)q(e),r.push(U(e));if(")"!==e.token)throw ie(e,"Parenthesis ) expected");R(e),q(e),n=new y(n,r)}else if("["===e.token){if(B(e),q(e),"]"!==e.token)for(r.push(U(e));","===e.token;)q(e),r.push(U(e));if("]"!==e.token)throw ie(e,"Parenthesis ] expected");R(e),q(e),n=new f(n,new h(r))}else{if(q(e),e.tokenType!==E.SYMBOL)throw ie(e,"Property name expected after dot");r.push(new p(e.token)),q(e);n=new f(n,new h(r,!0))}return n}function ne(e){for(var n="";""!==A(e)&&'"'!==A(e);)"\\"===A(e)&&(n+=A(e),C(e)),n+=A(e),C(e);if(q(e),'"'!==e.token)throw ie(e,'End of string " expected');return q(e),JSON.parse('"'+n+'"')}function te(e){for(var n="";""!==A(e)&&"'"!==A(e);)"\\"===A(e)&&(n+=A(e),C(e)),n+=A(e),C(e);if(q(e),"'"!==e.token)throw ie(e,"End of string ' expected");return q(e),JSON.parse('"'+n+'"')}function oe(e){for(var n=[U(e)],t=1;","===e.token;)q(e),n[t]=U(e),t++;return new s(n)}function re(e){return e.index-e.token.length+1}function ie(e,n){var t=re(e),o=new SyntaxError(n+" (char "+t+")");return o.char=t,o}function ue(e,n){var t=re(e),o=new SyntaxError(n+" (char "+t+")");return o.char=t,o}return N.isAlpha=function(e,n,t){return N.isValidLatinOrGreek(e)||N.isValidMathSymbol(e,t)||N.isValidMathSymbol(n,e)},N.isValidLatinOrGreek=function(e){return/^[a-zA-Z_$\u00C0-\u02AF\u0370-\u03FF\u2100-\u214F]$/.test(e)},N.isValidMathSymbol=function(e,n){return/^[\uD835]$/.test(e)&&/^[\uDC00-\uDFFF]$/.test(n)&&/^[^\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDFCC\uDFCD]$/.test(n)},N.isWhitespace=function(e,n){return" "===e||"\t"===e||"\n"===e&&n>0},N.isDecimalMark=function(e,n){return"."===e&&"/"!==n&&"*"!==n&&"^"!==n},N.isDigitDot=function(e){return e>="0"&&e<="9"||"."===e},N.isDigit=function(e){return e>="0"&&e<="9"},N}exports.name="parse",exports.path="expression",exports.factory=o;
},{"../error/ArgumentsError":"h0xI","../utils/collection/deepMap":"lOYo","../type/numeric":"aA7E","./node/AccessorNode":"vZNf","./node/ArrayNode":"onTs","./node/AssignmentNode":"yw4P","./node/BlockNode":"QBkn","./node/ConditionalNode":"uzAW","./node/ConstantNode":"MNuy","./node/FunctionAssignmentNode":"PrPs","./node/IndexNode":"SN5L","./node/ObjectNode":"UI2T","./node/OperatorNode":"F3sc","./node/ParenthesisNode":"Mj7c","./node/FunctionNode":"ZLEq","./node/RangeNode":"tJPg","./node/RelationalNode":"E94o","./node/SymbolNode":"RtSa"}],"eDsC":[function(require,module,exports) {
"use strict";function r(r,t,n,e,a){var o=a.expression.node.FunctionNode,s=a.expression.node.OperatorNode,i=a.expression.node.SymbolNode,g={add:!0,multiply:!0},f={add:!0,multiply:!0};function u(t,n){if(!r.isOperatorNode(t))return!1;var e=t.fn.toString();return n&&n.hasOwnProperty(e)&&n[e].hasOwnProperty("associative")?n[e].associative:f[e]||!1}function c(t){var n,e=[];return u(t)?(n=t.op,function t(a){for(var o=0;o<a.args.length;o++){var s=a.args[o];r.isOperatorNode(s)&&n===s.op?t(s):e.push(s)}}(t),e):t.args}function p(t){return r.isOperatorNode(t)?function(r){try{return new s(t.op,t.fn,r,t.implicit)}catch(n){return console.error(n),[]}}:function(r){return new o(new i(t.name),r)}}return{createMakeNodeFunction:p,isCommutative:function(t,n){if(!r.isOperatorNode(t))return!0;var e=t.fn.toString();return n&&n.hasOwnProperty(e)&&n[e].hasOwnProperty("commutative")?n[e].commutative:g[e]||!1},isAssociative:u,flatten:function r(t){if(!t.args||0===t.args.length)return t;t.args=c(t);for(var n=0;n<t.args.length;n++)r(t.args[n])},allChildren:c,unflattenr:function r(t){if(t.args&&0!==t.args.length){for(var n=p(t),e=t.args.length,a=0;a<e;a++)r(t.args[a]);if(e>2&&u(t)){for(var o=t.args.pop();t.args.length>0;)o=n([t.args.pop(),o]);t.args=o.args}}},unflattenl:function r(t){if(t.args&&0!==t.args.length){for(var n=p(t),e=t.args.length,a=0;a<e;a++)r(t.args[a]);if(e>2&&u(t)){for(var o=t.args.shift();t.args.length>0;)o=n([o,t.args.shift()]);t.args=o.args}}}}}exports.factory=r,exports.math=!0;
},{}],"TWFw":[function(require,module,exports) {
"use strict";function e(e,n,r,t,o){var i=r(require("./util")),a=i.isCommutative,u=i.isAssociative,s=i.allChildren,c=i.createMakeNodeFunction,d=o.expression.node.ConstantNode,f=o.expression.node.OperatorNode,m=o.expression.node.FunctionNode;function l(n,r,t){try{return b(o[n].apply(null,r),t)}catch(i){return r=r.map(function(n){return e.isFraction(n)?n.valueOf():n}),b(o[n].apply(null,r),t)}}var p=t({Fraction:function(e){var n,r=e.s*e.n;n=r<0?new f("-","unaryMinus",[new d(-r)]):new d(r);if(1===e.d)return n;return new f("/","divide",[n,new d(e.d)])},number:function(e){return e<0?y(new d(-e)):new d(e)},BigNumber:function(e){return e<0?y(new d(-e)):new d(e)},Complex:function(e){throw new Error("Cannot convert Complex number to Node")}});function N(e,n){if(n&&!1!==n.exactFractions&&isFinite(e)){var r=o.fraction(e);if(r.valueOf()===e)return r}return e}var b=t({"string, Object":function(e,r){return"BigNumber"===n.number?o.bignumber(e):"Fraction"===n.number?o.fraction(e):N(parseFloat(e),r)},"Fraction, Object":function(e,n){return e},"BigNumber, Object":function(e,n){return e},"number, Object":function(e,n){return N(e,n)},"Complex, Object":function(e,n){return 0!==e.im?e:N(e.re,n)}});function y(e){return new f("-","unaryMinus",[e])}function v(n,r,t,o){return r.reduce(function(r,i){if(e.isNode(r)||e.isNode(i))e.isNode(r)?e.isNode(i)||(i=p(i)):r=p(r);else{try{return l(n,[r,i],o)}catch(a){}r=p(r),i=p(i)}return t([r,i])})}return function(n,r){var t=function n(r,t){switch(r.type){case"SymbolNode":return r;case"ConstantNode":return"number"!=typeof r.value&&isNaN(r.value)?r:b(r.value,t);case"FunctionNode":if(o[r.name]&&o[r.name].rawArgs)return r;if(-1===["add","multiply"].indexOf(r.name)){var i=r.args.map(function(e){return n(e,t)});if(!i.some(e.isNode))try{return l(r.name,i,t)}catch(x){}return i=i.map(function(n){return e.isNode(n)?n:p(n)}),new m(r.name,i)}case"OperatorNode":var d,f,N=r.fn.toString(),y=c(r);if(r.isUnary())d=[n(r.args[0],t)],f=e.isNode(d[0])?y(d):l(N,d,t);else if(u(r))if(d=(d=s(r)).map(function(e){return n(e,t)}),a(N)){for(var w=[],g=[],h=0;h<d.length;h++)e.isNode(d[h])?g.push(d[h]):w.push(d[h]);w.length>1?(f=v(N,w,y,t),g.unshift(f),f=v(N,g,y,t)):f=v(N,d,y,t)}else f=v(N,d,y,t);else d=r.args.map(function(e){return n(e,t)}),f=v(N,d,y,t);return f;case"ParenthesisNode":return n(r.content,t);case"AccessorNode":case"ArrayNode":case"AssignmentNode":case"BlockNode":case"FunctionAssignmentNode":case"IndexNode":case"ObjectNode":case"RangeNode":case"UpdateNode":case"ConditionalNode":default:throw new Error("Unimplemented node type in simplifyConstant: ".concat(r.type))}}(n,r);return e.isNode(t)?t:p(t)}}exports.math=!0,exports.name="simplifyConstant",exports.path="algebra.simplify",exports.factory=e;
},{"./util":"eDsC"}],"geyZ":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function n(n,e,t,u){var i=u("isZero",{number:function(r){return 0===r},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:function(r){return i(r.value)},"Array | Matrix":function(n){return r(n,i)}});return i}exports.name="isZero",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo"}],"IRmO":[function(require,module,exports) {
"use strict";var r=require("../../../utils/index"),t=r.object;function e(r,e,i,a){var n=i(require("../../../type/matrix/function/matrix")),u=i(require("../../arithmetic/abs")),o=i(require("../../arithmetic/addScalar")),s=i(require("../../arithmetic/divideScalar")),c=i(require("../../arithmetic/multiplyScalar")),f=i(require("../../arithmetic/subtract")),h=i(require("../../relational/larger")),p=i(require("../../relational/equalScalar")),l=i(require("../../arithmetic/unaryMinus")),v=r.SparseMatrix,m=r.DenseMatrix,g=r.Spa;function w(r){var e,i,a,n=r._size[0],l=r._size[1],v=Math.min(n,l),g=t.clone(r._data),w=[],S=[n,v],x=[],_=[v,l],d=[];for(e=0;e<n;e++)d[e]=e;for(i=0;i<l;i++){if(i>0)for(e=0;e<n;e++){var q=Math.min(e,i),z=0;for(a=0;a<q;a++)z=o(z,c(g[e][a],g[a][i]));g[e][i]=f(g[e][i],z)}var L=i,M=0,U=0;for(e=i;e<n;e++){var y=g[e][i],E=u(y);h(E,M)&&(L=e,M=E,U=y)}if(i!==L&&(d[i]=[d[L],d[L]=d[i]][0],m._swapRows(i,L,g)),i<n)for(e=i+1;e<n;e++){var R=g[e][i];p(R,0)||(g[e][i]=s(g[e][i],U))}}for(i=0;i<l;i++)for(e=0;e<n;e++)0===i&&(e<l&&(x[e]=[]),w[e]=[]),e<i?(e<l&&(x[e][i]=g[e][i]),i<n&&(w[e][i]=0)):e!==i?(e<l&&(x[e][i]=0),i<n&&(w[e][i]=g[e][i])):(e<l&&(x[e][i]=g[e][i]),i<n&&(w[e][i]=1));var b=new m({data:w,size:S}),D=new m({data:x,size:_}),O=[];for(e=0,v=d.length;e<v;e++)O[d[e]]=e;return{L:b,U:D,p:O,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}function S(r){var t,e,i,a=r._size[0],n=r._size[1],o=Math.min(a,n),f=r._values,m=r._index,w=r._ptr,S=[],x=[],_=[],d=[a,o],q=[],z=[],L=[],M=[o,n],U=[],y=[];for(t=0;t<a;t++)U[t]=t,y[t]=t;var E=function(){var r=new g;e<a&&(_.push(S.length),S.push(1),x.push(e)),L.push(q.length);var n=w[e],o=w[e+1];for(i=n;i<o;i++)t=m[i],r.set(U[t],f[i]);e>0&&r.forEach(0,e-1,function(t,e){v._forEachRow(t,S,x,_,function(i,a){i>t&&r.accumulate(i,l(c(a,e)))})});var E,R,b,D,O=e,P=r.get(e),j=u(P);r.forEach(e+1,a-1,function(r,t){var e=u(t);h(e,j)&&(O=r,j=e,P=t)}),e!==O&&(v._swapRows(e,O,d[1],S,x,_),v._swapRows(e,O,M[1],q,z,L),r.swap(e,O),R=O,b=y[E=e],D=y[R],U[b]=R,U[D]=E,y[E]=D,y[R]=b),r.forEach(0,a-1,function(r,t){r<=e?(q.push(t),z.push(r)):(t=s(t,P),p(t,0)||(S.push(t),x.push(r)))})};for(e=0;e<n;e++)E();return L.push(q.length),_.push(S.length),{L:new v({values:S,index:x,ptr:_,size:d}),U:new v({values:q,index:z,ptr:L,size:M}),p:U,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\nP: "+this.p}}}return a("lup",{DenseMatrix:function(r){return w(r)},SparseMatrix:function(r){return S(r)},Array:function(r){var t=w(n(r));return{L:t.L.valueOf(),U:t.U.valueOf(),p:t.p}}})}exports.name="lup",exports.factory=e;
},{"../../../utils/index":"fsXI","../../../type/matrix/function/matrix":"vzj5","../../arithmetic/abs":"K5X1","../../arithmetic/addScalar":"ZM3O","../../arithmetic/divideScalar":"R3aq","../../arithmetic/multiplyScalar":"obRw","../../arithmetic/subtract":"m78R","../../relational/larger":"SrDl","../../relational/equalScalar":"QvIw","../../arithmetic/unaryMinus":"q5A1"}],"KApf":[function(require,module,exports) {
"use strict";var r=require("../../utils/index"),e=r.object,t=r.string;function i(r,i,a,n){var u=a(require("../../type/matrix/function/matrix")),o=a(require("../arithmetic/subtract")),s=a(require("../arithmetic/multiply")),c=a(require("../arithmetic/unaryMinus")),f=a(require("../algebra/decomposition/lup")),l=n("det",{any:function(r){return e.clone(r)},"Array | Matrix":function(i){var a;switch((a=r.isMatrix(i)?i.size():Array.isArray(i)?(i=u(i)).size():[]).length){case 0:return e.clone(i);case 1:if(1===a[0])return e.clone(i.valueOf()[0]);throw new RangeError("Matrix must be square (size: "+t.format(a)+")");case 2:var n=a[0],l=a[1];if(n===l)return function(r,t,i){if(1===t)return e.clone(r[0][0]);if(2===t)return o(s(r[0][0],r[1][1]),s(r[1][0],r[0][1]));for(var a=f(r),n=a.U[0][0],u=1;u<t;u++)n=s(n,a.U[u][u]);for(var l=0,m=0,x=[];;){for(;x[m];)m++;if(m>=t)break;for(var h=m,p=0;!x[a.p[h]];)x[a.p[h]]=!0,h=a.p[h],p++;p%2==0&&l++}return l%2==0?n:c(n)}(i.clone().valueOf(),n);throw new RangeError("Matrix must be square (size: "+t.format(a)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+t.format(a)+")")}}});return l.toTex={1:"\\det\\left(${args[0]}\\right)"},l}exports.name="det",exports.factory=i;
},{"../../utils/index":"fsXI","../../type/matrix/function/matrix":"vzj5","../arithmetic/subtract":"m78R","../arithmetic/multiply":"k7By","../arithmetic/unaryMinus":"q5A1","../algebra/decomposition/lup":"IRmO"}],"yHuZ":[function(require,module,exports) {
"use strict";var r=require("../../utils/index");function e(e,t,i,a){var n=i(require("../../type/matrix/function/matrix")),o=i(require("../arithmetic/divideScalar")),u=i(require("../arithmetic/addScalar")),s=i(require("../arithmetic/multiply")),f=i(require("../arithmetic/unaryMinus")),c=i(require("../matrix/det")),m=i(require("./identity")),v=i(require("../arithmetic/abs")),l=a("inv",{"Array | Matrix":function(t){var i=e.isMatrix(t)?t.size():r.array.size(t);switch(i.length){case 1:if(1===i[0])return e.isMatrix(t)?n([o(1,t.valueOf()[0])]):[o(1,t[0])];throw new RangeError("Matrix must be square (size: "+r.string.format(i)+")");case 2:var a=i[0],u=i[1];if(a===u)return e.isMatrix(t)?n(h(t.valueOf(),a,u),t.storage()):h(t,a,u);throw new RangeError("Matrix must be square (size: "+r.string.format(i)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+r.string.format(i)+")")}},any:function(r){return o(1,r)}});function h(r,e,t){var i,a,n,l,h;if(1===e){if(0===(l=r[0][0]))throw Error("Cannot calculate inverse, determinant is zero");return[[o(1,l)]]}if(2===e){var x=c(r);if(0===x)throw Error("Cannot calculate inverse, determinant is zero");return[[o(r[1][1],x),o(f(r[0][1]),x)],[o(f(r[1][0]),x),o(r[0][0],x)]]}var d=r.concat();for(i=0;i<e;i++)d[i]=d[i].concat();for(var q=m(e).valueOf(),w=0;w<t;w++){var g=v(d[w][w]),y=w;for(i=w+1;i<e;)v(d[i][w])>g&&(g=v(d[i][w]),y=i),i++;if(0===g)throw Error("Cannot calculate inverse, determinant is zero");(i=y)!==w&&(h=d[w],d[w]=d[i],d[i]=h,h=q[w],q[w]=q[i],q[i]=h);var z=d[w],M=q[w];for(i=0;i<e;i++){var E=d[i],b=q[i];if(i!==w){if(0!==E[w]){for(n=o(f(E[w]),z[w]),a=w;a<t;a++)E[a]=u(E[a],s(n,z[a]));for(a=0;a<t;a++)b[a]=u(b[a],s(n,M[a]))}}else{for(n=z[w],a=w;a<t;a++)E[a]=o(E[a],n);for(a=0;a<t;a++)b[a]=o(b[a],n)}}}return q}return l.toTex={1:"\\left(${args[0]}\\right)^{-1}"},l}exports.name="inv",exports.factory=e;
},{"../../utils/index":"fsXI","../../type/matrix/function/matrix":"vzj5","../arithmetic/divideScalar":"R3aq","../arithmetic/addScalar":"ZM3O","../arithmetic/multiply":"k7By","../arithmetic/unaryMinus":"q5A1","../matrix/det":"KApf","./identity":"zJUT","../arithmetic/abs":"K5X1"}],"lVgQ":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").extend;function t(t,e,i,a){var n=i(require("./divideScalar")),u=i(require("./multiply")),o=i(require("../matrix/inv")),x=i(require("../../type/matrix/function/matrix")),s=i(require("../../type/matrix/utils/algorithm11")),y=i(require("../../type/matrix/utils/algorithm14")),c=a("divide",r({"Array | Matrix, Array | Matrix":function(r,t){return u(r,o(t))},"DenseMatrix, any":function(r,t){return y(r,t,n,!1)},"SparseMatrix, any":function(r,t){return s(r,t,n,!1)},"Array, any":function(r,t){return y(x(r),t,n,!1).valueOf()},"any, Array | Matrix":function(r,t){return u(r,o(t))}},n.signatures));return c.toTex={2:"\\frac{${args[0]}}{${args[1]}}"},c}exports.name="divide",exports.factory=t;
},{"../../utils/object":"FcSp","./divideScalar":"R3aq","./multiply":"k7By","../matrix/inv":"yHuZ","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm14":"S2eB"}],"c7UI":[function(require,module,exports) {
"use strict";function e(e,r,n,i,t){var a=n(require("../../relational/equal")),o=n(require("../../utils/isZero")),s=n(require("../../arithmetic/add")),u=n(require("../../arithmetic/subtract")),f=n(require("../../arithmetic/multiply")),p=n(require("../../arithmetic/divide")),l=n(require("../../arithmetic/pow")),d=t.expression.node.ConstantNode,v=t.expression.node.OperatorNode,N=t.expression.node.FunctionNode,w=t.expression.node.ParenthesisNode,c=new d(0),C=new d(1);return function r(n){if(e.isOperatorNode(n)&&n.isUnary()){var i=r(n.args[0]);if("+"===n.op)return i;if("-"===n.op){if(e.isOperatorNode(i)){if(i.isUnary()&&"-"===i.op)return i.args[0];if(i.isBinary()&&"subtract"===i.fn)return new v("-","subtract",[i.args[1],i.args[0]])}return new v(n.op,n.fn,[i])}}else if(e.isOperatorNode(n)&&n.isBinary()){var t=r(n.args[0]),m=r(n.args[1]);if("+"===n.op){if(e.isConstantNode(t)){if(o(t.value))return m;if(e.isConstantNode(m))return new d(s(t.value,m.value))}return e.isConstantNode(m)&&o(m.value)?t:e.isOperatorNode(m)&&m.isUnary()&&"-"===m.op?new v("-","subtract",[t,m.args[0]]):new v(n.op,n.fn,m?[t,m]:[t])}if("-"===n.op){if(e.isConstantNode(t)&&m){if(e.isConstantNode(m))return new d(u(t.value,m.value));if(o(t.value))return new v("-","unaryMinus",[m])}if("subtract"===n.fn)return e.isConstantNode(m)&&o(m.value)?t:e.isOperatorNode(m)&&m.isUnary()&&"-"===m.op?r(new v("+","add",[t,m.args[0]])):new v(n.op,n.fn,[t,m])}else{if("*"===n.op){if(e.isConstantNode(t)){if(o(t.value))return c;if(a(t.value,1))return m;if(e.isConstantNode(m))return new d(f(t.value,m.value))}if(e.isConstantNode(m)){if(o(m.value))return c;if(a(m.value,1))return t;if(e.isOperatorNode(t)&&t.isBinary()&&t.op===n.op){var g=t.args[0];if(e.isConstantNode(g)){var y=new d(f(g.value,m.value));return new v(n.op,n.fn,[y,t.args[1]],n.implicit)}}return new v(n.op,n.fn,[m,t],n.implicit)}return new v(n.op,n.fn,[t,m],n.implicit)}if("/"===n.op){if(e.isConstantNode(t)){if(o(t.value))return c;if(e.isConstantNode(m)&&(a(m.value,1)||a(m.value,2)||a(m.value,4)))return new d(p(t.value,m.value))}return new v(n.op,n.fn,[t,m])}if("^"===n.op){if(e.isConstantNode(m)){if(o(m.value))return C;if(a(m.value,1))return t;if(e.isConstantNode(t))return new d(l(t.value,m.value));if(e.isOperatorNode(t)&&t.isBinary()&&"^"===t.op){var h=t.args[1];if(e.isConstantNode(h))return new v(n.op,n.fn,[t.args[0],new d(f(h.value,m.value))])}}return new v(n.op,n.fn,[t,m])}}}else{if(e.isParenthesisNode(n)){var q=r(n.content);return e.isParenthesisNode(q)||e.isSymbolNode(q)||e.isConstantNode(q)?q:new w(q)}if(e.isFunctionNode(n)){var x=n.args.map(r).map(function(r){return e.isParenthesisNode(r)?r.content:r});return new N(r(n.fn),x)}}return n}}exports.math=!0,exports.name="simplifyCore",exports.path="algebra.simplify",exports.factory=e;
},{"../../relational/equal":"IviB","../../utils/isZero":"geyZ","../../arithmetic/add":"zf2Z","../../arithmetic/subtract":"m78R","../../arithmetic/multiply":"k7By","../../arithmetic/divide":"lVgQ","../../arithmetic/pow":"CsUv"}],"hHj3":[function(require,module,exports) {
"use strict";function e(e,r,n,o,t){var i=t.expression.node.Node,s=t.expression.node.OperatorNode,a=t.expression.node.FunctionNode,p=t.expression.node.ParenthesisNode;return function r(n,o){if(!o)return n;if(e.isSymbolNode(n)){var u=o[n.name];if(u instanceof i)return r(u,o);if("number"==typeof u)return t.parse(String(u))}else{if(e.isOperatorNode(n)){var f=n.args.map(function(e){return r(e,o)});return new s(n.op,n.fn,f,n.implicit)}if(e.isParenthesisNode(n))return new p(r(n.content,o));if(e.isFunctionNode(n)){var d=n.args.map(function(e){return r(e,o)});return new a(n.name,d)}}return n}}exports.math=!0,exports.name="resolve",exports.path="algebra.simplify",exports.factory=e;
},{}],"EVZ1":[function(require,module,exports) {
"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(e)}function e(r){return(e="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)})(r)}function r(n,r,t,o,i){var l=t(require("../../expression/parse")),a=t(require("../relational/equal")),s=t(require("../../expression/node/ConstantNode")),u=t(require("../../expression/node/FunctionNode")),f=t(require("../../expression/node/OperatorNode")),c=t(require("../../expression/node/ParenthesisNode")),p=t(require("../../expression/node/SymbolNode")),h=t(require("./simplify/simplifyConstant")),d=t(require("./simplify/simplifyCore")),m=t(require("./simplify/resolve")),g=t(require("./simplify/util")),y=g.isCommutative,v=g.isAssociative,b=g.flatten,x=g.unflattenr,N=g.unflattenl,O=g.createMakeNodeFunction,S=o("simplify",{string:function(n){return S(l(n),S.rules,{},{})},"string, Object":function(n,e){return S(l(n),S.rules,e,{})},"string, Object, Object":function(n,e,r){return S(l(n),S.rules,e,r)},"string, Array":function(n,e){return S(l(n),e,{},{})},"string, Array, Object":function(n,e,r){return S(l(n),e,r,{})},"string, Array, Object, Object":function(n,e,r,t){return S(l(n),e,r,t)},"Node, Object":function(n,e){return S(n,S.rules,e,{})},"Node, Object, Object":function(n,e,r){return S(n,S.rules,e,r)},Node:function(n){return S(n,S.rules,{},{})},"Node, Array":function(n,e){return S(n,e,{},{})},"Node, Array, Object":function(n,e,r){return S(n,e,r,{})},"Node, Array, Object, Object":function(n,r,t,o){r=function(n){for(var r=[],t=0;t<n.length;t++){var o=n[t],i=void 0,a=e(o);switch(a){case"string":var s=o.split("->");if(2!==s.length)throw SyntaxError("Could not parse rule: "+o);o={l:s[0],r:s[1]};case"object":if(i={l:j(l(o.l)),r:j(l(o.r))},o.context&&(i.evaluate=o.context),o.evaluate&&(i.evaluate=l(o.evaluate)),v(i.l)){var u=O(i.l),f=new p("_p"+q++);i.expanded={},i.expanded.l=u([i.l.clone(),f]),b(i.expanded.l),x(i.expanded.l),i.expanded.r=u([i.r,f])}break;case"function":i=o;break;default:throw TypeError("Unsupported type of rule: "+a)}r.push(i)}return r}(r);for(var i=m(n,t),a={},s=(i=j(i)).toString({parenthesis:"all"});!a[s];){a[s]=!0,q=0;for(var u=0;u<r.length;u++)"function"==typeof r[u]?i=r[u](i,o):(b(i),i=E(i,r[u])),N(i);s=i.toString({parenthesis:"all"})}return i}});function j(e){return e.transform(function(e,r,t){return n.isParenthesisNode(e)?e.content:e})}S.simplifyCore=d,S.resolve=m;var w={true:!0,false:!0,e:!0,i:!0,Infinity:!0,LN2:!0,LN10:!0,LOG2E:!0,LOG10E:!0,NaN:!0,phi:!0,pi:!0,SQRT1_2:!0,SQRT2:!0,tau:!0};S.rules=[d,{l:"log(e)",r:"1"},{l:"n-n1",r:"n+-n1"},{l:"-(c*v)",r:"(-c) * v"},{l:"-v",r:"(-1) * v"},{l:"n/n1^n2",r:"n*n1^-n2"},{l:"n/n1",r:"n*n1^-1"},{l:"(n ^ n1) ^ n2",r:"n ^ (n1 * n2)"},{l:"n*n",r:"n^2"},{l:"n * n^n1",r:"n^(n1+1)"},{l:"n^n1 * n^n2",r:"n^(n1+n2)"},{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},{l:"n1*n2 + n2",r:"(n1+1)*n2"},{l:"n1*n3 + n2*n3",r:"(n1+n2)*n3"},{l:"n1 + -1 * (n2 + n3)",r:"n1 + -1 * n2 + -1 * n3"},h,{l:"(-n)*n1",r:"-(n*n1)"},{l:"c+v",r:"v+c",context:{add:{commutative:!1}}},{l:"v*c",r:"c*v",context:{multiply:{commutative:!1}}},{l:"n+-n1",r:"n-n1"},{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"n-(n1+n2)",r:"n-n1-n2"},{l:"1*n",r:"n"}];var q=0;var E=o("applyRule",{"Node, Object":function(n,e){var r=n;if(r instanceof f||r instanceof u){if(r.args)for(var t=0;t<r.args.length;t++)r.args[t]=E(r.args[t],e)}else r instanceof c&&r.content&&(r.content=E(r.content,e));var o=e.r,i=P(e.l,r)[0];if(!i&&e.expanded&&(o=e.expanded.r,i=P(e.expanded.l,r)[0]),i){var l=r.implicit;r=o.clone(),l&&"implicit"in o&&(r.implicit=!0);r=function n(e){return e.isSymbolNode&&i.placeholders.hasOwnProperty(e.name)?i.placeholders[e.name].clone():e.map(n)}(r)}return r}});function A(n,e){var r={placeholders:{}};if(!n.placeholders&&!e.placeholders)return r;if(!n.placeholders)return e;if(!e.placeholders)return n;for(var t in n.placeholders)if(r.placeholders[t]=n.placeholders[t],e.placeholders.hasOwnProperty(t)&&!L(n.placeholders[t],e.placeholders[t]))return null;for(var o in e.placeholders)r.placeholders[o]=e.placeholders[o];return r}function C(n,e){var r,t=[];if(0===n.length||0===e.length)return t;for(var o=0;o<n.length;o++)for(var i=0;i<e.length;i++)(r=A(n[o],e[i]))&&t.push(r);return t}function P(e,r,t){var o=[{placeholders:{}}];if(e instanceof f&&r instanceof f||e instanceof u&&r instanceof u){if(e instanceof f){if(e.op!==r.op||e.fn!==r.fn)return[]}else if(e instanceof u&&e.name!==r.name)return[];if((1!==r.args.length||1!==e.args.length)&&v(r)&&!t){if(r.args.length>=2&&2===e.args.length){for(var l=function(n,e){var r,t,o=[],i=O(n);if(y(n,e))for(var l=0;l<n.args.length;l++)(t=n.args.slice(0)).splice(l,1),r=1===t.length?t[0]:i(t),o.push(i([n.args[l],r]));else r=1===(t=n.args.slice(1)).length?t[0]:i(t),o.push(i([n.args[0],r]));return o}(r,e.context),c=[],h=0;h<l.length;h++){var d=P(e,l[h],!0);c=c.concat(d)}return c}if(e.args.length>2)throw Error("Unexpected non-binary associative function: "+e.toString());return[]}for(var m=[],g=0;g<e.args.length;g++){var b=P(e.args[g],r.args[g]);if(0===b.length)return[];m.push(b)}o=function(n){if(0===n.length)return n;for(var e=n.reduce(C),r=[],t={},o=0;o<e.length;o++){var i=JSON.stringify(e[o]);t[i]||(t[i]=!0,r.push(e[o]))}return r}(m)}else if(e instanceof p){if(0===e.name.length)throw new Error("Symbol in rule has 0 length...!?");if(i.hasOwnProperty(e.name)){if(!w[e.name])throw new Error("Built in constant: "+e.name+" is not supported by simplify.");if(e.name!==r.name)return[]}else if("n"===e.name[0]||"_p"===e.name.substring(0,2))o[0].placeholders[e.name]=r;else if("v"===e.name[0]){if(n.isConstantNode(r))return[];o[0].placeholders[e.name]=r}else{if("c"!==e.name[0])throw new Error("Invalid symbol in rule: "+e.name);if(!(r instanceof s))return[];o[0].placeholders[e.name]=r}}else{if(!(e instanceof s))return[];if(!a(e.value,r.value))return[]}return o}function L(n,e){if(n instanceof s&&e instanceof s){if(!a(n.value,e.value))return!1}else if(n instanceof p&&e instanceof p){if(n.name!==e.name)return!1}else{if(!(n instanceof f&&e instanceof f||n instanceof u&&e instanceof u))return!1;if(n instanceof f){if(n.op!==e.op||n.fn!==e.fn)return!1}else if(n instanceof u&&n.name!==e.name)return!1;if(n.args.length!==e.args.length)return!1;for(var r=0;r<n.args.length;r++)if(!L(n.args[r],e.args[r]))return!1}return!0}return S}exports.math=!0,exports.name="simplify",exports.factory=r;
},{"../../expression/parse":"EUvE","../relational/equal":"IviB","../../expression/node/ConstantNode":"MNuy","../../expression/node/FunctionNode":"ZLEq","../../expression/node/OperatorNode":"F3sc","../../expression/node/ParenthesisNode":"Mj7c","../../expression/node/SymbolNode":"RtSa","./simplify/simplifyConstant":"TWFw","./simplify/simplifyCore":"c7UI","./simplify/resolve":"hHj3","./simplify/util":"eDsC"}],"VLL0":[function(require,module,exports) {
"use strict";function e(e,n,r,t){var o=r(require("../../expression/parse")),a=r(require("./simplify")),i=r(require("../relational/equal")),s=r(require("../utils/isZero")),c=r(require("../utils/typeof")),u=r(require("../../type/numeric")),l=r(require("../../expression/node/ConstantNode")),w=r(require("../../expression/node/FunctionNode")),d=r(require("../../expression/node/OperatorNode")),p=r(require("../../expression/node/ParenthesisNode")),g=r(require("../../expression/node/SymbolNode")),b=t("derivative",{"Node, SymbolNode, Object":function(e,n,r){var t={};m(t,e,n.name);var o=v(e,t);return r.simplify?a(o):o},"Node, SymbolNode":function(e,n){return b(e,n,{simplify:!0})},"string, SymbolNode":function(e,n){return b(o(e),n)},"string, SymbolNode, Object":function(e,n,r){return b(o(e),n,r)},"string, string":function(e,n){return b(o(e),o(n))},"string, string, Object":function(e,n,r){return b(o(e),o(n),r)},"Node, string":function(e,n){return b(e,o(n))},"Node, string, Object":function(e,n,r){return b(e,o(n),r)}});b._simplify=!0,b.toTex=function(e){return f.apply(null,e.args)};var f=t("_derivTex",{"Node, SymbolNode":function(n,r){return e.isConstantNode(n)&&"string"===c(n.value)?f(o(n.value).toString(),r.toString(),1):f(n.toString(),r.toString(),1)},"Node, ConstantNode":function(e,n){if("string"===c(n.value))return f(e,o(n.value));throw new Error("The second parameter to 'derivative' is a non-string constant")},"Node, SymbolNode, ConstantNode":function(e,n,r){return f(e.toString(),n.name,r.value)},"string, string, number":function(e,n,r){return(1===r?"{d\\over d"+n+"}":"{d^{"+r+"}\\over d"+n+"^{"+r+"}}")+"\\left[".concat(e,"\\right]")}}),m=t("constTag",{"Object, ConstantNode, string":function(e,n){return e[n]=!0,!0},"Object, SymbolNode, string":function(e,n,r){return n.name!==r&&(e[n]=!0,!0)},"Object, ParenthesisNode, string":function(e,n,r){return m(e,n.content,r)},"Object, FunctionAssignmentNode, string":function(e,n,r){return-1===n.params.indexOf(r)?(e[n]=!0,!0):m(e,n.expr,r)},"Object, FunctionNode | OperatorNode, string":function(e,n,r){if(n.args.length>0){for(var t=m(e,n.args[0],r),o=1;o<n.args.length;++o)t=m(e,n.args[o],r)&&t;if(t)return e[n]=!0,!0}return!1}}),v=t("_derivative",{"ConstantNode, Object":function(e){return y(0)},"SymbolNode, Object":function(e,n){return void 0!==n[e]?y(0):y(1)},"ParenthesisNode, Object":function(e,n){return new p(v(e.content,n))},"FunctionAssignmentNode, Object":function(e,n){return void 0!==n[e]?y(0):v(e.expr,n)},"FunctionNode, Object":function(e,n){if(1!==e.args.length&&function(e){if(("log"===e.name||"nthRoot"===e.name||"pow"===e.name)&&2===e.args.length)return;for(var n=0;n<e.args.length;++n)e.args[n]=y(0);throw e.compile().eval(),new Error("Expected TypeError, but none found")}(e),void 0!==n[e])return y(0);var r,t,o,a,i=e.args[0],s=!1,c=!1;switch(e.name){case"cbrt":s=!0,t=new d("*","multiply",[y(3),new d("^","pow",[i,new d("/","divide",[y(2),y(3)])])]);break;case"sqrt":case"nthRoot":if(1===e.args.length)s=!0,t=new d("*","multiply",[y(2),new w("sqrt",[i])]);else if(2===e.args.length)return n[r=new d("/","divide",[y(1),e.args[1]])]=n[e.args[1]],v(new d("^","pow",[i,r]),n);break;case"log10":r=y(10);case"log":if(r||1!==e.args.length){if(1===e.args.length&&r||2===e.args.length&&void 0!==n[e.args[1]])t=new d("*","multiply",[i.clone(),new w("log",[r||e.args[1]])]),s=!0;else if(2===e.args.length)return v(new d("/","divide",[new w("log",[i]),new w("log",[e.args[1]])]),n)}else t=i.clone(),s=!0;break;case"pow":return n[r]=n[e.args[1]],v(new d("^","pow",[i,e.args[1]]),n);case"exp":t=new w("exp",[i.clone()]);break;case"sin":t=new w("cos",[i.clone()]);break;case"cos":t=new d("-","unaryMinus",[new w("sin",[i.clone()])]);break;case"tan":t=new d("^","pow",[new w("sec",[i.clone()]),y(2)]);break;case"sec":t=new d("*","multiply",[e,new w("tan",[i.clone()])]);break;case"csc":c=!0,t=new d("*","multiply",[e,new w("cot",[i.clone()])]);break;case"cot":c=!0,t=new d("^","pow",[new w("csc",[i.clone()]),y(2)]);break;case"asin":s=!0,t=new w("sqrt",[new d("-","subtract",[y(1),new d("^","pow",[i.clone(),y(2)])])]);break;case"acos":s=!0,c=!0,t=new w("sqrt",[new d("-","subtract",[y(1),new d("^","pow",[i.clone(),y(2)])])]);break;case"atan":s=!0,t=new d("+","add",[new d("^","pow",[i.clone(),y(2)]),y(1)]);break;case"asec":s=!0,t=new d("*","multiply",[new w("abs",[i.clone()]),new w("sqrt",[new d("-","subtract",[new d("^","pow",[i.clone(),y(2)]),y(1)])])]);break;case"acsc":s=!0,c=!0,t=new d("*","multiply",[new w("abs",[i.clone()]),new w("sqrt",[new d("-","subtract",[new d("^","pow",[i.clone(),y(2)]),y(1)])])]);break;case"acot":s=!0,c=!0,t=new d("+","add",[new d("^","pow",[i.clone(),y(2)]),y(1)]);break;case"sinh":t=new w("cosh",[i.clone()]);break;case"cosh":t=new w("sinh",[i.clone()]);break;case"tanh":t=new d("^","pow",[new w("sech",[i.clone()]),y(2)]);break;case"sech":c=!0,t=new d("*","multiply",[e,new w("tanh",[i.clone()])]);break;case"csch":c=!0,t=new d("*","multiply",[e,new w("coth",[i.clone()])]);break;case"coth":c=!0,t=new d("^","pow",[new w("csch",[i.clone()]),y(2)]);break;case"asinh":s=!0,t=new w("sqrt",[new d("+","add",[new d("^","pow",[i.clone(),y(2)]),y(1)])]);break;case"acosh":s=!0,t=new w("sqrt",[new d("-","subtract",[new d("^","pow",[i.clone(),y(2)]),y(1)])]);break;case"atanh":s=!0,t=new d("-","subtract",[y(1),new d("^","pow",[i.clone(),y(2)])]);break;case"asech":s=!0,c=!0,t=new d("*","multiply",[i.clone(),new w("sqrt",[new d("-","subtract",[y(1),new d("^","pow",[i.clone(),y(2)])])])]);break;case"acsch":s=!0,c=!0,t=new d("*","multiply",[new w("abs",[i.clone()]),new w("sqrt",[new d("+","add",[new d("^","pow",[i.clone(),y(2)]),y(1)])])]);break;case"acoth":s=!0,c=!0,t=new d("-","subtract",[y(1),new d("^","pow",[i.clone(),y(2)])]);break;case"abs":t=new d("/","divide",[new w(new g("abs"),[i.clone()]),i.clone()]);break;case"gamma":default:throw new Error('Function "'+e.name+'" is not supported by derivative, or a wrong number of arguments is passed')}s?(o="/",a="divide"):(o="*",a="multiply");var u=v(i,n);return c&&(u=new d("-","unaryMinus",[u])),new d(o,a,[u,t])},"OperatorNode, Object":function(n,r){if(void 0!==r[n])return y(0);if("+"===n.op)return new d(n.op,n.fn,n.args.map(function(e){return v(e,r)}));if("-"===n.op){if(n.isUnary())return new d(n.op,n.fn,[v(n.args[0],r)]);if(n.isBinary())return new d(n.op,n.fn,[v(n.args[0],r),v(n.args[1],r)])}if("*"===n.op){var t=n.args.filter(function(e){return void 0!==r[e]});if(t.length>0){var o=n.args.filter(function(e){return void 0===r[e]}),a=1===o.length?o[0]:new d("*","multiply",o),c=t.concat(v(a,r));return new d("*","multiply",c)}return new d("+","add",n.args.map(function(e){return new d("*","multiply",n.args.map(function(n){return n===e?v(n,r):n.clone()}))}))}if("/"===n.op&&n.isBinary()){var u=n.args[0],l=n.args[1];return void 0!==r[l]?new d("/","divide",[v(u,r),l]):void 0!==r[u]?new d("*","multiply",[new d("-","unaryMinus",[u]),new d("/","divide",[v(l,r),new d("^","pow",[l.clone(),y(2)])])]):new d("/","divide",[new d("-","subtract",[new d("*","multiply",[v(u,r),l.clone()]),new d("*","multiply",[u.clone(),v(l,r)])]),new d("^","pow",[l.clone(),y(2)])])}if("^"===n.op&&n.isBinary()){var p=n.args[0],g=n.args[1];if(void 0!==r[p])return e.isConstantNode(p)&&(s(p.value)||i(p.value,1))?y(0):new d("*","multiply",[n,new d("*","multiply",[new w("log",[p.clone()]),v(g.clone(),r)])]);if(void 0!==r[g]){if(e.isConstantNode(g)){if(s(g.value))return y(0);if(i(g.value,1))return v(p,r)}var b=new d("^","pow",[p.clone(),new d("-","subtract",[g,y(1)])]);return new d("*","multiply",[g.clone(),new d("*","multiply",[v(p,r),b])])}return new d("*","multiply",[new d("^","pow",[p.clone(),g.clone()]),new d("+","add",[new d("*","multiply",[v(p,r),new d("/","divide",[g.clone(),p.clone()])]),new d("*","multiply",[v(g,r),new w("log",[p.clone()])])])])}throw new Error('Operator "'+n.op+'" is not supported by derivative, or a wrong number of arguments is passed')}});function y(e,r){return new l(u(e,r||n.number))}return b}exports.name="derivative",exports.factory=e;
},{"../../expression/parse":"EUvE","./simplify":"EVZ1","../relational/equal":"IviB","../utils/isZero":"geyZ","../utils/typeof":"LZTG","../../type/numeric":"aA7E","../../expression/node/ConstantNode":"MNuy","../../expression/node/FunctionNode":"ZLEq","../../expression/node/OperatorNode":"F3sc","../../expression/node/ParenthesisNode":"Mj7c","../../expression/node/SymbolNode":"RtSa"}],"uJKc":[function(require,module,exports) {
"use strict";function r(r,t,e,a){var s=e(require("../parse"));return a("parse",{"string | Array | Matrix":s,"string | Array | Matrix, Object":s})}exports.name="parse",exports.factory=r;
},{"../parse":"EUvE"}],"wmjX":[function(require,module,exports) {
"use strict";function n(n,r,e,o){var t=e(require("./simplify")),i=e(require("./simplify/simplifyCore")),a=e(require("./simplify/simplifyConstant")),l=e(require("../../expression/function/parse")),s=require("../../utils/number"),f=e(require("../../expression/node/ConstantNode")),u=e(require("../../expression/node/OperatorNode")),c=e(require("../../expression/node/SymbolNode")),p=o("rationalize",{string:function(n){return p(l(n),{},!1)},"string, boolean":function(n,r){return p(l(n),{},r)},"string, Object":function(n,r){return p(l(n),r,!1)},"string, Object, boolean":function(n,r,e){return p(l(n),r,e)},Node:function(n){return p(n,{},!1)},"Node, boolean":function(n,r){return p(n,{},r)},"Node, Object":function(n,r){return p(n,r,!1)},"Node, Object, boolean":function(n,r,e){var o=function(){var n=[i,{l:"n+n",r:"2*n"},{l:"n+-n",r:"0"},a,{l:"n*(n1^-1)",r:"n/n1"},{l:"n*n1^-n2",r:"n/n1^n2"},{l:"n1^-1",r:"1/n1"},{l:"n*(n1/n2)",r:"(n*n1)/n2"},{l:"1*n",r:"n"}],r=[{l:"(-n1)/(-n2)",r:"n1/n2"},{l:"(-n1)*(-n2)",r:"n1*n2"},{l:"n1--n2",r:"n1+n2"},{l:"n1-n2",r:"n1+(-n2)"},{l:"(n1+n2)*n3",r:"(n1*n3 + n2*n3)"},{l:"n1*(n2+n3)",r:"(n1*n2+n1*n3)"},{l:"c1*n + c2*n",r:"(c1+c2)*n"},{l:"c1*n + n",r:"(c1+1)*n"},{l:"c1*n - c2*n",r:"(c1-c2)*n"},{l:"c1*n - n",r:"(c1-1)*n"},{l:"v/c",r:"(1/c)*v"},{l:"v/-c",r:"-(1/c)*v"},{l:"-v*-c",r:"c*v"},{l:"-v*c",r:"-c*v"},{l:"v*-c",r:"-c*v"},{l:"v*c",r:"c*v"},{l:"-(-n1*n2)",r:"(n1*n2)"},{l:"-(n1*n2)",r:"(-n1*n2)"},{l:"-(-n1+n2)",r:"(n1-n2)"},{l:"-(n1+n2)",r:"(-n1-n2)"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"},{l:"-(-n1/n2)",r:"(n1/n2)"},{l:"-(n1/n2)",r:"(-n1/n2)"}],e=[{l:"(n1/(n2/n3))",r:"((n1*n3)/n2)"},{l:"(n1/n2/n3)",r:"(n1/(n2*n3))"}],o={};return o.firstRules=n.concat(r,e),o.distrDivRules=[{l:"(n1/n2 + n3/n4)",r:"((n1*n4 + n3*n2)/(n2*n4))"},{l:"(n1/n2 + n3)",r:"((n1 + n3*n2)/n2)"},{l:"(n1 + n2/n3)",r:"((n1*n3 + n2)/n3)"}],o.sucDivRules=e,o.firstRulesAgain=n.concat(r),o.finalRules=[i,{l:"n*-n",r:"-n^2"},{l:"n*n",r:"n^2"},a,{l:"n*-n^n1",r:"-n^(n1+1)"},{l:"n*n^n1",r:"n^(n1+1)"},{l:"n^n1*-n^n2",r:"-n^(n1+n2)"},{l:"n^n1*n^n2",r:"n^(n1+n2)"},{l:"n^n1*-n",r:"-n^(n1+1)"},{l:"n^n1*n",r:"n^(n1+1)"},{l:"n^n1/-n",r:"-n^(n1-1)"},{l:"n^n1/n",r:"n^(n1-1)"},{l:"n/-n^n1",r:"-n^(1-n1)"},{l:"n/n^n1",r:"n^(1-n1)"},{l:"n^n1/-n^n2",r:"n^(n1-n2)"},{l:"n^n1/n^n2",r:"n^(n1-n2)"},{l:"n1+(-n2*n3)",r:"n1-n2*n3"},{l:"v*(-c)",r:"-c*v"},{l:"n1+-n2",r:"n1-n2"},{l:"v*c",r:"c*v"},{l:"(n1^n2)^n3",r:"(n1^(n2*n3))"}],o}(),l=function(n,r,e,o){var i=[],a=t(n,o,r,{exactFractions:!1}),l="+-*"+((e=!!e)?"/":"");!function n(r){var e=r.type;if("FunctionNode"===e)throw new Error("There is an unsolved function call");if("OperatorNode"===e)if("^"===r.op){if("unaryMinus"===r.args[1].fn&&(r=r.args[0]),"ConstantNode"!==r.args[1].type||!s.isInteger(parseFloat(r.args[1].value)))throw new Error("There is a non-integer exponent");n(r.args[0])}else{if(-1===l.indexOf(r.op))throw new Error("Operator "+r.op+" invalid in polynomial expression");for(var o=0;o<r.args.length;o++)n(r.args[o])}else if("SymbolNode"===e){var t=r.name,a=i.indexOf(t);-1===a&&i.push(t)}else if("ParenthesisNode"===e)n(r.content);else if("ConstantNode"!==e)throw new Error("type "+e+" is not allowed in polynomial expression")}(a);var f={};return f.expression=a,f.variables=i,f}(n,r,!0,o.firstRules),c=l.variables.length;if(n=l.expression,c>=1){var p,d;n=function n(r,e,o){var t=r.type;var i=arguments.length>1;if("OperatorNode"===t&&r.isBinary()){var a,l=!1;if("^"===r.op&&("ParenthesisNode"!==r.args[0].type&&"OperatorNode"!==r.args[0].type||"ConstantNode"!==r.args[1].type||(a=parseFloat(r.args[1].value),l=a>=2&&s.isInteger(a))),l){if(a>2){var c=r.args[0],p=new u("^","pow",[r.args[0].cloneDeep(),new f(a-1)]);r=new u("*","multiply",[c,p])}else r=new u("*","multiply",[r.args[0],r.args[0].cloneDeep()]);i&&("content"===o?e.content=r:e.args[o]=r)}}if("ParenthesisNode"===t)n(r.content,r,"content");else if("ConstantNode"!==t&&"SymbolNode"!==t)for(var v=0;v<r.args.length;v++)n(r.args[v],r,v);if(!i)return r}(n);var w,g=!0,h=!1;for(n=t(n,o.firstRules,{},{exactFractions:!1});d=g?o.distrDivRules:o.sucDivRules,g=!g,(w=(n=t(n,d)).toString())!==p;)h=!0,p=w;h&&(n=t(n,o.firstRulesAgain,{},{exactFractions:!1})),n=t(n,o.finalRules,{},{exactFractions:!1})}var y=[],b={};return"OperatorNode"===n.type&&n.isBinary()&&"/"===n.op?(1===c&&(n.args[0]=v(n.args[0],y),n.args[1]=v(n.args[1])),e&&(b.numerator=n.args[0],b.denominator=n.args[1])):(1===c&&(n=v(n,y)),e&&(b.numerator=n,b.denominator=null)),e?(b.coefficients=y,b.variables=l.variables,b.expression=n,b):n}});function v(n,r){void 0===r&&(r=[]),r[0]=0;var e={cte:1,oper:"+",fire:""},o=0,t="";!function n(e,i,a){var l=e.type;if("FunctionNode"===l)throw new Error("There is an unsolved function call");if("OperatorNode"===l){if(-1==="+-*^".indexOf(e.op))throw new Error("Operator "+e.op+" invalid");if(null!==i){if(("unaryMinus"===e.fn||"pow"===e.fn)&&"add"!==i.fn&&"subtract"!==i.fn&&"multiply"!==i.fn)throw new Error("Invalid "+e.op+" placing");if(("subtract"===e.fn||"add"===e.fn||"multiply"===e.fn)&&"add"!==i.fn&&"subtract"!==i.fn)throw new Error("Invalid "+e.op+" placing");if(("subtract"===e.fn||"add"===e.fn||"unaryMinus"===e.fn)&&0!==a.noFil)throw new Error("Invalid "+e.op+" placing")}"^"!==e.op&&"*"!==e.op||(a.fire=e.op);for(var f=0;f<e.args.length;f++)"unaryMinus"===e.fn&&(a.oper="-"),"+"!==e.op&&"subtract"!==e.fn||(a.fire="",a.cte=1,a.oper=0===f?"+":e.op),a.noFil=f,n(e.args[f],e,a)}else if("SymbolNode"===l){if(e.name!==t&&""!==t)throw new Error("There is more than one variable");if(t=e.name,null===i)return void(r[1]=1);if("^"===i.op&&0!==a.noFil)throw new Error("In power the variable should be the first parameter");if("*"===i.op&&1!==a.noFil)throw new Error("In multiply the variable should be the second parameter");""!==a.fire&&"*"!==a.fire||(o<1&&(r[1]=0),r[1]+=a.cte*("+"===a.oper?1:-1),o=Math.max(1,o))}else{if("ConstantNode"!==l)throw new Error("Type "+l+" is not allowed");var u=parseFloat(e.value);if(null===i)return void(r[0]=u);if("^"===i.op){if(1!==a.noFil)throw new Error("Constant cannot be powered");if(!s.isInteger(u)||u<=0)throw new Error("Non-integer exponent is not allowed");for(var c=o+1;c<u;c++)r[c]=0;return u>o&&(r[u]=0),r[u]+=a.cte*("+"===a.oper?1:-1),void(o=Math.max(u,o))}a.cte=u,""===a.fire&&(r[0]+=a.cte*("+"===a.oper?1:-1))}}(n,null,e);for(var i,a=!0,l=o=r.length-1;l>=0;l--)if(0!==r[l]){var p=new f(a?r[l]:Math.abs(r[l])),v=r[l]<0?"-":"+";if(l>0){var d=new c(t);if(l>1){var w=new f(l);d=new u("^","pow",[d,w])}p=-1===r[l]&&a?new u("-","unaryMinus",[d]):1===Math.abs(r[l])?d:new u("*","multiply",[p,d])}i=a?p:"+"===v?new u("+","add",[i,p]):new u("-","subtract",[i,p]),a=!1}return a?new f(0):i}return p}exports.name="rationalize",exports.factory=n;
},{"./simplify":"EVZ1","./simplify/simplifyCore":"c7UI","./simplify/simplifyConstant":"TWFw","../../expression/function/parse":"uJKc","../../utils/number":"uqMu","../../expression/node/ConstantNode":"MNuy","../../expression/node/OperatorNode":"F3sc","../../expression/node/SymbolNode":"RtSa"}],"npE3":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").nearlyEqual,n=require("../../utils/bignumber/nearlyEqual");function e(e,t,u,i){var a=u(require("../../type/matrix/function/matrix")),o=u(require("../../type/matrix/utils/algorithm03")),l=u(require("../../type/matrix/utils/algorithm07")),s=u(require("../../type/matrix/utils/algorithm12")),f=u(require("../../type/matrix/utils/algorithm13")),c=u(require("../../type/matrix/utils/algorithm14")),x=require("../../utils/latex"),y=i("unequal",{"any, any":function(r,n){return null===r?null!==n:null===n?null!==r:void 0===r?void 0!==n:void 0===n?void 0!==r:m(r,n)},"SparseMatrix, SparseMatrix":function(r,n){return l(r,n,m)},"SparseMatrix, DenseMatrix":function(r,n){return o(n,r,m,!0)},"DenseMatrix, SparseMatrix":function(r,n){return o(r,n,m,!1)},"DenseMatrix, DenseMatrix":function(r,n){return f(r,n,m)},"Array, Array":function(r,n){return y(a(r),a(n)).valueOf()},"Array, Matrix":function(r,n){return y(a(r),n)},"Matrix, Array":function(r,n){return y(r,a(n))},"SparseMatrix, any":function(r,n){return s(r,n,m,!1)},"DenseMatrix, any":function(r,n){return c(r,n,m,!1)},"any, SparseMatrix":function(r,n){return s(n,r,m,!0)},"any, DenseMatrix":function(r,n){return c(n,r,m,!0)},"Array, any":function(r,n){return c(a(r),n,m,!1).valueOf()},"any, Array":function(r,n){return c(a(n),r,m,!0).valueOf()}}),m=i("_unequal",{"boolean, boolean":function(r,n){return r!==n},"number, number":function(n,e){return!r(n,e,t.epsilon)},"BigNumber, BigNumber":function(r,e){return!n(r,e,t.epsilon)},"Fraction, Fraction":function(r,n){return!r.equals(n)},"Complex, Complex":function(r,n){return!r.equals(n)},"Unit, Unit":function(r,n){if(!r.equalBase(n))throw new Error("Cannot compare units with different base");return y(r.value,n.value)}});return y.toTex={2:"\\left(${args[0]}".concat(x.operators.unequal,"${args[1]}\\right)")},y}exports.name="unequal",exports.factory=e;
},{"../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB","../../utils/latex":"H1Mr"}],"Zr7Q":[function(require,module,exports) {
"use strict";var r=require("../../utils/number"),n=require("../../utils/collection/deepMap");function e(e,t,i,u){var o=u("sign",{number:r.sign,Complex:function(r){return r.sign()},BigNumber:function(r){return new e.BigNumber(r.cmp(0))},Fraction:function(r){return new e.Fraction(r.s,1)},"Array | Matrix":function(r){return n(r,o,!0)},Unit:function(r){return o(r.value)}});return o.toTex={1:"\\mathrm{${name}}\\left(${args[0]}\\right)"},o}exports.name="sign",exports.factory=e;
},{"../../utils/number":"uqMu","../../utils/collection/deepMap":"lOYo"}],"T6pB":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,e,n,i){var u=i("sqrt",{number:o,Complex:function(r){return r.sqrt()},BigNumber:function(r){return!r.isNegative()||e.predictable?r.sqrt():o(r.toNumber())},"Array | Matrix":function(t){return r(t,u,!0)},Unit:function(r){return r.pow(.5)}});function o(r){return isNaN(r)?NaN:r>=0||e.predictable?Math.sqrt(r):new t.Complex(r,0).sqrt()}return u.toTex={1:"\\sqrt{${args[0]}}"},u}exports.name="sqrt",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"msvi":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,n,e,u){var o=u("conj",{number:function(r){return r},BigNumber:function(r){return r},Complex:function(r){return r.conjugate()},"Array | Matrix":function(t){return r(t,o)}});return o.toTex={1:"\\left(${args[0]}\\right)^*"},o}exports.name="conj",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"fqqA":[function(require,module,exports) {
"use strict";function r(r,e,t,i){var a=t(require("../../../type/matrix/function/matrix")),n=t(require("../../matrix/zeros")),o=t(require("../../matrix/identity")),u=t(require("../../utils/isZero")),c=t(require("../../relational/unequal")),f=t(require("../../arithmetic/sign")),s=t(require("../../arithmetic/sqrt")),m=t(require("../../complex/conj")),q=t(require("../../arithmetic/unaryMinus")),l=t(require("../../arithmetic/addScalar")),h=t(require("../../arithmetic/divideScalar")),v=t(require("../../arithmetic/multiplyScalar")),d=t(require("../../arithmetic/subtract"));function x(r){var e,t,i,a=r._size[0],x=r._size[1],p=o([a],"dense"),y=p._data,S=r.clone(),w=S._data,R=n([a],"");for(i=0;i<Math.min(x,a);++i){var g=w[i][i],Q=q(f(g)),M=m(Q),_=0;for(e=i;e<a;e++)_=l(_,v(w[e][i],m(w[e][i])));var z=v(Q,s(_));if(!u(z)){var E=d(g,z);for(R[i]=1,e=i+1;e<a;e++)R[e]=h(w[e][i],E);var O=q(m(h(E,z))),b=void 0;for(t=i;t<x;t++){for(b=0,e=i;e<a;e++)b=l(b,v(m(R[e]),w[e][t]));for(b=v(b,O),e=i;e<a;e++)w[e][t]=v(d(w[e][t],v(R[e],b)),M)}for(e=0;e<a;e++){for(b=0,t=i;t<a;t++)b=l(b,v(y[e][t],R[t]));for(b=v(b,O),t=i;t<a;++t)y[e][t]=h(d(y[e][t],v(b,m(R[t]))),M)}}}for(e=0;e<a;++e)for(t=0;t<e&&t<x;++t){if(c(0,h(w[e][t],1e5)))throw new Error("math.qr(): unknown error - R is not lower triangular (element ("+e+", "+t+") = "+w[e][t]+")");w[e][t]=v(w[e][t],0)}return{Q:p,R:S,toString:function(){return"Q: "+this.Q.toString()+"\nR: "+this.R.toString()}}}return i("qr",{DenseMatrix:function(r){return x(r)},SparseMatrix:function(r){return function(r){throw new Error("qr not implemented for sparse matrices yet")}()},Array:function(r){var e=x(a(r));return{Q:e.Q.valueOf(),R:e.R.valueOf()}}})}exports.name="qr",exports.factory=r;
},{"../../../type/matrix/function/matrix":"vzj5","../../matrix/zeros":"BAjv","../../matrix/identity":"zJUT","../../utils/isZero":"geyZ","../../relational/unequal":"npE3","../../arithmetic/sign":"Zr7Q","../../arithmetic/sqrt":"T6pB","../../complex/conj":"msvi","../../arithmetic/unaryMinus":"q5A1","../../arithmetic/addScalar":"ZM3O","../../arithmetic/divideScalar":"R3aq","../../arithmetic/multiplyScalar":"obRw","../../arithmetic/subtract":"m78R"}],"da3s":[function(require,module,exports) {
"use strict";function r(){return function(r){return-r-2}}exports.name="csFlip",exports.path="algebra.sparse",exports.factory=r;
},{}],"ppxA":[function(require,module,exports) {
"use strict";function e(){return function(e,r,t){for(var s=e._values,n=e._index,a=e._ptr,p=e._size[1],o=0,c=0;c<p;c++){var i=a[c];for(a[c]=o;i<a[c+1];i++)r(n[i],c,s?s[i]:1,t)&&(n[o]=n[i],s&&(s[o]=s[i]),o++)}return a[p]=o,n.splice(o,n.length-o),s&&s.splice(o,s.length-o),o}}exports.name="csFkeep",exports.path="algebra.sparse",exports.factory=e;
},{}],"xmPn":[function(require,module,exports) {
"use strict";function r(){return function(r,t,e,s,a,n,o){var c=0;for(e[o]=r;c>=0;){var f=e[o+c],p=e[s+f];-1===p?(c--,n[t++]=f):(e[s+f]=e[a+p],e[o+ ++c]=p)}return t}}exports.name="csTdfs",exports.path="algebra.sparse",exports.factory=r;
},{}],"C2z0":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").clone,e=require("../../utils/string").format;function t(t,a,n,s){var o=require("../../utils/latex"),i=n(require("../../type/matrix/function/matrix")),u=t.DenseMatrix,c=t.SparseMatrix,f=s("transpose",{Array:function(r){return f(i(r)).valueOf()},Matrix:function(t){var a,n=t.size();switch(n.length){case 1:a=t.clone();break;case 2:var s=n[0],o=n[1];if(0===o)throw new RangeError("Cannot transpose a 2D matrix with no columns (size: "+e(n)+")");switch(t.storage()){case"dense":a=function(e,t,a){for(var n,s=e._data,o=[],i=0;i<a;i++){n=o[i]=[];for(var c=0;c<t;c++)n[c]=r(s[c][i])}return new u({data:o,size:[a,t],datatype:e._datatype})}(t,s,o);break;case"sparse":a=function(e,t,a){for(var n,s,o,i=e._values,u=e._index,f=e._ptr,p=i?[]:void 0,l=[],v=[],x=[],d=0;d<t;d++)x[d]=0;for(n=0,s=u.length;n<s;n++)x[u[n]]++;for(var h=0,w=0;w<t;w++)v.push(h),h+=x[w],x[w]=v[w];for(v.push(h),o=0;o<a;o++)for(var g=f[o],m=f[o+1],y=g;y<m;y++){var _=x[u[y]]++;l[_]=o,i&&(p[_]=r(i[y]))}return new c({values:p,index:l,ptr:v,size:[a,t],datatype:e._datatype})}(t,s,o)}break;default:throw new RangeError("Matrix must be a vector or two dimensional (size: "+e(this._size)+")")}return a},any:function(e){return r(e)}});return f.toTex={1:"\\left(${args[0]}\\right)".concat(o.operators.transpose)},f}exports.name="transpose",exports.factory=t;
},{"../../utils/object":"FcSp","../../utils/string":"PshC","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5"}],"tamT":[function(require,module,exports) {
"use strict";function r(r,f,a){var e=a(require("./csFlip")),t=a(require("./csFkeep")),i=a(require("./csTdfs")),o=a(require("../../arithmetic/add")),n=a(require("../../arithmetic/multiply")),u=a(require("../../matrix/transpose"));function v(r,f,a,e,t){if(r<2||r+f<0){for(var i=0;i<t;i++)0!==a[e+i]&&(a[e+i]=1);r=2}return r}function s(r,f){return r!==f}return function(r,f){if(!f||r<=0||r>3)return null;var a=f._size,c=a[0],l=a[1],m=0,p=Math.max(16,10*Math.sqrt(l)),h=function(r,f,a,e,t){var i=u(f);if(1===r&&e===a)return o(f,i);if(2===r){for(var v=i._index,s=i._ptr,c=0,l=0;l<a;l++){var m=s[l];if(s[l]=c,!(s[l+1]-m>t))for(var p=s[l+1];m<p;m++)v[c++]=v[m]}return s[a]=c,f=u(i),n(i,f)}return n(i,f)}(r,f,c,l,p=Math.min(l-2,p));t(h,s,null);for(var x,q,M,d,_,g,y,F,b,k,z,A,T,j,w,B,C=h._index,D=h._ptr,E=D[l],G=[],H=[],I=l+1,J=2*(l+1),K=3*(l+1),L=4*(l+1),N=5*(l+1),O=6*(l+1),P=7*(l+1),Q=G,R=function(r,f,a,e,t,i,o,n,u,s,c,l){for(var m=0;m<r;m++)a[e+m]=f[m+1]-f[m];a[e+r]=0;for(var p=0;p<=r;p++)a[t+p]=-1,i[p]=-1,a[o+p]=-1,a[n+p]=-1,a[u+p]=1,a[s+p]=1,a[c+p]=0,a[l+p]=a[e+p];var h=v(0,0,a,s,r);return a[c+r]=-2,f[r]=-1,a[s+r]=0,h}(l,D,H,0,K,Q,J,P,I,O,L,N),S=function(r,f,a,t,i,o,n,u,v,s,c){for(var l=0,m=0;m<r;m++){var p=a[t+m];if(0===p)a[i+m]=-2,l++,f[m]=-1,a[o+m]=0;else if(p>n)a[u+m]=0,a[i+m]=-1,l++,f[m]=e(r),a[u+r]++;else{var h=a[v+p];-1!==h&&(s[h]=m),a[c+m]=a[v+p],a[v+p]=m}}return l}(l,D,H,N,L,O,p,I,K,Q,J),U=0;S<l;){for(M=-1;U<l&&-1===(M=H[K+U]);U++);-1!==H[J+M]&&(Q[H[J+M]]=-1),H[K+U]=H[J+M];var V=H[L+M],W=H[I+M];S+=W;var X=0;H[I+M]=-W;var Y=D[M],Z=0===V?Y:E,$=Z;for(d=1;d<=V+1;d++){for(d>V?(g=M,y=Y,F=H[0+M]-V):(y=D[g=C[Y++]],F=H[0+g]),_=1;_<=F;_++)(b=H[I+(x=C[y++])])<=0||(X+=b,H[I+x]=-b,C[$++]=x,-1!==H[J+x]&&(Q[H[J+x]]=Q[x]),-1!==Q[x]?H[J+Q[x]]=H[J+x]:H[K+H[N+x]]=H[J+x]);g!==M&&(D[g]=e(M),H[O+g]=0)}for(0!==V&&(E=$),H[N+M]=X,D[M]=Z,H[0+M]=$-Z,H[L+M]=-2,R=v(R,m,H,O,l),k=Z;k<$;k++)if(!((z=H[L+(x=C[k])])<=0)){var rr=R-(b=-H[I+x]);for(Y=D[x],A=D[x]+z-1;Y<=A;Y++)H[O+(g=C[Y])]>=R?H[O+g]-=b:0!==H[O+g]&&(H[O+g]=H[N+g]+rr)}for(k=Z;k<$;k++){for(T=(A=D[x=C[k]])+H[L+x]-1,j=A,w=0,B=0,Y=A;Y<=T;Y++)if(0!==H[O+(g=C[Y])]){var fr=H[O+g]-R;fr>0?(B+=fr,C[j++]=g,w+=g):(D[g]=e(M),H[O+g]=0)}H[L+x]=j-A+1;var ar=j,er=A+H[0+x];for(Y=T+1;Y<er;Y++){var tr=H[I+(q=C[Y])];tr<=0||(B+=tr,C[j++]=q,w+=q)}0===B?(D[x]=e(M),X-=b=-H[I+x],W+=b,S+=b,H[I+x]=0,H[L+x]=-1):(H[N+x]=Math.min(H[N+x],B),C[j]=C[ar],C[ar]=C[A],C[A]=M,H[0+x]=j-A+1,w=(w<0?-w:w)%l,H[J+x]=H[P+w],H[P+w]=x,Q[x]=w)}for(H[N+M]=X,R=v(R+(m=Math.max(m,X)),m,H,O,l),k=Z;k<$;k++)if(!(H[I+(x=C[k])]>=0))for(x=H[P+(w=Q[x])],H[P+w]=-1;-1!==x&&-1!==H[J+x];x=H[J+x],R++){for(F=H[0+x],z=H[L+x],Y=D[x]+1;Y<=D[x]+F-1;Y++)H[O+C[Y]]=R;var ir=x;for(q=H[J+x];-1!==q;){var or=H[0+q]===F&&H[L+q]===z;for(Y=D[q]+1;or&&Y<=D[q]+F-1;Y++)H[O+C[Y]]!==R&&(or=0);or?(D[q]=e(x),H[I+x]+=H[I+q],H[I+q]=0,H[L+q]=-1,q=H[J+q],H[J+ir]=q):(ir=q,q=H[J+q])}}for(Y=Z,k=Z;k<$;k++)(b=-H[I+(x=C[k])])<=0||(H[I+x]=b,B=H[N+x]+X-b,-1!==H[K+(B=Math.min(B,l-S-b))]&&(Q[H[K+B]]=x),H[J+x]=H[K+B],Q[x]=-1,H[K+B]=x,U=Math.min(U,B),H[N+x]=B,C[Y++]=x);H[I+M]=W,0==(H[0+M]=Y-Z)&&(D[M]=-1,H[O+M]=0),0!==V&&(E=Y)}for(x=0;x<l;x++)D[x]=e(D[x]);for(q=0;q<=l;q++)H[K+q]=-1;for(q=l;q>=0;q--)H[I+q]>0||(H[J+q]=H[K+D[q]],H[K+D[q]]=q);for(g=l;g>=0;g--)H[I+g]<=0||-1!==D[g]&&(H[J+g]=H[K+D[g]],H[K+D[g]]=g);for(M=0,x=0;x<=l;x++)-1===D[x]&&(M=i(x,M,H,K,J,G,O));return G.splice(G.length-1,1),G}}exports.name="csAmd",exports.path="algebra.sparse",exports.factory=r;
},{"./csFlip":"da3s","./csFkeep":"ppxA","./csTdfs":"xmPn","../../arithmetic/add":"zf2Z","../../arithmetic/multiply":"k7By","../../matrix/transpose":"C2z0"}],"rGf9":[function(require,module,exports) {
"use strict";function e(e){var r=e.SparseMatrix;return function(e,a,t,s){for(var n=e._values,p=e._index,u=e._ptr,i=e._size,o=e._datatype,v=i[0],l=i[1],x=s&&e._values?[]:null,_=[],c=[],f=0,d=0;d<l;d++){c[d]=f;for(var y=t?t[d]:d,m=u[y],z=u[y+1],b=m;b<z;b++){var g=a?a[p[b]]:p[b];_[f]=g,x&&(x[f]=n[b]),f++}}return c[l]=f,new r({values:x,index:_,ptr:c,size:[v,l],datatype:o})}}exports.name="csPermute",exports.path="algebra.sparse",exports.factory=e;
},{}],"vEli":[function(require,module,exports) {
"use strict";function r(){return function(r,e){if(!r)return null;var t,a,n=r._index,o=r._ptr,f=r._size,s=f[0],i=f[1],u=[],p=[],c=i;if(e)for(t=0;t<s;t++)p[c+t]=-1;for(var v=0;v<i;v++){u[v]=-1,p[0+v]=-1;for(var x=o[v],l=o[v+1],_=x;_<l;_++){var b=n[_];for(t=e?p[c+b]:b;-1!==t&&t<v;t=a)a=p[0+t],p[0+t]=v,-1===a&&(u[t]=v);e&&(p[c+b]=v)}}return u}}exports.name="csEtree",exports.path="algebra.sparse",exports.factory=r;
},{}],"ONfv":[function(require,module,exports) {
"use strict";function r(r,t,e){var s=e(require("./csTdfs"));return function(r,t){if(!r)return null;var e,o=0,n=[],a=[],f=t,u=2*t;for(e=0;e<t;e++)a[0+e]=-1;for(e=t-1;e>=0;e--)-1!==r[e]&&(a[f+e]=a[0+r[e]],a[0+r[e]]=e);for(e=0;e<t;e++)-1===r[e]&&(o=s(e,o,a,0,f,n,u));return n}}exports.name="csPost",exports.path="algebra.sparse",exports.factory=r;
},{"./csTdfs":"xmPn"}],"R1Om":[function(require,module,exports) {
"use strict";function r(){return function(r,e,t,a,f,s,n){var o,u,c,i,p=0;if(r<=e||t[a+e]<=t[f+r])return-1;if(t[f+r]=t[a+e],c=t[s+r],t[s+r]=e,-1===c)p=1,i=r;else{for(p=2,i=c;i!==t[n+i];i=t[n+i]);for(o=c;o!==i;o=u)u=t[n+o],t[n+o]=i}return{jleaf:p,q:i}}}exports.name="csLeaf",exports.path="algebra.sparse",exports.factory=r;
},{}],"OmuS":[function(require,module,exports) {
"use strict";function r(r,e,f){var o=f(require("../../matrix/transpose")),t=f(require("./csLeaf"));return function(r,e,f,a){if(!r||!e||!f)return null;var n,s,i,u,p,c,l,x=r._size,v=x[0],m=x[1],q=4*m+(a?m+v+1:0),_=[],h=m,j=2*m,b=3*m,d=4*m,g=5*m+1;for(i=0;i<q;i++)_[i]=-1;var y=[],z=o(r),C=z._index,L=z._ptr;for(i=0;i<m;i++)for(y[s=f[i]]=-1===_[b+s]?1:0;-1!==s&&-1===_[b+s];s=e[s])_[b+s]=i;if(a){for(i=0;i<m;i++)_[f[i]]=i;for(n=0;n<v;n++){for(i=m,c=L[n],l=L[n+1],p=c;p<l;p++)i=Math.min(i,_[C[p]]);_[g+n]=_[d+i],_[d+i]=n}}for(n=0;n<m;n++)_[0+n]=n;for(i=0;i<m;i++){for(-1!==e[s=f[i]]&&y[e[s]]--,u=a?_[d+i]:s;-1!==u;u=a?_[g+u]:-1)for(p=L[u];p<L[u+1];p++){n=C[p];var M=t(n,s,_,b,h,j,0);M.jleaf>=1&&y[s]++,2===M.jleaf&&y[M.q]--}-1!==e[s]&&(_[0+s]=e[s])}for(s=0;s<m;s++)-1!==e[s]&&(y[e[s]]+=y[s]);return y}}exports.name="csCounts",exports.path="algebra.sparse",exports.factory=r;
},{"../../matrix/transpose":"C2z0","./csLeaf":"R1Om"}],"VNCK":[function(require,module,exports) {
"use strict";function r(r,e,n){var t=n(require("./csAmd")),u=n(require("./csPermute")),s=n(require("./csEtree")),o=n(require("./csPost")),a=n(require("./csCounts"));return function(r,e,n){var f,i=e._ptr,p=e._size[1],c={};if(c.q=t(r,e),r&&!c.q)return null;if(n){var l=r?u(e,null,c.q,0):e;c.parent=s(l,1);var z=o(c.parent,p);if(c.cp=a(l,c.parent,z,1),l&&c.parent&&c.cp&&function(r,e){var n=r._ptr,t=r._index,u=r._size,s=u[0],o=u[1];e.pinv=[],e.leftmost=[];var a,f,i,p,c,l=e.parent,z=e.pinv,q=e.leftmost,v=[],m=s,_=s+o,x=s+2*o;for(f=0;f<o;f++)v[m+f]=-1,v[_+f]=-1,v[x+f]=0;for(a=0;a<s;a++)q[a]=-1;for(f=o-1;f>=0;f--)for(p=n[f],c=n[f+1],i=p;i<c;i++)q[t[i]]=f;for(a=s-1;a>=0;a--)z[a]=-1,-1!==(f=q[a])&&(0==v[x+f]++&&(v[_+f]=a),v[0+a]=v[m+f],v[m+f]=a);for(e.lnz=0,e.m2=s,f=0;f<o;f++)if(a=v[m+f],e.lnz++,a<0&&(a=e.m2++),z[a]=f,!(--x[f]<=0)){e.lnz+=v[x+f];var d=l[f];-1!==d&&(0===v[x+d]&&(v[_+d]=v[_+f]),v[0+v[_+f]]=v[m+d],v[m+d]=v[0+a],v[x+d]+=v[x+f])}for(a=0;a<s;a++)z[a]<0&&(z[a]=f++);return!0}(l,c))for(c.unz=0,f=0;f<p;f++)c.unz+=c.cp[f]}else c.unz=4*i[p]+p,c.lnz=c.unz;return c}}exports.name="csSqr",exports.path="algebra.sparse",exports.factory=r;
},{"./csAmd":"tamT","./csPermute":"rGf9","./csEtree":"vEli","./csPost":"ONfv","./csCounts":"OmuS"}],"d923":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").nearlyEqual,e=require("../../utils/bignumber/nearlyEqual");function t(t,n,i,a){var u=i(require("../../type/matrix/function/matrix")),o=i(require("../../type/matrix/utils/algorithm03")),l=i(require("../../type/matrix/utils/algorithm07")),s=i(require("../../type/matrix/utils/algorithm12")),f=i(require("../../type/matrix/utils/algorithm13")),c=i(require("../../type/matrix/utils/algorithm14")),x=require("../../utils/latex"),m=a("largerEq",{"boolean, boolean":function(r,e){return r>=e},"number, number":function(e,t){return e>=t||r(e,t,n.epsilon)},"BigNumber, BigNumber":function(r,t){return r.gte(t)||e(r,t,n.epsilon)},"Fraction, Fraction":function(r,e){return-1!==r.compare(e)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(r,e){if(!r.equalBase(e))throw new Error("Cannot compare units with different base");return m(r.value,e.value)},"SparseMatrix, SparseMatrix":function(r,e){return l(r,e,m)},"SparseMatrix, DenseMatrix":function(r,e){return o(e,r,m,!0)},"DenseMatrix, SparseMatrix":function(r,e){return o(r,e,m,!1)},"DenseMatrix, DenseMatrix":function(r,e){return f(r,e,m)},"Array, Array":function(r,e){return m(u(r),u(e)).valueOf()},"Array, Matrix":function(r,e){return m(u(r),e)},"Matrix, Array":function(r,e){return m(r,u(e))},"SparseMatrix, any":function(r,e){return s(r,e,m,!1)},"DenseMatrix, any":function(r,e){return c(r,e,m,!1)},"any, SparseMatrix":function(r,e){return s(e,r,m,!0)},"any, DenseMatrix":function(r,e){return c(e,r,m,!0)},"Array, any":function(r,e){return c(u(r),e,m,!1).valueOf()},"any, Array":function(r,e){return c(u(e),r,m,!0).valueOf()}});return m.toTex={2:"\\left(${args[0]}".concat(x.operators.largerEq,"${args[1]}\\right)")},m}exports.name="largerEq",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB","../../utils/latex":"H1Mr"}],"HHkn":[function(require,module,exports) {
"use strict";function r(){return function(r,t){return r[t]<0}}exports.name="csMarked",exports.path="algebra.sparse",exports.factory=r;
},{}],"Lsyn":[function(require,module,exports) {
"use strict";function r(r,e,t){var s=t(require("./csFlip"));return function(r,e){r[e]=s(r[e])}}exports.name="csMark",exports.path="algebra.sparse",exports.factory=r;
},{"./csFlip":"da3s"}],"x9BP":[function(require,module,exports) {
"use strict";function r(r,e,t){var s=t(require("./csFlip"));return function(r){return r<0?s(r):r}}exports.name="csUnflip",exports.path="algebra.sparse",exports.factory=r;
},{"./csFlip":"da3s"}],"JD8V":[function(require,module,exports) {
"use strict";function r(r,e,a){var s=a(require("./csMarked")),t=a(require("./csMark")),i=a(require("./csUnflip"));return function(r,e,a,n,c){var f,o,u,p=e._index,v=e._ptr,x=e._size[1],k=0;for(n[0]=r;k>=0;){r=n[k];var q=c?c[r]:r;s(v,r)||(t(v,r),n[x+k]=q<0?0:i(v[q]));var _=1;for(o=n[x+k],u=q<0?0:i(v[q+1]);o<u;o++)if(f=p[o],!s(v,f)){n[x+k]=o,n[++k]=f,_=0;break}_&&(k--,n[--a]=r)}return a}}exports.name="csDfs",exports.path="algebra.sparse",exports.factory=r;
},{"./csMarked":"HHkn","./csMark":"Lsyn","./csUnflip":"x9BP"}],"b7WF":[function(require,module,exports) {
"use strict";function r(r,e,s){var t=s(require("./csDfs")),a=s(require("./csMarked")),c=s(require("./csMark"));return function(r,e,s,i,n){var o,u,p,f=r._ptr,x=r._size,_=e._index,q=e._ptr,v=x[1],d=v;for(u=q[s],p=q[s+1],o=u;o<p;o++){var h=_[o];a(f,h)||(d=t(h,r,d,i,n))}for(o=d;o<v;o++)c(f,i[o]);return d}}exports.name="csReach",exports.path="algebra.sparse",exports.factory=r;
},{"./csDfs":"JD8V","./csMarked":"HHkn","./csMark":"Lsyn"}],"k2Qt":[function(require,module,exports) {
"use strict";function r(r,e,t){var a=t(require("../../arithmetic/divideScalar")),i=t(require("../../arithmetic/multiply")),s=t(require("../../arithmetic/subtract")),u=t(require("./csReach"));return function(r,e,t,c,o,n,p){var v,f,l,_,h=r._values,m=r._index,x=r._ptr,d=r._size[1],q=e._values,b=e._index,y=e._ptr,S=u(r,e,t,c,n);for(v=S;v<d;v++)o[c[v]]=0;for(f=y[t],l=y[t+1],v=f;v<l;v++)o[b[v]]=q[v];for(var g=S;g<d;g++){var z=c[g],R=n?n[z]:z;if(!(R<0))for(f=x[R],l=x[R+1],o[z]=a(o[z],h[p?f:l-1]),v=p?f+1:f,_=p?l:l-1;v<_;v++){var j=m[v];o[j]=s(o[j],i(h[v],o[z]))}}return S}}exports.name="csSpsolve",exports.path="algebra.sparse",exports.factory=r;
},{"../../arithmetic/divideScalar":"R3aq","../../arithmetic/multiply":"k7By","../../arithmetic/subtract":"m78R","./csReach":"b7WF"}],"i7D2":[function(require,module,exports) {
"use strict";function r(r,e,i){var a=i(require("../../arithmetic/abs")),t=i(require("../../arithmetic/divideScalar")),l=i(require("../../arithmetic/multiply")),n=i(require("../../relational/larger")),s=i(require("../../relational/largerEq")),u=i(require("./csSpsolve")),p=r.SparseMatrix;return function(r,e,i){if(!r)return null;var c,o=r._size[1],v=100,f=100;e&&(c=e.q,v=e.lnz||v,f=e.unz||f);var h,q,g=[],x=[],m=[],z=new p({values:g,index:x,ptr:m,size:[o,o]}),d=[],S=[],b=[],w=new p({values:d,index:S,ptr:b,size:[o,o]}),y=[],L=[],E=[];for(h=0;h<o;h++)L[h]=0,y[h]=-1,m[h+1]=0;v=0,f=0;for(var M=0;M<o;M++){m[M]=v,b[M]=f;var U=c?c[M]:M,_=u(z,r,U,E,L,y,1),j=-1,k=-1;for(q=_;q<o;q++)if(y[h=E[q]]<0){var A=a(L[h]);n(A,k)&&(k=A,j=h)}else S[f]=y[h],d[f++]=L[h];if(-1===j||k<=0)return null;y[U]<0&&s(a(L[U]),l(k,i))&&(j=U);var B=L[j];for(S[f]=M,d[f++]=B,y[j]=M,x[v]=j,g[v++]=1,q=_;q<o;q++)y[h=E[q]]<0&&(x[v]=h,g[v++]=t(L[h],B)),L[h]=0}for(m[o]=v,b[o]=f,q=0;q<v;q++)x[q]=y[x[q]];return g.splice(v,g.length-v),x.splice(v,x.length-v),d.splice(f,d.length-f),S.splice(f,S.length-f),{L:z,U:w,pinv:y}}}exports.name="csLu",exports.path="algebra.sparse",exports.factory=r;
},{"../../arithmetic/abs":"K5X1","../../arithmetic/divideScalar":"R3aq","../../arithmetic/multiply":"k7By","../../relational/larger":"SrDl","../../relational/largerEq":"d923","./csSpsolve":"k2Qt"}],"g5hu":[function(require,module,exports) {
"use strict";var r=require("../../../utils/index"),t=r.number,e=t.isInteger;function n(r,t,n,i){var s=n(require("../../algebra/sparse/csSqr")),o=n(require("../../algebra/sparse/csLu"));return i("slu",{"SparseMatrix, number, number":function(r,t,n){if(!e(t)||t<0||t>3)throw new Error("Symbolic Ordering and Analysis order must be an integer number in the interval [0, 3]");if(n<0||n>1)throw new Error("Partial pivoting threshold must be a number from 0 to 1");var i=s(t,r,!1),u=o(r,i,n);return{L:u.L,U:u.U,p:u.pinv,q:i.q,toString:function(){return"L: "+this.L.toString()+"\nU: "+this.U.toString()+"\np: "+this.p.toString()+(this.q?"\nq: "+this.q.toString():"")+"\n"}}}})}exports.name="slu",exports.factory=n;
},{"../../../utils/index":"fsXI","../../algebra/sparse/csSqr":"VNCK","../../algebra/sparse/csLu":"i7D2"}],"YTfO":[function(require,module,exports) {
"use strict";var t=require("../../../../utils/index"),r=t.string,e=t.array,a=Array.isArray;function n(t){var n=t.DenseMatrix;return function(i,s,o){var m=i.size();if(2!==m.length)throw new RangeError("Matrix must be two dimensional (size: "+r.format(m)+")");var h,c,u,f=m[0];if(f!==m[1])throw new RangeError("Matrix must be square (size: "+r.format(m)+")");if(t.isMatrix(s)){var w=s.size();if(1===w.length){if(w[0]!==f)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(h=[],u=s._data,c=0;c<f;c++)h[c]=[u[c]];return new n({data:h,size:[f,1],datatype:s._datatype})}if(2===w.length){if(w[0]!==f||1!==w[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");if(t.isDenseMatrix(s)){if(o){for(h=[],u=s._data,c=0;c<f;c++)h[c]=[u[c][0]];return new n({data:h,size:[f,1],datatype:s._datatype})}return s}for(h=[],c=0;c<f;c++)h[c]=[0];for(var g=s._values,l=s._index,d=s._ptr,v=d[1],x=d[0];x<v;x++)h[c=l[x]][0]=g[x];return new n({data:h,size:[f,1],datatype:s._datatype})}throw new RangeError("Dimension mismatch. Matrix columns must match vector length.")}if(a(s)){var M=e.size(s);if(1===M.length){if(M[0]!==f)throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(h=[],c=0;c<f;c++)h[c]=[s[c]];return new n({data:h,size:[f,1]})}if(2===M.length){if(M[0]!==f||1!==M[1])throw new RangeError("Dimension mismatch. Matrix columns must match vector length.");for(h=[],c=0;c<f;c++)h[c]=[s[c][0]];return new n({data:h,size:[f,1]})}throw new RangeError("Dimension mismatch. Matrix columns must match vector length.")}}}exports.factory=n;
},{"../../../../utils/index":"fsXI"}],"LFCL":[function(require,module,exports) {
"use strict";function r(r,e,a,i){var t=a(require("../../../type/matrix/function/matrix")),n=a(require("../../arithmetic/divideScalar")),s=a(require("../../arithmetic/multiplyScalar")),u=a(require("../../arithmetic/subtract")),o=a(require("../../relational/equalScalar")),l=a(require("./utils/solveValidation")),c=r.DenseMatrix;function f(r,e){for(var a=(e=l(r,e,!0))._data,i=r._size[0],t=r._size[1],f=[],v=r._data,x=0;x<t;x++){var d=a[x][0]||0,m=void 0;if(o(d,0))m=0;else{var _=v[x][x];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");m=n(d,_);for(var y=x+1;y<i;y++)a[y]=[u(a[y][0]||0,s(m,v[y][x]))]}f[x]=[m]}return new c({data:f,size:[i,1]})}return i("lsolve",{"SparseMatrix, Array | Matrix":function(r,e){return function(r,e){for(var a,i,t=(e=l(r,e,!0))._data,f=r._size[0],v=r._size[1],x=r._values,d=r._index,m=r._ptr,_=[],y=0;y<v;y++){var h=t[y][0]||0;if(o(h,0))_[y]=[0];else{var p=0,q=[],w=[],z=m[y+1];for(i=m[y];i<z;i++)(a=d[i])===y?p=x[i]:a>y&&(q.push(x[i]),w.push(a));if(o(p,0))throw new Error("Linear system cannot be solved since matrix is singular");var M=n(h,p);for(i=0,z=w.length;i<z;i++)a=w[i],t[a]=[u(t[a][0]||0,s(M,q[i]))];_[y]=[M]}}return new c({data:_,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()}})}exports.name="lsolve",exports.factory=r;
},{"../../../type/matrix/function/matrix":"vzj5","../../arithmetic/divideScalar":"R3aq","../../arithmetic/multiplyScalar":"obRw","../../arithmetic/subtract":"m78R","../../relational/equalScalar":"QvIw","./utils/solveValidation":"YTfO"}],"nPqM":[function(require,module,exports) {
"use strict";function r(){return function(r,e){var t,s=e.length,n=[];if(r)for(t=0;t<s;t++)n[r[t]]=e[t];else for(t=0;t<s;t++)n[t]=e[t];return n}}exports.name="csIpvec",exports.path="algebra.sparse",exports.factory=r;
},{}],"IPbG":[function(require,module,exports) {
"use strict";function r(r,e,a,i){var t=a(require("../../../type/matrix/function/matrix")),n=a(require("../../arithmetic/divideScalar")),s=a(require("../../arithmetic/multiplyScalar")),u=a(require("../../arithmetic/subtract")),o=a(require("../../relational/equalScalar")),l=a(require("./utils/solveValidation")),c=r.DenseMatrix;function f(r,e){for(var a=(e=l(r,e,!0))._data,i=r._size[0],t=r._size[1],f=[],v=r._data,x=t-1;x>=0;x--){var d=a[x][0]||0,m=void 0;if(o(d,0))m=0;else{var _=v[x][x];if(o(_,0))throw new Error("Linear system cannot be solved since matrix is singular");m=n(d,_);for(var y=x-1;y>=0;y--)a[y]=[u(a[y][0]||0,s(m,v[y][x]))]}f[x]=[m]}return new c({data:f,size:[i,1]})}return i("usolve",{"SparseMatrix, Array | Matrix":function(r,e){return function(r,e){for(var a,i,t=(e=l(r,e,!0))._data,f=r._size[0],v=r._size[1],x=r._values,d=r._index,m=r._ptr,_=[],y=v-1;y>=0;y--){var h=t[y][0]||0;if(o(h,0))_[y]=[0];else{var p=0,q=[],w=[],z=m[y],M=m[y+1];for(i=M-1;i>=z;i--)(a=d[i])===y?p=x[i]:a<y&&(q.push(x[i]),w.push(a));if(o(p,0))throw new Error("Linear system cannot be solved since matrix is singular");var A=n(h,p);for(i=0,M=w.length;i<M;i++)a=w[i],t[a]=[u(t[a][0],s(A,q[i]))];_[y]=[A]}}return new c({data:_,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()}})}exports.name="usolve",exports.factory=r;
},{"../../../type/matrix/function/matrix":"vzj5","../../arithmetic/divideScalar":"R3aq","../../arithmetic/multiplyScalar":"obRw","../../arithmetic/subtract":"m78R","../../relational/equalScalar":"QvIw","./utils/solveValidation":"YTfO"}],"gikm":[function(require,module,exports) {
"use strict";var r=Array.isArray;function e(e,t,a,i){var n=a(require("../../../type/matrix/function/matrix")),u=a(require("../decomposition/lup")),o=a(require("../decomposition/slu")),s=a(require("../sparse/csIpvec")),l=a(require("./utils/solveValidation")),c=a(require("./usolve")),p=a(require("./lsolve")),v=i("lusolve",{"Array, Array | Matrix":function(r,e){r=n(r);var t=u(r);return f(t.L,t.U,t.p,null,e).valueOf()},"DenseMatrix, Array | Matrix":function(r,e){var t=u(r);return f(t.L,t.U,t.p,null,e)},"SparseMatrix, Array | Matrix":function(r,e){var t=u(r);return f(t.L,t.U,t.p,null,e)},"SparseMatrix, Array | Matrix, number, number":function(r,e,t,a){var i=o(r,t,a);return f(i.L,i.U,i.p,i.q,e)},"Object, Array | Matrix":function(r,e){return f(r.L,r.U,r.p,r.q,e)}}),x=function(t){if(e.isMatrix(t))return t;if(r(t))return n(t);throw new TypeError("Invalid Matrix LU decomposition")};function f(r,e,t,a,i){r=x(r),e=x(e),i=l(r,i,!1),t&&(i._data=s(t,i._data));var n=p(r,i),u=c(e,n);return a&&(u._data=s(a,u._data)),u}return v}exports.name="lusolve",exports.factory=e;
},{"../../../type/matrix/function/matrix":"vzj5","../decomposition/lup":"IRmO","../decomposition/slu":"g5hu","../sparse/csIpvec":"nPqM","./utils/solveValidation":"YTfO","./usolve":"IPbG","./lsolve":"LFCL"}],"VeYJ":[function(require,module,exports) {
"use strict";module.exports=[require("./derivative"),require("./simplify"),require("./rationalize"),require("./decomposition/qr"),require("./decomposition/lup"),require("./decomposition/slu"),require("./solver/lsolve"),require("./solver/lusolve"),require("./solver/usolve")];
},{"./derivative":"VLL0","./simplify":"EVZ1","./rationalize":"wmjX","./decomposition/qr":"fqqA","./decomposition/lup":"IRmO","./decomposition/slu":"g5hu","./solver/lsolve":"LFCL","./solver/lusolve":"gikm","./solver/usolve":"IPbG"}],"HYoC":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,n,i){var u=i("isNegative",{number:function(r){return r<0},BigNumber:function(r){return r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s<0},Unit:function(r){return u(r.value)},"Array | Matrix":function(e){return r(e,u)}});return u}exports.name="isNegative",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"N7RE":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function r(r,u,a,n){var i=a(require("./unaryMinus")),l=a(require("../utils/isNegative")),o=a(require("../../type/matrix/function/matrix")),v=n("cbrt",{number:t,Complex:m,"Complex, boolean":m,BigNumber:function(e){return e.cbrt()},Unit:function(e){if(e.value&&r.isComplex(e.value)){var t=e.clone();return t.value=1,(t=t.pow(1/3)).value=m(e.value),t}var u,a=l(e.value);a&&(e.value=i(e.value)),u=r.isBigNumber(e.value)?new r.BigNumber(1).div(3):r.isFraction(e.value)?new r.Fraction(1,3):1/3;var n=e.pow(u);return a&&(n.value=i(n.value)),n},"Array | Matrix":function(r){return e(r,v,!0)}});function m(e,a){var n=e.arg()/3,i=e.abs(),l=new r.Complex(t(i),0).mul(new r.Complex(0,n).exp());if(a){var v=[l,new r.Complex(t(i),0).mul(new r.Complex(0,n+2*Math.PI/3).exp()),new r.Complex(t(i),0).mul(new r.Complex(0,n-2*Math.PI/3).exp())];return"Array"===u.matrix?v:o(v)}return l}return v.toTex={1:"\\sqrt[3]{${args[0]}}"},v}var t=Math.cbrt||function(e){if(0===e)return e;var r,t=e<0;return t&&(e=-e),r=isFinite(e)?(e/((r=Math.exp(Math.log(e)/3))*r)+2*r)/3:e,t?-r:r};exports.name="cbrt",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo","./unaryMinus":"q5A1","../utils/isNegative":"HYoC","../../type/matrix/function/matrix":"vzj5"}],"qFQg":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,n,e,u){var i=u("cube",{number:function(r){return r*r*r},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)},"Array | Matrix":function(t){return r(t,i,!0)},Unit:function(r){return r.pow(3)}});return i.toTex={1:"\\left(${args[0]}\\right)^3"},i}exports.name="cube",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"j4Xj":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function e(e,t,a,n){var i=a(require("../../../function/relational/equalScalar")),o=e.SparseMatrix;return function(e,t,a,s){var h=e._data,p=e._size,u=e._datatype,f=t._values,l=t._index,v=t._ptr,c=t._size,d=t._datatype;if(p.length!==c.length)throw new r(p.length,c.length);if(p[0]!==c[0]||p[1]!==c[1])throw new RangeError("Dimension mismatch. Matrix A ("+p+") must match Matrix B ("+c+")");if(!f)throw new Error("Cannot perform operation on Dense Matrix and Pattern Sparse Matrix");var g,m=p[0],x=p[1],_=i,w=0,y=a;"string"==typeof u&&u===d&&(g=u,_=n.find(i,[g,g]),w=n.convert(0,g),y=n.find(a,[g,g]));for(var M=[],q=[],z=[],D=0;D<x;D++){z[D]=q.length;for(var E=v[D],S=v[D+1],A=E;A<S;A++){var B=l[A],C=s?y(f[A],h[B][D]):y(h[B][D],f[A]);_(C,w)||(q.push(B),M.push(C))}}return z[x]=q.length,new o({values:M,index:q,ptr:z,size:[m,x],datatype:g})}}exports.name="algorithm02",exports.factory=e;
},{"../../../error/DimensionError":"YiAw","../../../function/relational/equalScalar":"QvIw"}],"JrX5":[function(require,module,exports) {
"use strict";function r(r,t,e,i){var a=e(require("../../type/matrix/function/matrix")),n=e(require("./divideScalar")),u=require("../../utils/latex"),o=e(require("../../type/matrix/utils/algorithm02")),s=e(require("../../type/matrix/utils/algorithm03")),x=e(require("../../type/matrix/utils/algorithm07")),y=e(require("../../type/matrix/utils/algorithm11")),l=e(require("../../type/matrix/utils/algorithm12")),c=e(require("../../type/matrix/utils/algorithm13")),f=e(require("../../type/matrix/utils/algorithm14")),m=i("dotDivide",{"any, any":n,"SparseMatrix, SparseMatrix":function(r,t){return x(r,t,n,!1)},"SparseMatrix, DenseMatrix":function(r,t){return o(t,r,n,!0)},"DenseMatrix, SparseMatrix":function(r,t){return s(r,t,n,!1)},"DenseMatrix, DenseMatrix":function(r,t){return c(r,t,n)},"Array, Array":function(r,t){return m(a(r),a(t)).valueOf()},"Array, Matrix":function(r,t){return m(a(r),t)},"Matrix, Array":function(r,t){return m(r,a(t))},"SparseMatrix, any":function(r,t){return y(r,t,n,!1)},"DenseMatrix, any":function(r,t){return f(r,t,n,!1)},"any, SparseMatrix":function(r,t){return l(t,r,n,!0)},"any, DenseMatrix":function(r,t){return f(t,r,n,!0)},"Array, any":function(r,t){return f(a(r),t,n,!1).valueOf()},"any, Array":function(r,t){return f(a(t),r,n,!0).valueOf()}});return m.toTex={2:"\\left(${args[0]}".concat(u.operators.dotDivide,"${args[1]}\\right)")},m}exports.name="dotDivide",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","./divideScalar":"R3aq","../../utils/latex":"H1Mr","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"PvZY":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function e(e,t,a,i){var n=a(require("../../../function/relational/equalScalar")),o=e.SparseMatrix;return function(e,t,a){var s=e._values,u=e._index,l=e._ptr,f=e._size,h=e._datatype,p=t._values,v=t._index,d=t._ptr,_=t._size,c=t._datatype;if(f.length!==_.length)throw new r(f.length,_.length);if(f[0]!==_[0]||f[1]!==_[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+_+")");var g,m=f[0],x=f[1],w=n,y=0,q=a;"string"==typeof h&&h===c&&(g=h,w=i.find(n,[g,g]),y=i.convert(0,g),q=i.find(a,[g,g]));var z,M,D,E,S,A=s&&p?[]:void 0,B=[],R=[],b=new o({values:A,index:B,ptr:R,size:[m,x],datatype:g}),j=A?[]:void 0,k=[];for(M=0;M<x;M++){R[M]=B.length;var C=M+1;if(j)for(E=d[M],S=d[M+1],D=E;D<S;D++)k[z=v[D]]=C,j[z]=p[D];for(E=l[M],S=l[M+1],D=E;D<S;D++)if(z=u[D],j){var F=k[z]===C?j[z]:y,G=q(s[D],F);w(G,y)||(B.push(z),A.push(G))}else B.push(z)}return R[x]=B.length,b}}exports.name="algorithm09",exports.factory=e;
},{"../../../error/DimensionError":"YiAw","../../../function/relational/equalScalar":"QvIw"}],"x67x":[function(require,module,exports) {
"use strict";function r(r,t,e,i){var n=e(require("../../type/matrix/function/matrix")),a=e(require("./multiplyScalar")),u=require("../../utils/latex"),o=e(require("../../type/matrix/utils/algorithm02")),l=e(require("../../type/matrix/utils/algorithm09")),s=e(require("../../type/matrix/utils/algorithm11")),x=e(require("../../type/matrix/utils/algorithm13")),y=e(require("../../type/matrix/utils/algorithm14")),c=i("dotMultiply",{"any, any":a,"SparseMatrix, SparseMatrix":function(r,t){return l(r,t,a,!1)},"SparseMatrix, DenseMatrix":function(r,t){return o(t,r,a,!0)},"DenseMatrix, SparseMatrix":function(r,t){return o(r,t,a,!1)},"DenseMatrix, DenseMatrix":function(r,t){return x(r,t,a)},"Array, Array":function(r,t){return c(n(r),n(t)).valueOf()},"Array, Matrix":function(r,t){return c(n(r),t)},"Matrix, Array":function(r,t){return c(r,n(t))},"SparseMatrix, any":function(r,t){return s(r,t,a,!1)},"DenseMatrix, any":function(r,t){return y(r,t,a,!1)},"any, SparseMatrix":function(r,t){return s(t,r,a,!0)},"any, DenseMatrix":function(r,t){return y(t,r,a,!0)},"Array, any":function(r,t){return y(n(r),t,a,!1).valueOf()},"any, Array":function(r,t){return y(n(t),r,a,!0).valueOf()}});return c.toTex={2:"\\left(${args[0]}".concat(u.operators.dotMultiply,"${args[1]}\\right)")},c}exports.name="dotMultiply",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","./multiplyScalar":"obRw","../../utils/latex":"H1Mr","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm09":"PvZY","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"xz2O":[function(require,module,exports) {
"use strict";function r(r,t,e,i){var n=e(require("../../type/matrix/function/matrix")),a=e(require("./pow")),u=require("../../utils/latex"),o=e(require("../../type/matrix/utils/algorithm03")),s=e(require("../../type/matrix/utils/algorithm07")),x=e(require("../../type/matrix/utils/algorithm11")),y=e(require("../../type/matrix/utils/algorithm12")),f=e(require("../../type/matrix/utils/algorithm13")),c=e(require("../../type/matrix/utils/algorithm14")),l=i("dotPow",{"any, any":a,"SparseMatrix, SparseMatrix":function(r,t){return s(r,t,a,!1)},"SparseMatrix, DenseMatrix":function(r,t){return o(t,r,a,!0)},"DenseMatrix, SparseMatrix":function(r,t){return o(r,t,a,!1)},"DenseMatrix, DenseMatrix":function(r,t){return f(r,t,a)},"Array, Array":function(r,t){return l(n(r),n(t)).valueOf()},"Array, Matrix":function(r,t){return l(n(r),t)},"Matrix, Array":function(r,t){return l(r,n(t))},"SparseMatrix, any":function(r,t){return x(r,t,l,!1)},"DenseMatrix, any":function(r,t){return c(r,t,l,!1)},"any, SparseMatrix":function(r,t){return y(t,r,l,!0)},"any, DenseMatrix":function(r,t){return c(t,r,l,!0)},"Array, any":function(r,t){return c(n(r),t,l,!1).valueOf()},"any, Array":function(r,t){return c(n(t),r,l,!0).valueOf()}});return l.toTex={2:"\\left(${args[0]}".concat(u.operators.dotPow,"${args[1]}\\right)")},l}exports.name="dotPow",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","./pow":"CsUv","../../utils/latex":"H1Mr","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"hoRG":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function r(r,t,n,u){var i=u("exp",{number:Math.exp,Complex:function(e){return e.exp()},BigNumber:function(e){return e.exp()},"Array | Matrix":function(r){return e(r,i)}});return i.toTex={1:"\\exp\\left(${args[0]}\\right)"},i}exports.name="exp",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"aAXN":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function r(r,t,n,i){var o=require("../../utils/latex"),u=i("expm1",{number:Math.expm1||function(e){return e>=2e-4||e<=-2e-4?Math.exp(e)-1:e+e*e/2+e*e*e/6},Complex:function(e){var t=Math.exp(e.re);return new r.Complex(t*Math.cos(e.im)-1,t*Math.sin(e.im))},BigNumber:function(e){return e.exp().minus(1)},"Array | Matrix":function(r){return e(r,u)}});return u.toTex="\\left(e".concat(o.operators.pow,"{${args[0]}}-1\\right)"),u}exports.name="expm1",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo","../../utils/latex":"H1Mr"}],"AWGe":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger;function e(r,e,n,i){var u=n(require("../../type/matrix/function/matrix")),a=n(require("../../type/matrix/utils/algorithm01")),m=n(require("../../type/matrix/utils/algorithm04")),o=n(require("../../type/matrix/utils/algorithm10")),s=n(require("../../type/matrix/utils/algorithm13")),c=n(require("../../type/matrix/utils/algorithm14")),f=i("gcd",{"number, number":t,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function gcd must be integer numbers");var n=new r.BigNumber(0);for(;!t.isZero();){var i=e.mod(t);e=t,t=i}return e.lt(n)?e.neg():e},"Fraction, Fraction":function(r,e){return r.gcd(e)},"SparseMatrix, SparseMatrix":function(r,e){return m(r,e,f)},"SparseMatrix, DenseMatrix":function(r,e){return a(e,r,f,!0)},"DenseMatrix, SparseMatrix":function(r,e){return a(r,e,f,!1)},"DenseMatrix, DenseMatrix":function(r,e){return s(r,e,f)},"Array, Array":function(r,e){return f(u(r),u(e)).valueOf()},"Array, Matrix":function(r,e){return f(u(r),e)},"Matrix, Array":function(r,e){return f(r,u(e))},"SparseMatrix, number | BigNumber":function(r,e){return o(r,e,f,!1)},"DenseMatrix, number | BigNumber":function(r,e){return c(r,e,f,!1)},"number | BigNumber, SparseMatrix":function(r,e){return o(e,r,f,!0)},"number | BigNumber, DenseMatrix":function(r,e){return c(e,r,f,!0)},"Array, number | BigNumber":function(r,e){return c(u(r),e,f,!1).valueOf()},"number | BigNumber, Array":function(r,e){return c(u(e),r,f,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(r,e,t){for(var n=f(r,e),i=0;i<t.length;i++)n=f(n,t[i]);return n}});return f.toTex="\\gcd\\left(${args}\\right)",f}function t(e,t){if(!r(e)||!r(t))throw new Error("Parameters in function gcd must be integer numbers");for(var n;0!==t;)n=e%t,e=t,t=n;return e<0?-e:e}exports.name="gcd",exports.factory=e;
},{"../../utils/number":"uqMu","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm04":"m7Qa","../../type/matrix/utils/algorithm10":"H0xb","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"OFKG":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function n(n,t,i,e){var u=e("isPositive",{number:function(r){return r>0},BigNumber:function(r){return!r.isNeg()&&!r.isZero()&&!r.isNaN()},Fraction:function(r){return r.s>0&&r.n>0},Unit:function(r){return u(r.value)},"Array | Matrix":function(n){return r(n,u)}});return u}exports.name="isPositive",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo"}],"YQ9T":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function e(e,t,a,i){var u=a(require("./abs")),n=a(require("./addScalar")),l=a(require("./divideScalar")),o=a(require("./multiplyScalar")),s=a(require("./sqrt")),p=a(require("../relational/smaller")),y=a(require("../utils/isPositive")),c=i("hypot",{"... number | BigNumber":function(r){for(var e=0,t=0,a=0;a<r.length;a++){var i=u(r[a]);p(t,i)?(e=o(e,o(l(t,i),l(t,i))),e=n(e,1),t=i):e=n(e,y(i)?o(l(i,t),l(i,t)):i)}return o(t,s(e))},Array:function(e){return c.apply(c,r(e))},Matrix:function(e){return c.apply(c,r(e.toArray()))}});return c.toTex="\\hypot\\left(${args}\\right)",c}exports.name="hypot",exports.factory=e;
},{"../../utils/array":"j2lF","./abs":"K5X1","./addScalar":"ZM3O","./divideScalar":"R3aq","./multiplyScalar":"obRw","./sqrt":"T6pB","../relational/smaller":"Q7ag","../utils/isPositive":"OFKG"}],"h6yp":[function(require,module,exports) {
"use strict";module.exports=function(e,s,r,u,i,o,t,f,n,p,_){var d,l,x,a,c=e._values,h=e._index,v=e._ptr,m=t._index;if(u)for(l=v[s],x=v[s+1],d=l;d<x;d++)r[a=h[d]]!==o?(r[a]=o,m.push(a),p?(u[a]=n?f(c[d],_):f(_,c[d]),i[a]=o):u[a]=c[d]):(u[a]=n?f(c[d],u[a]):f(u[a],c[d]),i[a]=o);else for(l=v[s],x=v[s+1],d=l;d<x;d++)r[a=h[d]]!==o?(r[a]=o,m.push(a)):i[a]=o};
},{}],"WzD7":[function(require,module,exports) {
"use strict";var e=require("./../../../utils/collection/scatter"),r=require("../../../error/DimensionError");function t(t,a,i,n){var l=i(require("../../../function/relational/equalScalar")),o=t.SparseMatrix;return function(t,a,i){var s=t._values,u=t._size,v=t._datatype,c=a._values,f=a._size,h=a._datatype;if(u.length!==f.length)throw new r(u.length,f.length);if(u[0]!==f[0]||u[1]!==f[1])throw new RangeError("Dimension mismatch. Matrix A ("+u+") must match Matrix B ("+f+")");var p,g=u[0],d=u[1],m=l,x=0,_=i;"string"==typeof v&&v===h&&(p=v,m=n.find(l,[p,p]),x=n.convert(0,p),_=n.find(i,[p,p]));for(var w=s&&c?[]:void 0,y=[],q=[],z=new o({values:w,index:y,ptr:q,size:[g,d],datatype:p}),M=w?[]:void 0,D=[],E=[],S=0;S<d;S++){q[S]=y.length;var A=S+1;if(e(t,S,D,M,E,A,z,_),e(a,S,D,M,E,A,z,_),M)for(var B=q[S];B<y.length;){var R=y[B];if(E[R]===A){var b=M[R];m(b,x)?y.splice(B,1):(w.push(b),B++)}else y.splice(B,1)}else for(var j=q[S];j<y.length;)E[y[j]]!==A?y.splice(j,1):j++}return q[d]=y.length,z}}exports.name="algorithm06",exports.factory=t;
},{"./../../../utils/collection/scatter":"h6yp","../../../error/DimensionError":"YiAw","../../../function/relational/equalScalar":"QvIw"}],"EueY":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger;function e(r,e,n,i){var u=n(require("../../type/matrix/function/matrix")),a=n(require("../../type/matrix/utils/algorithm02")),m=n(require("../../type/matrix/utils/algorithm06")),o=n(require("../../type/matrix/utils/algorithm11")),s=n(require("../../type/matrix/utils/algorithm13")),f=n(require("../../type/matrix/utils/algorithm14")),b=i("lcm",{"number, number":t,"BigNumber, BigNumber":function(e,t){if(!e.isInt()||!t.isInt())throw new Error("Parameters in function lcm must be integer numbers");if(e.isZero()||t.isZero())return new r.BigNumber(0);var n=e.times(t);for(;!t.isZero();){var i=t;t=e.mod(i),e=i}return n.div(e).abs()},"Fraction, Fraction":function(r,e){return r.lcm(e)},"SparseMatrix, SparseMatrix":function(r,e){return m(r,e,b)},"SparseMatrix, DenseMatrix":function(r,e){return a(e,r,b,!0)},"DenseMatrix, SparseMatrix":function(r,e){return a(r,e,b,!1)},"DenseMatrix, DenseMatrix":function(r,e){return s(r,e,b)},"Array, Array":function(r,e){return b(u(r),u(e)).valueOf()},"Array, Matrix":function(r,e){return b(u(r),e)},"Matrix, Array":function(r,e){return b(r,u(e))},"SparseMatrix, number | BigNumber":function(r,e){return o(r,e,b,!1)},"DenseMatrix, number | BigNumber":function(r,e){return f(r,e,b,!1)},"number | BigNumber, SparseMatrix":function(r,e){return o(e,r,b,!0)},"number | BigNumber, DenseMatrix":function(r,e){return f(e,r,b,!0)},"Array, number | BigNumber":function(r,e){return f(u(r),e,b,!1).valueOf()},"number | BigNumber, Array":function(r,e){return f(u(e),r,b,!0).valueOf()},"Array | Matrix | number | BigNumber, Array | Matrix | number | BigNumber, ...Array | Matrix | number | BigNumber":function(r,e,t){for(var n=b(r,e),i=0;i<t.length;i++)n=b(n,t[i]);return n}});return b.toTex=void 0,b}function t(e,t){if(!r(e)||!r(t))throw new Error("Parameters in function lcm must be integer numbers");if(0===e||0===t)return 0;for(var n,i=e*t;0!==t;)t=e%(n=t),e=n;return Math.abs(i/e)}exports.name="lcm",exports.factory=e;
},{"../../utils/number":"uqMu","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm06":"WzD7","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"T05K":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,n,o){var i=n(require("./divideScalar")),l=o("log",{number:function(r){return r>=0||t.predictable?Math.log(r):new e.Complex(r,0).log()},Complex:function(r){return r.log()},BigNumber:function(r){return!r.isNegative()||t.predictable?r.ln():new e.Complex(r.toNumber(),0).log()},"Array | Matrix":function(e){return r(e,l)},"any, any":function(r,e){return i(l(r),l(e))}});return l.toTex={1:"\\ln\\left(${args[0]}\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}\\right)"},l}exports.name="log",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo","./divideScalar":"R3aq"}],"Bbg8":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function t(t,o,n,i){var l=i("log10",{number:function(e){return e>=0||o.predictable?r(e):new t.Complex(e,0).log().div(Math.LN10)},Complex:function(e){return new t.Complex(e).log().div(Math.LN10)},BigNumber:function(e){return!e.isNegative()||o.predictable?e.log():new t.Complex(e.toNumber(),0).log().div(Math.LN10)},"Array | Matrix":function(t){return e(t,l)}});return l.toTex={1:"\\log_{10}\\left(${args[0]}\\right)"},l}var r=Math.log10||function(e){return Math.log(e)/Math.LN10};exports.name="log10",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"pWAs":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,n,a){var i=n(require("./divideScalar")),o=n(require("./log")),l=a("log1p",{number:function(r){return r>=-1||t.predictable?Math.log1p?Math.log1p(r):Math.log(r+1):u(new e.Complex(r,0))},Complex:u,BigNumber:function(r){var n=r.plus(1);return!n.isNegative()||t.predictable?n.ln():u(new e.Complex(r.toNumber(),0))},"Array | Matrix":function(e){return r(e,l)},"any, any":function(r,e){return i(l(r),o(e))}});function u(r){var t=r.re+1;return new e.Complex(Math.log(Math.sqrt(t*t+r.im*r.im)),Math.atan2(r.im,t))}return l.toTex={1:"\\ln\\left(${args[0]}+1\\right)",2:"\\log_{${args[1]}}\\left(${args[0]}+1\\right)"},l}exports.name="log1p",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo","./divideScalar":"R3aq","./log":"T05K"}],"MzTq":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function e(e,r,o,a){var n=a("log2",{number:function(t){return t>=0||r.predictable?Math.log2?Math.log2(t):Math.log(t)/Math.LN2:l(new e.Complex(t,0))},Complex:l,BigNumber:function(t){return!t.isNegative()||r.predictable?t.log(2):l(new e.Complex(t.toNumber(),0))},"Array | Matrix":function(e){return t(e,n)}});function l(t){var r=Math.sqrt(t.re*t.re+t.im*t.im);return new e.Complex(Math.log2?Math.log2(r):Math.log(r)/Math.LN2,Math.atan2(t.im,t.re)/Math.LN2)}return n.toTex="\\log_{2}\\left(${args[0]}\\right)",n}exports.name="log2",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"sR9e":[function(require,module,exports) {
"use strict";function r(r,t,e,i){var n=e(require("../../type/matrix/function/matrix")),a=require("../../utils/latex"),u=e(require("../../type/matrix/utils/algorithm02")),o=e(require("../../type/matrix/utils/algorithm03")),s=e(require("../../type/matrix/utils/algorithm05")),f=e(require("../../type/matrix/utils/algorithm11")),m=e(require("../../type/matrix/utils/algorithm12")),x=e(require("../../type/matrix/utils/algorithm13")),c=e(require("../../type/matrix/utils/algorithm14")),l=i("mod",{"number, number":function(r,t){if(t>0)return r-t*Math.floor(r/t);if(0===t)return r;throw new Error("Cannot calculate mod for a negative divisor")},"BigNumber, BigNumber":function(r,t){return t.isZero()?r:r.mod(t)},"Fraction, Fraction":function(r,t){return r.mod(t)},"SparseMatrix, SparseMatrix":function(r,t){return s(r,t,l,!1)},"SparseMatrix, DenseMatrix":function(r,t){return u(t,r,l,!0)},"DenseMatrix, SparseMatrix":function(r,t){return o(r,t,l,!1)},"DenseMatrix, DenseMatrix":function(r,t){return x(r,t,l)},"Array, Array":function(r,t){return l(n(r),n(t)).valueOf()},"Array, Matrix":function(r,t){return l(n(r),t)},"Matrix, Array":function(r,t){return l(r,n(t))},"SparseMatrix, any":function(r,t){return f(r,t,l,!1)},"DenseMatrix, any":function(r,t){return c(r,t,l,!1)},"any, SparseMatrix":function(r,t){return m(t,r,l,!0)},"any, DenseMatrix":function(r,t){return c(t,r,l,!0)},"Array, any":function(r,t){return c(n(r),t,l,!1).valueOf()},"any, Array":function(r,t){return c(n(t),r,l,!0).valueOf()}});return l.toTex={2:"\\left(${args[0]}".concat(a.operators.mod,"${args[1]}\\right)")},l}exports.name="mod",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","../../utils/latex":"H1Mr","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm05":"JNXe","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"Ts3b":[function(require,module,exports) {
"use strict";function r(r,e,n,t){var i=n(require("../arithmetic/abs")),u=n(require("../arithmetic/add")),a=n(require("../arithmetic/pow")),o=n(require("../complex/conj")),f=n(require("../arithmetic/sqrt")),m=n(require("../arithmetic/multiply")),c=n(require("../relational/equalScalar")),l=n(require("../relational/larger")),s=n(require("../relational/smaller")),b=n(require("../../type/matrix/function/matrix")),p=t("norm",{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 N(b(r),2)},Matrix:function(r){return N(r,2)},"number | Complex | BigNumber | boolean, number | BigNumber | string":function(r){return p(r)},"Array, number | BigNumber | string":function(r,e){return N(b(r),e)},"Matrix, number | BigNumber | string":function(r,e){return N(r,e)}});function N(r,e){var n=r.size();if(1===n.length){if(e===Number.POSITIVE_INFINITY||"inf"===e){var t=0;return r.forEach(function(r){var e=i(r);l(e,t)&&(t=e)},!0),t}var b;if(e===Number.NEGATIVE_INFINITY||"-inf"===e)return r.forEach(function(r){var e=i(r);b&&!s(e,b)||(b=e)},!0),b||0;if("fro"===e)return N(r,2);if("number"==typeof e&&!isNaN(e)){if(!c(e,0)){var p=0;return r.forEach(function(r){p=u(a(i(r),e),p)},!0),a(p,1/e)}return Number.POSITIVE_INFINITY}throw new Error("Unsupported parameter value")}if(2===n.length){if(1===e){var h=[],I=0;return r.forEach(function(r,e){var n=e[1],t=u(h[n]||0,i(r));l(t,I)&&(I=t),h[n]=t},!0),I}if(e===Number.POSITIVE_INFINITY||"inf"===e){var v=[],g=0;return r.forEach(function(r,e){var n=e[0],t=u(v[n]||0,i(r));l(t,g)&&(g=t),v[n]=t},!0),g}if("fro"===e){var E=0;return r.forEach(function(r,e){E=u(E,m(r,o(r)))}),i(f(E))}if(2===e)throw new Error("Unsupported parameter value, missing implementation of matrix singular value decomposition");throw new Error("Unsupported parameter value")}}return p.toTex={1:"\\left\\|${args[0]}\\right\\|",2:void 0},p}exports.name="norm",exports.factory=r;
},{"../arithmetic/abs":"K5X1","../arithmetic/add":"zf2Z","../arithmetic/pow":"CsUv","../complex/conj":"msvi","../arithmetic/sqrt":"T6pB","../arithmetic/multiply":"k7By","../relational/equalScalar":"QvIw","../relational/larger":"SrDl","../relational/smaller":"Q7ag","../../type/matrix/function/matrix":"vzj5"}],"g0GR":[function(require,module,exports) {
"use strict";function r(r,t,n,i){var o=n(require("../../type/matrix/function/matrix")),u=n(require("../../type/matrix/utils/algorithm01")),a=n(require("../../type/matrix/utils/algorithm02")),s=n(require("../../type/matrix/utils/algorithm06")),m=n(require("../../type/matrix/utils/algorithm11")),f=n(require("../../type/matrix/utils/algorithm13")),b=n(require("../../type/matrix/utils/algorithm14")),c="Complex number not supported in function nthRoot. Use nthRoots instead.",g=i("nthRoot",{number:function(r){return e(r,2)},"number, number":e,BigNumber:function(e){return x(e,new r.BigNumber(2))},Complex:function(r){throw new Error(c)},"Complex, number":function(r,e){throw new Error(c)},"BigNumber, BigNumber":x,"Array | Matrix":function(r){return g(r,2)},"SparseMatrix, SparseMatrix":function(r,e){if(1===e.density())return s(r,e,g);throw new Error("Root must be non-zero")},"SparseMatrix, DenseMatrix":function(r,e){return a(e,r,g,!0)},"DenseMatrix, SparseMatrix":function(r,e){if(1===e.density())return u(r,e,g,!1);throw new Error("Root must be non-zero")},"DenseMatrix, DenseMatrix":function(r,e){return f(r,e,g)},"Array, Array":function(r,e){return g(o(r),o(e)).valueOf()},"Array, Matrix":function(r,e){return g(o(r),e)},"Matrix, Array":function(r,e){return g(r,o(e))},"SparseMatrix, number | BigNumber":function(r,e){return m(r,e,g,!1)},"DenseMatrix, number | BigNumber":function(r,e){return b(r,e,g,!1)},"number | BigNumber, SparseMatrix":function(r,e){if(1===e.density())return m(e,r,g,!0);throw new Error("Root must be non-zero")},"number | BigNumber, DenseMatrix":function(r,e){return b(e,r,g,!0)},"Array, number | BigNumber":function(r,e){return g(o(r),e).valueOf()},"number | BigNumber, Array":function(r,e){return g(r,o(e)).valueOf()}});return g.toTex={2:"\\sqrt[${args[1]}]{${args[0]}}"},g;function x(e,t){var n=r.BigNumber.precision,i=r.BigNumber.clone({precision:n+2}),o=new r.BigNumber(0),u=new i(1),a=t.isNegative();if(a&&(t=t.neg()),t.isZero())throw new Error("Root must be non-zero");if(e.isNegative()&&!t.abs().mod(2).equals(1))throw new Error("Root must be odd when a is negative.");if(e.isZero())return a?new i(1/0):0;if(!e.isFinite())return a?o:e;var s=e.abs().pow(u.div(t));return s=e.isNeg()?s.neg():s,new r.BigNumber((a?u.div(s):s).toPrecision(n))}}function e(r,e){var t=e<0;if(t&&(e=-e),0===e)throw new Error("Root must be non-zero");if(r<0&&Math.abs(e)%2!=1)throw new 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}exports.name="nthRoot",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm06":"WzD7","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"Eyh8":[function(require,module,exports) {
"use strict";var r=require("../../type/complex/Complex"),t=require("../../core/typed"),o=r.factory("Complex",{},"",t,{on:function(r,t){}});function e(r,t,o,e){var n=e("nthRoots",{Complex:function(r){return u(r,2)},"Complex, number":u});return n.toTex={2:"\\{y : $y^{args[1]} = {${args[0]}}\\}"},n}var n=[function(r){return o(r)},function(r){return o(0,r)},function(r){return o(-r)},function(r){return o(0,-r)}];function u(r,t){if(t<0)throw new Error("Root must be greater than zero");if(0===t)throw new Error("Root must be non-zero");if(t%1!=0)throw new Error("Root must be an integer");if(0===r||0===r.abs())return[o(0)];var e,u="number"==typeof r;(u||0===r.re||0===r.im)&&(e=u?2*+(r<0):0===r.im?2*+(r.re<0):2*+(r.im<0)+1);for(var a=r.arg(),i=r.abs(),f=[],s=Math.pow(i,1/t),m=0;m<t;m++){var p=(e+4*m)/t;p!==Math.round(p)?f.push(o({r:s,phi:(a+2*Math.PI*m)/t})):f.push(n[p%4](s))}return f}exports.name="nthRoots",exports.factory=e;
},{"../../type/complex/Complex":"dh9O","../../core/typed":"ybZj"}],"YL5h":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,n,e,u){var i=u("square",{number:function(r){return r*r},Complex:function(r){return r.mul(r)},BigNumber:function(r){return r.times(r)},Fraction:function(r){return r.mul(r)},"Array | Matrix":function(t){return r(t,i,!0)},Unit:function(r){return r.pow(2)}});return i.toTex={1:"\\left(${args[0]}\\right)^2"},i}exports.name="square",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"tzUx":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function n(n,t,e,u){var i=require("../../utils/latex"),o=u("unaryPlus",{number:function(r){return r},Complex:function(r){return r},BigNumber:function(r){return r},Fraction:function(r){return r},Unit:function(r){return r.clone()},"Array | Matrix":function(n){return r(n,o,!0)},"boolean | string":function(r){return"BigNumber"===t.number?new n.BigNumber(+r):+r}});return o.toTex={1:"".concat(i.operators.unaryPlus,"\\left(${args[0]}\\right)")},o}exports.name="unaryPlus",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo","../../utils/latex":"H1Mr"}],"M0zV":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger;function e(e,n,t,i){var u=t(require("../../type/matrix/function/matrix")),o=i("xgcd",{"number, number":function(e,t){var i,o,m,s,a=0,g=1,f=1,c=0;if(!r(e)||!r(t))throw new Error("Parameters in function xgcd must be integer numbers");for(;t;)o=Math.floor(e/t),m=e-o*t,i=a,a=g-o*a,g=i,i=f,f=c-o*f,c=i,e=t,t=m;s=e<0?[-e,-g,-c]:[e,e?g:0,c];return"Array"===n.matrix?s:u(s)},"BigNumber, BigNumber":function(r,t){var i,o,m,s,a=new e.BigNumber(0),g=new e.BigNumber(1),f=a,c=g,b=g,x=a;if(!r.isInt()||!t.isInt())throw new Error("Parameters in function xgcd must be integer numbers");for(;!t.isZero();)o=r.div(t).floor(),m=r.mod(t),i=f,f=c.minus(o.times(f)),c=i,i=b,b=x.minus(o.times(b)),x=i,r=t,t=m;s=r.lt(a)?[r.neg(),c.neg(),x.neg()]:[r,r.isZero()?0:c,x];return"Array"===n.matrix?s:u(s)}});return o.toTex=void 0,o}exports.name="xgcd",exports.factory=e;
},{"../../utils/number":"uqMu","../../type/matrix/function/matrix":"vzj5"}],"bAc9":[function(require,module,exports) {
"use strict";module.exports=[require("./abs"),require("./add"),require("./addScalar"),require("./cbrt"),require("./ceil"),require("./cube"),require("./divide"),require("./dotDivide"),require("./dotMultiply"),require("./dotPow"),require("./exp"),require("./expm1"),require("./fix"),require("./floor"),require("./gcd"),require("./hypot"),require("./lcm"),require("./log"),require("./log10"),require("./log1p"),require("./log2"),require("./mod"),require("./multiply"),require("./norm"),require("./nthRoot"),require("./nthRoots"),require("./pow"),require("./round"),require("./sign"),require("./sqrt"),require("./square"),require("./subtract"),require("./unaryMinus"),require("./unaryPlus"),require("./xgcd")];
},{"./abs":"K5X1","./add":"zf2Z","./addScalar":"ZM3O","./cbrt":"N7RE","./ceil":"CkRk","./cube":"qFQg","./divide":"lVgQ","./dotDivide":"JrX5","./dotMultiply":"x67x","./dotPow":"xz2O","./exp":"hoRG","./expm1":"aAXN","./fix":"Pk2X","./floor":"Wigz","./gcd":"AWGe","./hypot":"YQ9T","./lcm":"EueY","./log":"T05K","./log10":"Bbg8","./log1p":"pWAs","./log2":"MzTq","./mod":"sR9e","./multiply":"k7By","./norm":"Ts3b","./nthRoot":"g0GR","./nthRoots":"Eyh8","./pow":"CsUv","./round":"f25u","./sign":"Zr7Q","./sqrt":"T6pB","./square":"YL5h","./subtract":"m78R","./unaryMinus":"q5A1","./unaryPlus":"tzUx","./xgcd":"M0zV"}],"LJa0":[function(require,module,exports) {
"use strict";module.exports=function(e){if(e.isFinite()&&!e.isInteger())throw new Error("Integer expected in function bitNot");var i=e.constructor,n=i.precision;i.config({precision:1e9});var r=e.plus(new i(1));return r.s=-r.s||null,i.config({precision:n}),r};
},{}],"aXnU":[function(require,module,exports) {
"use strict";var e=require("./bitNot");function r(e){for(var r=e.d,n=r[0]+"",t=1;t<r.length;++t){for(var l=r[t]+"",o=7-l.length;o--;)l="0"+l;n+=l}for(var i=n.length;"0"===n.charAt(i);)i--;var s=e.e,f=n.slice(0,i+1||1),a=f.length;if(s>0)if(++s>a)for(s-=a;s--;)f+="0";else s<a&&(f=f.slice(0,s)+"."+f.slice(s));for(var c=[0],g=0;g<f.length;){for(var h=c.length;h--;)c[h]*=10;c[0]+=parseInt(f.charAt(g++));for(var v=0;v<c.length;++v)c[v]>1&&(null!==c[v+1]&&void 0!==c[v+1]||(c[v+1]=0),c[v+1]+=c[v]>>1,c[v]&=1)}return c.reverse()}module.exports=function(n,t,l){var o,i,s,f,a,c=n.constructor,g=+(n.s<0),h=+(t.s<0);if(g){o=r(e(n));for(var v=0;v<o.length;++v)o[v]^=1}else o=r(n);if(h){i=r(e(t));for(var u=0;u<i.length;++u)i[u]^=1}else i=r(t);o.length<=i.length?(s=o,f=i,a=g):(s=i,f=o,a=h);var p=s.length,d=f.length,m=1^l(g,h),w=new c(1^m),A=new c(1),b=new c(2),q=c.precision;for(c.config({precision:1e9});p>0;)l(s[--p],f[--d])===m&&(w=w.plus(A)),A=A.times(b);for(;d>0;)l(a,f[--d])===m&&(w=w.plus(A)),A=A.times(b);return c.config({precision:q}),0===m&&(w.s=-w.s),w};
},{"./bitNot":"LJa0"}],"upit":[function(require,module,exports) {
"use strict";var i=require("./bitwise");module.exports=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitAnd");var n=e.constructor;if(e.isNaN()||t.isNaN())return new n(NaN);if(e.isZero()||t.eq(-1)||e.eq(t))return e;if(t.isZero()||e.eq(-1))return t;if(!e.isFinite()||!t.isFinite()){if(!e.isFinite()&&!t.isFinite())return e.isNegative()===t.isNegative()?e:new n(0);if(!e.isFinite())return t.isNegative()?e:e.isNegative()?new n(0):t;if(!t.isFinite())return e.isNegative()?t:t.isNegative()?new n(0):e}return i(e,t,function(i,e){return i&e})};
},{"./bitwise":"aXnU"}],"LRIo":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,t=require("../../utils/bignumber/bitAnd");function e(e,n,i,u){var a=require("../../utils/latex"),o=i(require("../../type/matrix/function/matrix")),s=i(require("../../type/matrix/utils/algorithm02")),x=i(require("../../type/matrix/utils/algorithm06")),f=i(require("../../type/matrix/utils/algorithm11")),c=i(require("../../type/matrix/utils/algorithm13")),m=i(require("../../type/matrix/utils/algorithm14")),y=u("bitAnd",{"number, number":function(t,e){if(!r(t)||!r(e))throw new Error("Integers expected in function bitAnd");return t&e},"BigNumber, BigNumber":t,"SparseMatrix, SparseMatrix":function(r,t){return x(r,t,y,!1)},"SparseMatrix, DenseMatrix":function(r,t){return s(t,r,y,!0)},"DenseMatrix, SparseMatrix":function(r,t){return s(r,t,y,!1)},"DenseMatrix, DenseMatrix":function(r,t){return c(r,t,y)},"Array, Array":function(r,t){return y(o(r),o(t)).valueOf()},"Array, Matrix":function(r,t){return y(o(r),t)},"Matrix, Array":function(r,t){return y(r,o(t))},"SparseMatrix, any":function(r,t){return f(r,t,y,!1)},"DenseMatrix, any":function(r,t){return m(r,t,y,!1)},"any, SparseMatrix":function(r,t){return f(t,r,y,!0)},"any, DenseMatrix":function(r,t){return m(t,r,y,!0)},"Array, any":function(r,t){return m(o(r),t,y,!1).valueOf()},"any, Array":function(r,t){return m(o(t),r,y,!0).valueOf()}});return y.toTex={2:"\\left(${args[0]}".concat(a.operators.bitAnd,"${args[1]}\\right)")},y}exports.name="bitAnd",exports.factory=e;
},{"../../utils/number":"uqMu","../../utils/bignumber/bitAnd":"upit","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm06":"WzD7","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"Oh4X":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap"),t=require("../../utils/bignumber/bitNot"),e=require("../../utils/number").isInteger;function i(i,n,u,o){var s=require("../../utils/latex"),a=o("bitNot",{number:function(r){if(!e(r))throw new Error("Integer expected in function bitNot");return~r},BigNumber:t,"Array | Matrix":function(t){return r(t,a)}});return a.toTex={1:s.operators.bitNot+"\\left(${args[0]}\\right)"},a}exports.name="bitNot",exports.factory=i;
},{"../../utils/collection/deepMap":"lOYo","../../utils/bignumber/bitNot":"LJa0","../../utils/number":"uqMu","../../utils/latex":"H1Mr"}],"MUNI":[function(require,module,exports) {
"use strict";var i=require("./bitwise");module.exports=function(e,t){if(e.isFinite()&&!e.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitOr");var s=e.constructor;if(e.isNaN()||t.isNaN())return new s(NaN);var n=new s(-1);return e.isZero()||t.eq(n)||e.eq(t)?t:t.isZero()||e.eq(n)?e:e.isFinite()&&t.isFinite()?i(e,t,function(i,e){return i|e}):!e.isFinite()&&!e.isNegative()&&t.isNegative()||e.isNegative()&&!t.isNegative()&&!t.isFinite()?n:e.isNegative()&&t.isNegative()?e.isFinite()?e:t:e.isFinite()?t:e};
},{"./bitwise":"aXnU"}],"kLOX":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,t=require("../../utils/bignumber/bitOr");function e(e,i,n,u){var a=require("../../utils/latex"),o=n(require("../../type/matrix/function/matrix")),s=n(require("../../type/matrix/utils/algorithm01")),x=n(require("../../type/matrix/utils/algorithm04")),f=n(require("../../type/matrix/utils/algorithm10")),c=n(require("../../type/matrix/utils/algorithm13")),m=n(require("../../type/matrix/utils/algorithm14")),y=u("bitOr",{"number, number":function(t,e){if(!r(t)||!r(e))throw new Error("Integers expected in function bitOr");return t|e},"BigNumber, BigNumber":t,"SparseMatrix, SparseMatrix":function(r,t){return x(r,t,y)},"SparseMatrix, DenseMatrix":function(r,t){return s(t,r,y,!0)},"DenseMatrix, SparseMatrix":function(r,t){return s(r,t,y,!1)},"DenseMatrix, DenseMatrix":function(r,t){return c(r,t,y)},"Array, Array":function(r,t){return y(o(r),o(t)).valueOf()},"Array, Matrix":function(r,t){return y(o(r),t)},"Matrix, Array":function(r,t){return y(r,o(t))},"SparseMatrix, any":function(r,t){return f(r,t,y,!1)},"DenseMatrix, any":function(r,t){return m(r,t,y,!1)},"any, SparseMatrix":function(r,t){return f(t,r,y,!0)},"any, DenseMatrix":function(r,t){return m(t,r,y,!0)},"Array, any":function(r,t){return m(o(r),t,y,!1).valueOf()},"any, Array":function(r,t){return m(o(t),r,y,!0).valueOf()}});return y.toTex={2:"\\left(${args[0]}".concat(a.operators.bitOr,"${args[1]}\\right)")},y}exports.name="bitOr",exports.factory=e;
},{"../../utils/number":"uqMu","../../utils/bignumber/bitOr":"MUNI","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm04":"m7Qa","../../type/matrix/utils/algorithm10":"H0xb","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"LBOM":[function(require,module,exports) {
"use strict";var i=require("./bitwise"),e=require("./bitNot");module.exports=function(r,t){if(r.isFinite()&&!r.isInteger()||t.isFinite()&&!t.isInteger())throw new Error("Integers expected in function bitXor");var n=r.constructor;if(r.isNaN()||t.isNaN())return new n(NaN);if(r.isZero())return t;if(t.isZero())return r;if(r.eq(t))return new n(0);var s=new n(-1);return r.eq(s)?e(t):t.eq(s)?e(r):r.isFinite()&&t.isFinite()?i(r,t,function(i,e){return i^e}):r.isFinite()||t.isFinite()?new n(r.isNegative()===t.isNegative()?1/0:-1/0):s};
},{"./bitwise":"aXnU","./bitNot":"LJa0"}],"WoWZ":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,t=require("../../utils/bignumber/bitXor");function e(e,i,n,u){var a=require("../../utils/latex"),o=n(require("../../type/matrix/function/matrix")),s=n(require("../../type/matrix/utils/algorithm03")),x=n(require("../../type/matrix/utils/algorithm07")),f=n(require("../../type/matrix/utils/algorithm12")),c=n(require("../../type/matrix/utils/algorithm13")),m=n(require("../../type/matrix/utils/algorithm14")),y=u("bitXor",{"number, number":function(t,e){if(!r(t)||!r(e))throw new Error("Integers expected in function bitXor");return t^e},"BigNumber, BigNumber":t,"SparseMatrix, SparseMatrix":function(r,t){return x(r,t,y)},"SparseMatrix, DenseMatrix":function(r,t){return s(t,r,y,!0)},"DenseMatrix, SparseMatrix":function(r,t){return s(r,t,y,!1)},"DenseMatrix, DenseMatrix":function(r,t){return c(r,t,y)},"Array, Array":function(r,t){return y(o(r),o(t)).valueOf()},"Array, Matrix":function(r,t){return y(o(r),t)},"Matrix, Array":function(r,t){return y(r,o(t))},"SparseMatrix, any":function(r,t){return f(r,t,y,!1)},"DenseMatrix, any":function(r,t){return m(r,t,y,!1)},"any, SparseMatrix":function(r,t){return f(t,r,y,!0)},"any, DenseMatrix":function(r,t){return m(t,r,y,!0)},"Array, any":function(r,t){return m(o(r),t,y,!1).valueOf()},"any, Array":function(r,t){return m(o(t),r,y,!0).valueOf()}});return y.toTex={2:"\\left(${args[0]}".concat(a.operators.bitXor,"${args[1]}\\right)")},y}exports.name="bitXor",exports.factory=e;
},{"../../utils/number":"uqMu","../../utils/bignumber/bitXor":"LBOM","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"Wxcu":[function(require,module,exports) {
"use strict";module.exports=function(e,i){if(e.isFinite()&&!e.isInteger()||i.isFinite()&&!i.isInteger())throw new Error("Integers expected in function leftShift");var t=e.constructor;return e.isNaN()||i.isNaN()||i.isNegative()&&!i.isZero()?new t(NaN):e.isZero()||i.isZero()?e:e.isFinite()||i.isFinite()?i.lt(55)?e.times(Math.pow(2,i.toNumber())+""):e.times(new t(2).pow(i)):new t(NaN)};
},{}],"sHbh":[function(require,module,exports) {
"use strict";var r=require("../../../error/DimensionError");function e(e,t,n,a){var i=n(require("../../../function/relational/equalScalar")),o=e.SparseMatrix;return function(e,t,n){var s=e._values,l=e._index,p=e._ptr,f=e._size,h=e._datatype,u=t._values,c=t._index,v=t._ptr,g=t._size,_=t._datatype;if(f.length!==g.length)throw new r(f.length,g.length);if(f[0]!==g[0]||f[1]!==g[1])throw new RangeError("Dimension mismatch. Matrix A ("+f+") must match Matrix B ("+g+")");if(!s||!u)throw new Error("Cannot perform operation on Pattern Sparse Matrices");var m,d=f[0],x=f[1],w=i,y=0,M=n;"string"==typeof h&&h===_&&(m=h,w=a.find(i,[m,m]),y=a.convert(0,m),M=a.find(n,[m,m]));for(var q,z,E,S,D=[],A=[],B=[],C=new o({values:D,index:A,ptr:B,size:[d,x],datatype:m}),P=[],R=[],b=0;b<x;b++){B[b]=A.length;var j=b+1;for(z=p[b],E=p[b+1],q=z;q<E;q++)R[S=l[q]]=j,P[S]=s[q],A.push(S);for(z=v[b],E=v[b+1],q=z;q<E;q++)R[S=c[q]]===j&&(P[S]=M(P[S],u[q]));for(q=B[b];q<A.length;){var k=P[S=A[q]];w(k,y)?A.splice(q,1):(D.push(k),q++)}}return B[x]=A.length,C}}exports.name="algorithm08",exports.factory=e;
},{"../../../error/DimensionError":"YiAw","../../../function/relational/equalScalar":"QvIw"}],"p0FC":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,e=require("../../utils/bignumber/leftShift");function t(t,i,u,n){var a=require("../../utils/latex"),o=u(require("../../type/matrix/function/matrix")),m=u(require("../relational/equalScalar")),s=u(require("../matrix/zeros")),f=u(require("../../type/matrix/utils/algorithm01")),l=u(require("../../type/matrix/utils/algorithm02")),x=u(require("../../type/matrix/utils/algorithm08")),c=u(require("../../type/matrix/utils/algorithm10")),g=u(require("../../type/matrix/utils/algorithm11")),b=u(require("../../type/matrix/utils/algorithm13")),p=u(require("../../type/matrix/utils/algorithm14")),y=n("leftShift",{"number, number":function(e,t){if(!r(e)||!r(t))throw new Error("Integers expected in function leftShift");return e<<t},"BigNumber, BigNumber":e,"SparseMatrix, SparseMatrix":function(r,e){return x(r,e,y,!1)},"SparseMatrix, DenseMatrix":function(r,e){return l(e,r,y,!0)},"DenseMatrix, SparseMatrix":function(r,e){return f(r,e,y,!1)},"DenseMatrix, DenseMatrix":function(r,e){return b(r,e,y)},"Array, Array":function(r,e){return y(o(r),o(e)).valueOf()},"Array, Matrix":function(r,e){return y(o(r),e)},"Matrix, Array":function(r,e){return y(r,o(e))},"SparseMatrix, number | BigNumber":function(r,e){return m(e,0)?r.clone():g(r,e,y,!1)},"DenseMatrix, number | BigNumber":function(r,e){return m(e,0)?r.clone():p(r,e,y,!1)},"number | BigNumber, SparseMatrix":function(r,e){return m(r,0)?s(e.size(),e.storage()):c(e,r,y,!0)},"number | BigNumber, DenseMatrix":function(r,e){return m(r,0)?s(e.size(),e.storage()):p(e,r,y,!0)},"Array, number | BigNumber":function(r,e){return y(o(r),e).valueOf()},"number | BigNumber, Array":function(r,e){return y(r,o(e)).valueOf()}});return y.toTex={2:"\\left(${args[0]}".concat(a.operators.leftShift,"${args[1]}\\right)")},y}exports.name="leftShift",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/bignumber/leftShift":"Wxcu","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../relational/equalScalar":"QvIw","../matrix/zeros":"BAjv","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm08":"sHbh","../../type/matrix/utils/algorithm10":"H0xb","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"gyUS":[function(require,module,exports) {
"use strict";module.exports=function(i,e){if(i.isFinite()&&!i.isInteger()||e.isFinite()&&!e.isInteger())throw new Error("Integers expected in function rightArithShift");var t=i.constructor;return i.isNaN()||e.isNaN()||e.isNegative()&&!e.isZero()?new t(NaN):i.isZero()||e.isZero()?i:e.isFinite()?e.lt(55)?i.div(Math.pow(2,e.toNumber())+"").floor():i.div(new t(2).pow(e)).floor():i.isNegative()?new t(-1):i.isFinite()?new t(0):new t(NaN)};
},{}],"DRd9":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,t=require("../../utils/bignumber/rightArithShift");function e(e,i,u,n){var a=require("../../utils/latex"),o=u(require("../../type/matrix/function/matrix")),m=u(require("../relational/equalScalar")),s=u(require("../matrix/zeros")),x=u(require("../../type/matrix/utils/algorithm01")),f=u(require("../../type/matrix/utils/algorithm02")),g=u(require("../../type/matrix/utils/algorithm08")),l=u(require("../../type/matrix/utils/algorithm10")),c=u(require("../../type/matrix/utils/algorithm11")),h=u(require("../../type/matrix/utils/algorithm13")),b=u(require("../../type/matrix/utils/algorithm14")),p=n("rightArithShift",{"number, number":function(t,e){if(!r(t)||!r(e))throw new Error("Integers expected in function rightArithShift");return t>>e},"BigNumber, BigNumber":t,"SparseMatrix, SparseMatrix":function(r,t){return g(r,t,p,!1)},"SparseMatrix, DenseMatrix":function(r,t){return f(t,r,p,!0)},"DenseMatrix, SparseMatrix":function(r,t){return x(r,t,p,!1)},"DenseMatrix, DenseMatrix":function(r,t){return h(r,t,p)},"Array, Array":function(r,t){return p(o(r),o(t)).valueOf()},"Array, Matrix":function(r,t){return p(o(r),t)},"Matrix, Array":function(r,t){return p(r,o(t))},"SparseMatrix, number | BigNumber":function(r,t){return m(t,0)?r.clone():c(r,t,p,!1)},"DenseMatrix, number | BigNumber":function(r,t){return m(t,0)?r.clone():b(r,t,p,!1)},"number | BigNumber, SparseMatrix":function(r,t){return m(r,0)?s(t.size(),t.storage()):l(t,r,p,!0)},"number | BigNumber, DenseMatrix":function(r,t){return m(r,0)?s(t.size(),t.storage()):b(t,r,p,!0)},"Array, number | BigNumber":function(r,t){return p(o(r),t).valueOf()},"number | BigNumber, Array":function(r,t){return p(r,o(t)).valueOf()}});return p.toTex={2:"\\left(${args[0]}".concat(a.operators.rightArithShift,"${args[1]}\\right)")},p}exports.name="rightArithShift",exports.factory=e;
},{"../../utils/number":"uqMu","../../utils/bignumber/rightArithShift":"gyUS","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../relational/equalScalar":"QvIw","../matrix/zeros":"BAjv","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm08":"sHbh","../../type/matrix/utils/algorithm10":"H0xb","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"KdQk":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger;function e(e,t,i,n){var u=require("../../utils/latex"),a=i(require("../../type/matrix/function/matrix")),o=i(require("../relational/equalScalar")),s=i(require("../matrix/zeros")),m=i(require("../../type/matrix/utils/algorithm01")),x=i(require("../../type/matrix/utils/algorithm02")),g=i(require("../../type/matrix/utils/algorithm08")),f=i(require("../../type/matrix/utils/algorithm10")),l=i(require("../../type/matrix/utils/algorithm11")),c=i(require("../../type/matrix/utils/algorithm13")),p=i(require("../../type/matrix/utils/algorithm14")),h=n("rightLogShift",{"number, number":function(e,t){if(!r(e)||!r(t))throw new Error("Integers expected in function rightLogShift");return e>>>t},"SparseMatrix, SparseMatrix":function(r,e){return g(r,e,h,!1)},"SparseMatrix, DenseMatrix":function(r,e){return x(e,r,h,!0)},"DenseMatrix, SparseMatrix":function(r,e){return m(r,e,h,!1)},"DenseMatrix, DenseMatrix":function(r,e){return c(r,e,h)},"Array, Array":function(r,e){return h(a(r),a(e)).valueOf()},"Array, Matrix":function(r,e){return h(a(r),e)},"Matrix, Array":function(r,e){return h(r,a(e))},"SparseMatrix, number | BigNumber":function(r,e){return o(e,0)?r.clone():l(r,e,h,!1)},"DenseMatrix, number | BigNumber":function(r,e){return o(e,0)?r.clone():p(r,e,h,!1)},"number | BigNumber, SparseMatrix":function(r,e){return o(r,0)?s(e.size(),e.storage()):f(e,r,h,!0)},"number | BigNumber, DenseMatrix":function(r,e){return o(r,0)?s(e.size(),e.storage()):p(e,r,h,!0)},"Array, number | BigNumber":function(r,e){return h(a(r),e).valueOf()},"number | BigNumber, Array":function(r,e){return h(r,a(e)).valueOf()}});return h.toTex={2:"\\left(${args[0]}".concat(u.operators.rightLogShift,"${args[1]}\\right)")},h}exports.name="rightLogShift",exports.factory=e;
},{"../../utils/number":"uqMu","../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../relational/equalScalar":"QvIw","../matrix/zeros":"BAjv","../../type/matrix/utils/algorithm01":"q1c8","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm08":"sHbh","../../type/matrix/utils/algorithm10":"H0xb","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"JhAg":[function(require,module,exports) {
"use strict";module.exports=[require("./bitAnd"),require("./bitNot"),require("./bitOr"),require("./bitXor"),require("./leftShift"),require("./rightArithShift"),require("./rightLogShift")];
},{"./bitAnd":"LRIo","./bitNot":"Oh4X","./bitOr":"kLOX","./bitXor":"WoWZ","./leftShift":"p0FC","./rightArithShift":"DRd9","./rightLogShift":"KdQk"}],"FONy":[function(require,module,exports) {
"use strict";function r(t,e){var u;return e<t?1:e===t?e:r(t,u=e+t>>1)*r(u+1,e)}module.exports=r;
},{}],"ciea":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap"),r=require("../../utils/number").isInteger;function i(i,a,u,m){var o=u(require("../arithmetic/multiply")),s=u(require("../arithmetic/pow")),h=require("./product"),c=m("gamma",{number:function(e){var i,a;if(r(e))return e<=0?isFinite(e)?1/0:NaN:e>171?1/0:h(1,e-1);if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*c(1-e));if(e>=171.35)return 1/0;if(e>85){var u=e*e,m=u*e,o=m*e,s=o*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*u)-139/(51840*m)-571/(2488320*o)+163879/(209018880*s)+5246819/(75246796800*s*e))}--e,a=n[0];for(var g=1;g<n.length;++g)a+=n[g]/(e+g);return i=e+t+.5,Math.sqrt(2*Math.PI)*Math.pow(i,e+.5)*Math.exp(-i)*a},Complex:function(e){var r,a;if(0===e.im)return c(e.re);e=new i.Complex(e.re-1,e.im),a=new i.Complex(n[0],0);for(var u=1;u<n.length;++u){var m=e.re+u,h=m*m+e.im*e.im;0!==h?(a.re+=n[u]*m/h,a.im+=-n[u]*e.im/h):a.re=n[u]<0?-1/0:1/0}r=new i.Complex(e.re+t+.5,e.im);var g=Math.sqrt(2*Math.PI);e.re+=.5;var f=s(r,e);0===f.im?f.re*=g:0===f.re?f.im*=g:(f.re*=g,f.im*=g);var p=Math.exp(-r.re);return r.re=p*Math.cos(-r.im),r.im=p*Math.sin(-r.im),o(o(f,r),a)},BigNumber:function(e){if(e.isInteger())return e.isNegative()||e.isZero()?new i.BigNumber(1/0):function(e){if(e.isZero())return new i.BigNumber(1);var r=a.precision+(0|Math.log(e.toNumber())),t=new(i.BigNumber.clone({precision:r}))(e),n=e.toNumber()-1;for(;n>1;)t=t.times(n),n--;return new i.BigNumber(t.toPrecision(i.BigNumber.precision))}(e.minus(1));if(!e.isFinite())return new i.BigNumber(e.isNegative()?NaN:1/0);throw new Error("Integer BigNumber expected")},"Array | Matrix":function(r){return e(r,c)}});return c.toTex={1:"\\Gamma\\left(${args[0]}\\right)"},c}var t=4.7421875,n=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];exports.name="gamma",exports.factory=i;
},{"../../utils/collection/deepMap":"lOYo","../../utils/number":"uqMu","../arithmetic/multiply":"k7By","../arithmetic/pow":"CsUv","./product":"FONy"}],"yidz":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,a,n){var i=a(require("./gamma")),o=require("../../utils/latex"),u=n("factorial",{number:function(r){if(r<0)throw new Error("Value must be non-negative");return i(r+1)},BigNumber:function(r){if(r.isNegative())throw new Error("Value must be non-negative");return i(r.plus(1))},"Array | Matrix":function(e){return r(e,u)}});return u.toTex={1:"\\left(${args[0]}\\right)".concat(o.operators.factorial)},u}exports.name="factorial",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo","./gamma":"ciea","../../utils/latex":"H1Mr"}],"n9b2":[function(require,module,exports) {
"use strict";var e=require("../../utils/number").isInteger,n=require("./product");function r(r,t,o,u){var s=u("combinations",{"number, number":function(r,i){var t;if(!e(r)||r<0)throw new TypeError("Positive integer value expected in function combinations");if(!e(i)||i<0)throw new TypeError("Positive integer value expected in function combinations");if(i>r)throw new TypeError("k must be less than or equal to n");return i<(t=r-i)?n(t+1,r)/n(1,i):n(i+1,r)/n(1,t)},"BigNumber, BigNumber":function(e,n){var t,o,u,s,a=new r.BigNumber(1);if(!i(e)||!i(n))throw new TypeError("Positive integer value expected in function combinations");if(n.gt(e))throw new TypeError("k must be less than n in function combinations");for(t=e.minus(n),n.lt(t)&&(t=n),o=a,u=a,s=e.minus(t);u.lte(s);u=u.plus(1))o=o.times(t.plus(u)).dividedBy(u);return o}});return s.toTex={2:"\\binom{${args[0]}}{${args[1]}}"},s}function i(e){return e.isInteger()&&e.gte(0)}exports.name="combinations",exports.factory=r;
},{"../../utils/number":"uqMu","./product":"FONy"}],"qG7X":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap"),e=require("../../utils/number");function n(n,t,i,u){var s=u("isInteger",{number:e.isInteger,BigNumber:function(r){return r.isInt()},Fraction:function(r){return 1===r.d&&isFinite(r.n)},"Array | Matrix":function(e){return r(e,s)}});return s}exports.name="isInteger",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo","../../utils/number":"uqMu"}],"RVLq":[function(require,module,exports) {
"use strict";function r(r,e,i,t){var n=i(require("../arithmetic/add")),u=i(require("../arithmetic/subtract")),a=i(require("../arithmetic/multiply")),o=i(require("../arithmetic/divide")),l=i(require("../arithmetic/pow")),s=i(require("../probability/factorial")),c=i(require("../probability/combinations")),m=i(require("../utils/isNegative")),g=i(require("../utils/isInteger")),b=i(require("../relational/larger")),q=t("stirlingS2",{"number | BigNumber, number | BigNumber":function(r,e){if(!g(r)||m(r)||!g(e)||m(e))throw new TypeError("Non-negative integer value expected in function stirlingS2");if(b(e,r))throw new TypeError("k must be less than or equal to n in function stirlingS2");for(var i=s(e),t=0,q=0;q<=e;q++){var f=l(-1,u(e,q)),h=c(e,q),p=l(q,r);t=n(t,a(a(h,p),f))}return o(t,i)}});return q.toTex={2:"\\mathrm{S}\\left(${args}\\right)"},q}exports.name="stirlingS2",exports.factory=r;
},{"../arithmetic/add":"zf2Z","../arithmetic/subtract":"m78R","../arithmetic/multiply":"k7By","../arithmetic/divide":"lVgQ","../arithmetic/pow":"CsUv","../probability/factorial":"yidz","../probability/combinations":"n9b2","../utils/isNegative":"HYoC","../utils/isInteger":"qG7X","../relational/larger":"SrDl"}],"VdBl":[function(require,module,exports) {
"use strict";function e(e,r,t,i){var u=t(require("../arithmetic/add")),n=t(require("./stirlingS2")),s=t(require("../utils/isNegative")),a=t(require("../utils/isInteger")),o=i("bellNumbers",{"number | BigNumber":function(e){if(!a(e)||s(e))throw new TypeError("Non-negative integer value expected in function bellNumbers");for(var r=0,t=0;t<=e;t++)r=u(r,n(e,t));return r}});return o.toTex={1:"\\mathrm{B}_{${args[0]}}"},o}exports.name="bellNumbers",exports.factory=e;
},{"../arithmetic/add":"zf2Z","./stirlingS2":"RVLq","../utils/isNegative":"HYoC","../utils/isInteger":"qG7X"}],"FQ9r":[function(require,module,exports) {
"use strict";function e(e,i,r,o){var t=r(require("../probability/combinations")),n=r(require("../arithmetic/addScalar")),u=r(require("../utils/isPositive")),s=r(require("../utils/isInteger")),a=r(require("../relational/larger")),c=o("composition",{"number | BigNumber, number | BigNumber":function(e,i){if(!(s(e)&&u(e)&&s(i)&&u(i)))throw new TypeError("Positive integer value expected in function composition");if(a(i,e))throw new TypeError("k must be less than or equal to n in function composition");return t(n(e,-1),n(i,-1))}});return c.toTex=void 0,c}exports.name="composition",exports.factory=e;
},{"../probability/combinations":"n9b2","../arithmetic/addScalar":"ZM3O","../utils/isPositive":"OFKG","../utils/isInteger":"qG7X","../relational/larger":"SrDl"}],"UHHf":[function(require,module,exports) {
"use strict";function e(e,r,i,t){var a=i(require("../arithmetic/add")),n=i(require("../arithmetic/divide")),u=i(require("../arithmetic/multiply")),c=i(require("../probability/combinations")),o=i(require("../utils/isNegative")),m=i(require("../utils/isInteger")),s=t("catalan",{"number | BigNumber":function(e){if(!m(e)||o(e))throw new TypeError("Non-negative integer value expected in function catalan");return n(c(u(e,2),e),a(e,1))}});return s.toTex={1:"\\mathrm{C}_{${args[0]}}"},s}exports.name="catalan",exports.factory=e;
},{"../arithmetic/add":"zf2Z","../arithmetic/divide":"lVgQ","../arithmetic/multiply":"k7By","../probability/combinations":"n9b2","../utils/isNegative":"HYoC","../utils/isInteger":"qG7X"}],"otxT":[function(require,module,exports) {
"use strict";module.exports=[require("./bellNumbers"),require("./composition"),require("./stirlingS2"),require("./catalan")];
},{"./bellNumbers":"VdBl","./composition":"FQ9r","./stirlingS2":"RVLq","./catalan":"UHHf"}],"UjqL":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,e,n,a){var u=a("arg",{number:function(r){return Math.atan2(0,r)},BigNumber:function(r){return t.BigNumber.atan2(0,r)},Complex:function(r){return r.arg()},"Array | Matrix":function(t){return r(t,u)}});return u.toTex={1:"\\arg\\left(${args[0]}\\right)"},u}exports.name="arg",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"NXCa":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,n,i){var u=i("im",{number:function(r){return 0},BigNumber:function(r){return new e.BigNumber(0)},Complex:function(r){return r.im},"Array | Matrix":function(e){return r(e,u)}});return u.toTex={1:"\\Im\\left\\lbrace${args[0]}\\right\\rbrace"},u}exports.name="im",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"Vvrl":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,n,u){var i=u("re",{number:function(r){return r},BigNumber:function(r){return r},Complex:function(r){return r.re},"Array | Matrix":function(e){return r(e,i)}});return i.toTex={1:"\\Re\\left\\lbrace${args[0]}\\right\\rbrace"},i}exports.name="re",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"gHt6":[function(require,module,exports) {
"use strict";module.exports=[require("./arg"),require("./conj"),require("./im"),require("./re")];
},{"./arg":"UjqL","./conj":"msvi","./im":"NXCa","./re":"Vvrl"}],"Lso4":[function(require,module,exports) {
"use strict";function r(r,e,t,i){var n=t(require("../arithmetic/abs")),u=t(require("../arithmetic/add")),a=t(require("../arithmetic/addScalar")),o=t(require("../../type/matrix/function/matrix")),f=t(require("../arithmetic/multiply")),m=t(require("../arithmetic/multiplyScalar")),c=t(require("../arithmetic/divideScalar")),h=t(require("../arithmetic/subtract")),s=t(require("../relational/smaller")),w=t(require("../relational/equalScalar")),y=i("intersect",{"Array, Array, Array":function(r,e,t){if(!g(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!g(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!function(r){return 4===r.length&&l(r[0])&&l(r[1])&&l(r[2])&&l(r[3])}(t))throw new TypeError("Array with 4 numbers expected as third argument");return function(r,e,t,i,n,u,o,f,s,w){var y=m(r,o),l=m(i,o),p=m(e,f),g=m(n,f),b=m(t,s),d=m(u,s),x=c(h(h(h(w,y),p),b),h(h(h(a(a(l,g),d),y),p),b)),A=a(r,m(x,h(i,r))),v=a(e,m(x,h(n,e))),E=a(t,m(x,h(u,t)));return[A,v,E]}(r[0],r[1],r[2],e[0],e[1],e[2],t[0],t[1],t[2],t[3])},"Array, Array, Array, Array":function(r,t,i,o){if(2===r.length){if(!p(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!p(t))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!p(i))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");if(!p(o))throw new TypeError("Array with 2 numbers or BigNumbers expected for fourth argument");return function(r,t,i,o){var w=r,y=i,l=h(w,t),p=h(y,o),g=h(m(l[0],p[1]),m(p[0],l[1]));if(s(n(g),e.epsilon))return null;var b=m(p[0],w[1]),d=m(p[1],w[0]),x=m(p[0],y[1]),A=m(p[1],y[0]),v=c(a(h(h(b,d),x),A),g);return u(f(l,v),w)}(r,t,i,o)}if(3===r.length){if(!g(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!g(t))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");if(!g(i))throw new TypeError("Array with 3 numbers or BigNumbers expected for third argument");if(!g(o))throw new TypeError("Array with 3 numbers or BigNumbers expected for fourth argument");return y=r[0],l=r[1],d=r[2],x=t[0],A=t[1],v=t[2],E=i[0],T=i[1],q=i[2],B=o[0],N=o[1],M=o[2],O=b(y,E,B,E,l,T,N,T,d,q,M,q),S=b(B,E,x,y,N,T,A,l,M,q,v,d),j=b(y,E,x,y,l,T,A,l,d,q,v,d),k=b(B,E,B,E,N,T,N,T,M,q,M,q),z=b(x,y,x,y,A,l,A,l,v,d,v,d),C=c(h(m(O,S),m(j,k)),h(m(z,k),m(S,S))),D=c(a(O,m(C,S)),k),F=a(y,m(C,h(x,y))),G=a(l,m(C,h(A,l))),H=a(d,m(C,h(v,d))),I=a(E,m(D,h(B,E))),J=a(T,m(D,h(N,T))),K=a(q,m(D,h(M,q))),w(F,I)&&w(G,J)&&w(H,K)?[F,G,H]:null}throw new TypeError("Arrays with two or thee dimensional points expected");var y,l,d,x,A,v,E,T,q,B,N,M,O,S,j,k,z,C,D,F,G,H,I,J,K},"Matrix, Matrix, Matrix":function(r,e,t){return o(y(r.valueOf(),e.valueOf(),t.valueOf()))},"Matrix, Matrix, Matrix, Matrix":function(r,e,t,i){return o(y(r.valueOf(),e.valueOf(),t.valueOf(),i.valueOf()))}});function l(e){return"number"==typeof e||r.isBigNumber(e)}function p(r){return 2===r.length&&l(r[0])&&l(r[1])}function g(r){return 3===r.length&&l(r[0])&&l(r[1])&&l(r[2])}function b(r,e,t,i,n,u,o,f,c,s,w,y){var l=m(h(r,e),h(t,i)),p=m(h(n,u),h(o,f)),g=m(h(c,s),h(w,y));return a(a(l,p),g)}return y}exports.name="intersect",exports.factory=r;
},{"../arithmetic/abs":"K5X1","../arithmetic/add":"zf2Z","../arithmetic/addScalar":"ZM3O","../../type/matrix/function/matrix":"vzj5","../arithmetic/multiply":"k7By","../arithmetic/multiplyScalar":"obRw","../arithmetic/divideScalar":"R3aq","../arithmetic/subtract":"m78R","../relational/smaller":"Q7ag","../relational/equalScalar":"QvIw"}],"HQQE":[function(require,module,exports) {
"use strict";function r(r,e,n,t){var o=n(require("../arithmetic/addScalar")),i=n(require("../arithmetic/subtract")),a=n(require("../arithmetic/multiplyScalar")),s=n(require("../arithmetic/divideScalar")),u=n(require("../arithmetic/unaryMinus")),p=n(require("../arithmetic/sqrt")),h=n(require("../arithmetic/abs"));function w(e){return"number"==typeof e||r.isBigNumber(e)}function y(r){return r.constructor!==Array&&(r=m(r)),w(r[0])&&w(r[1])}function f(r){return r.constructor!==Array&&(r=m(r)),w(r[0])&&w(r[1])&&w(r[2])}function c(r){return r.constructor!==Array&&(r=m(r)),w(r[0])&&w(r[1])&&w(r[2])&&w(r[3])&&w(r[4])&&w(r[5])}function m(r){for(var e=Object.keys(r),n=[],t=0;t<e.length;t++)n.push(r[e[t]]);return n}function b(r,e,n,t,i){var u=h(o(o(a(n,r),a(t,e)),i)),w=p(o(a(n,n),a(t,t)));return s(u,w)}function l(r,e,n,t,u,h,w,y,f){var c=[i(a(i(u,e),f),a(i(h,n),y)),i(a(i(h,n),w),a(i(t,r),f)),i(a(i(t,r),y),a(i(u,e),w))];c=p(o(o(a(c[0],c[0]),a(c[1],c[1])),a(c[2],c[2])));var m=p(o(o(a(w,w),a(y,y)),a(f,f)));return s(c,m)}function g(r,e,n,t){var s=i(t,e),u=i(n,r),h=o(a(s,s),a(u,u));return p(h)}function O(r,e,n,t,s,u){var h=i(u,n),w=i(s,e),y=i(t,r),f=o(o(a(h,h),a(w,w)),a(y,y));return p(f)}return t("distance",{"Array, Array, Array":function(r,e,n){if(2===r.length&&2===e.length&&2===n.length){if(!y(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!y(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");if(!y(n))throw new TypeError("Array with 2 numbers or BigNumbers expected for third argument");var t=s(i(n[1],n[0]),i(e[1],e[0])),o=a(a(t,t),e[0]),p=u(a(t,e[0])),h=r[1];return b(r[0],r[1],o,p,h)}throw new TypeError("Invalid Arguments: Try again")},"Object, Object, Object":function(r,e,n){if(2===Object.keys(r).length&&2===Object.keys(e).length&&2===Object.keys(n).length){if(!y(r))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!y(e))throw new TypeError("Values of lineOnePtX and lineOnePtY should be numbers or BigNumbers");if(!y(n))throw new TypeError("Values of lineTwoPtX and lineTwoPtY should be numbers or BigNumbers");if(r.hasOwnProperty("pointX")&&r.hasOwnProperty("pointY")&&e.hasOwnProperty("lineOnePtX")&&e.hasOwnProperty("lineOnePtY")&&n.hasOwnProperty("lineTwoPtX")&&n.hasOwnProperty("lineTwoPtY")){var t=s(i(n.lineTwoPtY,n.lineTwoPtX),i(e.lineOnePtY,e.lineOnePtX)),o=a(a(t,t),e.lineOnePtX),p=u(a(t,e.lineOnePtX)),h=r.pointX;return b(r.pointX,r.pointY,o,p,h)}throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},"Array, Array":function(r,e){if(2===r.length&&3===e.length){if(!y(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!f(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return b(r[0],r[1],e[0],e[1],e[2])}if(3===r.length&&6===e.length){if(!f(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!c(e))throw new TypeError("Array with 6 numbers or BigNumbers expected for second argument");return l(r[0],r[1],r[2],e[0],e[1],e[2],e[3],e[4],e[5])}if(2===r.length&&2===e.length){if(!y(r))throw new TypeError("Array with 2 numbers or BigNumbers expected for first argument");if(!y(e))throw new TypeError("Array with 2 numbers or BigNumbers expected for second argument");return g(r[0],r[1],e[0],e[1])}if(3===r.length&&3===e.length){if(!f(r))throw new TypeError("Array with 3 numbers or BigNumbers expected for first argument");if(!f(e))throw new TypeError("Array with 3 numbers or BigNumbers expected for second argument");return O(r[0],r[1],r[2],e[0],e[1],e[2])}throw new TypeError("Invalid Arguments: Try again")},"Object, Object":function(r,e){if(2===Object.keys(r).length&&3===Object.keys(e).length){if(!y(r))throw new TypeError("Values of pointX and pointY should be numbers or BigNumbers");if(!f(e))throw new TypeError("Values of xCoeffLine, yCoeffLine and constant should be numbers or BigNumbers");if(r.hasOwnProperty("pointX")&&r.hasOwnProperty("pointY")&&e.hasOwnProperty("xCoeffLine")&&e.hasOwnProperty("yCoeffLine")&&e.hasOwnProperty("constant"))return b(r.pointX,r.pointY,e.xCoeffLine,e.yCoeffLine,e.constant);throw new TypeError("Key names do not match")}if(3===Object.keys(r).length&&6===Object.keys(e).length){if(!f(r))throw new TypeError("Values of pointX, pointY and pointZ should be numbers or BigNumbers");if(!c(e))throw new TypeError("Values of x0, y0, z0, a, b and c should be numbers or BigNumbers");if(r.hasOwnProperty("pointX")&&r.hasOwnProperty("pointY")&&e.hasOwnProperty("x0")&&e.hasOwnProperty("y0")&&e.hasOwnProperty("z0")&&e.hasOwnProperty("a")&&e.hasOwnProperty("b")&&e.hasOwnProperty("c"))return l(r.pointX,r.pointY,r.pointZ,e.x0,e.y0,e.z0,e.a,e.b,e.c);throw new TypeError("Key names do not match")}if(2===Object.keys(r).length&&2===Object.keys(e).length){if(!y(r))throw new TypeError("Values of pointOneX and pointOneY should be numbers or BigNumbers");if(!y(e))throw new TypeError("Values of pointTwoX and pointTwoY should be numbers or BigNumbers");if(r.hasOwnProperty("pointOneX")&&r.hasOwnProperty("pointOneY")&&e.hasOwnProperty("pointTwoX")&&e.hasOwnProperty("pointTwoY"))return g(r.pointOneX,r.pointOneY,e.pointTwoX,e.pointTwoY);throw new TypeError("Key names do not match")}if(3===Object.keys(r).length&&3===Object.keys(e).length){if(!f(r))throw new TypeError("Values of pointOneX, pointOneY and pointOneZ should be numbers or BigNumbers");if(!f(e))throw new TypeError("Values of pointTwoX, pointTwoY and pointTwoZ should be numbers or BigNumbers");if(r.hasOwnProperty("pointOneX")&&r.hasOwnProperty("pointOneY")&&r.hasOwnProperty("pointOneZ")&&e.hasOwnProperty("pointTwoX")&&e.hasOwnProperty("pointTwoY")&&e.hasOwnProperty("pointTwoZ"))return O(r.pointOneX,r.pointOneY,r.pointOneZ,e.pointTwoX,e.pointTwoY,e.pointTwoZ);throw new TypeError("Key names do not match")}throw new TypeError("Invalid Arguments: Try again")},Array:function(r){if(!function(r){if(2===r[0].length&&w(r[0][0])&&w(r[0][1])){for(var e in r)if(2!==r[e].length||!w(r[e][0])||!w(r[e][1]))return!1}else{if(!(3===r[0].length&&w(r[0][0])&&w(r[0][1])&&w(r[0][2])))return!1;for(var n in r)if(3!==r[n].length||!w(r[n][0])||!w(r[n][1])||!w(r[n][2]))return!1}return!0}(r))throw new TypeError("Incorrect array format entered for pairwise distance calculation");return function(r){for(var e=[],n=0;n<r.length-1;n++)for(var t=n+1;t<r.length;t++)2===r[0].length?e.push(g(r[n][0],r[n][1],r[t][0],r[t][1])):3===r[0].length&&e.push(O(r[n][0],r[n][1],r[n][2],r[t][0],r[t][1],r[t][2]));return e}(r)}})}exports.name="distance",exports.factory=r;
},{"../arithmetic/addScalar":"ZM3O","../arithmetic/subtract":"m78R","../arithmetic/multiplyScalar":"obRw","../arithmetic/divideScalar":"R3aq","../arithmetic/unaryMinus":"q5A1","../arithmetic/sqrt":"T6pB","../arithmetic/abs":"K5X1"}],"W9Zs":[function(require,module,exports) {
"use strict";module.exports=[require("./intersect"),require("./distance")];
},{"./intersect":"Lso4","./distance":"HQQE"}],"yt75":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,e,n,u){var i=require("../../utils/latex"),o=u("not",{number:function(r){return!r},Complex:function(r){return 0===r.re&&0===r.im},BigNumber:function(r){return r.isZero()||r.isNaN()},Unit:function(r){return null===r.value||o(r.value)},"Array | Matrix":function(t){return r(t,o)}});return o.toTex={1:i.operators.not+"\\left(${args[0]}\\right)"},o}exports.name="not",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo","../../utils/latex":"H1Mr"}],"T9FX":[function(require,module,exports) {
"use strict";function r(r,t,e,n){var i=require("../../utils/latex"),a=e(require("../../type/matrix/function/matrix")),u=e(require("../matrix/zeros")),o=e(require("./not")),s=e(require("../../type/matrix/utils/algorithm02")),x=e(require("../../type/matrix/utils/algorithm06")),f=e(require("../../type/matrix/utils/algorithm11")),c=e(require("../../type/matrix/utils/algorithm13")),m=e(require("../../type/matrix/utils/algorithm14")),l=n("and",{"number, number":function(r,t){return!(!r||!t)},"Complex, Complex":function(r,t){return!(0===r.re&&0===r.im||0===t.re&&0===t.im)},"BigNumber, BigNumber":function(r,t){return!(r.isZero()||t.isZero()||r.isNaN()||t.isNaN())},"Unit, Unit":function(r,t){return l(r.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(r,t){return x(r,t,l,!1)},"SparseMatrix, DenseMatrix":function(r,t){return s(t,r,l,!0)},"DenseMatrix, SparseMatrix":function(r,t){return s(r,t,l,!1)},"DenseMatrix, DenseMatrix":function(r,t){return c(r,t,l)},"Array, Array":function(r,t){return l(a(r),a(t)).valueOf()},"Array, Matrix":function(r,t){return l(a(r),t)},"Matrix, Array":function(r,t){return l(r,a(t))},"SparseMatrix, any":function(r,t){return o(t)?u(r.size(),r.storage()):f(r,t,l,!1)},"DenseMatrix, any":function(r,t){return o(t)?u(r.size(),r.storage()):m(r,t,l,!1)},"any, SparseMatrix":function(r,t){return o(r)?u(r.size(),r.storage()):f(t,r,l,!0)},"any, DenseMatrix":function(r,t){return o(r)?u(r.size(),r.storage()):m(t,r,l,!0)},"Array, any":function(r,t){return l(a(r),t).valueOf()},"any, Array":function(r,t){return l(r,a(t)).valueOf()}});return l.toTex={2:"\\left(${args[0]}".concat(i.operators.and,"${args[1]}\\right)")},l}exports.name="and",exports.factory=r;
},{"../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../matrix/zeros":"BAjv","./not":"yt75","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm06":"WzD7","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"Jm4S":[function(require,module,exports) {
"use strict";function r(r,t,e,n){var i=require("../../utils/latex"),u=e(require("../../type/matrix/function/matrix")),a=e(require("../../type/matrix/utils/algorithm03")),o=e(require("../../type/matrix/utils/algorithm05")),s=e(require("../../type/matrix/utils/algorithm12")),x=e(require("../../type/matrix/utils/algorithm13")),f=e(require("../../type/matrix/utils/algorithm14")),c=n("or",{"number, number":function(r,t){return!(!r&&!t)},"Complex, Complex":function(r,t){return 0!==r.re||0!==r.im||0!==t.re||0!==t.im},"BigNumber, BigNumber":function(r,t){return!r.isZero()&&!r.isNaN()||!t.isZero()&&!t.isNaN()},"Unit, Unit":function(r,t){return c(r.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(r,t){return o(r,t,c)},"SparseMatrix, DenseMatrix":function(r,t){return a(t,r,c,!0)},"DenseMatrix, SparseMatrix":function(r,t){return a(r,t,c,!1)},"DenseMatrix, DenseMatrix":function(r,t){return x(r,t,c)},"Array, Array":function(r,t){return c(u(r),u(t)).valueOf()},"Array, Matrix":function(r,t){return c(u(r),t)},"Matrix, Array":function(r,t){return c(r,u(t))},"SparseMatrix, any":function(r,t){return s(r,t,c,!1)},"DenseMatrix, any":function(r,t){return f(r,t,c,!1)},"any, SparseMatrix":function(r,t){return s(t,r,c,!0)},"any, DenseMatrix":function(r,t){return f(t,r,c,!0)},"Array, any":function(r,t){return f(u(r),t,c,!1).valueOf()},"any, Array":function(r,t){return f(u(t),r,c,!0).valueOf()}});return c.toTex={2:"\\left(${args[0]}".concat(i.operators.or,"${args[1]}\\right)")},c}exports.name="or",exports.factory=r;
},{"../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm05":"JNXe","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"TZVj":[function(require,module,exports) {
"use strict";function r(r,t,e,n){var i=require("../../utils/latex"),u=e(require("../../type/matrix/function/matrix")),a=e(require("../../type/matrix/utils/algorithm03")),o=e(require("../../type/matrix/utils/algorithm07")),x=e(require("../../type/matrix/utils/algorithm12")),s=e(require("../../type/matrix/utils/algorithm13")),f=e(require("../../type/matrix/utils/algorithm14")),c=n("xor",{"number, number":function(r,t){return!!r!=!!t},"Complex, Complex":function(r,t){return(0!==r.re||0!==r.im)!=(0!==t.re||0!==t.im)},"BigNumber, BigNumber":function(r,t){return(!r.isZero()&&!r.isNaN())!=(!t.isZero()&&!t.isNaN())},"Unit, Unit":function(r,t){return c(r.value||0,t.value||0)},"SparseMatrix, SparseMatrix":function(r,t){return o(r,t,c)},"SparseMatrix, DenseMatrix":function(r,t){return a(t,r,c,!0)},"DenseMatrix, SparseMatrix":function(r,t){return a(r,t,c,!1)},"DenseMatrix, DenseMatrix":function(r,t){return s(r,t,c)},"Array, Array":function(r,t){return c(u(r),u(t)).valueOf()},"Array, Matrix":function(r,t){return c(u(r),t)},"Matrix, Array":function(r,t){return c(r,u(t))},"SparseMatrix, any":function(r,t){return x(r,t,c,!1)},"DenseMatrix, any":function(r,t){return f(r,t,c,!1)},"any, SparseMatrix":function(r,t){return x(t,r,c,!0)},"any, DenseMatrix":function(r,t){return f(t,r,c,!0)},"Array, any":function(r,t){return f(u(r),t,c,!1).valueOf()},"any, Array":function(r,t){return f(u(t),r,c,!0).valueOf()}});return c.toTex={2:"\\left(${args[0]}".concat(i.operators.xor,"${args[1]}\\right)")},c}exports.name="xor",exports.factory=r;
},{"../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"TPFf":[function(require,module,exports) {
"use strict";module.exports=[require("./and"),require("./not"),require("./or"),require("./xor")];
},{"./and":"T9FX","./not":"yt75","./or":"Jm4S","./xor":"TZVj"}],"f9k3":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").size,e=require("../../utils/collection/isMatrix"),t=require("../../error/IndexError");function n(n,u,o,a){var f=o(require("../utils/isInteger")),s=a("apply",{"Array | Matrix, number | BigNumber, function":function(n,u,o){if(!f(u))throw new TypeError("Integer number expected for dimension");var a=Array.isArray(n)?r(n):n.size();if(u<0||u>=a.length)throw new t(u,a.length);return e(n)?n.create(i(n.valueOf(),u,o)):i(n,u,o)}});return s.toTex=void 0,s}function i(r,e,t){var n,o,a;if(e<=0){if(Array.isArray(r[0])){for(a=u(r),o=[],n=0;n<a.length;n++)o[n]=i(a[n],e-1,t);return o}return t(r)}for(o=[],n=0;n<r.length;n++)o[n]=i(r[n],e-1,t);return o}function u(r){var e,t,n=r.length,i=r[0].length,u=[];for(t=0;t<i;t++){var o=[];for(e=0;e<n;e++)o.push(r[e][t]);u.push(o)}return u}exports.name="apply",exports.factory=n;
},{"../../utils/array":"j2lF","../../utils/collection/isMatrix":"gfmG","../../error/IndexError":"tfOV","../utils/isInteger":"qG7X"}],"rN68":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").nearlyEqual,e=require("../../utils/bignumber/nearlyEqual");function t(t,n,i,a){var u=i(require("../../type/matrix/function/matrix")),o=i(require("../../type/matrix/utils/algorithm03")),l=i(require("../../type/matrix/utils/algorithm07")),s=i(require("../../type/matrix/utils/algorithm12")),f=i(require("../../type/matrix/utils/algorithm13")),c=i(require("../../type/matrix/utils/algorithm14")),m=require("../../utils/latex"),x=a("smallerEq",{"boolean, boolean":function(r,e){return r<=e},"number, number":function(e,t){return e<=t||r(e,t,n.epsilon)},"BigNumber, BigNumber":function(r,t){return r.lte(t)||e(r,t,n.epsilon)},"Fraction, Fraction":function(r,e){return 1!==r.compare(e)},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(r,e){if(!r.equalBase(e))throw new Error("Cannot compare units with different base");return x(r.value,e.value)},"SparseMatrix, SparseMatrix":function(r,e){return l(r,e,x)},"SparseMatrix, DenseMatrix":function(r,e){return o(e,r,x,!0)},"DenseMatrix, SparseMatrix":function(r,e){return o(r,e,x,!1)},"DenseMatrix, DenseMatrix":function(r,e){return f(r,e,x)},"Array, Array":function(r,e){return x(u(r),u(e)).valueOf()},"Array, Matrix":function(r,e){return x(u(r),e)},"Matrix, Array":function(r,e){return x(r,u(e))},"SparseMatrix, any":function(r,e){return s(r,e,x,!1)},"DenseMatrix, any":function(r,e){return c(r,e,x,!1)},"any, SparseMatrix":function(r,e){return s(e,r,x,!0)},"any, DenseMatrix":function(r,e){return c(e,r,x,!0)},"Array, any":function(r,e){return c(u(r),e,x,!1).valueOf()},"any, Array":function(r,e){return c(u(e),r,x,!0).valueOf()}});return x.toTex={2:"\\left(${args[0]}".concat(m.operators.smallerEq,"${args[1]}\\right)")},x}exports.name="smallerEq",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm07":"u44a","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB","../../utils/latex":"H1Mr"}],"lueR":[function(require,module,exports) {
"use strict";function r(r,e,n,u){var t=n(require("../../type/matrix/function/matrix")),i=n(require("../relational/smaller")),o=n(require("../relational/larger")),a=n(require("../relational/smallerEq")),f=n(require("../relational/largerEq")),s=new r.BigNumber(0),l=new r.BigNumber(1),m=u("range",{string:g,"string, boolean":g,"number, number":function(r,e){return b(c(r,e,1))},"number, number, number":function(r,e,n){return b(c(r,e,n))},"number, number, boolean":function(r,e,n){return b(n?p(r,e,1):c(r,e,1))},"number, number, number, boolean":function(r,e,n,u){return b(u?p(r,e,n):c(r,e,n))},"BigNumber, BigNumber":function(r,e){return b(N(r,e,l))},"BigNumber, BigNumber, BigNumber":function(r,e,n){return b(N(r,e,n))},"BigNumber, BigNumber, boolean":function(r,e,n){return b(n?B(r,e,l):N(r,e,l))},"BigNumber, BigNumber, BigNumber, boolean":function(r,e,n,u){return b(u?B(r,e,n):N(r,e,n))}});return m.toTex=void 0,m;function b(r){return"Array"===e.matrix?r:t(r)}function g(n,u){var t=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}}(n);if(!t)throw new SyntaxError('String "'+n+'" is no valid range');return"BigNumber"===e.number?b((u?B:N)(new r.BigNumber(t.start),new r.BigNumber(t.end),new r.BigNumber(t.step))):b((u?p:c)(t.start,t.end,t.step))}function c(r,e,n){var u=[],t=r;if(n>0)for(;i(t,e);)u.push(t),t+=n;else if(n<0)for(;o(t,e);)u.push(t),t+=n;return u}function p(r,e,n){var u=[],t=r;if(n>0)for(;a(t,e);)u.push(t),t+=n;else if(n<0)for(;f(t,e);)u.push(t),t+=n;return u}function N(r,e,n){var u=[],t=r;if(n.gt(s))for(;i(t,e);)u.push(t),t=t.plus(n);else if(n.lt(s))for(;o(t,e);)u.push(t),t=t.plus(n);return u}function B(r,e,n){var u=[],t=r;if(n.gt(s))for(;a(t,e);)u.push(t),t=t.plus(n);else if(n.lt(s))for(;f(t,e);)u.push(t),t=t.plus(n);return u}}exports.name="range",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","../relational/smaller":"Q7ag","../relational/larger":"SrDl","../relational/smallerEq":"rN68","../relational/largerEq":"d923"}],"g7VB":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").clone,e=require("../../utils/array").validateIndex;function t(t,i,n,u){var a=n(require("../../type/matrix/MatrixIndex")),o=n(require("../../type/matrix/function/matrix")),s=n(require("./range")),x=u("column",{"Matrix, number":c,"Array, number":function(e,t){return c(o(r(e)),t).valueOf()}});return x.toTex=void 0,x;function c(r,t){if(2!==r.size().length)throw new Error("Only two dimensional matrix is supported");e(t,r.size()[1]);var i=s(0,r.size()[0]),n=new a(i,t);return r.subset(n)}}exports.name="column",exports.factory=t;
},{"../../utils/object":"FcSp","../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../../type/matrix/function/matrix":"vzj5","./range":"lueR"}],"LXdZ":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").clone,e=require("../../utils/array"),t=require("../../error/IndexError"),n=require("../../error/DimensionError");function i(i,u,a,s){var f=a(require("../../type/matrix/function/matrix")),c=a(require("../utils/isInteger")),l=s("concat",{"...Array | Matrix | number | BigNumber":function(u){var a,s,l=u.length,h=-1,g=!1,m=[];for(a=0;a<l;a++){var w=u[a];if(i.isMatrix(w)&&(g=!0),i.isNumber(w)||i.isBigNumber(w)){if(a!==l-1)throw new Error("Dimension must be specified as last argument");if(s=h,h=w.valueOf(),!c(h))throw new TypeError("Integer number expected for dimension");if(h<0||a>0&&h>s)throw new t(h,s+1)}else{var x=r(w).valueOf(),v=e.size(x);if(m[a]=x,s=h,h=v.length-1,a>0&&h!==s)throw new n(s+1,h+1)}}if(0===m.length)throw new SyntaxError("At least one matrix expected");for(var b=m.shift();m.length;)b=o(b,m.shift(),h,0);return g?f(b):b},"...string":function(r){return r.join("")}});return l.toTex=void 0,l}function o(r,e,t,i){if(i<t){if(r.length!==e.length)throw new n(r.length,e.length);for(var u=[],a=0;a<r.length;a++)u[a]=o(r[a],e[a],t,i+1);return u}return r.concat(e)}exports.name="concat",exports.factory=i;
},{"../../utils/object":"FcSp","../../utils/array":"j2lF","../../error/IndexError":"tfOV","../../error/DimensionError":"YiAw","../../type/matrix/function/matrix":"vzj5","../utils/isInteger":"qG7X"}],"GWq7":[function(require,module,exports) {
"use strict";var r=require("../../utils/array");function t(t,e,i,a){var n=i(require("../../type/matrix/function/matrix")),o=i(require("../arithmetic/subtract")),u=i(require("../arithmetic/multiply")),s=a("cross",{"Matrix, Matrix":function(r,t){return n(c(r.toArray(),t.toArray()))},"Matrix, Array":function(r,t){return n(c(r.toArray(),t))},"Array, Matrix":function(r,t){return n(c(r,t.toArray()))},"Array, Array":c});return s.toTex={2:"\\left(${args[0]}\\right)\\times\\left(${args[1]}\\right)"},s;function c(t,e){var i=Math.max(r.size(t).length,r.size(e).length);t=r.squeeze(t),e=r.squeeze(e);var a=r.size(t),n=r.size(e);if(1!==a.length||1!==n.length||3!==a[0]||3!==n[0])throw new RangeError("Vectors with length 3 expected (Size A = ["+a.join(", ")+"], B = ["+n.join(", ")+"])");var s=[o(u(t[1],e[2]),u(t[2],e[1])),o(u(t[2],e[0]),u(t[0],e[2])),o(u(t[0],e[1]),u(t[1],e[0]))];return i>1?[s]:s}}exports.name="cross",exports.factory=t;
},{"../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5","../arithmetic/subtract":"m78R","../arithmetic/multiply":"k7By"}],"pnEY":[function(require,module,exports) {
"use strict";function r(r,e,t,o){var s=t(require("./transpose")),n=t(require("../complex/conj")),a=require("../../utils/latex"),c=o("ctranspose",{any:function(r){return n(s(r))}});return c.toTex={1:"\\left(${args[0]}\\right)".concat(a.operators.ctranspose)},c}exports.name="ctranspose",exports.factory=r;
},{"./transpose":"C2z0","../complex/conj":"msvi","../../utils/latex":"H1Mr"}],"JNTV":[function(require,module,exports) {
"use strict";var r=require("../../utils/array"),n=require("../../utils/number").isInteger;function t(t,e,i,u){var a=i(require("../../type/matrix/function/matrix")),o=u("diag",{Array:function(n){return s(n,0,r.size(n),null)},"Array, number":function(n,t){return s(n,t,r.size(n),null)},"Array, BigNumber":function(n,t){return s(n,t.toNumber(),r.size(n),null)},"Array, string":function(n,t){return s(n,0,r.size(n),t)},"Array, number, string":function(n,t,e){return s(n,t,r.size(n),e)},"Array, BigNumber, string":function(n,t,e){return s(n,t.toNumber(),r.size(n),e)},Matrix:function(r){return s(r,0,r.size(),r.storage())},"Matrix, number":function(r,n){return s(r,n,r.size(),r.storage())},"Matrix, BigNumber":function(r,n){return s(r,n.toNumber(),r.size(),r.storage())},"Matrix, string":function(r,n){return s(r,0,r.size(),n)},"Matrix, number, string":function(r,n,t){return s(r,n,r.size(),t)},"Matrix, BigNumber, string":function(r,n,t){return s(r,n.toNumber(),r.size(),t)}});return o.toTex=void 0,o;function s(r,e,i,u){if(!n(e))throw new TypeError("Second parameter in function diag must be an integer");var o=e>0?e:0,s=e<0?-e:0;switch(i.length){case 1:return function(r,n,e,i,u,a){var o=[i+u,i+a],s=t.Matrix.storage(e||"dense").diagonal(o,r,n);return null!==e?s:s.valueOf()}(r,e,u,i[0],s,o);case 2:return function(r,n,e,i,u,o){if(t.isMatrix(r)){var s=r.diagonal(n);return null!==e?e!==s.storage()?a(s,e):s:s.valueOf()}for(var f=Math.min(i[0]-u,i[1]-o),c=[],g=0;g<f;g++)c[g]=r[g+u][g+o];return null!==e?a(c):c}(r,e,u,i,s,o)}throw new RangeError("Matrix for function diag must be 2 dimensional")}}exports.name="diag",exports.factory=t;
},{"../../utils/array":"j2lF","../../utils/number":"uqMu","../../type/matrix/function/matrix":"vzj5"}],"unxK":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").size;function t(t,e,a,o){var n=a(require("../arithmetic/add")),i=a(require("../arithmetic/multiply")),u=o("dot",{"Matrix, Matrix":function(r,t){return c(r.toArray(),t.toArray())},"Matrix, Array":function(r,t){return c(r.toArray(),t)},"Array, Matrix":function(r,t){return c(r,t.toArray())},"Array, Array":c});return u.toTex={2:"\\left(${args[0]}\\cdot${args[1]}\\right)"},u;function c(t,e){var a=r(t),o=r(e),u=a[0];if(1!==a.length||1!==o.length)throw new RangeError("Vector expected");if(a[0]!==o[0])throw new RangeError("Vectors must have equal length ("+a[0]+" != "+o[0]+")");if(0===u)throw new RangeError("Cannot calculate the dot product of empty vectors");for(var c=0,f=0;f<u;f++)c=n(c,i(t[f],e[f]));return c}}exports.name="dot",exports.factory=t;
},{"../../utils/array":"j2lF","../arithmetic/add":"zf2Z","../arithmetic/multiply":"k7By"}],"pW27":[function(require,module,exports) {
"use strict";function e(e,t,r,i){return function(){throw new Error('Function "eye" is renamed to "identity" since mathjs version 5.0.0. To keep eye working, create an alias for it using "math.import({eye: math.identity}, {override: true})"')}}exports.name="eye",exports.factory=e;
},{}],"XFhy":[function(require,module,exports) {
"use strict";var r=require("../../utils/string").format;function e(e,t,a,i){var n=a(require("../arithmetic/abs")),o=a(require("../arithmetic/add")),u=a(require("./identity")),f=a(require("./inv")),s=a(require("../arithmetic/multiply")),p=e.SparseMatrix,c=i("expm",{Matrix:function(t){var a=t.size();if(2!==a.length||a[0]!==a[1])throw new RangeError("Matrix must be square (size: "+r(a)+")");for(var i=a[0],c=function(r,e){for(var t=0;t<30;t++)for(var a=0;a<=t;a++){var i=t-a;if(m(r,a,i)<e)return{q:a,j:i}}throw new 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],t=0,a=0;a<e;a++){for(var i=0,o=0;o<e;o++)i+=n(r.get([a,o]));t=Math.max(i,t)}return t}(t),1e-15),x=c.q,v=c.j,h=s(t,Math.pow(2,-v)),q=u(i),l=u(i),w=1,M=h,g=-1,d=1;d<=x;d++)d>1&&(M=s(M,h),g=-g),q=o(q,s(w=w*(x-d+1)/((2*x-d+1)*d),M)),l=o(l,s(w*g,M));for(var y=s(f(l),q),z=0;z<v;z++)y=s(y,y);return e.isSparseMatrix(t)?new p(y):y}});function m(r,e,t){for(var a=1,i=2;i<=e;i++)a*=i;for(var n=a,o=e+1;o<=2*e;o++)n*=o;var u=n*(2*e+1);return 8*Math.pow(r/Math.pow(2,t),2*e)*a*a/(n*u)}return c.toTex={1:"\\exp\\left(${args[0]}\\right)"},c}exports.name="expm",exports.factory=e;
},{"../../utils/string":"PshC","../arithmetic/abs":"K5X1","../arithmetic/add":"zf2Z","./identity":"zJUT","./inv":"yHuZ","../arithmetic/multiply":"k7By"}],"QC1r":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").filter,t=require("../../utils/array").filterRegExp,e=require("../../utils/function").maxArgumentCount;function i(r,e,i,u){var a=i(require("../../type/matrix/function/matrix")),o=u("filter",{"Array, function":n,"Matrix, function":function(r,t){return a(n(r.toArray(),t))},"Array, RegExp":t,"Matrix, RegExp":function(r,e){return a(t(r.toArray(),e))}});return o.toTex=void 0,o}function n(t,i){var n=e(i);return r(t,function(r,t,e){return 1===n?i(r):2===n?i(r,[t]):i(r,[t],e)})}exports.name="filter",exports.factory=i;
},{"../../utils/array":"j2lF","../../utils/function":"woyg","../../type/matrix/function/matrix":"vzj5"}],"KNrk":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").clone,t=require("../../utils/array").flatten;function e(e,n,a,i){var u=a(require("../../type/matrix/function/matrix")),o=i("flatten",{Array:function(e){return t(r(e))},Matrix:function(e){var n=t(r(e.toArray()));return u(n)}});return o.toTex=void 0,o}exports.name="flatten",exports.factory=e;
},{"../../utils/object":"FcSp","../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5"}],"dOnH":[function(require,module,exports) {
"use strict";var r=require("../../utils/function").maxArgumentCount,n=require("../../utils/array").forEach;function t(r,n,t,a){var u=a("forEach",{"Array, function":o,"Matrix, function":function(r,n){return r.forEach(n)}});return u.toTex=void 0,u}function o(t,o){var a=r(o);!function r(u,c){Array.isArray(u)?n(u,function(n,t){r(n,c.concat(t))}):1===a?o(u):2===a?o(u,c):o(u,c,t)}(t,[])}exports.name="forEach",exports.factory=t;
},{"../../utils/function":"woyg","../../utils/array":"j2lF"}],"g4K8":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").size;function t(t,n,e,i){var a=e(require("../../type/matrix/function/matrix")),u=e(require("../arithmetic/multiplyScalar"));return i("kron",{"Matrix, Matrix":function(r,t){return a(o(r.toArray(),t.toArray()))},"Matrix, Array":function(r,t){return a(o(r.toArray(),t))},"Array, Matrix":function(r,t){return a(o(r,t.toArray()))},"Array, Array":o});function o(t,n){if(1===r(t).length&&(t=[t]),1===r(n).length&&(n=[n]),r(t).length>2||r(n).length>2)throw new RangeError("Vectors with dimensions greater then 2 are not supported expected (Size x = "+JSON.stringify(t.length)+", y = "+JSON.stringify(n.length)+")");var e=[],i=[];return t.map(function(r){return n.map(function(t){return i=[],e.push(i),r.map(function(r){return t.map(function(t){return i.push(u(r,t))})})})})&&e}}exports.name="kron",exports.factory=t;
},{"../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5","../arithmetic/multiplyScalar":"obRw"}],"dcuN":[function(require,module,exports) {
"use strict";var r=require("../../utils/function").maxArgumentCount;function n(r,n,u,a){var o=a("map",{"Array, function":t,"Matrix, function":function(r,n){return r.map(n)}});return o.toTex=void 0,o}function t(n,t){var u=r(t);return function r(a,o){return Array.isArray(a)?a.map(function(n,t){return r(n,o.concat(t))}):1===u?t(a):2===u?t(a,o):t(a,o,n)}(n,[])}exports.name="map",exports.factory=n;
},{"../../utils/function":"woyg"}],"dmcR":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,e=require("../../utils/array").resize;function t(t,n,i,u){var a=i(require("../../type/matrix/function/matrix")),o=u("ones",{"":function(){return"Array"===n.matrix?f([]):f([],"default")},"...number | BigNumber | string":function(r){if("string"==typeof r[r.length-1]){var e=r.pop();return f(r,e)}return"Array"===n.matrix?f(r):f(r,"default")},Array:f,Matrix:function(r){var e=r.storage();return f(r.valueOf(),e)},"Array | Matrix, string":function(r,e){return f(r.valueOf(),e)}});return o.toTex=void 0,o;function f(n,i){var u=function(r){var e=!1;return r.forEach(function(r,n,i){t.isBigNumber(r)&&(e=!0,i[n]=r.toNumber())}),e}(n)?new t.BigNumber(1):1;if(function(e){e.forEach(function(e){if("number"!=typeof e||!r(e)||e<0)throw new Error("Parameters in function ones must be positive integers")})}(n),i){var o=a(i);return n.length>0?o.resize(n,u):o}var f=[];return n.length>0?e(f,n,u):f}}exports.name="ones",exports.factory=t;
},{"../../utils/number":"uqMu","../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5"}],"AHex":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function n(n,t,e,u){return u("isNaN",{number:function(r){return Number.isNaN(r)},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(n){return r(n,Number.isNaN)}})}exports.name="isNaN",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo"}],"yGce":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").nearlyEqual,e=require("../../utils/bignumber/nearlyEqual");function n(n,t,i,u){var a=i(require("../../type/matrix/function/matrix")),o=i(require("../../type/matrix/utils/algorithm03")),c=i(require("../../type/matrix/utils/algorithm05")),f=i(require("../../type/matrix/utils/algorithm12")),l=i(require("../../type/matrix/utils/algorithm13")),m=i(require("../../type/matrix/utils/algorithm14")),s=u("compare",{"boolean, boolean":function(r,e){return r===e?0:r>e?1:-1},"number, number":function(e,n){return e===n||r(e,n,t.epsilon)?0:e>n?1:-1},"BigNumber, BigNumber":function(r,i){return r.eq(i)||e(r,i,t.epsilon)?new n.BigNumber(0):new n.BigNumber(r.cmp(i))},"Fraction, Fraction":function(r,e){return new n.Fraction(r.compare(e))},"Complex, Complex":function(){throw new TypeError("No ordering relation is defined for complex numbers")},"Unit, Unit":function(r,e){if(!r.equalBase(e))throw new Error("Cannot compare units with different base");return s(r.value,e.value)},"SparseMatrix, SparseMatrix":function(r,e){return c(r,e,s)},"SparseMatrix, DenseMatrix":function(r,e){return o(e,r,s,!0)},"DenseMatrix, SparseMatrix":function(r,e){return o(r,e,s,!1)},"DenseMatrix, DenseMatrix":function(r,e){return l(r,e,s)},"Array, Array":function(r,e){return s(a(r),a(e)).valueOf()},"Array, Matrix":function(r,e){return s(a(r),e)},"Matrix, Array":function(r,e){return s(r,a(e))},"SparseMatrix, any":function(r,e){return f(r,e,s,!1)},"DenseMatrix, any":function(r,e){return m(r,e,s,!1)},"any, SparseMatrix":function(r,e){return f(e,r,s,!0)},"any, DenseMatrix":function(r,e){return m(e,r,s,!0)},"Array, any":function(r,e){return m(a(r),e,s,!1).valueOf()},"any, Array":function(r,e){return m(a(e),r,s,!0).valueOf()}});return s.toTex=void 0,s}exports.name="compare",exports.factory=n;
},{"../../utils/number":"uqMu","../../utils/bignumber/nearlyEqual":"Uu9K","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm05":"JNXe","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"kE3o":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger;function e(e,t,n,i){var o=n(require("../utils/isNumeric")),u=n(require("../utils/isNaN")),a=n(require("../relational/compare"));function s(r,e){return-a(r,e)}return i("partitionSelect",{"Array | Matrix, number":function(r,e){return f(r,e,a)},"Array | Matrix, number, string":function(r,e,t){if("asc"===t)return f(r,e,a);if("desc"===t)return f(r,e,s);throw new Error('Compare string must be "asc" or "desc"')},"Array | Matrix, number, function":f});function f(t,n,i){if(!r(n)||n<0)throw new Error("k must be a non-negative integer");if(e.isMatrix(t)){if(t.size().length>1)throw new Error("Only one dimensional matrices supported");return c(t.valueOf(),n,i)}if(Array.isArray(t))return c(t,n,i)}function c(r,e,t){if(e>=r.length)throw new Error("k out of bounds");for(var n=0;n<r.length;n++)if(o(r[n])&&u(r[n]))return r[n];for(var i=0,a=r.length-1;i<a;){for(var s=i,f=a,c=r[Math.floor(Math.random()*(a-i+1))+i];s<f;)if(t(r[s],c)>=0){var l=r[f];r[f]=r[s],r[s]=l,--f}else++s;t(r[s],c)>0&&--s,e<=s?a=s:i=s+1}return r[e]}}exports.name="partitionSelect",exports.factory=e;
},{"../../utils/number":"uqMu","../utils/isNumeric":"Rv38","../utils/isNaN":"AHex","../relational/compare":"yGce"}],"BrQj":[function(require,module,exports) {
"use strict";var r=require("../../utils/array");function e(e,t,a,i){var n=a(require("../../type/matrix/function/matrix")),o=a(require("../utils/isInteger")),s=i("reshape",{"Matrix, Array":function(e,t){return e.reshape?e.reshape(t):n(r.reshape(e.valueOf(),t))},"Array, Array":function(e,t){return t.forEach(function(r){if(!o(r))throw new TypeError("Invalid size for dimension: "+r)}),r.reshape(e,t)}});return s.toTex=void 0,s}exports.name="reshape",exports.factory=e;
},{"../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5","../utils/isInteger":"qG7X"}],"pwUu":[function(require,module,exports) {
"use strict";var r=require("../../error/DimensionError"),e=require("../../error/ArgumentsError"),t=require("../../utils/number").isInteger,i=require("../../utils/string").format,n=require("../../utils/object").clone,u=require("../../utils/array");function s(s,o,a,f){var l=a(require("../../type/matrix/function/matrix")),g=function(a,f,g){if(2!==arguments.length&&3!==arguments.length)throw new e("resize",arguments.length,2,3);if(s.isMatrix(f)&&(f=f.valueOf()),s.isBigNumber(f[0])&&(f=f.map(function(r){return s.isBigNumber(r)?r.toNumber():r})),s.isMatrix(a))return a.resize(f,g,!0);if("string"==typeof a)return function(e,n,u){if(void 0!==u){if("string"!=typeof u||1!==u.length)throw new TypeError("Single character expected as defaultValue")}else u=" ";if(1!==n.length)throw new r(n.length,1);var s=n[0];if("number"!=typeof s||!t(s))throw new TypeError("Invalid size, must contain positive integers (size: "+i(n)+")");if(e.length>s)return e.substring(0,s);if(e.length<s){for(var o=e,a=0,f=s-e.length;a<f;a++)o+=u;return o}return e}(a,f,g);var h=!Array.isArray(a)&&"Array"!==o.matrix;if(0===f.length){for(;Array.isArray(a);)a=a[0];return n(a)}Array.isArray(a)||(a=[a]),a=n(a);var y=u.resize(a,f,g);return h?l(y):y};return g.toTex=void 0,g}exports.name="resize",exports.factory=s;
},{"../../error/DimensionError":"YiAw","../../error/ArgumentsError":"h0xI","../../utils/number":"uqMu","../../utils/string":"PshC","../../utils/object":"FcSp","../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5"}],"eLyh":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").clone,e=require("../../utils/array").validateIndex;function t(t,i,n,u){var a=n(require("../../type/matrix/MatrixIndex")),o=n(require("../../type/matrix/function/matrix")),s=n(require("./range")),x=u("row",{"Matrix, number":c,"Array, number":function(e,t){return c(o(r(e)),t).valueOf()}});return x.toTex=void 0,x;function c(r,t){if(2!==r.size().length)throw new Error("Only two dimensional matrix is supported");e(t,r.size()[0]);var i=s(0,r.size()[1]),n=new a(t,i);return r.subset(n)}}exports.name="row",exports.factory=t;
},{"../../utils/object":"FcSp","../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../../type/matrix/function/matrix":"vzj5","./range":"lueR"}],"OqDc":[function(require,module,exports) {
"use strict";var r=require("../../utils/array");function t(t,e,i,n){var u=i(require("../../type/matrix/function/matrix")),a=n("size",{Matrix:function(r){return u(r.size())},Array:r.size,string:function(r){return"Array"===e.matrix?[r.length]:u([r.length])},"number | Complex | BigNumber | Unit | boolean | null":function(r){return"Array"===e.matrix?[]:u([])}});return a.toTex=void 0,a}exports.name="size",exports.factory=t;
},{"../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5"}],"Z01J":[function(require,module,exports) {
module.exports=function e(a,r){"use strict";var t,i,n=/(^([+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?)?$|^0x[0-9a-f]+$|\d+)/gi,p=/(^[ ]*|[ ]*$)/g,l=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,c=/^0x[0-9a-f]+$/i,s=/^0/,d=function(a){return e.insensitive&&(""+a).toLowerCase()||""+a},f=d(a).replace(p,"")||"",u=d(r).replace(p,"")||"",o=f.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=u.replace(n,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(f.match(c),16)||1!==o.length&&f.match(l)&&Date.parse(f),w=parseInt(u.match(c),16)||m&&u.match(l)&&Date.parse(u)||null;if(w){if(m<w)return-1;if(m>w)return 1}for(var $=0,N=Math.max(o.length,h.length);$<N;$++){if(t=!(o[$]||"").match(s)&&parseFloat(o[$])||o[$]||0,i=!(h[$]||"").match(s)&&parseFloat(h[$])||h[$]||0,isNaN(t)!==isNaN(i))return isNaN(t)?1:-1;if(typeof t!=typeof i&&(t+="",i+=""),t<i)return-1;if(t>i)return 1}return 0};
},{}],"ljuJ":[function(require,module,exports) {
"use strict";var r=require("javascript-natural-sort");function t(t,n,i,a){var u=i(require("../utils/typeof")),o=i(require("./compare")),f=o.signatures["boolean,boolean"],s=a("compareNatural",{"any, any":function(n,i){var a,c=u(n),m=u(i);if(!("number"!==c&&"BigNumber"!==c&&"Fraction"!==c||"number"!==m&&"BigNumber"!==m&&"Fraction"!==m))return"0"!==(a=o(n,i)).toString()?a>0?1:-1:r(c,m);if("Array"===c||"Matrix"===c||"Array"===m||"Matrix"===m)return 0!==(a=function r(e,n){if(t.isSparseMatrix(e)&&t.isSparseMatrix(n))return l(e.toJSON().values,n.toJSON().values);if(t.isSparseMatrix(e))return r(e.toArray(),n);if(t.isSparseMatrix(n))return r(e,n.toArray());if(t.isDenseMatrix(e))return r(e.toJSON().data,n);if(t.isDenseMatrix(n))return r(e,n.toJSON().data);if(!Array.isArray(e))return r([e],n);if(!Array.isArray(n))return r(e,[n]);return l(e,n)}(n,i))?a:r(c,m);if(c!==m)return r(c,m);if("Complex"===c)return e(n,i);if("Unit"===c)return n.equalBase(i)?s(n.value,i.value):l(n.formatUnits(),i.formatUnits());if("boolean"===c)return f(n,i);if("string"===c)return r(n,i);if("Object"===c)return function(t,e){var n=Object.keys(t),i=Object.keys(e);n.sort(r),i.sort(r);var a=l(n,i);if(0!==a)return a;for(var u=0;u<n.length;u++){var o=s(t[n[u]],e[i[u]]);if(0!==o)return o}return 0}(n,i);if("null"===c)return 0;if("undefined"===c)return 0;throw new TypeError('Unsupported type of value "'+c+'"')}});function l(r,t){for(var e=0,n=Math.min(r.length,t.length);e<n;e++){var i=s(r[e],t[e]);if(0!==i)return i}return r.length>t.length?1:r.length<t.length?-1:0}return s.toTex=void 0,s}function e(r,t){return r.re>t.re?1:r.re<t.re?-1:r.im>t.im?1:r.im<t.im?-1:0}exports.name="compareNatural",exports.factory=t;
},{"javascript-natural-sort":"Z01J","../utils/typeof":"LZTG","./compare":"yGce"}],"roN2":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").size;function t(t,n,e,o){var i=e(require("../../type/matrix/function/matrix")),a=e(require("../relational/compare")),u=function(r,t){return-a(r,t)},s=e(require("../relational/compareNatural")),c=o("sort",{Array:function(r){return l(r),r.sort(a)},Matrix:function(r){return x(r),i(r.toArray().sort(a),r.storage())},"Array, function":function(r,t){return l(r),r.sort(t)},"Matrix, function":function(r,t){return x(r),i(r.toArray().sort(t),r.storage())},"Array, string":function(r,t){return l(r),r.sort(f(t))},"Matrix, string":function(r,t){return x(r),i(r.toArray().sort(f(t)),r.storage())}});function f(r){if("asc"===r)return a;if("desc"===r)return u;if("natural"===r)return s;throw new Error('String "asc", "desc", or "natural" expected')}function l(t){if(1!==r(t).length)throw new Error("One dimensional array expected")}function x(r){if(1!==r.size().length)throw new Error("One dimensional matrix expected")}return c.toTex=void 0,c}exports.name="sort",exports.factory=t;
},{"../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5","../relational/compare":"yGce","../relational/compareNatural":"ljuJ"}],"Uh7d":[function(require,module,exports) {
"use strict";var r=require("./isMatrix");module.exports=function a(e,i){r(e)&&(e=e.valueOf());for(var t=0,s=e.length;t<s;t++){var u=e[t];Array.isArray(u)?a(u,i):i(u)}};
},{"./isMatrix":"gfmG"}],"tjrJ":[function(require,module,exports) {
"use strict";var r=require("../array").size,e=require("../collection/isMatrix"),t=require("../../error/IndexError");function n(r,e,t){var u,o,a,f;if(e<=0){if(Array.isArray(r[0])){for(f=i(r),o=[],u=0;u<f.length;u++)o[u]=n(f[u],e-1,t);return o}for(a=r[0],u=1;u<r.length;u++)a=t(a,r[u]);return a}for(o=[],u=0;u<r.length;u++)o[u]=n(r[u],e-1,t);return o}function i(r){var e,t,n=r.length,i=r[0].length,u=[];for(t=0;t<i;t++){var o=[];for(e=0;e<n;e++)o.push(r[e][t]);u.push(o)}return u}module.exports=function(i,u,o){var a=Array.isArray(i)?r(i):i.size();if(u<0||u>=a.length)throw new t(u,a.length);return e(i)?i.create(n(i.valueOf(),u,o)):n(i,u,o)};
},{"../array":"j2lF","../collection/isMatrix":"gfmG","../../error/IndexError":"tfOV"}],"m4c0":[function(require,module,exports) {
"use strict";var r=require("./isMatrix");module.exports=function(e){return Array.isArray(e)||r(e)};
},{"./isMatrix":"gfmG"}],"UGDC":[function(require,module,exports) {
"use strict";var r=require("./isCollection");module.exports=function(e){for(var t=0;t<e.length;t++)if(r(e[t]))return!0;return!1};
},{"./isCollection":"m4c0"}],"lOhJ":[function(require,module,exports) {
"use strict";function e(e,t,n,r){var a=n(require("../../utils/typeof"));return function(e,t,n){var r;return-1!==String(e).indexOf("Unexpected type")?(r=arguments.length>2?" (type: "+a(n)+", value: "+JSON.stringify(n)+")":" (type: "+e.data.actual+")",new TypeError("Cannot calculate "+t+", unexpected type of argument"+r)):-1!==String(e).indexOf("complex numbers")?(r=arguments.length>2?" (type: "+a(n)+", value: "+JSON.stringify(n)+")":"",new TypeError("Cannot calculate "+t+", no ordering relation is defined for complex numbers"+r)):e}}exports.factory=e;
},{"../../utils/typeof":"LZTG"}],"US8O":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepForEach"),e=require("../../utils/collection/reduce"),t=require("../../utils/collection/containsCollections");function a(a,n,o,i){var u=o(require("../relational/larger")),c=o(require("./utils/improveErrorMessage")),l=i("max",{"Array | Matrix":f,"Array | Matrix, number | BigNumber":function(r,t){return e(r,t.valueOf(),s)},"...":function(r){if(t(r))throw new TypeError("Scalar values expected in function max");return f(r)}});return l.toTex="\\max\\left(${args}\\right)",l;function s(r,e){try{return u(r,e)?r:e}catch(t){throw c(t,"max",e)}}function f(e){var t;if(r(e,function(r){try{isNaN(r)&&"number"==typeof r?t=NaN:(void 0===t||u(r,t))&&(t=r)}catch(e){throw c(e,"max",r)}}),void 0===t)throw new Error("Cannot calculate max of an empty array");return t}}exports.name="max",exports.factory=a;
},{"../../utils/collection/deepForEach":"Uh7d","../../utils/collection/reduce":"tjrJ","../../utils/collection/containsCollections":"UGDC","../relational/larger":"SrDl","./utils/improveErrorMessage":"lOhJ"}],"yVQR":[function(require,module,exports) {
"use strict";var r=require("../../utils/array"),e=require("../../utils/latex"),t=require("../../utils/string");function i(i,a,s,u){var o=s(require("../arithmetic/abs")),n=s(require("../arithmetic/add")),c=s(require("../arithmetic/multiply")),m=s(require("../arithmetic/sqrt")),q=s(require("../arithmetic/subtract")),h=s(require("../matrix/inv")),x=s(require("../matrix/size")),f=s(require("../statistics/max")),l=s(require("./identity")),w=u("sqrtm",{"Array | Matrix":function(e){var a=i.isMatrix(e)?e.size():r.size(e);switch(a.length){case 1:if(1===a[0])return m(e);throw new RangeError("Matrix must be square (size: "+t.format(a)+")");case 2:if(a[0]===a[1])return d(e);throw new RangeError("Matrix must be square (size: "+t.format(a)+")")}}}),v=1e3,g=1e-6;function d(r){var e,t=0,i=r,a=l(x(r));do{var s=i;if(i=c(.5,n(s,h(a))),a=c(.5,n(a,h(s))),(e=f(o(q(i,s))))>g&&++t>v)throw new Error("computing square root of matrix: iterative method could not converge")}while(e>g);return i}return w.toTex={1:"{${args[0]}}".concat(e.operators.pow,"{\\frac{1}{2}}")},w}exports.name="sqrtm",exports.factory=i;
},{"../../utils/array":"j2lF","../../utils/latex":"H1Mr","../../utils/string":"PshC","../arithmetic/abs":"K5X1","../arithmetic/add":"zf2Z","../arithmetic/multiply":"k7By","../arithmetic/sqrt":"T6pB","../arithmetic/subtract":"m78R","../matrix/inv":"yHuZ","../matrix/size":"OqDc","../statistics/max":"US8O","./identity":"zJUT"}],"c5o7":[function(require,module,exports) {
"use strict";var r=require("../../utils/object"),e=require("../../utils/array");function t(t,u,n,i){var a=n(require("../../type/matrix/function/matrix")),o=i("squeeze",{Array:function(t){return e.squeeze(r.clone(t))},Matrix:function(r){var t=e.squeeze(r.toArray());return Array.isArray(t)?a(t):t},any:function(e){return r.clone(e)}});return o.toTex=void 0,o}exports.name="squeeze",exports.factory=t;
},{"../../utils/object":"FcSp","../../utils/array":"j2lF","../../type/matrix/function/matrix":"vzj5"}],"YmDd":[function(require,module,exports) {
"use strict";var r=require("../../utils/object").clone,e=require("../../utils/string").format;function t(t,a,i,n){var s=i(require("../../type/matrix/function/matrix")),u=i(require("../arithmetic/add")),o=n("trace",{Array:function(r){return f(s(r))},SparseMatrix:function(r){var t=r._values,a=r._index,i=r._ptr,n=r._size,s=n[0],o=n[1];if(s===o){var f=0;if(t.length>0)for(var c=0;c<o;c++)for(var m=i[c],x=i[c+1],v=m;v<x;v++){var h=a[v];if(h===c){f=u(f,t[v]);break}if(h>c)break}return f}throw new RangeError("Matrix must be square (size: "+e(n)+")")},DenseMatrix:f,any:r});function f(t){var a=t._size,i=t._data;switch(a.length){case 1:if(1===a[0])return r(i[0]);throw new RangeError("Matrix must be square (size: "+e(a)+")");case 2:var n=a[0];if(n===a[1]){for(var s=0,o=0;o<n;o++)s=u(s,i[o][o]);return s}throw new RangeError("Matrix must be square (size: "+e(a)+")");default:throw new RangeError("Matrix must be two dimensional (size: "+e(a)+")")}}return o.toTex={1:"\\mathrm{tr}\\left(${args[0]}\\right)"},o}exports.name="trace",exports.factory=t;
},{"../../utils/object":"FcSp","../../utils/string":"PshC","../../type/matrix/function/matrix":"vzj5","../arithmetic/add":"zf2Z"}],"CPKp":[function(require,module,exports) {
"use strict";function t(t,r,e,a){var i=e(require("../../type/matrix/utils/getArrayDataType"));return a("getMatrixDataType",{Array:function(t){return i(t)},Matrix:function(t){return t.getDataType()}})}exports.name="getMatrixDataType",exports.factory=t;
},{"../../type/matrix/utils/getArrayDataType":"XmtI"}],"X3kh":[function(require,module,exports) {
"use strict";module.exports=[require("./apply"),require("./column"),require("./concat"),require("./cross"),require("./ctranspose"),require("./det"),require("./diag"),require("./dot"),require("./eye"),require("./expm"),require("./filter"),require("./flatten"),require("./forEach"),require("./identity"),require("./inv"),require("./kron"),require("./map"),require("./ones"),require("./partitionSelect"),require("./range"),require("./reshape"),require("./resize"),require("./row"),require("./size"),require("./sort"),require("./sqrtm"),require("./squeeze"),require("./subset"),require("./trace"),require("./transpose"),require("./zeros"),require("./getMatrixDataType")];
},{"./apply":"f9k3","./column":"g7VB","./concat":"LXdZ","./cross":"GWq7","./ctranspose":"pnEY","./det":"KApf","./diag":"JNTV","./dot":"unxK","./eye":"pW27","./expm":"XFhy","./filter":"QC1r","./flatten":"KNrk","./forEach":"dOnH","./identity":"zJUT","./inv":"yHuZ","./kron":"g4K8","./map":"dcuN","./ones":"dmcR","./partitionSelect":"kE3o","./range":"lueR","./reshape":"BrQj","./resize":"pwUu","./row":"eLyh","./size":"OqDc","./sort":"roN2","./sqrtm":"yVQR","./squeeze":"c5o7","./subset":"ZWbZ","./trace":"YmDd","./transpose":"C2z0","./zeros":"BAjv","./getMatrixDataType":"CPKp"}],"y9hQ":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepForEach"),e=require("../../utils/collection/reduce"),t=require("../../utils/collection/containsCollections");function i(i,u,n,c){var o=n(require("../arithmetic/addScalar")),a=n(require("./utils/improveErrorMessage")),s=c("sum",{"Array | Matrix":l,"Array | Matrix, number | BigNumber":function(r,t){try{var i=e(r,t,o);return i}catch(u){throw a(u,"sum")}},"...":function(r){if(t(r))throw new TypeError("Scalar values expected in function sum");return l(r)}});return s.toTex=void 0,s;function l(e){var t;if(r(e,function(r){try{t=void 0===t?r:o(t,r)}catch(e){throw a(e,"sum",r)}}),void 0===t)switch(u.number){case"number":return 0;case"BigNumber":return new i.BigNumber(0);case"Fraction":return new i.Fraction(0);default:return 0}return t}}exports.name="sum",exports.factory=i;
},{"../../utils/collection/deepForEach":"Uh7d","../../utils/collection/reduce":"tjrJ","../../utils/collection/containsCollections":"UGDC","../arithmetic/addScalar":"ZM3O","./utils/improveErrorMessage":"lOhJ"}],"CGIk":[function(require,module,exports) {
"use strict";function r(r,e,t,i){var n=t(require("../../type/matrix/function/matrix")),o=t(require("../arithmetic/divide")),u=t(require("../statistics/sum")),s=t(require("../arithmetic/multiply")),a=t(require("../arithmetic/dotDivide")),c=t(require("../arithmetic/log")),m=t(require("../utils/isNumeric"));function f(r,e){var t=e.size().length,i=r.size().length;if(t>1)throw new Error("first object must be one dimensional");if(i>1)throw new Error("second object must be one dimensional");if(t!==i)throw new Error("Length of two vectors must be equal");if(0===u(r))throw new Error("Sum of elements in first object must be non zero");if(0===u(e))throw new Error("Sum of elements in second object must be non zero");var n=o(r,u(r)),f=o(e,u(e)),l=u(s(n,c(a(n,f))));return m(l)?l:Number.NaN}return i("kldivergence",{"Array, Array":function(r,e){return f(n(r),n(e))},"Matrix, Array":function(r,e){return f(r,n(e))},"Array, Matrix":function(r,e){return f(n(r),e)},"Matrix, Matrix":function(r,e){return f(r,e)}})}exports.name="kldivergence",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","../arithmetic/divide":"lVgQ","../statistics/sum":"y9hQ","../arithmetic/multiply":"k7By","../arithmetic/dotDivide":"JrX5","../arithmetic/log":"T05K","../utils/isNumeric":"Rv38"}],"kuKA":[function(require,module,exports) {
"use strict";var i=require("../../utils/collection/deepForEach");function r(r,e,t,u){var a=t(require("../arithmetic/add")),n=t(require("../arithmetic/multiply")),o=t(require("../arithmetic/divide")),l=t(require("../probability/factorial")),c=t(require("../utils/isInteger")),m=t(require("../utils/isPositive"));return u("multinomial",{"Array | Matrix":function(r){var e=0,t=1;return i(r,function(i){if(!c(i)||!m(i))throw new TypeError("Positive integer value expected in function multinomial");e=a(e,i),t=n(t,l(i))}),o(l(e),t)}})}exports.name="multinomial",exports.factory=r;
},{"../../utils/collection/deepForEach":"Uh7d","../arithmetic/add":"zf2Z","../arithmetic/multiply":"k7By","../arithmetic/divide":"lVgQ","../probability/factorial":"yidz","../utils/isInteger":"qG7X","../utils/isPositive":"OFKG"}],"IUt2":[function(require,module,exports) {
"use strict";var e=require("../../utils/number").isInteger;function r(r,n,i,u){var o=i(require("./factorial")),s=require("./product"),a=u("permutations",{"number | BigNumber":o,"number, number":function(r,t){if(!e(r)||r<0)throw new TypeError("Positive integer value expected in function permutations");if(!e(t)||t<0)throw new TypeError("Positive integer value expected in function permutations");if(t>r)throw new TypeError("second argument k must be less than or equal to first argument n");return s(r-t+1,r)},"BigNumber, BigNumber":function(e,n){var i,u;if(!t(e)||!t(n))throw new TypeError("Positive integer value expected in function permutations");if(n.gt(e))throw new TypeError("second argument k must be less than or equal to first argument n");for(i=new r.BigNumber(1),u=e.minus(n).plus(1);u.lte(e);u=u.plus(1))i=i.times(u);return i}});return a.toTex=void 0,a}function t(e){return e.isInteger()&&e.gte(0)}exports.name="permutations",exports.factory=r;
},{"../../utils/number":"uqMu","./factorial":"yidz","./product":"FONy"}],"JPVl":[function(require,module,exports) {
var global = arguments[3];
var r=arguments[3],n=256,t=6,o=52,a=[],e=void 0===r?window:r,u=Math.pow(n,t),i=Math.pow(2,o),f=2*i,l=n-1,c=Math.random;function h(r){var t,o=r.length,a=this,e=0,u=a.i=a.j=0,i=a.S=[];for(o||(r=[o++]);e<n;)i[e]=e++;for(e=0;e<n;e++)i[e]=i[u=l&u+r[e%o]+(t=i[e])],i[u]=t;(a.g=function(r){for(var t,o=0,e=a.i,u=a.j,i=a.S;r--;)t=i[e=l&e+1],o=o*n+i[l&(i[e]=i[u=l&u+t])+(i[u]=t)];return a.i=e,a.j=u,o})(n)}function g(r,n){var t,o=[],a=(typeof r)[0];if(n&&"o"==a)for(t in r)try{o.push(g(r[t],n-1))}catch(e){}return o.length?o:"s"==a?r:r+"\0"}function d(r,n){for(var t,o=r+"",a=0;a<o.length;)n[l&a]=l&(t^=19*n[l&a])+o.charCodeAt(a++);return m(n)}function p(r){try{return e.crypto.getRandomValues(r=new Uint8Array(n)),m(r)}catch(t){return[+new Date,e,e.navigator&&e.navigator.plugins,e.screen,m(a)]}}function m(r){return String.fromCharCode.apply(0,r)}module.exports=function(r,o){if(o&&!0===o.global)return o.global=!1,Math.random=module.exports(r,o),o.global=!0,Math.random;var e=[],l=(d(g(o&&o.entropy||!1?[r,m(a)]:0 in arguments?r:p(),3),e),new h(e));return d(m(l.S),a),function(){for(var r=l.g(t),o=u,a=0;r<i;)r=(r+a)*n,o*=n,a=l.g(1);for(;r>=f;)r/=2,o/=2,a>>>=1;return(r+a)/o}},module.exports.resetGlobal=function(){Math.random=c},d(Math.random(),a);
},{}],"qBYF":[function(require,module,exports) {
"use strict";var n=require("seed-random"),r=n();function e(e,o,t,d,i){var u;function a(e){u=null===e?r:n(String(e))}return a(o.randomSeed),i.on("config",function(n,r,e){void 0!==e.randomSeed&&a(n.randomSeed)}),function(){return u()}}exports.factory=e,exports.math=!0;
},{"seed-random":"JPVl"}],"pAyZ":[function(require,module,exports) {
"use strict";var r=require("../../error/ArgumentsError"),n=require("../../utils/collection/isCollection"),e=require("../../utils/number").isNumber;function t(t,i,o,a,u){var f=o(require("../../type/matrix/function/matrix")),s=require("../../utils/array"),l=o(require("./seededRNG"));function v(i){if(!h.hasOwnProperty(i))throw new Error("Unknown distribution "+i);var o=Array.prototype.slice.call(arguments,1);return function(i){function o(r,n,i){var o=void 0===n;if(o&&(n=1),t.isMatrix(r))r=r.valueOf();else if(!Array.isArray(r))throw new TypeError("Unsupported type of value in function pickRandom");if(s.size(r).length>1)throw new Error("Only one dimensional vectors supported");var a=0;if(void 0!==i){if(i.length!==r.length)throw new Error("Weights must have the same length as possibles");for(var u=0,f=i.length;u<f;u++){if(!e(i[u])||i[u]<0)throw new Error("Weights must be an array of positive numbers");a+=i[u]}}var v=r.length;if(0===v)return[];if(n>=v)return n>1?r:r[0];for(var h,c=[];c.length<n;){if(void 0===i)h=r[Math.floor(l()*v)];else for(var m=l()*a,y=0,d=r.length;y<d;y++)if((m-=i[y])<0){h=r[y];break}-1===c.indexOf(h)&&c.push(h)}return o?c[0]:c}function u(r,n){return r+i()*(n-r)}function v(r,n){return Math.floor(r+i()*(n-r))}function h(r,n,e,t){var i=[];if((r=r.slice(0)).length>1)for(var o=0,a=r.shift();o<a;o++)i.push(h(r,n,e,t));else for(var u=0,f=r.shift();u<f;u++)i.push(t(n,e));return i}return{random:function(i,o,a){var s,l,v;if(arguments.length>3)throw new r("random",arguments.length,0,3);if(1===arguments.length?n(i)?s=i:v=i:2===arguments.length?n(i)?(s=i,v=o):(l=i,v=o):(s=i,l=o,v=a),void 0!==l&&!e(l)||void 0!==v&&!e(v))throw new TypeError("Invalid argument in function random");if(void 0===v&&(v=1),void 0===l&&(l=0),void 0!==s){var c=h(s.valueOf(),l,v,u);return t.isMatrix(s)?f(c):c}return u(l,v)},randomInt:a({"number | Array":function(r){if(n(r)){var e=r,i=h(e.valueOf(),0,1,v);return t.isMatrix(e)?f(i):i}return v(0,r)},"number | Array, number":function(r,e){if(n(r)){var i=r,o=e,a=h(i.valueOf(),0,o,v);return t.isMatrix(i)?f(a):a}return v(r,e)},"Array, number, number":function(r,n,e){var t=h(r.valueOf(),n,e,v);return r&&!0===r.isMatrix?f(t):t}}),pickRandom:a({Array:function(r){return o(r)},"Array, number | Array":function(r,n){var t,i;if(Array.isArray(n))i=n;else{if(!e(n))throw new TypeError("Invalid argument in function pickRandom");t=n}return o(r,t,i)},"Array, number | Array, Array | number":function(r,n,t){var i,a;if(Array.isArray(n)?(a=n,i=t):(a=t,i=n),!Array.isArray(a)||!e(i))throw new TypeError("Invalid argument in function pickRandom");return o(r,i,a)}})}}(h[i].apply(this,o))}var h={uniform:function(){return l},normal:function(){return function(){for(var r,n,e=-1;e<0||e>1;)r=l(),n=l(),e=1/6*Math.pow(-2*Math.log(r),.5)*Math.cos(2*Math.PI*n)+.5;return e}}};return v.toTex=void 0,v}exports.name="distribution",exports.factory=t;
},{"../../error/ArgumentsError":"h0xI","../../utils/collection/isCollection":"m4c0","../../utils/number":"uqMu","../../type/matrix/function/matrix":"vzj5","../../utils/array":"j2lF","./seededRNG":"qBYF"}],"JMJP":[function(require,module,exports) {
"use strict";function r(r,i,o,t){var e=o(require("./distribution"))("uniform").pickRandom;return e.toTex=void 0,e}exports.name="pickRandom",exports.factory=r;
},{"./distribution":"pAyZ"}],"YT9V":[function(require,module,exports) {
"use strict";function r(r,o,t,e){var i=t(require("./distribution"))("uniform").random;return i.toTex=void 0,i}exports.name="random",exports.factory=r;
},{"./distribution":"pAyZ"}],"Zogd":[function(require,module,exports) {
"use strict";function r(r,t,n,o){var e=n(require("./distribution"))("uniform").randomInt;return e.toTex=void 0,e}exports.name="randomInt",exports.factory=r;
},{"./distribution":"pAyZ"}],"xCRU":[function(require,module,exports) {
"use strict";module.exports=[require("./combinations"),require("./factorial"),require("./gamma"),require("./kldivergence"),require("./multinomial"),require("./permutations"),require("./pickRandom"),require("./random"),require("./randomInt")];
},{"./combinations":"n9b2","./factorial":"yidz","./gamma":"ciea","./kldivergence":"CGIk","./multinomial":"kuKA","./permutations":"IUt2","./pickRandom":"JMJP","./random":"YT9V","./randomInt":"Zogd"}],"eVLO":[function(require,module,exports) {
"use strict";function r(r,t,e,n){var i=e(require("../../type/matrix/function/matrix")),a=e(require("../utils/typeof")),u=e(require("../../type/matrix/utils/algorithm13")),o=e(require("../../type/matrix/utils/algorithm14")),c=n("compareText",{"any, any":x,"DenseMatrix, DenseMatrix":function(r,t){return u(r,t,x)},"Array, Array":function(r,t){return c(i(r),i(t)).valueOf()},"Array, Matrix":function(r,t){return c(i(r),t)},"Matrix, Array":function(r,t){return c(r,i(t))},"DenseMatrix, any":function(r,t){return o(r,t,x,!1)},"any, DenseMatrix":function(r,t){return o(t,r,x,!0)},"Array, any":function(r,t){return o(i(r),t,x,!1).valueOf()},"any, Array":function(r,t){return o(i(t),r,x,!0).valueOf()}});function x(t,e){if(!r.isString(t))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+a(t)+", index: 0)");if(!r.isString(e))throw new TypeError("Unexpected type of argument in function compareText (expected: string or Array or Matrix, actual: "+a(e)+", index: 1)");return t===e?0:t>e?1:-1}return c.toTex=void 0,c}exports.name="compareText",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","../utils/typeof":"LZTG","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"qExK":[function(require,module,exports) {
"use strict";function r(r,e,a,n){var t=a(require("./equal")),u=n("deepEqual",{"any, any":function(r,e){return function r(e,a){if(Array.isArray(e)){if(Array.isArray(a)){var n=e.length;if(n!==a.length)return!1;for(var u=0;u<n;u++)if(!r(e[u],a[u]))return!1;return!0}return!1}return!Array.isArray(a)&&t(e,a)}(r.valueOf(),e.valueOf())}});return u.toTex=void 0,u}exports.name="deepEqual",exports.factory=r;
},{"./equal":"IviB"}],"c7Nt":[function(require,module,exports) {
"use strict";function e(e,r,t,u){var n=t(require("./compareText")),o=t(require("../utils/isZero")),a=u("equalText",{"any, any":function(e,r){return o(n(e,r))}});return a.toTex=void 0,a}exports.name="equalText",exports.factory=e;
},{"./compareText":"eVLO","../utils/isZero":"geyZ"}],"IR2w":[function(require,module,exports) {
"use strict";module.exports=[require("./compare"),require("./compareNatural"),require("./compareText"),require("./deepEqual"),require("./equal"),require("./equalText"),require("./larger"),require("./largerEq"),require("./smaller"),require("./smallerEq"),require("./unequal")];
},{"./compare":"yGce","./compareNatural":"ljuJ","./compareText":"eVLO","./deepEqual":"qExK","./equal":"IviB","./equalText":"c7Nt","./larger":"SrDl","./largerEq":"d923","./smaller":"Q7ag","./smallerEq":"rN68","./unequal":"npE3"}],"UZAG":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function a(a,e,t,i){var s=t(require("../../type/matrix/MatrixIndex")),n=t(require("../../type/matrix/DenseMatrix")),y=t(require("../matrix/size")),u=t(require("../matrix/subset")),o=t(require("../relational/compareNatural"));return i("setCartesian",{"Array | Matrix, Array | Matrix":function(a,e){var t=[];if(0!==u(y(a),new s(0))&&0!==u(y(e),new s(0))){var i=r(Array.isArray(a)?a:a.toArray()).sort(o),A=r(Array.isArray(e)?e:e.toArray()).sort(o);t=[];for(var x=0;x<i.length;x++)for(var f=0;f<A.length;f++)t.push([i[x],A[f]])}return Array.isArray(a)&&Array.isArray(e)?t:new n(t)}})}exports.name="setCartesian",exports.factory=a;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../../type/matrix/DenseMatrix":"bZ8L","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../relational/compareNatural":"ljuJ"}],"wktc":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten,e=require("../../utils/array").identify,a=require("../../utils/array").generalize;function i(i,t,n,u){var s=n(require("../../type/matrix/MatrixIndex")),y=n(require("../../type/matrix/DenseMatrix")),f=n(require("../matrix/size")),o=n(require("../matrix/subset")),l=n(require("../relational/compareNatural"));return u("setDifference",{"Array | Matrix, Array | Matrix":function(i,t){var n;if(0===o(f(i),new s(0)))n=[];else{if(0===o(f(t),new s(0)))return r(i.toArray());var u,A=e(r(Array.isArray(i)?i:i.toArray()).sort(l)),x=e(r(Array.isArray(t)?t:t.toArray()).sort(l));n=[];for(var q=0;q<A.length;q++){u=!1;for(var v=0;v<x.length;v++)if(0===l(A[q].value,x[v].value)&&A[q].identifier===x[v].identifier){u=!0;break}u||n.push(A[q])}}return Array.isArray(i)&&Array.isArray(t)?a(n):new y(a(n))}})}exports.name="setDifference",exports.factory=i;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../../type/matrix/DenseMatrix":"bZ8L","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../relational/compareNatural":"ljuJ"}],"mVYy":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function e(e,t,a,i){var s=a(require("../../type/matrix/MatrixIndex")),n=a(require("../../type/matrix/DenseMatrix")),u=a(require("../matrix/size")),o=a(require("../matrix/subset")),x=a(require("../relational/compareNatural"));return i("setDistinct",{"Array | Matrix":function(e){var t;if(0===o(u(e),new s(0)))t=[];else{var a=r(Array.isArray(e)?e:e.toArray()).sort(x);(t=[]).push(a[0]);for(var i=1;i<a.length;i++)0!==x(a[i],a[i-1])&&t.push(a[i])}return Array.isArray(e)?t:new n(t)}})}exports.name="setDistinct",exports.factory=e;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../../type/matrix/DenseMatrix":"bZ8L","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../relational/compareNatural":"ljuJ"}],"XVUf":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten,e=require("../../utils/array").identify,a=require("../../utils/array").generalize;function t(t,i,s,n){var u=s(require("../../type/matrix/MatrixIndex")),y=s(require("../../type/matrix/DenseMatrix")),l=s(require("../matrix/size")),o=s(require("../matrix/subset")),A=s(require("../relational/compareNatural"));return n("setIntersect",{"Array | Matrix, Array | Matrix":function(t,i){var s;if(0===o(l(t),new u(0))||0===o(l(i),new u(0)))s=[];else{var n=e(r(Array.isArray(t)?t:t.toArray()).sort(A)),f=e(r(Array.isArray(i)?i:i.toArray()).sort(A));s=[];for(var x=0;x<n.length;x++)for(var q=0;q<f.length;q++)if(0===A(n[x].value,f[q].value)&&n[x].identifier===f[q].identifier){s.push(n[x]);break}}return Array.isArray(t)&&Array.isArray(i)?a(s):new y(a(s))}})}exports.name="setIntersect",exports.factory=t;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../../type/matrix/DenseMatrix":"bZ8L","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../relational/compareNatural":"ljuJ"}],"EFhD":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten,e=require("../../utils/array").identify;function t(t,a,i,u){var n=i(require("../../type/matrix/MatrixIndex")),s=i(require("../matrix/size")),f=i(require("../matrix/subset")),o=i(require("../relational/compareNatural"));return u("setIsSubset",{"Array | Matrix, Array | Matrix":function(t,a){if(0===f(s(t),new n(0)))return!0;if(0===f(s(a),new n(0)))return!1;for(var i,u=e(r(Array.isArray(t)?t:t.toArray()).sort(o)),y=e(r(Array.isArray(a)?a:a.toArray()).sort(o)),l=0;l<u.length;l++){i=!1;for(var x=0;x<y.length;x++)if(0===o(u[l].value,y[x].value)&&u[l].identifier===y[x].identifier){i=!0;break}if(!1===i)return!1}return!0}})}exports.name="setIsSubset",exports.factory=t;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../relational/compareNatural":"ljuJ"}],"B2m3":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function e(e,t,i,a){var u=i(require("../relational/compareNatural")),n=i(require("../../type/matrix/MatrixIndex")),l=i(require("../matrix/size")),o=i(require("../matrix/subset"));return a("setMultiplicity",{"number | BigNumber | Fraction | Complex, Array | Matrix":function(e,t){if(0===o(l(t),new n(0)))return 0;for(var i=r(Array.isArray(t)?t:t.toArray()),a=0,s=0;s<i.length;s++)0===u(i[s],e)&&a++;return a}})}exports.name="setMultiplicity",exports.factory=e;
},{"../../utils/array":"j2lF","../relational/compareNatural":"ljuJ","../../type/matrix/MatrixIndex":"SL3U","../matrix/size":"OqDc","../matrix/subset":"ZWbZ"}],"RB1b":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function t(t,e,n,a){var i=n(require("../../type/matrix/MatrixIndex")),u=n(require("../matrix/size")),o=n(require("../matrix/subset")),s=n(require("../relational/compareNatural"));return a("setPowerset",{"Array | Matrix":function(t){if(0===o(u(t),new i(0)))return[];for(var e=r(Array.isArray(t)?t:t.toArray()).sort(s),n=[],a=0;a.toString(2).length<=e.length;)n.push(l(e,a.toString(2).split("").reverse())),a++;return function(r){for(var t=[],e=r.length-1;e>0;e--)for(var n=0;n<e;n++)r[n].length>r[n+1].length&&(t=r[n],r[n]=r[n+1],r[n+1]=t);return r}(n)}});function l(r,t){for(var e=[],n=0;n<t.length;n++)"1"===t[n]&&e.push(r[n]);return e}}exports.name="setPowerset",exports.factory=t;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../relational/compareNatural":"ljuJ"}],"St3b":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function t(t,a,e,n){var i=e(require("../relational/compareNatural"));return n("setSize",{"Array | Matrix":function(t){return Array.isArray(t)?r(t).length:r(t.toArray()).length},"Array | Matrix, boolean":function(t,a){if(!1===a||0===t.length)return Array.isArray(t)?r(t).length:r(t.toArray()).length;for(var e=r(Array.isArray(t)?t:t.toArray()).sort(i),n=1,o=1;o<e.length;o++)0!==i(e[o],e[o-1])&&n++;return n}})}exports.name="setSize",exports.factory=t;
},{"../../utils/array":"j2lF","../relational/compareNatural":"ljuJ"}],"XYAW":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function e(e,t,i,a){var n=i(require("../../type/matrix/MatrixIndex")),u=i(require("../matrix/concat")),f=i(require("../matrix/size")),s=i(require("../matrix/subset")),x=i(require("../set/setDifference"));return a("setSymDifference",{"Array | Matrix, Array | Matrix":function(e,t){if(0===s(f(e),new n(0)))return r(t);if(0===s(f(t),new n(0)))return r(e);var i=r(e),a=r(t);return u(x(i,a),x(a,i))}})}exports.name="setSymDifference",exports.factory=e;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../matrix/concat":"LXdZ","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../set/setDifference":"wktc"}],"LJzh":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function e(e,t,i,n){var a=i(require("../../type/matrix/MatrixIndex")),u=i(require("../matrix/concat")),s=i(require("../matrix/size")),x=i(require("../matrix/subset")),c=i(require("../set/setIntersect")),f=i(require("../set/setSymDifference"));return n("setUnion",{"Array | Matrix, Array | Matrix":function(e,t){if(0===x(s(e),new a(0)))return r(t);if(0===x(s(t),new a(0)))return r(e);var i=r(e),n=r(t);return u(f(i,n),c(i,n))}})}exports.name="setUnion",exports.factory=e;
},{"../../utils/array":"j2lF","../../type/matrix/MatrixIndex":"SL3U","../matrix/concat":"LXdZ","../matrix/size":"OqDc","../matrix/subset":"ZWbZ","../set/setIntersect":"XVUf","../set/setSymDifference":"XYAW"}],"O2mj":[function(require,module,exports) {
"use strict";module.exports=[require("./setCartesian"),require("./setDifference"),require("./setDistinct"),require("./setIntersect"),require("./setIsSubset"),require("./setMultiplicity"),require("./setPowerset"),require("./setSize"),require("./setSymDifference"),require("./setUnion")];
},{"./setCartesian":"UZAG","./setDifference":"wktc","./setDistinct":"mVYy","./setIntersect":"XVUf","./setIsSubset":"EFhD","./setMultiplicity":"B2m3","./setPowerset":"RB1b","./setSize":"St3b","./setSymDifference":"XYAW","./setUnion":"LJzh"}],"eibQ":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap"),e=require("../../utils/number").sign;function t(t,f,c,p){var s=p("erf",{number:function(r){var t=Math.abs(r);return t>=o?e(r):t<=n?e(r)*function(r){var e,t=r*r,n=u[0][4]*t,a=t;for(e=0;e<3;e+=1)n=(n+u[0][e])*t,a=(a+i[0][e])*t;return r*(n+u[0][3])/(a+i[0][3])}(t):t<=4?e(r)*(1-function(r){var e,t=u[1][8]*r,n=r;for(e=0;e<7;e+=1)t=(t+u[1][e])*r,n=(n+i[1][e])*r;var a=(t+u[1][7])/(n+i[1][7]),o=parseInt(16*r)/16,f=(r-o)*(r+o);return Math.exp(-o*o)*Math.exp(-f)*a}(t)):e(r)*(1-function(r){var e,t=1/(r*r),n=u[2][5]*t,o=t;for(e=0;e<4;e+=1)n=(n+u[2][e])*t,o=(o+i[2][e])*t;var f=t*(n+u[2][4])/(o+i[2][4]);f=(a-f)/r,t=parseInt(16*r)/16;var c=(r-t)*(r+t);return Math.exp(-t*t)*Math.exp(-c)*f}(t))},BigNumber:function(r){return new t.BigNumber(s(r.toNumber()))},"Array | Matrix":function(e){return r(e,s)}});return s.toTex={1:"erf\\left(${args[0]}\\right)"},s}var n=.46875,a=.5641895835477563,u=[[3.1611237438705655,113.86415415105016,377.485237685302,3209.3775891384694,.18577770618460315],[.5641884969886701,8.883149794388377,66.11919063714163,298.6351381974001,881.952221241769,1712.0476126340707,2051.0783778260716,1230.3393547979972,2.1531153547440383e-8],[.30532663496123236,.36034489994980445,.12578172611122926,.016083785148742275,.0006587491615298378,.016315387137302097]],i=[[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]],o=Math.pow(2,53);exports.name="erf",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo","../../utils/number":"uqMu"}],"JuUL":[function(require,module,exports) {
"use strict";module.exports=[require("./erf")];
},{"./erf":"eibQ"}],"LcS3":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten,e=require("../../utils/collection/containsCollections");function t(t,i,n,a){var o=n(require("../arithmetic/addScalar")),u=n(require("../arithmetic/divideScalar")),c=n(require("../relational/compare")),m=n(require("../matrix/partitionSelect")),l=n(require("./utils/improveErrorMessage")),f=a("median",{"Array | Matrix":d,"Array | Matrix, number | BigNumber":function(r,e){throw new Error("median(A, dim) is not yet supported")},"...":function(r){if(e(r))throw new TypeError("Scalar values expected in function median");return d(r)}});function d(e){try{var t=(e=r(e.valueOf())).length;if(0===t)throw new Error("Cannot calculate median of an empty array");if(t%2==0){for(var i=t/2-1,n=m(e,i+1),a=e[i],o=0;o<i;++o)c(e[o],a)>0&&(a=e[o]);return p(a,n)}var u=m(e,(t-1)/2);return s(u)}catch(f){throw l(f,"median")}}var s=a({"number | BigNumber | Complex | Unit":function(r){return r}}),p=a({"number | BigNumber | Complex | Unit, number | BigNumber | Complex | Unit":function(r,e){return u(o(r,e),2)}});return f.toTex=void 0,f}exports.name="median",exports.factory=t;
},{"../../utils/array":"j2lF","../../utils/collection/containsCollections":"UGDC","../arithmetic/addScalar":"ZM3O","../arithmetic/divideScalar":"R3aq","../relational/compare":"yGce","../matrix/partitionSelect":"kE3o","./utils/improveErrorMessage":"lOhJ"}],"Je7I":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function e(e,a,t,i){var n=t(require("../arithmetic/abs")),o=t(require("../matrix/map")),u=t(require("../statistics/median")),s=t(require("../arithmetic/subtract")),m=t(require("./utils/improveErrorMessage")),c=i("mad",{"Array | Matrix":d,"...":function(r){return d(r)}});return c.toTex=void 0,c;function d(e){if(0===(e=r(e.valueOf())).length)throw new Error("Cannot calculate median absolute deviation (mad) of an empty array");try{var a=u(e);return u(o(e,function(r){return n(s(r,a))}))}catch(t){throw t instanceof TypeError&&-1!==t.message.indexOf("median")?new TypeError(t.message.replace("median","mad")):m(t,"mad")}}}exports.name="mad",exports.factory=e;
},{"../../utils/array":"j2lF","../arithmetic/abs":"K5X1","../matrix/map":"dcuN","../statistics/median":"LcS3","../arithmetic/subtract":"m78R","./utils/improveErrorMessage":"lOhJ"}],"WyK1":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").size,e=require("../../utils/collection/deepForEach"),t=require("../../utils/collection/reduce"),i=require("../../utils/collection/containsCollections");function a(a,n,o,c){var u=o(require("../arithmetic/add")),l=o(require("../arithmetic/divide")),s=o(require("./utils/improveErrorMessage")),m=c("mean",{"Array | Matrix":y,"Array | Matrix, number | BigNumber":function(e,i){try{var a=t(e,i,u),n=Array.isArray(e)?r(e):e.size();return l(a,n[i])}catch(o){throw s(o,"mean")}},"...":function(r){if(i(r))throw new TypeError("Scalar values expected in function mean");return y(r)}});return m.toTex=void 0,m;function y(r){var t=0,i=0;if(e(r,function(r){try{t=u(t,r),i++}catch(e){throw s(e,"mean",r)}}),0===i)throw new Error("Cannot calculate mean of an empty array");return l(t,i)}}exports.name="mean",exports.factory=a;
},{"../../utils/array":"j2lF","../../utils/collection/deepForEach":"Uh7d","../../utils/collection/reduce":"tjrJ","../../utils/collection/containsCollections":"UGDC","../arithmetic/add":"zf2Z","../arithmetic/divide":"lVgQ","./utils/improveErrorMessage":"lOhJ"}],"VKqc":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepForEach"),e=require("../../utils/collection/reduce"),t=require("../../utils/collection/containsCollections");function n(n,i,o,a){var u=o(require("../relational/smaller")),c=o(require("./utils/improveErrorMessage")),l=a("min",{"Array | Matrix":f,"Array | Matrix, number | BigNumber":function(r,t){return e(r,t.valueOf(),s)},"...":function(r){if(t(r))throw new TypeError("Scalar values expected in function min");return f(r)}});return l.toTex="\\min\\left(${args}\\right)",l;function s(r,e){try{return u(r,e)?r:e}catch(t){throw c(t,"min",e)}}function f(e){var t;if(r(e,function(r){try{isNaN(r)&&"number"==typeof r?t=NaN:(void 0===t||u(r,t))&&(t=r)}catch(e){throw c(e,"min",r)}}),void 0===t)throw new Error("Cannot calculate min of an empty array");return t}}exports.name="min",exports.factory=n;
},{"../../utils/collection/deepForEach":"Uh7d","../../utils/collection/reduce":"tjrJ","../../utils/collection/containsCollections":"UGDC","../relational/smaller":"Q7ag","./utils/improveErrorMessage":"lOhJ"}],"DTxj":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").flatten;function a(a,e,t,n){var o=t(require("../utils/isNaN")),i=t(require("../utils/isNumeric"));return n("mode",{"Array | Matrix":u,"...":function(r){return u(r)}});function u(a){if(0===(a=r(a.valueOf())).length)throw new Error("Cannot calculate mode of an empty array");for(var e={},t=[],n=0,u=0;u<a.length;u++){var l=a[u];if(i(l)&&o(l))throw new Error("Cannot calculate mode of an array containing NaN values");l in e||(e[l]=0),e[l]++,e[l]===n?t.push(l):e[l]>n&&(n=e[l],t=[l])}return t}}exports.name="mode",exports.factory=a;
},{"../../utils/array":"j2lF","../utils/isNaN":"AHex","../utils/isNumeric":"Rv38"}],"Hc7x":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepForEach");function t(t,o,e,i){var n=e(require("../arithmetic/multiplyScalar")),a=e(require("./utils/improveErrorMessage")),u=i("prod",{"Array | Matrix":c,"Array | Matrix, number | BigNumber":function(r,t){throw new Error("prod(A, dim) is not yet supported")},"...":function(r){return c(r)}});return u.toTex=void 0,u;function c(t){var o;if(r(t,function(r){try{o=void 0===o?r:n(o,r)}catch(t){throw a(t,"prod",r)}}),void 0===o)throw new Error("Cannot calculate prod of an empty array");return o}}exports.name="prod",exports.factory=t;
},{"../../utils/collection/deepForEach":"Uh7d","../arithmetic/multiplyScalar":"obRw","./utils/improveErrorMessage":"lOhJ"}],"hl2d":[function(require,module,exports) {
"use strict";var r=require("../../utils/number").isInteger,e=require("../../utils/number").isNumber,t=require("../../utils/array").flatten,n=require("../../utils/collection/isCollection");function i(i,o,u,a){var f=u(require("../arithmetic/add")),s=u(require("../arithmetic/multiply")),l=u(require("../matrix/partitionSelect")),m=u(require("../relational/compare"));function w(r,n,i){var o=t(r),u=o.length;if(0===u)throw new Error("Cannot calculate quantile of an empty sequence");if(e(n)){var a=n*(u-1),w=a%1;if(0===w){var v=i?o[a]:l(o,a);return c(v),v}var b,g,h=Math.floor(a);if(i)b=o[h],g=o[h+1];else{g=l(o,h+1),b=o[h];for(var p=0;p<h;++p)m(o[p],b)>0&&(b=o[p])}return c(b),c(g),f(s(b,1-w),s(g,w))}var q=n.times(u-1);if(q.isInteger()){q=q.toNumber();var y=i?o[q]:l(o,q);return c(y),y}var N,E,d=q.floor(),x=q.minus(d),S=d.toNumber();if(i)N=o[S],E=o[S+1];else{E=l(o,S+1),N=o[S];for(var B=0;B<S;++B)m(o[B],N)>0&&(N=o[B])}c(N),c(E);var A=new x.constructor(1);return f(s(N,A.minus(x)),s(E,x))}var c=a({"number | BigNumber | Unit":function(r){return r}});return function(t,o,u){var a,f,s;if(arguments.length<2||arguments.length>3)throw new SyntaxError("Function quantileSeq requires two or three parameters");if(n(t)){if("boolean"==typeof(u=u||!1)){if(f=t.valueOf(),e(o)){if(o<0)throw new Error("N/prob must be non-negative");if(o<=1)return w(f,o,u);if(o>1){if(!r(o))throw new Error("N must be a positive integer");var l=o+1;a=new Array(o);for(var m=0;m<o;)a[m]=w(f,++m/l,u);return a}}if(i.isBigNumber(o)){if(o.isNegative())throw new Error("N/prob must be non-negative");if(s=new o.constructor(1),o.lte(s))return new i.BigNumber(w(f,o,u));if(o.gt(s)){if(!o.isInteger())throw new Error("N must be a positive integer");var c=o.toNumber();if(c>4294967295)throw new Error("N must be less than or equal to 2^32-1, as that is the maximum length of an Array");var v=new i.BigNumber(c+1);a=new Array(c);for(var b=0;b<c;)a[b]=new i.BigNumber(w(f,new i.BigNumber(++b).div(v),u));return a}}if(Array.isArray(o)){a=new Array(o.length);for(var g=0;g<a.length;++g){var h=o[g];if(e(h)){if(h<0||h>1)throw new Error("Probability must be between 0 and 1, inclusive")}else{if(!i.isBigNumber(h))throw new TypeError("Unexpected type of argument in function quantileSeq");if(s=new h.constructor(1),h.isNegative()||h.gt(s))throw new Error("Probability must be between 0 and 1, inclusive")}a[g]=w(f,h,u)}return a}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}throw new TypeError("Unexpected type of argument in function quantileSeq")}}exports.name="quantileSeq",exports.factory=i;
},{"../../utils/number":"uqMu","../../utils/array":"j2lF","../../utils/collection/isCollection":"m4c0","../arithmetic/add":"zf2Z","../arithmetic/multiply":"k7By","../matrix/partitionSelect":"kE3o","../relational/compare":"yGce"}],"ujYK":[function(require,module,exports) {
"use strict";var r="unbiased",e=require("../../utils/collection/deepForEach");function t(t,a,i,n){var u=i(require("../matrix/apply")),o=i(require("../arithmetic/addScalar")),c=i(require("../arithmetic/subtract")),s=i(require("../arithmetic/multiplyScalar")),m=i(require("../arithmetic/divideScalar")),h=i(require("../utils/isNaN")),l=i(require("./utils/improveErrorMessage")),d=n("variance",{"Array | Matrix":function(e){return f(e,r)},"Array | Matrix, string":f,"Array | Matrix, number | BigNumber":function(e,t){return v(e,t,r)},"Array | Matrix, number | BigNumber, string":v,"...":function(e){return f(e,r)}});return d.toTex="\\mathrm{Var}\\left(${args}\\right)",d;function f(r,a){var i=0,n=0;if(0===r.length)throw new SyntaxError("Function var requires one or more parameters (0 provided)");if(e(r,function(r){try{i=o(i,r),n++}catch(e){throw l(e,"var",r)}}),0===n)throw new Error("Cannot calculate var of an empty array");var u=m(i,n);if(i=0,e(r,function(r){var e=c(r,u);i=o(i,s(e,e))}),h(i))return i;switch(a){case"uncorrected":return m(i,n);case"biased":return m(i,n+1);case"unbiased":var d=t.isBigNumber(i)?new t.BigNumber(0):0;return 1===n?d:m(i,n-1);default:throw new Error('Unknown normalization "'+a+'". Choose "unbiased" (default), "uncorrected", or "biased".')}}function v(r,e,t){try{if(0===r.length)throw new SyntaxError("Function var requires one or more parameters (0 provided)");return u(r,e,function(r){return f(r,t)})}catch(a){throw l(a,"var")}}}exports.name="var",exports.factory=t;
},{"../../utils/collection/deepForEach":"Uh7d","../matrix/apply":"f9k3","../arithmetic/addScalar":"ZM3O","../arithmetic/subtract":"m78R","../arithmetic/multiplyScalar":"obRw","../arithmetic/divideScalar":"R3aq","../utils/isNaN":"AHex","./utils/improveErrorMessage":"lOhJ"}],"hFUZ":[function(require,module,exports) {
"use strict";function r(r,e,t,a){var i=t(require("../arithmetic/sqrt")),n=t(require("../statistics/var")),s=a("std",{"Array | Matrix":o,"Array | Matrix, string":o,"Array | Matrix, number | BigNumber":o,"Array | Matrix, number | BigNumber, string":o,"...":function(r){return o(r)}});return s.toTex=void 0,s;function o(r,e){if(0===r.length)throw new SyntaxError("Function std requires one or more parameters (0 provided)");try{return i(n.apply(null,arguments))}catch(t){throw t instanceof TypeError&&-1!==t.message.indexOf(" var")?new TypeError(t.message.replace(" var"," std")):t}}}exports.name="std",exports.factory=r;
},{"../arithmetic/sqrt":"T6pB","../statistics/var":"ujYK"}],"wF4V":[function(require,module,exports) {
"use strict";module.exports=[require("./mad"),require("./max"),require("./mean"),require("./median"),require("./min"),require("./mode"),require("./prod"),require("./quantileSeq"),require("./std"),require("./sum"),require("./var")];
},{"./mad":"Je7I","./max":"US8O","./mean":"WyK1","./median":"LcS3","./min":"VKqc","./mode":"DTxj","./prod":"Hc7x","./quantileSeq":"hl2d","./std":"hFUZ","./sum":"y9hQ","./var":"ujYK"}],"Y1aD":[function(require,module,exports) {
"use strict";var r=require("../../utils/string").isString,t=require("../../utils/string").format;function i(r,t,i,n){var s=n("print",{"string, Object | Array":e,"string, Object | Array, number | Object":e});return s.toTex=void 0,s}function e(i,e,n){return i.replace(/\$([\w.]+)/g,function(i,s){for(var o=s.split("."),u=e[o.shift()];o.length&&void 0!==u;){var a=o.shift();u=a?u[a]:u+"."}return void 0!==u?r(u)?u:t(u,n):i})}exports.name="print",exports.factory=i;
},{"../../utils/string":"PshC"}],"PVZV":[function(require,module,exports) {
"use strict";module.exports=[require("./format"),require("./print")];
},{"./format":"A04Q","./print":"Y1aD"}],"VaAN":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,o,n){var c=n("acos",{number:function(r){return r>=-1&&r<=1||t.predictable?Math.acos(r):new e.Complex(r,0).acos()},Complex:function(r){return r.acos()},BigNumber:function(r){return r.acos()},"Array | Matrix":function(e){return r(e,c)}});return c.toTex={1:"\\cos^{-1}\\left(${args[0]}\\right)"},c}exports.name="acos",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"ztg1":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function r(r,o,n,a){var c=a("acosh",{number:function(t){return t>=1||o.predictable?e(t):t<=-1?new r.Complex(Math.log(Math.sqrt(t*t-1)-t),Math.PI):new r.Complex(t,0).acosh()},Complex:function(t){return t.acosh()},BigNumber:function(t){return t.acosh()},"Array | Matrix":function(r){return t(r,c)}});return c.toTex={1:"\\cosh^{-1}\\left(${args[0]}\\right)"},c}var e=Math.acosh||function(t){return Math.log(Math.sqrt(t*t-1)+t)};exports.name="acosh",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"y5e7":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function r(r,e,n,a){var o=a("acot",{number:function(t){return Math.atan(1/t)},Complex:function(t){return t.acot()},BigNumber:function(t){return new r.BigNumber(1).div(t).atan()},"Array | Matrix":function(r){return t(r,o)}});return o.toTex={1:"\\cot^{-1}\\left(${args[0]}\\right)"},o}exports.name="acot",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"qhkj":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function r(r,e,n,o){var i=o("acoth",{number:function(t){return t>=1||t<=-1||e.predictable?isFinite(t)?(Math.log((t+1)/t)+Math.log(t/(t-1)))/2:0:new r.Complex(t,0).acoth()},Complex:function(t){return t.acoth()},BigNumber:function(t){return new r.BigNumber(1).div(t).atanh()},"Array | Matrix":function(r){return t(r,i)}});return i.toTex={1:"\\coth^{-1}\\left(${args[0]}\\right)"},i}exports.name="acoth",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"U7Zf":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,n,c){var i=c("acsc",{number:function(r){return r<=-1||r>=1||t.predictable?Math.asin(1/r):new e.Complex(r,0).acsc()},Complex:function(r){return r.acsc()},BigNumber:function(r){return new e.BigNumber(1).div(r).asin()},"Array | Matrix":function(e){return r(e,i)}});return i.toTex={1:"\\csc^{-1}\\left(${args[0]}\\right)"},i}exports.name="acsc",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"YhGE":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,e,n,c){var u=c("acsch",{number:function(r){return r=1/r,Math.log(r+Math.sqrt(r*r+1))},Complex:function(r){return r.acsch()},BigNumber:function(r){return new t.BigNumber(1).div(r).asinh()},"Array | Matrix":function(t){return r(t,u)}});return u.toTex={1:"\\mathrm{csch}^{-1}\\left(${args[0]}\\right)"},u}exports.name="acsch",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"Ln1e":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function r(r,t,n,c){var a=c("asec",{number:function(e){return e<=-1||e>=1||t.predictable?Math.acos(1/e):new r.Complex(e,0).asec()},Complex:function(e){return e.asec()},BigNumber:function(e){return new r.BigNumber(1).div(e).acos()},"Array | Matrix":function(r){return e(r,a)}});return a.toTex={1:"\\sec^{-1}\\left(${args[0]}\\right)"},a}exports.name="asec",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"hL0t":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function r(r,t,n,a){var c=a("asech",{number:function(e){if(e<=1&&e>=-1||t.predictable){e=1/e;var n=Math.sqrt(e*e-1);return e>0||t.predictable?Math.log(n+e):new r.Complex(Math.log(n-e),Math.PI)}return new r.Complex(e,0).asech()},Complex:function(e){return e.asech()},BigNumber:function(e){return new r.BigNumber(1).div(e).acosh()},"Array | Matrix":function(r){return e(r,c)}});return c.toTex={1:"\\mathrm{sech}^{-1}\\left(${args[0]}\\right)"},c}exports.name="asech",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"Kjxu":[function(require,module,exports) {
"use strict";var n=require("../../utils/collection/deepMap");function r(r,e,t,i){var a=i("asin",{number:function(n){return n>=-1&&n<=1||e.predictable?Math.asin(n):new r.Complex(n,0).asin()},Complex:function(n){return n.asin()},BigNumber:function(n){return n.asin()},"Array | Matrix":function(r){return n(r,a,!0)}});return a.toTex={1:"\\sin^{-1}\\left(${args[0]}\\right)"},a}exports.name="asin",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"IRsU":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,n,e,i){var a=i("asinh",{number:Math.asinh||function(r){return Math.log(Math.sqrt(r*r+1)+r)},Complex:function(r){return r.asinh()},BigNumber:function(r){return r.asinh()},"Array | Matrix":function(t){return r(t,a,!0)}});return a.toTex={1:"\\sinh^{-1}\\left(${args[0]}\\right)"},a}exports.name="asinh",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"RhXd":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function r(r,n,a,e){var u=e("atan",{number:function(t){return Math.atan(t)},Complex:function(t){return t.atan()},BigNumber:function(t){return t.atan()},"Array | Matrix":function(r){return t(r,u,!0)}});return u.toTex={1:"\\tan^{-1}\\left(${args[0]}\\right)"},u}exports.name="atan",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"lP3L":[function(require,module,exports) {
"use strict";function r(r,t,e,i){var n=e(require("../../type/matrix/function/matrix")),u=e(require("../../type/matrix/utils/algorithm02")),a=e(require("../../type/matrix/utils/algorithm03")),m=e(require("../../type/matrix/utils/algorithm09")),o=e(require("../../type/matrix/utils/algorithm11")),x=e(require("../../type/matrix/utils/algorithm12")),s=e(require("../../type/matrix/utils/algorithm13")),f=e(require("../../type/matrix/utils/algorithm14")),c=i("atan2",{"number, number":Math.atan2,"BigNumber, BigNumber":function(t,e){return r.BigNumber.atan2(t,e)},"SparseMatrix, SparseMatrix":function(r,t){return m(r,t,c,!1)},"SparseMatrix, DenseMatrix":function(r,t){return u(t,r,c,!0)},"DenseMatrix, SparseMatrix":function(r,t){return a(r,t,c,!1)},"DenseMatrix, DenseMatrix":function(r,t){return s(r,t,c)},"Array, Array":function(r,t){return c(n(r),n(t)).valueOf()},"Array, Matrix":function(r,t){return c(n(r),t)},"Matrix, Array":function(r,t){return c(r,n(t))},"SparseMatrix, number | BigNumber":function(r,t){return o(r,t,c,!1)},"DenseMatrix, number | BigNumber":function(r,t){return f(r,t,c,!1)},"number | BigNumber, SparseMatrix":function(r,t){return x(t,r,c,!0)},"number | BigNumber, DenseMatrix":function(r,t){return f(t,r,c,!0)},"Array, number | BigNumber":function(r,t){return f(n(r),t,c,!1).valueOf()},"number | BigNumber, Array":function(r,t){return f(n(t),r,c,!0).valueOf()}});return c.toTex={2:"\\mathrm{atan2}\\left(${args}\\right)"},c}exports.name="atan2",exports.factory=r;
},{"../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm02":"j4Xj","../../type/matrix/utils/algorithm03":"oR02","../../type/matrix/utils/algorithm09":"PvZY","../../type/matrix/utils/algorithm11":"dpKK","../../type/matrix/utils/algorithm12":"Pn2O","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"PRlQ":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function n(n,a,e,u){var o=u("atanh",{number:function(t){return t<=1&&t>=-1||a.predictable?r(t):new n.Complex(t,0).atanh()},Complex:function(t){return t.atanh()},BigNumber:function(t){return t.atanh()},"Array | Matrix":function(n){return t(n,o,!0)}});return o.toTex={1:"\\tanh^{-1}\\left(${args[0]}\\right)"},o}var r=Math.atanh||function(t){return Math.log((1+t)/(1-t))/2};exports.name="atanh",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo"}],"WIaC":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function n(n,t,e,o){var i=o("cos",{number:Math.cos,Complex:function(r){return r.cos()},BigNumber:function(r){return r.cos()},Unit:function(r){if(!r.hasBase(n.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cos is no angle");return i(r.value)},"Array | Matrix":function(n){return r(n,i)}});return i.toTex={1:"\\cos\\left(${args[0]}\\right)"},i}exports.name="cos",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo"}],"urk8":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function t(t,e,o,i){var u=i("cosh",{number:n,Complex:function(r){return r.cosh()},BigNumber:function(r){return r.cosh()},Unit:function(r){if(!r.hasBase(t.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cosh is no angle");return u(r.value)},"Array | Matrix":function(t){return r(t,u)}});return u.toTex={1:"\\cosh\\left(${args[0]}\\right)"},u}var n=Math.cosh||function(r){return(Math.exp(r)+Math.exp(-r))/2};exports.name="cosh",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"ray7":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function n(n,r,e,i){var o=i("cot",{number:function(t){return 1/Math.tan(t)},Complex:function(t){return t.cot()},BigNumber:function(t){return new n.BigNumber(1).div(t.tan())},Unit:function(t){if(!t.hasBase(n.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function cot is no angle");return o(t.value)},"Array | Matrix":function(n){return t(n,o)}});return o.toTex={1:"\\cot\\left(${args[0]}\\right)"},o}exports.name="cot",exports.factory=n;
},{"../../utils/collection/deepMap":"lOYo"}],"wqSx":[function(require,module,exports) {
"use strict";var t=require("../../utils/collection/deepMap");function r(r,e,i,o){var u=o("coth",{number:n,Complex:function(t){return t.coth()},BigNumber:function(t){return new r.BigNumber(1).div(t.tanh())},Unit:function(t){if(!t.hasBase(r.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function coth is no angle");return u(t.value)},"Array | Matrix":function(r){return t(r,u)}});return u.toTex={1:"\\coth\\left(${args[0]}\\right)"},u}function n(t){var r=Math.exp(2*t);return(r+1)/(r-1)}exports.name="coth",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"R45M":[function(require,module,exports) {
"use strict";var n=require("../../utils/collection/deepMap");function r(r,t,e,i){var c=i("csc",{number:function(n){return 1/Math.sin(n)},Complex:function(n){return n.csc()},BigNumber:function(n){return new r.BigNumber(1).div(n.sin())},Unit:function(n){if(!n.hasBase(r.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csc is no angle");return c(n.value)},"Array | Matrix":function(r){return n(r,c)}});return c.toTex={1:"\\csc\\left(${args[0]}\\right)"},c}exports.name="csc",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"AQW3":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap"),n=require("../../utils/number").sign;function e(n,e,i,u){var c=u("csch",{number:t,Complex:function(r){return r.csch()},BigNumber:function(r){return new n.BigNumber(1).div(r.sinh())},Unit:function(r){if(!r.hasBase(n.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function csch is no angle");return c(r.value)},"Array | Matrix":function(n){return r(n,c)}});return c.toTex={1:"\\mathrm{csch}\\left(${args[0]}\\right)"},c}function t(r){return 0===r?Number.POSITIVE_INFINITY:Math.abs(2/(Math.exp(r)-Math.exp(-r)))*n(r)}exports.name="csch",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo","../../utils/number":"uqMu"}],"CaBc":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function r(r,n,t,i){var u=i("sec",{number:function(e){return 1/Math.cos(e)},Complex:function(e){return e.sec()},BigNumber:function(e){return new r.BigNumber(1).div(e.cos())},Unit:function(e){if(!e.hasBase(r.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sec is no angle");return u(e.value)},"Array | Matrix":function(r){return e(r,u)}});return u.toTex={1:"\\sec\\left(${args[0]}\\right)"},u}exports.name="sec",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"twiY":[function(require,module,exports) {
"use strict";var e=require("../../utils/collection/deepMap");function r(r,t,i,u){var o=u("sech",{number:n,Complex:function(e){return e.sech()},BigNumber:function(e){return new r.BigNumber(1).div(e.cosh())},Unit:function(e){if(!e.hasBase(r.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sech is no angle");return o(e.value)},"Array | Matrix":function(r){return e(r,o)}});return o.toTex={1:"\\mathrm{sech}\\left(${args[0]}\\right)"},o}function n(e){return 2/(Math.exp(e)+Math.exp(-e))}exports.name="sech",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"v5Tm":[function(require,module,exports) {
"use strict";var n=require("../../utils/collection/deepMap");function r(r,t,i,e){var u=e("sin",{number:Math.sin,Complex:function(n){return n.sin()},BigNumber:function(n){return n.sin()},Unit:function(n){if(!n.hasBase(r.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sin is no angle");return u(n.value)},"Array | Matrix":function(r){return n(r,u,!0)}});return u.toTex={1:"\\sin\\left(${args[0]}\\right)"},u}exports.name="sin",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"Q1nY":[function(require,module,exports) {
"use strict";var n=require("../../utils/collection/deepMap");function r(r,e,i,u){var o=u("sinh",{number:t,Complex:function(n){return n.sinh()},BigNumber:function(n){return n.sinh()},Unit:function(n){if(!n.hasBase(r.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function sinh is no angle");return o(n.value)},"Array | Matrix":function(r){return n(r,o,!0)}});return o.toTex={1:"\\sinh\\left(${args[0]}\\right)"},o}var t=Math.sinh||function(n){return(Math.exp(n)-Math.exp(-n))/2};exports.name="sinh",exports.factory=r;
},{"../../utils/collection/deepMap":"lOYo"}],"jk9z":[function(require,module,exports) {
"use strict";var n=require("../../utils/collection/deepMap");function t(t,r,e,a){var i=a("tan",{number:Math.tan,Complex:function(n){return n.tan()},BigNumber:function(n){return n.tan()},Unit:function(n){if(!n.hasBase(t.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tan is no angle");return i(n.value)},"Array | Matrix":function(t){return n(t,i,!0)}});return i.toTex={1:"\\tan\\left(${args[0]}\\right)"},i}exports.name="tan",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"FXHB":[function(require,module,exports) {
"use strict";var n=require("../../utils/collection/deepMap");function t(t,e,a,i){var u=i("tanh",{number:r,Complex:function(n){return n.tanh()},BigNumber:function(n){return n.tanh()},Unit:function(n){if(!n.hasBase(t.Unit.BASE_UNITS.ANGLE))throw new TypeError("Unit in function tanh is no angle");return u(n.value)},"Array | Matrix":function(t){return n(t,u,!0)}});return u.toTex={1:"\\tanh\\left(${args[0]}\\right)"},u}var r=Math.tanh||function(n){var t=Math.exp(2*n);return(t-1)/(t+1)};exports.name="tanh",exports.factory=t;
},{"../../utils/collection/deepMap":"lOYo"}],"SGcX":[function(require,module,exports) {
"use strict";module.exports=[require("./acos"),require("./acosh"),require("./acot"),require("./acoth"),require("./acsc"),require("./acsch"),require("./asec"),require("./asech"),require("./asin"),require("./asinh"),require("./atan"),require("./atan2"),require("./atanh"),require("./cos"),require("./cosh"),require("./cot"),require("./coth"),require("./csc"),require("./csch"),require("./sec"),require("./sech"),require("./sin"),require("./sinh"),require("./tan"),require("./tanh")];
},{"./acos":"VaAN","./acosh":"ztg1","./acot":"y5e7","./acoth":"qhkj","./acsc":"U7Zf","./acsch":"YhGE","./asec":"Ln1e","./asech":"hL0t","./asin":"Kjxu","./asinh":"IRsU","./atan":"RhXd","./atan2":"lP3L","./atanh":"PRlQ","./cos":"WIaC","./cosh":"urk8","./cot":"ray7","./coth":"wqSx","./csc":"R45M","./csch":"AQW3","./sec":"CaBc","./sech":"twiY","./sin":"v5Tm","./sinh":"Q1nY","./tan":"jk9z","./tanh":"FXHB"}],"aMR7":[function(require,module,exports) {
"use strict";function r(r,t,n,i){var a=require("../../utils/latex"),e=n(require("../../type/matrix/function/matrix")),u=n(require("../../type/matrix/utils/algorithm13")),o=n(require("../../type/matrix/utils/algorithm14")),f=i("to",{"Unit, Unit | string":function(r,t){return r.to(t)},"Matrix, Matrix":function(r,t){return u(r,t,f)},"Array, Array":function(r,t){return f(e(r),e(t)).valueOf()},"Array, Matrix":function(r,t){return f(e(r),t)},"Matrix, Array":function(r,t){return f(r,e(t))},"Matrix, any":function(r,t){return o(r,t,f,!1)},"any, Matrix":function(r,t){return o(t,r,f,!0)},"Array, any":function(r,t){return o(e(r),t,f,!1).valueOf()},"any, Array":function(r,t){return o(e(t),r,f,!0).valueOf()}});return f.toTex={2:"\\left(${args[0]}".concat(a.operators.to,"${args[1]}\\right)")},f}exports.name="to",exports.factory=r;
},{"../../utils/latex":"H1Mr","../../type/matrix/function/matrix":"vzj5","../../type/matrix/utils/algorithm13":"NS7U","../../type/matrix/utils/algorithm14":"S2eB"}],"rv7z":[function(require,module,exports) {
"use strict";module.exports=[require("./to")];
},{"./to":"aMR7"}],"Oa1A":[function(require,module,exports) {
"use strict";var e=require("../../utils/object");function o(o,r,t,n){var c=n("clone",{any:e.clone});return c.toTex=void 0,c}exports.name="clone",exports.factory=o;
},{"../../utils/object":"FcSp"}],"mSLG":[function(require,module,exports) {
"use strict";function r(r,e,t,u){var n=t(require("./isNumeric"));return u("hasNumericValue",{string:function(r){return r.trim().length>0&&!isNaN(Number(r))},any:function(r){return n(r)}})}exports.name="hasNumericValue",exports.factory=r;
},{"./isNumeric":"Rv38"}],"on0C":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,i,u){var n=u("isPrime",{number:function(r){if(r<2)return!1;if(2===r)return!0;if(r%2==0)return!1;for(var e=3;e*e<=r;e+=2)if(r%e==0)return!1;return!0},BigNumber:function(r){if(r.lt(2))return!1;if(r.equals(2))return!0;if(r.mod(2).isZero())return!1;for(var t=e.BigNumber(3);t.times(t).lte(r);t=t.plus(1))if(r.mod(t).isZero())return!1;return!0},"Array | Matrix":function(e){return r(e,n)}});return n}exports.name="isPrime",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo"}],"tvom":[function(require,module,exports) {
"use strict";module.exports=[require("./clone"),require("./isInteger"),require("./isNegative"),require("./isNumeric"),require("./hasNumericValue"),require("./isPositive"),require("./isPrime"),require("./isZero"),require("./isNaN"),require("./typeof")];
},{"./clone":"Oa1A","./isInteger":"qG7X","./isNegative":"HYoC","./isNumeric":"Rv38","./hasNumericValue":"mSLG","./isPositive":"OFKG","./isPrime":"on0C","./isZero":"geyZ","./isNaN":"AHex","./typeof":"LZTG"}],"wKfj":[function(require,module,exports) {
"use strict";module.exports=[require("./algebra"),require("./arithmetic"),require("./bitwise"),require("./combinatorics"),require("./complex"),require("./geometry"),require("./logical"),require("./matrix"),require("./probability"),require("./relational"),require("./set"),require("./special"),require("./statistics"),require("./string"),require("./trigonometry"),require("./unit"),require("./utils")];
},{"./algebra":"VeYJ","./arithmetic":"bAc9","./bitwise":"JhAg","./combinatorics":"otxT","./complex":"gHt6","./geometry":"W9Zs","./logical":"TPFf","./matrix":"X3kh","./probability":"xCRU","./relational":"IR2w","./set":"O2mj","./special":"JuUL","./statistics":"wF4V","./string":"PVZV","./trigonometry":"SGcX","./unit":"rv7z","./utils":"tvom"}],"iLNC":[function(require,module,exports) {
"use strict";module.exports={name:"bignumber",category:"Construction",syntax:["bignumber(x)"],description:"Create a big number from a number or string.",examples:["0.1 + 0.2","bignumber(0.1) + bignumber(0.2)",'bignumber("7.2")','bignumber("7.2e500")',"bignumber([0.1, 0.2, 0.3])"],seealso:["boolean","complex","fraction","index","matrix","string","unit"]};
},{}],"t9At":[function(require,module,exports) {
"use strict";module.exports={name:"boolean",category:"Construction",syntax:["x","boolean(x)"],description:"Convert a string or number into a boolean.",examples:["boolean(0)","boolean(1)","boolean(3)",'boolean("true")','boolean("false")',"boolean([1, 0, 1, 1])"],seealso:["bignumber","complex","index","matrix","number","string","unit"]};
},{}],"JrNm":[function(require,module,exports) {
"use strict";module.exports={name:"complex",category:"Construction",syntax:["complex()","complex(re, im)","complex(string)"],description:"Create a complex number.",examples:["complex()","complex(2, 3)",'complex("7 - 2i")'],seealso:["bignumber","boolean","index","matrix","number","string","unit"]};
},{}],"p1Y0":[function(require,module,exports) {
"use strict";module.exports={name:"createUnit",category:"Construction",syntax:["createUnit(definitions)","createUnit(name, definition)"],description:"Create a user-defined unit and register it with the Unit type.",examples:['createUnit("foo")','createUnit("knot", {definition: "0.514444444 m/s", aliases: ["knots", "kt", "kts"]})','createUnit("mph", "1 mile/hour")'],seealso:["unit","splitUnit"]};
},{}],"L0ae":[function(require,module,exports) {
"use strict";module.exports={name:"fraction",category:"Construction",syntax:["fraction(num)","fraction(num,den)"],description:"Create a fraction from a number or from a numerator and denominator.",examples:["fraction(0.125)","fraction(1, 3) + fraction(2, 5)"],seealso:["bignumber","boolean","complex","index","matrix","string","unit"]};
},{}],"u7WR":[function(require,module,exports) {
"use strict";module.exports={name:"index",category:"Construction",syntax:["[start]","[start:end]","[start:step:end]","[start1, start 2, ...]","[start1:end1, start2:end2, ...]","[start1:step1:end1, start2:step2:end2, ...]"],description:"Create an index to get or replace a subset of a matrix",examples:["[]","[1, 2, 3]","A = [1, 2, 3; 4, 5, 6]","A[1, :]","A[1, 2] = 50","A[0:2, 0:2] = ones(2, 2)"],seealso:["bignumber","boolean","complex","matrix,","number","range","string","unit"]};
},{}],"ig4c":[function(require,module,exports) {
"use strict";module.exports={name:"matrix",category:"Construction",syntax:["[]","[a1, b1, ...; a2, b2, ...]","matrix()",'matrix("dense")',"matrix([...])"],description:"Create a matrix.",examples:["[]","[1, 2, 3]","[1, 2, 3; 4, 5, 6]","matrix()","matrix([3, 4])",'matrix([3, 4; 5, 6], "sparse")','matrix([3, 4; 5, 6], "sparse", "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","sparse"]};
},{}],"a1WX":[function(require,module,exports) {
"use strict";module.exports={name:"number",category:"Construction",syntax:["x","number(x)","number(unit, valuelessUnit)"],description:"Create a number or convert a string or boolean into a number.",examples:["2","2e3","4.05","number(2)",'number("7.2")',"number(true)","number([true, false, true, true])",'number(unit("52cm"), "m")'],seealso:["bignumber","boolean","complex","fraction","index","matrix","string","unit"]};
},{}],"wNuW":[function(require,module,exports) {
"use strict";module.exports={name:"sparse",category:"Construction",syntax:["sparse()","sparse([a1, b1, ...; a1, b2, ...])",'sparse([a1, b1, ...; a1, b2, ...], "number")'],description:"Create a sparse matrix.",examples:["sparse()","sparse([3, 4; 5, 6])",'sparse([3, 0; 5, 0], "number")'],seealso:["bignumber","boolean","complex","index","number","string","unit","matrix"]};
},{}],"YFZz":[function(require,module,exports) {
"use strict";module.exports={name:"splitUnit",category:"Construction",syntax:["splitUnit(unit: Unit, parts: Unit[])"],description:"Split a unit in an array of units whose sum is equal to the original unit.",examples:['splitUnit(1 m, ["feet", "inch"])'],seealso:["unit","createUnit"]};
},{}],"rqOi":[function(require,module,exports) {
"use strict";module.exports={name:"string",category:"Construction",syntax:['"text"',"string(x)"],description:"Create a string or convert a value to a string",examples:['"Hello World!"',"string(4.2)","string(3 + 2i)"],seealso:["bignumber","boolean","complex","index","matrix","number","unit"]};
},{}],"x7uc":[function(require,module,exports) {
"use strict";module.exports={name:"unit",category:"Construction",syntax:["value unit","unit(value, unit)","unit(string)"],description:"Create a unit.",examples:["5.5 mm","3 inch",'unit(7.1, "kilogram")','unit("23 deg")'],seealso:["bignumber","boolean","complex","index","matrix","number","string"]};
},{}],"MQ99":[function(require,module,exports) {
"use strict";module.exports={name:"e",category:"Constants",syntax:["e"],description:"Euler's number, the base of the natural logarithm. Approximately equal to 2.71828",examples:["e","e ^ 2","exp(2)","log(e)"],seealso:["exp"]};
},{}],"T9NB":[function(require,module,exports) {
"use strict";module.exports={name:"false",category:"Constants",syntax:["false"],description:"Boolean value false",examples:["false"],seealso:["true"]};
},{}],"aPHB":[function(require,module,exports) {
"use strict";module.exports={name:"i",category:"Constants",syntax:["i"],description:"Imaginary unit, defined as i*i=-1. A complex number is described as a + b*i, where a is the real part, and b is the imaginary part.",examples:["i","i * i","sqrt(-1)"],seealso:[]};
},{}],"QQb5":[function(require,module,exports) {
"use strict";module.exports={name:"Infinity",category:"Constants",syntax:["Infinity"],description:"Infinity, a number which is larger than the maximum number that can be handled by a floating point number.",examples:["Infinity","1 / 0"],seealso:[]};
},{}],"aXGR":[function(require,module,exports) {
"use strict";module.exports={name:"LN2",category:"Constants",syntax:["LN2"],description:"Returns the natural logarithm of 2, approximately equal to 0.693",examples:["LN2","log(2)"],seealso:[]};
},{}],"ONCS":[function(require,module,exports) {
"use strict";module.exports={name:"LN10",category:"Constants",syntax:["LN10"],description:"Returns the natural logarithm of 10, approximately equal to 2.302",examples:["LN10","log(10)"],seealso:[]};
},{}],"l03h":[function(require,module,exports) {
"use strict";module.exports={name:"LOG2E",category:"Constants",syntax:["LOG2E"],description:"Returns the base-2 logarithm of E, approximately equal to 1.442",examples:["LOG2E","log(e, 2)"],seealso:[]};
},{}],"IwW2":[function(require,module,exports) {
"use strict";module.exports={name:"LOG10E",category:"Constants",syntax:["LOG10E"],description:"Returns the base-10 logarithm of E, approximately equal to 0.434",examples:["LOG10E","log(e, 10)"],seealso:[]};
},{}],"sLjM":[function(require,module,exports) {
"use strict";module.exports={name:"NaN",category:"Constants",syntax:["NaN"],description:"Not a number",examples:["NaN","0 / 0"],seealso:[]};
},{}],"lowc":[function(require,module,exports) {
"use strict";module.exports={name:"null",category:"Constants",syntax:["null"],description:"Value null",examples:["null"],seealso:["true","false"]};
},{}],"HJY8":[function(require,module,exports) {
"use strict";module.exports={name:"pi",category:"Constants",syntax:["pi"],description:"The number pi is a mathematical constant that is the ratio of a circle's circumference to its diameter, and is approximately equal to 3.14159",examples:["pi","sin(pi/2)"],seealso:["tau"]};
},{}],"jcFy":[function(require,module,exports) {
"use strict";module.exports={name:"phi",category:"Constants",syntax:["phi"],description:"Phi is the golden ratio. Two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Phi is defined as `(1 + sqrt(5)) / 2` and is approximately 1.618034...",examples:["phi"],seealso:[]};
},{}],"fDHA":[function(require,module,exports) {
"use strict";module.exports={name:"SQRT1_2",category:"Constants",syntax:["SQRT1_2"],description:"Returns the square root of 1/2, approximately equal to 0.707",examples:["SQRT1_2","sqrt(1/2)"],seealso:[]};
},{}],"yYpy":[function(require,module,exports) {
"use strict";module.exports={name:"SQRT2",category:"Constants",syntax:["SQRT2"],description:"Returns the square root of 2, approximately equal to 1.414",examples:["SQRT2","sqrt(2)"],seealso:[]};
},{}],"aQgJ":[function(require,module,exports) {
"use strict";module.exports={name:"tau",category:"Constants",syntax:["tau"],description:"Tau is the ratio constant of a circle's circumference to radius, equal to 2 * pi, approximately 6.2832.",examples:["tau","2 * pi"],seealso:["pi"]};
},{}],"n6zq":[function(require,module,exports) {
"use strict";module.exports={name:"true",category:"Constants",syntax:["true"],description:"Boolean value true",examples:["true"],seealso:["false"]};
},{}],"CPzZ":[function(require,module,exports) {
"use strict";module.exports={name:"version",category:"Constants",syntax:["version"],description:"A string with the version number of math.js",examples:["version"],seealso:[]};
},{}],"HjBS":[function(require,module,exports) {
"use strict";module.exports={name:"derivative",category:"Algebra",syntax:["derivative(expr, variable)","derivative(expr, variable, {simplify: boolean})"],description:"Takes the derivative of an expression expressed in parser Nodes. The derivative will be taken over the supplied variable in the second parameter. If there are multiple variables in the expression, it will return a partial derivative.",examples:['derivative("2x^3", "x")','derivative("2x^3", "x", {simplify: false})','derivative("2x^2 + 3x + 4", "x")','derivative("sin(2x)", "x")','f = parse("x^2 + x")','x = parse("x")',"df = derivative(f, x)","df.eval({x: 3})"],seealso:["simplify","parse","eval"]};
},{}],"OFzm":[function(require,module,exports) {
"use strict";module.exports={name:"lsolve",category:"Algebra",syntax:["x=lsolve(L, b)"],description:"Solves the linear system L * x = b where L is an [n x n] lower triangular matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lsolve(a, b)"],seealso:["lup","lusolve","usolve","matrix","sparse"]};
},{}],"SsYr":[function(require,module,exports) {
"use strict";module.exports={name:"lup",category:"Algebra",syntax:["lup(m)"],description:"Calculate the Matrix LU decomposition with partial pivoting. Matrix A is decomposed in three matrices (L, U, P) where P * A = L * U",examples:["lup([[2, 1], [1, 4]])","lup(matrix([[2, 1], [1, 4]]))","lup(sparse([[2, 1], [1, 4]]))"],seealso:["lusolve","lsolve","usolve","matrix","sparse","slu","qr"]};
},{}],"F1Dh":[function(require,module,exports) {
"use strict";module.exports={name:"lusolve",category:"Algebra",syntax:["x=lusolve(A, b)","x=lusolve(lu, b)"],description:"Solves the linear system A * x = b where A is an [n x n] matrix and b is a [n] column vector.",examples:["a = [-2, 3; 2, 1]","b = [11, 9]","x = lusolve(a, b)"],seealso:["lup","slu","lsolve","usolve","matrix","sparse"]};
},{}],"yWjE":[function(require,module,exports) {
"use strict";module.exports={name:"simplify",category:"Algebra",syntax:["simplify(expr)","simplify(expr, rules)"],description:"Simplify an expression tree.",examples:['simplify("3 + 2 / 4")','simplify("2x + x")','f = parse("x * (x + 2 + x)")',"simplified = simplify(f)","simplified.eval({x: 2})"],seealso:["derivative","parse","eval"]};
},{}],"xCNe":[function(require,module,exports) {
"use strict";module.exports={name:"rationalize",category:"Algebra",syntax:["rationalize(expr)","rationalize(expr, scope)","rationalize(expr, scope, detailed)"],description:"Transform a rationalizable expression in a rational fraction. If rational fraction is one variable polynomial then converts the numerator and denominator in canonical form, with decreasing exponents, returning the coefficients of numerator.",examples:['rationalize("2x/y - y/(x+1)")','rationalize("2x/y - y/(x+1)", true)'],seealso:["simplify"]};
},{}],"h0vC":[function(require,module,exports) {
"use strict";module.exports={name:"slu",category:"Algebra",syntax:["slu(A, order, threshold)"],description:"Calculate the Matrix LU decomposition with full pivoting. Matrix A is decomposed in two matrices (L, U) and two permutation vectors (pinv, q) where P * A * Q = L * U",examples:["slu(sparse([4.5, 0, 3.2, 0; 3.1, 2.9, 0, 0.9; 0, 1.7, 3, 0; 3.5, 0.4, 0, 1]), 1, 0.001)"],seealso:["lusolve","lsolve","usolve","matrix","sparse","lup","qr"]};
},{}],"RXlV":[function(require,module,exports) {
"use strict";module.exports={name:"usolve",category:"Algebra",syntax:["x=usolve(U, b)"],description:"Solves the linear system U * x = b where U is an [n x n] upper triangular matrix and b is a [n] column vector.",examples:["x=usolve(sparse([1, 1, 1, 1; 0, 1, 1, 1; 0, 0, 1, 1; 0, 0, 0, 1]), [1; 2; 3; 4])"],seealso:["lup","lusolve","lsolve","matrix","sparse"]};
},{}],"rUq2":[function(require,module,exports) {
"use strict";module.exports={name:"qr",category:"Algebra",syntax:["qr(A)"],description:"Calculates the Matrix QR decomposition. Matrix `A` is decomposed in two matrices (`Q`, `R`) where `Q` is an orthogonal matrix and `R` is an upper triangular matrix.",examples:["qr([[1, -1, 4], [1, 4, -2], [1, 4, 2], [1, -1, 0]])"],seealso:["lup","slu","matrix"]};
},{}],"XkjO":[function(require,module,exports) {
"use strict";module.exports={name:"abs",category:"Arithmetic",syntax:["abs(x)"],description:"Compute the absolute value.",examples:["abs(3.5)","abs(-4.2)"],seealso:["sign"]};
},{}],"k4Wb":[function(require,module,exports) {
"use strict";module.exports={name:"add",category:"Operators",syntax:["x + y","add(x, y)"],description:"Add two values.",examples:["a = 2.1 + 3.6","a - 3.6","3 + 2i","3 cm + 2 inch",'"2.3" + "4"'],seealso:["subtract"]};
},{}],"aoF1":[function(require,module,exports) {
"use strict";module.exports={name:"cbrt",category:"Arithmetic",syntax:["cbrt(x)","cbrt(x, allRoots)"],description:"Compute the cubic root value. If x = y * y * y, then y is the cubic root of x. When `x` is a number or complex number, an optional second argument `allRoots` can be provided to return all three cubic roots. If not provided, the principal root is returned",examples:["cbrt(64)","cube(4)","cbrt(-8)","cbrt(2 + 3i)","cbrt(8i)","cbrt(8i, true)","cbrt(27 m^3)"],seealso:["square","sqrt","cube","multiply"]};
},{}],"z4It":[function(require,module,exports) {
"use strict";module.exports={name:"ceil",category:"Arithmetic",syntax:["ceil(x)"],description:"Round a value towards plus infinity. If x is complex, both real and imaginary part are rounded towards plus infinity.",examples:["ceil(3.2)","ceil(3.8)","ceil(-4.2)"],seealso:["floor","fix","round"]};
},{}],"ruVI":[function(require,module,exports) {
"use strict";module.exports={name:"cube",category:"Arithmetic",syntax:["cube(x)"],description:"Compute the cube of a value. The cube of x is x * x * x.",examples:["cube(2)","2^3","2 * 2 * 2"],seealso:["multiply","square","pow"]};
},{}],"sbSk":[function(require,module,exports) {
"use strict";module.exports={name:"divide",category:"Operators",syntax:["x / y","divide(x, y)"],description:"Divide two values.",examples:["a = 2 / 3","a * 3","4.5 / 2","3 + 4 / 2","(3 + 4) / 2","18 km / 4.5"],seealso:["multiply"]};
},{}],"hr3Z":[function(require,module,exports) {
"use strict";module.exports={name:"dotDivide",category:"Operators",syntax:["x ./ y","dotDivide(x, y)"],description:"Divide two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a ./ b"],seealso:["multiply","dotMultiply","divide"]};
},{}],"p0XP":[function(require,module,exports) {
"use strict";module.exports={name:"dotMultiply",category:"Operators",syntax:["x .* y","dotMultiply(x, y)"],description:"Multiply two values element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","b = [2, 1, 1; 3, 2, 5]","a .* b"],seealso:["multiply","divide","dotDivide"]};
},{}],"HDd7":[function(require,module,exports) {
"use strict";module.exports={name:"dotpow",category:"Operators",syntax:["x .^ y","dotpow(x, y)"],description:"Calculates the power of x to y element wise.",examples:["a = [1, 2, 3; 4, 5, 6]","a .^ 2"],seealso:["pow"]};
},{}],"y0AC":[function(require,module,exports) {
"use strict";module.exports={name:"exp",category:"Arithmetic",syntax:["exp(x)"],description:"Calculate the exponent of a value.",examples:["exp(1.3)","e ^ 1.3","log(exp(1.3))","x = 2.4","(exp(i*x) == cos(x) + i*sin(x)) # Euler's formula"],seealso:["expm","expm1","pow","log"]};
},{}],"iddg":[function(require,module,exports) {
"use strict";module.exports={name:"expm",category:"Arithmetic",syntax:["exp(x)"],description:"Compute the matrix exponential, expm(A) = e^A. The matrix must be square. Not to be confused with exp(a), which performs element-wise exponentiation.",examples:["expm([[0,2],[0,0]])"],seealso:["exp"]};
},{}],"pk0d":[function(require,module,exports) {
"use strict";module.exports={name:"expm1",category:"Arithmetic",syntax:["expm1(x)"],description:"Calculate the value of subtracting 1 from the exponential value.",examples:["expm1(2)","pow(e, 2) - 1","log(expm1(2) + 1)"],seealso:["exp","pow","log"]};
},{}],"WGIH":[function(require,module,exports) {
"use strict";module.exports={name:"fix",category:"Arithmetic",syntax:["fix(x)"],description:"Round a value towards zero. If x is complex, both real and imaginary part are rounded towards zero.",examples:["fix(3.2)","fix(3.8)","fix(-4.2)","fix(-4.8)"],seealso:["ceil","floor","round"]};
},{}],"vXNc":[function(require,module,exports) {
"use strict";module.exports={name:"floor",category:"Arithmetic",syntax:["floor(x)"],description:"Round a value towards minus infinity.If x is complex, both real and imaginary part are rounded towards minus infinity.",examples:["floor(3.2)","floor(3.8)","floor(-4.2)"],seealso:["ceil","fix","round"]};
},{}],"dwcd":[function(require,module,exports) {
"use strict";module.exports={name:"gcd",category:"Arithmetic",syntax:["gcd(a, b)","gcd(a, b, c, ...)"],description:"Compute the greatest common divisor.",examples:["gcd(8, 12)","gcd(-4, 6)","gcd(25, 15, -10)"],seealso:["lcm","xgcd"]};
},{}],"Vx3c":[function(require,module,exports) {
"use strict";module.exports={name:"hypot",category:"Arithmetic",syntax:["hypot(a, b, c, ...)","hypot([a, b, c, ...])"],description:"Calculate the hypotenusa of a list with values. ",examples:["hypot(3, 4)","sqrt(3^2 + 4^2)","hypot(-2)","hypot([3, 4, 5])"],seealso:["abs","norm"]};
},{}],"gaE4":[function(require,module,exports) {
"use strict";module.exports={name:"lcm",category:"Arithmetic",syntax:["lcm(x, y)"],description:"Compute the least common multiple.",examples:["lcm(4, 6)","lcm(6, 21)","lcm(6, 21, 5)"],seealso:["gcd"]};
},{}],"vbjs":[function(require,module,exports) {
"use strict";module.exports={name:"log",category:"Arithmetic",syntax:["log(x)","log(x, base)"],description:"Compute the logarithm of a value. If no base is provided, the natural logarithm of x is calculated. If base if provided, the logarithm is calculated for the specified base. log(x, base) is defined as log(x) / log(base).",examples:["log(3.5)","a = log(2.4)","exp(a)","10 ^ 4","log(10000, 10)","log(10000) / log(10)","b = log(1024, 2)","2 ^ b"],seealso:["exp","log1p","log2","log10"]};
},{}],"XIlx":[function(require,module,exports) {
"use strict";module.exports={name:"log2",category:"Arithmetic",syntax:["log2(x)"],description:"Calculate the 2-base of a value. This is the same as calculating `log(x, 2)`.",examples:["log2(0.03125)","log2(16)","log2(16) / log2(2)","pow(2, 4)"],seealso:["exp","log1p","log","log10"]};
},{}],"WGSj":[function(require,module,exports) {
"use strict";module.exports={name:"log1p",category:"Arithmetic",syntax:["log1p(x)","log1p(x, base)"],description:"Calculate the logarithm of a `value+1`",examples:["log1p(2.5)","exp(log1p(1.4))","pow(10, 4)","log1p(9999, 10)","log1p(9999) / log(10)"],seealso:["exp","log","log2","log10"]};
},{}],"qxOp":[function(require,module,exports) {
"use strict";module.exports={name:"log10",category:"Arithmetic",syntax:["log10(x)"],description:"Compute the 10-base logarithm of a value.",examples:["log10(0.00001)","log10(10000)","10 ^ 4","log(10000) / log(10)","log(10000, 10)"],seealso:["exp","log"]};
},{}],"WNo3":[function(require,module,exports) {
"use strict";module.exports={name:"mod",category:"Operators",syntax:["x % y","x mod y","mod(x, y)"],description:"Calculates the modulus, the remainder of an integer division.",examples:["7 % 3","11 % 2","10 mod 4","isOdd(x) = x % 2","isOdd(2)","isOdd(3)"],seealso:["divide"]};
},{}],"rG0J":[function(require,module,exports) {
"use strict";module.exports={name:"multiply",category:"Operators",syntax:["x * y","multiply(x, y)"],description:"multiply two values.",examples:["a = 2.1 * 3.4","a / 3.4","2 * 3 + 4","2 * (3 + 4)","3 * 2.1 km"],seealso:["divide"]};
},{}],"av88":[function(require,module,exports) {
"use strict";module.exports={name:"norm",category:"Arithmetic",syntax:["norm(x)","norm(x, p)"],description:"Calculate the norm of a number, vector or matrix.",examples:["abs(-3.5)","norm(-3.5)","norm(3 - 4i)","norm([1, 2, -3], Infinity)","norm([1, 2, -3], -Infinity)","norm([3, 4], 2)","norm([[1, 2], [3, 4]], 1)",'norm([[1, 2], [3, 4]], "inf")','norm([[1, 2], [3, 4]], "fro")']};
},{}],"tPWr":[function(require,module,exports) {
"use strict";module.exports={name:"nthRoot",category:"Arithmetic",syntax:["nthRoot(a)","nthRoot(a, root)"],description:'Calculate the nth root of a value. The principal nth root of a positive real number A, is the positive real solution of the equation "x^root = A".',examples:["4 ^ 3","nthRoot(64, 3)","nthRoot(9, 2)","sqrt(9)"],seealso:["nthRoots","pow","sqrt"]};
},{}],"Hwjx":[function(require,module,exports) {
"use strict";module.exports={name:"nthRoots",category:"Arithmetic",syntax:["nthRoots(A)","nthRoots(A, root)"],description:'Calculate the nth roots of a value. An nth root of a positive real number A, is a positive real solution of the equation "x^root = A". This function returns an array of complex values.',examples:["nthRoots(1)","nthRoots(1, 3)"],seealso:["sqrt","pow","nthRoot"]};
},{}],"RTne":[function(require,module,exports) {
"use strict";module.exports={name:"pow",category:"Operators",syntax:["x ^ y","pow(x, y)"],description:"Calculates the power of x to y, x^y.",examples:["2^3","2*2*2","1 + e ^ (pi * i)"],seealso:["multiply","nthRoot","nthRoots","sqrt"]};
},{}],"ayTa":[function(require,module,exports) {
"use strict";module.exports={name:"round",category:"Arithmetic",syntax:["round(x)","round(x, n)"],description:"round a value towards the nearest integer.If x is complex, both real and imaginary part are rounded towards the nearest integer. When n is specified, the value is rounded to n decimals.",examples:["round(3.2)","round(3.8)","round(-4.2)","round(-4.8)","round(pi, 3)","round(123.45678, 2)"],seealso:["ceil","floor","fix"]};
},{}],"HnEg":[function(require,module,exports) {
"use strict";module.exports={name:"sign",category:"Arithmetic",syntax:["sign(x)"],description:"Compute the sign of a value. The sign of a value x is 1 when x>1, -1 when x<0, and 0 when x=0.",examples:["sign(3.5)","sign(-4.2)","sign(0)"],seealso:["abs"]};
},{}],"uX7J":[function(require,module,exports) {
"use strict";module.exports={name:"sqrt",category:"Arithmetic",syntax:["sqrt(x)"],description:"Compute the square root value. If x = y * y, then y is the square root of x.",examples:["sqrt(25)","5 * 5","sqrt(-1)"],seealso:["square","sqrtm","multiply","nthRoot","nthRoots","pow"]};
},{}],"MaXS":[function(require,module,exports) {
"use strict";module.exports={name:"sqrtm",category:"Arithmetic",syntax:["sqrtm(x)"],description:"Calculate the principal square root of a square matrix. The principal square root matrix `X` of another matrix `A` is such that `X * X = A`.",examples:["sqrtm([[1, 2], [3, 4]])"],seealso:["sqrt","abs","square","multiply"]};
},{}],"wa24":[function(require,module,exports) {
"use strict";module.exports={name:"square",category:"Arithmetic",syntax:["square(x)"],description:"Compute the square of a value. The square of x is x * x.",examples:["square(3)","sqrt(9)","3^2","3 * 3"],seealso:["multiply","pow","sqrt","cube"]};
},{}],"IpJ1":[function(require,module,exports) {
"use strict";module.exports={name:"subtract",category:"Operators",syntax:["x - y","subtract(x, y)"],description:"subtract two values.",examples:["a = 5.3 - 2","a + 2","2/3 - 1/6","2 * 3 - 3","2.1 km - 500m"],seealso:["add"]};
},{}],"zSOc":[function(require,module,exports) {
"use strict";module.exports={name:"unaryMinus",category:"Operators",syntax:["-x","unaryMinus(x)"],description:"Inverse the sign of a value. Converts booleans and strings to numbers.",examples:["-4.5","-(-5.6)",'-"22"'],seealso:["add","subtract","unaryPlus"]};
},{}],"hWWr":[function(require,module,exports) {
"use strict";module.exports={name:"unaryPlus",category:"Operators",syntax:["+x","unaryPlus(x)"],description:"Converts booleans and strings to numbers.",examples:["+true",'+"2"'],seealso:["add","subtract","unaryMinus"]};
},{}],"LePI":[function(require,module,exports) {
"use strict";module.exports={name:"xgcd",category:"Arithmetic",syntax:["xgcd(a, b)"],description:"Calculate the extended greatest common divisor for two values. The result is an array [d, x, y] with 3 entries, where d is the greatest common divisor, and d = x * a + y * b.",examples:["xgcd(8, 12)","gcd(8, 12)","xgcd(36163, 21199)"],seealso:["gcd","lcm"]};
},{}],"cry4":[function(require,module,exports) {
"use strict";module.exports={name:"bitAnd",category:"Bitwise",syntax:["x & y","bitAnd(x, y)"],description:"Bitwise AND operation. Performs the logical AND operation on each pair of the corresponding bits of the two given values by multiplying them. If both bits in the compared position are 1, the bit in the resulting binary representation is 1, otherwise, the result is 0",examples:["5 & 3","bitAnd(53, 131)","[1, 12, 31] & 42"],seealso:["bitNot","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};
},{}],"HcKC":[function(require,module,exports) {
"use strict";module.exports={name:"bitNot",category:"Bitwise",syntax:["~x","bitNot(x)"],description:"Bitwise NOT operation. Performs a logical negation on each bit of the given value. Bits that are 0 become 1, and those that are 1 become 0.",examples:["~1","~2","bitNot([2, -3, 4])"],seealso:["bitAnd","bitOr","bitXor","leftShift","rightArithShift","rightLogShift"]};
},{}],"ujKO":[function(require,module,exports) {
"use strict";module.exports={name:"bitOr",category:"Bitwise",syntax:["x | y","bitOr(x, y)"],description:"Bitwise OR operation. Performs the logical inclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if the first bit is 1 or the second bit is 1 or both bits are 1, otherwise, the result is 0.",examples:["5 | 3","bitOr([1, 2, 3], 4)"],seealso:["bitAnd","bitNot","bitXor","leftShift","rightArithShift","rightLogShift"]};
},{}],"WecP":[function(require,module,exports) {
"use strict";module.exports={name:"bitXor",category:"Bitwise",syntax:["bitXor(x, y)"],description:"Bitwise XOR operation, exclusive OR. Performs the logical exclusive OR operation on each pair of corresponding bits of the two given values. The result in each position is 1 if only the first bit is 1 or only the second bit is 1, but will be 0 if both are 0 or both are 1.",examples:["bitOr(1, 2)","bitXor([2, 3, 4], 4)"],seealso:["bitAnd","bitNot","bitOr","leftShift","rightArithShift","rightLogShift"]};
},{}],"T9yh":[function(require,module,exports) {
"use strict";module.exports={name:"leftShift",category:"Bitwise",syntax:["x << y","leftShift(x, y)"],description:"Bitwise left logical shift of a value x by y number of bits.",examples:["4 << 1","8 >> 1"],seealso:["bitAnd","bitNot","bitOr","bitXor","rightArithShift","rightLogShift"]};
},{}],"ZNwk":[function(require,module,exports) {
"use strict";module.exports={name:"rightArithShift",category:"Bitwise",syntax:["x >> y","rightArithShift(x, y)"],description:"Bitwise right arithmetic shift of a value x by y number of bits.",examples:["8 >> 1","4 << 1","-12 >> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightLogShift"]};
},{}],"XUC6":[function(require,module,exports) {
"use strict";module.exports={name:"rightLogShift",category:"Bitwise",syntax:["x >>> y","rightLogShift(x, y)"],description:"Bitwise right logical shift of a value x by y number of bits.",examples:["8 >>> 1","4 << 1","-12 >>> 2"],seealso:["bitAnd","bitNot","bitOr","bitXor","leftShift","rightArithShift"]};
},{}],"a5Km":[function(require,module,exports) {
"use strict";module.exports={name:"bellNumbers",category:"Combinatorics",syntax:["bellNumbers(n)"],description:"The Bell Numbers count the number of partitions of a set. A partition is a pairwise disjoint subset of S whose union is S. `bellNumbers` only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["bellNumbers(3)","bellNumbers(8)"],seealso:["stirlingS2"]};
},{}],"gEl1":[function(require,module,exports) {
"use strict";module.exports={name:"catalan",category:"Combinatorics",syntax:["catalan(n)"],description:"The Catalan Numbers enumerate combinatorial structures of many different types. catalan only takes integer arguments. The following condition must be enforced: n >= 0.",examples:["catalan(3)","catalan(8)"],seealso:["bellNumbers"]};
},{}],"oDTX":[function(require,module,exports) {
"use strict";module.exports={name:"composition",category:"Combinatorics",syntax:["composition(n, k)"],description:"The composition counts of n into k parts. composition only takes integer arguments. The following condition must be enforced: k <= n.",examples:["composition(5, 3)"],seealso:["combinations"]};
},{}],"sdgX":[function(require,module,exports) {
"use strict";module.exports={name:"stirlingS2",category:"Combinatorics",syntax:["stirlingS2(n, k)"],description:"he Stirling numbers of the second kind, counts the number of ways to partition a set of n labelled objects into k nonempty unlabelled subsets. `stirlingS2` only takes integer arguments. The following condition must be enforced: k <= n. If n = k or k = 1, then s(n,k) = 1.",examples:["stirlingS2(5, 3)"],seealso:["bellNumbers"]};
},{}],"DO71":[function(require,module,exports) {
"use strict";module.exports={name:"config",category:"Core",syntax:["config()","config(options)"],description:"Get configuration or change configuration.",examples:["config()","1/3 + 1/4",'config({number: "Fraction"})',"1/3 + 1/4"],seealso:[]};
},{}],"ZwB0":[function(require,module,exports) {
"use strict";module.exports={name:"import",category:"Core",syntax:["import(functions)","import(functions, options)"],description:"Import functions or constants from an object.",examples:["import({myFn: f(x)=x^2, myConstant: 32 })","myFn(2)","myConstant"],seealso:[]};
},{}],"Shzo":[function(require,module,exports) {
"use strict";module.exports={name:"typed",category:"Core",syntax:["typed(signatures)","typed(name, signatures)"],description:"Create a typed function.",examples:['double = typed({ "number, number": f(x)=x+x })',"double(2)",'double("hello")'],seealso:[]};
},{}],"DVdV":[function(require,module,exports) {
"use strict";module.exports={name:"arg",category:"Complex",syntax:["arg(x)"],description:"Compute the argument of a complex value. If x = a+bi, the argument is computed as atan2(b, a).",examples:["arg(2 + 2i)","atan2(3, 2)","arg(2 + 3i)"],seealso:["re","im","conj","abs"]};
},{}],"Wmy6":[function(require,module,exports) {
"use strict";module.exports={name:"conj",category:"Complex",syntax:["conj(x)"],description:"Compute the complex conjugate of a complex value. If x = a+bi, the complex conjugate is a-bi.",examples:["conj(2 + 3i)","conj(2 - 3i)","conj(-5.2i)"],seealso:["re","im","abs","arg"]};
},{}],"zwHi":[function(require,module,exports) {
"use strict";module.exports={name:"re",category:"Complex",syntax:["re(x)"],description:"Get the real part of a complex number.",examples:["re(2 + 3i)","im(2 + 3i)","re(-5.2i)","re(2.4)"],seealso:["im","conj","abs","arg"]};
},{}],"QAET":[function(require,module,exports) {
"use strict";module.exports={name:"im",category:"Complex",syntax:["im(x)"],description:"Get the imaginary part of a complex number.",examples:["im(2 + 3i)","re(2 + 3i)","im(-5.2i)","im(2.4)"],seealso:["re","conj","abs","arg"]};
},{}],"bVEH":[function(require,module,exports) {
"use strict";module.exports={name:"eval",category:"Expression",syntax:["eval(expression)","eval([expr1, expr2, expr3, ...])"],description:"Evaluate an expression or an array with expressions.",examples:['eval("2 + 3")','eval("sqrt(" + 4 + ")")'],seealso:[]};
},{}],"Fax8":[function(require,module,exports) {
"use strict";module.exports={name:"help",category:"Expression",syntax:["help(object)","help(string)"],description:"Display documentation on a function or data type.",examples:["help(sqrt)",'help("complex")'],seealso:[]};
},{}],"dMW5":[function(require,module,exports) {
"use strict";module.exports={name:"distance",category:"Geometry",syntax:["distance([x1, y1], [x2, y2])","distance([[x1, y1], [x2, y2])"],description:"Calculates the Euclidean distance between two points.",examples:["distance([0,0], [4,4])","distance([[0,0], [4,4]])"],seealso:[]};
},{}],"bVBO":[function(require,module,exports) {
"use strict";module.exports={name:"intersect",category:"Geometry",syntax:["intersect(expr1, expr2, expr3, expr4)","intersect(expr1, expr2, expr3)"],description:"Computes the intersection point of lines and/or planes.",examples:["intersect([0, 0], [10, 10], [10, 0], [0, 10])","intersect([1, 0, 1], [4, -2, 2], [1, 1, 1, 6])"],seealso:[]};
},{}],"AWzT":[function(require,module,exports) {
"use strict";module.exports={name:"and",category:"Logical",syntax:["x and y","and(x, y)"],description:"Logical and. Test whether two values are both defined with a nonzero/nonempty value.",examples:["true and false","true and true","2 and 4"],seealso:["not","or","xor"]};
},{}],"AWWa":[function(require,module,exports) {
"use strict";module.exports={name:"not",category:"Logical",syntax:["not x","not(x)"],description:"Logical not. Flips the boolean value of given argument.",examples:["not true","not false","not 2","not 0"],seealso:["and","or","xor"]};
},{}],"JhOe":[function(require,module,exports) {
"use strict";module.exports={name:"or",category:"Logical",syntax:["x or y","or(x, y)"],description:"Logical or. Test if at least one value is defined with a nonzero/nonempty value.",examples:["true or false","false or false","0 or 4"],seealso:["not","and","xor"]};
},{}],"JMRD":[function(require,module,exports) {
"use strict";module.exports={name:"xor",category:"Logical",syntax:["x xor y","xor(x, y)"],description:"Logical exclusive or, xor. Test whether one and only one value is defined with a nonzero/nonempty value.",examples:["true xor false","false xor false","true xor true","0 xor 4"],seealso:["not","and","or"]};
},{}],"aMEf":[function(require,module,exports) {
"use strict";module.exports={name:"column",category:"Matrix",syntax:["column(x, index)"],description:"Return a column from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","column(A, 1)","column(A, 2)"],seealso:["row"]};
},{}],"q0hB":[function(require,module,exports) {
"use strict";module.exports={name:"concat",category:"Matrix",syntax:["concat(A, B, C, ...)","concat(A, B, C, ..., dim)"],description:"Concatenate matrices. By default, the matrices are concatenated by the last dimension. The dimension on which to concatenate can be provided as last argument.",examples:["A = [1, 2; 5, 6]","B = [3, 4; 7, 8]","concat(A, B)","concat(A, B, 1)","concat(A, B, 2)"],seealso:["det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};
},{}],"IWZn":[function(require,module,exports) {
"use strict";module.exports={name:"cross",category:"Matrix",syntax:["cross(A, B)"],description:"Calculate the cross product for two vectors in three dimensional space.",examples:["cross([1, 1, 0], [0, 1, 1])","cross([3, -3, 1], [4, 9, 2])","cross([2, 3, 4], [5, 6, 7])"],seealso:["multiply","dot"]};
},{}],"nnFv":[function(require,module,exports) {
"use strict";module.exports={name:"transpose",category:"Matrix",syntax:["x'","ctranspose(x)"],description:"Complex Conjugate and Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","ctranspose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};
},{}],"qD6G":[function(require,module,exports) {
"use strict";module.exports={name:"det",category:"Matrix",syntax:["det(x)"],description:"Calculate the determinant of a matrix",examples:["det([1, 2; 3, 4])","det([-2, 2, 3; -1, 1, 3; 2, 0, -1])"],seealso:["concat","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};
},{}],"UQh1":[function(require,module,exports) {
"use strict";module.exports={name:"diag",category:"Matrix",syntax:["diag(x)","diag(x, k)"],description:"Create a diagonal matrix or retrieve the diagonal of a matrix. When x is a vector, a matrix with the vector values on the diagonal will be returned. When x is a matrix, a vector with the diagonal values of the matrix is returned. When k is provided, the k-th diagonal will be filled in or retrieved, if k is positive, the values are placed on the super diagonal. When k is negative, the values are placed on the sub diagonal.",examples:["diag(1:3)","diag(1:3, 1)","a = [1, 2, 3; 4, 5, 6; 7, 8, 9]","diag(a)"],seealso:["concat","det","identity","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};
},{}],"BlyW":[function(require,module,exports) {
"use strict";module.exports={name:"dot",category:"Matrix",syntax:["dot(A, B)","A * B"],description:"Calculate the dot product of two vectors. The dot product of A = [a1, a2, a3, ..., an] and B = [b1, b2, b3, ..., bn] is defined as dot(A, B) = a1 * b1 + a2 * b2 + a3 * b3 + ... + an * bn",examples:["dot([2, 4, 1], [2, 2, 3])","[2, 4, 1] * [2, 2, 3]"],seealso:["multiply","cross"]};
},{}],"bnMU":[function(require,module,exports) {
"use strict";module.exports={name:"getMatrixDataType",category:"Matrix",syntax:["getMatrixDataType(x)"],description:'Find the data type of all elements in a matrix or array, for example "number" if all items are a number and "Complex" if all values are complex numbers. If a matrix contains more than one data type, it will return "mixed".',examples:["getMatrixDataType([1, 2, 3])","getMatrixDataType([[5 cm], [2 inch]])",'getMatrixDataType([1, "text"])',"getMatrixDataType([1, bignumber(4)])"],seealso:["matrix","sparse","typeof"]};
},{}],"iJ3P":[function(require,module,exports) {
"use strict";module.exports={name:"identity",category:"Matrix",syntax:["identity(n)","identity(m, n)","identity([m, n])"],description:"Returns the identity matrix with size m-by-n. The matrix has ones on the diagonal and zeros elsewhere.",examples:["identity(3)","identity(3, 5)","a = [1, 2, 3; 4, 5, 6]","identity(size(a))"],seealso:["concat","det","diag","inv","ones","range","size","squeeze","subset","trace","transpose","zeros"]};
},{}],"CckY":[function(require,module,exports) {
"use strict";module.exports={name:"filter",category:"Matrix",syntax:["filter(x, test)"],description:"Filter items in a matrix.",examples:["isPositive(x) = x > 0","filter([6, -2, -1, 4, 3], isPositive)","filter([6, -2, 0, 1, 0], x != 0)"],seealso:["sort","map","forEach"]};
},{}],"UmBd":[function(require,module,exports) {
"use strict";module.exports={name:"flatten",category:"Matrix",syntax:["flatten(x)"],description:"Flatten a multi dimensional matrix into a single dimensional matrix.",examples:["a = [1, 2, 3; 4, 5, 6]","size(a)","b = flatten(a)","size(b)"],seealso:["concat","resize","size","squeeze"]};
},{}],"l4FK":[function(require,module,exports) {
"use strict";module.exports={name:"forEach",category:"Matrix",syntax:["forEach(x, callback)"],description:"Iterates over all elements of a matrix/array, and executes the given callback function.",examples:["forEach([1, 2, 3], function(val) { console.log(val) })"],seealso:["map","sort","filter"]};
},{}],"DDDN":[function(require,module,exports) {
"use strict";module.exports={name:"inv",category:"Matrix",syntax:["inv(x)"],description:"Calculate the inverse of a matrix",examples:["inv([1, 2; 3, 4])","inv(4)","1 / 4"],seealso:["concat","det","diag","identity","ones","range","size","squeeze","subset","trace","transpose","zeros"]};
},{}],"DU2x":[function(require,module,exports) {
"use strict";module.exports={name:"kron",category:"Matrix",syntax:["kron(x, y)"],description:"Calculates the kronecker product of 2 matrices or vectors.",examples:["kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])","kron([1,1], [2,3,4])"],seealso:["multiply","dot","cross"]};
},{}],"oHAh":[function(require,module,exports) {
"use strict";module.exports={name:"map",category:"Matrix",syntax:["map(x, callback)"],description:"Create a new matrix or array with the results of the callback function executed on each entry of the matrix/array.",examples:["map([1, 2, 3], square)"],seealso:["filter","forEach"]};
},{}],"fbw8":[function(require,module,exports) {
"use strict";module.exports={name:"ones",category:"Matrix",syntax:["ones(m)","ones(m, n)","ones(m, n, p, ...)","ones([m])","ones([m, n])","ones([m, n, p, ...])"],description:"Create a matrix containing ones.",examples:["ones(3)","ones(3, 5)","ones([2,3]) * 4.5","a = [1, 2, 3; 4, 5, 6]","ones(size(a))"],seealso:["concat","det","diag","identity","inv","range","size","squeeze","subset","trace","transpose","zeros"]};
},{}],"fQm4":[function(require,module,exports) {
"use strict";module.exports={name:"partitionSelect",category:"Matrix",syntax:["partitionSelect(x, k)","partitionSelect(x, k, compare)"],description:"Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.",examples:["partitionSelect([5, 10, 1], 2)",'partitionSelect(["C", "B", "A", "D"], 1)'],seealso:["sort"]};
},{}],"NLcZ":[function(require,module,exports) {
"use strict";module.exports={name:"range",category:"Type",syntax:["start:end","start:step:end","range(start, end)","range(start, end, step)","range(string)"],description:"Create a range. Lower bound of the range is included, upper bound is excluded.",examples:["1:5","3:-1:-3","range(3, 7)","range(0, 12, 2)",'range("4:10")',"a = [1, 2, 3, 4; 5, 6, 7, 8]","a[1:2, 1:2]"],seealso:["concat","det","diag","identity","inv","ones","size","squeeze","subset","trace","transpose","zeros"]};
},{}],"tmIl":[function(require,module,exports) {
"use strict";module.exports={name:"resize",category:"Matrix",syntax:["resize(x, size)","resize(x, size, defaultValue)"],description:"Resize a matrix.",examples:["resize([1,2,3,4,5], [3])","resize([1,2,3], [5])","resize([1,2,3], [5], -1)","resize(2, [2, 3])",'resize("hello", [8], "!")'],seealso:["size","subset","squeeze","reshape"]};
},{}],"DOEY":[function(require,module,exports) {
"use strict";module.exports={name:"reshape",category:"Matrix",syntax:["reshape(x, sizes)"],description:"Reshape a multi dimensional array to fit the specified dimensions.",examples:["reshape([1, 2, 3, 4, 5, 6], [2, 3])","reshape([[1, 2], [3, 4]], [1, 4])","reshape([[1, 2], [3, 4]], [4])"],seealso:["size","squeeze","resize"]};
},{}],"FNOD":[function(require,module,exports) {
"use strict";module.exports={name:"row",category:"Matrix",syntax:["row(x, index)"],description:"Return a row from a matrix or array.",examples:["A = [[1, 2], [3, 4]]","row(A, 1)","row(A, 2)"],seealso:["column"]};
},{}],"lVw7":[function(require,module,exports) {
"use strict";module.exports={name:"size",category:"Matrix",syntax:["size(x)"],description:"Calculate the size of a matrix.",examples:["size(2.3)",'size("hello world")',"a = [1, 2; 3, 4; 5, 6]","size(a)","size(1:6)"],seealso:["concat","det","diag","identity","inv","ones","range","squeeze","subset","trace","transpose","zeros"]};
},{}],"bGuK":[function(require,module,exports) {
"use strict";module.exports={name:"sort",category:"Matrix",syntax:["sort(x)","sort(x, compare)"],description:'Sort the items in a matrix. Compare can be a string "asc", "desc", "natural", or a custom sort function.',examples:["sort([5, 10, 1])",'sort(["C", "B", "A", "D"])',"sortByLength(a, b) = size(a)[1] - size(b)[1]",'sort(["Langdon", "Tom", "Sara"], sortByLength)','sort(["10", "1", "2"], "natural")'],seealso:["map","filter","forEach"]};
},{}],"MpqE":[function(require,module,exports) {
"use strict";module.exports={name:"squeeze",category:"Matrix",syntax:["squeeze(x)"],description:"Remove inner and outer singleton dimensions from a matrix.",examples:["a = zeros(3,2,1)","size(squeeze(a))","b = zeros(1,1,3)","size(squeeze(b))"],seealso:["concat","det","diag","identity","inv","ones","range","size","subset","trace","transpose","zeros"]};
},{}],"WRJB":[function(require,module,exports) {
"use strict";module.exports={name:"subset",category:"Matrix",syntax:["value(index)","value(index) = replacement","subset(value, [index])","subset(value, [index], replacement)"],description:"Get or set a subset of a matrix or string. Indexes are one-based. Both the ranges lower-bound and upper-bound are included.",examples:["d = [1, 2; 3, 4]","e = []","e[1, 1:2] = [5, 6]","e[2, :] = [7, 8]","f = d * e","f[2, 1]","f[:, 1]"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","trace","transpose","zeros"]};
},{}],"nc6c":[function(require,module,exports) {
"use strict";module.exports={name:"trace",category:"Matrix",syntax:["trace(A)"],description:"Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.",examples:["A = [1, 2, 3; -1, 2, 3; 2, 0, 3]","trace(A)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","transpose","zeros"]};
},{}],"fj0p":[function(require,module,exports) {
"use strict";module.exports={name:"transpose",category:"Matrix",syntax:["x'","transpose(x)"],description:"Transpose a matrix",examples:["a = [1, 2, 3; 4, 5, 6]","a'","transpose(a)"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","zeros"]};
},{}],"nFaR":[function(require,module,exports) {
"use strict";module.exports={name:"zeros",category:"Matrix",syntax:["zeros(m)","zeros(m, n)","zeros(m, n, p, ...)","zeros([m])","zeros([m, n])","zeros([m, n, p, ...])"],description:"Create a matrix containing zeros.",examples:["zeros(3)","zeros(3, 5)","a = [1, 2, 3; 4, 5, 6]","zeros(size(a))"],seealso:["concat","det","diag","identity","inv","ones","range","size","squeeze","subset","trace","transpose"]};
},{}],"M4Fz":[function(require,module,exports) {
"use strict";module.exports={name:"combinations",category:"Probability",syntax:["combinations(n, k)"],description:"Compute the number of combinations of n items taken k at a time",examples:["combinations(7, 5)"],seealso:["permutations","factorial"]};
},{}],"cbU5":[function(require,module,exports) {
"use strict";module.exports={name:"factorial",category:"Probability",syntax:["n!","factorial(n)"],description:"Compute the factorial of a value",examples:["5!","5 * 4 * 3 * 2 * 1","3!"],seealso:["combinations","permutations","gamma"]};
},{}],"mIdZ":[function(require,module,exports) {
"use strict";module.exports={name:"gamma",category:"Probability",syntax:["gamma(n)"],description:"Compute the gamma function. For small values, the Lanczos approximation is used, and for large values the extended Stirling approximation.",examples:["gamma(4)","3!","gamma(1/2)","sqrt(pi)"],seealso:["factorial"]};
},{}],"W9Q9":[function(require,module,exports) {
"use strict";module.exports={name:"kldivergence",category:"Probability",syntax:["kldivergence(x, y)"],description:"Calculate the Kullback-Leibler (KL) divergence between two distributions.",examples:["kldivergence([0.7,0.5,0.4], [0.2,0.9,0.5])"],seealso:[]};
},{}],"y9uR":[function(require,module,exports) {
"use strict";module.exports={name:"multinomial",category:"Probability",syntax:["multinomial(A)"],description:"Multinomial Coefficients compute the number of ways of picking a1, a2, ..., ai unordered outcomes from `n` possibilities. multinomial takes one array of integers as an argument. The following condition must be enforced: every ai > 0.",examples:["multinomial([1, 2, 1])"],seealso:["combinations","factorial"]};
},{}],"qGLJ":[function(require,module,exports) {
"use strict";module.exports={name:"permutations",category:"Probability",syntax:["permutations(n)","permutations(n, k)"],description:"Compute the number of permutations of n items taken k at a time",examples:["permutations(5)","permutations(5, 3)"],seealso:["combinations","factorial"]};
},{}],"iKEH":[function(require,module,exports) {
"use strict";module.exports={name:"pickRandom",category:"Probability",syntax:["pickRandom(array)","pickRandom(array, number)","pickRandom(array, weights)","pickRandom(array, number, weights)","pickRandom(array, weights, number)"],description:"Pick a random entry from a given array.",examples:["pickRandom(0:10)","pickRandom([1, 3, 1, 6])","pickRandom([1, 3, 1, 6], 2)","pickRandom([1, 3, 1, 6], [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], 2, [2, 3, 2, 1])","pickRandom([1, 3, 1, 6], [2, 3, 2, 1], 2)"],seealso:["random","randomInt"]};
},{}],"pXBT":[function(require,module,exports) {
"use strict";module.exports={name:"random",category:"Probability",syntax:["random()","random(max)","random(min, max)","random(size)","random(size, max)","random(size, min, max)"],description:"Return a random number.",examples:["random()","random(10, 20)","random([2, 3])"],seealso:["pickRandom","randomInt"]};
},{}],"fj2Q":[function(require,module,exports) {
"use strict";module.exports={name:"randomInt",category:"Probability",syntax:["randomInt(max)","randomInt(min, max)","randomInt(size)","randomInt(size, max)","randomInt(size, min, max)"],description:"Return a random integer number",examples:["randomInt(10, 20)","randomInt([2, 3], 10)"],seealso:["pickRandom","random"]};
},{}],"jKwP":[function(require,module,exports) {
"use strict";module.exports={name:"compare",category:"Relational",syntax:["compare(x, y)"],description:"Compare two values. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compare(2, 3)","compare(3, 2)","compare(2, 2)","compare(5cm, 40mm)","compare(2, [1, 2, 3])"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compareNatural","compareText"]};
},{}],"JLzY":[function(require,module,exports) {
"use strict";module.exports={name:"compareNatural",category:"Relational",syntax:["compareNatural(x, y)"],description:"Compare two values of any type in a deterministic, natural way. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:["compareNatural(2, 3)","compareNatural(3, 2)","compareNatural(2, 2)","compareNatural(5cm, 40mm)",'compareNatural("2", "10")',"compareNatural(2 + 3i, 2 + 4i)","compareNatural([1, 2, 4], [1, 2, 3])","compareNatural([1, 5], [1, 2, 3])","compareNatural([1, 2], [1, 2])","compareNatural({a: 2}, {a: 4})"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare","compareText"]};
},{}],"Bmmt":[function(require,module,exports) {
"use strict";module.exports={name:"compareText",category:"Relational",syntax:["compareText(x, y)"],description:"Compare two strings lexically. Comparison is case sensitive. Returns 1 when x > y, -1 when x < y, and 0 when x == y.",examples:['compareText("B", "A")','compareText("A", "B")','compareText("A", "A")','compareText("2", "10")','compare("2", "10")',"compare(2, 10)",'compareNatural("2", "10")','compareText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural"]};
},{}],"bLpw":[function(require,module,exports) {
"use strict";module.exports={name:"deepEqual",category:"Relational",syntax:["deepEqual(x, y)"],description:"Check equality of two matrices element wise. Returns true if the size of both matrices is equal and when and each of the elements are equal.",examples:["deepEqual([1,3,4], [1,3,4])","deepEqual([1,3,4], [1,3])"],seealso:["equal","unequal","smaller","larger","smallerEq","largerEq","compare"]};
},{}],"wgSR":[function(require,module,exports) {
"use strict";module.exports={name:"equal",category:"Relational",syntax:["x == y","equal(x, y)"],description:"Check equality of two values. Returns true if the values are equal, and false if not.",examples:["2+2 == 3","2+2 == 4","a = 3.2","b = 6-2.8","a == b","50cm == 0.5m"],seealso:["unequal","smaller","larger","smallerEq","largerEq","compare","deepEqual","equalText"]};
},{}],"HVZA":[function(require,module,exports) {
"use strict";module.exports={name:"equalText",category:"Relational",syntax:["equalText(x, y)"],description:"Check equality of two strings. Comparison is case sensitive. Returns true if the values are equal, and false if not.",examples:['equalText("Hello", "Hello")','equalText("a", "A")','equal("2e3", "2000")','equalText("2e3", "2000")','equalText("B", ["A", "B", "C"])'],seealso:["compare","compareNatural","compareText","equal"]};
},{}],"TH74":[function(require,module,exports) {
"use strict";module.exports={name:"larger",category:"Relational",syntax:["x > y","larger(x, y)"],description:"Check if value x is larger than y. Returns true if x is larger than y, and false if not.",examples:["2 > 3","5 > 2*2","a = 3.3","b = 6-2.8","(a > b)","(b < a)","5 cm > 2 inch"],seealso:["equal","unequal","smaller","smallerEq","largerEq","compare"]};
},{}],"hahd":[function(require,module,exports) {
"use strict";module.exports={name:"largerEq",category:"Relational",syntax:["x >= y","largerEq(x, y)"],description:"Check if value x is larger or equal to y. Returns true if x is larger or equal to y, and false if not.",examples:["2 >= 1+1","2 > 1+1","a = 3.2","b = 6-2.8","(a >= b)"],seealso:["equal","unequal","smallerEq","smaller","compare"]};
},{}],"iBZ4":[function(require,module,exports) {
"use strict";module.exports={name:"smaller",category:"Relational",syntax:["x < y","smaller(x, y)"],description:"Check if value x is smaller than value y. Returns true if x is smaller than y, and false if not.",examples:["2 < 3","5 < 2*2","a = 3.3","b = 6-2.8","(a < b)","5 cm < 2 inch"],seealso:["equal","unequal","larger","smallerEq","largerEq","compare"]};
},{}],"Ob6s":[function(require,module,exports) {
"use strict";module.exports={name:"smallerEq",category:"Relational",syntax:["x <= y","smallerEq(x, y)"],description:"Check if value x is smaller or equal to value y. Returns true if x is smaller than y, and false if not.",examples:["2 <= 1+1","2 < 1+1","a = 3.2","b = 6-2.8","(a <= b)"],seealso:["equal","unequal","larger","smaller","largerEq","compare"]};
},{}],"kwrJ":[function(require,module,exports) {
"use strict";module.exports={name:"unequal",category:"Relational",syntax:["x != y","unequal(x, y)"],description:"Check unequality of two values. Returns true if the values are unequal, and false if they are equal.",examples:["2+2 != 3","2+2 != 4","a = 3.2","b = 6-2.8","a != b","50cm != 0.5m","5 cm != 2 inch"],seealso:["equal","smaller","larger","smallerEq","largerEq","compare","deepEqual"]};
},{}],"qllh":[function(require,module,exports) {
"use strict";module.exports={name:"setCartesian",category:"Set",syntax:["setCartesian(set1, set2)"],description:"Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setCartesian([1, 2], [3, 4])"],seealso:["setUnion","setIntersect","setDifference","setPowerset"]};
},{}],"jaWL":[function(require,module,exports) {
"use strict";module.exports={name:"setDifference",category:"Set",syntax:["setDifference(set1, set2)"],description:"Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setDifference([1, 2, 3, 4], [3, 4, 5, 6])","setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setSymDifference"]};
},{}],"VDoP":[function(require,module,exports) {
"use strict";module.exports={name:"setDistinct",category:"Set",syntax:["setDistinct(set)"],description:"Collect the distinct elements of a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setDistinct([1, 1, 1, 2, 2, 3])"],seealso:["setMultiplicity"]};
},{}],"kvfp":[function(require,module,exports) {
"use strict";module.exports={name:"setIntersect",category:"Set",syntax:["setIntersect(set1, set2)"],description:"Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIntersect([1, 2, 3, 4], [3, 4, 5, 6])","setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setDifference"]};
},{}],"XvM6":[function(require,module,exports) {
"use strict";module.exports={name:"setIsSubset",category:"Set",syntax:["setIsSubset(set1, set2)"],description:"Check whether a (multi)set is a subset of another (multi)set: every element of set1 is the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setIsSubset([1, 2], [3, 4, 5, 6])","setIsSubset([3, 4], [3, 4, 5, 6])"],seealso:["setUnion","setIntersect","setDifference"]};
},{}],"sMXh":[function(require,module,exports) {
"use strict";module.exports={name:"setMultiplicity",category:"Set",syntax:["setMultiplicity(element, set)"],description:"Count the multiplicity of an element in a multiset. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setMultiplicity(1, [1, 2, 2, 4])","setMultiplicity(2, [1, 2, 2, 4])"],seealso:["setDistinct","setSize"]};
},{}],"rmtw":[function(require,module,exports) {
"use strict";module.exports={name:"setPowerset",category:"Set",syntax:["setPowerset(set)"],description:"Create the powerset of a (multi)set: the powerset contains very possible subsets of a (multi)set. A multi-dimension array will be converted to a single-dimension array before the operation.",examples:["setPowerset([1, 2, 3])"],seealso:["setCartesian"]};
},{}],"AYWb":[function(require,module,exports) {
"use strict";module.exports={name:"setSize",category:"Set",syntax:["setSize(set)","setSize(set, unique)"],description:'Count the number of elements of a (multi)set. When the second parameter "unique" is true, count only the unique values. A multi-dimension array will be converted to a single-dimension array before the operation.',examples:["setSize([1, 2, 2, 4])","setSize([1, 2, 2, 4], true)"],seealso:["setUnion","setIntersect","setDifference"]};
},{}],"reLj":[function(require,module,exports) {
"use strict";module.exports={name:"setSymDifference",category:"Set",syntax:["setSymDifference(set1, set2)"],description:"Create the symmetric difference of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setSymDifference([1, 2, 3, 4], [3, 4, 5, 6])","setSymDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setUnion","setIntersect","setDifference"]};
},{}],"Wqu5":[function(require,module,exports) {
"use strict";module.exports={name:"setUnion",category:"Set",syntax:["setUnion(set1, set2)"],description:"Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.",examples:["setUnion([1, 2, 3, 4], [3, 4, 5, 6])","setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]])"],seealso:["setIntersect","setDifference"]};
},{}],"NbhS":[function(require,module,exports) {
"use strict";module.exports={name:"erf",category:"Special",syntax:["erf(x)"],description:"Compute the erf function of a value using a rational Chebyshev approximations for different intervals of x",examples:["erf(0.2)","erf(-0.5)","erf(4)"],seealso:[]};
},{}],"EtYx":[function(require,module,exports) {
"use strict";module.exports={name:"mad",category:"Statistics",syntax:["mad(a, b, c, ...)","mad(A)"],description:"Compute the median absolute deviation of a matrix or a list with values. The median absolute deviation is defined as the median of the absolute deviations from the median.",examples:["mad(10, 20, 30)","mad([1, 2, 3])"],seealso:["mean","median","std","abs"]};
},{}],"L2AM":[function(require,module,exports) {
"use strict";module.exports={name:"max",category:"Statistics",syntax:["max(a, b, c, ...)","max(A)","max(A, dim)"],description:"Compute the maximum value of a list of values.",examples:["max(2, 3, 4, 1)","max([2, 3, 4, 1])","max([2, 5; 4, 3])","max([2, 5; 4, 3], 1)","max([2, 5; 4, 3], 2)","max(2.7, 7.1, -4.5, 2.0, 4.1)","min(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["mean","median","min","prod","std","sum","var"]};
},{}],"qRED":[function(require,module,exports) {
"use strict";module.exports={name:"mean",category:"Statistics",syntax:["mean(a, b, c, ...)","mean(A)","mean(A, dim)"],description:"Compute the arithmetic mean of a list of values.",examples:["mean(2, 3, 4, 1)","mean([2, 3, 4, 1])","mean([2, 5; 4, 3])","mean([2, 5; 4, 3], 1)","mean([2, 5; 4, 3], 2)","mean([1.0, 2.7, 3.2, 4.0])"],seealso:["max","median","min","prod","std","sum","var"]};
},{}],"nYR2":[function(require,module,exports) {
"use strict";module.exports={name:"median",category:"Statistics",syntax:["median(a, b, c, ...)","median(A)"],description:"Compute the median of all values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned.",examples:["median(5, 2, 7)","median([3, -1, 5, 7])"],seealso:["max","mean","min","prod","std","sum","var","quantileSeq"]};
},{}],"xrLZ":[function(require,module,exports) {
"use strict";module.exports={name:"min",category:"Statistics",syntax:["min(a, b, c, ...)","min(A)","min(A, dim)"],description:"Compute the minimum value of a list of values.",examples:["min(2, 3, 4, 1)","min([2, 3, 4, 1])","min([2, 5; 4, 3])","min([2, 5; 4, 3], 1)","min([2, 5; 4, 3], 2)","min(2.7, 7.1, -4.5, 2.0, 4.1)","max(2.7, 7.1, -4.5, 2.0, 4.1)"],seealso:["max","mean","median","prod","std","sum","var"]};
},{}],"yBPR":[function(require,module,exports) {
"use strict";module.exports={name:"mode",category:"Statistics",syntax:["mode(a, b, c, ...)","mode(A)","mode(A, a, b, B, c, ...)"],description:"Computes the mode of all values as an array. In case mode being more than one, multiple values are returned in an array.",examples:["mode(2, 1, 4, 3, 1)","mode([1, 2.7, 3.2, 4, 2.7])","mode(1, 4, 6, 1, 6)"],seealso:["max","mean","min","median","prod","std","sum","var"]};
},{}],"NCYX":[function(require,module,exports) {
"use strict";module.exports={name:"prod",category:"Statistics",syntax:["prod(a, b, c, ...)","prod(A)"],description:"Compute the product of all values.",examples:["prod(2, 3, 4)","prod([2, 3, 4])","prod([2, 5; 4, 3])"],seealso:["max","mean","min","median","min","std","sum","var"]};
},{}],"Gbgi":[function(require,module,exports) {
"use strict";module.exports={name:"quantileSeq",category:"Statistics",syntax:["quantileSeq(A, prob[, sorted])","quantileSeq(A, [prob1, prob2, ...][, sorted])","quantileSeq(A, N[, sorted])"],description:"Compute the prob order quantile of a matrix or a list with values. The sequence is sorted and the middle value is returned. Supported types of sequence values are: Number, BigNumber, Unit Supported types of probablity are: Number, BigNumber. \n\nIn case of a (multi dimensional) array or matrix, the prob order quantile of all elements will be calculated.",examples:["quantileSeq([3, -1, 5, 7], 0.5)","quantileSeq([3, -1, 5, 7], [1/3, 2/3])","quantileSeq([3, -1, 5, 7], 2)","quantileSeq([-1, 3, 5, 7], 0.5, true)"],seealso:["mean","median","min","max","prod","std","sum","var"]};
},{}],"uXlw":[function(require,module,exports) {
"use strict";module.exports={name:"std",category:"Statistics",syntax:["std(a, b, c, ...)","std(A)","std(A, normalization)"],description:'Compute the standard deviation of all values, defined as std(A) = sqrt(var(A)). Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["std(2, 4, 6)","std([2, 4, 6, 8])",'std([2, 4, 6, 8], "uncorrected")','std([2, 4, 6, 8], "biased")',"std([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","sum","var"]};
},{}],"qyn0":[function(require,module,exports) {
"use strict";module.exports={name:"sum",category:"Statistics",syntax:["sum(a, b, c, ...)","sum(A)"],description:"Compute the sum of all values.",examples:["sum(2, 3, 4, 1)","sum([2, 3, 4, 1])","sum([2, 5; 4, 3])"],seealso:["max","mean","median","min","prod","std","sum","var"]};
},{}],"siyP":[function(require,module,exports) {
"use strict";module.exports={name:"var",category:"Statistics",syntax:["var(a, b, c, ...)","var(A)","var(A, normalization)"],description:'Compute the variance of all values. Optional parameter normalization can be "unbiased" (default), "uncorrected", or "biased".',examples:["var(2, 4, 6)","var([2, 4, 6, 8])",'var([2, 4, 6, 8], "uncorrected")','var([2, 4, 6, 8], "biased")',"var([1, 2, 3; 4, 5, 6])"],seealso:["max","mean","min","median","min","prod","std","sum"]};
},{}],"HPVa":[function(require,module,exports) {
"use strict";module.exports={name:"acos",category:"Trigonometry",syntax:["acos(x)"],description:"Compute the inverse cosine of a value in radians.",examples:["acos(0.5)","acos(cos(2.3))"],seealso:["cos","atan","asin"]};
},{}],"MvCO":[function(require,module,exports) {
"use strict";module.exports={name:"acosh",category:"Trigonometry",syntax:["acosh(x)"],description:"Calculate the hyperbolic arccos of a value, defined as `acosh(x) = ln(sqrt(x^2 - 1) + x)`.",examples:["acosh(1.5)"],seealso:["cosh","asinh","atanh"]};
},{}],"xXPM":[function(require,module,exports) {
"use strict";module.exports={name:"acot",category:"Trigonometry",syntax:["acot(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acot(0.5)","acot(cot(0.5))","acot(2)"],seealso:["cot","atan"]};
},{}],"KpnL":[function(require,module,exports) {
"use strict";module.exports={name:"acoth",category:"Trigonometry",syntax:["acoth(x)"],description:"Calculate the hyperbolic arccotangent of a value, defined as `acoth(x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.",examples:["acoth(2)","acoth(0.5)"],seealso:["acsch","asech"]};
},{}],"Gt5T":[function(require,module,exports) {
"use strict";module.exports={name:"acsc",category:"Trigonometry",syntax:["acsc(x)"],description:"Calculate the inverse cotangent of a value.",examples:["acsc(2)","acsc(csc(0.5))","acsc(0.5)"],seealso:["csc","asin","asec"]};
},{}],"XLHb":[function(require,module,exports) {
"use strict";module.exports={name:"acsch",category:"Trigonometry",syntax:["acsch(x)"],description:"Calculate the hyperbolic arccosecant of a value, defined as `acsch(x) = ln(1/x + sqrt(1/x^2 + 1))`.",examples:["acsch(0.5)"],seealso:["asech","acoth"]};
},{}],"uxTA":[function(require,module,exports) {
"use strict";module.exports={name:"asec",category:"Trigonometry",syntax:["asec(x)"],description:"Calculate the inverse secant of a value.",examples:["asec(0.5)","asec(sec(0.5))","asec(2)"],seealso:["acos","acot","acsc"]};
},{}],"eRMa":[function(require,module,exports) {
"use strict";module.exports={name:"asech",category:"Trigonometry",syntax:["asech(x)"],description:"Calculate the inverse secant of a value.",examples:["asech(0.5)"],seealso:["acsch","acoth"]};
},{}],"M9R8":[function(require,module,exports) {
"use strict";module.exports={name:"asin",category:"Trigonometry",syntax:["asin(x)"],description:"Compute the inverse sine of a value in radians.",examples:["asin(0.5)","asin(sin(0.5))"],seealso:["sin","acos","atan"]};
},{}],"qY7D":[function(require,module,exports) {
"use strict";module.exports={name:"asinh",category:"Trigonometry",syntax:["asinh(x)"],description:"Calculate the hyperbolic arcsine of a value, defined as `asinh(x) = ln(x + sqrt(x^2 + 1))`.",examples:["asinh(0.5)"],seealso:["acosh","atanh"]};
},{}],"s9IB":[function(require,module,exports) {
"use strict";module.exports={name:"atan",category:"Trigonometry",syntax:["atan(x)"],description:"Compute the inverse tangent of a value in radians.",examples:["atan(0.5)","atan(tan(0.5))"],seealso:["tan","acos","asin"]};
},{}],"fjot":[function(require,module,exports) {
"use strict";module.exports={name:"atanh",category:"Trigonometry",syntax:["atanh(x)"],description:"Calculate the hyperbolic arctangent of a value, defined as `atanh(x) = ln((1 + x)/(1 - x)) / 2`.",examples:["atanh(0.5)"],seealso:["acosh","asinh"]};
},{}],"Z7HZ":[function(require,module,exports) {
"use strict";module.exports={name:"atan2",category:"Trigonometry",syntax:["atan2(y, x)"],description:"Computes the principal value of the arc tangent of y/x in radians.",examples:["atan2(2, 2) / pi","angle = 60 deg in rad","x = cos(angle)","y = sin(angle)","atan2(y, x)"],seealso:["sin","cos","tan"]};
},{}],"DWzk":[function(require,module,exports) {
"use strict";module.exports={name:"cos",category:"Trigonometry",syntax:["cos(x)"],description:"Compute the cosine of x in radians.",examples:["cos(2)","cos(pi / 4) ^ 2","cos(180 deg)","cos(60 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["acos","sin","tan"]};
},{}],"maYo":[function(require,module,exports) {
"use strict";module.exports={name:"cosh",category:"Trigonometry",syntax:["cosh(x)"],description:"Compute the hyperbolic cosine of x in radians.",examples:["cosh(0.5)"],seealso:["sinh","tanh","coth"]};
},{}],"wCAM":[function(require,module,exports) {
"use strict";module.exports={name:"cot",category:"Trigonometry",syntax:["cot(x)"],description:"Compute the cotangent of x in radians. Defined as 1/tan(x)",examples:["cot(2)","1 / tan(2)"],seealso:["sec","csc","tan"]};
},{}],"AM7w":[function(require,module,exports) {
"use strict";module.exports={name:"coth",category:"Trigonometry",syntax:["coth(x)"],description:"Compute the hyperbolic cotangent of x in radians.",examples:["coth(2)","1 / tanh(2)"],seealso:["sech","csch","tanh"]};
},{}],"cTPc":[function(require,module,exports) {
"use strict";module.exports={name:"csc",category:"Trigonometry",syntax:["csc(x)"],description:"Compute the cosecant of x in radians. Defined as 1/sin(x)",examples:["csc(2)","1 / sin(2)"],seealso:["sec","cot","sin"]};
},{}],"uHb4":[function(require,module,exports) {
"use strict";module.exports={name:"csch",category:"Trigonometry",syntax:["csch(x)"],description:"Compute the hyperbolic cosecant of x in radians. Defined as 1/sinh(x)",examples:["csch(2)","1 / sinh(2)"],seealso:["sech","coth","sinh"]};
},{}],"hpuP":[function(require,module,exports) {
"use strict";module.exports={name:"sec",category:"Trigonometry",syntax:["sec(x)"],description:"Compute the secant of x in radians. Defined as 1/cos(x)",examples:["sec(2)","1 / cos(2)"],seealso:["cot","csc","cos"]};
},{}],"WKMm":[function(require,module,exports) {
"use strict";module.exports={name:"sech",category:"Trigonometry",syntax:["sech(x)"],description:"Compute the hyperbolic secant of x in radians. Defined as 1/cosh(x)",examples:["sech(2)","1 / cosh(2)"],seealso:["coth","csch","cosh"]};
},{}],"gPaM":[function(require,module,exports) {
"use strict";module.exports={name:"sin",category:"Trigonometry",syntax:["sin(x)"],description:"Compute the sine of x in radians.",examples:["sin(2)","sin(pi / 4) ^ 2","sin(90 deg)","sin(30 deg)","sin(0.2)^2 + cos(0.2)^2"],seealso:["asin","cos","tan"]};
},{}],"G3av":[function(require,module,exports) {
"use strict";module.exports={name:"sinh",category:"Trigonometry",syntax:["sinh(x)"],description:"Compute the hyperbolic sine of x in radians.",examples:["sinh(0.5)"],seealso:["cosh","tanh"]};
},{}],"N6lO":[function(require,module,exports) {
"use strict";module.exports={name:"tan",category:"Trigonometry",syntax:["tan(x)"],description:"Compute the tangent of x in radians.",examples:["tan(0.5)","sin(0.5) / cos(0.5)","tan(pi / 4)","tan(45 deg)"],seealso:["atan","sin","cos"]};
},{}],"teZk":[function(require,module,exports) {
"use strict";module.exports={name:"tanh",category:"Trigonometry",syntax:["tanh(x)"],description:"Compute the hyperbolic tangent of x in radians.",examples:["tanh(0.5)","sinh(0.5) / cosh(0.5)"],seealso:["sinh","cosh"]};
},{}],"ROe2":[function(require,module,exports) {
"use strict";module.exports={name:"to",category:"Units",syntax:["x to unit","to(x, unit)"],description:"Change the unit of a value.",examples:["5 inch to cm","3.2kg to g","16 bytes in bits"],seealso:[]};
},{}],"I9FW":[function(require,module,exports) {
"use strict";module.exports={name:"clone",category:"Utils",syntax:["clone(x)"],description:"Clone a variable. Creates a copy of primitive variables,and a deep copy of matrices",examples:["clone(3.5)","clone(2 - 4i)","clone(45 deg)","clone([1, 2; 3, 4])",'clone("hello world")'],seealso:[]};
},{}],"gPkx":[function(require,module,exports) {
"use strict";module.exports={name:"format",category:"Utils",syntax:["format(value)","format(value, precision)"],description:"Format a value of any type as string.",examples:["format(2.3)","format(3 - 4i)","format([])","format(pi, 3)"],seealso:["print"]};
},{}],"VF4n":[function(require,module,exports) {
"use strict";module.exports={name:"isNaN",category:"Utils",syntax:["isNaN(x)"],description:"Test whether a value is NaN (not a number)",examples:["isNaN(2)","isNaN(0 / 0)","isNaN(NaN)","isNaN(Infinity)"],seealso:["isNegative","isNumeric","isPositive","isZero"]};
},{}],"rt70":[function(require,module,exports) {
"use strict";module.exports={name:"isInteger",category:"Utils",syntax:["isInteger(x)"],description:"Test whether a value is an integer number.",examples:["isInteger(2)","isInteger(3.5)","isInteger([3, 0.5, -2])"],seealso:["isNegative","isNumeric","isPositive","isZero"]};
},{}],"hspf":[function(require,module,exports) {
"use strict";module.exports={name:"isNegative",category:"Utils",syntax:["isNegative(x)"],description:"Test whether a value is negative: smaller than zero.",examples:["isNegative(2)","isNegative(0)","isNegative(-4)","isNegative([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isPositive","isZero"]};
},{}],"Tqof":[function(require,module,exports) {
"use strict";module.exports={name:"isNumeric",category:"Utils",syntax:["isNumeric(x)"],description:"Test whether a value is a numeric value. Returns true when the input is a number, BigNumber, Fraction, or boolean.",examples:["isNumeric(2)",'isNumeric("2")','hasNumericValue("2")',"isNumeric(0)","isNumeric(bignumber(500))","isNumeric(fraction(0.125))","isNumeric(2 + 3i)",'isNumeric([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","hasNumericValue"]};
},{}],"RYV2":[function(require,module,exports) {
"use strict";module.exports={name:"hasNumericValue",category:"Utils",syntax:["hasNumericValue(x)"],description:"Test whether a value is an numeric value. In case of a string, true is returned if the string contains a numeric value.",examples:["hasNumericValue(2)",'hasNumericValue("2")','isNumeric("2")',"hasNumericValue(0)","hasNumericValue(bignumber(500))","hasNumericValue(fraction(0.125))","hasNumericValue(2 + 3i)",'hasNumericValue([2.3, "foo", false])'],seealso:["isInteger","isZero","isNegative","isPositive","isNaN","isNumeric"]};
},{}],"pq0g":[function(require,module,exports) {
"use strict";module.exports={name:"isPositive",category:"Utils",syntax:["isPositive(x)"],description:"Test whether a value is positive: larger than zero.",examples:["isPositive(2)","isPositive(0)","isPositive(-4)","isPositive([3, 0.5, -2])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};
},{}],"mX5V":[function(require,module,exports) {
"use strict";module.exports={name:"isPrime",category:"Utils",syntax:["isPrime(x)"],description:"Test whether a value is prime: has no divisors other than itself and one.",examples:["isPrime(3)","isPrime(-2)","isPrime([2, 17, 100])"],seealso:["isInteger","isNumeric","isNegative","isZero"]};
},{}],"MHMc":[function(require,module,exports) {
"use strict";module.exports={name:"isZero",category:"Utils",syntax:["isZero(x)"],description:"Test whether a value is zero.",examples:["isZero(2)","isZero(0)","isZero(-4)","isZero([3, 0, -2, 0])"],seealso:["isInteger","isNumeric","isNegative","isPositive"]};
},{}],"v295":[function(require,module,exports) {
"use strict";module.exports={name:"typeof",category:"Utils",syntax:["typeof(x)"],description:"Get the type of a variable.",examples:["typeof(3.5)","typeof(2 - 4i)","typeof(45 deg)",'typeof("hello world")'],seealso:["getMatrixDataType"]};
},{}],"u4GE":[function(require,module,exports) {
"use strict";function e(e,i,t,r){var n={};return n.bignumber=require("./construction/bignumber"),n.boolean=require("./construction/boolean"),n.complex=require("./construction/complex"),n.createUnit=require("./construction/createUnit"),n.fraction=require("./construction/fraction"),n.index=require("./construction/index"),n.matrix=require("./construction/matrix"),n.number=require("./construction/number"),n.sparse=require("./construction/sparse"),n.splitUnit=require("./construction/splitUnit"),n.string=require("./construction/string"),n.unit=require("./construction/unit"),n.e=require("./constants/e"),n.E=require("./constants/e"),n.false=require("./constants/false"),n.i=require("./constants/i"),n[1/0]=require("./constants/Infinity"),n.LN2=require("./constants/LN2"),n.LN10=require("./constants/LN10"),n.LOG2E=require("./constants/LOG2E"),n.LOG10E=require("./constants/LOG10E"),n.NaN=require("./constants/NaN"),n.null=require("./constants/null"),n.pi=require("./constants/pi"),n.PI=require("./constants/pi"),n.phi=require("./constants/phi"),n.SQRT1_2=require("./constants/SQRT1_2"),n.SQRT2=require("./constants/SQRT2"),n.tau=require("./constants/tau"),n.true=require("./constants/true"),n.version=require("./constants/version"),n.speedOfLight={description:"Speed of light in vacuum",examples:["speedOfLight"]},n.gravitationConstant={description:"Newtonian constant of gravitation",examples:["gravitationConstant"]},n.planckConstant={description:"Planck constant",examples:["planckConstant"]},n.reducedPlanckConstant={description:"Reduced Planck constant",examples:["reducedPlanckConstant"]},n.magneticConstant={description:"Magnetic constant (vacuum permeability)",examples:["magneticConstant"]},n.electricConstant={description:"Electric constant (vacuum permeability)",examples:["electricConstant"]},n.vacuumImpedance={description:"Characteristic impedance of vacuum",examples:["vacuumImpedance"]},n.coulomb={description:"Coulomb's constant",examples:["coulomb"]},n.elementaryCharge={description:"Elementary charge",examples:["elementaryCharge"]},n.bohrMagneton={description:"Borh magneton",examples:["bohrMagneton"]},n.conductanceQuantum={description:"Conductance quantum",examples:["conductanceQuantum"]},n.inverseConductanceQuantum={description:"Inverse conductance quantum",examples:["inverseConductanceQuantum"]},n.magneticFluxQuantum={description:"Magnetic flux quantum",examples:["magneticFluxQuantum"]},n.nuclearMagneton={description:"Nuclear magneton",examples:["nuclearMagneton"]},n.klitzing={description:"Von Klitzing constant",examples:["klitzing"]},n.bohrRadius={description:"Borh radius",examples:["bohrRadius"]},n.classicalElectronRadius={description:"Classical electron radius",examples:["classicalElectronRadius"]},n.electronMass={description:"Electron mass",examples:["electronMass"]},n.fermiCoupling={description:"Fermi coupling constant",examples:["fermiCoupling"]},n.fineStructure={description:"Fine-structure constant",examples:["fineStructure"]},n.hartreeEnergy={description:"Hartree energy",examples:["hartreeEnergy"]},n.protonMass={description:"Proton mass",examples:["protonMass"]},n.deuteronMass={description:"Deuteron Mass",examples:["deuteronMass"]},n.neutronMass={description:"Neutron mass",examples:["neutronMass"]},n.quantumOfCirculation={description:"Quantum of circulation",examples:["quantumOfCirculation"]},n.rydberg={description:"Rydberg constant",examples:["rydberg"]},n.thomsonCrossSection={description:"Thomson cross section",examples:["thomsonCrossSection"]},n.weakMixingAngle={description:"Weak mixing angle",examples:["weakMixingAngle"]},n.efimovFactor={description:"Efimov factor",examples:["efimovFactor"]},n.atomicMass={description:"Atomic mass constant",examples:["atomicMass"]},n.avogadro={description:"Avogadro's number",examples:["avogadro"]},n.boltzmann={description:"Boltzmann constant",examples:["boltzmann"]},n.faraday={description:"Faraday constant",examples:["faraday"]},n.firstRadiation={description:"First radiation constant",examples:["firstRadiation"]},n.loschmidt={description:"Loschmidt constant at T=273.15 K and p=101.325 kPa",examples:["loschmidt"]},n.gasConstant={description:"Gas constant",examples:["gasConstant"]},n.molarPlanckConstant={description:"Molar Planck constant",examples:["molarPlanckConstant"]},n.molarVolume={description:"Molar volume of an ideal gas at T=273.15 K and p=101.325 kPa",examples:["molarVolume"]},n.sackurTetrode={description:"Sackur-Tetrode constant at T=1 K and p=101.325 kPa",examples:["sackurTetrode"]},n.secondRadiation={description:"Second radiation constant",examples:["secondRadiation"]},n.stefanBoltzmann={description:"Stefan-Boltzmann constant",examples:["stefanBoltzmann"]},n.wienDisplacement={description:"Wien displacement law constant",examples:["wienDisplacement"]},n.molarMass={description:"Molar mass constant",examples:["molarMass"]},n.molarMassC12={description:"Molar mass constant of carbon-12",examples:["molarMassC12"]},n.gravity={description:"Standard acceleration of gravity (standard acceleration of free-fall on Earth)",examples:["gravity"]},n.planckLength={description:"Planck length",examples:["planckLength"]},n.planckMass={description:"Planck mass",examples:["planckMass"]},n.planckTime={description:"Planck time",examples:["planckTime"]},n.planckCharge={description:"Planck charge",examples:["planckCharge"]},n.planckTemperature={description:"Planck temperature",examples:["planckTemperature"]},n.derivative=require("./function/algebra/derivative"),n.lsolve=require("./function/algebra/lsolve"),n.lup=require("./function/algebra/lup"),n.lusolve=require("./function/algebra/lusolve"),n.simplify=require("./function/algebra/simplify"),n.rationalize=require("./function/algebra/rationalize"),n.slu=require("./function/algebra/slu"),n.usolve=require("./function/algebra/usolve"),n.qr=require("./function/algebra/qr"),n.abs=require("./function/arithmetic/abs"),n.add=require("./function/arithmetic/add"),n.cbrt=require("./function/arithmetic/cbrt"),n.ceil=require("./function/arithmetic/ceil"),n.cube=require("./function/arithmetic/cube"),n.divide=require("./function/arithmetic/divide"),n.dotDivide=require("./function/arithmetic/dotDivide"),n.dotMultiply=require("./function/arithmetic/dotMultiply"),n.dotPow=require("./function/arithmetic/dotPow"),n.exp=require("./function/arithmetic/exp"),n.expm=require("./function/arithmetic/expm"),n.expm1=require("./function/arithmetic/expm1"),n.fix=require("./function/arithmetic/fix"),n.floor=require("./function/arithmetic/floor"),n.gcd=require("./function/arithmetic/gcd"),n.hypot=require("./function/arithmetic/hypot"),n.lcm=require("./function/arithmetic/lcm"),n.log=require("./function/arithmetic/log"),n.log2=require("./function/arithmetic/log2"),n.log1p=require("./function/arithmetic/log1p"),n.log10=require("./function/arithmetic/log10"),n.mod=require("./function/arithmetic/mod"),n.multiply=require("./function/arithmetic/multiply"),n.norm=require("./function/arithmetic/norm"),n.nthRoot=require("./function/arithmetic/nthRoot"),n.nthRoots=require("./function/arithmetic/nthRoots"),n.pow=require("./function/arithmetic/pow"),n.round=require("./function/arithmetic/round"),n.sign=require("./function/arithmetic/sign"),n.sqrt=require("./function/arithmetic/sqrt"),n.sqrtm=require("./function/arithmetic/sqrtm"),n.square=require("./function/arithmetic/square"),n.subtract=require("./function/arithmetic/subtract"),n.unaryMinus=require("./function/arithmetic/unaryMinus"),n.unaryPlus=require("./function/arithmetic/unaryPlus"),n.xgcd=require("./function/arithmetic/xgcd"),n.bitAnd=require("./function/bitwise/bitAnd"),n.bitNot=require("./function/bitwise/bitNot"),n.bitOr=require("./function/bitwise/bitOr"),n.bitXor=require("./function/bitwise/bitXor"),n.leftShift=require("./function/bitwise/leftShift"),n.rightArithShift=require("./function/bitwise/rightArithShift"),n.rightLogShift=require("./function/bitwise/rightLogShift"),n.bellNumbers=require("./function/combinatorics/bellNumbers"),n.catalan=require("./function/combinatorics/catalan"),n.composition=require("./function/combinatorics/composition"),n.stirlingS2=require("./function/combinatorics/stirlingS2"),n.config=require("./core/config"),n.import=require("./core/import"),n.typed=require("./core/typed"),n.arg=require("./function/complex/arg"),n.conj=require("./function/complex/conj"),n.re=require("./function/complex/re"),n.im=require("./function/complex/im"),n.eval=require("./function/expression/eval"),n.help=require("./function/expression/help"),n.distance=require("./function/geometry/distance"),n.intersect=require("./function/geometry/intersect"),n.and=require("./function/logical/and"),n.not=require("./function/logical/not"),n.or=require("./function/logical/or"),n.xor=require("./function/logical/xor"),n.column=require("./function/matrix/column"),n.concat=require("./function/matrix/concat"),n.cross=require("./function/matrix/cross"),n.ctranspose=require("./function/matrix/ctranspose"),n.det=require("./function/matrix/det"),n.diag=require("./function/matrix/diag"),n.dot=require("./function/matrix/dot"),n.getMatrixDataType=require("./function/matrix/getMatrixDataType"),n.identity=require("./function/matrix/identity"),n.filter=require("./function/matrix/filter"),n.flatten=require("./function/matrix/flatten"),n.forEach=require("./function/matrix/forEach"),n.inv=require("./function/matrix/inv"),n.kron=require("./function/matrix/kron"),n.map=require("./function/matrix/map"),n.ones=require("./function/matrix/ones"),n.partitionSelect=require("./function/matrix/partitionSelect"),n.range=require("./function/matrix/range"),n.resize=require("./function/matrix/resize"),n.reshape=require("./function/matrix/reshape"),n.row=require("./function/matrix/row"),n.size=require("./function/matrix/size"),n.sort=require("./function/matrix/sort"),n.squeeze=require("./function/matrix/squeeze"),n.subset=require("./function/matrix/subset"),n.trace=require("./function/matrix/trace"),n.transpose=require("./function/matrix/transpose"),n.zeros=require("./function/matrix/zeros"),n.combinations=require("./function/probability/combinations"),n.factorial=require("./function/probability/factorial"),n.gamma=require("./function/probability/gamma"),n.kldivergence=require("./function/probability/kldivergence"),n.multinomial=require("./function/probability/multinomial"),n.permutations=require("./function/probability/permutations"),n.pickRandom=require("./function/probability/pickRandom"),n.random=require("./function/probability/random"),n.randomInt=require("./function/probability/randomInt"),n.compare=require("./function/relational/compare"),n.compareNatural=require("./function/relational/compareNatural"),n.compareText=require("./function/relational/compareText"),n.deepEqual=require("./function/relational/deepEqual"),n.equal=require("./function/relational/equal"),n.equalText=require("./function/relational/equalText"),n.larger=require("./function/relational/larger"),n.largerEq=require("./function/relational/largerEq"),n.smaller=require("./function/relational/smaller"),n.smallerEq=require("./function/relational/smallerEq"),n.unequal=require("./function/relational/unequal"),n.setCartesian=require("./function/set/setCartesian"),n.setDifference=require("./function/set/setDifference"),n.setDistinct=require("./function/set/setDistinct"),n.setIntersect=require("./function/set/setIntersect"),n.setIsSubset=require("./function/set/setIsSubset"),n.setMultiplicity=require("./function/set/setMultiplicity"),n.setPowerset=require("./function/set/setPowerset"),n.setSize=require("./function/set/setSize"),n.setSymDifference=require("./function/set/setSymDifference"),n.setUnion=require("./function/set/setUnion"),n.erf=require("./function/special/erf"),n.mad=require("./function/statistics/mad"),n.max=require("./function/statistics/max"),n.mean=require("./function/statistics/mean"),n.median=require("./function/statistics/median"),n.min=require("./function/statistics/min"),n.mode=require("./function/statistics/mode"),n.prod=require("./function/statistics/prod"),n.quantileSeq=require("./function/statistics/quantileSeq"),n.std=require("./function/statistics/std"),n.sum=require("./function/statistics/sum"),n.var=require("./function/statistics/var"),n.acos=require("./function/trigonometry/acos"),n.acosh=require("./function/trigonometry/acosh"),n.acot=require("./function/trigonometry/acot"),n.acoth=require("./function/trigonometry/acoth"),n.acsc=require("./function/trigonometry/acsc"),n.acsch=require("./function/trigonometry/acsch"),n.asec=require("./function/trigonometry/asec"),n.asech=require("./function/trigonometry/asech"),n.asin=require("./function/trigonometry/asin"),n.asinh=require("./function/trigonometry/asinh"),n.atan=require("./function/trigonometry/atan"),n.atanh=require("./function/trigonometry/atanh"),n.atan2=require("./function/trigonometry/atan2"),n.cos=require("./function/trigonometry/cos"),n.cosh=require("./function/trigonometry/cosh"),n.cot=require("./function/trigonometry/cot"),n.coth=require("./function/trigonometry/coth"),n.csc=require("./function/trigonometry/csc"),n.csch=require("./function/trigonometry/csch"),n.sec=require("./function/trigonometry/sec"),n.sech=require("./function/trigonometry/sech"),n.sin=require("./function/trigonometry/sin"),n.sinh=require("./function/trigonometry/sinh"),n.tan=require("./function/trigonometry/tan"),n.tanh=require("./function/trigonometry/tanh"),n.to=require("./function/units/to"),n.clone=require("./function/utils/clone"),n.format=require("./function/utils/format"),n.isNaN=require("./function/utils/isNaN"),n.isInteger=require("./function/utils/isInteger"),n.isNegative=require("./function/utils/isNegative"),n.isNumeric=require("./function/utils/isNumeric"),n.hasNumericValue=require("./function/utils/hasNumericValue"),n.isPositive=require("./function/utils/isPositive"),n.isPrime=require("./function/utils/isPrime"),n.isZero=require("./function/utils/isZero"),n.typeof=require("./function/utils/typeof"),n}exports.name="docs",exports.path="expression",exports.factory=e;
},{"./construction/bignumber":"iLNC","./construction/boolean":"t9At","./construction/complex":"JrNm","./construction/createUnit":"p1Y0","./construction/fraction":"L0ae","./construction/index":"u7WR","./construction/matrix":"ig4c","./construction/number":"a1WX","./construction/sparse":"wNuW","./construction/splitUnit":"YFZz","./construction/string":"rqOi","./construction/unit":"x7uc","./constants/e":"MQ99","./constants/false":"T9NB","./constants/i":"aPHB","./constants/Infinity":"QQb5","./constants/LN2":"aXGR","./constants/LN10":"ONCS","./constants/LOG2E":"l03h","./constants/LOG10E":"IwW2","./constants/NaN":"sLjM","./constants/null":"lowc","./constants/pi":"HJY8","./constants/phi":"jcFy","./constants/SQRT1_2":"fDHA","./constants/SQRT2":"yYpy","./constants/tau":"aQgJ","./constants/true":"n6zq","./constants/version":"CPzZ","./function/algebra/derivative":"HjBS","./function/algebra/lsolve":"OFzm","./function/algebra/lup":"SsYr","./function/algebra/lusolve":"F1Dh","./function/algebra/simplify":"yWjE","./function/algebra/rationalize":"xCNe","./function/algebra/slu":"h0vC","./function/algebra/usolve":"RXlV","./function/algebra/qr":"rUq2","./function/arithmetic/abs":"XkjO","./function/arithmetic/add":"k4Wb","./function/arithmetic/cbrt":"aoF1","./function/arithmetic/ceil":"z4It","./function/arithmetic/cube":"ruVI","./function/arithmetic/divide":"sbSk","./function/arithmetic/dotDivide":"hr3Z","./function/arithmetic/dotMultiply":"p0XP","./function/arithmetic/dotPow":"HDd7","./function/arithmetic/exp":"y0AC","./function/arithmetic/expm":"iddg","./function/arithmetic/expm1":"pk0d","./function/arithmetic/fix":"WGIH","./function/arithmetic/floor":"vXNc","./function/arithmetic/gcd":"dwcd","./function/arithmetic/hypot":"Vx3c","./function/arithmetic/lcm":"gaE4","./function/arithmetic/log":"vbjs","./function/arithmetic/log2":"XIlx","./function/arithmetic/log1p":"WGSj","./function/arithmetic/log10":"qxOp","./function/arithmetic/mod":"WNo3","./function/arithmetic/multiply":"rG0J","./function/arithmetic/norm":"av88","./function/arithmetic/nthRoot":"tPWr","./function/arithmetic/nthRoots":"Hwjx","./function/arithmetic/pow":"RTne","./function/arithmetic/round":"ayTa","./function/arithmetic/sign":"HnEg","./function/arithmetic/sqrt":"uX7J","./function/arithmetic/sqrtm":"MaXS","./function/arithmetic/square":"wa24","./function/arithmetic/subtract":"IpJ1","./function/arithmetic/unaryMinus":"zSOc","./function/arithmetic/unaryPlus":"hWWr","./function/arithmetic/xgcd":"LePI","./function/bitwise/bitAnd":"cry4","./function/bitwise/bitNot":"HcKC","./function/bitwise/bitOr":"ujKO","./function/bitwise/bitXor":"WecP","./function/bitwise/leftShift":"T9yh","./function/bitwise/rightArithShift":"ZNwk","./function/bitwise/rightLogShift":"XUC6","./function/combinatorics/bellNumbers":"a5Km","./function/combinatorics/catalan":"gEl1","./function/combinatorics/composition":"oDTX","./function/combinatorics/stirlingS2":"sdgX","./core/config":"DO71","./core/import":"ZwB0","./core/typed":"Shzo","./function/complex/arg":"DVdV","./function/complex/conj":"Wmy6","./function/complex/re":"zwHi","./function/complex/im":"QAET","./function/expression/eval":"bVEH","./function/expression/help":"Fax8","./function/geometry/distance":"dMW5","./function/geometry/intersect":"bVBO","./function/logical/and":"AWzT","./function/logical/not":"AWWa","./function/logical/or":"JhOe","./function/logical/xor":"JMRD","./function/matrix/column":"aMEf","./function/matrix/concat":"q0hB","./function/matrix/cross":"IWZn","./function/matrix/ctranspose":"nnFv","./function/matrix/det":"qD6G","./function/matrix/diag":"UQh1","./function/matrix/dot":"BlyW","./function/matrix/getMatrixDataType":"bnMU","./function/matrix/identity":"iJ3P","./function/matrix/filter":"CckY","./function/matrix/flatten":"UmBd","./function/matrix/forEach":"l4FK","./function/matrix/inv":"DDDN","./function/matrix/kron":"DU2x","./function/matrix/map":"oHAh","./function/matrix/ones":"fbw8","./function/matrix/partitionSelect":"fQm4","./function/matrix/range":"NLcZ","./function/matrix/resize":"tmIl","./function/matrix/reshape":"DOEY","./function/matrix/row":"FNOD","./function/matrix/size":"lVw7","./function/matrix/sort":"bGuK","./function/matrix/squeeze":"MpqE","./function/matrix/subset":"WRJB","./function/matrix/trace":"nc6c","./function/matrix/transpose":"fj0p","./function/matrix/zeros":"nFaR","./function/probability/combinations":"M4Fz","./function/probability/factorial":"cbU5","./function/probability/gamma":"mIdZ","./function/probability/kldivergence":"W9Q9","./function/probability/multinomial":"y9uR","./function/probability/permutations":"qGLJ","./function/probability/pickRandom":"iKEH","./function/probability/random":"pXBT","./function/probability/randomInt":"fj2Q","./function/relational/compare":"jKwP","./function/relational/compareNatural":"JLzY","./function/relational/compareText":"Bmmt","./function/relational/deepEqual":"bLpw","./function/relational/equal":"wgSR","./function/relational/equalText":"HVZA","./function/relational/larger":"TH74","./function/relational/largerEq":"hahd","./function/relational/smaller":"iBZ4","./function/relational/smallerEq":"Ob6s","./function/relational/unequal":"kwrJ","./function/set/setCartesian":"qllh","./function/set/setDifference":"jaWL","./function/set/setDistinct":"VDoP","./function/set/setIntersect":"kvfp","./function/set/setIsSubset":"XvM6","./function/set/setMultiplicity":"sMXh","./function/set/setPowerset":"rmtw","./function/set/setSize":"AYWb","./function/set/setSymDifference":"reLj","./function/set/setUnion":"Wqu5","./function/special/erf":"NbhS","./function/statistics/mad":"EtYx","./function/statistics/max":"L2AM","./function/statistics/mean":"qRED","./function/statistics/median":"nYR2","./function/statistics/min":"xrLZ","./function/statistics/mode":"yBPR","./function/statistics/prod":"NCYX","./function/statistics/quantileSeq":"Gbgi","./function/statistics/std":"uXlw","./function/statistics/sum":"qyn0","./function/statistics/var":"siyP","./function/trigonometry/acos":"HPVa","./function/trigonometry/acosh":"MvCO","./function/trigonometry/acot":"xXPM","./function/trigonometry/acoth":"KpnL","./function/trigonometry/acsc":"Gt5T","./function/trigonometry/acsch":"XLHb","./function/trigonometry/asec":"uxTA","./function/trigonometry/asech":"eRMa","./function/trigonometry/asin":"M9R8","./function/trigonometry/asinh":"qY7D","./function/trigonometry/atan":"s9IB","./function/trigonometry/atanh":"fjot","./function/trigonometry/atan2":"Z7HZ","./function/trigonometry/cos":"DWzk","./function/trigonometry/cosh":"maYo","./function/trigonometry/cot":"wCAM","./function/trigonometry/coth":"AM7w","./function/trigonometry/csc":"cTPc","./function/trigonometry/csch":"uHb4","./function/trigonometry/sec":"hpuP","./function/trigonometry/sech":"WKMm","./function/trigonometry/sin":"gPaM","./function/trigonometry/sinh":"G3av","./function/trigonometry/tan":"N6lO","./function/trigonometry/tanh":"teZk","./function/units/to":"ROe2","./function/utils/clone":"I9FW","./function/utils/format":"gPkx","./function/utils/isNaN":"VF4n","./function/utils/isInteger":"rt70","./function/utils/isNegative":"hspf","./function/utils/isNumeric":"Tqof","./function/utils/hasNumericValue":"RYV2","./function/utils/isPositive":"pq0g","./function/utils/isPrime":"mX5V","./function/utils/isZero":"MHMc","./function/utils/typeof":"v295"}],"tSao":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,i,n){var o=i(require("../parse"));return n("compile",{string:function(r){return o(r).compile()},"Array | Matrix":function(e){return r(e,function(r){return o(r).compile()})}})}exports.name="compile",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo","../parse":"EUvE"}],"kgrW":[function(require,module,exports) {
"use strict";var r=require("../../utils/collection/deepMap");function e(e,t,n,i){var c=n(require("../parse"));return i("compile",{string:function(r){return c(r).compile().eval({})},"string, Object":function(r,e){return c(r).compile().eval(e)},"Array | Matrix":function(e){var t={};return r(e,function(r){return c(r).compile().eval(t)})},"Array | Matrix, Object":function(e,t){return r(e,function(r){return c(r).compile().eval(t)})}})}exports.name="eval",exports.factory=e;
},{"../../utils/collection/deepMap":"lOYo","../parse":"EUvE"}],"eMLC":[function(require,module,exports) {
"use strict";var r=require("../../utils/customs").getSafeProperty;function e(e,t,o,n,a){var i=o(require("../embeddedDocs"));return n("help",{any:function(t){var o,n=t;if("string"!=typeof t)for(o in a)if(a.hasOwnProperty(o)&&t===a[o]){n=o;break}var s=r(i,n);if(!s)throw new Error('No documentation found on "'+n+'"');return new e.Help(s)}})}exports.math=!0,exports.name="help",exports.factory=e;
},{"../../utils/customs":"PAPk","../embeddedDocs":"u4GE"}],"SQe8":[function(require,module,exports) {
"use strict";var e=require("../utils/object").extend,t=require("../utils/customs");function r(r,o,s,p,i){var n=s(require("./parse"));function c(){if(!(this instanceof c))throw new SyntaxError("Constructor must be called with the new operator");this.scope={}}return c.prototype.type="Parser",c.prototype.isParser=!0,c.prototype.parse=function(e){throw new Error("Parser.parse is deprecated. Use math.parse instead.")},c.prototype.compile=function(e){throw new Error("Parser.compile is deprecated. Use math.compile instead.")},c.prototype.eval=function(e){return n(e).compile().eval(this.scope)},c.prototype.get=function(e){return e in this.scope?t.getSafeProperty(this.scope,e):void 0},c.prototype.getAll=function(){return e({},this.scope)},c.prototype.set=function(e,r){return t.setSafeProperty(this.scope,e,r)},c.prototype.remove=function(e){delete this.scope[e]},c.prototype.clear=function(){for(var e in this.scope)this.scope.hasOwnProperty(e)&&delete this.scope[e]},c}exports.name="Parser",exports.path="expression",exports.factory=r,exports.math=!0;
},{"../utils/object":"FcSp","../utils/customs":"PAPk","./parse":"EUvE"}],"mLT7":[function(require,module,exports) {
"use strict";function r(r,e,t,n,s){var a=t(require("../Parser"));return n("parser",{"":function(){return new a(s)}})}exports.name="parser",exports.factory=r,exports.math=!0;
},{"../Parser":"SQe8"}],"bSaC":[function(require,module,exports) {
"use strict";module.exports=[require("./compile"),require("./eval"),require("./help"),require("./parse"),require("./parser")];
},{"./compile":"tSao","./eval":"kgrW","./help":"eMLC","./parse":"uJKc","./parser":"mLT7"}],"EsLR":[function(require,module,exports) {
"use strict";function e(e,t,o,r){return function(){throw new Error("UpdateNode is deprecated. Use AssignmentNode instead.")}}exports.name="UpdateNode",exports.path="expression.node",exports.factory=e;
},{}],"gbLV":[function(require,module,exports) {
"use strict";module.exports=[require("./AccessorNode"),require("./ArrayNode"),require("./AssignmentNode"),require("./BlockNode"),require("./ConditionalNode"),require("./ConstantNode"),require("./IndexNode"),require("./FunctionAssignmentNode"),require("./FunctionNode"),require("./Node"),require("./ObjectNode"),require("./OperatorNode"),require("./ParenthesisNode"),require("./RangeNode"),require("./RelationalNode"),require("./SymbolNode"),require("./UpdateNode")];
},{"./AccessorNode":"vZNf","./ArrayNode":"onTs","./AssignmentNode":"yw4P","./BlockNode":"QBkn","./ConditionalNode":"uzAW","./ConstantNode":"MNuy","./IndexNode":"SN5L","./FunctionAssignmentNode":"PrPs","./FunctionNode":"ZLEq","./Node":"dnbo","./ObjectNode":"UI2T","./OperatorNode":"F3sc","./ParenthesisNode":"Mj7c","./RangeNode":"tJPg","./RelationalNode":"E94o","./SymbolNode":"RtSa","./UpdateNode":"EsLR"}],"fYWL":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform;function t(t,a,e,n){var o=e(require("../../function/matrix/apply"));return n("apply",{"...any":function(a){var e=a[1];t.isNumber(e)?a[1]=e-1:t.isBigNumber(e)&&(a[1]=e.minus(1));try{return o.apply(null,a)}catch(n){throw r(n)}}})}exports.name="apply",exports.path="expression.transform",exports.factory=t;
},{"./error.transform":"Bjol","../../function/matrix/apply":"f9k3"}],"hFxa":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform;function t(t,n,e,o){var a=e(require("../../function/matrix/column"));return o("column",{"...any":function(n){var e=n.length-1,o=n[e];t.isNumber(o)&&(n[e]=o-1);try{return a.apply(null,n)}catch(u){throw r(u)}}})}exports.name="column",exports.path="expression.transform",exports.factory=t;
},{"./error.transform":"Bjol","../../function/matrix/column":"g7VB"}],"fUNc":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform;function t(t,n,e,a){var o=e(require("../../function/matrix/concat"));return a("concat",{"...any":function(n){var e=n.length-1,a=n[e];t.isNumber(a)?n[e]=a-1:t.isBigNumber(a)&&(n[e]=a.minus(1));try{return o.apply(null,n)}catch(c){throw r(c)}}})}exports.name="concat",exports.path="expression.transform",exports.factory=t;
},{"./error.transform":"Bjol","../../function/matrix/concat":"LXdZ"}],"yzMS":[function(require,module,exports) {
"use strict";function n(n,e,r,i){return function(e,r,i){var t=e.filter(function(e){return n.isSymbolNode(e)&&!(e.name in r)&&!(e.name in i)})[0];if(!t)throw new Error('No undefined variable found in inline expression "'+e+'"');var o=t.name,u=Object.create(i),a=e.compile();return function(n){return u[o]=n,a.eval(u)}}}exports.factory=n;
},{}],"Ozx7":[function(require,module,exports) {
"use strict";var r=require("../../utils/array").filter,t=require("../../utils/array").filterRegExp,e=require("../../utils/function").maxArgumentCount;function i(r,e,i,o){var u=i(require("./utils/compileInlineExpression")),a=i(require("../../type/matrix/function/matrix"));function s(t,e,i){var n,o;return t[0]&&(n=t[0].compile().eval(i)),t[1]&&(o=r.isSymbolNode(t[1])||r.isFunctionAssignmentNode(t[1])?t[1].compile().eval(i):u(t[1],e,i)),c(n,o)}s.rawArgs=!0;var c=o("filter",{"Array, function":n,"Matrix, function":function(r,t){return a(n(r.toArray(),t))},"Array, RegExp":t,"Matrix, RegExp":function(r,e){return a(t(r.toArray(),e))}});return c.toTex=void 0,s}function n(t,i){var n=e(i);return r(t,function(r,t,e){return 1===n?i(r):2===n?i(r,[t+1]):i(r,[t+1],e)})}exports.name="filter",exports.path="expression.transform",exports.factory=i;
},{"../../utils/array":"j2lF","../../utils/function":"woyg","./utils/compileInlineExpression":"yzMS","../../type/matrix/function/matrix":"vzj5"}],"YwEg":[function(require,module,exports) {
"use strict";var r=require("../../utils/function").maxArgumentCount,n=require("../../utils/array").forEach;function e(e,i,o,t){var a=o(require("./utils/compileInlineExpression"));function u(r,n,i){var o,t;return r[0]&&(o=r[0].compile().eval(i)),r[1]&&(t=e.isSymbolNode(r[1])||e.isFunctionAssignmentNode(r[1])?r[1].compile().eval(i):a(r[1],n,i)),s(o,t)}u.rawArgs=!0;var s=t("forEach",{"Array | Matrix, function":function(e,i){var o=r(i);!function r(t,a){Array.isArray(t)?n(t,function(n,e){r(n,a.concat(e+1))}):1===o?i(t):2===o?i(t,a):i(t,a,e)}(e.valueOf(),[])}});return u}exports.name="forEach",exports.path="expression.transform",exports.factory=e;
},{"../../utils/function":"woyg","../../utils/array":"j2lF","./utils/compileInlineExpression":"yzMS"}],"XTGQ":[function(require,module,exports) {
"use strict";function e(e,r,n){return function(){for(var r=[],n=0,t=arguments.length;n<t;n++){var i=arguments[n];if(e.isRange(i))i.start--,i.end-=i.step>0?0:2;else if(i&&!0===i.isSet)i=i.map(function(e){return e-1});else if(e.isArray(i)||e.isMatrix(i))i=i.map(function(e){return e-1});else if(e.isNumber(i))i--;else if(e.isBigNumber(i))i=i.toNumber()-1;else if("string"!=typeof i)throw new TypeError("Dimension must be an Array, Matrix, number, string, or Range");r[n]=i}var s=new e.Index;return e.Index.apply(s,r),s}}exports.name="index",exports.path="expression.transform",exports.factory=e;
},{}],"nCs5":[function(require,module,exports) {
"use strict";var r=require("../../utils/function").maxArgumentCount,n=require("../../utils/array").map;function t(r,n,t,i){var u=t(require("./utils/compileInlineExpression")),o=t(require("../../type/matrix/function/matrix"));function a(n,t,e){var i,o;return n[0]&&(i=n[0].compile().eval(e)),n[1]&&(o=r.isSymbolNode(n[1])||r.isFunctionAssignmentNode(n[1])?n[1].compile().eval(e):u(n[1],t,e)),c(i,o)}a.rawArgs=!0;var c=i("map",{"Array, function":function(r,n){return e(r,n,r)},"Matrix, function":function(r,n){return o(e(r.valueOf(),n,r))}});return a}function e(t,e,i){var u=r(e);return function r(t,o){return Array.isArray(t)?n(t,function(n,t){return r(n,o.concat(t+1))}):1===u?e(t):2===u?e(t,o):e(t,o,i)}(t,[])}exports.name="map",exports.path="expression.transform",exports.factory=t;
},{"../../utils/function":"woyg","../../utils/array":"j2lF","./utils/compileInlineExpression":"yzMS","../../type/matrix/function/matrix":"vzj5"}],"NHP1":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform,t=require("../../utils/collection/isCollection");function e(e,i,n,s){var o=n(require("../../function/statistics/max"));return s("max",{"...any":function(i){if(2===i.length&&t(i[0])){var n=i[1];e.isNumber(n)?i[1]=n-1:e.isBigNumber(n)&&(i[1]=n.minus(1))}try{return o.apply(null,i)}catch(s){throw r(s)}}})}exports.name="max",exports.path="expression.transform",exports.factory=e;
},{"./error.transform":"Bjol","../../utils/collection/isCollection":"m4c0","../../function/statistics/max":"US8O"}],"nlKP":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform,t=require("../../utils/collection/isCollection");function e(e,n,i,s){var o=i(require("../../function/statistics/mean"));return s("mean",{"...any":function(n){if(2===n.length&&t(n[0])){var i=n[1];e.isNumber(i)?n[1]=i-1:e.isBigNumber(i)&&(n[1]=i.minus(1))}try{return o.apply(null,n)}catch(s){throw r(s)}}})}exports.name="mean",exports.path="expression.transform",exports.factory=e;
},{"./error.transform":"Bjol","../../utils/collection/isCollection":"m4c0","../../function/statistics/mean":"WyK1"}],"cpNx":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform,t=require("../../utils/collection/isCollection");function i(i,n,e,s){var o=e(require("../../function/statistics/min"));return s("min",{"...any":function(n){if(2===n.length&&t(n[0])){var e=n[1];i.isNumber(e)?n[1]=e-1:i.isBigNumber(e)&&(n[1]=e.minus(1))}try{return o.apply(null,n)}catch(s){throw r(s)}}})}exports.name="min",exports.path="expression.transform",exports.factory=i;
},{"./error.transform":"Bjol","../../utils/collection/isCollection":"m4c0","../../function/statistics/min":"VKqc"}],"NRUm":[function(require,module,exports) {
"use strict";function r(r,n,e,t){var a=e(require("../../function/matrix/range"));return t("range",{"...any":function(r){return"boolean"!=typeof r[r.length-1]&&r.push(!0),a.apply(null,r)}})}exports.name="range",exports.path="expression.transform",exports.factory=r;
},{"../../function/matrix/range":"lueR"}],"tHFG":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform,t=require("../../utils/collection/isCollection");function e(e,s,i,n){var o=i(require("../../function/statistics/std"));return n("std",{"...any":function(s){if(s.length>=2&&t(s[0])){var i=s[1];e.isNumber(i)?s[1]=i-1:e.isBigNumber(i)&&(s[1]=i.minus(1))}try{return o.apply(null,s)}catch(n){throw r(n)}}})}exports.name="std",exports.path="expression.transform",exports.factory=e;
},{"./error.transform":"Bjol","../../utils/collection/isCollection":"m4c0","../../function/statistics/std":"hFUZ"}],"fCpa":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform;function t(t,e,n,o){var a=n(require("../../function/matrix/row"));return o("row",{"...any":function(e){var n=e.length-1,o=e[n];t.isNumber(o)&&(e[n]=o-1);try{return a.apply(null,e)}catch(s){throw r(s)}}})}exports.name="row",exports.path="expression.transform",exports.factory=t;
},{"./error.transform":"Bjol","../../function/matrix/row":"eLyh"}],"XVBF":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform;function t(t,e,s,n){var o=s(require("../../function/matrix/subset"));return n("subset",{"...any":function(t){try{return o.apply(null,t)}catch(e){throw r(e)}}})}exports.name="subset",exports.path="expression.transform",exports.factory=t;
},{"./error.transform":"Bjol","../../function/matrix/subset":"ZWbZ"}],"vC3z":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform,t=require("../../utils/collection/isCollection");function e(e,s,i,n){var o=i(require("../../function/statistics/sum"));return n("sum",{"...any":function(s){if(2===s.length&&t(s[0])){var i=s[1];e.isNumber(i)?s[1]=i-1:e.isBigNumber(i)&&(s[1]=i.minus(1))}try{return o.apply(null,s)}catch(n){throw r(n)}}})}exports.name="sum",exports.path="expression.transform",exports.factory=e;
},{"./error.transform":"Bjol","../../utils/collection/isCollection":"m4c0","../../function/statistics/sum":"y9hQ"}],"d6Xr":[function(require,module,exports) {
"use strict";var r=require("./error.transform").transform,t=require("../../utils/collection/isCollection");function e(e,i,n,s){var o=n(require("../../function/statistics/var"));return s("var",{"...any":function(i){if(i.length>=2&&t(i[0])){var n=i[1];e.isNumber(n)?i[1]=n-1:e.isBigNumber(n)&&(i[1]=n.minus(1))}try{return o.apply(null,i)}catch(s){throw r(s)}}})}exports.name="var",exports.path="expression.transform",exports.factory=e;
},{"./error.transform":"Bjol","../../utils/collection/isCollection":"m4c0","../../function/statistics/var":"ujYK"}],"mXCx":[function(require,module,exports) {
"use strict";module.exports=[require("./apply.transform"),require("./column.transform"),require("./concat.transform"),require("./filter.transform"),require("./forEach.transform"),require("./index.transform"),require("./map.transform"),require("./max.transform"),require("./mean.transform"),require("./min.transform"),require("./range.transform"),require("./std.transform"),require("./row.transform"),require("./subset.transform"),require("./sum.transform"),require("./var.transform")];
},{"./apply.transform":"fYWL","./column.transform":"hFxa","./concat.transform":"fUNc","./filter.transform":"Ozx7","./forEach.transform":"YwEg","./index.transform":"XTGQ","./map.transform":"nCs5","./max.transform":"NHP1","./mean.transform":"nlKP","./min.transform":"cpNx","./range.transform":"NRUm","./std.transform":"tHFG","./row.transform":"fCpa","./subset.transform":"XVBF","./sum.transform":"vC3z","./var.transform":"d6Xr"}],"SNFv":[function(require,module,exports) {
"use strict";var t=require("../utils/object"),e=require("../utils/string");function r(r,n,o,i){var a=o(require("./function/parser"))();function s(t){if(!(this instanceof s))throw new SyntaxError("Constructor must be called with the new operator");if(!t)throw new Error('Argument "doc" missing');this.doc=t}return s.prototype.type="Help",s.prototype.isHelp=!0,s.prototype.toString=function(){var t=this.doc||{},n="\n";if(t.name&&(n+="Name: "+t.name+"\n\n"),t.category&&(n+="Category: "+t.category+"\n\n"),t.description&&(n+="Description:\n "+t.description+"\n\n"),t.syntax&&(n+="Syntax:\n "+t.syntax.join("\n ")+"\n\n"),t.examples){n+="Examples:\n";for(var o=0;o<t.examples.length;o++){var i=t.examples[o];n+=" "+i+"\n";var s=void 0;try{s=a.eval(i)}catch(p){s=p}void 0===s||r.isHelp(s)||(n+=" "+e.format(s,{precision:14})+"\n")}n+="\n"}return t.seealso&&t.seealso.length&&(n+="See also: "+t.seealso.join(", ")+"\n"),n},s.prototype.toJSON=function(){var e=t.clone(this.doc);return e.mathjs="Help",e},s.fromJSON=function(t){var e={};for(var r in t)"mathjs"!==r&&(e[r]=t[r]);return new s(e)},s.prototype.valueOf=s.prototype.toString,s}exports.name="Help",exports.path="type",exports.factory=r;
},{"../utils/object":"FcSp","../utils/string":"PshC","./function/parser":"mLT7"}],"xTTM":[function(require,module,exports) {
"use strict";module.exports=[require("./embeddedDocs"),require("./function"),require("./node"),require("./transform"),require("./Help"),require("./parse"),require("./Parser")];
},{"./embeddedDocs":"u4GE","./function":"bSaC","./node":"gbLV","./transform":"mXCx","./Help":"SNFv","./parse":"EUvE","./Parser":"SQe8"}],"aE4P":[function(require,module,exports) {
"use strict";function r(r,t,e,o,n){return function(t,e){var o=r[e&&e.mathjs]||n.expression&&n.expression.node[e&&e.mathjs];return o&&"function"==typeof o.fromJSON?o.fromJSON(e):e}}exports.name="reviver",exports.path="json",exports.factory=r,exports.math=!0;
},{}],"KEFM":[function(require,module,exports) {
"use strict";module.exports=[require("./reviver")];
},{"./reviver":"aE4P"}],"zqj8":[function(require,module,exports) {
"use strict";var r=require("./ArgumentsError"),e=require("./DimensionError"),n=require("./IndexError");module.exports=[{name:"ArgumentsError",path:"error",factory:function(){return r}},{name:"DimensionError",path:"error",factory:function(){return e}},{name:"IndexError",path:"error",factory:function(){return n}}];
},{"./ArgumentsError":"h0xI","./DimensionError":"YiAw","./IndexError":"tfOV"}],"pq5F":[function(require,module,exports) {
"use strict";module.exports=[require("./type"),require("./constants"),require("./function"),require("./expression"),require("./json"),require("./error")];
},{"./type":"And3","./constants":"GTWZ","./function":"wKfj","./expression":"xTTM","./json":"KEFM","./error":"zqj8"}],"HZcI":[function(require,module,exports) {
"use strict";var e=require("./core/core");function r(t){var c=e.create(t);return c.create=r,c.import(require("./index")),c}module.exports=r();
},{"./core/core":"MP6P","./index":"pq5F"}],"PI51":[function(require,module,exports) {
module.exports=require("./lib/main");
},{"./lib/main":"HZcI"}],"Tiv2":[function(require,module,exports) {
var r=require("mathjs");function e(e){return JSON.parse(JSON.stringify(r.parse(e)))}module.exports={parseMath:e};
},{"mathjs":"PI51"}],"SRZe":[function(require,module,exports) {
"use strict";function r(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var e=require("rescript/lib/js/curry.js"),t=require("rescript/lib/js/js_exn.js"),a=require("../utility/E.bs.js"),s=require("./MathjsWrapper.js"),i=require("rescript/lib/js/caml_js_exceptions.js");function n(r){return s.parseMath(r)}function o(n){var o;try{o=s.parseMath(n)}catch(c){var u=i.internalToOCamlException(c);return u.RE_EXN_ID===t.$$Error?r({TAG:1,_0:e._2(a.O.$$default,"MathJS Parse Error",u._1.message)},Symbol.for("name"),"Error"):r({TAG:1,_0:"MathJS Parse Error"},Symbol.for("name"),"Error")}return r({TAG:0,_0:o},Symbol.for("name"),"Ok")}exports.parseMathExt=n,exports.parseMath=o;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/js_exn.js":"XrLb","../utility/E.bs.js":"xX5m","./MathjsWrapper.js":"Tiv2","rescript/lib/js/caml_js_exceptions.js":"yO2E"}],"dGOd":[function(require,module,exports) {
"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(e)}function e(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}var n=require("rescript/lib/js/curry.js"),t=require("rescript/lib/js/js_dict.js"),o=require("rescript/lib/js/belt_Array.js"),a=require("@glennsl/bs-json/src/Json_decode.bs.js"),i=require("../utility/E.bs.js"),s=require("./Mathjs.bs.js");function u(r){var o=a.field("mathjs",a.string,r);switch(o){case"ArrayNode":var s=a.field("items",function(r){return a.array(u,r)},r);return e({TAG:3,_0:n._1(i.A.O.concatSomes,s)},Symbol.for("name"),"Array");case"AssignmentNode":var m=a.field("object",u,r),l=a.field("value",u,r);return void 0!==m&&void 0!==l?e({TAG:6,_0:m,_1:l},Symbol.for("name"),"Assignment"):void 0;case"BlockNode":var f=function(r){return a.field("node",u,r)};return e({TAG:4,_0:n._1(i.A.O.concatSomes,a.field("blocks",function(r){return a.array(f,r)},r))},Symbol.for("name"),"Blocks");case"ConstantNode":return n._2(i.O.fmap,function(r){return e({TAG:1,_0:r},Symbol.for("name"),"Value")},a.optional(function(r){return a.field("value",a.$$float,r)},r));case"FunctionAssignmentNode":var c=a.field("name",a.string,r),A=a.field("params",function(r){return a.array(function(r){return a.field("name",a.string,r)},r)},r),b=a.field("expr",u,r);return n._2(i.O.fmap,function(r){return e({TAG:7,_0:{name:c,args:A,expression:r}},Symbol.for("name"),"FunctionAssignment")},b);case"FunctionNode":var _=a.field("args",function(r){return a.array(u,r)},r),d=a.optional(function(r){return a.field("fn",function(r){return a.field("name",a.string,r)},r)},r);return n._2(i.O.fmap,function(r){return e({TAG:2,_0:{name:r,args:n._1(i.A.O.concatSomes,_)}},Symbol.for("name"),"Fn")},d);case"ObjectNode":var y=a.field("properties",function(r){return a.dict(u,r)},r);return e({TAG:5,_0:t.fromArray(n._1(i.A.O.concatSomes,n._2(i.A.fmap,function(r){var e=r[0];return n._2(i.O.fmap,function(r){return[e,r]},r[1])},t.entries(y))))},Symbol.for("name"),"Object");case"OperatorNode":var T=a.field("args",function(r){return a.array(u,r)},r);return e({TAG:2,_0:{name:a.field("fn",a.string,r),args:n._1(i.A.O.concatSomes,T)}},Symbol.for("name"),"Fn");case"ParenthesisNode":return a.field("content",u,r);case"SymbolNode":return e({TAG:0,_0:a.field("name",a.string,r)},Symbol.for("name"),"Symbol");default:return void console.log("Couldn't parse mathjs node",r,o)}}var m={run:u};function l(r){return e({TAG:0,_0:{NAME:"Symbol",VAL:r}},Symbol.for("name"),"Ok")}function f(r,e){switch(e){case"B":return 1e9*r;case"K":return 1e3*r;case"M":return 1e6*r;case"T":return 1e12*r;default:return}}function c(r){switch(0|r.TAG){case 0:return e({TAG:0,_0:r._0},Symbol.for("name"),"Symbol");case 1:return e({TAG:1,_0:r._0},Symbol.for("name"),"Value");case 2:var o=r._0,a=o.name;switch(a){case"multiply":var s=o.args;if(2===s.length){var u=s[0];if(1===u.TAG){var m=s[1];if(0===m.TAG)return n._2(i.O.$$default,r,n._2(i.O.fmap,function(r){return e({TAG:1,_0:r},Symbol.for("name"),"Value")},f(u._0,m._0)))}}break;case"unaryMinus":var l=o.args;if(1===l.length){var A=l[0];if(1===A.TAG)return e({TAG:1,_0:-1*A._0},Symbol.for("name"),"Value")}}return e({TAG:2,_0:{name:a,args:n._2(i.A.fmap,c,o.args)}},Symbol.for("name"),"Fn");case 3:return e({TAG:3,_0:n._2(i.A.fmap,c,r._0)},Symbol.for("name"),"Array");case 4:return e({TAG:4,_0:n._2(i.A.fmap,c,r._0)},Symbol.for("name"),"Blocks");case 5:return e({TAG:5,_0:t.fromArray(n._2(i.A.fmap,function(r){return[r[0],c(r[1])]},t.entries(r._0)))},Symbol.for("name"),"Object");case 6:return e({TAG:6,_0:r._0,_1:c(r._1)},Symbol.for("name"),"Assignment");case 7:return e({TAG:7,_0:r._0},Symbol.for("name"),"FunctionAssignment")}}var A={transformWithSymbol:f,run:c};function b(r,o,a){if(1===r.length){var s=r[0];if(5===s.TAG){var u=s._0,m=function(r){var e=i.O.toResult("Variable was empty",t.get(u,r));return n._2(i.R.bind,e,a)},l=m("mean"),f=m("stdev"),c=m("mu"),A=m("sigma"),b=0;if(0===l.TAG){if(0===f.TAG)return e({TAG:0,_0:{NAME:"FunctionCall",VAL:["lognormalFromMeanAndStdDev",[l._0,f._0]]}},Symbol.for("name"),"Ok");b=2}else b=2;if(2===b)return 0===c.TAG&&0===A.TAG?e({TAG:0,_0:{NAME:"FunctionCall",VAL:["lognormal",[c._0,A._0]]}},Symbol.for("name"),"Ok"):e({TAG:1,_0:"Lognormal distribution needs either mean and stdev or mu and sigma"},Symbol.for("name"),"Error")}}return n._2(i.R.fmap,function(r){return{NAME:"FunctionCall",VAL:["lognormal",r]}},n._1(o,void 0))}function _(t,o){return n._2(i.R.bind,o,function(n){switch(t){case"add":return 2!==n.length?e({TAG:1,_0:"Addition needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:["Add",n[0],n[1]]}},Symbol.for("name"),"Ok");case"divide":return 2!==n.length?e({TAG:1,_0:"Division needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:["Divide",n[0],n[1]]}},Symbol.for("name"),"Ok");case"dotMultiply":return 2!==n.length?e({TAG:1,_0:"Dotwise multiplication needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"PointwiseCombination",VAL:["Multiply",n[0],n[1]]}},Symbol.for("name"),"Ok");case"dotPow":return 2!==n.length?e({TAG:1,_0:"Dotwise exponentiation needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"PointwiseCombination",VAL:["Exponentiate",n[0],n[1]]}},Symbol.for("name"),"Ok");case"leftTruncate":if(2!==n.length)return e({TAG:1,_0:"leftTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");var o=n[0],a=n[1];if("object"!==r(a))return e({TAG:1,_0:"leftTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");if("SymbolicDist"!==a.NAME)return e({TAG:1,_0:"leftTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");var i=a.VAL;return"object"===r(i)&&"Float"===i.NAME?e({TAG:0,_0:{NAME:"Truncate",VAL:[i.VAL,void 0,o]}},Symbol.for("name"),"Ok"):e({TAG:1,_0:"leftTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");case"multiply":return 2!==n.length?e({TAG:1,_0:"Multiplication needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:["Multiply",n[0],n[1]]}},Symbol.for("name"),"Ok");case"pow":return 2!==n.length?e({TAG:1,_0:"Exponentiation needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:["Exponentiate",n[0],n[1]]}},Symbol.for("name"),"Ok");case"rightLogShift":return 2!==n.length?e({TAG:1,_0:"Dotwise addition needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"PointwiseCombination",VAL:["Add",n[0],n[1]]}},Symbol.for("name"),"Ok");case"rightTruncate":if(2!==n.length)return e({TAG:1,_0:"rightTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");var s=n[0],u=n[1];if("object"!==r(u))return e({TAG:1,_0:"rightTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");if("SymbolicDist"!==u.NAME)return e({TAG:1,_0:"rightTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");var m=u.VAL;return"object"===r(m)&&"Float"===m.NAME?e({TAG:0,_0:{NAME:"Truncate",VAL:[void 0,m.VAL,s]}},Symbol.for("name"),"Ok"):e({TAG:1,_0:"rightTruncate needs two arguments: the expression and the cutoff"},Symbol.for("name"),"Error");case"subtract":return 2!==n.length?e({TAG:1,_0:"Subtraction needs two operands"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:["Subtract",n[0],n[1]]}},Symbol.for("name"),"Ok");case"truncate":if(3!==n.length)return e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");var l=n[0],f=n[1];if("object"!==r(f))return e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");if("SymbolicDist"!==f.NAME)return e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");var c=f.VAL;if("object"!==r(c))return e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");if("Float"!==c.NAME)return e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");var A=n[2];if("object"!==r(A))return e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");if("SymbolicDist"!==A.NAME)return e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");var b=A.VAL;return"object"===r(b)&&"Float"===b.NAME?e({TAG:0,_0:{NAME:"Truncate",VAL:[c.VAL,b.VAL,l]}},Symbol.for("name"),"Ok"):e({TAG:1,_0:"truncate needs three arguments: the expression and both cutoffs"},Symbol.for("name"),"Error");case"unaryMinus":return 1!==n.length?e({TAG:1,_0:"This type not currently supported"},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:["Multiply",{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:-1}},n[0]]}},Symbol.for("name"),"Ok");default:return e({TAG:1,_0:"This type not currently supported"},Symbol.for("name"),"Error")}})}function d(r,t,a){var s=function(e){return n._1(i.A.R.firstErrorOrOpen,n._2(i.A.fmap,r,e))};switch(t){case"lognormal":return b(a,function(r){return s(a)},r);case"mm":var u=i.A.last(a),m=n._2(i.O.bind,u,function(r){if(3===r.TAG)return s(r._0)}),l=n._1(i.O.isSome,m)?o.slice(a,0,i.A.length(a)-1|0):a,f=s(l);return void 0!==m?0!==m.TAG?e({TAG:1,_0:m._0},Symbol.for("name"),"Error"):0!==f.TAG?e({TAG:1,_0:f._0},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"FunctionCall",VAL:["multimodal",[{NAME:"Hash",VAL:[["dists",{NAME:"Array",VAL:f._0}],["weights",{NAME:"Array",VAL:m._0}]]}]]}},Symbol.for("name"),"Ok"):0!==f.TAG?e({TAG:1,_0:f._0},Symbol.for("name"),"Error"):e({TAG:0,_0:{NAME:"FunctionCall",VAL:["multimodal",[{NAME:"Hash",VAL:[["dists",{NAME:"Array",VAL:f._0}],["weights",{NAME:"Array",VAL:[]}]]}]]}},Symbol.for("name"),"Ok");case"add":case"divide":case"dotMultiply":case"dotPow":case"leftTruncate":case"multimodal":case"multiply":case"pow":case"rightLogShift":case"rightTruncate":case"subtract":case"truncate":case"unaryMinus":return _(t,s(a));default:return n._2(i.R.fmap,function(r){return{NAME:"FunctionCall",VAL:[t,r]}},s(a))}}function y(r){switch(0|r.TAG){case 0:return e({TAG:0,_0:{NAME:"Symbol",VAL:r._0}},Symbol.for("name"),"Ok");case 1:return e({TAG:0,_0:{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:r._0}}},Symbol.for("name"),"Ok");case 2:var n=r._0;return d(y,n.name,n.args);default:return e({TAG:1,_0:"This type not currently supported"},Symbol.for("name"),"Error")}}function T(r){switch(0|r.TAG){case 0:return n._2(i.R.fmap,function(r){return[{NAME:"Expression",VAL:r}]},e({TAG:0,_0:{NAME:"Symbol",VAL:r._0}},Symbol.for("name"),"Ok"));case 1:case 2:return n._2(i.R.fmap,function(r){return[{NAME:"Expression",VAL:r}]},y(r));case 3:return e({TAG:1,_0:"Array not valid as top level"},Symbol.for("name"),"Error");case 4:return n._2(i.R.fmap,i.A.concatMany,n._1(i.A.R.firstErrorOrOpen,n._2(i.A.fmap,T,r._0)));case 5:return e({TAG:1,_0:"Object not valid as top level"},Symbol.for("name"),"Error");case 6:var t=r._0;if(0!==t.TAG)return e({TAG:1,_0:"Symbol not a string"},Symbol.for("name"),"Error");var o=t._0;return n._2(i.R.fmap,function(r){return[{NAME:"Assignment",VAL:[o,r]}]},y(r._1));case 7:var a=r._0,s=y(a.expression);return 0===s.TAG?e({TAG:0,_0:[{NAME:"Assignment",VAL:[a.name,{NAME:"Function",VAL:[a.args,s._0]}]}]},Symbol.for("name"),"Ok"):e({TAG:1,_0:s._0},Symbol.for("name"),"Error")}}function S(r){return T(c(r))}var p={handleSymbol:l,MathAdtCleaner:A,lognormal:b,operationParser:_,functionParser:d,nodeParser:y,topLevel:T,run:S},h=/\.\+/g;function G(r){return r.replace(h,">>>")}function g(r){var t=s.parseMath(G(r)),o=n._2(i.R.bind,t,function(r){var n=u(r);return void 0!==n?e({TAG:0,_0:n},Symbol.for("name"),"Ok"):e({TAG:1,_0:"MathJsParse Error"},Symbol.for("name"),"Error")});return n._2(i.R.bind,o,S)}var E=g;exports.MathJsonToMathJsAdt=m,exports.MathAdtToDistDst=p,exports.pointwiseToRightLogShift=G,exports.fromString2=g,exports.fromString=E;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/js_dict.js":"GWKE","rescript/lib/js/belt_Array.js":"yUxI","@glennsl/bs-json/src/Json_decode.bs.js":"kurU","../utility/E.bs.js":"xX5m","./Mathjs.bs.js":"SRZe"}],"AuT8":[function(require,module,exports) {
var define;
var n;!function(r,t){"object"==typeof exports?module.exports=t():"function"==typeof n&&n.amd?n(t):r.jStat=t()}(this,function(){var n=function(n,r){var t=Array.prototype.concat,e=Array.prototype.slice,o=Object.prototype.toString;function a(r,t){var e=r>t?r:t;return n.pow(10,17-~~(n.log(e>0?e:-e)*n.LOG10E))}var u=Array.isArray||function(n){return"[object Array]"===o.call(n)};function i(n){return"[object Function]"===o.call(n)}function f(n){return"number"==typeof n&&n-n==0}function c(){return new c._init(arguments)}function l(){return 0}function s(){return 1}function m(n,r){return n===r?1:0}c.fn=c.prototype,c._init=function(n){if(u(n[0]))if(u(n[0][0])){i(n[1])&&(n[0]=c.map(n[0],n[1]));for(var r=0;r<n[0].length;r++)this[r]=n[0][r];this.length=n[0].length}else this[0]=i(n[1])?c.map(n[0],n[1]):n[0],this.length=1;else if(f(n[0]))this[0]=c.seq.apply(null,n),this.length=1;else{if(n[0]instanceof c)return c(n[0].toArray());this[0]=[],this.length=1}return this},c._init.prototype=c.prototype,c._init.constructor=c,c.utils={calcRdx:a,isArray:u,isFunction:i,isNumber:f,toVector:function(n){return t.apply([],n)}},c._random_fn=n.random,c.setRandom=function(n){if("function"!=typeof n)throw new TypeError("fn is not a function");c._random_fn=n},c.extend=function(n){var r,t;if(1===arguments.length){for(t in n)c[t]=n[t];return this}for(r=1;r<arguments.length;r++)for(t in arguments[r])n[t]=arguments[r][t];return n},c.rows=function(n){return n.length||1},c.cols=function(n){return n[0].length||1},c.dimensions=function(n){return{rows:c.rows(n),cols:c.cols(n)}},c.row=function(n,r){return u(r)?r.map(function(r){return c.row(n,r)}):n[r]},c.rowa=function(n,r){return c.row(n,r)},c.col=function(n,r){if(u(r)){var t=c.arange(n.length).map(function(){return new Array(r.length)});return r.forEach(function(r,e){c.arange(n.length).forEach(function(o){t[o][e]=n[o][r]})}),t}for(var e=new Array(n.length),o=0;o<n.length;o++)e[o]=[n[o][r]];return e},c.cola=function(n,r){return c.col(n,r).map(function(n){return n[0]})},c.diag=function(n){for(var r=c.rows(n),t=new Array(r),e=0;e<r;e++)t[e]=[n[e][e]];return t},c.antidiag=function(n){for(var r=c.rows(n)-1,t=new Array(r),e=0;r>=0;r--,e++)t[e]=[n[e][r]];return t},c.transpose=function(n){var r,t,e,o,a,i=[];for(u(n[0])||(n=[n]),t=n.length,e=n[0].length,a=0;a<e;a++){for(r=new Array(t),o=0;o<t;o++)r[o]=n[o][a];i.push(r)}return 1===i.length?i[0]:i},c.map=function(n,r,t){var e,o,a,i,f;for(u(n[0])||(n=[n]),o=n.length,a=n[0].length,i=t?n:new Array(o),e=0;e<o;e++)for(i[e]||(i[e]=new Array(a)),f=0;f<a;f++)i[e][f]=r(n[e][f],e,f);return 1===i.length?i[0]:i},c.cumreduce=function(n,r,t){var e,o,a,i,f;for(u(n[0])||(n=[n]),o=n.length,a=n[0].length,i=t?n:new Array(o),e=0;e<o;e++)for(i[e]||(i[e]=new Array(a)),a>0&&(i[e][0]=n[e][0]),f=1;f<a;f++)i[e][f]=r(i[e][f-1],n[e][f]);return 1===i.length?i[0]:i},c.alter=function(n,r){return c.map(n,r,!0)},c.create=function(n,r,t){var e,o,a=new Array(n);for(i(r)&&(t=r,r=n),e=0;e<n;e++)for(a[e]=new Array(r),o=0;o<r;o++)a[e][o]=t(e,o);return a},c.zeros=function(n,r){return f(r)||(r=n),c.create(n,r,l)},c.ones=function(n,r){return f(r)||(r=n),c.create(n,r,s)},c.rand=function(n,r){return f(r)||(r=n),c.create(n,r,c._random_fn)},c.identity=function(n,r){return f(r)||(r=n),c.create(n,r,m)},c.symmetric=function(n){var r,t,e=n.length;if(n.length!==n[0].length)return!1;for(r=0;r<e;r++)for(t=0;t<e;t++)if(n[t][r]!==n[r][t])return!1;return!0},c.clear=function(n){return c.alter(n,l)},c.seq=function(n,r,t,e){i(e)||(e=!1);var o,u=[],f=a(n,r),c=(r*f-n*f)/((t-1)*f),l=n;for(o=0;l<=r&&o<t;l=(n*f+c*f*++o)/f)u.push(e?e(l,o):l);return u},c.arange=function(n,t,e){var o,a=[];if(e=e||1,t===r&&(t=n,n=0),n===t||0===e)return[];if(n<t&&e<0)return[];if(n>t&&e>0)return[];if(e>0)for(o=n;o<t;o+=e)a.push(o);else for(o=n;o>t;o+=e)a.push(o);return a},c.slice=function(){function n(n,t,e,o){var a,u=[],i=n.length;if(t===r&&e===r&&o===r)return c.copy(n);if(o=o||1,(t=(t=t||0)>=0?t:i+t)===(e=(e=e||n.length)>=0?e:i+e)||0===o)return[];if(t<e&&o<0)return[];if(t>e&&o>0)return[];if(o>0)for(a=t;a<e;a+=o)u.push(n[a]);else for(a=t;a>e;a+=o)u.push(n[a]);return u}return function(r,t){var e,o;return f((t=t||{}).row)?f(t.col)?r[t.row][t.col]:n(c.rowa(r,t.row),(e=t.col||{}).start,e.end,e.step):f(t.col)?n(c.cola(r,t.col),(o=t.row||{}).start,o.end,o.step):(o=t.row||{},e=t.col||{},n(r,o.start,o.end,o.step).map(function(r){return n(r,e.start,e.end,e.step)}))}}(),c.sliceAssign=function(t,e,o){var a,u;if(f(e.row)){if(f(e.col))return t[e.row][e.col]=o;e.col=e.col||{},e.col.start=e.col.start||0,e.col.end=e.col.end||t[0].length,e.col.step=e.col.step||1,a=c.arange(e.col.start,n.min(t.length,e.col.end),e.col.step);var i=e.row;return a.forEach(function(n,r){t[i][n]=o[r]}),t}if(f(e.col)){e.row=e.row||{},e.row.start=e.row.start||0,e.row.end=e.row.end||t.length,e.row.step=e.row.step||1,u=c.arange(e.row.start,n.min(t[0].length,e.row.end),e.row.step);var l=e.col;return u.forEach(function(n,r){t[n][l]=o[r]}),t}return o[0].length===r&&(o=[o]),e.row.start=e.row.start||0,e.row.end=e.row.end||t.length,e.row.step=e.row.step||1,e.col.start=e.col.start||0,e.col.end=e.col.end||t[0].length,e.col.step=e.col.step||1,u=c.arange(e.row.start,n.min(t.length,e.row.end),e.row.step),a=c.arange(e.col.start,n.min(t[0].length,e.col.end),e.col.step),u.forEach(function(n,r){a.forEach(function(e,a){t[n][e]=o[r][a]})}),t},c.diagonal=function(n){var r=c.zeros(n.length,n.length);return n.forEach(function(n,t){r[t][t]=n}),r},c.copy=function(n){return n.map(function(n){return f(n)?n:n.map(function(n){return n})})};var g=c.prototype;return g.length=0,g.push=Array.prototype.push,g.sort=Array.prototype.sort,g.splice=Array.prototype.splice,g.slice=Array.prototype.slice,g.toArray=function(){return this.length>1?e.call(this):e.call(this)[0]},g.map=function(n,r){return c(c.map(this,n,r))},g.cumreduce=function(n,r){return c(c.cumreduce(this,n,r))},g.alter=function(n){return c.alter(this,n),this},function(n){for(var r=0;r<n.length;r++)!function(n){g[n]=function(r){var t,e=this;return r?(setTimeout(function(){r.call(e,g[n].call(e))}),this):(t=c[n](this),u(t)?c(t):t)}}(n[r])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(n){for(var r=0;r<n.length;r++)!function(n){g[n]=function(r,t){var e=this;return t?(setTimeout(function(){t.call(e,g[n].call(e,r))}),this):c(c[n](this,r))}}(n[r])}("row col".split(" ")),function(n){for(var r=0;r<n.length;r++)!function(n){g[n]=function(){return c(c[n].apply(null,arguments))}}(n[r])}("create zeros ones rand identity".split(" ")),c}(Math);return function(n,r){var t=n.utils.isFunction;function e(n,r){return n-r}function o(n,t,e){return r.max(t,r.min(n,e))}n.sum=function(n){for(var r=0,t=n.length;--t>=0;)r+=n[t];return r},n.sumsqrd=function(n){for(var r=0,t=n.length;--t>=0;)r+=n[t]*n[t];return r},n.sumsqerr=function(r){for(var t,e=n.mean(r),o=0,a=r.length;--a>=0;)o+=(t=r[a]-e)*t;return o},n.sumrow=function(n){for(var r=0,t=n.length;--t>=0;)r+=n[t];return r},n.product=function(n){for(var r=1,t=n.length;--t>=0;)r*=n[t];return r},n.min=function(n){for(var r=n[0],t=0;++t<n.length;)n[t]<r&&(r=n[t]);return r},n.max=function(n){for(var r=n[0],t=0;++t<n.length;)n[t]>r&&(r=n[t]);return r},n.unique=function(n){for(var r={},t=[],e=0;e<n.length;e++)r[n[e]]||(r[n[e]]=!0,t.push(n[e]));return t},n.mean=function(r){return n.sum(r)/r.length},n.meansqerr=function(r){return n.sumsqerr(r)/r.length},n.geomean=function(t){return r.pow(n.product(t),1/t.length)},n.median=function(n){var r=n.length,t=n.slice().sort(e);return 1&r?t[r/2|0]:(t[r/2-1]+t[r/2])/2},n.cumsum=function(r){return n.cumreduce(r,function(n,r){return n+r})},n.cumprod=function(r){return n.cumreduce(r,function(n,r){return n*r})},n.diff=function(n){var r,t=[],e=n.length;for(r=1;r<e;r++)t.push(n[r]-n[r-1]);return t},n.rank=function(n){for(var r,t=n.length,o=n.slice().sort(e),a=new Array(t),u=0;u<t;u++){var i=o.indexOf(n[u]),f=o.lastIndexOf(n[u]);r=i===f?i:(i+f)/2,a[u]=r+1}return a},n.mode=function(n){var r,t=n.length,o=n.slice().sort(e),a=1,u=0,i=0,f=[];for(r=0;r<t;r++)o[r]===o[r+1]?a++:(a>u?(f=[o[r]],u=a,i=0):a===u&&(f.push(o[r]),i++),a=1);return 0===i?f[0]:f},n.range=function(r){return n.max(r)-n.min(r)},n.variance=function(r,t){return n.sumsqerr(r)/(r.length-(t?1:0))},n.pooledvariance=function(r){return r.reduce(function(r,t){return r+n.sumsqerr(t)},0)/(r.reduce(function(n,r){return n+r.length},0)-r.length)},n.deviation=function(r){for(var t=n.mean(r),e=r.length,o=new Array(e),a=0;a<e;a++)o[a]=r[a]-t;return o},n.stdev=function(t,e){return r.sqrt(n.variance(t,e))},n.pooledstdev=function(t){return r.sqrt(n.pooledvariance(t))},n.meandev=function(t){for(var e=n.mean(t),o=[],a=t.length-1;a>=0;a--)o.push(r.abs(t[a]-e));return n.mean(o)},n.meddev=function(t){for(var e=n.median(t),o=[],a=t.length-1;a>=0;a--)o.push(r.abs(t[a]-e));return n.median(o)},n.coeffvar=function(r){return n.stdev(r)/n.mean(r)},n.quartiles=function(n){var t=n.length,o=n.slice().sort(e);return[o[r.round(t/4)-1],o[r.round(t/2)-1],o[r.round(3*t/4)-1]]},n.quantiles=function(n,t,a,u){var i,f,c,l,s,m=n.slice().sort(e),g=[t.length],p=n.length;for(void 0===a&&(a=3/8),void 0===u&&(u=3/8),i=0;i<t.length;i++)c=p*(f=t[i])+(a+f*(1-a-u)),l=r.floor(o(c,1,p-1)),s=o(c-l,0,1),g[i]=(1-s)*m[l-1]+s*m[l];return g},n.percentile=function(n,r,t){var o=n.slice().sort(e),a=r*(o.length+(t?1:-1))+(t?0:1),u=parseInt(a),i=a-u;return u+1<o.length?o[u-1]+i*(o[u]-o[u-1]):o[u-1]},n.percentileOfScore=function(n,r,t){var e,o,a=0,u=n.length,i=!1;for("strict"===t&&(i=!0),o=0;o<u;o++)e=n[o],(i&&e<r||!i&&e<=r)&&a++;return a/u},n.histogram=function(t,e){e=e||4;var o,a=n.min(t),u=(n.max(t)-a)/e,i=t.length,f=[];for(o=0;o<e;o++)f[o]=0;for(o=0;o<i;o++)f[r.min(r.floor((t[o]-a)/u),e-1)]+=1;return f},n.covariance=function(r,t){var e,o=n.mean(r),a=n.mean(t),u=r.length,i=new Array(u);for(e=0;e<u;e++)i[e]=(r[e]-o)*(t[e]-a);return n.sum(i)/(u-1)},n.corrcoeff=function(r,t){return n.covariance(r,t)/n.stdev(r,1)/n.stdev(t,1)},n.spearmancoeff=function(r,t){return r=n.rank(r),t=n.rank(t),n.corrcoeff(r,t)},n.stanMoment=function(t,e){for(var o=n.mean(t),a=n.stdev(t),u=t.length,i=0,f=0;f<u;f++)i+=r.pow((t[f]-o)/a,e);return i/t.length},n.skewness=function(r){return n.stanMoment(r,3)},n.kurtosis=function(r){return n.stanMoment(r,4)-3};var a=n.prototype;!function(r){for(var e=0;e<r.length;e++)!function(r){a[r]=function(e,o){var u=[],i=0,f=this;if(t(e)&&(o=e,e=!1),o)return setTimeout(function(){o.call(f,a[r].call(f,e))}),this;if(this.length>1){for(f=!0===e?this:this.transpose();i<f.length;i++)u[i]=n[r](f[i]);return u}return n[r](this[0],e)}}(r[e])}("cumsum cumprod".split(" ")),function(r){for(var e=0;e<r.length;e++)!function(r){a[r]=function(e,o){var u=[],i=0,f=this;if(t(e)&&(o=e,e=!1),o)return setTimeout(function(){o.call(f,a[r].call(f,e))}),this;if(this.length>1){for("sumrow"!==r&&(f=!0===e?this:this.transpose());i<f.length;i++)u[i]=n[r](f[i]);return!0===e?n[r](n.utils.toVector(u)):u}return n[r](this[0],e)}}(r[e])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(r){for(var e=0;e<r.length;e++)!function(r){a[r]=function(){var e,o=[],u=0,i=this,f=Array.prototype.slice.call(arguments);if(t(f[f.length-1])){e=f[f.length-1];var c=f.slice(0,f.length-1);return setTimeout(function(){e.call(i,a[r].apply(i,c))}),this}e=void 0;var l=function(t){return n[r].apply(i,[t].concat(f))};if(this.length>1){for(i=i.transpose();u<i.length;u++)o[u]=l(i[u]);return o}return l(this[0])}}(r[e])}("quantiles percentileOfScore".split(" "))}(n,Math),function(n,r){n.gammaln=function(n){var t,e,o,a=0,u=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],i=1.000000000190015;for(o=(e=t=n)+5.5,o-=(t+.5)*r.log(o);a<6;a++)i+=u[a]/++e;return r.log(2.5066282746310007*i/t)-o},n.loggam=function(n){var t,e,o,a,u,i,f,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(t=n,f=0,1==n||2==n)return 0;for(n<=7&&(t=n+(f=r.floor(7-n))),e=1/(t*t),o=2*r.PI,u=c[9],i=8;i>=0;i--)u*=e,u+=c[i];if(a=u/t+.5*r.log(o)+(t-.5)*r.log(t)-t,n<=7)for(i=1;i<=f;i++)a-=r.log(t-1),t-=1;return a},n.gammafn=function(n){var t,e,o,a,u=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],i=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],f=!1,c=0,l=0,s=0,m=n;if(m<=0){if(!(a=m%1+3.6e-16))return 1/0;f=(1&m?-1:1)*r.PI/r.sin(r.PI*a),m=1-m}for(o=m,e=m<1?m++:(m-=c=(0|m)-1)-1,t=0;t<8;++t)s=(s+u[t])*e,l=l*e+i[t];if(a=s/l+1,o<m)a/=o;else if(o>m)for(t=0;t<c;++t)a*=m,m++;return f&&(a=f/a),a},n.gammap=function(r,t){return n.lowRegGamma(r,t)*n.gammafn(r)},n.lowRegGamma=function(t,e){var o,a=n.gammaln(t),u=t,i=1/t,f=i,c=e+1-t,l=1/1e-30,s=1/c,m=s,g=1,p=-~(8.5*r.log(t>=1?t:1/t)+.4*t+17);if(e<0||t<=0)return NaN;if(e<t+1){for(;g<=p;g++)i+=f*=e/++u;return i*r.exp(-e+t*r.log(e)-a)}for(;g<=p;g++)m*=(s=1/(s=(o=-g*(g-t))*s+(c+=2)))*(l=c+o/l);return 1-m*r.exp(-e+t*r.log(e)-a)},n.factorialln=function(r){return r<0?NaN:n.gammaln(r+1)},n.factorial=function(r){return r<0?NaN:n.gammafn(r+1)},n.combination=function(t,e){return t>170||e>170?r.exp(n.combinationln(t,e)):n.factorial(t)/n.factorial(e)/n.factorial(t-e)},n.combinationln=function(r,t){return n.factorialln(r)-n.factorialln(t)-n.factorialln(r-t)},n.permutation=function(r,t){return n.factorial(r)/n.factorial(r-t)},n.betafn=function(t,e){if(!(t<=0||e<=0))return t+e>170?r.exp(n.betaln(t,e)):n.gammafn(t)*n.gammafn(e)/n.gammafn(t+e)},n.betaln=function(r,t){return n.gammaln(r)+n.gammaln(t)-n.gammaln(r+t)},n.betacf=function(n,t,e){var o,a,u,i,f=1,c=t+e,l=t+1,s=t-1,m=1,g=1-c*n/l;for(r.abs(g)<1e-30&&(g=1e-30),i=g=1/g;f<=100&&(g=1+(a=f*(e-f)*n/((s+(o=2*f))*(t+o)))*g,r.abs(g)<1e-30&&(g=1e-30),m=1+a/m,r.abs(m)<1e-30&&(m=1e-30),i*=(g=1/g)*m,g=1+(a=-(t+f)*(c+f)*n/((t+o)*(l+o)))*g,r.abs(g)<1e-30&&(g=1e-30),m=1+a/m,r.abs(m)<1e-30&&(m=1e-30),i*=u=(g=1/g)*m,!(r.abs(u-1)<3e-7));f++);return i},n.gammapinv=function(t,e){var o,a,u,i,f,c,l=0,s=e-1,m=n.gammaln(e);if(t>=1)return r.max(100,e+100*r.sqrt(e));if(t<=0)return 0;for(e>1?(f=r.log(s),c=r.exp(s*(f-1)-m),i=t<.5?t:1-t,o=(2.30753+.27061*(a=r.sqrt(-2*r.log(i))))/(1+a*(.99229+.04481*a))-a,t<.5&&(o=-o),o=r.max(.001,e*r.pow(1-1/(9*e)-o/(3*r.sqrt(e)),3))):o=t<(a=1-e*(.253+.12*e))?r.pow(t/a,1/e):1-r.log(1-(t-a)/(1-a));l<12;l++){if(o<=0)return 0;if((o-=a=(u=(n.lowRegGamma(e,o)-t)/(a=e>1?c*r.exp(-(o-s)+s*(r.log(o)-f)):r.exp(-o+s*r.log(o)-m)))/(1-.5*r.min(1,u*((e-1)/o-1))))<=0&&(o=.5*(o+a)),r.abs(a)<1e-8*o)break}return o},n.erf=function(n){var t,e,o,a,u=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,9.6467911e-11,2.394038e-12,-6.886027e-12,8.94487e-13,3.13092e-13,-1.12708e-13,3.81e-16,7.106e-15,-1.523e-15,-9.4e-17,1.21e-16,-2.8e-17],i=u.length-1,f=!1,c=0,l=0;for(n<0&&(n=-n,f=!0),e=4*(t=2/(2+n))-2;i>0;i--)o=c,c=e*c-l+u[i],l=o;return a=t*r.exp(-n*n+.5*(u[0]+e*c)-l),f?a-1:1-a},n.erfc=function(r){return 1-n.erf(r)},n.erfcinv=function(t){var e,o,a,u,i=0;if(t>=2)return-100;if(t<=0)return 100;for(u=t<1?t:2-t,e=-.70711*((2.30753+.27061*(a=r.sqrt(-2*r.log(u/2))))/(1+a*(.99229+.04481*a))-a);i<2;i++)e+=(o=n.erfc(e)-u)/(1.1283791670955126*r.exp(-e*e)-e*o);return t<1?e:-e},n.ibetainv=function(t,e,o){var a,u,i,f,c,l,s,m,g,p,d=e-1,h=o-1,v=0;if(t<=0)return 0;if(t>=1)return 1;for(e>=1&&o>=1?(i=t<.5?t:1-t,l=(2.30753+.27061*(f=r.sqrt(-2*r.log(i))))/(1+f*(.99229+.04481*f))-f,t<.5&&(l=-l),s=(l*l-3)/6,m=2/(1/(2*e-1)+1/(2*o-1)),g=l*r.sqrt(s+m)/m-(1/(2*o-1)-1/(2*e-1))*(s+5/6-2/(3*m)),l=e/(e+o*r.exp(2*g))):(a=r.log(e/(e+o)),u=r.log(o/(e+o)),l=t<(f=r.exp(e*a)/e)/(g=f+(c=r.exp(o*u)/o))?r.pow(e*g*t,1/e):1-r.pow(o*g*(1-t),1/o)),p=-n.gammaln(e)-n.gammaln(o)+n.gammaln(e+o);v<10;v++){if(0===l||1===l)return l;if((l-=f=(c=(n.ibeta(l,e,o)-t)/(f=r.exp(d*r.log(l)+h*r.log(1-l)+p)))/(1-.5*r.min(1,c*(d/l-h/(1-l)))))<=0&&(l=.5*(l+f)),l>=1&&(l=.5*(l+f+1)),r.abs(f)<1e-8*l&&v>0)break}return l},n.ibeta=function(t,e,o){var a=0===t||1===t?0:r.exp(n.gammaln(e+o)-n.gammaln(e)-n.gammaln(o)+e*r.log(t)+o*r.log(1-t));return!(t<0||t>1)&&(t<(e+1)/(e+o+2)?a*n.betacf(t,e,o)/e:1-a*n.betacf(1-t,o,e)/o)},n.randn=function(t,e){var o,a,u,i,f;if(e||(e=t),t)return n.create(t,e,function(){return n.randn()});do{o=n._random_fn(),a=1.7156*(n._random_fn()-.5),f=(u=o-.449871)*u+(i=r.abs(a)+.386595)*(.196*i-.25472*u)}while(f>.27597&&(f>.27846||a*a>-4*r.log(o)*o*o));return a/o},n.randg=function(t,e,o){var a,u,i,f,c,l,s=t;if(o||(o=e),t||(t=1),e)return(l=n.zeros(e,o)).alter(function(){return n.randg(t)}),l;t<1&&(t+=1),a=t-1/3,u=1/r.sqrt(9*a);do{do{f=1+u*(c=n.randn())}while(f<=0);f*=f*f,i=n._random_fn()}while(i>1-.331*r.pow(c,4)&&r.log(i)>.5*c*c+a*(1-f+r.log(f)));if(t==s)return a*f;do{i=n._random_fn()}while(0===i);return r.pow(i,1/s)*a*f},function(r){for(var t=0;t<r.length;t++)!function(r){n.fn[r]=function(){return n(n.map(this,function(t){return n[r](t)}))}}(r[t])}("gammaln gammafn factorial factorialln".split(" ")),function(r){for(var t=0;t<r.length;t++)!function(r){n.fn[r]=function(){return n(n[r].apply(null,arguments))}}(r[t])}("randn".split(" "))}(n,Math),function(n,r){function t(n,t,e,o){for(var a,u=0,i=1,f=1,c=1,l=0,s=0;r.abs((f-s)/f)>o;)s=f,i=c+(a=-(t+l)*(t+e+l)*n/(t+2*l)/(t+2*l+1))*i,f=(u=f+a*u)+(a=(l+=1)*(e-l)*n/(t+2*l-1)/(t+2*l))*f,u/=c=i+a*c,i/=c,f/=c,c=1;return f/t}function e(t,e,o){var a=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],u=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],i=.5*t;if(i>=8)return 1;var f,c=2*n.normal.cdf(i,0,1,1,0)-1;c=c>=r.exp(-50/o)?r.pow(c,o):0;for(var l=i,s=(8-i)/(f=t>3?2:3),m=l+s,g=0,p=o-1,d=1;d<=f;d++){for(var h=0,v=.5*(m+l),w=.5*(m-l),y=1;y<=12;y++){var b,x=v+w*(6<y?a[(b=12-y+1)-1]:-a[(b=y)-1]),q=x*x;if(q>60)break;var _=.5*(2*n.normal.cdf(x,0,1,1,0))-.5*(2*n.normal.cdf(x,t,1,1,0));_>=r.exp(-30/p)&&(h+=_=u[b-1]*r.exp(-.5*q)*r.pow(_,p))}g+=h*=2*w*o/r.sqrt(2*r.PI),l=m,m+=s}return(c+=g)<=r.exp(-30/e)?0:(c=r.pow(c,e))>=1?1:c}!function(r){for(var t=0;t<r.length;t++)!function(r){n[r]=function(n,r,t){return this instanceof arguments.callee?(this._a=n,this._b=r,this._c=t,this):new arguments.callee(n,r,t)},n.fn[r]=function(t,e,o){var a=n[r](t,e,o);return a.data=this,a},n[r].prototype.sample=function(t){var e=this._a,o=this._b,a=this._c;return t?n.alter(t,function(){return n[r].sample(e,o,a)}):n[r].sample(e,o,a)},function(t){for(var e=0;e<t.length;e++)!function(t){n[r].prototype[t]=function(e){var o=this._a,a=this._b,u=this._c;return e||0===e||(e=this.data),"number"!=typeof e?n.fn.map.call(e,function(e){return n[r][t](e,o,a,u)}):n[r][t](e,o,a,u)}}(t[e])}("pdf cdf inv".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){n[r].prototype[t]=function(){return n[r][t](this._a,this._b,this._c)}}(t[e])}("mean median mode variance".split(" "))}(r[t])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),n.extend(n.beta,{pdf:function(t,e,o){return t>1||t<0?0:1==e&&1==o?1:e<512&&o<512?r.pow(t,e-1)*r.pow(1-t,o-1)/n.betafn(e,o):r.exp((e-1)*r.log(t)+(o-1)*r.log(1-t)-n.betaln(e,o))},cdf:function(r,t,e){return r>1||r<0?1*(r>1):n.ibeta(r,t,e)},inv:function(r,t,e){return n.ibetainv(r,t,e)},mean:function(n,r){return n/(n+r)},median:function(r,t){return n.ibetainv(.5,r,t)},mode:function(n,r){return(n-1)/(n+r-2)},sample:function(r,t){var e=n.randg(r);return e/(e+n.randg(t))},variance:function(n,t){return n*t/(r.pow(n+t,2)*(n+t+1))}}),n.extend(n.centralF,{pdf:function(t,e,o){var a;return t<0?0:e<=2?0===t&&e<2?1/0:0===t&&2===e?1:1/n.betafn(e/2,o/2)*r.pow(e/o,e/2)*r.pow(t,e/2-1)*r.pow(1+e/o*t,-(e+o)/2):(a=e*t/(o+t*e),e*(o/(o+t*e))/2*n.binomial.pdf((e-2)/2,(e+o-2)/2,a))},cdf:function(r,t,e){return r<0?0:n.ibeta(t*r/(t*r+e),t/2,e/2)},inv:function(r,t,e){return e/(t*(1/n.ibetainv(r,t/2,e/2)-1))},mean:function(n,r){return r>2?r/(r-2):void 0},mode:function(n,r){return n>2?r*(n-2)/(n*(r+2)):void 0},sample:function(r,t){return 2*n.randg(r/2)/r/(2*n.randg(t/2)/t)},variance:function(n,r){if(!(r<=4))return 2*r*r*(n+r-2)/(n*(r-2)*(r-2)*(r-4))}}),n.extend(n.cauchy,{pdf:function(n,t,e){return e<0?0:e/(r.pow(n-t,2)+r.pow(e,2))/r.PI},cdf:function(n,t,e){return r.atan((n-t)/e)/r.PI+.5},inv:function(n,t,e){return t+e*r.tan(r.PI*(n-.5))},median:function(n){return n},mode:function(n){return n},sample:function(t,e){return n.randn()*r.sqrt(1/(2*n.randg(.5)))*e+t}}),n.extend(n.chisquare,{pdf:function(t,e){return t<0?0:0===t&&2===e?.5:r.exp((e/2-1)*r.log(t)-t/2-e/2*r.log(2)-n.gammaln(e/2))},cdf:function(r,t){return r<0?0:n.lowRegGamma(t/2,r/2)},inv:function(r,t){return 2*n.gammapinv(r,.5*t)},mean:function(n){return n},median:function(n){return n*r.pow(1-2/(9*n),3)},mode:function(n){return n-2>0?n-2:0},sample:function(r){return 2*n.randg(r/2)},variance:function(n){return 2*n}}),n.extend(n.exponential,{pdf:function(n,t){return n<0?0:t*r.exp(-t*n)},cdf:function(n,t){return n<0?0:1-r.exp(-t*n)},inv:function(n,t){return-r.log(1-n)/t},mean:function(n){return 1/n},median:function(n){return 1/n*r.log(2)},mode:function(){return 0},sample:function(t){return-1/t*r.log(n._random_fn())},variance:function(n){return r.pow(n,-2)}}),n.extend(n.gamma,{pdf:function(t,e,o){return t<0?0:0===t&&1===e?1/o:r.exp((e-1)*r.log(t)-t/o-n.gammaln(e)-e*r.log(o))},cdf:function(r,t,e){return r<0?0:n.lowRegGamma(t,r/e)},inv:function(r,t,e){return n.gammapinv(r,t)*e},mean:function(n,r){return n*r},mode:function(n,r){if(n>1)return(n-1)*r},sample:function(r,t){return n.randg(r)*t},variance:function(n,r){return n*r*r}}),n.extend(n.invgamma,{pdf:function(t,e,o){return t<=0?0:r.exp(-(e+1)*r.log(t)-o/t-n.gammaln(e)+e*r.log(o))},cdf:function(r,t,e){return r<=0?0:1-n.lowRegGamma(t,e/r)},inv:function(r,t,e){return e/n.gammapinv(1-r,t)},mean:function(n,r){return n>1?r/(n-1):void 0},mode:function(n,r){return r/(n+1)},sample:function(r,t){return t/n.randg(r)},variance:function(n,r){if(!(n<=2))return r*r/((n-1)*(n-1)*(n-2))}}),n.extend(n.kumaraswamy,{pdf:function(n,t,e){return 0===n&&1===t?e:1===n&&1===e?t:r.exp(r.log(t)+r.log(e)+(t-1)*r.log(n)+(e-1)*r.log(1-r.pow(n,t)))},cdf:function(n,t,e){return n<0?0:n>1?1:1-r.pow(1-r.pow(n,t),e)},inv:function(n,t,e){return r.pow(1-r.pow(1-n,1/e),1/t)},mean:function(r,t){return t*n.gammafn(1+1/r)*n.gammafn(t)/n.gammafn(1+1/r+t)},median:function(n,t){return r.pow(1-r.pow(2,-1/t),1/n)},mode:function(n,t){if(n>=1&&t>=1&&1!==n&&1!==t)return r.pow((n-1)/(n*t-1),1/n)},variance:function(){throw new Error("variance not yet implemented")}}),n.extend(n.lognormal,{pdf:function(n,t,e){return n<=0?0:r.exp(-r.log(n)-.5*r.log(2*r.PI)-r.log(e)-r.pow(r.log(n)-t,2)/(2*e*e))},cdf:function(t,e,o){return t<0?0:.5+.5*n.erf((r.log(t)-e)/r.sqrt(2*o*o))},inv:function(t,e,o){return r.exp(-1.4142135623730951*o*n.erfcinv(2*t)+e)},mean:function(n,t){return r.exp(n+t*t/2)},median:function(n){return r.exp(n)},mode:function(n,t){return r.exp(n-t*t)},sample:function(t,e){return r.exp(n.randn()*e+t)},variance:function(n,t){return(r.exp(t*t)-1)*r.exp(2*n+t*t)}}),n.extend(n.noncentralt,{pdf:function(t,e,o){return r.abs(o)<1e-14?n.studentt.pdf(t,e):r.abs(t)<1e-14?r.exp(n.gammaln((e+1)/2)-o*o/2-.5*r.log(r.PI*e)-n.gammaln(e/2)):e/t*(n.noncentralt.cdf(t*r.sqrt(1+2/e),e+2,o)-n.noncentralt.cdf(t,e,o))},cdf:function(t,e,o){if(r.abs(o)<1e-14)return n.studentt.cdf(t,e);var a=!1;t<0&&(a=!0,o=-o);for(var u=n.normal.cdf(-o,0,1),i=1e-14+1,f=i,c=t*t/(t*t+e),l=0,s=r.exp(-o*o/2),m=r.exp(-o*o/2-.5*r.log(2)-n.gammaln(1.5))*o;l<200||f>1e-14||i>1e-14;)f=i,l>0&&(s*=o*o/(2*l),m*=o*o/(2*(l+.5))),u+=.5*(i=s*n.beta.cdf(c,l+.5,e/2)+m*n.beta.cdf(c,l+1,e/2)),l++;return a?1-u:u}}),n.extend(n.normal,{pdf:function(n,t,e){return r.exp(-.5*r.log(2*r.PI)-r.log(e)-r.pow(n-t,2)/(2*e*e))},cdf:function(t,e,o){return.5*(1+n.erf((t-e)/r.sqrt(2*o*o)))},inv:function(r,t,e){return-1.4142135623730951*e*n.erfcinv(2*r)+t},mean:function(n){return n},median:function(n){return n},mode:function(n){return n},sample:function(r,t){return n.randn()*t+r},variance:function(n,r){return r*r}}),n.extend(n.pareto,{pdf:function(n,t,e){return n<t?0:e*r.pow(t,e)/r.pow(n,e+1)},cdf:function(n,t,e){return n<t?0:1-r.pow(t/n,e)},inv:function(n,t,e){return t/r.pow(1-n,1/e)},mean:function(n,t){if(!(t<=1))return t*r.pow(n,t)/(t-1)},median:function(n,t){return n*(t*r.SQRT2)},mode:function(n){return n},variance:function(n,t){if(!(t<=2))return n*n*t/(r.pow(t-1,2)*(t-2))}}),n.extend(n.studentt,{pdf:function(t,e){return e=e>1e100?1e100:e,1/(r.sqrt(e)*n.betafn(.5,e/2))*r.pow(1+t*t/e,-(e+1)/2)},cdf:function(t,e){var o=e/2;return n.ibeta((t+r.sqrt(t*t+e))/(2*r.sqrt(t*t+e)),o,o)},inv:function(t,e){var o=n.ibetainv(2*r.min(t,1-t),.5*e,.5);return o=r.sqrt(e*(1-o)/o),t>.5?o:-o},mean:function(n){return n>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(t){return n.randn()*r.sqrt(t/(2*n.randg(t/2)))},variance:function(n){return n>2?n/(n-2):n>1?1/0:void 0}}),n.extend(n.weibull,{pdf:function(n,t,e){return n<0||t<0||e<0?0:e/t*r.pow(n/t,e-1)*r.exp(-r.pow(n/t,e))},cdf:function(n,t,e){return n<0?0:1-r.exp(-r.pow(n/t,e))},inv:function(n,t,e){return t*r.pow(-r.log(1-n),1/e)},mean:function(r,t){return r*n.gammafn(1+1/t)},median:function(n,t){return n*r.pow(r.log(2),1/t)},mode:function(n,t){return t<=1?0:n*r.pow((t-1)/t,1/t)},sample:function(t,e){return t*r.pow(-r.log(n._random_fn()),1/e)},variance:function(t,e){return t*t*n.gammafn(1+2/e)-r.pow(n.weibull.mean(t,e),2)}}),n.extend(n.uniform,{pdf:function(n,r,t){return n<r||n>t?0:1/(t-r)},cdf:function(n,r,t){return n<r?0:n<t?(n-r)/(t-r):1},inv:function(n,r,t){return r+n*(t-r)},mean:function(n,r){return.5*(n+r)},median:function(r,t){return n.mean(r,t)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(r,t){return r/2+t/2+(t/2-r/2)*(2*n._random_fn()-1)},variance:function(n,t){return r.pow(t-n,2)/12}}),n.extend(n.binomial,{pdf:function(t,e,o){return 0===o||1===o?e*o===t?1:0:n.combination(e,t)*r.pow(o,t)*r.pow(1-o,e-t)},cdf:function(e,o,a){var u;if(e<0)return 0;if(e>=o)return 1;if(a<0||a>1||o<=0)return NaN;var i=a,f=(e=r.floor(e))+1,c=o-e,l=f+c,s=r.exp(n.gammaln(l)-n.gammaln(c)-n.gammaln(f)+f*r.log(i)+c*r.log(1-i));return u=i<(f+1)/(l+2)?s*t(i,f,c,1e-10):1-s*t(1-i,c,f,1e-10),r.round(1e10*(1-u))/1e10}}),n.extend(n.negbin,{pdf:function(t,e,o){return t===t>>>0&&(t<0?0:n.combination(t+e-1,e-1)*r.pow(1-o,t)*r.pow(o,e))},cdf:function(r,t,e){var o=0,a=0;if(r<0)return 0;for(;a<=r;a++)o+=n.negbin.pdf(a,t,e);return o}}),n.extend(n.hypgeom,{pdf:function(t,e,o,a){if(t!=t|0)return!1;if(t<0||t<o-(e-a))return 0;if(t>a||t>o)return 0;if(2*o>e)return 2*a>e?n.hypgeom.pdf(e-o-a+t,e,e-o,e-a):n.hypgeom.pdf(a-t,e,e-o,a);if(2*a>e)return n.hypgeom.pdf(o-t,e,o,e-a);if(o<a)return n.hypgeom.pdf(t,e,a,o);for(var u=1,i=0,f=0;f<t;f++){for(;u>1&&i<a;)u*=1-o/(e-i),i++;u*=(a-f)*(o-f)/((f+1)*(e-o-a+f+1))}for(;i<a;i++)u*=1-o/(e-i);return r.min(1,r.max(0,u))},cdf:function(t,e,o,a){if(t<0||t<o-(e-a))return 0;if(t>=a||t>=o)return 1;if(2*o>e)return 2*a>e?n.hypgeom.cdf(e-o-a+t,e,e-o,e-a):1-n.hypgeom.cdf(a-t-1,e,e-o,a);if(2*a>e)return 1-n.hypgeom.cdf(o-t-1,e,o,e-a);if(o<a)return n.hypgeom.cdf(t,e,a,o);for(var u=1,i=1,f=0,c=0;c<t;c++){for(;u>1&&f<a;){var l=1-o/(e-f);i*=l,u*=l,f++}u+=i*=(a-c)*(o-c)/((c+1)*(e-o-a+c+1))}for(;f<a;f++)u*=1-o/(e-f);return r.min(1,r.max(0,u))}}),n.extend(n.poisson,{pdf:function(t,e){return e<0||t%1!=0||t<0?0:r.pow(e,t)*r.exp(-e)/n.factorial(t)},cdf:function(r,t){var e=[],o=0;if(r<0)return 0;for(;o<=r;o++)e.push(n.poisson.pdf(o,t));return n.sum(e)},mean:function(n){return n},variance:function(n){return n},sampleSmall:function(t){var e=1,o=0,a=r.exp(-t);do{o++,e*=n._random_fn()}while(e>a);return o-1},sampleLarge:function(t){var e,o,a,u,i,f,c,l,s,m,g=t;for(u=r.sqrt(g),i=r.log(g),f=.02483*(c=.931+2.53*u)-.059,l=1.1239+1.1328/(c-3.4),s=.9277-3.6224/(c-2);;){if(o=r.random()-.5,a=r.random(),m=.5-r.abs(o),e=r.floor((2*f/m+c)*o+g+.43),m>=.07&&a<=s)return e;if(!(e<0||m<.013&&a>m)&&r.log(a)+r.log(l)-r.log(f/(m*m)+c)<=e*i-g-n.loggam(e+1))return e}},sample:function(n){return n<10?this.sampleSmall(n):this.sampleLarge(n)}}),n.extend(n.triangular,{pdf:function(n,r,t,e){return t<=r||e<r||e>t?NaN:n<r||n>t?0:n<e?2*(n-r)/((t-r)*(e-r)):n===e?2/(t-r):2*(t-n)/((t-r)*(t-e))},cdf:function(n,t,e,o){return e<=t||o<t||o>e?NaN:n<=t?0:n>=e?1:n<=o?r.pow(n-t,2)/((e-t)*(o-t)):1-r.pow(e-n,2)/((e-t)*(e-o))},inv:function(n,t,e,o){return e<=t||o<t||o>e?NaN:n<=(o-t)/(e-t)?t+(e-t)*r.sqrt(n*((o-t)/(e-t))):t+(e-t)*(1-r.sqrt((1-n)*(1-(o-t)/(e-t))))},mean:function(n,r,t){return(n+r+t)/3},median:function(n,t,e){return e<=(n+t)/2?t-r.sqrt((t-n)*(t-e))/r.sqrt(2):e>(n+t)/2?n+r.sqrt((t-n)*(e-n))/r.sqrt(2):void 0},mode:function(n,r,t){return t},sample:function(t,e,o){var a=n._random_fn();return a<(o-t)/(e-t)?t+r.sqrt(a*(e-t)*(o-t)):e-r.sqrt((1-a)*(e-t)*(e-o))},variance:function(n,r,t){return(n*n+r*r+t*t-n*r-n*t-r*t)/18}}),n.extend(n.arcsine,{pdf:function(n,t,e){return e<=t?NaN:n<=t||n>=e?0:2/r.PI*r.pow(r.pow(e-t,2)-r.pow(2*n-t-e,2),-.5)},cdf:function(n,t,e){return n<t?0:n<e?2/r.PI*r.asin(r.sqrt((n-t)/(e-t))):1},inv:function(n,t,e){return t+(.5-.5*r.cos(r.PI*n))*(e-t)},mean:function(n,r){return r<=n?NaN:(n+r)/2},median:function(n,r){return r<=n?NaN:(n+r)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(t,e){return(t+e)/2+(e-t)/2*r.sin(2*r.PI*n.uniform.sample(0,1))},variance:function(n,t){return t<=n?NaN:r.pow(t-n,2)/8}}),n.extend(n.laplace,{pdf:function(n,t,e){return e<=0?0:r.exp(-r.abs(n-t)/e)/(2*e)},cdf:function(n,t,e){return e<=0?0:n<t?.5*r.exp((n-t)/e):1-.5*r.exp(-(n-t)/e)},mean:function(n){return n},median:function(n){return n},mode:function(n){return n},variance:function(n,r){return 2*r*r},sample:function(t,e){var o,a=n._random_fn()-.5;return t-e*((o=a)/r.abs(o))*r.log(1-2*r.abs(a))}}),n.extend(n.tukey,{cdf:function(t,o,a){var u=o,i=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],f=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(t<=0)return 0;if(a<2||u<2)return NaN;if(!Number.isFinite(t))return 1;if(a>25e3)return e(t,1,u);var c,l=.5*a,s=l*r.log(a)-a*r.log(2)-n.gammaln(l),m=l-1,g=.25*a;c=a<=100?1:a<=800?.5:a<=5e3?.25:.125,s+=r.log(c);for(var p=0,d=1;d<=50;d++){for(var h=0,v=(2*d-1)*c,w=1;w<=16;w++){var y,b;if(8<w?(y=w-8-1,b=s+m*r.log(v+i[y]*c)-(i[y]*c+v)*g):(y=w-1,b=s+m*r.log(v-i[y]*c)+(i[y]*c-v)*g),b>=-30)h+=e(8<w?t*r.sqrt(.5*(i[y]*c+v)):t*r.sqrt(.5*(-i[y]*c+v)),1,u)*f[y]*r.exp(b)}if(d*c>=1&&h<=1e-14)break;p+=h}if(h>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(t,e,o){if(o<2||e<2)return NaN;if(t<0||t>1)return NaN;if(0===t)return 0;if(1===t)return 1/0;var a,u=function(n,t,e){var o=.5-.5*n,a=r.sqrt(r.log(1/(o*o))),u=a+((((-453642210148e-16*a-.204231210125)*a-.342242088547)*a-1)*a+.322232421088)/((((.0038560700634*a+.10353775285)*a+.531103462366)*a+.588581570495)*a+.099348462606);e<120&&(u+=(u*u*u+u)/e/4);var i=.8832-.2368*u;return e<120&&(i+=-1.214/e+1.208*u/e),u*(i*r.log(t-1)+1.4142)}(t,e,o),i=n.tukey.cdf(u,e,o)-t;a=i>0?r.max(0,u-1):u+1;for(var f,c=n.tukey.cdf(a,e,o)-t,l=1;l<50;l++){if(f=a-c*(a-u)/(c-i),i=c,u=a,f<0&&(f=0,c=-t),c=n.tukey.cdf(f,e,o)-t,a=f,r.abs(a-u)<1e-4)return f}throw new Error("tukey.inv failed to converge")}})}(n,Math),function(n,r){var t=Array.prototype.push,e=n.utils.isArray;function o(r){return e(r)||r instanceof n}n.extend({add:function(r,t){return o(t)?(o(t[0])||(t=[t]),n.map(r,function(n,r,e){return n+t[r][e]})):n.map(r,function(n){return n+t})},subtract:function(r,t){return o(t)?(o(t[0])||(t=[t]),n.map(r,function(n,r,e){return n-t[r][e]||0})):n.map(r,function(n){return n-t})},divide:function(r,t){return o(t)?(o(t[0])||(t=[t]),n.multiply(r,n.inv(t))):n.map(r,function(n){return n/t})},multiply:function(r,t){var e,a,u,i,f,c,l,s;if(void 0===r.length&&void 0===t.length)return r*t;if(f=r.length,c=r[0].length,l=n.zeros(f,u=o(t)?t[0].length:c),s=0,o(t)){for(;s<u;s++)for(e=0;e<f;e++){for(i=0,a=0;a<c;a++)i+=r[e][a]*t[a][s];l[e][s]=i}return 1===f&&1===s?l[0][0]:l}return n.map(r,function(n){return n*t})},outer:function(r,t){return n.multiply(r.map(function(n){return[n]}),[t])},dot:function(r,t){o(r[0])||(r=[r]),o(t[0])||(t=[t]);for(var e,a,u=1===r[0].length&&1!==r.length?n.transpose(r):r,i=1===t[0].length&&1!==t.length?n.transpose(t):t,f=[],c=0,l=u.length,s=u[0].length;c<l;c++){for(f[c]=[],e=0,a=0;a<s;a++)e+=u[c][a]*i[c][a];f[c]=e}return 1===f.length?f[0]:f},pow:function(t,e){return n.map(t,function(n){return r.pow(n,e)})},exp:function(t){return n.map(t,function(n){return r.exp(n)})},log:function(t){return n.map(t,function(n){return r.log(n)})},abs:function(t){return n.map(t,function(n){return r.abs(n)})},norm:function(n,t){var e=0,a=0;for(isNaN(t)&&(t=2),o(n[0])&&(n=n[0]);a<n.length;a++)e+=r.pow(r.abs(n[a]),t);return r.pow(e,1/t)},angle:function(t,e){return r.acos(n.dot(t,e)/(n.norm(t)*n.norm(e)))},aug:function(n,r){var e,o=[];for(e=0;e<n.length;e++)o.push(n[e].slice());for(e=0;e<o.length;e++)t.apply(o[e],r[e]);return o},inv:function(r){for(var t,e=r.length,o=r[0].length,a=n.identity(e,o),u=n.gauss_jordan(r,a),i=[],f=0;f<e;f++)for(i[f]=[],t=o;t<u[0].length;t++)i[f][t-o]=u[f][t];return i},det:function(n){var r,t=n.length,e=2*t,o=new Array(e),a=t-1,u=e-1,i=a-t+1,f=u,c=0,l=0;if(2===t)return n[0][0]*n[1][1]-n[0][1]*n[1][0];for(;c<e;c++)o[c]=1;for(c=0;c<t;c++){for(r=0;r<t;r++)o[i<0?i+t:i]*=n[c][r],o[f<t?f+t:f]*=n[c][r],i++,f--;i=--a-t+1,f=--u}for(c=0;c<t;c++)l+=o[c];for(;c<e;c++)l-=o[c];return l},gauss_elimination:function(t,e){var o,a,u,i,f=0,c=0,l=t.length,s=t[0].length,m=1,g=0,p=[];for(o=(t=n.aug(t,e))[0].length,f=0;f<l;f++){for(a=t[f][f],c=f,i=f+1;i<s;i++)a<r.abs(t[i][f])&&(a=t[i][f],c=i);if(c!=f)for(i=0;i<o;i++)u=t[f][i],t[f][i]=t[c][i],t[c][i]=u;for(c=f+1;c<l;c++)for(m=t[c][f]/t[f][f],i=f;i<o;i++)t[c][i]=t[c][i]-m*t[f][i]}for(f=l-1;f>=0;f--){for(g=0,c=f+1;c<=l-1;c++)g+=p[c]*t[f][c];p[f]=(t[f][o-1]-g)/t[f][f]}return p},gauss_jordan:function(t,e){var o,a,u,i=n.aug(t,e),f=i.length,c=i[0].length,l=0;for(a=0;a<f;a++){var s=a;for(u=a+1;u<f;u++)r.abs(i[u][a])>r.abs(i[s][a])&&(s=u);var m=i[a];for(i[a]=i[s],i[s]=m,u=a+1;u<f;u++)for(l=i[u][a]/i[a][a],o=a;o<c;o++)i[u][o]-=i[a][o]*l}for(a=f-1;a>=0;a--){for(l=i[a][a],u=0;u<a;u++)for(o=c-1;o>a-1;o--)i[u][o]-=i[a][o]*i[u][a]/l;for(i[a][a]/=l,o=f;o<c;o++)i[a][o]/=l}return i},triaUpSolve:function(r,t){var e,o=r[0].length,a=n.zeros(1,o)[0],u=!1;return null!=t[0].length&&(t=t.map(function(n){return n[0]}),u=!0),n.arange(o-1,-1,-1).forEach(function(u){e=n.arange(u+1,o).map(function(n){return a[n]*r[u][n]}),a[u]=(t[u]-n.sum(e))/r[u][u]}),u?a.map(function(n){return[n]}):a},triaLowSolve:function(r,t){var e,o=r[0].length,a=n.zeros(1,o)[0],u=!1;return null!=t[0].length&&(t=t.map(function(n){return n[0]}),u=!0),n.arange(o).forEach(function(o){e=n.arange(o).map(function(n){return r[o][n]*a[n]}),a[o]=(t[o]-n.sum(e))/r[o][o]}),u?a.map(function(n){return[n]}):a},lu:function(r){var t,e=r.length,o=n.identity(e),a=n.zeros(r.length,r[0].length);return n.arange(e).forEach(function(n){a[0][n]=r[0][n]}),n.arange(1,e).forEach(function(u){n.arange(u).forEach(function(e){t=n.arange(e).map(function(n){return o[u][n]*a[n][e]}),o[u][e]=(r[u][e]-n.sum(t))/a[e][e]}),n.arange(u,e).forEach(function(e){t=n.arange(u).map(function(n){return o[u][n]*a[n][e]}),a[u][e]=r[t.length][e]-n.sum(t)})}),[o,a]},cholesky:function(t){var e,o=t.length,a=n.zeros(t.length,t[0].length);return n.arange(o).forEach(function(u){e=n.arange(u).map(function(n){return r.pow(a[u][n],2)}),a[u][u]=r.sqrt(t[u][u]-n.sum(e)),n.arange(u+1,o).forEach(function(r){e=n.arange(u).map(function(n){return a[u][n]*a[r][n]}),a[r][u]=(t[u][r]-n.sum(e))/a[u][u]})}),a},gauss_jacobi:function(t,e,o,a){for(var u,i,f,c,l=0,s=0,m=t.length,g=[],p=[],d=[];l<m;l++)for(g[l]=[],p[l]=[],d[l]=[],s=0;s<m;s++)l>s?(g[l][s]=t[l][s],p[l][s]=d[l][s]=0):l<s?(p[l][s]=t[l][s],g[l][s]=d[l][s]=0):(d[l][s]=t[l][s],g[l][s]=p[l][s]=0);for(f=n.multiply(n.multiply(n.inv(d),n.add(g,p)),-1),i=n.multiply(n.inv(d),e),u=o,c=n.add(n.multiply(f,o),i),l=2;r.abs(n.norm(n.subtract(c,u)))>a;)u=c,c=n.add(n.multiply(f,u),i),l++;return c},gauss_seidel:function(t,e,o,a){for(var u,i,f,c,l,s=0,m=t.length,g=[],p=[],d=[];s<m;s++)for(g[s]=[],p[s]=[],d[s]=[],u=0;u<m;u++)s>u?(g[s][u]=t[s][u],p[s][u]=d[s][u]=0):s<u?(p[s][u]=t[s][u],g[s][u]=d[s][u]=0):(d[s][u]=t[s][u],g[s][u]=p[s][u]=0);for(c=n.multiply(n.multiply(n.inv(n.add(d,g)),p),-1),f=n.multiply(n.inv(n.add(d,g)),e),i=o,l=n.add(n.multiply(c,o),f),s=2;r.abs(n.norm(n.subtract(l,i)))>a;)i=l,l=n.add(n.multiply(c,i),f),s+=1;return l},SOR:function(t,e,o,a,u){for(var i,f,c,l,s,m=0,g=t.length,p=[],d=[],h=[];m<g;m++)for(p[m]=[],d[m]=[],h[m]=[],i=0;i<g;i++)m>i?(p[m][i]=t[m][i],d[m][i]=h[m][i]=0):m<i?(d[m][i]=t[m][i],p[m][i]=h[m][i]=0):(h[m][i]=t[m][i],p[m][i]=d[m][i]=0);for(l=n.multiply(n.inv(n.add(h,n.multiply(p,u))),n.subtract(n.multiply(h,1-u),n.multiply(d,u))),c=n.multiply(n.multiply(n.inv(n.add(h,n.multiply(p,u))),e),u),f=o,s=n.add(n.multiply(l,o),c),m=2;r.abs(n.norm(n.subtract(s,f)))>a;)f=s,s=n.add(n.multiply(l,f),c),m++;return s},householder:function(t){for(var e,o,a,u,i=t.length,f=t[0].length,c=0,l=[],s=[];c<i-1;c++){for(e=0,u=c+1;u<f;u++)e+=t[u][c]*t[u][c];for(e=(t[c+1][c]>0?-1:1)*r.sqrt(e),o=r.sqrt((e*e-t[c+1][c]*e)/2),(l=n.zeros(i,1))[c+1][0]=(t[c+1][c]-e)/(2*o),a=c+2;a<i;a++)l[a][0]=t[a][c]/(2*o);s=n.subtract(n.identity(i,f),n.multiply(n.multiply(l,n.transpose(l)),2)),t=n.multiply(s,n.multiply(t,s))}return t},QR:function(){var t=n.sum,e=n.arange;return function(o){var a,u,i,f=o.length,c=o[0].length,l=n.zeros(c,c);for(o=n.copy(o),u=0;u<c;u++){for(l[u][u]=r.sqrt(t(e(f).map(function(n){return o[n][u]*o[n][u]}))),a=0;a<f;a++)o[a][u]=o[a][u]/l[u][u];for(i=u+1;i<c;i++)for(l[u][i]=t(e(f).map(function(n){return o[n][u]*o[n][i]})),a=0;a<f;a++)o[a][i]=o[a][i]-o[a][u]*l[u][i]}return[o,l]}}(),lstsq:function(){return function(r,t){var e=!1;void 0===t[0].length&&(t=t.map(function(n){return[n]}),e=!0);var o=n.QR(r),a=o[0],u=o[1],i=r[0].length,f=n.slice(a,{col:{end:i}}),c=function(r){var t=(r=n.copy(r)).length,e=n.identity(t);return n.arange(t-1,-1,-1).forEach(function(t){n.sliceAssign(e,{row:t},n.divide(n.slice(e,{row:t}),r[t][t])),n.sliceAssign(r,{row:t},n.divide(n.slice(r,{row:t}),r[t][t])),n.arange(t).forEach(function(o){var a=n.multiply(r[o][t],-1),u=n.slice(r,{row:o}),i=n.multiply(n.slice(r,{row:t}),a);n.sliceAssign(r,{row:o},n.add(u,i));var f=n.slice(e,{row:o}),c=n.multiply(n.slice(e,{row:t}),a);n.sliceAssign(e,{row:o},n.add(f,c))})}),e}(n.slice(u,{row:{end:i}})),l=n.transpose(f);void 0===l[0].length&&(l=[l]);var s=n.multiply(n.multiply(c,l),t);return void 0===s.length&&(s=[[s]]),e?s.map(function(n){return n[0]}):s}}(),jacobi:function(t){for(var e,o,a,u,i,f,c,l=1,s=t.length,m=n.identity(s,s),g=[];1===l;){for(i=t[0][1],a=0,u=1,e=0;e<s;e++)for(o=0;o<s;o++)e!=o&&i<r.abs(t[e][o])&&(i=r.abs(t[e][o]),a=e,u=o);for(f=t[a][a]===t[u][u]?t[a][u]>0?r.PI/4:-r.PI/4:r.atan(2*t[a][u]/(t[a][a]-t[u][u]))/2,(c=n.identity(s,s))[a][a]=r.cos(f),c[a][u]=-r.sin(f),c[u][a]=r.sin(f),c[u][u]=r.cos(f),m=n.multiply(m,c),t=n.multiply(n.multiply(n.inv(c),t),c),l=0,e=1;e<s;e++)for(o=1;o<s;o++)e!=o&&r.abs(t[e][o])>.001&&(l=1)}for(e=0;e<s;e++)g.push(t[e][e]);return[m,g]},rungekutta:function(n,r,t,e,o,a){var u,i,f;if(2===a)for(;e<=t;)o=o+((u=r*n(e,o))+(i=r*n(e+r,o+u)))/2,e+=r;if(4===a)for(;e<=t;)o=o+((u=r*n(e,o))+2*(i=r*n(e+r/2,o+u/2))+2*(f=r*n(e+r/2,o+i/2))+r*n(e+r,o+f))/6,e+=r;return o},romberg:function(n,t,e,o){for(var a,u,i,f,c,l=0,s=(e-t)/2,m=[],g=[],p=[];l<o/2;){for(c=n(t),i=t,f=0;i<=e;i+=s,f++)m[f]=i;for(a=m.length,i=1;i<a-1;i++)c+=(i%2!=0?4:2)*n(m[i]);c=s/3*(c+n(e)),p[l]=c,s/=2,l++}for(u=p.length,a=1;1!==u;){for(i=0;i<u-1;i++)g[i]=(r.pow(4,a)*p[i+1]-p[i])/(r.pow(4,a)-1);u=g.length,p=g,g=[],a++}return p},richardson:function(n,t,e,o){function a(n,r){for(var t,e=0,o=n.length;e<o;e++)n[e]===r&&(t=e);return t}for(var u,i,f,c,l,s=r.abs(e-n[a(n,e)+1]),m=0,g=[],p=[];o>=s;)u=a(n,e+o),i=a(n,e),g[m]=(t[u]-2*t[i]+t[2*i-u])/(o*o),o/=2,m++;for(c=g.length,f=1;1!=c;){for(l=0;l<c-1;l++)p[l]=(r.pow(4,f)*g[l+1]-g[l])/(r.pow(4,f)-1);c=p.length,g=p,p=[],f++}return g},simpson:function(n,r,t,e){for(var o,a=(t-r)/e,u=n(r),i=[],f=r,c=0,l=1;f<=t;f+=a,c++)i[c]=f;for(o=i.length;l<o-1;l++)u+=(l%2!=0?4:2)*n(i[l]);return a/3*(u+n(t))},hermite:function(n,r,t,e){for(var o,a=n.length,u=0,i=0,f=[],c=[],l=[],s=[];i<a;i++){for(f[i]=1,o=0;o<a;o++)i!=o&&(f[i]*=(e-n[o])/(n[i]-n[o]));for(c[i]=0,o=0;o<a;o++)i!=o&&(c[i]+=1/(n[i]-n[o]));l[i]=(1-2*(e-n[i])*c[i])*(f[i]*f[i]),s[i]=(e-n[i])*(f[i]*f[i]),u+=l[i]*r[i]+s[i]*t[i]}return u},lagrange:function(n,r,t){for(var e,o,a=0,u=0,i=n.length;u<i;u++){for(o=r[u],e=0;e<i;e++)u!=e&&(o*=(t-n[e])/(n[u]-n[e]));a+=o}return a},cubic_spline:function(r,t,e){for(var o,a,u=r.length,i=0,f=[],c=[],l=[],s=[],m=[],g=[];i<u-1;i++)s[i]=r[i+1]-r[i];for(l[0]=0,i=1;i<u-1;i++)l[i]=3/s[i]*(t[i+1]-t[i])-3/s[i-1]*(t[i]-t[i-1]);for(i=1;i<u-1;i++)f[i]=[],c[i]=[],f[i][i-1]=s[i-1],f[i][i]=2*(s[i-1]+s[i]),f[i][i+1]=s[i],c[i][0]=l[i];for(a=n.multiply(n.inv(f),c),o=0;o<u-1;o++)m[o]=(t[o+1]-t[o])/s[o]-s[o]*(a[o+1][0]+2*a[o][0])/3,g[o]=(a[o+1][0]-a[o][0])/(3*s[o]);for(o=0;o<u&&!(r[o]>e);o++);return t[o-=1]+(e-r[o])*m[o]+n.sq(e-r[o])*a[o]+(e-r[o])*n.sq(e-r[o])*g[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(r){var t,e,o,a,u,i=r.length,f=r[0].length,c=0,l=[],s=[],m=[],g=[],p=[],d=[],h=[];for(c=0;c<i;c++)l[c]=n.sum(r[c])/f;for(c=0;c<f;c++)for(p[c]=[],t=0;t<i;t++)p[c][t]=r[t][c]-l[t];for(p=n.transpose(p),c=0;c<i;c++)for(d[c]=[],t=0;t<i;t++)d[c][t]=n.dot([p[c]],[p[t]])/(f-1);for(u=(o=n.jacobi(d))[0],s=o[1],h=n.transpose(u),c=0;c<s.length;c++)for(t=c;t<s.length;t++)s[c]<s[t]&&(e=s[c],s[c]=s[t],s[t]=e,m=h[c],h[c]=h[t],h[t]=m);for(a=n.transpose(p),c=0;c<i;c++)for(g[c]=[],t=0;t<a.length;t++)g[c][t]=n.dot([h[c]],[a[t]]);return[r,s,h,g]}}),function(r){for(var t=0;t<r.length;t++)!function(r){n.fn[r]=function(t,e){var o=this;return e?(setTimeout(function(){e.call(o,n.fn[r].call(o,t))},15),this):"number"==typeof n[r](this,t)?n[r](this,t):n(n[r](this,t))}}(r[t])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(n,Math),function(n,r){var t=[].slice,e=n.utils.isNumber,o=n.utils.isArray;function a(n,t,e,o){if(n>1||e>1||n<=0||e<=0)throw new Error("Proportions should be greater than 0 and less than 1");var a=(n*t+e*o)/(t+o);return(n-e)/r.sqrt(a*(1-a)*(1/t+1/o))}n.extend({zscore:function(){var r=t.call(arguments);return e(r[1])?(r[0]-r[1])/r[2]:(r[0]-n.mean(r[1]))/n.stdev(r[1],r[2])},ztest:function(){var e,a=t.call(arguments);return o(a[1])?(e=n.zscore(a[0],a[1],a[3]),1===a[2]?n.normal.cdf(-r.abs(e),0,1):2*n.normal.cdf(-r.abs(e),0,1)):a.length>2?(e=n.zscore(a[0],a[1],a[2]),1===a[3]?n.normal.cdf(-r.abs(e),0,1):2*n.normal.cdf(-r.abs(e),0,1)):(e=a[0],1===a[1]?n.normal.cdf(-r.abs(e),0,1):2*n.normal.cdf(-r.abs(e),0,1))}}),n.extend(n.fn,{zscore:function(n,r){return(n-this.mean())/this.stdev(r)},ztest:function(t,e,o){var a=r.abs(this.zscore(t,o));return 1===e?n.normal.cdf(-a,0,1):2*n.normal.cdf(-a,0,1)}}),n.extend({tscore:function(){var e=t.call(arguments);return 4===e.length?(e[0]-e[1])/(e[2]/r.sqrt(e[3])):(e[0]-n.mean(e[1]))/(n.stdev(e[1],!0)/r.sqrt(e[1].length))},ttest:function(){var o,a=t.call(arguments);return 5===a.length?(o=r.abs(n.tscore(a[0],a[1],a[2],a[3])),1===a[4]?n.studentt.cdf(-o,a[3]-1):2*n.studentt.cdf(-o,a[3]-1)):e(a[1])?(o=r.abs(a[0]),1==a[2]?n.studentt.cdf(-o,a[1]-1):2*n.studentt.cdf(-o,a[1]-1)):(o=r.abs(n.tscore(a[0],a[1])),1==a[2]?n.studentt.cdf(-o,a[1].length-1):2*n.studentt.cdf(-o,a[1].length-1))}}),n.extend(n.fn,{tscore:function(n){return(n-this.mean())/(this.stdev(!0)/r.sqrt(this.cols()))},ttest:function(t,e){return 1===e?1-n.studentt.cdf(r.abs(this.tscore(t)),this.cols()-1):2*n.studentt.cdf(-r.abs(this.tscore(t)),this.cols()-1)}}),n.extend({anovafscore:function(){var e,o,a,u,i,f,c,l,s=t.call(arguments);if(1===s.length){for(i=new Array(s[0].length),c=0;c<s[0].length;c++)i[c]=s[0][c];s=i}for(o=new Array,c=0;c<s.length;c++)o=o.concat(s[c]);for(a=n.mean(o),e=0,c=0;c<s.length;c++)e+=s[c].length*r.pow(n.mean(s[c])-a,2);for(e/=s.length-1,f=0,c=0;c<s.length;c++)for(u=n.mean(s[c]),l=0;l<s[c].length;l++)f+=r.pow(s[c][l]-u,2);return e/(f/=o.length-s.length)},anovaftest:function(){var r,o,a,u,i=t.call(arguments);if(e(i[0]))return 1-n.centralF.cdf(i[0],i[1],i[2]);var f=n.anovafscore(i);for(r=i.length-1,a=0,u=0;u<i.length;u++)a+=i[u].length;return o=a-r-1,1-n.centralF.cdf(f,r,o)},ftest:function(r,t,e){return 1-n.centralF.cdf(r,t,e)}}),n.extend(n.fn,{anovafscore:function(){return n.anovafscore(this.toArray())},anovaftes:function(){var r,t=0;for(r=0;r<this.length;r++)t+=this[r].length;return n.ftest(this.anovafscore(),this.length-1,t-this.length)}}),n.extend({qscore:function(){var o,a,u,i,f,c=t.call(arguments);return e(c[0])?(o=c[0],a=c[1],u=c[2],i=c[3],f=c[4]):(o=n.mean(c[0]),a=n.mean(c[1]),u=c[0].length,i=c[1].length,f=c[2]),r.abs(o-a)/(f*r.sqrt((1/u+1/i)/2))},qtest:function(){var r,e=t.call(arguments);3===e.length?(r=e[0],e=e.slice(1)):7===e.length?(r=n.qscore(e[0],e[1],e[2],e[3],e[4]),e=e.slice(5)):(r=n.qscore(e[0],e[1],e[2]),e=e.slice(3));var o=e[0],a=e[1];return 1-n.tukey.cdf(r,a,o-a)},tukeyhsd:function(r){for(var t=n.pooledstdev(r),e=r.map(function(r){return n.mean(r)}),o=r.reduce(function(n,r){return n+r.length},0),a=[],u=0;u<r.length;++u)for(var i=u+1;i<r.length;++i){var f=n.qtest(e[u],e[i],r[u].length,r[i].length,t,o,r.length);a.push([[u,i],f])}return a}}),n.extend({normalci:function(){var e,o=t.call(arguments),a=new Array(2);return e=4===o.length?r.abs(n.normal.inv(o[1]/2,0,1)*o[2]/r.sqrt(o[3])):r.abs(n.normal.inv(o[1]/2,0,1)*n.stdev(o[2])/r.sqrt(o[2].length)),a[0]=o[0]-e,a[1]=o[0]+e,a},tci:function(){var e,o=t.call(arguments),a=new Array(2);return e=4===o.length?r.abs(n.studentt.inv(o[1]/2,o[3]-1)*o[2]/r.sqrt(o[3])):r.abs(n.studentt.inv(o[1]/2,o[2].length-1)*n.stdev(o[2],!0)/r.sqrt(o[2].length)),a[0]=o[0]-e,a[1]=o[0]+e,a},significant:function(n,r){return n<r}}),n.extend(n.fn,{normalci:function(r,t){return n.normalci(r,t,this.toArray())},tci:function(r,t){return n.tci(r,t,this.toArray())}}),n.extend(n.fn,{oneSidedDifferenceOfProportions:function(r,t,e,o){var u=a(r,t,e,o);return n.ztest(u,1)},twoSidedDifferenceOfProportions:function(r,t,e,o){var u=a(r,t,e,o);return n.ztest(u,2)}})}(n,Math),n.models=function(){function r(r,t){var e=r.length,o=t[0].length-1,a=e-o-1,u=n.lstsq(t,r),i=n.multiply(t,u.map(function(n){return[n]})).map(function(n){return n[0]}),f=n.subtract(r,i),c=n.mean(r),l=n.sum(i.map(function(n){return Math.pow(n-c,2)})),s=n.sum(r.map(function(n,r){return Math.pow(n-i[r],2)})),m=l+s;return{exog:t,endog:r,nobs:e,df_model:o,df_resid:a,coef:u,predict:i,resid:f,ybar:c,SST:m,SSE:l,SSR:s,R2:l/m}}function t(t){var e,o,a=(e=t.exog,o=e[0].length,n.arange(o).map(function(t){var a=n.arange(o).filter(function(n){return n!==t});return r(n.col(e,t).map(function(n){return n[0]}),n.col(e,a))})),u=Math.sqrt(t.SSR/t.df_resid),i=a.map(function(n){var r=n.SST,t=n.R2;return u/Math.sqrt(r*(1-t))}),f=t.coef.map(function(n,r){return(n-0)/i[r]}),c=f.map(function(r){var e=n.studentt.cdf(r,t.df_resid);return 2*(e>.5?1-e:e)}),l=n.studentt.inv(.975,t.df_resid),s=t.coef.map(function(n,r){var t=l*i[r];return[n-t,n+t]});return{se:i,t:f,p:c,sigmaHat:u,interval95:s}}return{ols:function(e,o){var a=r(e,o),u=t(a),i=function(r){var t,e,o,a=r.R2/r.df_model/((1-r.R2)/r.df_resid);return{F_statistic:a,pvalue:1-(t=a,e=r.df_model,o=r.df_resid,n.beta.cdf(t/(o/e+t),e/2,o/2))}}(a),f=1-(1-a.R2)*((a.nobs-1)/a.df_resid);return a.t=u,a.f=i,a.adjust_R2=f,a}}}(),n.extend({buildxmatrix:function(){for(var r=new Array(arguments.length),t=0;t<arguments.length;t++){r[t]=[1].concat(arguments[t])}return n(r)},builddxmatrix:function(){for(var r=new Array(arguments[0].length),t=0;t<arguments[0].length;t++){r[t]=[1].concat(arguments[0][t])}return n(r)},buildjxmatrix:function(r){for(var t=new Array(r.length),e=0;e<r.length;e++)t[e]=r[e];return n.builddxmatrix(t)},buildymatrix:function(r){return n(r).transpose()},buildjymatrix:function(n){return n.transpose()},matrixmult:function(r,t){var e,o,a,u,i;if(r.cols()==t.rows()){if(t.rows()>1){for(u=[],e=0;e<r.rows();e++)for(u[e]=[],o=0;o<t.cols();o++){for(i=0,a=0;a<r.cols();a++)i+=r.toArray()[e][a]*t.toArray()[a][o];u[e][o]=i}return n(u)}for(u=[],e=0;e<r.rows();e++)for(u[e]=[],o=0;o<t.cols();o++){for(i=0,a=0;a<r.cols();a++)i+=r.toArray()[e][a]*t.toArray()[o];u[e][o]=i}return n(u)}},regress:function(r,t){var e=n.xtranspxinv(r),o=r.transpose(),a=n.matrixmult(n(e),o);return n.matrixmult(a,t)},regresst:function(r,t,e){var o=n.regress(r,t),a={anova:{}},u=n.jMatYBar(r,o);a.yBar=u;var i=t.mean();a.anova.residuals=n.residuals(t,u),a.anova.ssr=n.ssr(u,i),a.anova.msr=a.anova.ssr/(r[0].length-1),a.anova.sse=n.sse(t,u),a.anova.mse=a.anova.sse/(t.length-(r[0].length-1)-1),a.anova.sst=n.sst(t,i),a.anova.mst=a.anova.sst/(t.length-1),a.anova.r2=1-a.anova.sse/a.anova.sst,a.anova.r2<0&&(a.anova.r2=0),a.anova.fratio=a.anova.msr/a.anova.mse,a.anova.pvalue=n.anovaftest(a.anova.fratio,r[0].length-1,t.length-(r[0].length-1)-1),a.anova.rmse=Math.sqrt(a.anova.mse),a.anova.r2adj=1-a.anova.mse/a.anova.mst,a.anova.r2adj<0&&(a.anova.r2adj=0),a.stats=new Array(r[0].length);for(var f,c,l,s=n.xtranspxinv(r),m=0;m<o.length;m++)f=Math.sqrt(a.anova.mse*Math.abs(s[m][m])),c=Math.abs(o[m]/f),l=n.ttest(c,t.length-r[0].length-1,e),a.stats[m]=[o[m],f,c,l];return a.regress=o,a},xtranspx:function(r){return n.matrixmult(r.transpose(),r)},xtranspxinv:function(r){var t=n.matrixmult(r.transpose(),r);return n.inv(t)},jMatYBar:function(r,t){var e=n.matrixmult(r,t);return new n(e)},residuals:function(r,t){return n.matrixsubtract(r,t)},ssr:function(n,r){for(var t=0,e=0;e<n.length;e++)t+=Math.pow(n[e]-r,2);return t},sse:function(n,r){for(var t=0,e=0;e<n.length;e++)t+=Math.pow(n[e]-r[e],2);return t},sst:function(n,r){for(var t=0,e=0;e<n.length;e++)t+=Math.pow(n[e]-r,2);return t},matrixsubtract:function(r,t){for(var e=new Array(r.length),o=0;o<r.length;o++){e[o]=new Array(r[o].length);for(var a=0;a<r[o].length;a++)e[o][a]=r[o][a]-t[o][a]}return n(e)}}),n.jStat=n,n});
},{}],"wl7Z":[function(require,module,exports) {
"use strict";function n(r){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(r)}function r(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}var t=require("rescript/lib/js/caml.js"),o=require("rescript/lib/js/curry.js"),e=require("jstat"),a=require("rescript/lib/js/belt_Array.js"),i=require("rescript/lib/js/pervasives.js"),u=require("../utility/E.bs.js"),l=require("../distribution/Discrete.bs.js"),m=require("../expressionTree/Operation.bs.js"),f=require("../distribution/Continuous.bs.js");function c(n){return{NAME:"Exponential",VAL:{rate:n}}}function A(n,r){return e.exponential.pdf(n,r.rate)}function s(n,r){return e.exponential.cdf(n,r.rate)}function L(n,r){return e.exponential.inv(n,r.rate)}function p(n){return e.exponential.sample(n.rate)}function V(n){return r({TAG:0,_0:e.exponential.mean(n.rate)},Symbol.for("name"),"Ok")}function d(n){return"Exponential("+n.rate+")"}var g={make:c,pdf:A,cdf:s,inv:L,sample:p,mean:V,toString:d};function h(n,r){return{NAME:"Cauchy",VAL:{local:n,scale:r}}}function v(n,r){return e.cauchy.pdf(n,r.local,r.scale)}function b(n,r){return e.cauchy.cdf(n,r.local,r.scale)}function y(n,r){return e.cauchy.inv(n,r.local,r.scale)}function N(n){return e.cauchy.sample(n.local,n.scale)}function M(n){return r({TAG:1,_0:"Cauchy distributions have no mean value."},Symbol.for("name"),"Error")}function E(n){return"Cauchy("+n.local+", "+n.scale+")"}var S={make:h,pdf:v,cdf:b,inv:y,sample:N,mean:M,toString:E};function w(n,t,o){return n<t&&t<o?r({TAG:0,_0:{NAME:"Triangular",VAL:{low:n,medium:t,high:o}}},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Triangular values must be increasing order"},Symbol.for("name"),"Error")}function _(n,r){return e.triangular.pdf(n,r.low,r.high,r.medium)}function x(n,r){return e.triangular.cdf(n,r.low,r.high,r.medium)}function T(n,r){return e.triangular.inv(n,r.low,r.high,r.medium)}function k(n){return e.triangular.sample(n.low,n.high,n.medium)}function j(n){return r({TAG:0,_0:e.triangular.mean(n.low,n.high,n.medium)},Symbol.for("name"),"Ok")}function C(n){return"Triangular("+n.low+", "+n.medium+", "+n.high+")"}var F={make:w,pdf:_,cdf:x,inv:T,sample:k,mean:j,toString:C};function G(n,r){return{NAME:"Normal",VAL:{mean:n,stdev:r}}}function O(n,r){return e.normal.pdf(n,r.mean,r.stdev)}function B(n,r){return e.normal.cdf(n,r.mean,r.stdev)}function q(n,r){return{NAME:"Normal",VAL:{mean:o._1(u.A.Floats.mean,[n,r]),stdev:(r-n)/3.289708}}}function U(n,r){return e.normal.inv(n,r.mean,r.stdev)}function P(n){return e.normal.sample(n.mean,n.stdev)}function $(n){return r({TAG:0,_0:e.normal.mean(n.mean,n.stdev)},Symbol.for("name"),"Ok")}function D(n){return"Normal("+n.mean+","+n.stdev+")"}function I(n,r){return{NAME:"Normal",VAL:{mean:n.mean+r.mean,stdev:Math.sqrt(Math.pow(n.stdev,2)+Math.pow(r.stdev,2))}}}function W(n,r){return{NAME:"Normal",VAL:{mean:n.mean-r.mean,stdev:Math.sqrt(Math.pow(n.stdev,2)+Math.pow(r.stdev,2))}}}function X(n,r){return{NAME:"Normal",VAL:{mean:(n.mean*Math.pow(r.stdev,2)+r.mean*Math.pow(n.stdev,2))/(Math.pow(n.stdev,2)+Math.pow(r.stdev,2)),stdev:1/(1/Math.pow(n.stdev,2)+1/Math.pow(r.stdev,2))}}}function z(n,r,t){return"Subtract"===n?W(r,t):"Add"===n?I(r,t):void 0}var H={make:G,pdf:O,cdf:B,from90PercentCI:q,inv:U,sample:P,mean:$,toString:D,add:I,subtract:W,pointwiseProduct:X,operate:z};function J(n,r){return{NAME:"Beta",VAL:{alpha:n,beta:r}}}function K(n,r){return e.beta.pdf(n,r.alpha,r.beta)}function Q(n,r){return e.beta.cdf(n,r.alpha,r.beta)}function R(n,r){return e.beta.inv(n,r.alpha,r.beta)}function Y(n){return e.beta.sample(n.alpha,n.beta)}function Z(n){return r({TAG:0,_0:e.beta.mean(n.alpha,n.beta)},Symbol.for("name"),"Ok")}function nn(n){return"Beta("+n.alpha+","+n.beta+")"}var rn={make:J,pdf:K,cdf:Q,inv:R,sample:Y,mean:Z,toString:nn};function tn(n,r){return{NAME:"Lognormal",VAL:{mu:n,sigma:r}}}function on(n,r){return e.lognormal.pdf(n,r.mu,r.sigma)}function en(n,r){return e.lognormal.cdf(n,r.mu,r.sigma)}function an(n,r){return e.lognormal.inv(n,r.mu,r.sigma)}function un(n){return r({TAG:0,_0:e.lognormal.mean(n.mu,n.sigma)},Symbol.for("name"),"Ok")}function ln(n){return e.lognormal.sample(n.mu,n.sigma)}function mn(n){return"Lognormal("+n.mu+","+n.sigma+")"}function fn(n,r){var t=Math.log(n),e=Math.log(r);return{NAME:"Lognormal",VAL:{mu:o._1(u.A.Floats.mean,[t,e]),sigma:(e-t)/3.29}}}function cn(n,r){var t=Math.pow(r,2),o=Math.pow(n,2);return{NAME:"Lognormal",VAL:{mu:Math.log(n)-.5*Math.log(t/o+1),sigma:Math.pow(Math.log(t/o+1),.5)}}}function An(n,r){return{NAME:"Lognormal",VAL:{mu:n.mu+r.mu,sigma:n.sigma+r.sigma}}}function sn(n,r){return{NAME:"Lognormal",VAL:{mu:n.mu-r.mu,sigma:n.sigma+r.sigma}}}function Ln(n,r,t){return"Divide"===n?sn(r,t):"Multiply"===n?An(r,t):void 0}var pn={make:tn,pdf:on,cdf:en,inv:an,mean:un,sample:ln,toString:mn,from90PercentCI:fn,fromMeanAndStdev:cn,multiply:An,divide:sn,operate:Ln};function Vn(n,r){return{NAME:"Uniform",VAL:{low:n,high:r}}}function dn(n,r){return e.uniform.pdf(n,r.low,r.high)}function gn(n,r){return e.uniform.cdf(n,r.low,r.high)}function hn(n,r){return e.uniform.inv(n,r.low,r.high)}function vn(n){return e.uniform.sample(n.low,n.high)}function bn(n){return r({TAG:0,_0:e.uniform.mean(n.low,n.high)},Symbol.for("name"),"Ok")}function yn(n){return"Uniform("+n.low+","+n.high+")"}function Nn(n,r,e){return{low:t.caml_float_max(o._2(u.O.$$default,i.neg_infinity,n),e.low),high:t.caml_float_min(o._2(u.O.$$default,i.infinity,r),e.high)}}var Mn={make:Vn,pdf:dn,cdf:gn,inv:hn,sample:vn,mean:bn,toString:yn,truncate:Nn};function En(n){return{NAME:"Float",VAL:n}}function Sn(n,r){return n===r?1:0}function wn(n,r){return n>=r?1:0}function _n(n,r){return n<r?0:1}function xn(n){return r({TAG:0,_0:n},Symbol.for("name"),"Ok")}function Tn(n){return n}function kn(n){return n.toString()}var jn={make:En,pdf:Sn,cdf:wn,inv:_n,mean:xn,sample:Tn,toString:kn};function Cn(n,r){var t=r.NAME;return"Lognormal"===t?on(n,r.VAL):"Exponential"===t?A(n,r.VAL):"Normal"===t?O(n,r.VAL):"Cauchy"===t?v(n,r.VAL):"Uniform"===t?dn(n,r.VAL):"Float"===t?Sn(n,r.VAL):"Beta"===t?K(n,r.VAL):_(n,r.VAL)}function Fn(n,r){var t=r.NAME;return"Lognormal"===t?en(n,r.VAL):"Exponential"===t?s(n,r.VAL):"Normal"===t?B(n,r.VAL):"Cauchy"===t?b(n,r.VAL):"Uniform"===t?gn(n,r.VAL):"Float"===t?wn(n,r.VAL):"Beta"===t?Q(n,r.VAL):x(n,r.VAL)}function Gn(n,r){var t=r.NAME;return"Lognormal"===t?an(n,r.VAL):"Exponential"===t?L(n,r.VAL):"Normal"===t?U(n,r.VAL):"Cauchy"===t?y(n,r.VAL):"Uniform"===t?hn(n,r.VAL):"Float"===t?_n(n,r.VAL):"Beta"===t?R(n,r.VAL):T(n,r.VAL)}function On(n){var r=n.NAME;return"Lognormal"===r?ln(n.VAL):"Exponential"===r?p(n.VAL):"Normal"===r?P(n.VAL):"Cauchy"===r?N(n.VAL):"Uniform"===r?vn(n.VAL):"Float"===r?n.VAL:"Beta"===r?Y(n.VAL):k(n.VAL)}function Bn(n,r){for(var t=a.make(n,0),e=0;e<n;++e)a.set(t,e,o._1(r,void 0));return t}function qn(n,r){return Bn(n,function(n){return On(r)})}function Un(n){var r=n.NAME;return"Lognormal"===r?mn(n.VAL):"Exponential"===r?d(n.VAL):"Normal"===r?D(n.VAL):"Cauchy"===r?E(n.VAL):"Uniform"===r?yn(n.VAL):"Float"===r?n.VAL.toString():"Beta"===r?nn(n.VAL):C(n.VAL)}function Pn(n){var r=n.NAME;return"Lognormal"===r?an(1e-4,n.VAL):"Exponential"===r?L(1e-4,n.VAL):"Normal"===r?U(1e-4,n.VAL):"Cauchy"===r?y(1e-4,n.VAL):"Float"===r?n.VAL:"Beta"===r?R(1e-4,n.VAL):n.VAL.low}function $n(n){var r=n.NAME;return"Lognormal"===r?an(.9999,n.VAL):"Exponential"===r?L(.9999,n.VAL):"Normal"===r?U(.9999,n.VAL):"Cauchy"===r?y(.9999,n.VAL):"Uniform"===r?n.VAL.high:"Float"===r?n.VAL:"Beta"===r?R(.9999,n.VAL):n.VAL.high}function Dn(n){var t=n.NAME;return"Lognormal"===t?un(n.VAL):"Exponential"===t?V(n.VAL):"Normal"===t?$(n.VAL):"Cauchy"===t?r({TAG:1,_0:"Cauchy distributions have no mean value."},Symbol.for("name"),"Error"):"Uniform"===t?bn(n.VAL):"Float"===t?r({TAG:0,_0:n.VAL},Symbol.for("name"),"Ok"):"Beta"===t?Z(n.VAL):j(n.VAL)}function In(t,o){if("object"!==n(t))return"Mean"===t?Dn(o):r({TAG:0,_0:On(o)},Symbol.for("name"),"Ok");var e=t.NAME;return r("Inv"===e?{TAG:0,_0:Gn(t.VAL,o)}:"Pdf"===e?{TAG:0,_0:Cn(t.VAL,o)}:{TAG:0,_0:Fn(t.VAL,o)},Symbol.for("name"),"Ok")}function Wn(r,t,e){if("Linear"===(void 0!==r?r:"Linear"))return o._3(u.A.Floats.range,Pn(t),$n(t),e);if("object"===n(t)&&"Uniform"===t.NAME){var a=t.VAL,i=1e-5*(a.high-a.low);return[a.low-i,a.low+i,a.high-i,a.high+i]}var l=o._3(u.A.Floats.range,1e-4,.9999,e);return o._2(u.A.fmap,function(n){return Gn(n,t)},l)}function Xn(r,t,o){if("object"!==n(r))return"NoSolution";var e=r.NAME;if("Lognormal"===e)return"object"===n(t)&&"Lognormal"===t.NAME?u.O.dimap(function(n){return{NAME:"AnalyticalSolution",VAL:n}},function(n){return"NoSolution"},Ln(o,r.VAL,t.VAL)):"NoSolution";if("Normal"===e)return"object"===n(t)&&"Normal"===t.NAME?u.O.dimap(function(n){return{NAME:"AnalyticalSolution",VAL:n}},function(n){return"NoSolution"},z(o,r.VAL,t.VAL)):"NoSolution";if("Float"!==e)return"NoSolution";if("object"!==n(t))return"NoSolution";if("Float"!==t.NAME)return"NoSolution";var a=m.Algebraic.applyFn(o,r.VAL,t.VAL);return 0===a.TAG?{NAME:"AnalyticalSolution",VAL:{NAME:"Float",VAL:a._0}}:{NAME:"Error",VAL:a._0}}function zn(t,e){if("object"===n(e)&&"Float"===e.NAME)return r({TAG:1,_0:l.make(1,void 0,{xs:[e.VAL],ys:[1]})},Symbol.for("name"),"Discrete");var a=Wn("ByWeight",e,t),i=o._2(u.A.fmap,function(n){return Cn(n,e)},a);return r({TAG:2,_0:f.make(void 0,1,void 0,{xs:a,ys:i})},Symbol.for("name"),"Continuous")}var Hn={minCdfValue:1e-4,maxCdfValue:.9999,pdf:Cn,cdf:Fn,inv:Gn,sample:On,doN:Bn,sampleN:qn,toString:Un,min:Pn,max:$n,mean:Dn,operate:In,interpolateXs:Wn,tryAnalyticalSimplification:Xn,toShape:zn};exports.Exponential=g,exports.Cauchy=S,exports.Triangular=F,exports.Normal=H,exports.Beta=rn,exports.Lognormal=pn,exports.Uniform=Mn,exports.Float=jn,exports.T=Hn;
},{"rescript/lib/js/caml.js":"gGFE","rescript/lib/js/curry.js":"NSLD","jstat":"AuT8","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/pervasives.js":"z22f","../utility/E.bs.js":"xX5m","../distribution/Discrete.bs.js":"Ms6F","../expressionTree/Operation.bs.js":"S4ET","../distribution/Continuous.bs.js":"CVcq"}],"wUHb":[function(require,module,exports) {
"use strict";var n=module.exports;module.exports.isNumber=function(n){return"number"==typeof n},module.exports.findMin=function(n){if(0===n.length)return 1/0;for(var t=n[0],r=1;r<n.length;r++)t=Math.min(t,n[r]);return t},module.exports.findMax=function(n){if(0===n.length)return-1/0;for(var t=n[0],r=1;r<n.length;r++)t=Math.max(t,n[r]);return t},module.exports.findMinMulti=function(t){for(var r=n.findMin(t[0]),e=1;e<t.length;e++)r=Math.min(r,n.findMin(t[e]));return r},module.exports.findMaxMulti=function(t){for(var r=n.findMax(t[0]),e=1;e<t.length;e++)r=Math.max(r,n.findMax(t[e]));return r},module.exports.inside=function(n,t,r){return n<=r&&r<=t};
},{}],"fFBv":[function(require,module,exports) {
"use strict";var i=50,e=2,t=Math.log(2),n=module.exports,r=require("./helper");function u(i){return 1-Math.abs(i)}function a(i,e){for(var t={},n=0,r=-e;r<=e;r++)n+=i(r/e),t[r]=n;return t}module.exports.getUnifiedMinMax=function(i,e){return n.getUnifiedMinMaxMulti([i],e)},module.exports.getUnifiedMinMaxMulti=function(t,n){n=n||{};var u=!1,a=!1,o=r.isNumber(n.width)?n.width:e,f=r.isNumber(n.size)?n.size:i,h=r.isNumber(n.min)?n.min:(u=!0,r.findMinMulti(t)),m=r.isNumber(n.max)?n.max:(a=!0,r.findMaxMulti(t)),l=(m-h)/(f-1);return u&&(h-=2*o*l),a&&(m+=2*o*l),{min:h,max:m}},module.exports.create=function(t,o){if(o=o||{},!t||0===t.length)return[];var f=r.isNumber(o.size)?o.size:i,h=r.isNumber(o.width)?o.width:e,m=n.getUnifiedMinMax(t,{size:f,width:h,min:o.min,max:o.max}),l=m.min,s=m.max-l,x=s/(f-1);if(0===s)return[{x:l,y:1}];for(var d=[],c=0;c<f;c++)d.push({x:l+c*x,y:0});var M=a(u,h),g=M[h],v=M[h-1]-M[h-2],y=0;t.forEach(function(i){var e=function(i){return Math.floor((i-l)/x)}(i);if(!(e+h<0||e-h>=d.length)){var t=Math.max(e-h,0),n=e,u=Math.min(e+h,d.length-1),a=t-(e-h),o=e+h-u,f=M[-h-1+a]||0,m=M[-h-1+o]||0,s=g/(g-f-m);a>0&&(y+=s*(a-1)*v);var c=Math.max(0,e-h+1);r.inside(0,d.length-1,c)&&(d[c].y+=1*s*v),r.inside(0,d.length-1,n+1)&&(d[n+1].y-=2*s*v),r.inside(0,d.length-1,u+1)&&(d[u+1].y+=1*s*v)}});var p=y,b=0,w=0;return d.forEach(function(i){b+=i.y,p+=b,i.y=p,w+=p}),w>0&&d.forEach(function(i){i.y/=w}),d},module.exports.getExpectedValueFromPdf=function(i){if(i&&0!==i.length){var e=0;return i.forEach(function(i){e+=i.x*i.y}),e}},module.exports.getXWithLeftTailArea=function(i,e){if(i&&0!==i.length){for(var t=0,n=0,r=0;r<i.length&&(n=r,!((t+=i[r].y)>=e));r++);return i[n].x}},module.exports.getPerplexity=function(i){if(i&&0!==i.length){var e=0;return i.forEach(function(i){var t=Math.log(i.y);isFinite(t)&&(e+=i.y*t)}),e=-e/t,Math.pow(2,e)}};
},{"./helper":"wUHb"}],"XPlA":[function(require,module,exports) {
"use strict";exports.byteLength=u,exports.toByteArray=i,exports.fromByteArray=d;for(var r=[],t=[],e="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=n.length;o<a;++o)r[o]=n[o],t[n.charCodeAt(o)]=o;function h(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function u(r){var t=h(r),e=t[0],n=t[1];return 3*(e+n)/4-n}function c(r,t,e){return 3*(t+e)/4-e}function i(r){var n,o,a=h(r),u=a[0],i=a[1],f=new e(c(r,u,i)),A=0,d=i>0?u-4:u;for(o=0;o<d;o+=4)n=t[r.charCodeAt(o)]<<18|t[r.charCodeAt(o+1)]<<12|t[r.charCodeAt(o+2)]<<6|t[r.charCodeAt(o+3)],f[A++]=n>>16&255,f[A++]=n>>8&255,f[A++]=255&n;return 2===i&&(n=t[r.charCodeAt(o)]<<2|t[r.charCodeAt(o+1)]>>4,f[A++]=255&n),1===i&&(n=t[r.charCodeAt(o)]<<10|t[r.charCodeAt(o+1)]<<4|t[r.charCodeAt(o+2)]>>2,f[A++]=n>>8&255,f[A++]=255&n),f}function f(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function A(r,t,e){for(var n,o=[],a=t;a<e;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(255&r[a+2]),o.push(f(n));return o.join("")}function d(t){for(var e,n=t.length,o=n%3,a=[],h=0,u=n-o;h<u;h+=16383)a.push(A(t,h,h+16383>u?u:h+16383));return 1===o?(e=t[n-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),a.join("")}t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63;
},{}],"EEnl":[function(require,module,exports) {
exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,N=i>>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l};
},{}],"ZCp3":[function(require,module,exports) {
var r={}.toString;module.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)};
},{}],"VjIL":[function(require,module,exports) {
var global = arguments[3];
var t=arguments[3],r=require("base64-js"),e=require("ieee754"),n=require("isarray");function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function o(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(o()<r)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=f.prototype:(null===t&&(t=new f(r)),t.length=r),t}function f(t,r,e){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return s(this,t,r,e)}function s(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?g(t,r,e,n):"string"==typeof r?l(t,r,e):y(t,r)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,r,e,n){return h(r),r<=0?u(t,r):void 0!==e?"string"==typeof n?u(t,r).fill(e,n):u(t,r).fill(e):u(t,r)}function c(t,r){if(h(r),t=u(t,r<0?0:0|w(r)),!f.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function l(t,r,e){if("string"==typeof e&&""!==e||(e="utf8"),!f.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|v(r,e),i=(t=u(t,n)).write(r,e);return i!==n&&(t=t.slice(0,i)),t}function p(t,r){var e=r.length<0?0:0|w(r.length);t=u(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function g(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n),f.TYPED_ARRAY_SUPPORT?(t=r).__proto__=f.prototype:t=p(t,r),t}function y(t,r){if(f.isBuffer(r)){var e=0|w(r.length);return 0===(t=u(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||W(r.length)?u(t,0):p(t,r);if("Buffer"===r.type&&n(r.data))return p(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function w(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),f.alloc(+t)}function v(t,r){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return K(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}function E(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,r,e);case"utf8":case"utf-8":return Y(this,r,e);case"ascii":return L(this,r,e);case"latin1":case"binary":return D(this,r,e);case"base64":return S(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=f.from(r,n)),f.isBuffer(r))return 0===r.length?-1:_(t,r,e,n,i);if("number"==typeof r)return r&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):_(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,r,e,n,i){var o,u=1,f=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,f/=2,s/=2,e/=2}function h(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(i){var a=-1;for(o=e;o<f;o++)if(h(t,o)===h(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===s)return a*u}else-1!==a&&(o-=o-a),a=-1}else for(e+s>f&&(e=f-s),o=e;o>=0;o--){for(var c=!0,l=0;l<s;l++)if(h(t,o+l)!==h(r,l)){c=!1;break}if(c)return o}return-1}function A(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var f=parseInt(r.substr(2*u,2),16);if(isNaN(f))return u;t[e+u]=f}return u}function m(t,r,e,n){return Q($(r,t.length-e),t,e,n)}function P(t,r,e,n){return Q(G(r),t,e,n)}function T(t,r,e,n){return P(t,r,e,n)}function B(t,r,e,n){return Q(K(r),t,e,n)}function U(t,r,e,n){return Q(H(r,t.length-e),t,e,n)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function Y(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,u,f,s,h=t[i],a=null,c=h>239?4:h>223?3:h>191?2:1;if(i+c<=e)switch(c){case 1:h<128&&(a=h);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&h)<<6|63&o)>127&&(a=s);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(s=(15&h)<<12|(63&o)<<6|63&u)>2047&&(s<55296||s>57343)&&(a=s);break;case 4:o=t[i+1],u=t[i+2],f=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&f)&&(s=(15&h)<<18|(63&o)<<12|(63&u)<<6|63&f)>65535&&s<1114112&&(a=s)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return O(n)}exports.Buffer=f,exports.SlowBuffer=d,exports.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:i(),exports.kMaxLength=o(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,r,e){return s(null,t,r,e)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,r,e){return a(null,t,r,e)},f.allocUnsafe=function(t){return c(null,t)},f.allocUnsafeSlow=function(t){return c(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,r){if(!f.isBuffer(t)||!f.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,r){if(!n(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var i=f.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var u=t[e];if(!f.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i},f.byteLength=v,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)b(this,r,r+1);return this},f.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)b(this,r,r+3),b(this,r+1,r+2);return this},f.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)b(this,r,r+7),b(this,r+1,r+6),b(this,r+2,r+5),b(this,r+3,r+4);return this},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Y(this,0,t):E.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",r=exports.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,r,e,n,i){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),s=Math.min(o,u),h=this.slice(n,i),a=t.slice(r,e),c=0;c<s;++c)if(h[c]!==a[c]){o=h[c],u=a[c];break}return o<u?-1:u<o?1:0},f.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},f.prototype.indexOf=function(t,r,e){return R(this,t,r,e,!0)},f.prototype.lastIndexOf=function(t,r,e){return R(this,t,r,e,!1)},f.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,r,e);case"utf8":case"utf-8":return m(this,t,r,e);case"ascii":return P(this,t,r,e);case"latin1":case"binary":return T(this,t,r,e);case"base64":return B(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function O(t){var r=t.length;if(r<=I)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=I));return e}function L(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function D(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function x(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Z(t[o]);return i}function C(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function M(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function k(t,r,e,n,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function N(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function F(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function j(t,r,n,i,o){return o||F(t,r,n,4,3.4028234663852886e38,-3.4028234663852886e38),e.write(t,r,n,i,23,4),n+4}function q(t,r,n,i,o){return o||F(t,r,n,8,1.7976931348623157e308,-1.7976931348623157e308),e.write(t,r,n,i,52,8),n+8}f.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),f.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=f.prototype;else{var i=r-t;e=new f(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},f.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},f.prototype.readUInt8=function(t,r){return r||M(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,r){return r||M(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,r){return r||M(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,r){return r||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,r){return r||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},f.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},f.prototype.readInt8=function(t,r){return r||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,r){r||M(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt16BE=function(t,r){r||M(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt32LE=function(t,r){return r||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,r){return r||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},f.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},f.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},f.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):z(this,t,r,!0),r+4},f.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=0,u=1,f=0;for(this[r]=255&t;++o<e&&(u*=256);)t<0&&0===f&&0!==this[r+o-1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},f.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=e-1,u=1,f=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===f&&0!==this[r+o+1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},f.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},f.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):z(this,t,r,!0),r+4},f.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeFloatLE=function(t,r,e){return j(this,t,r,!0,e)},f.prototype.writeFloatBE=function(t,r,e){return j(this,t,r,!1,e)},f.prototype.writeDoubleLE=function(t,r,e){return q(this,t,r,!0,e)},f.prototype.writeDoubleBE=function(t,r,e){return q(this,t,r,!1,e)},f.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},f.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var u=f.isBuffer(t)?t:$(new f(t,n).toString()),s=u.length;for(o=0;o<e-r;++o)this[o+r]=u[o%s]}return this};var V=/[^+\/0-9A-Za-z-_]/g;function X(t){if((t=J(t).replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function J(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Z(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],u=0;u<n;++u){if((e=t.charCodeAt(u))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function G(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}function H(t,r){for(var e,n,i,o=[],u=0;u<t.length&&!((r-=2)<0);++u)n=(e=t.charCodeAt(u))>>8,i=e%256,o.push(i),o.push(n);return o}function K(t){return r.toByteArray(X(t))}function Q(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function W(t){return t!=t}
},{"base64-js":"XPlA","ieee754":"EEnl","isarray":"ZCp3","buffer":"VjIL"}],"hKJs":[function(require,module,exports) {
var global = arguments[3];
var Buffer = require("buffer").Buffer;
var define;
var n,t=arguments[3],r=require("buffer").Buffer;(function(){var r,e=200,u="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",i="Expected a function",o="__lodash_hash_undefined__",f=500,a="__lodash_placeholder__",c=1,l=2,s=4,h=1,p=2,v=1,_=2,g=4,y=8,d=16,b=32,w=64,m=128,x=256,j=512,A=30,k="...",O=800,I=16,R=1,E=2,z=1/0,S=9007199254740991,L=1.7976931348623157e308,W=NaN,C=4294967295,B=C-1,U=C>>>1,T=[["ary",m],["bind",v],["bindKey",_],["curry",y],["curryRight",d],["flip",j],["partial",b],["partialRight",w],["rearg",x]],$="[object Arguments]",D="[object Array]",M="[object AsyncFunction]",F="[object Boolean]",N="[object Date]",P="[object DOMException]",q="[object Error]",Z="[object Function]",K="[object GeneratorFunction]",V="[object Map]",G="[object Number]",H="[object Null]",J="[object Object]",Y="[object Proxy]",Q="[object RegExp]",X="[object Set]",nn="[object String]",tn="[object Symbol]",rn="[object Undefined]",en="[object WeakMap]",un="[object WeakSet]",on="[object ArrayBuffer]",fn="[object DataView]",an="[object Float32Array]",cn="[object Float64Array]",ln="[object Int8Array]",sn="[object Int16Array]",hn="[object Int32Array]",pn="[object Uint8Array]",vn="[object Uint8ClampedArray]",_n="[object Uint16Array]",gn="[object Uint32Array]",yn=/\b__p \+= '';/g,dn=/\b(__p \+=) '' \+/g,bn=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wn=/&(?:amp|lt|gt|quot|#39);/g,mn=/[&<>"']/g,xn=RegExp(wn.source),jn=RegExp(mn.source),An=/<%-([\s\S]+?)%>/g,kn=/<%([\s\S]+?)%>/g,On=/<%=([\s\S]+?)%>/g,In=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Rn=/^\w*$/,En=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,zn=/[\\^$.*+?()[\]{}|]/g,Sn=RegExp(zn.source),Ln=/^\s+|\s+$/g,Wn=/^\s+/,Cn=/\s+$/,Bn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Un=/\{\n\/\* \[wrapped with (.+)\] \*/,Tn=/,? & /,$n=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dn=/\\(\\)?/g,Mn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Fn=/\w*$/,Nn=/^[-+]0x[0-9a-f]+$/i,Pn=/^0b[01]+$/i,qn=/^\[object .+?Constructor\]$/,Zn=/^0o[0-7]+$/i,Kn=/^(?:0|[1-9]\d*)$/,Vn=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Gn=/($^)/,Hn=/['\n\r\u2028\u2029\\]/g,Jn="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Yn="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Qn="[\\ud800-\\udfff]",Xn="["+Yn+"]",nt="["+Jn+"]",tt="\\d+",rt="[\\u2700-\\u27bf]",et="[a-z\\xdf-\\xf6\\xf8-\\xff]",ut="[^\\ud800-\\udfff"+Yn+tt+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",it="\\ud83c[\\udffb-\\udfff]",ot="[^\\ud800-\\udfff]",ft="(?:\\ud83c[\\udde6-\\uddff]){2}",at="[\\ud800-\\udbff][\\udc00-\\udfff]",ct="[A-Z\\xc0-\\xd6\\xd8-\\xde]",lt="(?:"+et+"|"+ut+")",st="(?:"+ct+"|"+ut+")",ht="(?:"+nt+"|"+it+")"+"?",pt="[\\ufe0e\\ufe0f]?"+ht+("(?:\\u200d(?:"+[ot,ft,at].join("|")+")[\\ufe0e\\ufe0f]?"+ht+")*"),vt="(?:"+[rt,ft,at].join("|")+")"+pt,_t="(?:"+[ot+nt+"?",nt,ft,at,Qn].join("|")+")",gt=RegExp("[']","g"),yt=RegExp(nt,"g"),dt=RegExp(it+"(?="+it+")|"+_t+pt,"g"),bt=RegExp([ct+"?"+et+"+(?:['](?:d|ll|m|re|s|t|ve))?(?="+[Xn,ct,"$"].join("|")+")",st+"+(?:['](?:D|LL|M|RE|S|T|VE))?(?="+[Xn,ct+lt,"$"].join("|")+")",ct+"?"+lt+"+(?:['](?:d|ll|m|re|s|t|ve))?",ct+"+(?:['](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tt,vt].join("|"),"g"),wt=RegExp("[\\u200d\\ud800-\\udfff"+Jn+"\\ufe0e\\ufe0f]"),mt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],jt=-1,At={};At[an]=At[cn]=At[ln]=At[sn]=At[hn]=At[pn]=At[vn]=At[_n]=At[gn]=!0,At[$]=At[D]=At[on]=At[F]=At[fn]=At[N]=At[q]=At[Z]=At[V]=At[G]=At[J]=At[Q]=At[X]=At[nn]=At[en]=!1;var kt={};kt[$]=kt[D]=kt[on]=kt[fn]=kt[F]=kt[N]=kt[an]=kt[cn]=kt[ln]=kt[sn]=kt[hn]=kt[V]=kt[G]=kt[J]=kt[Q]=kt[X]=kt[nn]=kt[tn]=kt[pn]=kt[vn]=kt[_n]=kt[gn]=!0,kt[q]=kt[Z]=kt[en]=!1;var Ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},It=parseFloat,Rt=parseInt,Et="object"==typeof t&&t&&t.Object===Object&&t,zt="object"==typeof self&&self&&self.Object===Object&&self,St=Et||zt||Function("return this")(),Lt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Wt=Lt&&"object"==typeof module&&module&&!module.nodeType&&module,Ct=Wt&&Wt.exports===Lt,Bt=Ct&&Et.process,Ut=function(){try{var n=Wt&&Wt.require&&Wt.require("util").types;return n||Bt&&Bt.binding&&Bt.binding("util")}catch(t){}}(),Tt=Ut&&Ut.isArrayBuffer,$t=Ut&&Ut.isDate,Dt=Ut&&Ut.isMap,Mt=Ut&&Ut.isRegExp,Ft=Ut&&Ut.isSet,Nt=Ut&&Ut.isTypedArray;function Pt(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function qt(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function Zt(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&!1!==t(n[r],r,n););return n}function Kt(n,t){for(var r=null==n?0:n.length;r--&&!1!==t(n[r],r,n););return n}function Vt(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;return!0}function Gt(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function Ht(n,t){return!!(null==n?0:n.length)&&ir(n,t,0)>-1}function Jt(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function Yt(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function Qt(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function Xt(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);return r}function nr(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function tr(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}var rr=cr("length");function er(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function ur(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function ir(n,t,r){return t==t?function(n,t,r){var e=r-1,u=n.length;for(;++e<u;)if(n[e]===t)return e;return-1}(n,t,r):ur(n,fr,r)}function or(n,t,r,e){for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function fr(n){return n!=n}function ar(n,t){var r=null==n?0:n.length;return r?hr(n,t)/r:W}function cr(n){return function(t){return null==t?r:t[n]}}function lr(n){return function(t){return null==n?r:n[t]}}function sr(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function hr(n,t){for(var e,u=-1,i=n.length;++u<i;){var o=t(n[u]);o!==r&&(e=e===r?o:e+o)}return e}function pr(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function vr(n){return function(t){return n(t)}}function _r(n,t){return Yt(t,function(t){return n[t]})}function gr(n,t){return n.has(t)}function yr(n,t){for(var r=-1,e=n.length;++r<e&&ir(t,n[r],0)>-1;);return r}function dr(n,t){for(var r=n.length;r--&&ir(t,n[r],0)>-1;);return r}var br=lr({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),wr=lr({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function mr(n){return"\\"+Ot[n]}function xr(n){return wt.test(n)}function jr(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function Ar(n,t){return function(r){return n(t(r))}}function kr(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==a||(n[r]=a,i[u++]=r)}return i}function Or(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=n}),r}function Ir(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Rr(n){return xr(n)?function(n){var t=dt.lastIndex=0;for(;dt.test(n);)++t;return t}(n):rr(n)}function Er(n){return xr(n)?function(n){return n.match(dt)||[]}(n):function(n){return n.split("")}(n)}var zr=lr({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var Sr=function n(t){var Jn,Yn=(t=null==t?St:Sr.defaults(St.Object(),t,Sr.pick(St,xt))).Array,Qn=t.Date,Xn=t.Error,nt=t.Function,tt=t.Math,rt=t.Object,et=t.RegExp,ut=t.String,it=t.TypeError,ot=Yn.prototype,ft=nt.prototype,at=rt.prototype,ct=t["__core-js_shared__"],lt=ft.toString,st=at.hasOwnProperty,ht=0,pt=(Jn=/[^.]+$/.exec(ct&&ct.keys&&ct.keys.IE_PROTO||""))?"Symbol(src)_1."+Jn:"",vt=at.toString,_t=lt.call(rt),dt=St._,wt=et("^"+lt.call(st).replace(zn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ot=Ct?t.Buffer:r,Et=t.Symbol,zt=t.Uint8Array,Lt=Ot?Ot.allocUnsafe:r,Wt=Ar(rt.getPrototypeOf,rt),Bt=rt.create,Ut=at.propertyIsEnumerable,rr=ot.splice,lr=Et?Et.isConcatSpreadable:r,Lr=Et?Et.iterator:r,Wr=Et?Et.toStringTag:r,Cr=function(){try{var n=$i(rt,"defineProperty");return n({},"",{}),n}catch(t){}}(),Br=t.clearTimeout!==St.clearTimeout&&t.clearTimeout,Ur=Qn&&Qn.now!==St.Date.now&&Qn.now,Tr=t.setTimeout!==St.setTimeout&&t.setTimeout,$r=tt.ceil,Dr=tt.floor,Mr=rt.getOwnPropertySymbols,Fr=Ot?Ot.isBuffer:r,Nr=t.isFinite,Pr=ot.join,qr=Ar(rt.keys,rt),Zr=tt.max,Kr=tt.min,Vr=Qn.now,Gr=t.parseInt,Hr=tt.random,Jr=ot.reverse,Yr=$i(t,"DataView"),Qr=$i(t,"Map"),Xr=$i(t,"Promise"),ne=$i(t,"Set"),te=$i(t,"WeakMap"),re=$i(rt,"create"),ee=te&&new te,ue={},ie=lo(Yr),oe=lo(Qr),fe=lo(Xr),ae=lo(ne),ce=lo(te),le=Et?Et.prototype:r,se=le?le.valueOf:r,he=le?le.toString:r;function pe(n){if(Ef(n)&&!df(n)&&!(n instanceof ye)){if(n instanceof ge)return n;if(st.call(n,"__wrapped__"))return so(n)}return new ge(n)}var ve=function(){function n(){}return function(t){if(!Rf(t))return{};if(Bt)return Bt(t);n.prototype=t;var e=new n;return n.prototype=r,e}}();function _e(){}function ge(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function ye(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=C,this.__views__=[]}function de(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function be(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function we(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function me(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new we;++t<r;)this.add(n[t])}function xe(n){var t=this.__data__=new be(n);this.size=t.size}function je(n,t){var r=df(n),e=!r&&yf(n),u=!r&&!e&&xf(n),i=!r&&!e&&!u&&Tf(n),o=r||e||u||i,f=o?pr(n.length,ut):[],a=f.length;for(var c in n)!t&&!st.call(n,c)||o&&("length"==c||u&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Zi(c,a))||f.push(c);return f}function Ae(n){var t=n.length;return t?n[mu(0,t-1)]:r}function ke(n,t){return fo(ri(n),Ce(t,0,n.length))}function Oe(n){return fo(ri(n))}function Ie(n,t,e){(e===r||vf(n[t],e))&&(e!==r||t in n)||Le(n,t,e)}function Re(n,t,e){var u=n[t];st.call(n,t)&&vf(u,e)&&(e!==r||t in n)||Le(n,t,e)}function Ee(n,t){for(var r=n.length;r--;)if(vf(n[r][0],t))return r;return-1}function ze(n,t,r,e){return De(n,function(n,u,i){t(e,n,r(n),i)}),e}function Se(n,t){return n&&ei(t,ia(t),n)}function Le(n,t,r){"__proto__"==t&&Cr?Cr(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function We(n,t){for(var e=-1,u=t.length,i=Yn(u),o=null==n;++e<u;)i[e]=o?r:na(n,t[e]);return i}function Ce(n,t,e){return n==n&&(e!==r&&(n=n<=e?n:e),t!==r&&(n=n>=t?n:t)),n}function Be(n,t,e,u,i,o){var f,a=t&c,h=t&l,p=t&s;if(e&&(f=i?e(n,u,i,o):e(n)),f!==r)return f;if(!Rf(n))return n;var v=df(n);if(v){if(f=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&st.call(n,"index")&&(r.index=n.index,r.input=n.input),r}(n),!a)return ri(n,f)}else{var _=Fi(n),g=_==Z||_==K;if(xf(n))return Ju(n,a);if(_==J||_==$||g&&!i){if(f=h||g?{}:Pi(n),!a)return h?function(n,t){return ei(n,Mi(n),t)}(n,function(n,t){return n&&ei(t,oa(t),n)}(f,n)):function(n,t){return ei(n,Di(n),t)}(n,Se(f,n))}else{if(!kt[_])return i?n:{};f=function(n,t,r){var e,u,i,o=n.constructor;switch(t){case on:return Yu(n);case F:case N:return new o(+n);case fn:return function(n,t){var r=t?Yu(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}(n,r);case an:case cn:case ln:case sn:case hn:case pn:case vn:case _n:case gn:return Qu(n,r);case V:return new o;case G:case nn:return new o(n);case Q:return(i=new(u=n).constructor(u.source,Fn.exec(u))).lastIndex=u.lastIndex,i;case X:return new o;case tn:return e=n,se?rt(se.call(e)):{}}}(n,_,a)}}o||(o=new xe);var y=o.get(n);if(y)return y;o.set(n,f),Cf(n)?n.forEach(function(r){f.add(Be(r,t,e,r,n,o))}):zf(n)&&n.forEach(function(r,u){f.set(u,Be(r,t,e,u,n,o))});var d=v?r:(p?h?Si:zi:h?oa:ia)(n);return Zt(d||n,function(r,u){d&&(r=n[u=r]),Re(f,u,Be(r,t,e,u,n,o))}),f}function Ue(n,t,e){var u=e.length;if(null==n)return!u;for(n=rt(n);u--;){var i=e[u],o=t[i],f=n[i];if(f===r&&!(i in n)||!o(f))return!1}return!0}function Te(n,t,e){if("function"!=typeof n)throw new it(i);return eo(function(){n.apply(r,e)},t)}function $e(n,t,r,u){var i=-1,o=Ht,f=!0,a=n.length,c=[],l=t.length;if(!a)return c;r&&(t=Yt(t,vr(r))),u?(o=Jt,f=!1):t.length>=e&&(o=gr,f=!1,t=new me(t));n:for(;++i<a;){var s=n[i],h=null==r?s:r(s);if(s=u||0!==s?s:0,f&&h==h){for(var p=l;p--;)if(t[p]===h)continue n;c.push(s)}else o(t,h,u)||c.push(s)}return c}pe.templateSettings={escape:An,evaluate:kn,interpolate:On,variable:"",imports:{_:pe}},pe.prototype=_e.prototype,pe.prototype.constructor=pe,ge.prototype=ve(_e.prototype),ge.prototype.constructor=ge,ye.prototype=ve(_e.prototype),ye.prototype.constructor=ye,de.prototype.clear=function(){this.__data__=re?re(null):{},this.size=0},de.prototype.delete=function(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t},de.prototype.get=function(n){var t=this.__data__;if(re){var e=t[n];return e===o?r:e}return st.call(t,n)?t[n]:r},de.prototype.has=function(n){var t=this.__data__;return re?t[n]!==r:st.call(t,n)},de.prototype.set=function(n,t){var e=this.__data__;return this.size+=this.has(n)?0:1,e[n]=re&&t===r?o:t,this},be.prototype.clear=function(){this.__data__=[],this.size=0},be.prototype.delete=function(n){var t=this.__data__,r=Ee(t,n);return!(r<0||(r==t.length-1?t.pop():rr.call(t,r,1),--this.size,0))},be.prototype.get=function(n){var t=this.__data__,e=Ee(t,n);return e<0?r:t[e][1]},be.prototype.has=function(n){return Ee(this.__data__,n)>-1},be.prototype.set=function(n,t){var r=this.__data__,e=Ee(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this},we.prototype.clear=function(){this.size=0,this.__data__={hash:new de,map:new(Qr||be),string:new de}},we.prototype.delete=function(n){var t=Ui(this,n).delete(n);return this.size-=t?1:0,t},we.prototype.get=function(n){return Ui(this,n).get(n)},we.prototype.has=function(n){return Ui(this,n).has(n)},we.prototype.set=function(n,t){var r=Ui(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this},me.prototype.add=me.prototype.push=function(n){return this.__data__.set(n,o),this},me.prototype.has=function(n){return this.__data__.has(n)},xe.prototype.clear=function(){this.__data__=new be,this.size=0},xe.prototype.delete=function(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r},xe.prototype.get=function(n){return this.__data__.get(n)},xe.prototype.has=function(n){return this.__data__.has(n)},xe.prototype.set=function(n,t){var r=this.__data__;if(r instanceof be){var u=r.__data__;if(!Qr||u.length<e-1)return u.push([n,t]),this.size=++r.size,this;r=this.__data__=new we(u)}return r.set(n,t),this.size=r.size,this};var De=oi(Ve),Me=oi(Ge,!0);function Fe(n,t){var r=!0;return De(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Ne(n,t,e){for(var u=-1,i=n.length;++u<i;){var o=n[u],f=t(o);if(null!=f&&(a===r?f==f&&!Uf(f):e(f,a)))var a=f,c=o}return c}function Pe(n,t){var r=[];return De(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function qe(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=qi),u||(u=[]);++i<o;){var f=n[i];t>0&&r(f)?t>1?qe(f,t-1,r,e,u):Qt(u,f):e||(u[u.length]=f)}return u}var Ze=fi(),Ke=fi(!0);function Ve(n,t){return n&&Ze(n,t,ia)}function Ge(n,t){return n&&Ke(n,t,ia)}function He(n,t){return Gt(t,function(t){return kf(n[t])})}function Je(n,t){for(var e=0,u=(t=Ku(t,n)).length;null!=n&&e<u;)n=n[co(t[e++])];return e&&e==u?n:r}function Ye(n,t,r){var e=t(n);return df(n)?e:Qt(e,r(n))}function Qe(n){return null==n?n===r?rn:H:Wr&&Wr in rt(n)?function(n){var t=st.call(n,Wr),e=n[Wr];try{n[Wr]=r;var u=!0}catch(o){}var i=vt.call(n);return u&&(t?n[Wr]=e:delete n[Wr]),i}(n):function(n){return vt.call(n)}(n)}function Xe(n,t){return n>t}function nu(n,t){return null!=n&&st.call(n,t)}function tu(n,t){return null!=n&&t in rt(n)}function ru(n,t,e){for(var u=e?Jt:Ht,i=n[0].length,o=n.length,f=o,a=Yn(o),c=1/0,l=[];f--;){var s=n[f];f&&t&&(s=Yt(s,vr(t))),c=Kr(s.length,c),a[f]=!e&&(t||i>=120&&s.length>=120)?new me(f&&s):r}s=n[0];var h=-1,p=a[0];n:for(;++h<i&&l.length<c;){var v=s[h],_=t?t(v):v;if(v=e||0!==v?v:0,!(p?gr(p,_):u(l,_,e))){for(f=o;--f;){var g=a[f];if(!(g?gr(g,_):u(n[f],_,e)))continue n}p&&p.push(_),l.push(v)}}return l}function eu(n,t,e){var u=null==(n=no(n,t=Ku(t,n)))?n:n[co(jo(t))];return null==u?r:Pt(u,n,e)}function uu(n){return Ef(n)&&Qe(n)==$}function iu(n,t,e,u,i){return n===t||(null==n||null==t||!Ef(n)&&!Ef(t)?n!=n&&t!=t:function(n,t,e,u,i,o){var f=df(n),a=df(t),c=f?D:Fi(n),l=a?D:Fi(t),s=(c=c==$?J:c)==J,v=(l=l==$?J:l)==J,_=c==l;if(_&&xf(n)){if(!xf(t))return!1;f=!0,s=!1}if(_&&!s)return o||(o=new xe),f||Tf(n)?Ri(n,t,e,u,i,o):function(n,t,r,e,u,i,o){switch(r){case fn:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;n=n.buffer,t=t.buffer;case on:return!(n.byteLength!=t.byteLength||!i(new zt(n),new zt(t)));case F:case N:case G:return vf(+n,+t);case q:return n.name==t.name&&n.message==t.message;case Q:case nn:return n==t+"";case V:var f=jr;case X:var a=e&h;if(f||(f=Or),n.size!=t.size&&!a)return!1;var c=o.get(n);if(c)return c==t;e|=p,o.set(n,t);var l=Ri(f(n),f(t),e,u,i,o);return o.delete(n),l;case tn:if(se)return se.call(n)==se.call(t)}return!1}(n,t,c,e,u,i,o);if(!(e&h)){var g=s&&st.call(n,"__wrapped__"),y=v&&st.call(t,"__wrapped__");if(g||y){var d=g?n.value():n,b=y?t.value():t;return o||(o=new xe),i(d,b,e,u,o)}}return!!_&&(o||(o=new xe),function(n,t,e,u,i,o){var f=e&h,a=zi(n),c=a.length,l=zi(t).length;if(c!=l&&!f)return!1;for(var s=c;s--;){var p=a[s];if(!(f?p in t:st.call(t,p)))return!1}var v=o.get(n);if(v&&o.get(t))return v==t;var _=!0;o.set(n,t),o.set(t,n);for(var g=f;++s<c;){p=a[s];var y=n[p],d=t[p];if(u)var b=f?u(d,y,p,t,n,o):u(y,d,p,n,t,o);if(!(b===r?y===d||i(y,d,e,u,o):b)){_=!1;break}g||(g="constructor"==p)}if(_&&!g){var w=n.constructor,m=t.constructor;w!=m&&"constructor"in n&&"constructor"in t&&!("function"==typeof w&&w instanceof w&&"function"==typeof m&&m instanceof m)&&(_=!1)}return o.delete(n),o.delete(t),_}(n,t,e,u,i,o))}(n,t,e,u,iu,i))}function ou(n,t,e,u){var i=e.length,o=i,f=!u;if(null==n)return!o;for(n=rt(n);i--;){var a=e[i];if(f&&a[2]?a[1]!==n[a[0]]:!(a[0]in n))return!1}for(;++i<o;){var c=(a=e[i])[0],l=n[c],s=a[1];if(f&&a[2]){if(l===r&&!(c in n))return!1}else{var v=new xe;if(u)var _=u(l,s,c,n,t,v);if(!(_===r?iu(s,l,h|p,u,v):_))return!1}}return!0}function fu(n){return!(!Rf(n)||(t=n,pt&&pt in t))&&(kf(n)?wt:qn).test(lo(n));var t}function au(n){return"function"==typeof n?n:null==n?Sa:"object"==typeof n?df(n)?vu(n[0],n[1]):pu(n):Ma(n)}function cu(n){if(!Ji(n))return qr(n);var t=[];for(var r in rt(n))st.call(n,r)&&"constructor"!=r&&t.push(r);return t}function lu(n){if(!Rf(n))return function(n){var t=[];if(null!=n)for(var r in rt(n))t.push(r);return t}(n);var t=Ji(n),r=[];for(var e in n)("constructor"!=e||!t&&st.call(n,e))&&r.push(e);return r}function su(n,t){return n<t}function hu(n,t){var r=-1,e=wf(n)?Yn(n.length):[];return De(n,function(n,u,i){e[++r]=t(n,u,i)}),e}function pu(n){var t=Ti(n);return 1==t.length&&t[0][2]?Qi(t[0][0],t[0][1]):function(r){return r===n||ou(r,n,t)}}function vu(n,t){return Vi(n)&&Yi(t)?Qi(co(n),t):function(e){var u=na(e,n);return u===r&&u===t?ta(e,n):iu(t,u,h|p)}}function _u(n,t,e,u,i){n!==t&&Ze(t,function(o,f){if(i||(i=new xe),Rf(o))!function(n,t,e,u,i,o,f){var a=to(n,e),c=to(t,e),l=f.get(c);if(l)Ie(n,e,l);else{var s=o?o(a,c,e+"",n,t,f):r,h=s===r;if(h){var p=df(c),v=!p&&xf(c),_=!p&&!v&&Tf(c);s=c,p||v||_?df(a)?s=a:mf(a)?s=ri(a):v?(h=!1,s=Ju(c,!0)):_?(h=!1,s=Qu(c,!0)):s=[]:Lf(c)||yf(c)?(s=a,yf(a)?s=Zf(a):Rf(a)&&!kf(a)||(s=Pi(c))):h=!1}h&&(f.set(c,s),i(s,c,u,o,f),f.delete(c)),Ie(n,e,s)}}(n,t,f,e,_u,u,i);else{var a=u?u(to(n,f),o,f+"",n,t,i):r;a===r&&(a=o),Ie(n,f,a)}},oa)}function gu(n,t){var e=n.length;if(e)return Zi(t+=t<0?e:0,e)?n[t]:r}function yu(n,t,r){var e=-1;return t=Yt(t.length?t:[Sa],vr(Bi())),function(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}(hu(n,function(n,r,u){return{criteria:Yt(t,function(t){return t(n)}),index:++e,value:n}}),function(n,t){return function(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,f=r.length;++e<o;){var a=Xu(u[e],i[e]);if(a){if(e>=f)return a;var c=r[e];return a*("desc"==c?-1:1)}}return n.index-t.index}(n,t,r)})}function du(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=Je(n,o);r(f,o)&&Ou(i,Ku(o,n),f)}return i}function bu(n,t,r,e){var u=e?or:ir,i=-1,o=t.length,f=n;for(n===t&&(t=ri(t)),r&&(f=Yt(n,vr(r)));++i<o;)for(var a=0,c=t[i],l=r?r(c):c;(a=u(f,l,a,e))>-1;)f!==n&&rr.call(f,a,1),rr.call(n,a,1);return n}function wu(n,t){for(var r=n?t.length:0,e=r-1;r--;){var u=t[r];if(r==e||u!==i){var i=u;Zi(u)?rr.call(n,u,1):$u(n,u)}}return n}function mu(n,t){return n+Dr(Hr()*(t-n+1))}function xu(n,t){var r="";if(!n||t<1||t>S)return r;do{t%2&&(r+=n),(t=Dr(t/2))&&(n+=n)}while(t);return r}function ju(n,t){return uo(Xi(n,t,Sa),n+"")}function Au(n){return Ae(va(n))}function ku(n,t){var r=va(n);return fo(r,Ce(t,0,r.length))}function Ou(n,t,e,u){if(!Rf(n))return n;for(var i=-1,o=(t=Ku(t,n)).length,f=o-1,a=n;null!=a&&++i<o;){var c=co(t[i]),l=e;if(i!=f){var s=a[c];(l=u?u(s,c,a):r)===r&&(l=Rf(s)?s:Zi(t[i+1])?[]:{})}Re(a,c,l),a=a[c]}return n}var Iu=ee?function(n,t){return ee.set(n,t),n}:Sa,Ru=Cr?function(n,t){return Cr(n,"toString",{configurable:!0,enumerable:!1,value:Ra(t),writable:!0})}:Sa;function Eu(n){return fo(va(n))}function zu(n,t,r){var e=-1,u=n.length;t<0&&(t=-t>u?0:u+t),(r=r>u?u:r)<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=Yn(u);++e<u;)i[e]=n[e+t];return i}function Su(n,t){var r;return De(n,function(n,e,u){return!(r=t(n,e,u))}),!!r}function Lu(n,t,r){var e=0,u=null==n?e:n.length;if("number"==typeof t&&t==t&&u<=U){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!Uf(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return Wu(n,t,Sa,r)}function Wu(n,t,e,u){t=e(t);for(var i=0,o=null==n?0:n.length,f=t!=t,a=null===t,c=Uf(t),l=t===r;i<o;){var s=Dr((i+o)/2),h=e(n[s]),p=h!==r,v=null===h,_=h==h,g=Uf(h);if(f)var y=u||_;else y=l?_&&(u||p):a?_&&p&&(u||!v):c?_&&p&&!v&&(u||!g):!v&&!g&&(u?h<=t:h<t);y?i=s+1:o=s}return Kr(o,B)}function Cu(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r],f=t?t(o):o;if(!r||!vf(f,a)){var a=f;i[u++]=0===o?0:o}}return i}function Bu(n){return"number"==typeof n?n:Uf(n)?W:+n}function Uu(n){if("string"==typeof n)return n;if(df(n))return Yt(n,Uu)+"";if(Uf(n))return he?he.call(n):"";var t=n+"";return"0"==t&&1/n==-z?"-0":t}function Tu(n,t,r){var u=-1,i=Ht,o=n.length,f=!0,a=[],c=a;if(r)f=!1,i=Jt;else if(o>=e){var l=t?null:xi(n);if(l)return Or(l);f=!1,i=gr,c=new me}else c=t?[]:a;n:for(;++u<o;){var s=n[u],h=t?t(s):s;if(s=r||0!==s?s:0,f&&h==h){for(var p=c.length;p--;)if(c[p]===h)continue n;t&&c.push(h),a.push(s)}else i(c,h,r)||(c!==a&&c.push(h),a.push(s))}return a}function $u(n,t){return null==(n=no(n,t=Ku(t,n)))||delete n[co(jo(t))]}function Du(n,t,r,e){return Ou(n,t,r(Je(n,t)),e)}function Mu(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?zu(n,e?0:i,e?i+1:u):zu(n,e?i+1:0,e?u:i)}function Fu(n,t){var r=n;return r instanceof ye&&(r=r.value()),Xt(t,function(n,t){return t.func.apply(t.thisArg,Qt([n],t.args))},r)}function Nu(n,t,r){var e=n.length;if(e<2)return e?Tu(n[0]):[];for(var u=-1,i=Yn(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=$e(i[u]||o,n[f],t,r));return Tu(qe(i,1),t,r)}function Pu(n,t,e){for(var u=-1,i=n.length,o=t.length,f={};++u<i;){var a=u<o?t[u]:r;e(f,n[u],a)}return f}function qu(n){return mf(n)?n:[]}function Zu(n){return"function"==typeof n?n:Sa}function Ku(n,t){return df(n)?n:Vi(n,t)?[n]:ao(Kf(n))}var Vu=ju;function Gu(n,t,e){var u=n.length;return e=e===r?u:e,!t&&e>=u?n:zu(n,t,e)}var Hu=Br||function(n){return St.clearTimeout(n)};function Ju(n,t){if(t)return n.slice();var r=n.length,e=Lt?Lt(r):new n.constructor(r);return n.copy(e),e}function Yu(n){var t=new n.constructor(n.byteLength);return new zt(t).set(new zt(n)),t}function Qu(n,t){var r=t?Yu(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}function Xu(n,t){if(n!==t){var e=n!==r,u=null===n,i=n==n,o=Uf(n),f=t!==r,a=null===t,c=t==t,l=Uf(t);if(!a&&!l&&!o&&n>t||o&&f&&c&&!a&&!l||u&&f&&c||!e&&c||!i)return 1;if(!u&&!o&&!l&&n<t||l&&e&&i&&!u&&!o||a&&e&&i||!f&&i||!c)return-1}return 0}function ni(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,a=t.length,c=Zr(i-o,0),l=Yn(a+c),s=!e;++f<a;)l[f]=t[f];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;c--;)l[f++]=n[u++];return l}function ti(n,t,r,e){for(var u=-1,i=n.length,o=-1,f=r.length,a=-1,c=t.length,l=Zr(i-f,0),s=Yn(l+c),h=!e;++u<l;)s[u]=n[u];for(var p=u;++a<c;)s[p+a]=t[a];for(;++o<f;)(h||u<i)&&(s[p+r[o]]=n[u++]);return s}function ri(n,t){var r=-1,e=n.length;for(t||(t=Yn(e));++r<e;)t[r]=n[r];return t}function ei(n,t,e,u){var i=!e;e||(e={});for(var o=-1,f=t.length;++o<f;){var a=t[o],c=u?u(e[a],n[a],a,e,n):r;c===r&&(c=n[a]),i?Le(e,a,c):Re(e,a,c)}return e}function ui(n,t){return function(r,e){var u=df(r)?qt:ze,i=t?t():{};return u(r,n,Bi(e,2),i)}}function ii(n){return ju(function(t,e){var u=-1,i=e.length,o=i>1?e[i-1]:r,f=i>2?e[2]:r;for(o=n.length>3&&"function"==typeof o?(i--,o):r,f&&Ki(e[0],e[1],f)&&(o=i<3?r:o,i=1),t=rt(t);++u<i;){var a=e[u];a&&n(t,a,u,o)}return t})}function oi(n,t){return function(r,e){if(null==r)return r;if(!wf(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=rt(r);(t?i--:++i<u)&&!1!==e(o[i],i,o););return r}}function fi(n){return function(t,r,e){for(var u=-1,i=rt(t),o=e(t),f=o.length;f--;){var a=o[n?f:++u];if(!1===r(i[a],a,i))break}return t}}function ai(n){return function(t){var e=xr(t=Kf(t))?Er(t):r,u=e?e[0]:t.charAt(0),i=e?Gu(e,1).join(""):t.slice(1);return u[n]()+i}}function ci(n){return function(t){return Xt(ka(ya(t).replace(gt,"")),n,"")}}function li(n){return function(){var t=arguments;switch(t.length){case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=ve(n.prototype),e=n.apply(r,t);return Rf(e)?e:r}}function si(n){return function(t,e,u){var i=rt(t);if(!wf(t)){var o=Bi(e,3);t=ia(t),e=function(n){return o(i[n],n,i)}}var f=n(t,e,u);return f>-1?i[o?t[f]:f]:r}}function hi(n){return Ei(function(t){var e=t.length,u=e,o=ge.prototype.thru;for(n&&t.reverse();u--;){var f=t[u];if("function"!=typeof f)throw new it(i);if(o&&!a&&"wrapper"==Wi(f))var a=new ge([],!0)}for(u=a?u:e;++u<e;){var c=Wi(f=t[u]),l="wrapper"==c?Li(f):r;a=l&&Gi(l[0])&&l[1]==(m|y|b|x)&&!l[4].length&&1==l[9]?a[Wi(l[0])].apply(a,l[3]):1==f.length&&Gi(f)?a[c]():a.thru(f)}return function(){var n=arguments,r=n[0];if(a&&1==n.length&&df(r))return a.plant(r).value();for(var u=0,i=e?t[u].apply(this,n):r;++u<e;)i=t[u].call(this,i);return i}})}function pi(n,t,e,u,i,o,f,a,c,l){var s=t&m,h=t&v,p=t&_,g=t&(y|d),b=t&j,w=p?r:li(n);return function v(){for(var _=arguments.length,y=Yn(_),d=_;d--;)y[d]=arguments[d];if(g)var m=Ci(v),x=function(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;return e}(y,m);if(u&&(y=ni(y,u,i,g)),o&&(y=ti(y,o,f,g)),_-=x,g&&_<l){var j=kr(y,m);return wi(n,t,pi,v.placeholder,e,y,j,a,c,l-_)}var A=h?e:this,k=p?A[n]:n;return _=y.length,a?y=function(n,t){for(var e=n.length,u=Kr(t.length,e),i=ri(n);u--;){var o=t[u];n[u]=Zi(o,e)?i[o]:r}return n}(y,a):b&&_>1&&y.reverse(),s&&c<_&&(y.length=c),this&&this!==St&&this instanceof v&&(k=w||li(k)),k.apply(A,y)}}function vi(n,t){return function(r,e){return function(n,t,r,e){return Ve(n,function(n,u,i){t(e,r(n),u,i)}),e}(r,n,t(e),{})}}function _i(n,t){return function(e,u){var i;if(e===r&&u===r)return t;if(e!==r&&(i=e),u!==r){if(i===r)return u;"string"==typeof e||"string"==typeof u?(e=Uu(e),u=Uu(u)):(e=Bu(e),u=Bu(u)),i=n(e,u)}return i}}function gi(n){return Ei(function(t){return t=Yt(t,vr(Bi())),ju(function(r){var e=this;return n(t,function(n){return Pt(n,e,r)})})})}function yi(n,t){var e=(t=t===r?" ":Uu(t)).length;if(e<2)return e?xu(t,n):t;var u=xu(t,$r(n/Rr(t)));return xr(t)?Gu(Er(u),0,n).join(""):u.slice(0,n)}function di(n){return function(t,e,u){return u&&"number"!=typeof u&&Ki(t,e,u)&&(e=u=r),t=Ff(t),e===r?(e=t,t=0):e=Ff(e),function(n,t,r,e){for(var u=-1,i=Zr($r((t-n)/(r||1)),0),o=Yn(i);i--;)o[e?i:++u]=n,n+=r;return o}(t,e,u=u===r?t<e?1:-1:Ff(u),n)}}function bi(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=qf(t),r=qf(r)),n(t,r)}}function wi(n,t,e,u,i,o,f,a,c,l){var s=t&y;t|=s?b:w,(t&=~(s?w:b))&g||(t&=~(v|_));var h=[n,t,i,s?o:r,s?f:r,s?r:o,s?r:f,a,c,l],p=e.apply(r,h);return Gi(n)&&ro(p,h),p.placeholder=u,io(p,n,t)}function mi(n){var t=tt[n];return function(n,r){if(n=qf(n),(r=null==r?0:Kr(Nf(r),292))&&Nr(n)){var e=(Kf(n)+"e").split("e");return+((e=(Kf(t(e[0]+"e"+(+e[1]+r)))+"e").split("e"))[0]+"e"+(+e[1]-r))}return t(n)}}var xi=ne&&1/Or(new ne([,-0]))[1]==z?function(n){return new ne(n)}:Ua;function ji(n){return function(t){var r=Fi(t);return r==V?jr(t):r==X?Ir(t):function(n,t){return Yt(t,function(t){return[t,n[t]]})}(t,n(t))}}function Ai(n,t,e,u,o,f,c,l){var s=t&_;if(!s&&"function"!=typeof n)throw new it(i);var h=u?u.length:0;if(h||(t&=~(b|w),u=o=r),c=c===r?c:Zr(Nf(c),0),l=l===r?l:Nf(l),h-=o?o.length:0,t&w){var p=u,j=o;u=o=r}var A=s?r:Li(n),k=[n,t,e,u,o,p,j,f,c,l];if(A&&function(n,t){var r=n[1],e=t[1],u=r|e,i=u<(v|_|m),o=e==m&&r==y||e==m&&r==x&&n[7].length<=t[8]||e==(m|x)&&t[7].length<=t[8]&&r==y;if(!i&&!o)return n;e&v&&(n[2]=t[2],u|=r&v?0:g);var f=t[3];if(f){var c=n[3];n[3]=c?ni(c,f,t[4]):f,n[4]=c?kr(n[3],a):t[4]}(f=t[5])&&(c=n[5],n[5]=c?ti(c,f,t[6]):f,n[6]=c?kr(n[5],a):t[6]),(f=t[7])&&(n[7]=f),e&m&&(n[8]=null==n[8]?t[8]:Kr(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u}(k,A),n=k[0],t=k[1],e=k[2],u=k[3],o=k[4],!(l=k[9]=k[9]===r?s?0:n.length:Zr(k[9]-h,0))&&t&(y|d)&&(t&=~(y|d)),t&&t!=v)O=t==y||t==d?function(n,t,e){var u=li(n);return function i(){for(var o=arguments.length,f=Yn(o),a=o,c=Ci(i);a--;)f[a]=arguments[a];var l=o<3&&f[0]!==c&&f[o-1]!==c?[]:kr(f,c);return(o-=l.length)<e?wi(n,t,pi,i.placeholder,r,f,l,r,r,e-o):Pt(this&&this!==St&&this instanceof i?u:n,this,f)}}(n,t,l):t!=b&&t!=(v|b)||o.length?pi.apply(r,k):function(n,t,r,e){var u=t&v,i=li(n);return function t(){for(var o=-1,f=arguments.length,a=-1,c=e.length,l=Yn(c+f),s=this&&this!==St&&this instanceof t?i:n;++a<c;)l[a]=e[a];for(;f--;)l[a++]=arguments[++o];return Pt(s,u?r:this,l)}}(n,t,e,u);else var O=function(n,t,r){var e=t&v,u=li(n);return function t(){return(this&&this!==St&&this instanceof t?u:n).apply(e?r:this,arguments)}}(n,t,e);return io((A?Iu:ro)(O,k),n,t)}function ki(n,t,e,u){return n===r||vf(n,at[e])&&!st.call(u,e)?t:n}function Oi(n,t,e,u,i,o){return Rf(n)&&Rf(t)&&(o.set(t,n),_u(n,t,r,Oi,o),o.delete(t)),n}function Ii(n){return Lf(n)?r:n}function Ri(n,t,e,u,i,o){var f=e&h,a=n.length,c=t.length;if(a!=c&&!(f&&c>a))return!1;var l=o.get(n);if(l&&o.get(t))return l==t;var s=-1,v=!0,_=e&p?new me:r;for(o.set(n,t),o.set(t,n);++s<a;){var g=n[s],y=t[s];if(u)var d=f?u(y,g,s,t,n,o):u(g,y,s,n,t,o);if(d!==r){if(d)continue;v=!1;break}if(_){if(!tr(t,function(n,t){if(!gr(_,t)&&(g===n||i(g,n,e,u,o)))return _.push(t)})){v=!1;break}}else if(g!==y&&!i(g,y,e,u,o)){v=!1;break}}return o.delete(n),o.delete(t),v}function Ei(n){return uo(Xi(n,r,yo),n+"")}function zi(n){return Ye(n,ia,Di)}function Si(n){return Ye(n,oa,Mi)}var Li=ee?function(n){return ee.get(n)}:Ua;function Wi(n){for(var t=n.name+"",r=ue[t],e=st.call(ue,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function Ci(n){return(st.call(pe,"placeholder")?pe:n).placeholder}function Bi(){var n=pe.iteratee||La;return n=n===La?au:n,arguments.length?n(arguments[0],arguments[1]):n}function Ui(n,t){var r,e,u=n.__data__;return("string"==(e=typeof(r=t))||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==r:null===r)?u["string"==typeof t?"string":"hash"]:u.map}function Ti(n){for(var t=ia(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,Yi(u)]}return t}function $i(n,t){var e=function(n,t){return null==n?r:n[t]}(n,t);return fu(e)?e:r}var Di=Mr?function(n){return null==n?[]:(n=rt(n),Gt(Mr(n),function(t){return Ut.call(n,t)}))}:Pa,Mi=Mr?function(n){for(var t=[];n;)Qt(t,Di(n)),n=Wt(n);return t}:Pa,Fi=Qe;function Ni(n,t,r){for(var e=-1,u=(t=Ku(t,n)).length,i=!1;++e<u;){var o=co(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:!!(u=null==n?0:n.length)&&If(u)&&Zi(o,u)&&(df(n)||yf(n))}function Pi(n){return"function"!=typeof n.constructor||Ji(n)?{}:ve(Wt(n))}function qi(n){return df(n)||yf(n)||!!(lr&&n&&n[lr])}function Zi(n,t){var r=typeof n;return!!(t=null==t?S:t)&&("number"==r||"symbol"!=r&&Kn.test(n))&&n>-1&&n%1==0&&n<t}function Ki(n,t,r){if(!Rf(r))return!1;var e=typeof t;return!!("number"==e?wf(r)&&Zi(t,r.length):"string"==e&&t in r)&&vf(r[t],n)}function Vi(n,t){if(df(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!Uf(n))||Rn.test(n)||!In.test(n)||null!=t&&n in rt(t)}function Gi(n){var t=Wi(n),r=pe[t];if("function"!=typeof r||!(t in ye.prototype))return!1;if(n===r)return!0;var e=Li(r);return!!e&&n===e[0]}(Yr&&Fi(new Yr(new ArrayBuffer(1)))!=fn||Qr&&Fi(new Qr)!=V||Xr&&"[object Promise]"!=Fi(Xr.resolve())||ne&&Fi(new ne)!=X||te&&Fi(new te)!=en)&&(Fi=function(n){var t=Qe(n),e=t==J?n.constructor:r,u=e?lo(e):"";if(u)switch(u){case ie:return fn;case oe:return V;case fe:return"[object Promise]";case ae:return X;case ce:return en}return t});var Hi=ct?kf:qa;function Ji(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||at)}function Yi(n){return n==n&&!Rf(n)}function Qi(n,t){return function(e){return null!=e&&e[n]===t&&(t!==r||n in rt(e))}}function Xi(n,t,e){return t=Zr(t===r?n.length-1:t,0),function(){for(var r=arguments,u=-1,i=Zr(r.length-t,0),o=Yn(i);++u<i;)o[u]=r[t+u];u=-1;for(var f=Yn(t+1);++u<t;)f[u]=r[u];return f[t]=e(o),Pt(n,this,f)}}function no(n,t){return t.length<2?n:Je(n,zu(t,0,-1))}function to(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}var ro=oo(Iu),eo=Tr||function(n,t){return St.setTimeout(n,t)},uo=oo(Ru);function io(n,t,r){var e=t+"";return uo(n,function(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(r>1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Bn,"{\n/* [wrapped with "+t+"] */\n")}(e,function(n,t){return Zt(T,function(r){var e="_."+r[0];t&r[1]&&!Ht(n,e)&&n.push(e)}),n.sort()}(function(n){var t=n.match(Un);return t?t[1].split(Tn):[]}(e),r)))}function oo(n){var t=0,e=0;return function(){var u=Vr(),i=I-(u-e);if(e=u,i>0){if(++t>=O)return arguments[0]}else t=0;return n.apply(r,arguments)}}function fo(n,t){var e=-1,u=n.length,i=u-1;for(t=t===r?u:t;++e<t;){var o=mu(e,i),f=n[o];n[o]=n[e],n[e]=f}return n.length=t,n}var ao=function(n){var t=af(n,function(n){return r.size===f&&r.clear(),n}),r=t.cache;return t}(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(En,function(n,r,e,u){t.push(e?u.replace(Dn,"$1"):r||n)}),t});function co(n){if("string"==typeof n||Uf(n))return n;var t=n+"";return"0"==t&&1/n==-z?"-0":t}function lo(n){if(null!=n){try{return lt.call(n)}catch(t){}try{return n+""}catch(t){}}return""}function so(n){if(n instanceof ye)return n.clone();var t=new ge(n.__wrapped__,n.__chain__);return t.__actions__=ri(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}var ho=ju(function(n,t){return mf(n)?$e(n,qe(t,1,mf,!0)):[]}),po=ju(function(n,t){var e=jo(t);return mf(e)&&(e=r),mf(n)?$e(n,qe(t,1,mf,!0),Bi(e,2)):[]}),vo=ju(function(n,t){var e=jo(t);return mf(e)&&(e=r),mf(n)?$e(n,qe(t,1,mf,!0),r,e):[]});function _o(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Nf(r);return u<0&&(u=Zr(e+u,0)),ur(n,Bi(t,3),u)}function go(n,t,e){var u=null==n?0:n.length;if(!u)return-1;var i=u-1;return e!==r&&(i=Nf(e),i=e<0?Zr(u+i,0):Kr(i,u-1)),ur(n,Bi(t,3),i,!0)}function yo(n){return null!=n&&n.length?qe(n,1):[]}function bo(n){return n&&n.length?n[0]:r}var wo=ju(function(n){var t=Yt(n,qu);return t.length&&t[0]===n[0]?ru(t):[]}),mo=ju(function(n){var t=jo(n),e=Yt(n,qu);return t===jo(e)?t=r:e.pop(),e.length&&e[0]===n[0]?ru(e,Bi(t,2)):[]}),xo=ju(function(n){var t=jo(n),e=Yt(n,qu);return(t="function"==typeof t?t:r)&&e.pop(),e.length&&e[0]===n[0]?ru(e,r,t):[]});function jo(n){var t=null==n?0:n.length;return t?n[t-1]:r}var Ao=ju(ko);function ko(n,t){return n&&n.length&&t&&t.length?bu(n,t):n}var Oo=Ei(function(n,t){var r=null==n?0:n.length,e=We(n,t);return wu(n,Yt(t,function(n){return Zi(n,r)?+n:n}).sort(Xu)),e});function Io(n){return null==n?n:Jr.call(n)}var Ro=ju(function(n){return Tu(qe(n,1,mf,!0))}),Eo=ju(function(n){var t=jo(n);return mf(t)&&(t=r),Tu(qe(n,1,mf,!0),Bi(t,2))}),zo=ju(function(n){var t=jo(n);return t="function"==typeof t?t:r,Tu(qe(n,1,mf,!0),r,t)});function So(n){if(!n||!n.length)return[];var t=0;return n=Gt(n,function(n){if(mf(n))return t=Zr(n.length,t),!0}),pr(t,function(t){return Yt(n,cr(t))})}function Lo(n,t){if(!n||!n.length)return[];var e=So(n);return null==t?e:Yt(e,function(n){return Pt(t,r,n)})}var Wo=ju(function(n,t){return mf(n)?$e(n,t):[]}),Co=ju(function(n){return Nu(Gt(n,mf))}),Bo=ju(function(n){var t=jo(n);return mf(t)&&(t=r),Nu(Gt(n,mf),Bi(t,2))}),Uo=ju(function(n){var t=jo(n);return t="function"==typeof t?t:r,Nu(Gt(n,mf),r,t)}),To=ju(So);var $o=ju(function(n){var t=n.length,e=t>1?n[t-1]:r;return e="function"==typeof e?(n.pop(),e):r,Lo(n,e)});function Do(n){var t=pe(n);return t.__chain__=!0,t}function Mo(n,t){return t(n)}var Fo=Ei(function(n){var t=n.length,e=t?n[0]:0,u=this.__wrapped__,i=function(t){return We(t,n)};return!(t>1||this.__actions__.length)&&u instanceof ye&&Zi(e)?((u=u.slice(e,+e+(t?1:0))).__actions__.push({func:Mo,args:[i],thisArg:r}),new ge(u,this.__chain__).thru(function(n){return t&&!n.length&&n.push(r),n})):this.thru(i)});var No=ui(function(n,t,r){st.call(n,r)?++n[r]:Le(n,r,1)});var Po=si(_o),qo=si(go);function Zo(n,t){return(df(n)?Zt:De)(n,Bi(t,3))}function Ko(n,t){return(df(n)?Kt:Me)(n,Bi(t,3))}var Vo=ui(function(n,t,r){st.call(n,r)?n[r].push(t):Le(n,r,[t])});var Go=ju(function(n,t,r){var e=-1,u="function"==typeof t,i=wf(n)?Yn(n.length):[];return De(n,function(n){i[++e]=u?Pt(t,n,r):eu(n,t,r)}),i}),Ho=ui(function(n,t,r){Le(n,r,t)});function Jo(n,t){return(df(n)?Yt:hu)(n,Bi(t,3))}var Yo=ui(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]});var Qo=ju(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ki(n,t[0],t[1])?t=[]:r>2&&Ki(t[0],t[1],t[2])&&(t=[t[0]]),yu(n,qe(t,1),[])}),Xo=Ur||function(){return St.Date.now()};function nf(n,t,e){return t=e?r:t,t=n&&null==t?n.length:t,Ai(n,m,r,r,r,r,t)}function tf(n,t){var e;if("function"!=typeof t)throw new it(i);return n=Nf(n),function(){return--n>0&&(e=t.apply(this,arguments)),n<=1&&(t=r),e}}var rf=ju(function(n,t,r){var e=v;if(r.length){var u=kr(r,Ci(rf));e|=b}return Ai(n,e,t,r,u)}),ef=ju(function(n,t,r){var e=v|_;if(r.length){var u=kr(r,Ci(ef));e|=b}return Ai(t,e,n,r,u)});function uf(n,t,e){var u,o,f,a,c,l,s=0,h=!1,p=!1,v=!0;if("function"!=typeof n)throw new it(i);function _(t){var e=u,i=o;return u=o=r,s=t,a=n.apply(i,e)}function g(n){var e=n-l;return l===r||e>=t||e<0||p&&n-s>=f}function y(){var n=Xo();if(g(n))return d(n);c=eo(y,function(n){var r=t-(n-l);return p?Kr(r,f-(n-s)):r}(n))}function d(n){return c=r,v&&u?_(n):(u=o=r,a)}function b(){var n=Xo(),e=g(n);if(u=arguments,o=this,l=n,e){if(c===r)return function(n){return s=n,c=eo(y,t),h?_(n):a}(l);if(p)return Hu(c),c=eo(y,t),_(l)}return c===r&&(c=eo(y,t)),a}return t=qf(t)||0,Rf(e)&&(h=!!e.leading,f=(p="maxWait"in e)?Zr(qf(e.maxWait)||0,t):f,v="trailing"in e?!!e.trailing:v),b.cancel=function(){c!==r&&Hu(c),s=0,u=l=o=c=r},b.flush=function(){return c===r?a:d(Xo())},b}var of=ju(function(n,t){return Te(n,1,t)}),ff=ju(function(n,t,r){return Te(n,qf(t)||0,r)});function af(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new it(i);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(af.Cache||we),r}function cf(n){if("function"!=typeof n)throw new it(i);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}af.Cache=we;var lf=Vu(function(n,t){var r=(t=1==t.length&&df(t[0])?Yt(t[0],vr(Bi())):Yt(qe(t,1),vr(Bi()))).length;return ju(function(e){for(var u=-1,i=Kr(e.length,r);++u<i;)e[u]=t[u].call(this,e[u]);return Pt(n,this,e)})}),sf=ju(function(n,t){var e=kr(t,Ci(sf));return Ai(n,b,r,t,e)}),hf=ju(function(n,t){var e=kr(t,Ci(hf));return Ai(n,w,r,t,e)}),pf=Ei(function(n,t){return Ai(n,x,r,r,r,t)});function vf(n,t){return n===t||n!=n&&t!=t}var _f=bi(Xe),gf=bi(function(n,t){return n>=t}),yf=uu(function(){return arguments}())?uu:function(n){return Ef(n)&&st.call(n,"callee")&&!Ut.call(n,"callee")},df=Yn.isArray,bf=Tt?vr(Tt):function(n){return Ef(n)&&Qe(n)==on};function wf(n){return null!=n&&If(n.length)&&!kf(n)}function mf(n){return Ef(n)&&wf(n)}var xf=Fr||qa,jf=$t?vr($t):function(n){return Ef(n)&&Qe(n)==N};function Af(n){if(!Ef(n))return!1;var t=Qe(n);return t==q||t==P||"string"==typeof n.message&&"string"==typeof n.name&&!Lf(n)}function kf(n){if(!Rf(n))return!1;var t=Qe(n);return t==Z||t==K||t==M||t==Y}function Of(n){return"number"==typeof n&&n==Nf(n)}function If(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=S}function Rf(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function Ef(n){return null!=n&&"object"==typeof n}var zf=Dt?vr(Dt):function(n){return Ef(n)&&Fi(n)==V};function Sf(n){return"number"==typeof n||Ef(n)&&Qe(n)==G}function Lf(n){if(!Ef(n)||Qe(n)!=J)return!1;var t=Wt(n);if(null===t)return!0;var r=st.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&lt.call(r)==_t}var Wf=Mt?vr(Mt):function(n){return Ef(n)&&Qe(n)==Q};var Cf=Ft?vr(Ft):function(n){return Ef(n)&&Fi(n)==X};function Bf(n){return"string"==typeof n||!df(n)&&Ef(n)&&Qe(n)==nn}function Uf(n){return"symbol"==typeof n||Ef(n)&&Qe(n)==tn}var Tf=Nt?vr(Nt):function(n){return Ef(n)&&If(n.length)&&!!At[Qe(n)]};var $f=bi(su),Df=bi(function(n,t){return n<=t});function Mf(n){if(!n)return[];if(wf(n))return Bf(n)?Er(n):ri(n);if(Lr&&n[Lr])return function(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}(n[Lr]());var t=Fi(n);return(t==V?jr:t==X?Or:va)(n)}function Ff(n){return n?(n=qf(n))===z||n===-z?(n<0?-1:1)*L:n==n?n:0:0===n?n:0}function Nf(n){var t=Ff(n),r=t%1;return t==t?r?t-r:t:0}function Pf(n){return n?Ce(Nf(n),0,C):0}function qf(n){if("number"==typeof n)return n;if(Uf(n))return W;if(Rf(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=Rf(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=n.replace(Ln,"");var r=Pn.test(n);return r||Zn.test(n)?Rt(n.slice(2),r?2:8):Nn.test(n)?W:+n}function Zf(n){return ei(n,oa(n))}function Kf(n){return null==n?"":Uu(n)}var Vf=ii(function(n,t){if(Ji(t)||wf(t))ei(t,ia(t),n);else for(var r in t)st.call(t,r)&&Re(n,r,t[r])}),Gf=ii(function(n,t){ei(t,oa(t),n)}),Hf=ii(function(n,t,r,e){ei(t,oa(t),n,e)}),Jf=ii(function(n,t,r,e){ei(t,ia(t),n,e)}),Yf=Ei(We);var Qf=ju(function(n,t){n=rt(n);var e=-1,u=t.length,i=u>2?t[2]:r;for(i&&Ki(t[0],t[1],i)&&(u=1);++e<u;)for(var o=t[e],f=oa(o),a=-1,c=f.length;++a<c;){var l=f[a],s=n[l];(s===r||vf(s,at[l])&&!st.call(n,l))&&(n[l]=o[l])}return n}),Xf=ju(function(n){return n.push(r,Oi),Pt(aa,r,n)});function na(n,t,e){var u=null==n?r:Je(n,t);return u===r?e:u}function ta(n,t){return null!=n&&Ni(n,t,tu)}var ra=vi(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=vt.call(t)),n[t]=r},Ra(Sa)),ea=vi(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=vt.call(t)),st.call(n,t)?n[t].push(r):n[t]=[r]},Bi),ua=ju(eu);function ia(n){return wf(n)?je(n):cu(n)}function oa(n){return wf(n)?je(n,!0):lu(n)}var fa=ii(function(n,t,r){_u(n,t,r)}),aa=ii(function(n,t,r,e){_u(n,t,r,e)}),ca=Ei(function(n,t){var r={};if(null==n)return r;var e=!1;t=Yt(t,function(t){return t=Ku(t,n),e||(e=t.length>1),t}),ei(n,Si(n),r),e&&(r=Be(r,c|l|s,Ii));for(var u=t.length;u--;)$u(r,t[u]);return r});var la=Ei(function(n,t){return null==n?{}:function(n,t){return du(n,t,function(t,r){return ta(n,r)})}(n,t)});function sa(n,t){if(null==n)return{};var r=Yt(Si(n),function(n){return[n]});return t=Bi(t),du(n,r,function(n,r){return t(n,r[0])})}var ha=ji(ia),pa=ji(oa);function va(n){return null==n?[]:_r(n,ia(n))}var _a=ci(function(n,t,r){return t=t.toLowerCase(),n+(r?ga(t):t)});function ga(n){return Aa(Kf(n).toLowerCase())}function ya(n){return(n=Kf(n))&&n.replace(Vn,br).replace(yt,"")}var da=ci(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),ba=ci(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),wa=ai("toLowerCase");var ma=ci(function(n,t,r){return n+(r?"_":"")+t.toLowerCase()});var xa=ci(function(n,t,r){return n+(r?" ":"")+Aa(t)});var ja=ci(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Aa=ai("toUpperCase");function ka(n,t,e){return n=Kf(n),(t=e?r:t)===r?function(n){return mt.test(n)}(n)?function(n){return n.match(bt)||[]}(n):function(n){return n.match($n)||[]}(n):n.match(t)||[]}var Oa=ju(function(n,t){try{return Pt(n,r,t)}catch(e){return Af(e)?e:new Xn(e)}}),Ia=Ei(function(n,t){return Zt(t,function(t){t=co(t),Le(n,t,rf(n[t],n))}),n});function Ra(n){return function(){return n}}var Ea=hi(),za=hi(!0);function Sa(n){return n}function La(n){return au("function"==typeof n?n:Be(n,c))}var Wa=ju(function(n,t){return function(r){return eu(r,n,t)}}),Ca=ju(function(n,t){return function(r){return eu(n,r,t)}});function Ba(n,t,r){var e=ia(t),u=He(t,e);null!=r||Rf(t)&&(u.length||!e.length)||(r=t,t=n,n=this,u=He(t,ia(t)));var i=!(Rf(r)&&"chain"in r&&!r.chain),o=kf(n);return Zt(u,function(r){var e=t[r];n[r]=e,o&&(n.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=n(this.__wrapped__);return(r.__actions__=ri(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,Qt([this.value()],arguments))})}),n}function Ua(){}var Ta=gi(Yt),$a=gi(Vt),Da=gi(tr);function Ma(n){return Vi(n)?cr(co(n)):function(n){return function(t){return Je(t,n)}}(n)}var Fa=di(),Na=di(!0);function Pa(){return[]}function qa(){return!1}var Za=_i(function(n,t){return n+t},0),Ka=mi("ceil"),Va=_i(function(n,t){return n/t},1),Ga=mi("floor");var Ha,Ja=_i(function(n,t){return n*t},1),Ya=mi("round"),Qa=_i(function(n,t){return n-t},0);return pe.after=function(n,t){if("function"!=typeof t)throw new it(i);return n=Nf(n),function(){if(--n<1)return t.apply(this,arguments)}},pe.ary=nf,pe.assign=Vf,pe.assignIn=Gf,pe.assignInWith=Hf,pe.assignWith=Jf,pe.at=Yf,pe.before=tf,pe.bind=rf,pe.bindAll=Ia,pe.bindKey=ef,pe.castArray=function(){if(!arguments.length)return[];var n=arguments[0];return df(n)?n:[n]},pe.chain=Do,pe.chunk=function(n,t,e){t=(e?Ki(n,t,e):t===r)?1:Zr(Nf(t),0);var u=null==n?0:n.length;if(!u||t<1)return[];for(var i=0,o=0,f=Yn($r(u/t));i<u;)f[o++]=zu(n,i,i+=t);return f},pe.compact=function(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u},pe.concat=function(){var n=arguments.length;if(!n)return[];for(var t=Yn(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return Qt(df(r)?ri(r):[r],qe(t,1))},pe.cond=function(n){var t=null==n?0:n.length,r=Bi();return n=t?Yt(n,function(n){if("function"!=typeof n[1])throw new it(i);return[r(n[0]),n[1]]}):[],ju(function(r){for(var e=-1;++e<t;){var u=n[e];if(Pt(u[0],this,r))return Pt(u[1],this,r)}})},pe.conforms=function(n){return function(n){var t=ia(n);return function(r){return Ue(r,n,t)}}(Be(n,c))},pe.constant=Ra,pe.countBy=No,pe.create=function(n,t){var r=ve(n);return null==t?r:Se(r,t)},pe.curry=function n(t,e,u){var i=Ai(t,y,r,r,r,r,r,e=u?r:e);return i.placeholder=n.placeholder,i},pe.curryRight=function n(t,e,u){var i=Ai(t,d,r,r,r,r,r,e=u?r:e);return i.placeholder=n.placeholder,i},pe.debounce=uf,pe.defaults=Qf,pe.defaultsDeep=Xf,pe.defer=of,pe.delay=ff,pe.difference=ho,pe.differenceBy=po,pe.differenceWith=vo,pe.drop=function(n,t,e){var u=null==n?0:n.length;return u?zu(n,(t=e||t===r?1:Nf(t))<0?0:t,u):[]},pe.dropRight=function(n,t,e){var u=null==n?0:n.length;return u?zu(n,0,(t=u-(t=e||t===r?1:Nf(t)))<0?0:t):[]},pe.dropRightWhile=function(n,t){return n&&n.length?Mu(n,Bi(t,3),!0,!0):[]},pe.dropWhile=function(n,t){return n&&n.length?Mu(n,Bi(t,3),!0):[]},pe.fill=function(n,t,e,u){var i=null==n?0:n.length;return i?(e&&"number"!=typeof e&&Ki(n,t,e)&&(e=0,u=i),function(n,t,e,u){var i=n.length;for((e=Nf(e))<0&&(e=-e>i?0:i+e),(u=u===r||u>i?i:Nf(u))<0&&(u+=i),u=e>u?0:Pf(u);e<u;)n[e++]=t;return n}(n,t,e,u)):[]},pe.filter=function(n,t){return(df(n)?Gt:Pe)(n,Bi(t,3))},pe.flatMap=function(n,t){return qe(Jo(n,t),1)},pe.flatMapDeep=function(n,t){return qe(Jo(n,t),z)},pe.flatMapDepth=function(n,t,e){return e=e===r?1:Nf(e),qe(Jo(n,t),e)},pe.flatten=yo,pe.flattenDeep=function(n){return null!=n&&n.length?qe(n,z):[]},pe.flattenDepth=function(n,t){return null!=n&&n.length?qe(n,t=t===r?1:Nf(t)):[]},pe.flip=function(n){return Ai(n,j)},pe.flow=Ea,pe.flowRight=za,pe.fromPairs=function(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e},pe.functions=function(n){return null==n?[]:He(n,ia(n))},pe.functionsIn=function(n){return null==n?[]:He(n,oa(n))},pe.groupBy=Vo,pe.initial=function(n){return null!=n&&n.length?zu(n,0,-1):[]},pe.intersection=wo,pe.intersectionBy=mo,pe.intersectionWith=xo,pe.invert=ra,pe.invertBy=ea,pe.invokeMap=Go,pe.iteratee=La,pe.keyBy=Ho,pe.keys=ia,pe.keysIn=oa,pe.map=Jo,pe.mapKeys=function(n,t){var r={};return t=Bi(t,3),Ve(n,function(n,e,u){Le(r,t(n,e,u),n)}),r},pe.mapValues=function(n,t){var r={};return t=Bi(t,3),Ve(n,function(n,e,u){Le(r,e,t(n,e,u))}),r},pe.matches=function(n){return pu(Be(n,c))},pe.matchesProperty=function(n,t){return vu(n,Be(t,c))},pe.memoize=af,pe.merge=fa,pe.mergeWith=aa,pe.method=Wa,pe.methodOf=Ca,pe.mixin=Ba,pe.negate=cf,pe.nthArg=function(n){return n=Nf(n),ju(function(t){return gu(t,n)})},pe.omit=ca,pe.omitBy=function(n,t){return sa(n,cf(Bi(t)))},pe.once=function(n){return tf(2,n)},pe.orderBy=function(n,t,e,u){return null==n?[]:(df(t)||(t=null==t?[]:[t]),df(e=u?r:e)||(e=null==e?[]:[e]),yu(n,t,e))},pe.over=Ta,pe.overArgs=lf,pe.overEvery=$a,pe.overSome=Da,pe.partial=sf,pe.partialRight=hf,pe.partition=Yo,pe.pick=la,pe.pickBy=sa,pe.property=Ma,pe.propertyOf=function(n){return function(t){return null==n?r:Je(n,t)}},pe.pull=Ao,pe.pullAll=ko,pe.pullAllBy=function(n,t,r){return n&&n.length&&t&&t.length?bu(n,t,Bi(r,2)):n},pe.pullAllWith=function(n,t,e){return n&&n.length&&t&&t.length?bu(n,t,r,e):n},pe.pullAt=Oo,pe.range=Fa,pe.rangeRight=Na,pe.rearg=pf,pe.reject=function(n,t){return(df(n)?Gt:Pe)(n,cf(Bi(t,3)))},pe.remove=function(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=Bi(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return wu(n,u),r},pe.rest=function(n,t){if("function"!=typeof n)throw new it(i);return ju(n,t=t===r?t:Nf(t))},pe.reverse=Io,pe.sampleSize=function(n,t,e){return t=(e?Ki(n,t,e):t===r)?1:Nf(t),(df(n)?ke:ku)(n,t)},pe.set=function(n,t,r){return null==n?n:Ou(n,t,r)},pe.setWith=function(n,t,e,u){return u="function"==typeof u?u:r,null==n?n:Ou(n,t,e,u)},pe.shuffle=function(n){return(df(n)?Oe:Eu)(n)},pe.slice=function(n,t,e){var u=null==n?0:n.length;return u?(e&&"number"!=typeof e&&Ki(n,t,e)?(t=0,e=u):(t=null==t?0:Nf(t),e=e===r?u:Nf(e)),zu(n,t,e)):[]},pe.sortBy=Qo,pe.sortedUniq=function(n){return n&&n.length?Cu(n):[]},pe.sortedUniqBy=function(n,t){return n&&n.length?Cu(n,Bi(t,2)):[]},pe.split=function(n,t,e){return e&&"number"!=typeof e&&Ki(n,t,e)&&(t=e=r),(e=e===r?C:e>>>0)?(n=Kf(n))&&("string"==typeof t||null!=t&&!Wf(t))&&!(t=Uu(t))&&xr(n)?Gu(Er(n),0,e):n.split(t,e):[]},pe.spread=function(n,t){if("function"!=typeof n)throw new it(i);return t=null==t?0:Zr(Nf(t),0),ju(function(r){var e=r[t],u=Gu(r,0,t);return e&&Qt(u,e),Pt(n,this,u)})},pe.tail=function(n){var t=null==n?0:n.length;return t?zu(n,1,t):[]},pe.take=function(n,t,e){return n&&n.length?zu(n,0,(t=e||t===r?1:Nf(t))<0?0:t):[]},pe.takeRight=function(n,t,e){var u=null==n?0:n.length;return u?zu(n,(t=u-(t=e||t===r?1:Nf(t)))<0?0:t,u):[]},pe.takeRightWhile=function(n,t){return n&&n.length?Mu(n,Bi(t,3),!1,!0):[]},pe.takeWhile=function(n,t){return n&&n.length?Mu(n,Bi(t,3)):[]},pe.tap=function(n,t){return t(n),n},pe.throttle=function(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new it(i);return Rf(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),uf(n,t,{leading:e,maxWait:t,trailing:u})},pe.thru=Mo,pe.toArray=Mf,pe.toPairs=ha,pe.toPairsIn=pa,pe.toPath=function(n){return df(n)?Yt(n,co):Uf(n)?[n]:ri(ao(Kf(n)))},pe.toPlainObject=Zf,pe.transform=function(n,t,r){var e=df(n),u=e||xf(n)||Tf(n);if(t=Bi(t,4),null==r){var i=n&&n.constructor;r=u?e?new i:[]:Rf(n)&&kf(i)?ve(Wt(n)):{}}return(u?Zt:Ve)(n,function(n,e,u){return t(r,n,e,u)}),r},pe.unary=function(n){return nf(n,1)},pe.union=Ro,pe.unionBy=Eo,pe.unionWith=zo,pe.uniq=function(n){return n&&n.length?Tu(n):[]},pe.uniqBy=function(n,t){return n&&n.length?Tu(n,Bi(t,2)):[]},pe.uniqWith=function(n,t){return t="function"==typeof t?t:r,n&&n.length?Tu(n,r,t):[]},pe.unset=function(n,t){return null==n||$u(n,t)},pe.unzip=So,pe.unzipWith=Lo,pe.update=function(n,t,r){return null==n?n:Du(n,t,Zu(r))},pe.updateWith=function(n,t,e,u){return u="function"==typeof u?u:r,null==n?n:Du(n,t,Zu(e),u)},pe.values=va,pe.valuesIn=function(n){return null==n?[]:_r(n,oa(n))},pe.without=Wo,pe.words=ka,pe.wrap=function(n,t){return sf(Zu(t),n)},pe.xor=Co,pe.xorBy=Bo,pe.xorWith=Uo,pe.zip=To,pe.zipObject=function(n,t){return Pu(n||[],t||[],Re)},pe.zipObjectDeep=function(n,t){return Pu(n||[],t||[],Ou)},pe.zipWith=$o,pe.entries=ha,pe.entriesIn=pa,pe.extend=Gf,pe.extendWith=Hf,Ba(pe,pe),pe.add=Za,pe.attempt=Oa,pe.camelCase=_a,pe.capitalize=ga,pe.ceil=Ka,pe.clamp=function(n,t,e){return e===r&&(e=t,t=r),e!==r&&(e=(e=qf(e))==e?e:0),t!==r&&(t=(t=qf(t))==t?t:0),Ce(qf(n),t,e)},pe.clone=function(n){return Be(n,s)},pe.cloneDeep=function(n){return Be(n,c|s)},pe.cloneDeepWith=function(n,t){return Be(n,c|s,t="function"==typeof t?t:r)},pe.cloneWith=function(n,t){return Be(n,s,t="function"==typeof t?t:r)},pe.conformsTo=function(n,t){return null==t||Ue(n,t,ia(t))},pe.deburr=ya,pe.defaultTo=function(n,t){return null==n||n!=n?t:n},pe.divide=Va,pe.endsWith=function(n,t,e){n=Kf(n),t=Uu(t);var u=n.length,i=e=e===r?u:Ce(Nf(e),0,u);return(e-=t.length)>=0&&n.slice(e,i)==t},pe.eq=vf,pe.escape=function(n){return(n=Kf(n))&&jn.test(n)?n.replace(mn,wr):n},pe.escapeRegExp=function(n){return(n=Kf(n))&&Sn.test(n)?n.replace(zn,"\\$&"):n},pe.every=function(n,t,e){var u=df(n)?Vt:Fe;return e&&Ki(n,t,e)&&(t=r),u(n,Bi(t,3))},pe.find=Po,pe.findIndex=_o,pe.findKey=function(n,t){return er(n,Bi(t,3),Ve)},pe.findLast=qo,pe.findLastIndex=go,pe.findLastKey=function(n,t){return er(n,Bi(t,3),Ge)},pe.floor=Ga,pe.forEach=Zo,pe.forEachRight=Ko,pe.forIn=function(n,t){return null==n?n:Ze(n,Bi(t,3),oa)},pe.forInRight=function(n,t){return null==n?n:Ke(n,Bi(t,3),oa)},pe.forOwn=function(n,t){return n&&Ve(n,Bi(t,3))},pe.forOwnRight=function(n,t){return n&&Ge(n,Bi(t,3))},pe.get=na,pe.gt=_f,pe.gte=gf,pe.has=function(n,t){return null!=n&&Ni(n,t,nu)},pe.hasIn=ta,pe.head=bo,pe.identity=Sa,pe.includes=function(n,t,r,e){n=wf(n)?n:va(n),r=r&&!e?Nf(r):0;var u=n.length;return r<0&&(r=Zr(u+r,0)),Bf(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&ir(n,t,r)>-1},pe.indexOf=function(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:Nf(r);return u<0&&(u=Zr(e+u,0)),ir(n,t,u)},pe.inRange=function(n,t,e){return t=Ff(t),e===r?(e=t,t=0):e=Ff(e),function(n,t,r){return n>=Kr(t,r)&&n<Zr(t,r)}(n=qf(n),t,e)},pe.invoke=ua,pe.isArguments=yf,pe.isArray=df,pe.isArrayBuffer=bf,pe.isArrayLike=wf,pe.isArrayLikeObject=mf,pe.isBoolean=function(n){return!0===n||!1===n||Ef(n)&&Qe(n)==F},pe.isBuffer=xf,pe.isDate=jf,pe.isElement=function(n){return Ef(n)&&1===n.nodeType&&!Lf(n)},pe.isEmpty=function(n){if(null==n)return!0;if(wf(n)&&(df(n)||"string"==typeof n||"function"==typeof n.splice||xf(n)||Tf(n)||yf(n)))return!n.length;var t=Fi(n);if(t==V||t==X)return!n.size;if(Ji(n))return!cu(n).length;for(var r in n)if(st.call(n,r))return!1;return!0},pe.isEqual=function(n,t){return iu(n,t)},pe.isEqualWith=function(n,t,e){var u=(e="function"==typeof e?e:r)?e(n,t):r;return u===r?iu(n,t,r,e):!!u},pe.isError=Af,pe.isFinite=function(n){return"number"==typeof n&&Nr(n)},pe.isFunction=kf,pe.isInteger=Of,pe.isLength=If,pe.isMap=zf,pe.isMatch=function(n,t){return n===t||ou(n,t,Ti(t))},pe.isMatchWith=function(n,t,e){return e="function"==typeof e?e:r,ou(n,t,Ti(t),e)},pe.isNaN=function(n){return Sf(n)&&n!=+n},pe.isNative=function(n){if(Hi(n))throw new Xn(u);return fu(n)},pe.isNil=function(n){return null==n},pe.isNull=function(n){return null===n},pe.isNumber=Sf,pe.isObject=Rf,pe.isObjectLike=Ef,pe.isPlainObject=Lf,pe.isRegExp=Wf,pe.isSafeInteger=function(n){return Of(n)&&n>=-S&&n<=S},pe.isSet=Cf,pe.isString=Bf,pe.isSymbol=Uf,pe.isTypedArray=Tf,pe.isUndefined=function(n){return n===r},pe.isWeakMap=function(n){return Ef(n)&&Fi(n)==en},pe.isWeakSet=function(n){return Ef(n)&&Qe(n)==un},pe.join=function(n,t){return null==n?"":Pr.call(n,t)},pe.kebabCase=da,pe.last=jo,pe.lastIndexOf=function(n,t,e){var u=null==n?0:n.length;if(!u)return-1;var i=u;return e!==r&&(i=(i=Nf(e))<0?Zr(u+i,0):Kr(i,u-1)),t==t?function(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}(n,t,i):ur(n,fr,i,!0)},pe.lowerCase=ba,pe.lowerFirst=wa,pe.lt=$f,pe.lte=Df,pe.max=function(n){return n&&n.length?Ne(n,Sa,Xe):r},pe.maxBy=function(n,t){return n&&n.length?Ne(n,Bi(t,2),Xe):r},pe.mean=function(n){return ar(n,Sa)},pe.meanBy=function(n,t){return ar(n,Bi(t,2))},pe.min=function(n){return n&&n.length?Ne(n,Sa,su):r},pe.minBy=function(n,t){return n&&n.length?Ne(n,Bi(t,2),su):r},pe.stubArray=Pa,pe.stubFalse=qa,pe.stubObject=function(){return{}},pe.stubString=function(){return""},pe.stubTrue=function(){return!0},pe.multiply=Ja,pe.nth=function(n,t){return n&&n.length?gu(n,Nf(t)):r},pe.noConflict=function(){return St._===this&&(St._=dt),this},pe.noop=Ua,pe.now=Xo,pe.pad=function(n,t,r){n=Kf(n);var e=(t=Nf(t))?Rr(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return yi(Dr(u),r)+n+yi($r(u),r)},pe.padEnd=function(n,t,r){n=Kf(n);var e=(t=Nf(t))?Rr(n):0;return t&&e<t?n+yi(t-e,r):n},pe.padStart=function(n,t,r){n=Kf(n);var e=(t=Nf(t))?Rr(n):0;return t&&e<t?yi(t-e,r)+n:n},pe.parseInt=function(n,t,r){return r||null==t?t=0:t&&(t=+t),Gr(Kf(n).replace(Wn,""),t||0)},pe.random=function(n,t,e){if(e&&"boolean"!=typeof e&&Ki(n,t,e)&&(t=e=r),e===r&&("boolean"==typeof t?(e=t,t=r):"boolean"==typeof n&&(e=n,n=r)),n===r&&t===r?(n=0,t=1):(n=Ff(n),t===r?(t=n,n=0):t=Ff(t)),n>t){var u=n;n=t,t=u}if(e||n%1||t%1){var i=Hr();return Kr(n+i*(t-n+It("1e-"+((i+"").length-1))),t)}return mu(n,t)},pe.reduce=function(n,t,r){var e=df(n)?Xt:sr,u=arguments.length<3;return e(n,Bi(t,4),r,u,De)},pe.reduceRight=function(n,t,r){var e=df(n)?nr:sr,u=arguments.length<3;return e(n,Bi(t,4),r,u,Me)},pe.repeat=function(n,t,e){return t=(e?Ki(n,t,e):t===r)?1:Nf(t),xu(Kf(n),t)},pe.replace=function(){var n=arguments,t=Kf(n[0]);return n.length<3?t:t.replace(n[1],n[2])},pe.result=function(n,t,e){var u=-1,i=(t=Ku(t,n)).length;for(i||(i=1,n=r);++u<i;){var o=null==n?r:n[co(t[u])];o===r&&(u=i,o=e),n=kf(o)?o.call(n):o}return n},pe.round=Ya,pe.runInContext=n,pe.sample=function(n){return(df(n)?Ae:Au)(n)},pe.size=function(n){if(null==n)return 0;if(wf(n))return Bf(n)?Rr(n):n.length;var t=Fi(n);return t==V||t==X?n.size:cu(n).length},pe.snakeCase=ma,pe.some=function(n,t,e){var u=df(n)?tr:Su;return e&&Ki(n,t,e)&&(t=r),u(n,Bi(t,3))},pe.sortedIndex=function(n,t){return Lu(n,t)},pe.sortedIndexBy=function(n,t,r){return Wu(n,t,Bi(r,2))},pe.sortedIndexOf=function(n,t){var r=null==n?0:n.length;if(r){var e=Lu(n,t);if(e<r&&vf(n[e],t))return e}return-1},pe.sortedLastIndex=function(n,t){return Lu(n,t,!0)},pe.sortedLastIndexBy=function(n,t,r){return Wu(n,t,Bi(r,2),!0)},pe.sortedLastIndexOf=function(n,t){if(null!=n&&n.length){var r=Lu(n,t,!0)-1;if(vf(n[r],t))return r}return-1},pe.startCase=xa,pe.startsWith=function(n,t,r){return n=Kf(n),r=null==r?0:Ce(Nf(r),0,n.length),t=Uu(t),n.slice(r,r+t.length)==t},pe.subtract=Qa,pe.sum=function(n){return n&&n.length?hr(n,Sa):0},pe.sumBy=function(n,t){return n&&n.length?hr(n,Bi(t,2)):0},pe.template=function(n,t,e){var u=pe.templateSettings;e&&Ki(n,t,e)&&(t=r),n=Kf(n),t=Hf({},t,u,ki);var i,o,f=Hf({},t.imports,u.imports,ki),a=ia(f),c=_r(f,a),l=0,s=t.interpolate||Gn,h="__p += '",p=et((t.escape||Gn).source+"|"+s.source+"|"+(s===On?Mn:Gn).source+"|"+(t.evaluate||Gn).source+"|$","g"),v="//# sourceURL="+(st.call(t,"sourceURL")?(t.sourceURL+"").replace(/[\r\n]/g," "):"lodash.templateSources["+ ++jt+"]")+"\n";n.replace(p,function(t,r,e,u,f,a){return e||(e=u),h+=n.slice(l,a).replace(Hn,mr),r&&(i=!0,h+="' +\n__e("+r+") +\n'"),f&&(o=!0,h+="';\n"+f+";\n__p += '"),e&&(h+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),l=a+t.length,t}),h+="';\n";var _=st.call(t,"variable")&&t.variable;_||(h="with (obj) {\n"+h+"\n}\n"),h=(o?h.replace(yn,""):h).replace(dn,"$1").replace(bn,"$1;"),h="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(i?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Oa(function(){return nt(a,v+"return "+h).apply(r,c)});if(g.source=h,Af(g))throw g;return g},pe.times=function(n,t){if((n=Nf(n))<1||n>S)return[];var r=C,e=Kr(n,C);t=Bi(t),n-=C;for(var u=pr(e,t);++r<n;)t(r);return u},pe.toFinite=Ff,pe.toInteger=Nf,pe.toLength=Pf,pe.toLower=function(n){return Kf(n).toLowerCase()},pe.toNumber=qf,pe.toSafeInteger=function(n){return n?Ce(Nf(n),-S,S):0===n?n:0},pe.toString=Kf,pe.toUpper=function(n){return Kf(n).toUpperCase()},pe.trim=function(n,t,e){if((n=Kf(n))&&(e||t===r))return n.replace(Ln,"");if(!n||!(t=Uu(t)))return n;var u=Er(n),i=Er(t);return Gu(u,yr(u,i),dr(u,i)+1).join("")},pe.trimEnd=function(n,t,e){if((n=Kf(n))&&(e||t===r))return n.replace(Cn,"");if(!n||!(t=Uu(t)))return n;var u=Er(n);return Gu(u,0,dr(u,Er(t))+1).join("")},pe.trimStart=function(n,t,e){if((n=Kf(n))&&(e||t===r))return n.replace(Wn,"");if(!n||!(t=Uu(t)))return n;var u=Er(n);return Gu(u,yr(u,Er(t))).join("")},pe.truncate=function(n,t){var e=A,u=k;if(Rf(t)){var i="separator"in t?t.separator:i;e="length"in t?Nf(t.length):e,u="omission"in t?Uu(t.omission):u}var o=(n=Kf(n)).length;if(xr(n)){var f=Er(n);o=f.length}if(e>=o)return n;var a=e-Rr(u);if(a<1)return u;var c=f?Gu(f,0,a).join(""):n.slice(0,a);if(i===r)return c+u;if(f&&(a+=c.length-a),Wf(i)){if(n.slice(a).search(i)){var l,s=c;for(i.global||(i=et(i.source,Kf(Fn.exec(i))+"g")),i.lastIndex=0;l=i.exec(s);)var h=l.index;c=c.slice(0,h===r?a:h)}}else if(n.indexOf(Uu(i),a)!=a){var p=c.lastIndexOf(i);p>-1&&(c=c.slice(0,p))}return c+u},pe.unescape=function(n){return(n=Kf(n))&&xn.test(n)?n.replace(wn,zr):n},pe.uniqueId=function(n){var t=++ht;return Kf(n)+t},pe.upperCase=ja,pe.upperFirst=Aa,pe.each=Zo,pe.eachRight=Ko,pe.first=bo,Ba(pe,(Ha={},Ve(pe,function(n,t){st.call(pe.prototype,t)||(Ha[t]=n)}),Ha),{chain:!1}),pe.VERSION="4.17.15",Zt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){pe[n].placeholder=pe}),Zt(["drop","take"],function(n,t){ye.prototype[n]=function(e){e=e===r?1:Zr(Nf(e),0);var u=this.__filtered__&&!t?new ye(this):this.clone();return u.__filtered__?u.__takeCount__=Kr(e,u.__takeCount__):u.__views__.push({size:Kr(e,C),type:n+(u.__dir__<0?"Right":"")}),u},ye.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),Zt(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==R||3==r;ye.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:Bi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),Zt(["head","last"],function(n,t){var r="take"+(t?"Right":"");ye.prototype[n]=function(){return this[r](1).value()[0]}}),Zt(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");ye.prototype[n]=function(){return this.__filtered__?new ye(this):this[r](1)}}),ye.prototype.compact=function(){return this.filter(Sa)},ye.prototype.find=function(n){return this.filter(n).head()},ye.prototype.findLast=function(n){return this.reverse().find(n)},ye.prototype.invokeMap=ju(function(n,t){return"function"==typeof n?new ye(this):this.map(function(r){return eu(r,n,t)})}),ye.prototype.reject=function(n){return this.filter(cf(Bi(n)))},ye.prototype.slice=function(n,t){n=Nf(n);var e=this;return e.__filtered__&&(n>0||t<0)?new ye(e):(n<0?e=e.takeRight(-n):n&&(e=e.drop(n)),t!==r&&(e=(t=Nf(t))<0?e.dropRight(-t):e.take(t-n)),e)},ye.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},ye.prototype.toArray=function(){return this.take(C)},Ve(ye.prototype,function(n,t){var e=/^(?:filter|find|map|reject)|While$/.test(t),u=/^(?:head|last)$/.test(t),i=pe[u?"take"+("last"==t?"Right":""):t],o=u||/^find/.test(t);i&&(pe.prototype[t]=function(){var t=this.__wrapped__,f=u?[1]:arguments,a=t instanceof ye,c=f[0],l=a||df(t),s=function(n){var t=i.apply(pe,Qt([n],f));return u&&h?t[0]:t};l&&e&&"function"==typeof c&&1!=c.length&&(a=l=!1);var h=this.__chain__,p=!!this.__actions__.length,v=o&&!h,_=a&&!p;if(!o&&l){t=_?t:new ye(this);var g=n.apply(t,f);return g.__actions__.push({func:Mo,args:[s],thisArg:r}),new ge(g,h)}return v&&_?n.apply(this,f):(g=this.thru(s),v?u?g.value()[0]:g.value():g)})}),Zt(["pop","push","shift","sort","splice","unshift"],function(n){var t=ot[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);pe.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(df(u)?u:[],n)}return this[r](function(r){return t.apply(df(r)?r:[],n)})}}),Ve(ye.prototype,function(n,t){var r=pe[t];if(r){var e=r.name+"";st.call(ue,e)||(ue[e]=[]),ue[e].push({name:t,func:r})}}),ue[pi(r,_).name]=[{name:"wrapper",func:r}],ye.prototype.clone=function(){var n=new ye(this.__wrapped__);return n.__actions__=ri(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=ri(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=ri(this.__views__),n},ye.prototype.reverse=function(){if(this.__filtered__){var n=new ye(this);n.__dir__=-1,n.__filtered__=!0}else(n=this.clone()).__dir__*=-1;return n},ye.prototype.value=function(){var n=this.__wrapped__.value(),t=this.__dir__,r=df(n),e=t<0,u=r?n.length:0,i=function(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=Kr(t,n+o);break;case"takeRight":n=Zr(n,t-o)}}return{start:n,end:t}}(0,u,this.__views__),o=i.start,f=i.end,a=f-o,c=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=Kr(a,this.__takeCount__);if(!r||!e&&u==a&&p==a)return Fu(n,this.__actions__);var v=[];n:for(;a--&&h<p;){for(var _=-1,g=n[c+=t];++_<s;){var y=l[_],d=y.iteratee,b=y.type,w=d(g);if(b==E)g=w;else if(!w){if(b==R)continue n;break n}}v[h++]=g}return v},pe.prototype.at=Fo,pe.prototype.chain=function(){return Do(this)},pe.prototype.commit=function(){return new ge(this.value(),this.__chain__)},pe.prototype.next=function(){this.__values__===r&&(this.__values__=Mf(this.value()));var n=this.__index__>=this.__values__.length;return{done:n,value:n?r:this.__values__[this.__index__++]}},pe.prototype.plant=function(n){for(var t,e=this;e instanceof _e;){var u=so(e);u.__index__=0,u.__values__=r,t?i.__wrapped__=u:t=u;var i=u;e=e.__wrapped__}return i.__wrapped__=n,t},pe.prototype.reverse=function(){var n=this.__wrapped__;if(n instanceof ye){var t=n;return this.__actions__.length&&(t=new ye(this)),(t=t.reverse()).__actions__.push({func:Mo,args:[Io],thisArg:r}),new ge(t,this.__chain__)}return this.thru(Io)},pe.prototype.toJSON=pe.prototype.valueOf=pe.prototype.value=function(){return Fu(this.__wrapped__,this.__actions__)},pe.prototype.first=pe.prototype.head,Lr&&(pe.prototype[Lr]=function(){return this}),pe}();"function"==typeof n&&"object"==typeof n.amd&&n.amd?(St._=Sr,n(function(){return Sr})):Wt?((Wt.exports=Sr)._=Sr,Lt._=Sr):St._=Sr}).call(this);
},{"buffer":"VjIL"}],"iO5H":[function(require,module,exports) {
var i=require("pdfast"),e=require("lodash"),t=function(t,n,r){var u=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],s=e.filter(t,e.isFinite);e.isFinite(u)&&(s=e.filter(s,function(i){return i>u})),e.isFinite(o)&&(s=e.filter(s,function(i){return i<o}));var f=i.create(s,{size:n,width:r});return{xs:f.map(function(i){return i.x}),ys:f.map(function(i){return i.y})}};module.exports={samplesToContinuousPdf:t};
},{"pdfast":"fFBv","lodash":"hKJs"}],"Oh6H":[function(require,module,exports) {
"use strict";var r=require("jstat"),t=require("rescript/lib/js/caml_array.js"),e=require("../utility/E.bs.js");function n(r){return e.A.length(r)}function a(t){return r.percentile(t,.75,!0)-r.percentile(t,.25,!0)}function i(n){var i=Math.sqrt(r.variance(n)),s=Math.min(i,a(n)/1.34),u=Math.abs(t.get(n,1));return.9*(Number.isNaN(s)?Number.isNaN(i)?Number.isNaN(u)?1:u:i:s)*Math.pow(e.A.length(n),-.2)}function s(t){var n=a(t)/1.34;return 1.06*Math.min(Math.sqrt(r.variance(t)),n)*Math.pow(e.A.length(t),-.2)}exports.len=n,exports.iqr=a,exports.nrd0=i,exports.nrd=s;
},{"jstat":"AuT8","rescript/lib/js/caml_array.js":"Tpli","../utility/E.bs.js":"xX5m"}],"O6rr":[function(require,module,exports) {
"use strict";function e(e,r,i){return r in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}var r=require("rescript/lib/js/curry.js"),i=require("rescript/lib/js/caml_option.js"),s=require("../utility/E.bs.js"),o=require("./Mixed.bs.js"),t=require("./XYShape.bs.js"),u=require("./Discrete.bs.js"),n=require("./Continuous.bs.js");function a(a,l){var b=r._2(s.O.$$default,n.make(void 0,0,void 0,{xs:[],ys:[]}),a),m=r._2(s.O.$$default,u.make(0,void 0,{xs:[],ys:[]}),l),d=s.A.length(t.T.xs(n.getShape(b))),c=s.A.length(t.T.xs(u.getShape(m)));return 0===d||1===d?0!==c?e({TAG:1,_0:m},Symbol.for("name"),"Discrete"):void 0:0===c?e({TAG:2,_0:b},Symbol.for("name"),"Continuous"):e({TAG:0,_0:o.make(i.some(void 0),i.some(void 0),b,m)},Symbol.for("name"),"Mixed")}exports.buildSimple=a;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_option.js":"dzFO","../utility/E.bs.js":"xX5m","./Mixed.bs.js":"XMuZ","./XYShape.bs.js":"Lf2V","./Discrete.bs.js":"Ms6F","./Continuous.bs.js":"CVcq"}],"wVv4":[function(require,module,exports) {
"use strict";var t=require("rescript/lib/js/caml.js"),r=require("rescript/lib/js/array.js"),e=require("rescript/lib/js/curry.js"),i=require("jstat"),n=require("rescript/lib/js/belt_Array.js"),o=require("rescript/lib/js/caml_array.js"),s=require("../utility/E.bs.js"),u=require("./KdeLibrary.js"),a=require("../distribution/XYShape.bs.js"),d=require("../distribution/Discrete.bs.js"),l=require("./Bandwidth.bs.js"),p=require("../distribution/Continuous.bs.js"),c=require("../distribution/MixedShapeBuilder.bs.js"),m={};function f(t){return{xs:t.xs,ys:t.ys}}function b(t,r,e){return u.samplesToContinuousPdf(t,r,e)}var h={jsToDist:f,samplesToContinuousPdf:b};function j(t,r,e){return f(u.samplesToContinuousPdf(t,r,e))}var v={normalSampling:j};function q(t){var r=[],e=s.FloatFloatMap.empty(void 0);return n.forEachWithIndex(t,function(i,u){var a=t.length-1|0,d=0!==i?i===a?[i-1|0]:[i-1|0,i+1|0]:[i+1|0],l=n.map(d,function(r){return o.get(t,r)});n.some(l,function(t){return t===u})?s.FloatFloatMap.increment(u,e):r.push(u)}),[r,e]}function g(t,r,i){return i/(e._2(s.O.$$default,0,e._3(s.A.Sorted.range,void 0,void 0,t))/r)}function y(t){return 0|i.max([t,1])}function S(t,r){return g(t,r,l.nrd0(t))}var _=j,P={splitContinuousAndDiscrete:q,xWidthToUnitWidth:g,formatUnitWidth:y,suggestedUnitWidth:S,kde:_},x={Types:m,JS:h,KDE:v,T:P};function F(i,n,o){r.fast_sort(t.caml_float_compare,i);var u,m=e._1(s.A.Sorted.Floats.split,i),f=m[0],b=s.A.length(i),h=d.make(void 0,void 0,a.T.fromZippedArray(s.FloatFloatMap.toArray(s.FloatFloatMap.fmap(function(t){return t/b},m[1]))));if(s.A.length(f)>5){var v=l.nrd0(f),q=S(f,n.outputXYPoints),_=e._2(s.O.$$default,v,n.kernelWidth),P=g(i,n.outputXYPoints,_),x={sampleCount:n.sampleCount,outputXYPoints:n.outputXYPoints,bandwidthXSuggested:v,bandwidthUnitSuggested:q,bandwidthXImplemented:_,bandwidthUnitImplemented:P};u=[p.make(void 0,void 0,void 0,j(f,n.outputXYPoints,y(P))),x]}else u=void 0;var F=c.buildSimple(e._2(s.O.fmap,function(t){return t[0]},u),h);return{continuousParseParams:e._2(s.O.fmap,function(t){return t[1]},u),shape:F}}function A(t,r){return F(r,t,void 0)}exports.Internals=x,exports.toShape=F,exports.fromSamples=A;
},{"rescript/lib/js/caml.js":"gGFE","rescript/lib/js/array.js":"d4B1","rescript/lib/js/curry.js":"NSLD","jstat":"AuT8","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_array.js":"Tpli","../utility/E.bs.js":"xX5m","./KdeLibrary.js":"iO5H","../distribution/XYShape.bs.js":"Lf2V","../distribution/Discrete.bs.js":"Ms6F","./Bandwidth.bs.js":"Oh6H","../distribution/Continuous.bs.js":"CVcq","../distribution/MixedShapeBuilder.bs.js":"O6rr"}],"OH0m":[function(require,module,exports) {
"use strict";function e(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var t=require("rescript/lib/js/curry.js"),n=require("../utility/E.bs.js"),o=require("rescript/lib/js/belt_MapString.js");function u(e,r){return t._2(n.O.fmap,function(e){return e[1]},t._2(n.A.getBy,e,function(e){return e[0]===r}))}function i(e,r){return n.O.toResult(r+" expected and not found",u(e,r))}function a(e,r){return t._2(n.A.fmap,function(r){return[r,u(e,r)]},r)}var f={getByName:u,getByNameResult:i,getByNames:a};function s(e){if("object"===r(e)){var t=e.NAME;if("SymbolicDist"===t){var n=e.VAL;return"object"===r(n)&&"Float"===n.NAME?n.VAL:void 0}if("RenderedDist"===t){var o=e.VAL;switch(0|o.TAG){case 1:var u=o._0.xyShape,i=u.xs;if(1!==i.length)return;var a=i[0],f=u.ys;if(1!==f.length)return;return 1!==f[0]?void 0:a;case 0:case 2:return}}}}function d(e){var r=s(e);return void 0!==r?{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:r}}:e}function c(e){return{sampleCount:t._2(n.O.$$default,1e4,e.sampleCount),outputXYPoints:t._2(n.O.$$default,1e4,e.outputXYPoints),kernelWidth:e.kernelWidth,shapeLength:t._2(n.O.$$default,1e4,e.shapeLength)}}var l={withDefaults:c},A=o.fromArray([]);function m(e,r){return o.merge(e,r,function(e,r,t){return void 0!==t?t:void 0!==r?r:void 0})}var y=o.update,v=o.get;function b(t,n){var u=o.get(t,n);if(void 0!==u&&"object"===r(u)&&"Function"===u.NAME){var i=u.VAL;return e({TAG:0,_0:[i[0],i[1]]},Symbol.for("name"),"Ok")}return e({TAG:1,_0:"Function "+n+" not found"},Symbol.for("name"),"Error")}var p={MS:void 0,fromArray:o.fromArray,empty:A,mergeKeepSecond:m,update:y,get:v,getFunction:b};function _(e){return t._1(e.evaluateNode,e)}function S(e,r,o){var u=t._2(e.evaluateNode,e,o);return t._2(n.R.bind,u,t._1(r,e))}function g(e,r){return t._2(e.evaluateNode,e,{NAME:"Render",VAL:r})}function N(t,n){if("object"===r(n)&&"RenderedDist"===n.NAME)return e({TAG:0,_0:n},Symbol.for("name"),"Ok");var o=g(t,n);if(0!==o.TAG)return e({TAG:1,_0:o._0},Symbol.for("name"),"Error");var u=o._0;return"object"===r(u)&&"RenderedDist"===u.NAME?e({TAG:0,_0:{NAME:"RenderedDist",VAL:u.VAL}},Symbol.for("name"),"Ok"):e({TAG:1,_0:"Did not render as requested"},Symbol.for("name"),"Error")}function E(t,n){var o=N(t,n);if(0!==o.TAG)return e({TAG:1,_0:o._0},Symbol.for("name"),"Error");var u=o._0;return"object"===r(u)&&"RenderedDist"===u.NAME?e({TAG:0,_0:u.VAL},Symbol.for("name"),"Ok"):e({TAG:1,_0:"Did not render as requested"},Symbol.for("name"),"Error")}function h(e){if("object"===r(e)&&"RenderedDist"===e.NAME)return e.VAL}function L(e){switch(0|e.TAG){case 1:var r=e._0.xyShape,t=r.xs;if(1!==t.length)return;var n=t[0],o=r.ys;if(1!==o.length)return;return 1!==o[0]?void 0:{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:n}};case 0:case 2:return}}function M(e){var r=h(e);return n.O.toResult("Not valid shape",t._2(n.O.bind,r,L))}var R={render:g,ensureIsRendered:N,ensureIsRenderedAndGetShape:E,getShape:h,_toFloat:L,toFloat:M},G={Hash:f,getFloat:s,toFloatIfNeeded:d,SamplingInputs:l,Environment:p,evaluateNode:_,evaluateAndRetry:S,Render:R},T={};exports.ExpressionTree=G,exports.Program=T;
},{"rescript/lib/js/curry.js":"NSLD","../utility/E.bs.js":"xX5m","rescript/lib/js/belt_MapString.js":"mO07"}],"uF38":[function(require,module,exports) {
"use strict";function e(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n=require("rescript/lib/js/curry.js"),t=require("rescript/lib/js/belt_Array.js"),i=require("rescript/lib/js/caml_option.js"),o=require("../utility/E.bs.js"),u=require("../distribution/Shape.bs.js"),s=require("./Operation.bs.js"),m=require("../symbolic/SymbolicDist.bs.js"),a=require("../samplesRenderer/SamplesToShape.bs.js"),f=require("./ExpressionTypes.bs.js");function l(e){if("object"===r(e)&&"Function"===e.NAME)return e.VAL}function c(e){return e[0]}function p(e){return e[1]}function b(r,i,u){if(o.A.length(i)!==o.A.length(c(u)))return e({TAG:1,_0:"Wrong number of variables"},Symbol.for("name"),"Error");var s=n._1(f.ExpressionTree.Environment.fromArray,t.zip(c(u),i)),m={samplingInputs:r.samplingInputs,environment:n._2(f.ExpressionTree.Environment.mergeKeepSecond,r.environment,s),evaluateNode:r.evaluateNode};return n._2(r.evaluateNode,m,p(u))}var d={fromNode:l,argumentNames:c,internals:p,run:b};function y(e){if("object"!==r(e))return!1;var n=e.NAME;return"RenderedDist"===n||"Function"===n||"SymbolicDist"===n}function A(e){if("object"===r(e)){var n=e.NAME;return"RenderedDist"===n||"Function"===n||"SymbolicDist"===n?e:void 0}}var v={isPrimative:y,fromNode:A};function S(e){if("object"!==r(e))return!1;var n=e.NAME;return"RenderedDist"===n||"SymbolicDist"===n}function N(n){if("object"!==r(n))return e({TAG:1,_0:"Not valid type"},Symbol.for("name"),"Error");var t=n.NAME;return"SymbolicDist"===t?e({TAG:0,_0:{NAME:"SymbolicDist",VAL:n.VAL}},Symbol.for("name"),"Ok"):"RenderedDist"===t?e({TAG:0,_0:{NAME:"RenderedDist",VAL:n.VAL}},Symbol.for("name"),"Ok"):e({TAG:1,_0:"Not valid type"},Symbol.for("name"),"Error")}function _(r,t){if(S(t))return e({TAG:0,_0:t},Symbol.for("name"),"Ok");var i=n._2(f.ExpressionTree.Render.render,r,t);return 0===i.TAG?e({TAG:0,_0:i._0},Symbol.for("name"),"Ok"):e({TAG:1,_0:i._0},Symbol.for("name"),"Error")}function E(e,t,o){if("object"===r(o)){var u=o.NAME;return"SymbolicDist"===u?i.some(n._1(t,o.VAL)):"RenderedDist"===u?i.some(n._1(e,o.VAL)):void 0}}function j(e){return function(r){return E(function(r){return u.sampleNRendered(e,r)},function(r){return m.T.sampleN(e,r)},r)}}function g(e,r,i,u){var m=j(e)(i),a=j(e)(u);if(void 0!==m&&void 0!==a)return n._2(o.A.fmap,function(e){return s.Algebraic.toFn(r)(e[0],e[1])},t.zip(m,a))}function D(e,r,t,i){var u=_(e,t),s=_(e,i),m=o.R.merge(u,s);return n._2(o.R.bind,m,function(t){var i=g(e.samplingInputs.sampleCount,r,t[0],t[1]),u=e.samplingInputs,s=n._2(o.O.fmap,function(e){return a.fromSamples(u,e)},i),m=o.O.toResult("No response",n._2(o.O.bind,s,function(e){return e.shape}));return n._2(o.R.fmap,function(e){return{NAME:"Normalize",VAL:{NAME:"RenderedDist",VAL:e}}},m)})}var T={isSamplingDistribution:S,fromNode:N,renderIfIsNotSamplingDistribution:_,map:E,sampleN:j,getCombinationSamples:g,combineShapesUsingSampling:D};exports.$$Function=d,exports.Primative=v,exports.SamplingDistribution=T;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_option.js":"dzFO","../utility/E.bs.js":"xX5m","../distribution/Shape.bs.js":"wbI6","./Operation.bs.js":"S4ET","../symbolic/SymbolicDist.bs.js":"wl7Z","../samplesRenderer/SamplesToShape.bs.js":"wVv4","./ExpressionTypes.bs.js":"OH0m"}],"N3i9":[function(require,module,exports) {
"use strict";var r=function(r,p){var l,t;t=p.length;var e=[];for(l=0;l<t-1;++l)e.push(p[l]);var n=p[t-1];for(l=0;l<n.length;++l)e.push(n[l]);return r.apply(null,e)},p=function(r,p,l){var t,e;e=l.length;var n=[];for(t=0;t<e-1;++t)n.push(l[t]);var s=l[e-1];for(t=0;t<s.length;++t)n.push(s[t]);return r[p].apply(r,n)};exports.spliceApply=r,exports.spliceObjApply=p;
},{}],"lpIF":[function(require,module,exports) {
"use strict";var r=require("rescript/lib/js/curry.js"),i=require("../utility/E.bs.js"),e=require("rescript/lib/js/caml_splice_call.js"),t=require("./Operation.bs.js"),n=require("../symbolic/SymbolicDist.bs.js");function c(a){for(;;){var o=a,u=o.NAME;if("SymbolicDist"===u)return n.T.toString(o.VAL);if("Function"===u){var l=o.VAL;return"[Function: ("+e.spliceObjApply(",","concat",[l[0]])+c(l[1])+")]"}if("FunctionCall"===u){var s=o.VAL;return"[Function call: ("+s[0]+e.spliceObjApply(",","concat",[r._2(i.A.fmap,c,s[1])])+")]"}if("AlgebraicCombination"===u){var A=o.VAL;return t.Algebraic.format(A[0],c(A[1]),c(A[2]))}if("PointwiseCombination"===u){var p=o.VAL;return t.Pointwise.format(p[0],c(p[1]),c(p[2]))}if("Symbol"===u)return"Symbol: "+o.VAL;if("RenderedDist"===u)return"[renderedShape]";if("Truncate"===u){var f=o.VAL;return t.T.truncateToString(f[0],f[1],c(f[2]))}if("Hash"===u)return"{"+e.spliceObjApply(",","concat",[r._2(i.A.fmap,function(r){return r[0]+":"+c(r[1])},o.VAL)])+"}";if("Array"===u)return"["+e.spliceObjApply(",","concat",[r._2(i.A.fmap,c,o.VAL)])+"]";if("Render"!==u)return"normalize(k"+c(o.VAL)+")";a=o.VAL}}exports.toString=c;
},{"rescript/lib/js/curry.js":"NSLD","../utility/E.bs.js":"xX5m","rescript/lib/js/caml_splice_call.js":"N3i9","./Operation.bs.js":"S4ET","../symbolic/SymbolicDist.bs.js":"wl7Z"}],"TKgk":[function(require,module,exports) {
"use strict";function r(r,e,o){return e in r?Object.defineProperty(r,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[e]=o,r}function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}var o=require("rescript/lib/js/curry.js"),n=require("rescript/lib/js/belt_Array.js"),t=require("../utility/E.bs.js"),i=require("rescript/lib/js/caml_splice_call.js"),a=require("../expressionTree/PTypes.bs.js"),u=require("../expressionTree/ExpressionTypes.bs.js"),f=require("../expressionTree/ExpressionTreeBasic.bs.js"),A=u.ExpressionTree.getFloat;function m(r){var e=r.NAME;return"Float"===e?"Float: "+r.VAL.toString():"RenderedDist"===e?"[rendered Shape]":"Hash"===e?"{"+i.spliceObjApply(",","concat",[o._2(t.A.fmap,function(r){return r[0]+":"+m(r[1])},r.VAL)])+"}":"Array"===e?"["+i.spliceObjApply(",","concat",[o._2(t.A.fmap,m,r.VAL)])+"]":"[sampling dist]"}function s(n){if("object"!==e(n))return r({TAG:1,_0:"Wrong type: "+f.toString(n)},Symbol.for("name"),"Error");var i=n.NAME;if("SymbolicDist"!==i)return"RenderedDist"===i?r({TAG:0,_0:{NAME:"RenderedDist",VAL:n.VAL}},Symbol.for("name"),"Ok"):"Hash"===i?o._2(t.R.fmap,function(r){return{NAME:"Hash",VAL:r}},o._1(t.A.R.firstErrorOrOpen,o._2(t.A.fmap,function(r){var e=r[0];return o._2(t.R.fmap,function(r){return[e,r]},s(r[1]))},n.VAL))):"Array"===i?o._2(t.R.fmap,function(r){return{NAME:"Array",VAL:r}},o._1(t.A.R.firstErrorOrOpen,o._2(t.A.fmap,s,n.VAL))):r({TAG:1,_0:"Wrong type: "+f.toString(n)},Symbol.for("name"),"Error");var a=n.VAL;return"object"===e(a)&&"Float"===a.NAME?r({TAG:0,_0:{NAME:"Float",VAL:a.VAL}},Symbol.for("name"),"Ok"):r({TAG:0,_0:{NAME:"SamplingDist",VAL:{NAME:"SymbolicDist",VAL:a}}},Symbol.for("name"),"Ok")}function p(n,i,f){if("object"===e(i)){if("Array"===i.NAME){if("object"!==e(f))return r({TAG:1,_0:"fromNodeWithTypeCoercion error, sorry."},Symbol.for("name"),"Error");if("Array"!==f.NAME)return r({TAG:1,_0:"fromNodeWithTypeCoercion error, sorry."},Symbol.for("name"),"Error");var m=i.VAL;return o._2(t.R.fmap,function(r){return{NAME:"Array",VAL:r}},o._1(t.A.R.firstErrorOrOpen,o._2(t.A.fmap,function(r){return p(n,m,r)},f.VAL)))}if("object"!==e(f))return r({TAG:1,_0:"fromNodeWithTypeCoercion error, sorry."},Symbol.for("name"),"Error");if("Hash"!==f.NAME)return r({TAG:1,_0:"fromNodeWithTypeCoercion error, sorry."},Symbol.for("name"),"Error");var y=f.VAL,c=o._2(t.A.fmap,function(r){var e=r[0];return[e,r[1],o._2(u.ExpressionTree.Hash.getByName,y,e)]},i.VAL);return o._2(t.R.fmap,function(r){return{NAME:"Hash",VAL:r}},o._1(t.A.R.firstErrorOrOpen,o._2(t.A.fmap,function(e){var i=e[2];if(void 0===i)return r({TAG:1,_0:"Hash parameter not present in hash."},Symbol.for("name"),"Error");var a=e[0];return o._2(t.R.fmap,function(r){return[a,r]},p(n,e[1],i))},c)))}if("Float"===i){var l=A(f);return void 0!==l?r({TAG:0,_0:{NAME:"Float",VAL:l}},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Type Error: Expected float."},Symbol.for("name"),"Error")}if("SamplingDistribution"===i){var b=a.SamplingDistribution.renderIfIsNotSamplingDistribution(n,f);return o._2(t.R.bind,b,s)}var _=o._2(u.ExpressionTree.Render.render,n,f);return o._2(t.R.bind,_,s)}function y(o){return"object"===e(o)&&"Float"===o.NAME?r({TAG:0,_0:o.VAL},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Not a float"},Symbol.for("name"),"Error")}function c(o){return"object"===e(o)&&"Array"===o.NAME?r({TAG:0,_0:o.VAL},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Not an array"},Symbol.for("name"),"Error")}function l(o){return"object"===e(o)&&"Hash"===o.NAME?r({TAG:0,_0:o.VAL},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Not a named item"},Symbol.for("name"),"Error")}function b(o){if("object"!==e(o))return r({TAG:1,_0:"Cannot be converted into a distribution: "+m(o)},Symbol.for("name"),"Error");var n=o.NAME;if("SamplingDist"!==n)return"Float"===n?r({TAG:0,_0:{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:o.VAL}}},Symbol.for("name"),"Ok"):"RenderedDist"===n?r({TAG:0,_0:{NAME:"RenderedDist",VAL:o.VAL}},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Cannot be converted into a distribution: "+m(o)},Symbol.for("name"),"Error");var t=o.VAL;return"RenderedDist"===t.NAME?r({TAG:0,_0:{NAME:"RenderedDist",VAL:t.VAL}},Symbol.for("name"),"Ok"):r({TAG:0,_0:{NAME:"SymbolicDist",VAL:t.VAL}},Symbol.for("name"),"Ok")}var _={toString:m,fromNode:s,fromNodeWithTypeCoercion:p,toFloat:y,toArray:c,toNamed:l,toDist:b};function T(r,e,o,n,t,i){return{name:r,inputTypes:e,outputType:o,run:n,shouldCoerceTypes:void 0===t||t}}function E(e,o){var n=t.A.length(o.inputTypes),i=t.A.length(e);return n===i?r({TAG:0,_0:e},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Wrong number of inputs. Expected"+t.I.toString(n)+". Got:"+t.I.toString(i)},Symbol.for("name"),"Error")}function d(r,e,i,a){return o._1(t.A.R.firstErrorOrOpen,o._2(t.A.fmap,function(e){var o=e[1];return i?p(r,e[0],o):s(o)},n.zip(e,a)))}function S(r,e,n){var i=n.shouldCoerceTypes,a=n.inputTypes;return o._2(t.R.bind,E(e,n),function(e){return d(r,a,i,e)})}function N(e,n,i){var a=o._2(t.R.bind,S(e,n,i),i.run);return 0===a.TAG?r({TAG:0,_0:a._0},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Function "+i.name+" error: "+a._0},Symbol.for("name"),"Error")}var V={make:T,_inputLengthCheck:E,_coerceInputNodes:d,inputsToTypedValues:S,run:N};function L(r,e){return n.getBy(r,function(r){return r.name===e})}function G(r,e,n,i){return o._2(t.O.fmap,function(r){return N(n,i,r)},L(r,e))}var v={findByName:L,findByNameAndRun:G},O={T:V,Ts:v};exports.getFloat=A,exports.TypedValue=_,exports.$$Function=O;
},{"rescript/lib/js/curry.js":"NSLD","rescript/lib/js/belt_Array.js":"yUxI","../utility/E.bs.js":"xX5m","rescript/lib/js/caml_splice_call.js":"N3i9","../expressionTree/PTypes.bs.js":"uF38","../expressionTree/ExpressionTypes.bs.js":"OH0m","../expressionTree/ExpressionTreeBasic.bs.js":"lpIF"}],"BBdU":[function(require,module,exports) {
"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(t)}function t(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var e=require("rescript/lib/js/curry.js"),n=require("../utility/E.bs.js"),i=require("rescript/lib/js/caml_splice_call.js"),o=require("../distribution/Shape.bs.js"),a=require("../expressionTree/Operation.bs.js"),u=require("./TypeSystem.bs.js"),l=require("../symbolic/SymbolicDist.bs.js"),m=require("../expressionTree/ExpressionTypes.bs.js");function s(r){var o=i.spliceObjApply(",","concat",[e._2(n.A.fmap,u.TypedValue.toString,r)]);return console.log("Inputs were",o,r),t({TAG:1,_0:"Wrong inputs. The inputs were:"+o},Symbol.for("name"),"Error")}function A(r,e){return r<=0&&r<e?t({TAG:0,_0:{NAME:"SymbolicDist",VAL:l.Normal.from90PercentCI(r,e)}},Symbol.for("name"),"Ok"):r<e?t({TAG:0,_0:{NAME:"SymbolicDist",VAL:l.Lognormal.from90PercentCI(r,e)}},Symbol.for("name"),"Ok"):t({TAG:1,_0:"Low value must be less than high value."},Symbol.for("name"),"Error")}function f(n,i){return e._6(u.$$Function.T.make,n,["Float","Float"],"SamplingDistribution",function(n){if(2!==n.length)return s(n);var o=n[0];if("object"!==r(o))return s(n);if("Float"!==o.NAME)return s(n);var a=n[1];return"object"===r(a)&&"Float"===a.NAME?t({TAG:0,_0:{NAME:"SymbolicDist",VAL:e._2(i,o.VAL,a.VAL)}},Symbol.for("name"),"Ok"):s(n)},void 0,void 0)}function c(n,i){return e._6(u.$$Function.T.make,n,["Float"],"SamplingDistribution",function(n){if(1!==n.length)return s(n);var o=n[0];return"object"===r(o)&&"Float"===o.NAME?t({TAG:0,_0:{NAME:"SymbolicDist",VAL:e._1(i,o.VAL)}},Symbol.for("name"),"Ok"):s(n)},void 0,void 0)}function b(t,n){return e._6(u.$$Function.T.make,t,["SamplingDistribution","Float"],"SamplingDistribution",function(t){if(2!==t.length)return s(t);var i=t[0];if("object"!==r(i))return s(t);var o=i.NAME;if("SamplingDist"===o){var a=t[1];return"object"===r(a)&&"Float"===a.NAME?e._2(n,i.VAL,a.VAL):s(t)}if("RenderedDist"!==o)return s(t);var u=t[1];return"object"===r(u)&&"Float"===u.NAME?e._2(n,{NAME:"RenderedDist",VAL:i.VAL},u.VAL):s(t)},void 0,void 0)}function d(t,n){return e._6(u.$$Function.T.make,t,["RenderedDistribution","Float"],"RenderedDistribution",function(t){if(2!==t.length)return s(t);var i=t[0];if("object"!==r(i))return s(t);if("RenderedDist"!==i.NAME)return s(t);var o=t[1];return"object"===r(o)&&"Float"===o.NAME?e._2(n,i.VAL,o.VAL):s(t)},!0,void 0)}function p(t,n){return e._6(u.$$Function.T.make,t,["SamplingDistribution"],"SamplingDistribution",function(t){if(1!==t.length)return s(t);var i=t[0];if("object"!==r(i))return s(t);var o=i.NAME;return"SamplingDist"===o?e._1(n,i.VAL):"RenderedDist"===o?e._1(n,{NAME:"RenderedDist",VAL:i.VAL}):s(t)},void 0,void 0)}function _(r,i){if("RenderedDist"===i.NAME)return t({TAG:0,_0:{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:o.operate(r,i.VAL)}}},Symbol.for("name"),"Ok");var a=l.T.operate(r,i.VAL);return e._2(n.R.bind,a,function(r){return t({TAG:0,_0:{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:r}}},Symbol.for("name"),"Ok")})}function y(r,n,i){var u=a.Scale.toIntegralSumCacheFn(r),l=a.Scale.toIntegralCacheFn(r);return t({TAG:0,_0:{NAME:"RenderedDist",VAL:e._4(o.T.mapY,e._1(u,i),e._1(l,i),function(t){return a.Scale.toFn(r)(t,i)},n)}},Symbol.for("name"),"Ok")}var E=m.ExpressionTree.Hash.getByNameResult;function S(i){if(1!==i.length)return t({TAG:1,_0:"Needs items"},Symbol.for("name"),"Error");var o=i[0];if("object"!==r(o))return t({TAG:1,_0:"Needs items"},Symbol.for("name"),"Error");if("Hash"!==o.NAME)return t({TAG:1,_0:"Needs items"},Symbol.for("name"),"Error");var a=o.VAL,l=e._2(n.R.bind,e._2(n.R.bind,e._2(E,a,"dists"),u.TypedValue.toArray),function(r){return e._1(n.A.R.firstErrorOrOpen,e._2(n.A.fmap,u.TypedValue.toDist,r))}),m=e._2(n.R.bind,e._2(n.R.bind,e._2(E,a,"weights"),u.TypedValue.toArray),function(r){return e._1(n.A.R.firstErrorOrOpen,e._2(n.A.fmap,u.TypedValue.toFloat,r))});return e._2(n.R.fmap,function(r){return e._2(n.A.fmap,function(r){return[e._2(n.O.toExn,"",r[0]),e._2(n.O.$$default,1,r[1])]},n.A.zipMaxLength(r[0],r[1]))},n.R.merge(l,m))}function v(r){var t=e._2(n.R.fmap,e._1(n.A.fmap,function(r){return{NAME:"FunctionCall",VAL:["scaleMultiply",[r[0],{NAME:"SymbolicDist",VAL:{NAME:"Float",VAL:r[1]}}]]}}),S(r));return e._2(n.R.fmap,function(r){return e._3(n.A.fold_left,function(r,t){return{NAME:"PointwiseCombination",VAL:["Add",r,t]}},n.A.unsafe_get(r,0),r.slice(1))},e._2(n.R.bind,t,function(r){return n.R.errorIfCondition(n.A.isEmpty,"Needs one input",r)}))}var L=e._6(u.$$Function.T.make,"multimodal",[{NAME:"Hash",VAL:[["dists",{NAME:"Array",VAL:"SamplingDistribution"}],["weights",{NAME:"Array",VAL:"Float"}]]}],"SamplingDistribution",v,void 0,void 0),V={getByNameResult:E,_paramsToDistsAndWeights:S,_runner:v,_function:L},M=[f("normal",l.Normal.make),f("uniform",l.Uniform.make),f("beta",l.Beta.make),f("lognormal",l.Lognormal.make),f("lognormalFromMeanAndStdDev",l.Lognormal.fromMeanAndStdev),c("exponential",l.Exponential.make),e._6(u.$$Function.T.make,"to",["Float","Float"],"SamplingDistribution",function(t){if(2!==t.length)return s(t);var e=t[0];if("object"!==r(e))return s(t);if("Float"!==e.NAME)return s(t);var n=t[1];return"object"===r(n)&&"Float"===n.NAME?A(e.VAL,n.VAL):s(t)},void 0,void 0),e._6(u.$$Function.T.make,"triangular",["Float","Float","Float"],"SamplingDistribution",function(t){if(3!==t.length)return s(t);var i=t[0];if("object"!==r(i))return s(t);if("Float"!==i.NAME)return s(t);var o=t[1];if("object"!==r(o))return s(t);if("Float"!==o.NAME)return s(t);var a=t[2];return"object"===r(a)&&"Float"===a.NAME?e._2(n.R.fmap,function(r){return{NAME:"SymbolicDist",VAL:r}},l.Triangular.make(i.VAL,o.VAL,a.VAL)):s(t)},void 0,void 0),b("pdf",function(r,t){return _({NAME:"Pdf",VAL:t},r)}),b("inv",function(r,t){return _({NAME:"Inv",VAL:t},r)}),b("cdf",function(r,t){return _({NAME:"Cdf",VAL:t},r)}),p("mean",function(r){return _("Mean",r)}),p("sample",function(r){return _("Sample",r)}),e._6(u.$$Function.T.make,"render",["RenderedDistribution"],"RenderedDistribution",function(e){if(1!==e.length)return s(e);var n=e[0];return"object"===r(n)&&"RenderedDist"===n.NAME?t({TAG:0,_0:{NAME:"RenderedDist",VAL:n.VAL}},Symbol.for("name"),"Ok"):s(e)},void 0,void 0),e._6(u.$$Function.T.make,"normalize",["SamplingDistribution"],"SamplingDistribution",function(n){if(1!==n.length)return s(n);var i=n[0];if("object"!==r(i))return s(n);if("SamplingDist"!==i.NAME)return s(n);var a=i.VAL;return"RenderedDist"===a.NAME?t({TAG:0,_0:{NAME:"RenderedDist",VAL:e._1(o.T.normalize,a.VAL)}},Symbol.for("name"),"Ok"):t({TAG:0,_0:{NAME:"SymbolicDist",VAL:a.VAL}},Symbol.for("name"),"Ok")},void 0,void 0),d("scaleExp",function(r,t){return y("Exponentiate",r,t)}),d("scaleMultiply",function(r,t){return y("Multiply",r,t)}),d("scaleLog",function(r,t){return y("Log",r,t)}),L];exports.wrongInputsError=s,exports.to_=A,exports.makeSymbolicFromTwoFloats=f,exports.makeSymbolicFromOneFloat=c,exports.makeDistFloat=b,exports.makeRenderedDistFloat=d,exports.makeDist=p,exports.floatFromDist=_,exports.verticalScaling=y,exports.Multimodal=V,exports.all=M;
},{"rescript/lib/js/curry.js":"NSLD","../utility/E.bs.js":"xX5m","rescript/lib/js/caml_splice_call.js":"N3i9","../distribution/Shape.bs.js":"wbI6","../expressionTree/Operation.bs.js":"S4ET","./TypeSystem.bs.js":"TKgk","../symbolic/SymbolicDist.bs.js":"wl7Z","../expressionTree/ExpressionTypes.bs.js":"OH0m"}],"NgRJ":[function(require,module,exports) {
"use strict";function r(r,e,n){return e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r})(r)}var n=require("rescript/lib/js/curry.js"),o=require("../utility/E.bs.js"),i=require("../distribution/Shape.bs.js"),t=require("./PTypes.bs.js"),u=require("../distribution/XYShape.bs.js"),a=require("../distribution/Continuous.bs.js"),s=require("../typeSystem/TypeSystem.bs.js"),A=require("../symbolic/SymbolicDist.bs.js"),f=require("./ExpressionTypes.bs.js"),c=require("../typeSystem/HardcodedFunctions.bs.js");function m(n,o,i){if("object"===e(o)&&"SymbolicDist"===o.NAME&&"object"===e(i)&&"SymbolicDist"===i.NAME){var t=A.T.tryAnalyticalSimplification(o.VAL,i.VAL,n);return"object"===e(t)?"Error"===t.NAME?r({TAG:1,_0:t.VAL},Symbol.for("name"),"Error"):r({TAG:0,_0:{NAME:"SymbolicDist",VAL:t.VAL}},Symbol.for("name"),"Ok"):r({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:[n,o,i]}},Symbol.for("name"),"Ok")}return r({TAG:0,_0:{NAME:"AlgebraicCombination",VAL:[n,o,i]}},Symbol.for("name"),"Ok")}function b(r,e,t,u){return n._2(o.R.fmap,function(r){return{NAME:"RenderedDist",VAL:i.combineAlgebraically(e,r[0],r[1])}},o.R.merge(n._2(f.ExpressionTree.Render.ensureIsRenderedAndGetShape,r,t),n._2(f.ExpressionTree.Render.ensureIsRenderedAndGetShape,r,u)))}function l(r){if("object"!==e(r))return 1e3;var n=r.NAME;if("SymbolicDist"===n){var o=r.VAL;return"object"===e(o)&&"Float"===o.NAME?1:1e3}if("RenderedDist"!==n)return 1e3;var i=r.VAL;switch(0|i.TAG){case 1:return u.T.length(i._0.xyShape);case 0:case 2:return 1e3}}function d(r,e){return Math.imul(l(r),l(e))>1e4?"Sampling":"Analytical"}function y(r,e,i,u){var a=o.R.merge(t.SamplingDistribution.renderIfIsNotSamplingDistribution(r,i),t.SamplingDistribution.renderIfIsNotSamplingDistribution(r,u));return n._2(o.R.bind,a,function(n){var o=n[1],i=n[0];return"Sampling"===d(i,o)?t.SamplingDistribution.combineShapesUsingSampling(r,e,i,o):b(r,e,i,o)})}function p(i,t,u,a){var s=m(t,u,a);return n._2(o.R.bind,s,function(n){return"object"===e(n)&&"SymbolicDist"===n.NAME?r({TAG:0,_0:n},Symbol.for("name"),"Ok"):y(i,t,u,a)})}var E={tryAnalyticalSimplification:m,combinationByRendering:b,nodeScore:l,choose:d,combine:y,operationToLeaf:p};function S(o,t,u){var s=n._2(f.ExpressionTree.Render.render,o,t),A=n._2(f.ExpressionTree.Render.render,o,u);if(0!==s.TAG)return r({TAG:1,_0:s._0},Symbol.for("name"),"Error");var c=s._0;if("object"===e(c)&&"RenderedDist"===c.NAME&&0===A.TAG){var m=A._0;return"object"===e(m)&&"RenderedDist"===m.NAME?r({TAG:0,_0:{NAME:"RenderedDist",VAL:i.combinePointwise(function(r,e){return r+e},function(r,e){return a.combinePointwise(void 0,void 0,"CDF",function(r,e){return r+e},r,e)},function(r,e){return r+e},c.VAL,m.VAL)}},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Pointwise combination: rendering failed."},Symbol.for("name"),"Error")}return 0===A.TAG?r({TAG:1,_0:"Pointwise combination: rendering failed."},Symbol.for("name"),"Error"):r({TAG:1,_0:A._0},Symbol.for("name"),"Error")}function _(o,t,u,a){var s=n._2(f.ExpressionTree.Render.render,t,u),A=n._2(f.ExpressionTree.Render.render,t,a);if(0!==s.TAG)return r({TAG:1,_0:s._0},Symbol.for("name"),"Error");var c=s._0;if("object"===e(c)&&"RenderedDist"===c.NAME&&0===A.TAG){var m=A._0;return"object"===e(m)&&"RenderedDist"===m.NAME?r({TAG:0,_0:{NAME:"RenderedDist",VAL:i.combinePointwise(void 0,void 0,o,c.VAL,m.VAL)}},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Pointwise combination: rendering failed."},Symbol.for("name"),"Error")}return 0===A.TAG?r({TAG:1,_0:"Pointwise combination: rendering failed."},Symbol.for("name"),"Error"):r({TAG:1,_0:A._0},Symbol.for("name"),"Error")}function T(r,e,n,o){return"Add"===e?S(r,n,o):_("Exponentiate"===e?function(r,e){return Math.pow(r,e)}:function(r,e){return r*e},r,n,o)}var v={pointwiseAdd:S,pointwiseCombine:_,operationToLeaf:T};function L(r,n,o){if(void 0!==r){if(void 0!==n&&r>n)return{NAME:"Error",VAL:"Left truncation bound must be smaller than right truncation bound."}}else if(void 0===n)return{NAME:"Solution",VAL:o};if("object"!==e(o))return"NoSolution";if("SymbolicDist"!==o.NAME)return"NoSolution";var i=o.VAL;return"object"===e(i)&&"Uniform"===i.NAME?{NAME:"Solution",VAL:{NAME:"SymbolicDist",VAL:{NAME:"Uniform",VAL:A.Uniform.truncate(r,n,i.VAL)}}}:"NoSolution"}function R(o,t,u,a){var s=n._2(f.ExpressionTree.Render.ensureIsRendered,o,a);if(0!==s.TAG)return r({TAG:1,_0:s._0},Symbol.for("name"),"Error");var A=s._0;return"object"===e(A)&&"RenderedDist"===A.NAME?r({TAG:0,_0:{NAME:"RenderedDist",VAL:n._3(i.T.truncate,t,u,A.VAL)}},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Could not truncate distribution."},Symbol.for("name"),"Error")}function V(n,o,i,t){var u=L(o,i,t);return"object"===e(u)?"Error"===u.NAME?r({TAG:1,_0:u.VAL},Symbol.for("name"),"Error"):r({TAG:0,_0:u.VAL},Symbol.for("name"),"Ok"):R(n,o,i,t)}var N={trySimplification:L,truncateAsShape:R,operationToLeaf:V};function G(o,t){if("object"!==e(t))return f.ExpressionTree.evaluateAndRetry(o,G,t);var u=t.NAME;return"SymbolicDist"===u?r({TAG:0,_0:t},Symbol.for("name"),"Ok"):"RenderedDist"===u?r({TAG:0,_0:{NAME:"RenderedDist",VAL:n._1(i.T.normalize,t.VAL)}},Symbol.for("name"),"Ok"):f.ExpressionTree.evaluateAndRetry(o,G,t)}var M={operationToLeaf:G};function D(r,e,o){return n._4(s.$$Function.Ts.findByNameAndRun,c.all,r,e,o)}function g(r,e,i){var u=n._2(f.ExpressionTree.Environment.getFunction,e.environment,r);return n._2(o.R.bind,u,function(r){return t.$$Function.run(e,i,[r[0],r[1]])})}function j(r,e,i){return n._2(o.O.$$default,g(e,r,i),D(e,r,i))}function x(r,e,i){var t=n._1(o.A.R.firstErrorOrOpen,n._2(o.A.fmap,function(e){return n._2(r.evaluateNode,r,e)},i));return n._2(o.R.bind,t,function(n){return j(r,e,n)})}var O={_runHardcodedFunction:D,_runLocalFunction:g,_runWithEvaluatedInputs:j,run:x};function h(n,o){if("object"!==e(o))return f.ExpressionTree.evaluateAndRetry(n,h,o);var i=o.NAME;return"SymbolicDist"===i?r({TAG:0,_0:{NAME:"RenderedDist",VAL:A.T.toShape(n.samplingInputs.shapeLength,o.VAL)}},Symbol.for("name"),"Ok"):"Function"===i?r({TAG:1,_0:"Cannot render a function"},Symbol.for("name"),"Error"):"RenderedDist"===i?r({TAG:0,_0:o},Symbol.for("name"),"Ok"):f.ExpressionTree.evaluateAndRetry(n,h,o)}var w={operationToLeaf:h};function k(e,i){var t=i.NAME;if("RenderedDist"===t||"Function"===t||"SymbolicDist"===t)return r({TAG:0,_0:i},Symbol.for("name"),"Ok");if("FunctionCall"===t){var u=i.VAL,a=x(e,u[0],u[1]);return n._2(o.R.bind,a,function(r){return k(e,r)})}if("AlgebraicCombination"===t){var s=i.VAL;return p(e,s[0],s[1],s[2])}if("PointwiseCombination"===t){var A=i.VAL;return T(e,A[0],A[1],A[2])}if("Symbol"===t){var c=i.VAL,m=o.O.toResult("Undeclared variable "+c,n._2(f.ExpressionTree.Environment.get,e.environment,c));return n._2(o.R.bind,m,function(r){return k(e,r)})}if("Truncate"!==t)return"Hash"===t?n._2(o.R.fmap,function(r){return{NAME:"Hash",VAL:r}},n._1(o.A.R.firstErrorOrOpen,n._2(o.A.fmap,function(r){var i=r[0];return n._2(o.R.fmap,function(r){return[i,r]},k(e,r[1]))},i.VAL))):"Array"===t?n._2(o.R.fmap,function(r){return{NAME:"Array",VAL:r}},n._1(o.A.R.firstErrorOrOpen,n._2(o.A.fmap,function(r){return k(e,r)},i.VAL))):"Render"===t?h(e,i.VAL):G(e,i.VAL);var b=i.VAL;return V(e,b[0],b[1],b[2])}exports.AlgebraicCombination=E,exports.PointwiseCombination=v,exports.Truncate=N,exports.Normalize=M,exports.FunctionCall=O,exports.Render=w,exports.toLeaf=k;
},{"rescript/lib/js/curry.js":"NSLD","../utility/E.bs.js":"xX5m","../distribution/Shape.bs.js":"wbI6","./PTypes.bs.js":"uF38","../distribution/XYShape.bs.js":"Lf2V","../distribution/Continuous.bs.js":"CVcq","../typeSystem/TypeSystem.bs.js":"TKgk","../symbolic/SymbolicDist.bs.js":"wl7Z","./ExpressionTypes.bs.js":"OH0m","../typeSystem/HardcodedFunctions.bs.js":"BBdU"}],"H74a":[function(require,module,exports) {
"use strict";function e(r){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(r)}function r(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}var n=require("./PTypes.bs.js"),t=require("./ExpressionTreeBasic.bs.js"),o=require("./ExpressionTreeEvaluator.bs.js");function u(e,r){return{samplingInputs:e,environment:r,evaluateNode:o.toLeaf}}function i(e,r,n){return o.toLeaf({samplingInputs:e,environment:r,evaluateNode:o.toLeaf},n)}function a(n,t,o){var u=i(n,t,o);if(0!==u.TAG)return r({TAG:1,_0:u._0},Symbol.for("name"),"Error");var a=u._0;return"object"===e(a)&&"RenderedDist"===a.NAME?r({TAG:0,_0:a.VAL},Symbol.for("name"),"Ok"):r({TAG:1,_0:"Rendering failed."},Symbol.for("name"),"Error")}function s(e,r,t,u){var i={samplingInputs:e,environment:r,evaluateNode:o.toLeaf};return n.$$Function.run(i,t,u)}var f=t.toString;exports.toString=f,exports.envs=u,exports.toLeaf=i,exports.toShape=a,exports.runFunction=s;
},{"./PTypes.bs.js":"uF38","./ExpressionTreeBasic.bs.js":"lpIF","./ExpressionTreeEvaluator.bs.js":"NgRJ"}],"uZ2e":[function(require,module,exports) {
"use strict";function e(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n=require("rescript/lib/js/array.js"),t=require("rescript/lib/js/curry.js"),o=require("rescript/lib/js/caml_option.js"),i=require("./utility/E.bs.js"),u=require("rescript/lib/js/belt_MapString.js"),s=require("./distribution/DistPlus.bs.js"),a=require("./expressionTree/MathJsParser.bs.js"),l=require("./expressionTree/ExpressionTree.bs.js"),m=require("./expressionTree/ExpressionTypes.bs.js"),p={},f={sampleCount:void 0,outputXYPoints:void 0,kernelWidth:void 0,shapeLength:void 0};function c(e,r,n,t){return{squiggleString:r,samplingInputs:void 0!==e?e:f,environment:void 0!==n?o.valFromOption(n):m.ExpressionTree.Environment.empty}}var d={SamplingInputs:p,defaultRecommendedLength:100,defaultShouldDownsample:!0,empty:f,make:c};function b(e,r,n){return{squiggleString:e.squiggleString,samplingInputs:e.samplingInputs,environment:t._3(m.ExpressionTree.Environment.update,e.environment,r,function(e){return n})}}function v(e,r){return{graph:e,shape:r}}function A(e){return{sampleCount:t._2(i.O.$$default,1e4,e.samplingInputs.sampleCount),outputXYPoints:t._2(i.O.$$default,1e4,e.samplingInputs.outputXYPoints),kernelWidth:e.samplingInputs.kernelWidth,shapeLength:t._2(i.O.$$default,1e4,e.samplingInputs.shapeLength)}}function y(e,r){return l.toLeaf(A(e),e.environment,r)}function g(e,r){var n={contents:e};return t._1(i.A.R.firstErrorOrOpen,t._1(i.A.O.concatSomes,t._2(i.A.fmap,function(e){if("Expression"===e.NAME)return t._2(i.R.fmap,function(e){return[n.contents.environment,e]},y(n.contents,e.VAL));var r=e.VAL;n.contents=b(n.contents,r[0],r[1])},r)))}function _(e){var r=a.fromString(e.squiggleString);return t._2(i.R.bind,r,function(r){return g(e,r)})}function S(e,r){return s.make(r,e.squiggleString,void 0,void 0,void 0)}var T={addVariable:b,makeOutputs:v,makeInputs:A,runNode:y,runProgram:g,inputsToLeaf:_,outputToDistPlus:S};function E(n,t){if("object"!==r(t))return e({TAG:0,_0:t},Symbol.for("name"),"Ok");var o=t.NAME;if("SymbolicDist"!==o&&"Normalize"!==o)return e({TAG:0,_0:t},Symbol.for("name"),"Ok");var i=y(n,{NAME:"Render",VAL:t});if(0!==i.TAG)return e({TAG:1,_0:i._0},Symbol.for("name"),"Error");var u=i._0;return"object"===r(u)&&"RenderedDist"===u.NAME?i:e({TAG:1,_0:"Didn't render, but intended to"},Symbol.for("name"),"Error")}function h(n,o,u){var s=E(n,u);return t._2(i.R.bind,s,function(t){if("object"===r(t)){var i=t.NAME;if("SymbolicDist"===i){var u=t.VAL;if("object"===r(u)&&"Float"===u.NAME)return e({TAG:0,_0:{NAME:"Float",VAL:u.VAL}},Symbol.for("name"),"Ok")}else{if("Function"===i)return e({TAG:0,_0:{NAME:"Function",VAL:[t.VAL,o]}},Symbol.for("name"),"Ok");if("RenderedDist"===i){var s=t.VAL,a=0;switch(0|s.TAG){case 1:var m=s._0.xyShape,p=m.xs;if(1!==p.length)a=2;else{var f=p[0],c=m.ys;if(1!==c.length)a=2;else{if(1===c[0])return e({TAG:0,_0:{NAME:"Float",VAL:f}},Symbol.for("name"),"Ok");a=2}}break;case 0:case 2:a=2}if(2===a)return e({TAG:0,_0:{NAME:"DistPlus",VAL:S(n,s)}},Symbol.for("name"),"Ok")}}}return e({TAG:1,_0:"Didn't output a rendered distribution. Format:"+l.toString(t)},Symbol.for("name"),"Error")})}function x(r,n){if(!n)return e({TAG:0,_0:0},Symbol.for("name"),"Ok");var o=t._1(r,n.hd);if(0!==o.TAG)return e({TAG:1,_0:o._0},Symbol.for("name"),"Error");var i=x(r,n.tl);return 0===i.TAG?e({TAG:0,_0:{hd:o._0,tl:i._0}},Symbol.for("name"),"Ok"):e({TAG:1,_0:i._0},Symbol.for("name"),"Error")}function j(e){var r=_(e);return t._2(i.R.bind,r,function(r){return x(function(r){return h(e,r[0],r[1])},n.to_list(r))})}function L(e,r,n){var o=l.runFunction(A(e),e.environment,n,r),u=e.environment;return t._2(i.R.bind,o,function(r){return h(e,u,r)})}function k(e){return j(c({sampleCount:1e4,outputXYPoints:1e4,kernelWidth:void 0,shapeLength:1e3},e,o.some(u.fromArray([])),void 0))}exports.Inputs=d,exports.Internals=T,exports.renderIfNeeded=E,exports.coersionToExportedTypes=h,exports.mapM=x,exports.evaluateProgram=j,exports.evaluateFunction=L,exports.runAll=k;
},{"rescript/lib/js/array.js":"d4B1","rescript/lib/js/curry.js":"NSLD","rescript/lib/js/caml_option.js":"dzFO","./utility/E.bs.js":"xX5m","rescript/lib/js/belt_MapString.js":"mO07","./distribution/DistPlus.bs.js":"A9pM","./expressionTree/MathJsParser.bs.js":"dGOd","./expressionTree/ExpressionTree.bs.js":"H74a","./expressionTree/ExpressionTypes.bs.js":"OH0m"}],"OXj9":[function(require,module,exports) {
var r=require("./ProgramEvaluator.bs"),a=function(a){var u=r.runAll(a);return 0===u.TAG?{tag:"Ok",value:u._0}:{tag:"Error",value:u._0}};exports.runAll=a;
},{"./ProgramEvaluator.bs":"uZ2e"}],"Focm":[function(require,module,exports) {
var r=require("../distPlus/ProgramEvaluator.gen.js");exports.runMePlease=r.runAll;
},{"../distPlus/ProgramEvaluator.gen.js":"OXj9"}]},{},["Focm"], null)