UNPKG

w-statistic

Version:
6 lines 202 kB
/*! * w-statistic v1.0.22 * (c) 2018-2021 yuda-lyu(semisphere) * Released under the MIT License. */ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self)["w-statistic"]={})}(this,(function(t){"use strict";var r=Object.prototype;function e(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}function n(t,r){return function(e){return t(r(e))}}var o=n(Object.keys,Object),i=Object.prototype.hasOwnProperty;function s(t){if(!e(t))return o(t);var r=[];for(var n in Object(t))i.call(t,n)&&"constructor"!=n&&r.push(n);return r}var a="object"==typeof global&&global&&global.Object===Object&&global,u="object"==typeof self&&self&&self.Object===Object&&self,l=a||u||Function("return this")(),f=l.Symbol,c=Object.prototype,h=c.hasOwnProperty,m=c.toString,g=f?f.toStringTag:void 0;var p=Object.prototype.toString;var d="[object Null]",w="[object Undefined]",v=f?f.toStringTag:void 0;function y(t){return null==t?void 0===t?w:d:v&&v in Object(t)?function(t){var r=h.call(t,g),e=t[g];try{t[g]=void 0;var n=!0}catch(t){}var o=m.call(t);return n&&(r?t[g]=e:delete t[g]),o}(t):function(t){return p.call(t)}(t)}function b(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}var M="[object AsyncFunction]",x="[object Function]",j="[object GeneratorFunction]",E="[object Proxy]";function S(t){if(!b(t))return!1;var r=y(t);return r==x||r==j||r==M||r==E}var _,A=l["__core-js_shared__"],q=(_=/[^.]+$/.exec(A&&A.keys&&A.keys.IE_PROTO||""))?"Symbol(src)_1."+_:"";var P=Function.prototype.toString;function R(t){if(null!=t){try{return P.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var k=/^\[object .+?Constructor\]$/,N=Function.prototype,I=Object.prototype,T=N.toString,O=I.hasOwnProperty,$=RegExp("^"+T.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function C(t){return!(!b(t)||(r=t,q&&q in r))&&(S(t)?$:k).test(R(t));var r}function F(t,r){var e=function(t,r){return null==t?void 0:t[r]}(t,r);return C(e)?e:void 0}var z=F(l,"DataView"),V=F(l,"Map"),D=F(l,"Promise"),L=F(l,"Set"),U=F(l,"WeakMap"),B="[object Map]",W="[object Promise]",X="[object Set]",Y="[object WeakMap]",G="[object DataView]",Q=R(z),H=R(V),J=R(D),K=R(L),Z=R(U),tt=y;(z&&tt(new z(new ArrayBuffer(1)))!=G||V&&tt(new V)!=B||D&&tt(D.resolve())!=W||L&&tt(new L)!=X||U&&tt(new U)!=Y)&&(tt=function(t){var r=y(t),e="[object Object]"==r?t.constructor:void 0,n=e?R(e):"";if(n)switch(n){case Q:return G;case H:return B;case J:return W;case K:return X;case Z:return Y}return r});var rt=tt,et=9007199254740991;function nt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=et}function ot(t){return null!=t&&nt(t.length)&&!S(t)}var it=Array.isArray;function st(t){return null!=t&&"object"==typeof t}var at="[object String]";function ut(t){return function(r){return null==r?void 0:r[t]}}var lt=ut("length"),ft=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var ct="\\ud800-\\udfff",ht="["+ct+"]",mt="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",gt="\\ud83c[\\udffb-\\udfff]",pt="[^"+ct+"]",dt="(?:\\ud83c[\\udde6-\\uddff]){2}",wt="[\\ud800-\\udbff][\\udc00-\\udfff]",vt="(?:"+mt+"|"+gt+")"+"?",yt="[\\ufe0e\\ufe0f]?",bt=yt+vt+("(?:\\u200d(?:"+[pt,dt,wt].join("|")+")"+yt+vt+")*"),Mt="(?:"+[pt+mt+"?",mt,dt,wt,ht].join("|")+")",xt=RegExp(gt+"(?="+gt+")|"+Mt+bt,"g");function jt(t){return function(t){return ft.test(t)}(t)?function(t){for(var r=xt.lastIndex=0;xt.test(t);)++r;return r}(t):lt(t)}var Et="[object Map]",St="[object Set]";function _t(t){if(null==t)return 0;if(ot(t))return"string"==typeof(r=t)||!it(r)&&st(r)&&y(r)==at?jt(t):t.length;var r,e=rt(t);return e==Et||e==St?t.size:s(t).length}function At(t,r){for(var e,n=-1,o=t.length;++n<o;){var i=r(t[n]);void 0!==i&&(e=void 0===e?i:e+i)}return e}var qt=NaN;function Pt(t){return t}function Rt(t){return function(t,r){var e=null==t?0:t.length;return e?At(t,r)/e:qt}(t,Pt)}function kt(t){return"[object Array]"===Object.prototype.toString.call(t)}function Nt(t,r){for(var e=-1,n=null==t?0:t.length,o=Array(n);++e<n;)o[e]=r(t[e],e,t);return o}function It(t,r){return t===r||t!=t&&r!=r}function Tt(t,r){for(var e=t.length;e--;)if(It(t[e][0],r))return e;return-1}var Ot=Array.prototype.splice;function $t(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}$t.prototype.clear=function(){this.__data__=[],this.size=0},$t.prototype.delete=function(t){var r=this.__data__,e=Tt(r,t);return!(e<0)&&(e==r.length-1?r.pop():Ot.call(r,e,1),--this.size,!0)},$t.prototype.get=function(t){var r=this.__data__,e=Tt(r,t);return e<0?void 0:r[e][1]},$t.prototype.has=function(t){return Tt(this.__data__,t)>-1},$t.prototype.set=function(t,r){var e=this.__data__,n=Tt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this};var Ct=F(Object,"create");var Ft=Object.prototype.hasOwnProperty;var zt=Object.prototype.hasOwnProperty;function Vt(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}function Dt(t,r){var e,n,o=t.__data__;return("string"==(n=typeof(e=r))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e)?o["string"==typeof r?"string":"hash"]:o.map}function Lt(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r<e;){var n=t[r];this.set(n[0],n[1])}}Vt.prototype.clear=function(){this.__data__=Ct?Ct(null):{},this.size=0},Vt.prototype.delete=function(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r},Vt.prototype.get=function(t){var r=this.__data__;if(Ct){var e=r[t];return"__lodash_hash_undefined__"===e?void 0:e}return Ft.call(r,t)?r[t]:void 0},Vt.prototype.has=function(t){var r=this.__data__;return Ct?void 0!==r[t]:zt.call(r,t)},Vt.prototype.set=function(t,r){var e=this.__data__;return this.size+=this.has(t)?0:1,e[t]=Ct&&void 0===r?"__lodash_hash_undefined__":r,this},Lt.prototype.clear=function(){this.size=0,this.__data__={hash:new Vt,map:new(V||$t),string:new Vt}},Lt.prototype.delete=function(t){var r=Dt(this,t).delete(t);return this.size-=r?1:0,r},Lt.prototype.get=function(t){return Dt(this,t).get(t)},Lt.prototype.has=function(t){return Dt(this,t).has(t)},Lt.prototype.set=function(t,r){var e=Dt(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this};function Ut(t){var r=this.__data__=new $t(t);this.size=r.size}Ut.prototype.clear=function(){this.__data__=new $t,this.size=0},Ut.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Ut.prototype.get=function(t){return this.__data__.get(t)},Ut.prototype.has=function(t){return this.__data__.has(t)},Ut.prototype.set=function(t,r){var e=this.__data__;if(e instanceof $t){var n=e.__data__;if(!V||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Lt(n)}return e.set(t,r),this.size=e.size,this};function Bt(t){var r=-1,e=null==t?0:t.length;for(this.__data__=new Lt;++r<e;)this.add(t[r])}function Wt(t,r){for(var e=-1,n=null==t?0:t.length;++e<n;)if(r(t[e],e,t))return!0;return!1}Bt.prototype.add=Bt.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Bt.prototype.has=function(t){return this.__data__.has(t)};var Xt=1,Yt=2;function Gt(t,r,e,n,o,i){var s=e&Xt,a=t.length,u=r.length;if(a!=u&&!(s&&u>a))return!1;var l=i.get(t),f=i.get(r);if(l&&f)return l==r&&f==t;var c=-1,h=!0,m=e&Yt?new Bt:void 0;for(i.set(t,r),i.set(r,t);++c<a;){var g=t[c],p=r[c];if(n)var d=s?n(p,g,c,r,t,i):n(g,p,c,t,r,i);if(void 0!==d){if(d)continue;h=!1;break}if(m){if(!Wt(r,(function(t,r){if(s=r,!m.has(s)&&(g===t||o(g,t,e,n,i)))return m.push(r);var s}))){h=!1;break}}else if(g!==p&&!o(g,p,e,n,i)){h=!1;break}}return i.delete(t),i.delete(r),h}var Qt=l.Uint8Array;function Ht(t){var r=-1,e=Array(t.size);return t.forEach((function(t,n){e[++r]=[n,t]})),e}function Jt(t){var r=-1,e=Array(t.size);return t.forEach((function(t){e[++r]=t})),e}var Kt=1,Zt=2,tr="[object Boolean]",rr="[object Date]",er="[object Error]",nr="[object Map]",or="[object Number]",ir="[object RegExp]",sr="[object Set]",ar="[object String]",ur="[object Symbol]",lr="[object ArrayBuffer]",fr="[object DataView]",cr=f?f.prototype:void 0,hr=cr?cr.valueOf:void 0;function mr(t,r){for(var e=-1,n=r.length,o=t.length;++e<n;)t[o+e]=r[e];return t}function gr(t,r,e){var n=r(t);return it(t)?n:mr(n,e(t))}function pr(t,r){for(var e=-1,n=null==t?0:t.length,o=0,i=[];++e<n;){var s=t[e];r(s,e,t)&&(i[o++]=s)}return i}function dr(){return[]}var wr=Object.prototype.propertyIsEnumerable,vr=Object.getOwnPropertySymbols,yr=vr?function(t){return null==t?[]:(t=Object(t),pr(vr(t),(function(r){return wr.call(t,r)})))}:dr;function br(t,r){for(var e=-1,n=Array(t);++e<t;)n[e]=r(e);return n}function Mr(t){return st(t)&&"[object Arguments]"==y(t)}var xr=Object.prototype,jr=xr.hasOwnProperty,Er=xr.propertyIsEnumerable,Sr=Mr(function(){return arguments}())?Mr:function(t){return st(t)&&jr.call(t,"callee")&&!Er.call(t,"callee")},_r=Sr;var Ar="object"==typeof t&&t&&!t.nodeType&&t,qr=Ar&&"object"==typeof module&&module&&!module.nodeType&&module,Pr=qr&&qr.exports===Ar?l.Buffer:void 0,Rr=(Pr?Pr.isBuffer:void 0)||function(){return!1},kr=9007199254740991,Nr=/^(?:0|[1-9]\d*)$/;function Ir(t,r){var e=typeof t;return!!(r=null==r?kr:r)&&("number"==e||"symbol"!=e&&Nr.test(t))&&t>-1&&t%1==0&&t<r}var Tr={};function Or(t){return function(r){return t(r)}}Tr["[object Float32Array]"]=Tr["[object Float64Array]"]=Tr["[object Int8Array]"]=Tr["[object Int16Array]"]=Tr["[object Int32Array]"]=Tr["[object Uint8Array]"]=Tr["[object Uint8ClampedArray]"]=Tr["[object Uint16Array]"]=Tr["[object Uint32Array]"]=!0,Tr["[object Arguments]"]=Tr["[object Array]"]=Tr["[object ArrayBuffer]"]=Tr["[object Boolean]"]=Tr["[object DataView]"]=Tr["[object Date]"]=Tr["[object Error]"]=Tr["[object Function]"]=Tr["[object Map]"]=Tr["[object Number]"]=Tr["[object Object]"]=Tr["[object RegExp]"]=Tr["[object Set]"]=Tr["[object String]"]=Tr["[object WeakMap]"]=!1;var $r="object"==typeof t&&t&&!t.nodeType&&t,Cr=$r&&"object"==typeof module&&module&&!module.nodeType&&module,Fr=Cr&&Cr.exports===$r&&a.process,zr=function(){try{var t=Cr&&Cr.require&&Cr.require("util").types;return t||Fr&&Fr.binding&&Fr.binding("util")}catch(t){}}(),Vr=zr&&zr.isTypedArray,Dr=Vr?Or(Vr):function(t){return st(t)&&nt(t.length)&&!!Tr[y(t)]},Lr=Object.prototype.hasOwnProperty;function Ur(t,r){var e=it(t),n=!e&&_r(t),o=!e&&!n&&Rr(t),i=!e&&!n&&!o&&Dr(t),s=e||n||o||i,a=s?br(t.length,String):[],u=a.length;for(var l in t)!r&&!Lr.call(t,l)||s&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Ir(l,u))||a.push(l);return a}function Br(t){return ot(t)?Ur(t):s(t)}function Wr(t){return gr(t,Br,yr)}var Xr=1,Yr=Object.prototype.hasOwnProperty;var Gr=1,Qr="[object Arguments]",Hr="[object Array]",Jr="[object Object]",Kr=Object.prototype.hasOwnProperty;function Zr(t,r,e,n,o,i){var s=it(t),a=it(r),u=s?Hr:rt(t),l=a?Hr:rt(r),f=(u=u==Qr?Jr:u)==Jr,c=(l=l==Qr?Jr:l)==Jr,h=u==l;if(h&&Rr(t)){if(!Rr(r))return!1;s=!0,f=!1}if(h&&!f)return i||(i=new Ut),s||Dr(t)?Gt(t,r,e,n,o,i):function(t,r,e,n,o,i,s){switch(e){case fr:if(t.byteLength!=r.byteLength||t.byteOffset!=r.byteOffset)return!1;t=t.buffer,r=r.buffer;case lr:return!(t.byteLength!=r.byteLength||!i(new Qt(t),new Qt(r)));case tr:case rr:case or:return It(+t,+r);case er:return t.name==r.name&&t.message==r.message;case ir:case ar:return t==r+"";case nr:var a=Ht;case sr:var u=n&Kt;if(a||(a=Jt),t.size!=r.size&&!u)return!1;var l=s.get(t);if(l)return l==r;n|=Zt,s.set(t,r);var f=Gt(a(t),a(r),n,o,i,s);return s.delete(t),f;case ur:if(hr)return hr.call(t)==hr.call(r)}return!1}(t,r,u,e,n,o,i);if(!(e&Gr)){var m=f&&Kr.call(t,"__wrapped__"),g=c&&Kr.call(r,"__wrapped__");if(m||g){var p=m?t.value():t,d=g?r.value():r;return i||(i=new Ut),o(p,d,e,n,i)}}return!!h&&(i||(i=new Ut),function(t,r,e,n,o,i){var s=e&Xr,a=Wr(t),u=a.length;if(u!=Wr(r).length&&!s)return!1;for(var l=u;l--;){var f=a[l];if(!(s?f in r:Yr.call(r,f)))return!1}var c=i.get(t),h=i.get(r);if(c&&h)return c==r&&h==t;var m=!0;i.set(t,r),i.set(r,t);for(var g=s;++l<u;){var p=t[f=a[l]],d=r[f];if(n)var w=s?n(d,p,f,r,t,i):n(p,d,f,t,r,i);if(!(void 0===w?p===d||o(p,d,e,n,i):w)){m=!1;break}g||(g="constructor"==f)}if(m&&!g){var v=t.constructor,y=r.constructor;v==y||!("constructor"in t)||!("constructor"in r)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(m=!1)}return i.delete(t),i.delete(r),m}(t,r,e,n,o,i))}function te(t,r,e,n,o){return t===r||(null==t||null==r||!st(t)&&!st(r)?t!=t&&r!=r:Zr(t,r,e,n,te,o))}var re=1,ee=2;function ne(t){return t==t&&!b(t)}function oe(t,r){return function(e){return null!=e&&(e[t]===r&&(void 0!==r||t in Object(e)))}}function ie(t){var r=function(t){for(var r=Br(t),e=r.length;e--;){var n=r[e],o=t[n];r[e]=[n,o,ne(o)]}return r}(t);return 1==r.length&&r[0][2]?oe(r[0][0],r[0][1]):function(e){return e===t||function(t,r,e,n){var o=e.length,i=o,s=!n;if(null==t)return!i;for(t=Object(t);o--;){var a=e[o];if(s&&a[2]?a[1]!==t[a[0]]:!(a[0]in t))return!1}for(;++o<i;){var u=(a=e[o])[0],l=t[u],f=a[1];if(s&&a[2]){if(void 0===l&&!(u in t))return!1}else{var c=new Ut;if(n)var h=n(l,f,u,t,r,c);if(!(void 0===h?te(f,l,re|ee,n,c):h))return!1}}return!0}(e,t,r)}}var se="[object Symbol]";function ae(t){return"symbol"==typeof t||st(t)&&y(t)==se}var ue=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,le=/^\w*$/;function fe(t,r){if(it(t))return!1;var e=typeof t;return!("number"!=e&&"symbol"!=e&&"boolean"!=e&&null!=t&&!ae(t))||(le.test(t)||!ue.test(t)||null!=r&&t in Object(r))}var ce="Expected a function";function he(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError(ce);var e=function(){var n=arguments,o=r?r.apply(this,n):n[0],i=e.cache;if(i.has(o))return i.get(o);var s=t.apply(this,n);return e.cache=i.set(o,s)||i,s};return e.cache=new(he.Cache||Lt),e}he.Cache=Lt;var me,ge,pe,de=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,we=/\\(\\)?/g,ve=(me=function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(de,(function(t,e,n,o){r.push(n?o.replace(we,"$1"):e||t)})),r},ge=he(me,(function(t){return 500===pe.size&&pe.clear(),t})),pe=ge.cache,ge),ye=ve,be=1/0,Me=f?f.prototype:void 0,xe=Me?Me.toString:void 0;function je(t){if("string"==typeof t)return t;if(it(t))return Nt(t,je)+"";if(ae(t))return xe?xe.call(t):"";var r=t+"";return"0"==r&&1/t==-be?"-0":r}function Ee(t){return null==t?"":je(t)}function Se(t,r){return it(t)?t:fe(t,r)?[t]:ye(Ee(t))}var _e=1/0;function Ae(t){if("string"==typeof t||ae(t))return t;var r=t+"";return"0"==r&&1/t==-_e?"-0":r}function qe(t,r){for(var e=0,n=(r=Se(r,t)).length;null!=t&&e<n;)t=t[Ae(r[e++])];return e&&e==n?t:void 0}function Pe(t,r,e){var n=null==t?void 0:qe(t,r);return void 0===n?e:n}function Re(t,r){return null!=t&&r in Object(t)}function ke(t,r){return null!=t&&function(t,r,e){for(var n=-1,o=(r=Se(r,t)).length,i=!1;++n<o;){var s=Ae(r[n]);if(!(i=null!=t&&e(t,s)))break;t=t[s]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&nt(o)&&Ir(s,o)&&(it(t)||_r(t))}(t,r,Re)}var Ne=1,Ie=2;function Te(t){return fe(t)?ut(Ae(t)):function(t){return function(r){return qe(r,t)}}(t)}function Oe(t){return"function"==typeof t?t:null==t?Pt:"object"==typeof t?it(t)?(r=t[0],e=t[1],fe(r)&&ne(e)?oe(Ae(r),e):function(t){var n=Pe(t,r);return void 0===n&&n===e?ke(t,r):te(e,n,Ne|Ie)}):ie(t):Te(t);var r,e}var $e,Ce=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),s=i.length;s--;){var a=i[$e?s:++n];if(!1===r(o[a],a,o))break}return t};var Fe=function(t,r){return function(e,n){if(null==e)return e;if(!ot(e))return t(e,n);for(var o=e.length,i=r?o:-1,s=Object(e);(r?i--:++i<o)&&!1!==n(s[i],i,s););return e}}((function(t,r){return t&&Ce(t,r,Br)})),ze=Fe;function Ve(t,r){var e=-1,n=ot(t)?Array(t.length):[];return ze(t,(function(t,o,i){n[++e]=r(t,o,i)})),n}function De(t,r){return(it(t)?Nt:Ve)(t,Oe(r))}function Le(t,r){var e=[];return ze(t,(function(t,n,o){r(t,n,o)&&e.push(t)})),e}function Ue(t,r){return(it(t)?pr:Le)(t,Oe(r))}function Be(t,r){for(var e=-1,n=null==t?0:t.length;++e<n&&!1!==r(t[e],e,t););return t}var We=function(){try{var t=F(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Xe=We;function Ye(t,r,e){"__proto__"==r&&Xe?Xe(t,r,{configurable:!0,enumerable:!0,value:e,writable:!0}):t[r]=e}var Ge=Object.prototype.hasOwnProperty;function Qe(t,r,e){var n=t[r];Ge.call(t,r)&&It(n,e)&&(void 0!==e||r in t)||Ye(t,r,e)}function He(t,r,e,n){var o=!e;e||(e={});for(var i=-1,s=r.length;++i<s;){var a=r[i],u=n?n(e[a],t[a],a,e,t):void 0;void 0===u&&(u=t[a]),o?Ye(e,a,u):Qe(e,a,u)}return e}var Je=Object.prototype.hasOwnProperty;function Ke(t){if(!b(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=e(t),n=[];for(var o in t)("constructor"!=o||!r&&Je.call(t,o))&&n.push(o);return n}function Ze(t){return ot(t)?Ur(t,!0):Ke(t)}var tn="object"==typeof t&&t&&!t.nodeType&&t,rn=tn&&"object"==typeof module&&module&&!module.nodeType&&module,en=rn&&rn.exports===tn?l.Buffer:void 0,nn=en?en.allocUnsafe:void 0;var on=n(Object.getPrototypeOf,Object),sn=Object.getOwnPropertySymbols?function(t){for(var r=[];t;)mr(r,yr(t)),t=on(t);return r}:dr,an=sn;function un(t){return gr(t,Ze,an)}var ln=Object.prototype.hasOwnProperty;function fn(t){var r=new t.constructor(t.byteLength);return new Qt(r).set(new Qt(t)),r}var cn=/\w*$/;var hn=f?f.prototype:void 0,mn=hn?hn.valueOf:void 0;var gn="[object Boolean]",pn="[object Date]",dn="[object Map]",wn="[object Number]",vn="[object RegExp]",yn="[object Set]",bn="[object String]",Mn="[object Symbol]",xn="[object ArrayBuffer]",jn="[object DataView]",En="[object Float32Array]",Sn="[object Float64Array]",_n="[object Int8Array]",An="[object Int16Array]",qn="[object Int32Array]",Pn="[object Uint8Array]",Rn="[object Uint8ClampedArray]",kn="[object Uint16Array]",Nn="[object Uint32Array]";function In(t,r,e){var n,o=t.constructor;switch(r){case xn:return fn(t);case gn:case pn:return new o(+t);case jn:return function(t,r){var e=r?fn(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)}(t,e);case En:case Sn:case _n:case An:case qn:case Pn:case Rn:case kn:case Nn:return function(t,r){var e=r?fn(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)}(t,e);case dn:return new o;case wn:case bn:return new o(t);case vn:return function(t){var r=new t.constructor(t.source,cn.exec(t));return r.lastIndex=t.lastIndex,r}(t);case yn:return new o;case Mn:return n=t,mn?Object(mn.call(n)):{}}}var Tn=Object.create,On=function(){function t(){}return function(r){if(!b(r))return{};if(Tn)return Tn(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}(),$n=On;var Cn=zr&&zr.isMap,Fn=Cn?Or(Cn):function(t){return st(t)&&"[object Map]"==rt(t)};var zn=zr&&zr.isSet,Vn=zn?Or(zn):function(t){return st(t)&&"[object Set]"==rt(t)},Dn=1,Ln=2,Un=4,Bn="[object Arguments]",Wn="[object Function]",Xn="[object GeneratorFunction]",Yn="[object Object]",Gn={};function Qn(t,r,n,o,i,s){var a,u=r&Dn,l=r&Ln,f=r&Un;if(n&&(a=i?n(t,o,i,s):n(t)),void 0!==a)return a;if(!b(t))return t;var c=it(t);if(c){if(a=function(t){var r=t.length,e=new t.constructor(r);return r&&"string"==typeof t[0]&&ln.call(t,"index")&&(e.index=t.index,e.input=t.input),e}(t),!u)return function(t,r){var e=-1,n=t.length;for(r||(r=Array(n));++e<n;)r[e]=t[e];return r}(t,a)}else{var h=rt(t),m=h==Wn||h==Xn;if(Rr(t))return function(t,r){if(r)return t.slice();var e=t.length,n=nn?nn(e):new t.constructor(e);return t.copy(n),n}(t,u);if(h==Yn||h==Bn||m&&!i){if(a=l||m?{}:function(t){return"function"!=typeof t.constructor||e(t)?{}:$n(on(t))}(t),!u)return l?function(t,r){return He(t,an(t),r)}(t,function(t,r){return t&&He(r,Ze(r),t)}(a,t)):function(t,r){return He(t,yr(t),r)}(t,function(t,r){return t&&He(r,Br(r),t)}(a,t))}else{if(!Gn[h])return i?t:{};a=In(t,h,u)}}s||(s=new Ut);var g=s.get(t);if(g)return g;s.set(t,a),Vn(t)?t.forEach((function(e){a.add(Qn(e,r,n,e,t,s))})):Fn(t)&&t.forEach((function(e,o){a.set(o,Qn(e,r,n,o,t,s))}));var p=c?void 0:(f?l?un:Wr:l?Ze:Br)(t);return Be(p||t,(function(e,o){p&&(e=t[o=e]),Qe(a,o,Qn(e,r,n,o,t,s))})),a}Gn[Bn]=Gn["[object Array]"]=Gn["[object ArrayBuffer]"]=Gn["[object DataView]"]=Gn["[object Boolean]"]=Gn["[object Date]"]=Gn["[object Float32Array]"]=Gn["[object Float64Array]"]=Gn["[object Int8Array]"]=Gn["[object Int16Array]"]=Gn["[object Int32Array]"]=Gn["[object Map]"]=Gn["[object Number]"]=Gn[Yn]=Gn["[object RegExp]"]=Gn["[object Set]"]=Gn["[object String]"]=Gn["[object Symbol]"]=Gn["[object Uint8Array]"]=Gn["[object Uint8ClampedArray]"]=Gn["[object Uint16Array]"]=Gn["[object Uint32Array]"]=!0,Gn["[object Error]"]=Gn[Wn]=Gn["[object WeakMap]"]=!1;var Hn=1,Jn=4;function Kn(t){return Qn(t,Hn|Jn)}function Zn(t){return"[object Object]"===Object.prototype.toString.call(t)}function to(t){return"[object String]"===Object.prototype.toString.call(t)}function ro(t){return t!=t}function eo(t){return!!function(t){return"[object Undefined]"===Object.prototype.toString.call(t)}(t)||(!!function(t){return"[object Null]"===Object.prototype.toString.call(t)}(t)||(!!function(t){if(Zn(t)){for(let r in t)return!1;return!0}return!1}(t)||(!!function(t){return!(!to(t)||""!==t)}(t)||(!!function(t){return!!kt(t)&&0===t.length}(t)||!!ro(t)))))}function no(t){return!!kt(t)&&(0!==t.length&&(1!==t.length||!eo(t[0])))}function oo(t){return!(!to(t)||""===t)}function io(t){let r=!1;if(oo(t))r=!isNaN(Number(t));else if(function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)){if(ro(t))return!1;r=!0}return r}var so=/\s/;var ao=/^\s+/;function uo(t){return t?t.slice(0,function(t){for(var r=t.length;r--&&so.test(t.charAt(r)););return r}(t)+1).replace(ao,""):t}var lo=NaN,fo=/^[-+]0x[0-9a-f]+$/i,co=/^0b[01]+$/i,ho=/^0o[0-7]+$/i,mo=parseInt;function go(t){if("number"==typeof t)return t;if(ae(t))return lo;if(b(t)){var r="function"==typeof t.valueOf?t.valueOf():t;t=b(r)?r+"":r}if("string"!=typeof t)return 0===t?t:+t;t=uo(t);var e=co.test(t);return e||ho.test(t)?mo(t.slice(2),e?2:8):fo.test(t)?lo:+t}var po=1/0,wo=17976931348623157e292;function vo(t){return t?(t=go(t))===po||t===-po?(t<0?-1:1)*wo:t==t?t:0:0===t?t:0}function yo(t){if(!io(t))return 0;return vo(t)}function bo(t){return no(t)?t=De(t=Ue(t=Kn(t),io),yo):[]}function Mo(t){if(!kt(t))return null;if(0===_t(t))return null;let r=bo(t);return 0===_t(r)?null:Rt(r)}function xo(t){if(!io(t))return!1;return yo(t)>0}function jo(t){return no(t)?t=De(t=Ue(t=Kn(t),xo),yo):[]}function Eo(t){return no(t)?t=De(t=jo(t),Math.log):[]}var So="[object Number]";function _o(t){return"number"==typeof t||st(t)&&y(t)==So}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;function Ao(t){if(t.__esModule)return t;var r=t.default;if("function"==typeof r){var e=function t(){if(this instanceof t){var e=[null];return e.push.apply(e,arguments),new(Function.bind.apply(r,e))}return r.apply(this,arguments)};e.prototype=r.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach((function(r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})})),e}var qo={};!function(t,r){t.exports=function(){var t=function(t,r){var e=Array.prototype.concat,n=Array.prototype.slice,o=Object.prototype.toString;function i(r,e){var n=r>e?r:e;return t.pow(10,17-~~(t.log(n>0?n:-n)*t.LOG10E))}var s=Array.isArray||function(t){return"[object Array]"===o.call(t)};function a(t){return"[object Function]"===o.call(t)}function u(t){return"number"==typeof t&&t-t==0}function l(t){return e.apply([],t)}function f(){return new f._init(arguments)}function c(){return 0}function h(){return 1}function m(t,r){return t===r?1:0}f.fn=f.prototype,f._init=function(t){if(s(t[0]))if(s(t[0][0])){a(t[1])&&(t[0]=f.map(t[0],t[1]));for(var r=0;r<t[0].length;r++)this[r]=t[0][r];this.length=t[0].length}else this[0]=a(t[1])?f.map(t[0],t[1]):t[0],this.length=1;else if(u(t[0]))this[0]=f.seq.apply(null,t),this.length=1;else{if(t[0]instanceof f)return f(t[0].toArray());this[0]=[],this.length=1}return this},f._init.prototype=f.prototype,f._init.constructor=f,f.utils={calcRdx:i,isArray:s,isFunction:a,isNumber:u,toVector:l},f._random_fn=t.random,f.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");f._random_fn=t},f.extend=function(t){var r,e;if(1===arguments.length){for(e in t)f[e]=t[e];return this}for(r=1;r<arguments.length;r++)for(e in arguments[r])t[e]=arguments[r][e];return t},f.rows=function(t){return t.length||1},f.cols=function(t){return t[0].length||1},f.dimensions=function(t){return{rows:f.rows(t),cols:f.cols(t)}},f.row=function(t,r){return s(r)?r.map((function(r){return f.row(t,r)})):t[r]},f.rowa=function(t,r){return f.row(t,r)},f.col=function(t,r){if(s(r)){var e=f.arange(t.length).map((function(){return new Array(r.length)}));return r.forEach((function(r,n){f.arange(t.length).forEach((function(o){e[o][n]=t[o][r]}))})),e}for(var n=new Array(t.length),o=0;o<t.length;o++)n[o]=[t[o][r]];return n},f.cola=function(t,r){return f.col(t,r).map((function(t){return t[0]}))},f.diag=function(t){for(var r=f.rows(t),e=new Array(r),n=0;n<r;n++)e[n]=[t[n][n]];return e},f.antidiag=function(t){for(var r=f.rows(t)-1,e=new Array(r),n=0;r>=0;r--,n++)e[n]=[t[n][r]];return e},f.transpose=function(t){var r,e,n,o,i,a=[];for(s(t[0])||(t=[t]),e=t.length,n=t[0].length,i=0;i<n;i++){for(r=new Array(e),o=0;o<e;o++)r[o]=t[o][i];a.push(r)}return 1===a.length?a[0]:a},f.map=function(t,r,e){var n,o,i,a,u;for(s(t[0])||(t=[t]),o=t.length,i=t[0].length,a=e?t:new Array(o),n=0;n<o;n++)for(a[n]||(a[n]=new Array(i)),u=0;u<i;u++)a[n][u]=r(t[n][u],n,u);return 1===a.length?a[0]:a},f.cumreduce=function(t,r,e){var n,o,i,a,u;for(s(t[0])||(t=[t]),o=t.length,i=t[0].length,a=e?t:new Array(o),n=0;n<o;n++)for(a[n]||(a[n]=new Array(i)),i>0&&(a[n][0]=t[n][0]),u=1;u<i;u++)a[n][u]=r(a[n][u-1],t[n][u]);return 1===a.length?a[0]:a},f.alter=function(t,r){return f.map(t,r,!0)},f.create=function(t,r,e){var n,o,i=new Array(t);for(a(r)&&(e=r,r=t),n=0;n<t;n++)for(i[n]=new Array(r),o=0;o<r;o++)i[n][o]=e(n,o);return i},f.zeros=function(t,r){return u(r)||(r=t),f.create(t,r,c)},f.ones=function(t,r){return u(r)||(r=t),f.create(t,r,h)},f.rand=function(t,r){return u(r)||(r=t),f.create(t,r,f._random_fn)},f.identity=function(t,r){return u(r)||(r=t),f.create(t,r,m)},f.symmetric=function(t){var r,e,n=t.length;if(t.length!==t[0].length)return!1;for(r=0;r<n;r++)for(e=0;e<n;e++)if(t[e][r]!==t[r][e])return!1;return!0},f.clear=function(t){return f.alter(t,c)},f.seq=function(t,r,e,n){a(n)||(n=!1);var o,s=[],u=i(t,r),l=(r*u-t*u)/((e-1)*u),f=t;for(o=0;f<=r&&o<e;f=(t*u+l*u*++o)/u)s.push(n?n(f,o):f);return s},f.arange=function(t,e,n){var o,i=[];if(n=n||1,e===r&&(e=t,t=0),t===e||0===n)return[];if(t<e&&n<0)return[];if(t>e&&n>0)return[];if(n>0)for(o=t;o<e;o+=n)i.push(o);else for(o=t;o>e;o+=n)i.push(o);return i},f.slice=function(){function t(t,e,n,o){var i,s=[],a=t.length;if(e===r&&n===r&&o===r)return f.copy(t);if(o=o||1,(e=(e=e||0)>=0?e:a+e)===(n=(n=n||t.length)>=0?n:a+n)||0===o)return[];if(e<n&&o<0)return[];if(e>n&&o>0)return[];if(o>0)for(i=e;i<n;i+=o)s.push(t[i]);else for(i=e;i>n;i+=o)s.push(t[i]);return s}function e(r,e){var n,o;return u((e=e||{}).row)?u(e.col)?r[e.row][e.col]:t(f.rowa(r,e.row),(n=e.col||{}).start,n.end,n.step):u(e.col)?t(f.cola(r,e.col),(o=e.row||{}).start,o.end,o.step):(o=e.row||{},n=e.col||{},t(r,o.start,o.end,o.step).map((function(r){return t(r,n.start,n.end,n.step)})))}return e}(),f.sliceAssign=function(e,n,o){var i,s;if(u(n.row)){if(u(n.col))return e[n.row][n.col]=o;n.col=n.col||{},n.col.start=n.col.start||0,n.col.end=n.col.end||e[0].length,n.col.step=n.col.step||1,i=f.arange(n.col.start,t.min(e.length,n.col.end),n.col.step);var a=n.row;return i.forEach((function(t,r){e[a][t]=o[r]})),e}if(u(n.col)){n.row=n.row||{},n.row.start=n.row.start||0,n.row.end=n.row.end||e.length,n.row.step=n.row.step||1,s=f.arange(n.row.start,t.min(e[0].length,n.row.end),n.row.step);var l=n.col;return s.forEach((function(t,r){e[t][l]=o[r]})),e}return o[0].length===r&&(o=[o]),n.row.start=n.row.start||0,n.row.end=n.row.end||e.length,n.row.step=n.row.step||1,n.col.start=n.col.start||0,n.col.end=n.col.end||e[0].length,n.col.step=n.col.step||1,s=f.arange(n.row.start,t.min(e.length,n.row.end),n.row.step),i=f.arange(n.col.start,t.min(e[0].length,n.col.end),n.col.step),s.forEach((function(t,r){i.forEach((function(n,i){e[t][n]=o[r][i]}))})),e},f.diagonal=function(t){var r=f.zeros(t.length,t.length);return t.forEach((function(t,e){r[e][e]=t})),r},f.copy=function(t){return t.map((function(t){return u(t)?t:t.map((function(t){return t}))}))};var g=f.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?n.call(this):n.call(this)[0]},g.map=function(t,r){return f(f.map(this,t,r))},g.cumreduce=function(t,r){return f(f.cumreduce(this,t,r))},g.alter=function(t){return f.alter(this,t),this},function(t){for(var r=0;r<t.length;r++)!function(t){g[t]=function(r){var e,n=this;return r?(setTimeout((function(){r.call(n,g[t].call(n))})),this):(e=f[t](this),s(e)?f(e):e)}}(t[r])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var r=0;r<t.length;r++)!function(t){g[t]=function(r,e){var n=this;return e?(setTimeout((function(){e.call(n,g[t].call(n,r))})),this):f(f[t](this,r))}}(t[r])}("row col".split(" ")),function(t){for(var r=0;r<t.length;r++)!function(t){g[t]=function(){return f(f[t].apply(null,arguments))}}(t[r])}("create zeros ones rand identity".split(" ")),f}(Math);return function(t,r){var e=t.utils.isFunction;function n(t,r){return t-r}function o(t,e,n){return r.max(e,r.min(t,n))}t.sum=function(t){for(var r=0,e=t.length;--e>=0;)r+=t[e];return r},t.sumsqrd=function(t){for(var r=0,e=t.length;--e>=0;)r+=t[e]*t[e];return r},t.sumsqerr=function(r){for(var e,n=t.mean(r),o=0,i=r.length;--i>=0;)o+=(e=r[i]-n)*e;return o},t.sumrow=function(t){for(var r=0,e=t.length;--e>=0;)r+=t[e];return r},t.product=function(t){for(var r=1,e=t.length;--e>=0;)r*=t[e];return r},t.min=function(t){for(var r=t[0],e=0;++e<t.length;)t[e]<r&&(r=t[e]);return r},t.max=function(t){for(var r=t[0],e=0;++e<t.length;)t[e]>r&&(r=t[e]);return r},t.unique=function(t){for(var r={},e=[],n=0;n<t.length;n++)r[t[n]]||(r[t[n]]=!0,e.push(t[n]));return e},t.mean=function(r){return t.sum(r)/r.length},t.meansqerr=function(r){return t.sumsqerr(r)/r.length},t.geomean=function(e){var n=e.map(r.log),o=t.mean(n);return r.exp(o)},t.median=function(t){var r=t.length,e=t.slice().sort(n);return 1&r?e[r/2|0]:(e[r/2-1]+e[r/2])/2},t.cumsum=function(r){return t.cumreduce(r,(function(t,r){return t+r}))},t.cumprod=function(r){return t.cumreduce(r,(function(t,r){return t*r}))},t.diff=function(t){var r,e=[],n=t.length;for(r=1;r<n;r++)e.push(t[r]-t[r-1]);return e},t.rank=function(t){var r,e=[],o={};for(r=0;r<t.length;r++)o[u=t[r]]?o[u]++:(o[u]=1,e.push(u));var i=e.sort(n),s={},a=1;for(r=0;r<i.length;r++){var u,l=o[u=i[r]],f=(a+(a+l-1))/2;s[u]=f,a+=l}return t.map((function(t){return s[t]}))},t.mode=function(t){var r,e=t.length,o=t.slice().sort(n),i=1,s=0,a=0,u=[];for(r=0;r<e;r++)o[r]===o[r+1]?i++:(i>s?(u=[o[r]],s=i,a=0):i===s&&(u.push(o[r]),a++),i=1);return 0===a?u[0]:u},t.range=function(r){return t.max(r)-t.min(r)},t.variance=function(r,e){return t.sumsqerr(r)/(r.length-(e?1:0))},t.pooledvariance=function(r){return r.reduce((function(r,e){return r+t.sumsqerr(e)}),0)/(r.reduce((function(t,r){return t+r.length}),0)-r.length)},t.deviation=function(r){for(var e=t.mean(r),n=r.length,o=new Array(n),i=0;i<n;i++)o[i]=r[i]-e;return o},t.stdev=function(e,n){return r.sqrt(t.variance(e,n))},t.pooledstdev=function(e){return r.sqrt(t.pooledvariance(e))},t.meandev=function(e){for(var n=t.mean(e),o=[],i=e.length-1;i>=0;i--)o.push(r.abs(e[i]-n));return t.mean(o)},t.meddev=function(e){for(var n=t.median(e),o=[],i=e.length-1;i>=0;i--)o.push(r.abs(e[i]-n));return t.median(o)},t.coeffvar=function(r){return t.stdev(r)/t.mean(r)},t.quartiles=function(t){var e=t.length,o=t.slice().sort(n);return[o[r.round(e/4)-1],o[r.round(e/2)-1],o[r.round(3*e/4)-1]]},t.quantiles=function(t,e,i,s){var a,u,l,f,c,h=t.slice().sort(n),m=[e.length],g=t.length;for(void 0===i&&(i=3/8),void 0===s&&(s=3/8),a=0;a<e.length;a++)l=g*(u=e[a])+(i+u*(1-i-s)),f=r.floor(o(l,1,g-1)),c=o(l-f,0,1),m[a]=(1-c)*h[f-1]+c*h[f];return m},t.percentile=function(t,r,e){var o=t.slice().sort(n),i=r*(o.length+(e?1:-1))+(e?0:1),s=parseInt(i),a=i-s;return s+1<o.length?o[s-1]+a*(o[s]-o[s-1]):o[s-1]},t.percentileOfScore=function(t,r,e){var n,o,i=0,s=t.length,a=!1;for("strict"===e&&(a=!0),o=0;o<s;o++)n=t[o],(a&&n<r||!a&&n<=r)&&i++;return i/s},t.histogram=function(e,n){n=n||4;var o,i=t.min(e),s=(t.max(e)-i)/n,a=e.length,u=[];for(o=0;o<n;o++)u[o]=0;for(o=0;o<a;o++)u[r.min(r.floor((e[o]-i)/s),n-1)]+=1;return u},t.covariance=function(r,e){var n,o=t.mean(r),i=t.mean(e),s=r.length,a=new Array(s);for(n=0;n<s;n++)a[n]=(r[n]-o)*(e[n]-i);return t.sum(a)/(s-1)},t.corrcoeff=function(r,e){return t.covariance(r,e)/t.stdev(r,1)/t.stdev(e,1)},t.spearmancoeff=function(r,e){return r=t.rank(r),e=t.rank(e),t.corrcoeff(r,e)},t.stanMoment=function(e,n){for(var o=t.mean(e),i=t.stdev(e),s=e.length,a=0,u=0;u<s;u++)a+=r.pow((e[u]-o)/i,n);return a/e.length},t.skewness=function(r){return t.stanMoment(r,3)},t.kurtosis=function(r){return t.stanMoment(r,4)-3};var i=t.prototype;!function(r){for(var n=0;n<r.length;n++)!function(r){i[r]=function(n,o){var s=[],a=0,u=this;if(e(n)&&(o=n,n=!1),o)return setTimeout((function(){o.call(u,i[r].call(u,n))})),this;if(this.length>1){for(u=!0===n?this:this.transpose();a<u.length;a++)s[a]=t[r](u[a]);return s}return t[r](this[0],n)}}(r[n])}("cumsum cumprod".split(" ")),function(r){for(var n=0;n<r.length;n++)!function(r){i[r]=function(n,o){var s=[],a=0,u=this;if(e(n)&&(o=n,n=!1),o)return setTimeout((function(){o.call(u,i[r].call(u,n))})),this;if(this.length>1){for("sumrow"!==r&&(u=!0===n?this:this.transpose());a<u.length;a++)s[a]=t[r](u[a]);return!0===n?t[r](t.utils.toVector(s)):s}return t[r](this[0],n)}}(r[n])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(r){for(var n=0;n<r.length;n++)!function(r){i[r]=function(){var n,o=[],s=0,a=this,u=Array.prototype.slice.call(arguments);if(e(u[u.length-1])){n=u[u.length-1];var l=u.slice(0,u.length-1);return setTimeout((function(){n.call(a,i[r].apply(a,l))})),this}n=void 0;var f=function(e){return t[r].apply(a,[e].concat(u))};if(this.length>1){for(a=a.transpose();s<a.length;s++)o[s]=f(a[s]);return o}return f(this[0])}}(r[n])}("quantiles percentileOfScore".split(" "))}(t,Math),function(t,r){t.gammaln=function(t){var e,n,o,i=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(o=(n=e=t)+5.5,o-=(e+.5)*r.log(o);i<6;i++)a+=s[i]/++n;return r.log(2.5066282746310007*a/e)-o},t.loggam=function(t){var e,n,o,i,s,a,u,l=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(e=t,u=0,1==t||2==t)return 0;for(t<=7&&(e=t+(u=r.floor(7-t))),n=1/(e*e),o=2*r.PI,s=l[9],a=8;a>=0;a--)s*=n,s+=l[a];if(i=s/e+.5*r.log(o)+(e-.5)*r.log(e)-e,t<=7)for(a=1;a<=u;a++)i-=r.log(e-1),e-=1;return i},t.gammafn=function(t){var e,n,o,i,s=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],u=!1,l=0,f=0,c=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(i=h%1+36e-17))return 1/0;u=(1&h?-1:1)*r.PI/r.sin(r.PI*i),h=1-h}for(o=h,n=h<1?h++:(h-=l=(0|h)-1)-1,e=0;e<8;++e)c=(c+s[e])*n,f=f*n+a[e];if(i=c/f+1,o<h)i/=o;else if(o>h)for(e=0;e<l;++e)i*=h,h++;return u&&(i=u/i),i},t.gammap=function(r,e){return t.lowRegGamma(r,e)*t.gammafn(r)},t.lowRegGamma=function(e,n){var o,i=t.gammaln(e),s=e,a=1/e,u=a,l=n+1-e,f=1/1e-30,c=1/l,h=c,m=1,g=-~(8.5*r.log(e>=1?e:1/e)+.4*e+17);if(n<0||e<=0)return NaN;if(n<e+1){for(;m<=g;m++)a+=u*=n/++s;return a*r.exp(-n+e*r.log(n)-i)}for(;m<=g;m++)h*=(c=1/(c=(o=-m*(m-e))*c+(l+=2)))*(f=l+o/f);return 1-h*r.exp(-n+e*r.log(n)-i)},t.factorialln=function(r){return r<0?NaN:t.gammaln(r+1)},t.factorial=function(r){return r<0?NaN:t.gammafn(r+1)},t.combination=function(e,n){return e>170||n>170?r.exp(t.combinationln(e,n)):t.factorial(e)/t.factorial(n)/t.factorial(e-n)},t.combinationln=function(r,e){return t.factorialln(r)-t.factorialln(e)-t.factorialln(r-e)},t.permutation=function(r,e){return t.factorial(r)/t.factorial(r-e)},t.betafn=function(e,n){if(!(e<=0||n<=0))return e+n>170?r.exp(t.betaln(e,n)):t.gammafn(e)*t.gammafn(n)/t.gammafn(e+n)},t.betaln=function(r,e){return t.gammaln(r)+t.gammaln(e)-t.gammaln(r+e)},t.betacf=function(t,e,n){var o,i,s,a,u=1e-30,l=1,f=e+n,c=e+1,h=e-1,m=1,g=1-f*t/c;for(r.abs(g)<u&&(g=u),a=g=1/g;l<=100&&(g=1+(i=l*(n-l)*t/((h+(o=2*l))*(e+o)))*g,r.abs(g)<u&&(g=u),m=1+i/m,r.abs(m)<u&&(m=u),a*=(g=1/g)*m,g=1+(i=-(e+l)*(f+l)*t/((e+o)*(c+o)))*g,r.abs(g)<u&&(g=u),m=1+i/m,r.abs(m)<u&&(m=u),a*=s=(g=1/g)*m,!(r.abs(s-1)<3e-7));l++);return a},t.gammapinv=function(e,n){var o,i,s,a,u,l,f=0,c=n-1,h=1e-8,m=t.gammaln(n);if(e>=1)return r.max(100,n+100*r.sqrt(n));if(e<=0)return 0;for(n>1?(u=r.log(c),l=r.exp(c*(u-1)-m),a=e<.5?e:1-e,o=(2.30753+.27061*(i=r.sqrt(-2*r.log(a))))/(1+i*(.99229+.04481*i))-i,e<.5&&(o=-o),o=r.max(.001,n*r.pow(1-1/(9*n)-o/(3*r.sqrt(n)),3))):o=e<(i=1-n*(.253+.12*n))?r.pow(e/i,1/n):1-r.log(1-(e-i)/(1-i));f<12;f++){if(o<=0)return 0;if((o-=i=(s=(t.lowRegGamma(n,o)-e)/(i=n>1?l*r.exp(-(o-c)+c*(r.log(o)-u)):r.exp(-o+c*r.log(o)-m)))/(1-.5*r.min(1,s*((n-1)/o-1))))<=0&&(o=.5*(o+i)),r.abs(i)<h*o)break}return o},t.erf=function(t){var e,n,o,i,s=[-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,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],a=s.length-1,u=!1,l=0,f=0;for(t<0&&(t=-t,u=!0),n=4*(e=2/(2+t))-2;a>0;a--)o=l,l=n*l-f+s[a],f=o;return i=e*r.exp(-t*t+.5*(s[0]+n*l)-f),u?i-1:1-i},t.erfc=function(r){return 1-t.erf(r)},t.erfcinv=function(e){var n,o,i,s,a=0;if(e>=2)return-100;if(e<=0)return 100;for(s=e<1?e:2-e,n=-.70711*((2.30753+.27061*(i=r.sqrt(-2*r.log(s/2))))/(1+i*(.99229+.04481*i))-i);a<2;a++)n+=(o=t.erfc(n)-s)/(1.1283791670955126*r.exp(-n*n)-n*o);return e<1?n:-n},t.ibetainv=function(e,n,o){var i,s,a,u,l,f,c,h,m,g,p=1e-8,d=n-1,w=o-1,v=0;if(e<=0)return 0;if(e>=1)return 1;for(n>=1&&o>=1?(a=e<.5?e:1-e,f=(2.30753+.27061*(u=r.sqrt(-2*r.log(a))))/(1+u*(.99229+.04481*u))-u,e<.5&&(f=-f),c=(f*f-3)/6,h=2/(1/(2*n-1)+1/(2*o-1)),m=f*r.sqrt(c+h)/h-(1/(2*o-1)-1/(2*n-1))*(c+5/6-2/(3*h)),f=n/(n+o*r.exp(2*m))):(i=r.log(n/(n+o)),s=r.log(o/(n+o)),f=e<(u=r.exp(n*i)/n)/(m=u+(l=r.exp(o*s)/o))?r.pow(n*m*e,1/n):1-r.pow(o*m*(1-e),1/o)),g=-t.gammaln(n)-t.gammaln(o)+t.gammaln(n+o);v<10;v++){if(0===f||1===f)return f;if((f-=u=(l=(t.ibeta(f,n,o)-e)/(u=r.exp(d*r.log(f)+w*r.log(1-f)+g)))/(1-.5*r.min(1,l*(d/f-w/(1-f)))))<=0&&(f=.5*(f+u)),f>=1&&(f=.5*(f+u+1)),r.abs(u)<p*f&&v>0)break}return f},t.ibeta=function(e,n,o){var i=0===e||1===e?0:r.exp(t.gammaln(n+o)-t.gammaln(n)-t.gammaln(o)+n*r.log(e)+o*r.log(1-e));return!(e<0||e>1)&&(e<(n+1)/(n+o+2)?i*t.betacf(e,n,o)/n:1-i*t.betacf(1-e,o,n)/o)},t.randn=function(e,n){var o,i,s,a,u;if(n||(n=e),e)return t.create(e,n,(function(){return t.randn()}));do{o=t._random_fn(),i=1.7156*(t._random_fn()-.5),u=(s=o-.449871)*s+(a=r.abs(i)+.386595)*(.196*a-.25472*s)}while(u>.27597&&(u>.27846||i*i>-4*r.log(o)*o*o));return i/o},t.randg=function(e,n,o){var i,s,a,u,l,f,c=e;if(o||(o=n),e||(e=1),n)return(f=t.zeros(n,o)).alter((function(){return t.randg(e)})),f;e<1&&(e+=1),i=e-1/3,s=1/r.sqrt(9*i);do{do{u=1+s*(l=t.randn())}while(u<=0);u*=u*u,a=t._random_fn()}while(a>1-.331*r.pow(l,4)&&r.log(a)>.5*l*l+i*(1-u+r.log(u)));if(e==c)return i*u;do{a=t._random_fn()}while(0===a);return r.pow(a,1/c)*i*u},function(r){for(var e=0;e<r.length;e++)!function(r){t.fn[r]=function(){return t(t.map(this,(function(e){return t[r](e)})))}}(r[e])}("gammaln gammafn factorial factorialln".split(" ")),function(r){for(var e=0;e<r.length;e++)!function(r){t.fn[r]=function(){return t(t[r].apply(null,arguments))}}(r[e])}("randn".split(" "))}(t,Math),function(t,r){function e(t,e,n,o){for(var i,s=0,a=1,u=1,l=1,f=0,c=0;r.abs((u-c)/u)>o;)c=u,a=l+(i=-(e+f)*(e+n+f)*t/(e+2*f)/(e+2*f+1))*a,u=(s=u+i*s)+(i=(f+=1)*(n-f)*t/(e+2*f-1)/(e+2*f))*u,s/=l=a+i*l,a/=l,u/=l,l=1;return u/e}function n(t){return t/r.abs(t)}function o(e,n,o){var i=12,s=6,a=-30,u=-50,l=60,f=8,c=3,h=2,m=3,g=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],p=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],d=.5*e;if(d>=f)return 1;var w,v=2*t.normal.cdf(d,0,1,1,0)-1;v=v>=r.exp(u/o)?r.pow(v,o):0;for(var y=d,b=(f-d)/(w=e>c?h:m),M=y+b,x=0,j=o-1,E=1;E<=w;E++){for(var S=0,_=.5*(M+y),A=.5*(M-y),q=1;q<=i;q++){var P,R=_+A*(s<q?g[(P=i-q+1)-1]:-g[(P=q)-1]),k=R*R;if(k>l)break;var N=2*t.normal.cdf(R,0,1,1,0)*.5-2*t.normal.cdf(R,e,1,1,0)*.5;N>=r.exp(a/j)&&(S+=N=p[P-1]*r.exp(-.5*k)*r.pow(N,j))}x+=S*=2*A*o/r.sqrt(2*r.PI),y=M,M+=b}return(v+=x)<=r.exp(a/n)?0:(v=r.pow(v,n))>=1?1:v}function i(t,e,n){var o=.322232421088,i=.099348462606,s=-1,a=.588581570495,u=-.342242088547,l=.531103462366,f=-.204231210125,c=.10353775285,h=-453642210148e-16,m=.0038560700634,g=.8832,p=.2368,d=1.214,w=1.208,v=1.4142,y=120,b=.5-.5*t,M=r.sqrt(r.log(1/(b*b))),x=M+((((M*h+f)*M+u)*M+s)*M+o)/((((M*m+c)*M+l)*M+a)*M+i);n<y&&(x+=(x*x*x+x)/n/4);var j=g-p*x;return n<y&&(j+=-d/n+w*x/n),x*(j*r.log(e-1)+v)}!function(r){for(var e=0;e<r.length;e++)!function(r){t[r]=function t(r,e,n){return this instanceof t?(this._a=r,this._b=e,this._c=n,this):new t(r,e,n)},t.fn[r]=function(e,n,o){var i=t[r](e,n,o);return i.data=this,i},t[r].prototype.sample=function(e){var n=this._a,o=this._b,i=this._c;return e?t.alter(e,(function(){return t[r].sample(n,o,i)})):t[r].sample(n,o,i)},function(e){for(var n=0;n<e.length;n++)!function(e){t[r].prototype[e]=function(n){var o=this._a,i=this._b,s=this._c;return n||0===n||(n=this.data),"number"!=typeof n?t.fn.map.call(n,(function(n){return t[r][e](n,o,i,s)})):t[r][e](n,o,i,s)}}(e[n])}("pdf cdf inv".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){t[r].prototype[e]=function(){return t[r][e](this._a,this._b,this._c)}}(e[n])}("mean median mode variance".split(" "))}(r[e])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(e,n,o){return e>1||e<0?0:1==n&&1==o?1:n<512&&o<512?r.pow(e,n-1)*r.pow(1-e,o-1)/t.betafn(n,o):r.exp((n-1)*r.log(e)+(o-1)*r.log(1-e)-t.betaln(n,o))},cdf:function(r,e,n){return r>1||r<0?1*(r>1):t.ibeta(r,e,n)},inv:function(r,e,n){return t.ibetainv(r,e,n)},mean:function(t,r){return t/(t+r)},median:function(r,e){return t.ibetainv(.5,r,e)},mode:function(t,r){return(t-1)/(t+r-2)},sample:function(r,e){var n=t.randg(r);return n/(n+t.randg(e))},variance:function(t,e){return t*e/(r.pow(t+e,2)*(t+e+1))}}),t.extend(t.centralF,{pdf:function(e,n,o){var i;return e<0?0:n<=2?0===e&&n<2?1/0:0===e&&2===n?1:1/t.betafn(n/2,o/2)*r.pow(n/o,n/2)*r.pow(e,n/2-1)*r.pow(1+n/o*e,-(n+o)/2):(i=n*e/(o+e*n),n*(o/(o+e*n))/2*t.binomial.pdf((n-2)/2,(n+o-2)/2,i))},cdf:function(r,e,n){return r<0?0:t.ibeta(e*r/(e*r+n),e/2,n/2)},inv:function(r,e,n){return n/(e*(1/t.ibetainv(r,e/2,n/2)-1))},mean:function(t,r){return r>2?r/(r-2):void 0},mode:function(t,r){return t>2?r*(t-2)/(t*(r+2)):void 0},sample:function(r,e){return 2*t.randg(r/2)/r/(2*t.randg(e/2)/e)},variance:function(t,r){if(!(r<=4))return 2*r*r*(t+r-2)/(t*(r-2)*(r-2)*(r-4))}}),t.extend(t.cauchy,{pdf:function(t,e,n){return n<0?0:n/(r.pow(t-e,2)+r.pow(n,2))/r.PI},cdf:function(t,e,n){return r.atan((t-e)/n)/r.PI+.5},inv:function(t,e,n){return e+n*r.tan(r.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*r.sqrt(1/(2*t.randg(.5)))*n+e}}),t.extend(t.chisquare,{pdf:function(e,n){return e<0?0:0===e&&2===n?.5:r.exp((n/2-1)*r.log(e)-e/2-n/2*r.log(2)-t.gammaln(n/2))},cdf:function(r,e){return r<0?0:t.lowRegGamma(e/2,r/2)},inv:function(r,e){return 2*t.gammapinv(r,.5*e)},mean:function(t){return t},median:function(t){return t*r.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(r){return 2*t.randg(r/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,e){return t<0?0:e*r.exp(-e*t)},cdf:function(t,e){return t<0?0:1-r.exp(-e*t)},inv:function(t,e){return-r.log(1-t)/e},mean:function(t){return 1/t},median:function(t){return 1/t*r.log(2)},mode:function(){return 0},sample:function(e){return-1/e*r.log(t._random_fn())},variance:function(t){return r.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(e,n,o){return e<0?0:0===e&&1===n?1/o:r.exp((n-1)*r.log(e)-e/o-t.gammaln(n)-n*r.log(o))},cdf:function(r,e,n){return r<0?0:t.lowRegGamma(e,r/n)},inv:function(r,e,n){return t.gammapinv(r,e)*n},mean:function(t,r){return t*r},mode:function(t,r){if(t>1)return(t-1)*r},sample:function(r,e){return t.randg(r)*e},variance:function(t,r){return t*r*r}}),t.extend(t.invgamma,{pdf:function(e,n,o){return e<=0?0:r.exp(-(n+1)*r.log(e)-o/e-t.gammaln(n)+n*r.log(o))},cdf:function(r,e,n){return r<=0?0:1-t.lowRegGamma(e,n/r)},inv:function(r,e,n){return n/t.gammapinv(1-r,e)},mean:function(t,r){return t>1?r/(t-1):void 0},mode:function(t,r){return r/(t+1)},sample:function(r,e){return e/t.randg(r)},variance:function(t,r){if(!(t<=2))return r*r/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,e,n){return 0===t&&1===e?n:1===t&&1===n?e:r.exp(r.log(e)+r.log(n)+(e-1)*r.log(t)+(n-1)*r.log(1-r.pow(t,e)))},cdf:function(t,e,n){return t<0?0:t>1?1:1-r.pow(1-r.pow(t,e),n)},inv:function(t,e,n){return r.pow(1-r.pow(1-t,1/n),1/e)},mean:function(r,e){return e*t.gammafn(1+1/r)*t.gammafn(e)/t.gammafn(1+1/r+e)},median:function(t,e){return r.pow(1-r.pow(2,-1/e),1/t)},mode:function(t,e){if(t>=1&&e>=1&&1!==t&&1!==e)return r.pow((t-1)/(t*e-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,e,n){return t<=0?0:r.exp(-r.log(t)-.5*r.log(2*r.PI)-r.log(n)-r.pow(r.log(t)-e,2)/(2*n*n))},cdf:function(e,n,o){return e<0?0:.5+.5*t.erf((r.log(e)-n)/r.sqrt(2*o*o))},inv:function(e,n,o){return r.exp(-1.4142135623730951*o*t.erfcinv(2*e)+n)},mean:function(t,e){return r.exp(t+e*e/2)},median:function(t){return r.exp(t)},mode:function(t,e){return r.exp(t-e*e)},sample:function(e,n){return r.exp(t.randn()*n+e)},variance:function(t,e){return(r.exp(e*e)-1)*r.exp(2*t+e*e)}}),t.extend(t.noncentralt,{pdf:function(e,n,o){var i=1e-14;return r.abs(o)<i?t.studentt.pdf(e,n):r.abs(e)<i?r.exp(t.gammaln((n+1)/2)-o*o/2-.5*r.log(r.PI*n)-t.gammaln(n/2)):n/e*(t.noncentralt.cdf(e*r.sqrt(1+2/n),n+2,o)-t.noncentralt.cdf(e,n,o))},cdf:function(e,n,o){var i=1e-14,s=200;if(r.abs(o)<i)return t.studentt.cdf(e,n);var a=!1;e<0&&(a=!0,o=-o);for(var u=t.normal.cdf(-o,0,1),l=i+1,f=l,c=e*e/(e*e+n),h=0,m=r.exp(-o*o/2),g=r.exp(-o*o/2-.5*r.log(2)-t.gammaln(1.5))*o;h<s||f>i||l>i;)f=l,h>0&&(m*=o*o/(2*h),g*=o*o/(2*(h+.5))),u+=.5*(l=m*t.beta.cdf(c,h+.5,n/2)+g*t.beta.cdf(c,h+1,n/2)),h++;return a?1-u:u}}),t.extend(t.normal,{pdf:function(t,e,n){return r.exp(-.5*r.log(2*r.PI)-r.log(n)-r.pow(t-e,2)/(2*n*n))},cdf:function(e,n,o){return.5*(1+t.erf((e-n)/r.sqrt(2*o*o)))},inv:function(r,e,n){return-1.4142135623730951*n*t.erfcinv(2*r)+e},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(r,e){return t.randn()*e+r},variance:function(t,r){return r*r}}),t.extend(t.pareto,{pdf:function(t,e,n){return t<e?0:n*r.pow(e,n)/r.pow(t,n+1)},cdf:function(t,e,n){return t<e?0:1-r.pow(e/t,n)},inv:function(t,e,n){return e/r.pow(1-t,1/n)},mean:function(t,e){if(!(e<=1))return e*r.pow(t,e)/(e-1)},median:function(t,e){return t*(e*r.SQRT2)},mode:function(t){return t},variance:function(t,e){if(!(e<=2))return t*t*e/(r.pow(e-1,2)*(e-2))}}),t.extend(t.studentt,{pdf:function(e,n){return n=n>1e100?1e100:n,1/(r.sqrt(n)*t.betafn(.5,n/2))*r.pow(1+e*e/n,-(n+1)/2)},cdf:function(e,n){var o=n/2;return t.ibeta((e+r.sqrt(e*e+n))/(2*r.sqrt(e*e+n)),o,o)},inv:function(e,n){var o=t.ibetainv(2*r.min(e,1-e),.5*n,.5);return o=r.sqrt(n*(1-o)/o),e>.5?o:-o},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(e){return t.randn()*r.sqrt(e/(2*t.randg(e/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,e,n){return t<0||e<0||n<0?0:n/e*r.pow(t/e,n-1)*r.exp(-r.pow(t/e,n))},cdf:function(t,e,n){return t<0?0:1-r.exp(-r.pow(t/e,n))},inv:function(t,e,n){return e*r.pow(-r.log(1-t),1/n)},mean:function(r,e){return r*t.gammafn(1+1/e)},median:function(t,e){return t*r.pow(r.log(2),1/e)},mode:function(t,e){return e<=1?0:t*r.pow((e-1)/e,1/e)},sample:function(e,n){return e*r.pow(-r.log(t._random_fn()),1/n)},variance:function(e,n){return e*e*t.gammafn(1+2/n)-r.pow(t.weibull.mean(e,n),2)}}),t.extend(t.uniform,{pdf:function(t,r,e){return t<r||t>e?0:1/(e-r)},cdf:function(t,r,e){return t<r?0:t<e?(t-r)/(e-r):1},inv:function(t,r,e){return r+t*(e-r)},mean:funct