From d9b74c8b5dbdd512570f4212eb88ed555cc8d0fe Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sun, 6 Feb 2022 19:04:11 -0500 Subject: [PATCH] Removed extra parcel plugins --- packages/squiggle-lang/dist/index.js | 80 ++++++------ packages/squiggle-lang/package.json | 4 +- packages/squiggle-lang/yarn.lock | 185 +-------------------------- 3 files changed, 45 insertions(+), 224 deletions(-) diff --git a/packages/squiggle-lang/dist/index.js b/packages/squiggle-lang/dist/index.js index 4a4d8d7c..1297d6f0 100644 --- a/packages/squiggle-lang/dist/index.js +++ b/packages/squiggle-lang/dist/index.js @@ -14,7 +14,21 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel "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(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(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=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)=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=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) { +},{"./curry.js":"NSLD","./caml_obj.js":"p3B5","./caml_array.js":"Tpli","./caml_exceptions.js":"RiV8","./caml_js_exceptions.js":"yO2E"}],"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:tr.max?r.max:t=0&&n=0&&n=0&&n=0&&n=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=0;--l)t[l+c|0]=n[l+a|0]}function q(r,n){for(var e=0,t=r.length;e=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;oo)return 1;if(t=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=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=v)return d;U=d,p=r[B],l=B}else if(0!==g){var I=y+1|0;if(!(I=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"}],"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 oo?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=(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=0?e=f.fromSortedArrayAux(r,0,n):(n=0|-n,e=f.fromSortedArrayRevAux(r,n-1|0,n));for(var o=n;o=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;n1)for(var n=1;nr.max?r.max:tr.max?r.max:t=0&&n=0&&n=0&&n=0&&n=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=0;--l)t[l+c|0]=n[l+a|0]}function q(r,n){for(var e=0,t=r.length;e=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;oo)return 1;if(t=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=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=v)return d;U=d,p=r[B],l=B}else if(0!==g){var I=y+1|0;if(!(I=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) { +},{"./caml_option.js":"dzFO"}],"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=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 oo?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=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;ot?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 rt},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=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=(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=0?e=f.fromSortedArrayAux(r,0,n):(n=0|-n,e=f.fromSortedArrayRevAux(r,n-1|0,n));for(var o=n;o=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;nt?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 W(r){return void 0!==r?r:""}function C(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 P(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 P(function(r,t){return rt},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:W,toResult:C,compare:P,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 gr(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 vr={result:y.result,id:mr,fmap:y.fmap,bind:y.bind,toExn:m.getExn,$$default:pr,merge:_r,toOption:dr,errorIfCondition:gr};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 Wr(r,t){return h.isSome(s.getBy(r,t))}function Cr(r){return r.length<1}function Pr(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=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=g.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=v.create("E-SquiggleExperimental.A.Floats.RangeError");function gt(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 vt={sum:pt,mean:_t,random:a.random_int,$$RangeError:dt,range:gt},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:Wr,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:Cr,min:Pr,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:vt};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=vr,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"}],"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; @@ -111,8 +111,8 @@ var e=arguments[3],r=function(){if("undefined"!=typeof globalThis)return globalT },{"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=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,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("rescript/lib/js/belt_MutableMap.js"),u=require("../utility/E.bs.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(u.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){},o=void 0!==e?e:function(e,r){};return r._3(u.A.fold_left,function(e,r){return Y(o,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=u.FloatFloatMap.empty(void 0),d=0;d=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(u.O.$$default,i.neg_infinity,e)&&n<=r._2(u.O.$$default,i.infinity,t)},c.T.zip(n.xyShape))))}function V(e,t){return s.MixedPoint.makeDiscrete(r._2(u.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(u.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","rescript/lib/js/belt_MutableMap.js":"aHaK","../utility/E.bs.js":"xX5m","./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>>")}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) { +"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("./MathjsWrapper.js"),s=require("rescript/lib/js/caml_js_exceptions.js"),i=require("../utility/E.bs.js");function n(r){return a.parseMath(r)}function o(n){var o;try{o=a.parseMath(n)}catch(c){var u=s.internalToOCamlException(c);return u.RE_EXN_ID===t.$$Error?r({TAG:1,_0:e._2(i.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","./MathjsWrapper.js":"Tiv2","rescript/lib/js/caml_js_exceptions.js":"yO2E","../utility/E.bs.js":"xX5m"}],"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")}),a=n._2(i.R.bind,o,S);return console.log(o,a),a}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"}],"l9TD":[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=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;a0&&(i[e][0]=n[e][0]),f=1;ft&&e>0)return[];if(e>0)for(o=n;ot;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(te&&o>0)return[];if(o>0)for(a=t;ae;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=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;++tr&&(r=n[t]);return r},n.unique=function(n){for(var r={},t=[],e=0;eu?(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=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;i1){for(f=!0===e?this:this.transpose();i1){for("sumrow"!==r&&(f=!0===e?this:this.transpose());i1){for(i=i.transpose();u=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,om)for(t=0;t=1?t:1/t)+.4*t+17);if(e<0||t<=0)return NaN;if(e170||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;to;)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*(660)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;t1||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 n1e100?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 nt?0:1/(t-r)},cdf:function(n,r,t){return n=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||ta||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(o1&&i=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(o1&&fa);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||et?NaN:nt?0:ne?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||oe?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 n25e3)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=-30)h+=e(8=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=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;ar.abs(i[s][a])&&(s=u);var m=i[a];for(i[a]=i[s],i[s]=m,u=a+1;u=0;a--){for(l=i[a][a],u=0;ua-1;o--)i[u][o]-=i[a][o]*i[u][a]/l;for(i[a][a]/=l,o=f;os?(g[l][s]=t[l][s],p[l][s]=d[l][s]=0):la;)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=[];su?(g[s][u]=t[s][u],p[s][u]=d[s][u]=0):sa;)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=[];mi?(p[m][i]=t[m][i],d[m][i]=h[m][i]=0):ma;)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=[];c0?-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;a0?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.001&&(l=1)}for(e=0;e=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;le);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;c1||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.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;t1){for(u=[],e=0;e=r?1:0}function _n(n,r){return n=r?1:0}function wn(n,r){return n=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=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)}}; @@ -1339,29 +1339,29 @@ var n,t=arguments[3],r=require("buffer").Buffer;(function(){var r,e=200,u="Unsup 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 i5){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";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("./KdeLibrary.js"),u=require("../utility/E.bs.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 s.samplesToContinuousPdf(t,r,e)}var h={jsToDist:f,samplesToContinuousPdf:b};function j(t,r,e){return f(s.samplesToContinuousPdf(t,r,e))}var v={normalSampling:j};function q(t){var r=[],e=u.FloatFloatMap.empty(void 0);return n.forEachWithIndex(t,function(i,s){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===s})?u.FloatFloatMap.increment(s,e):r.push(s)}),[r,e]}function g(t,r,i){return i/(e._2(u.O.$$default,0,e._3(u.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 s,m=e._1(u.A.Sorted.Floats.split,i),f=m[0],b=u.A.length(i),h=d.make(void 0,void 0,a.T.fromZippedArray(u.FloatFloatMap.toArray(u.FloatFloatMap.fmap(function(t){return t/b},m[1]))));if(u.A.length(f)>5){var v=l.nrd0(f),q=S(f,n.outputXYPoints),_=e._2(u.O.$$default,v,n.kernelWidth),P=g(i,n.outputXYPoints,_),x={sampleCount:n.sampleCount,outputXYPoints:n.outputXYPoints,bandwidthXSuggested:v,bandwidthUnitSuggested:q,bandwidthXImplemented:_,bandwidthUnitImplemented:P};s=[p.make(void 0,void 0,void 0,j(f,n.outputXYPoints,y(P))),x]}else s=void 0;var F=c.buildSimple(e._2(u.O.fmap,function(t){return t[0]},s),h);return{continuousParseParams:e._2(u.O.fmap,function(t){return t[1]},s),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":"l9TD","rescript/lib/js/belt_Array.js":"yUxI","rescript/lib/js/caml_array.js":"Tpli","./KdeLibrary.js":"iO5H","../utility/E.bs.js":"xX5m","../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("rescript/lib/js/belt_MapString.js"),o=require("../utility/E.bs.js");function u(e,r){return t._2(o.O.fmap,function(e){return e[1]},t._2(o.A.getBy,e,function(e){return e[0]===r}))}function i(e,r){return o.O.toResult(r+" expected and not found",u(e,r))}function a(e,r){return t._2(o.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(o.O.$$default,1e4,e.sampleCount),outputXYPoints:t._2(o.O.$$default,1e4,e.outputXYPoints),kernelWidth:e.kernelWidth,shapeLength:t._2(o.O.$$default,1e4,e.shapeLength)}}var l={withDefaults:c},A=n.fromArray([]);function m(e,r){return n.merge(e,r,function(e,r,t){return void 0!==t?t:void 0!==r?r:void 0})}var y=n.update,v=n.get;function b(t,o){var u=n.get(t,o);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 "+o+" not found"},Symbol.for("name"),"Error")}var p={MS:void 0,fromArray:n.fromArray,empty:A,mergeKeepSecond:m,update:y,get:v,getFunction:b};function _(e){return t._1(e.evaluateNode,e)}function S(e,r,n){var u=t._2(e.evaluateNode,e,n);return t._2(o.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 o.O.toResult("Not valid shape",t._2(o.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","rescript/lib/js/belt_MapString.js":"mO07","../utility/E.bs.js":"xX5m"}],"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;l1e4?"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) { +"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("rescript/lib/js/belt_MapString.js"),u=require("./utility/E.bs.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(u.O.$$default,1e4,e.samplingInputs.sampleCount),outputXYPoints:t._2(u.O.$$default,1e4,e.samplingInputs.outputXYPoints),kernelWidth:e.samplingInputs.kernelWidth,shapeLength:t._2(u.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(u.A.R.firstErrorOrOpen,t._1(u.A.O.concatSomes,t._2(u.A.fmap,function(e){if("Expression"===e.NAME)return t._2(u.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(u.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,i){var s=E(n,i);return t._2(u.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(u.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),i=e.environment;return t._2(u.R.bind,o,function(r){return h(e,i,r)})}function k(e){return j(c({sampleCount:1e4,outputXYPoints:1e4,kernelWidth:void 0,shapeLength:1e3},e,o.some(i.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","rescript/lib/js/belt_MapString.js":"mO07","./utility/E.bs.js":"xX5m","./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; diff --git a/packages/squiggle-lang/package.json b/packages/squiggle-lang/package.json index 1ba3ed23..bc10691f 100644 --- a/packages/squiggle-lang/package.json +++ b/packages/squiggle-lang/package.json @@ -1,6 +1,6 @@ { "name": "squiggle-experimental", - "version": "0.1.8", + "version": "0.1.9", "homepage": "https://foretold-app.github.io/estiband/", "private": false, "scripts": { @@ -36,8 +36,6 @@ "moduleserve": "0.9.1", "parcel": "^2.2.1", "parcel-bundler": "1.12.4", - "parcel-plugin-bundle-visualiser": "^1.2.0", - "parcel-plugin-less-js-enabled": "1.0.2", "rescript": "^9.1.4" } } diff --git a/packages/squiggle-lang/yarn.lock b/packages/squiggle-lang/yarn.lock index 666d639b..2333c5f8 100644 --- a/packages/squiggle-lang/yarn.lock +++ b/packages/squiggle-lang/yarn.lock @@ -3267,11 +3267,6 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" - integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= - camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" @@ -3436,15 +3431,6 @@ cli-spinners@^2.5.0: resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.6.1.tgz#adc954ebe281c37a6319bfa401e6dd2488ffb70d" integrity sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g== -cliui@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" - integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== - dependencies: - string-width "^2.1.1" - strip-ansi "^4.0.0" - wrap-ansi "^2.0.0" - cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -3496,11 +3482,6 @@ coa@^2.0.2: chalk "^2.4.1" q "^1.1.2" -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= - collect-v8-coverage@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59" @@ -4079,7 +4060,7 @@ debug@^4.1.0, debug@^4.1.1: dependencies: ms "^2.1.1" -decamelize@^1.1.1, decamelize@^1.2.0: +decamelize@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= @@ -4337,11 +4318,6 @@ duplexer2@~0.1.4: dependencies: readable-stream "^2.0.2" -duplexer@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" - integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= - ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" @@ -5022,11 +4998,6 @@ gentype@^4.3.0: resolved "https://registry.yarnpkg.com/gentype/-/gentype-4.3.0.tgz#ebac3abcdde2ce2a8fc85611b11568a4cb349c8d" integrity sha512-lqkc1ZS/Iog4uslRD4De47OV54Hu61vEBsirMKxRlgHIRvm8u6RqsdKxJ7JdJdrzmtKgPNvq1He69SozzW+6dQ== -get-caller-file@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" - integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== - get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -5162,14 +5133,6 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -gzip-size@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-4.1.0.tgz#8ae096257eabe7d69c45be2b67c448124ffb517c" - integrity sha1-iuCWJX6r59acRb4rZ8RIEk/7UXw= - dependencies: - duplexer "^0.1.1" - pify "^3.0.0" - har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" @@ -5566,11 +5529,6 @@ invariant@^2.2.2, invariant@^2.2.4: dependencies: loose-envify "^1.0.0" -invert-kv@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-2.0.0.tgz#7393f5afa59ec9ff5f67a27620d11c226e3eec02" - integrity sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA== - ip-regex@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-2.1.0.tgz#fa78bf5d2e6913c911ce9f819ee5146bb6d844e9" @@ -5745,13 +5703,6 @@ is-extglob@^2.1.0, is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= - dependencies: - number-is-nan "^1.0.0" - is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" @@ -7079,13 +7030,6 @@ kleur@^3.0.3: resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" integrity sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== -lcid@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-2.0.0.tgz#6ef5d2df60e52f82eb228a4c373e8d1f397253cf" - integrity sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA== - dependencies: - invert-kv "^2.0.0" - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -7255,13 +7199,6 @@ makeerror@1.0.x: dependencies: tmpl "1.0.x" -map-age-cleaner@^0.1.1: - version "0.1.3" - resolved "https://registry.yarnpkg.com/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz#7d583a7306434c055fe474b0f45078e6e1b4b92a" - integrity sha512-bJzx6nMoP6PDLPBFmg7+xRKeFZvFboMrGlxmNj9ClvX53KrmvM5bXFXEWjbz4cz1AFn+jWJ9z/DJSz7hrs0w3w== - dependencies: - p-defer "^1.0.0" - map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" @@ -7322,15 +7259,6 @@ medium-zoom@^1.0.6: resolved "https://registry.yarnpkg.com/medium-zoom/-/medium-zoom-1.0.6.tgz#9247f21ca9313d8bbe9420aca153a410df08d027" integrity sha512-UdiUWfvz9fZMg1pzf4dcuqA0W079o0mpqbTnOz5ip4VGYX96QjmbM+OgOU/0uOzAytxC0Ny4z+VcYQnhdifimg== -mem@^4.0.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178" - integrity sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w== - dependencies: - map-age-cleaner "^0.1.1" - mimic-fn "^2.0.0" - p-is-promise "^2.0.0" - merge-source-map@1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/merge-source-map/-/merge-source-map-1.0.4.tgz#a5de46538dae84d4114cc5ea02b4772a6346701f" @@ -7430,7 +7358,7 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== -mimic-fn@^2.0.0, mimic-fn@^2.1.0: +mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== @@ -7717,11 +7645,6 @@ nullthrows@^1.1.1: resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw== -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= - nwsapi@^2.1.3, nwsapi@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" @@ -7930,20 +7853,6 @@ os-browserify@^0.3.0: resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" integrity sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc= -os-locale@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-3.1.0.tgz#a802a6ee17f24c10483ab9935719cef4ed16bf1a" - integrity sha512-Z8l3R4wYWM40/52Z+S265okfFj8Kt2cC2MKY+xNi3kFs+XGI7WXu/I309QQQYbRW4ijiZ+yxs9pqEhJh0DqW3Q== - dependencies: - execa "^1.0.0" - lcid "^2.0.0" - mem "^4.0.0" - -p-defer@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" - integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= - p-each-series@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.1.0.tgz#961c8dd3f195ea96c747e636b262b800a6b1af48" @@ -7959,11 +7868,6 @@ p-finally@^2.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== -p-is-promise@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" - integrity sha512-Y3W0wlRPK8ZMRbNq97l4M5otioeA5lm1z7bkNkxCka8HSPjR0xRWmpCmc9utiaLP9Jb1eD8BgeIxTW4AIF45Pg== - p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -8019,7 +7923,7 @@ pako@~1.0.5: resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== -parcel-bundler@1.12.4, parcel-bundler@^1.12.3: +parcel-bundler@1.12.4: version "1.12.4" resolved "https://registry.yarnpkg.com/parcel-bundler/-/parcel-bundler-1.12.4.tgz#31223f4ab4d00323a109fce28d5e46775409a9ee" integrity sha512-G+iZGGiPEXcRzw0fiRxWYCKxdt/F7l9a0xkiU4XbcVRJCSlBnioWEwJMutOCCpoQmaQtjB4RBHDGIHN85AIhLQ== @@ -8084,22 +7988,6 @@ parcel-bundler@1.12.4, parcel-bundler@^1.12.3: v8-compile-cache "^2.0.0" ws "^5.1.1" -parcel-plugin-bundle-visualiser@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/parcel-plugin-bundle-visualiser/-/parcel-plugin-bundle-visualiser-1.2.0.tgz#b24cde64233c8e8ce2561ec5d864a7543d8e719d" - integrity sha512-/O+26nsOwXbl1q6A/X9lEJWAPwZt5VauTV32omC3a/09bfUgHTogkAIYB/BqrGQm6OyuoG5FATToT3AGGk9RTA== - dependencies: - filesize "^3.6.0" - gzip-size "^4.1.0" - yargs "^11.0.0" - -parcel-plugin-less-js-enabled@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/parcel-plugin-less-js-enabled/-/parcel-plugin-less-js-enabled-1.0.2.tgz#77d74166b406e6a516106653471b2fd619564af3" - integrity sha512-FE6zQwlJpNe3qJoIwudpiLhx1Pd26M3EUtBqtRdU+6dbXAW3GwDUszOUBka6KLtpV8p2GxOfiC1aCiGrzAnvsg== - dependencies: - parcel-bundler "^1.12.3" - parcel@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/parcel/-/parcel-2.2.1.tgz#c35503cd029c5f072add22e341c8ed83915ad9e0" @@ -8283,11 +8171,6 @@ picomatch@^2.2.3: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pify@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" - integrity sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY= - pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" @@ -9332,11 +9215,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= -require-main-filename@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" - integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" @@ -9990,23 +9868,6 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -string-width@^2.0.0, string-width@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - string-width@^3.0.0, string-width@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" @@ -10089,7 +9950,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -strip-ansi@^3.0.0, strip-ansi@^3.0.1: +strip-ansi@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= @@ -10894,14 +10755,6 @@ word-wrap@~1.2.3: resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== -wrap-ansi@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" - integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= - dependencies: - string-width "^1.0.1" - strip-ansi "^3.0.1" - wrap-ansi@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" @@ -10988,11 +10841,6 @@ xxhash-wasm@^0.4.2: resolved "https://registry.yarnpkg.com/xxhash-wasm/-/xxhash-wasm-0.4.2.tgz#752398c131a4dd407b5132ba62ad372029be6f79" integrity sha512-/eyHVRJQCirEkSZ1agRSCwriMhwlyUcFkXD5TPVSLP+IPzjsqMVzZwdoczLp1SoQU0R3dxz1RpIK+4YNQbCVOA== -y18n@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" - integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= - y18n@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" @@ -11034,31 +10882,6 @@ yargs-parser@^20.2.2: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs-parser@^9.0.2: - version "9.0.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" - integrity sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc= - dependencies: - camelcase "^4.1.0" - -yargs@^11.0.0: - version "11.1.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.1.tgz#5052efe3446a4df5ed669c995886cc0f13702766" - integrity sha512-PRU7gJrJaXv3q3yQZ/+/X6KBswZiaQ+zOmdprZcouPYtQgvNU35i+68M4b1ZHLZtYFT5QObFLV+ZkmJYcwKdiw== - dependencies: - cliui "^4.0.0" - decamelize "^1.1.1" - find-up "^2.1.0" - get-caller-file "^1.0.1" - os-locale "^3.1.0" - require-directory "^2.1.1" - require-main-filename "^1.0.1" - set-blocking "^2.0.0" - string-width "^2.0.0" - which-module "^2.0.0" - y18n "^3.2.1" - yargs-parser "^9.0.2" - yargs@^14.0.0: version "14.2.3" resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414"