-
Notifications
You must be signed in to change notification settings - Fork 2
/
ruleJS.all.full.min.js
7 lines (7 loc) · 217 KB
/
ruleJS.all.full.min.js
1
2
3
4
5
6
7
(function(){function a(a,b,c){for(var d=(c||0)-1,e=a?a.length:0;++d<e;)if(a[d]===b)return d;return-1}function b(b,c){var d=typeof c;if(b=b.cache,"boolean"==d||null==c)return b[c]?0:-1;"number"!=d&&"string"!=d&&(d="object");var e="number"==d?c:r+c;return b=(b=b[d])&&b[e],"object"==d?b&&a(b,c)>-1?0:-1:b?0:-1}function c(a){var b=this.cache,c=typeof a;if("boolean"==c||null==a)b[a]=!0;else{"number"!=c&&"string"!=c&&(c="object");var d="number"==c?a:r+a,e=b[c]||(b[c]={});"object"==c?(e[d]||(e[d]=[])).push(a):e[d]=!0}}function d(a){return a.charCodeAt(0)}function e(a,b){for(var c=a.criteria,d=b.criteria,e=-1,f=c.length;++e<f;){var g=c[e],h=d[e];if(g!==h){if(g>h||"undefined"==typeof g)return 1;if(h>g||"undefined"==typeof h)return-1}}return a.index-b.index}function f(a){var b=-1,d=a.length,e=a[0],f=a[d/2|0],g=a[d-1];if(e&&"object"==typeof e&&f&&"object"==typeof f&&g&&"object"==typeof g)return!1;var h=i();h["false"]=h["null"]=h["true"]=h.undefined=!1;var j=i();for(j.array=a,j.cache=h,j.push=c;++b<d;)j.push(a[b]);return j}function g(a){return"\\"+V[a]}function h(){return o.pop()||[]}function i(){return p.pop()||{array:null,cache:null,criteria:null,"false":!1,index:0,"null":!1,number:null,object:null,push:null,string:null,"true":!1,undefined:!1,value:null}}function j(a){a.length=0,o.length<t&&o.push(a)}function k(a){var b=a.cache;b&&k(b),a.array=a.cache=a.criteria=a.object=a.number=a.string=a.value=null,p.length<t&&p.push(a)}function l(a,b,c){b||(b=0),"undefined"==typeof c&&(c=a?a.length:0);for(var d=-1,e=c-b||0,f=Array(0>e?0:e);++d<e;)f[d]=a[b+d];return f}function m(c){function o(a){return a&&"object"==typeof a&&!Zd(a)&&Hd.call(a,"__wrapped__")?a:new p(a)}function p(a,b){this.__chain__=!!b,this.__wrapped__=a}function t(a){function b(){if(d){var a=l(d);Id.apply(a,arguments)}if(this instanceof b){var f=X(c.prototype),g=c.apply(f,a||arguments);return Eb(g)?g:f}return c.apply(e,a||arguments)}var c=a[0],d=a[2],e=a[4];return Yd(b,a),b}function V(a,b,c,d,e){if(c){var f=c(a);if("undefined"!=typeof f)return f}var g=Eb(a);if(!g)return a;var i=Ad.call(a);if(!R[i])return a;var k=Wd[i];switch(i){case K:case L:return new k(+a);case N:case Q:return new k(a);case P:return f=k(a.source,z.exec(a)),f.lastIndex=a.lastIndex,f}var m=Zd(a);if(b){var n=!d;d||(d=h()),e||(e=h());for(var o=d.length;o--;)if(d[o]==a)return e[o];f=m?k(a.length):{}}else f=m?l(a):ee({},a);return m&&(Hd.call(a,"index")&&(f.index=a.index),Hd.call(a,"input")&&(f.input=a.input)),b?(d.push(a),e.push(f),(m?Yb:he)(a,function(a,g){f[g]=V(a,b,c,d,e)}),n&&(j(d),j(e)),f):f}function X(a){return Eb(a)?Nd(a):{}}function Y(a,b,c){if("function"!=typeof a)return Zc;if("undefined"==typeof b||!("prototype"in a))return a;var d=a.__bindData__;if("undefined"==typeof d&&(Xd.funcNames&&(d=!a.name),d=d||!Xd.funcDecomp,!d)){var e=Fd.call(a);Xd.funcNames||(d=!A.test(e)),d||(d=E.test(e),Yd(a,d))}if(d===!1||d!==!0&&1&d[1])return a;switch(c){case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)};case 4:return function(c,d,e,f){return a.call(b,c,d,e,f)}}return Ic(a,b)}function Z(a){function b(){var a=i?g:this;if(e){var o=l(e);Id.apply(o,arguments)}if((f||k)&&(o||(o=l(arguments)),f&&Id.apply(o,f),k&&o.length<h))return d|=16,Z([c,m?d:-4&d,o,null,g,h]);if(o||(o=arguments),j&&(c=a[n]),this instanceof b){a=X(c.prototype);var p=c.apply(a,o);return Eb(p)?p:a}return c.apply(a,o)}var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=1&d,j=2&d,k=4&d,m=8&d,n=c;return Yd(b,a),b}function $(c,d){var e=-1,g=ib(),h=c?c.length:0,i=h>=s&&g===a,j=[];if(i){var l=f(d);l?(g=b,d=l):i=!1}for(;++e<h;){var m=c[e];g(d,m)<0&&j.push(m)}return i&&k(d),j}function ab(a,b,c,d){for(var e=(d||0)-1,f=a?a.length:0,g=[];++e<f;){var h=a[e];if(h&&"object"==typeof h&&"number"==typeof h.length&&(Zd(h)||mb(h))){b||(h=ab(h,b,c));var i=-1,j=h.length,k=g.length;for(g.length+=j;++i<j;)g[k++]=h[i]}else c||g.push(h)}return g}function bb(a,b,c,d,e,f){if(c){var g=c(a,b);if("undefined"!=typeof g)return!!g}if(a===b)return 0!==a||1/a==1/b;var i=typeof a,k=typeof b;if(!(a!==a||a&&U[i]||b&&U[k]))return!1;if(null==a||null==b)return a===b;var l=Ad.call(a),m=Ad.call(b);if(l==I&&(l=O),m==I&&(m=O),l!=m)return!1;switch(l){case K:case L:return+a==+b;case N:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case P:case Q:return a==vd(b)}var n=l==J;if(!n){var o=Hd.call(a,"__wrapped__"),p=Hd.call(b,"__wrapped__");if(o||p)return bb(o?a.__wrapped__:a,p?b.__wrapped__:b,c,d,e,f);if(l!=O)return!1;var q=a.constructor,r=b.constructor;if(q!=r&&!(Db(q)&&q instanceof q&&Db(r)&&r instanceof r)&&"constructor"in a&&"constructor"in b)return!1}var s=!e;e||(e=h()),f||(f=h());for(var t=e.length;t--;)if(e[t]==a)return f[t]==b;var u=0;if(g=!0,e.push(a),f.push(b),n){if(t=a.length,u=b.length,g=u==t,g||d)for(;u--;){var v=t,w=b[u];if(d)for(;v--&&!(g=bb(a[v],w,c,d,e,f)););else if(!(g=bb(a[u],w,c,d,e,f)))break}}else ge(b,function(b,h,i){return Hd.call(i,h)?(u++,g=Hd.call(a,h)&&bb(a[h],b,c,d,e,f)):void 0}),g&&!d&&ge(a,function(a,b,c){return Hd.call(c,b)?g=--u>-1:void 0});return e.pop(),f.pop(),s&&(j(e),j(f)),g}function cb(a,b,c,d,e){(Zd(b)?Yb:he)(b,function(b,f){var g,h,i=b,j=a[f];if(b&&((h=Zd(b))||ie(b))){for(var k=d.length;k--;)if(g=d[k]==b){j=e[k];break}if(!g){var l;c&&(i=c(j,b),(l="undefined"!=typeof i)&&(j=i)),l||(j=h?Zd(j)?j:[]:ie(j)?j:{}),d.push(b),e.push(j),l||cb(j,b,c,d,e)}}else c&&(i=c(j,b),"undefined"==typeof i&&(i=b)),"undefined"!=typeof i&&(j=i);a[f]=j})}function db(a,b){return a+Ed(Vd()*(b-a+1))}function eb(c,d,e){var g=-1,i=ib(),l=c?c.length:0,m=[],n=!d&&l>=s&&i===a,o=e||n?h():m;if(n){var p=f(o);i=b,o=p}for(;++g<l;){var q=c[g],r=e?e(q,g,c):q;(d?!g||o[o.length-1]!==r:i(o,r)<0)&&((e||n)&&o.push(r),m.push(q))}return n?(j(o.array),k(o)):e&&j(o),m}function fb(a){return function(b,c,d){var e={};c=o.createCallback(c,d,3);var f=-1,g=b?b.length:0;if("number"==typeof g)for(;++f<g;){var h=b[f];a(e,h,c(h,f,b),b)}else he(b,function(b,d,f){a(e,b,c(b,d,f),f)});return e}}function gb(a,b,c,d,e,f){var g=1&b,h=2&b,i=4&b,j=16&b,k=32&b;if(!h&&!Db(a))throw new wd;j&&!c.length&&(b&=-17,j=c=!1),k&&!d.length&&(b&=-33,k=d=!1);var m=a&&a.__bindData__;if(m&&m!==!0)return m=l(m),m[2]&&(m[2]=l(m[2])),m[3]&&(m[3]=l(m[3])),!g||1&m[1]||(m[4]=e),!g&&1&m[1]&&(b|=8),!i||4&m[1]||(m[5]=f),j&&Id.apply(m[2]||(m[2]=[]),c),k&&Ld.apply(m[3]||(m[3]=[]),d),m[1]|=b,gb.apply(null,m);var n=1==b||17===b?t:Z;return n([a,b,c,d,e,f])}function hb(a){return ae[a]}function ib(){var b=(b=o.indexOf)===rc?a:b;return b}function jb(a){return"function"==typeof a&&Bd.test(a)}function kb(a){var b,c;return a&&Ad.call(a)==O&&(b=a.constructor,!Db(b)||b instanceof b)?(ge(a,function(a,b){c=b}),"undefined"==typeof c||Hd.call(a,c)):!1}function lb(a){return be[a]}function mb(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Ad.call(a)==I||!1}function nb(a,b,c,d){return"boolean"!=typeof b&&null!=b&&(d=c,c=b,b=!1),V(a,b,"function"==typeof c&&Y(c,d,1))}function ob(a,b,c){return V(a,!0,"function"==typeof b&&Y(b,c,1))}function pb(a,b){var c=X(a);return b?ee(c,b):c}function qb(a,b,c){var d;return b=o.createCallback(b,c,3),he(a,function(a,c,e){return b(a,c,e)?(d=c,!1):void 0}),d}function rb(a,b,c){var d;return b=o.createCallback(b,c,3),tb(a,function(a,c,e){return b(a,c,e)?(d=c,!1):void 0}),d}function sb(a,b,c){var d=[];ge(a,function(a,b){d.push(b,a)});var e=d.length;for(b=Y(b,c,3);e--&&b(d[e--],d[e],a)!==!1;);return a}function tb(a,b,c){var d=_d(a),e=d.length;for(b=Y(b,c,3);e--;){var f=d[e];if(b(a[f],f,a)===!1)break}return a}function ub(a){var b=[];return ge(a,function(a,c){Db(a)&&b.push(c)}),b.sort()}function vb(a,b){return a?Hd.call(a,b):!1}function wb(a){for(var b=-1,c=_d(a),d=c.length,e={};++b<d;){var f=c[b];e[a[f]]=f}return e}function xb(a){return a===!0||a===!1||a&&"object"==typeof a&&Ad.call(a)==K||!1}function yb(a){return a&&"object"==typeof a&&Ad.call(a)==L||!1}function zb(a){return a&&1===a.nodeType||!1}function Ab(a){var b=!0;if(!a)return b;var c=Ad.call(a),d=a.length;return c==J||c==Q||c==I||c==O&&"number"==typeof d&&Db(a.splice)?!d:(he(a,function(){return b=!1}),b)}function Bb(a,b,c,d){return bb(a,b,"function"==typeof c&&Y(c,d,2))}function Cb(a){return Pd(a)&&!Qd(parseFloat(a))}function Db(a){return"function"==typeof a}function Eb(a){return!(!a||!U[typeof a])}function Fb(a){return Hb(a)&&a!=+a}function Gb(a){return null===a}function Hb(a){return"number"==typeof a||a&&"object"==typeof a&&Ad.call(a)==N||!1}function Ib(a){return a&&"object"==typeof a&&Ad.call(a)==P||!1}function Jb(a){return"string"==typeof a||a&&"object"==typeof a&&Ad.call(a)==Q||!1}function Kb(a){return"undefined"==typeof a}function Lb(a,b,c){var d={};return b=o.createCallback(b,c,3),he(a,function(a,c,e){d[c]=b(a,c,e)}),d}function Mb(a){var b=arguments,c=2;if(!Eb(a))return a;if("number"!=typeof b[2]&&(c=b.length),c>3&&"function"==typeof b[c-2])var d=Y(b[--c-1],b[c--],2);else c>2&&"function"==typeof b[c-1]&&(d=b[--c]);for(var e=l(arguments,1,c),f=-1,g=h(),i=h();++f<c;)cb(a,e[f],d,g,i);return j(g),j(i),a}function Nb(a,b,c){var d={};if("function"!=typeof b){var e=[];ge(a,function(a,b){e.push(b)}),e=$(e,ab(arguments,!0,!1,1));for(var f=-1,g=e.length;++f<g;){var h=e[f];d[h]=a[h]}}else b=o.createCallback(b,c,3),ge(a,function(a,c,e){b(a,c,e)||(d[c]=a)});return d}function Ob(a){for(var b=-1,c=_d(a),d=c.length,e=nd(d);++b<d;){var f=c[b];e[b]=[f,a[f]]}return e}function Pb(a,b,c){var d={};if("function"!=typeof b)for(var e=-1,f=ab(arguments,!0,!1,1),g=Eb(a)?f.length:0;++e<g;){var h=f[e];h in a&&(d[h]=a[h])}else b=o.createCallback(b,c,3),ge(a,function(a,c,e){b(a,c,e)&&(d[c]=a)});return d}function Qb(a,b,c,d){var e=Zd(a);if(null==c)if(e)c=[];else{var f=a&&a.constructor,g=f&&f.prototype;c=X(g)}return b&&(b=o.createCallback(b,d,4),(e?Yb:he)(a,function(a,d,e){return b(c,a,d,e)})),c}function Rb(a){for(var b=-1,c=_d(a),d=c.length,e=nd(d);++b<d;)e[b]=a[c[b]];return e}function Sb(a){for(var b=arguments,c=-1,d=ab(b,!0,!1,1),e=b[2]&&b[2][b[1]]===a?1:d.length,f=nd(e);++c<e;)f[c]=a[d[c]];return f}function Tb(a,b,c){var d=-1,e=ib(),f=a?a.length:0,g=!1;return c=(0>c?Sd(0,f+c):c)||0,Zd(a)?g=e(a,b,c)>-1:"number"==typeof f?g=(Jb(a)?a.indexOf(b,c):e(a,b,c))>-1:he(a,function(a){return++d>=c?!(g=a===b):void 0}),g}function Ub(a,b,c){var d=!0;b=o.createCallback(b,c,3);var e=-1,f=a?a.length:0;if("number"==typeof f)for(;++e<f&&(d=!!b(a[e],e,a)););else he(a,function(a,c,e){return d=!!b(a,c,e)});return d}function Vb(a,b,c){var d=[];b=o.createCallback(b,c,3);var e=-1,f=a?a.length:0;if("number"==typeof f)for(;++e<f;){var g=a[e];b(g,e,a)&&d.push(g)}else he(a,function(a,c,e){b(a,c,e)&&d.push(a)});return d}function Wb(a,b,c){b=o.createCallback(b,c,3);var d=-1,e=a?a.length:0;if("number"!=typeof e){var f;return he(a,function(a,c,d){return b(a,c,d)?(f=a,!1):void 0}),f}for(;++d<e;){var g=a[d];if(b(g,d,a))return g}}function Xb(a,b,c){var d;return b=o.createCallback(b,c,3),Zb(a,function(a,c,e){return b(a,c,e)?(d=a,!1):void 0}),d}function Yb(a,b,c){var d=-1,e=a?a.length:0;if(b=b&&"undefined"==typeof c?b:Y(b,c,3),"number"==typeof e)for(;++d<e&&b(a[d],d,a)!==!1;);else he(a,b);return a}function Zb(a,b,c){var d=a?a.length:0;if(b=b&&"undefined"==typeof c?b:Y(b,c,3),"number"==typeof d)for(;d--&&b(a[d],d,a)!==!1;);else{var e=_d(a);d=e.length,he(a,function(a,c,f){return c=e?e[--d]:--d,b(f[c],c,f)})}return a}function $b(a,b){var c=l(arguments,2),d=-1,e="function"==typeof b,f=a?a.length:0,g=nd("number"==typeof f?f:0);return Yb(a,function(a){g[++d]=(e?b:a[b]).apply(a,c)}),g}function _b(a,b,c){var d=-1,e=a?a.length:0;if(b=o.createCallback(b,c,3),"number"==typeof e)for(var f=nd(e);++d<e;)f[d]=b(a[d],d,a);else f=[],he(a,function(a,c,e){f[++d]=b(a,c,e)});return f}function ac(a,b,c){var e=-1/0,f=e;if("function"!=typeof b&&c&&c[b]===a&&(b=null),null==b&&Zd(a))for(var g=-1,h=a.length;++g<h;){var i=a[g];i>f&&(f=i)}else b=null==b&&Jb(a)?d:o.createCallback(b,c,3),Yb(a,function(a,c,d){var g=b(a,c,d);g>e&&(e=g,f=a)});return f}function bc(a,b,c){var e=1/0,f=e;if("function"!=typeof b&&c&&c[b]===a&&(b=null),null==b&&Zd(a))for(var g=-1,h=a.length;++g<h;){var i=a[g];f>i&&(f=i)}else b=null==b&&Jb(a)?d:o.createCallback(b,c,3),Yb(a,function(a,c,d){var g=b(a,c,d);e>g&&(e=g,f=a)});return f}function cc(a,b,c,d){if(!a)return c;var e=arguments.length<3;b=o.createCallback(b,d,4);var f=-1,g=a.length;if("number"==typeof g)for(e&&(c=a[++f]);++f<g;)c=b(c,a[f],f,a);else he(a,function(a,d,f){c=e?(e=!1,a):b(c,a,d,f)});return c}function dc(a,b,c,d){var e=arguments.length<3;return b=o.createCallback(b,d,4),Zb(a,function(a,d,f){c=e?(e=!1,a):b(c,a,d,f)}),c}function ec(a,b,c){return b=o.createCallback(b,c,3),Vb(a,function(a,c,d){return!b(a,c,d)})}function fc(a,b,c){if(a&&"number"!=typeof a.length&&(a=Rb(a)),null==b||c)return a?a[db(0,a.length-1)]:n;var d=gc(a);return d.length=Td(Sd(0,b),d.length),d}function gc(a){var b=-1,c=a?a.length:0,d=nd("number"==typeof c?c:0);return Yb(a,function(a){var c=db(0,++b);d[b]=d[c],d[c]=a}),d}function hc(a){var b=a?a.length:0;return"number"==typeof b?b:_d(a).length}function ic(a,b,c){var d;b=o.createCallback(b,c,3);var e=-1,f=a?a.length:0;if("number"==typeof f)for(;++e<f&&!(d=b(a[e],e,a)););else he(a,function(a,c,e){return!(d=b(a,c,e))});return!!d}function jc(a,b,c){var d=-1,f=Zd(b),g=a?a.length:0,l=nd("number"==typeof g?g:0);for(f||(b=o.createCallback(b,c,3)),Yb(a,function(a,c,e){var g=l[++d]=i();f?g.criteria=_b(b,function(b){return a[b]}):(g.criteria=h())[0]=b(a,c,e),g.index=d,g.value=a}),g=l.length,l.sort(e);g--;){var m=l[g];l[g]=m.value,f||j(m.criteria),k(m)}return l}function kc(a){return a&&"number"==typeof a.length?l(a):Rb(a)}function lc(a){for(var b=-1,c=a?a.length:0,d=[];++b<c;){var e=a[b];e&&d.push(e)}return d}function mc(a){return $(a,ab(arguments,!0,!0,1))}function nc(a,b,c){var d=-1,e=a?a.length:0;for(b=o.createCallback(b,c,3);++d<e;)if(b(a[d],d,a))return d;return-1}function oc(a,b,c){var d=a?a.length:0;for(b=o.createCallback(b,c,3);d--;)if(b(a[d],d,a))return d;return-1}function pc(a,b,c){var d=0,e=a?a.length:0;if("number"!=typeof b&&null!=b){var f=-1;for(b=o.createCallback(b,c,3);++f<e&&b(a[f],f,a);)d++}else if(d=b,null==d||c)return a?a[0]:n;return l(a,0,Td(Sd(0,d),e))}function qc(a,b,c,d){return"boolean"!=typeof b&&null!=b&&(d=c,c="function"!=typeof b&&d&&d[b]===a?null:b,b=!1),null!=c&&(a=_b(a,c,d)),ab(a,b)}function rc(b,c,d){if("number"==typeof d){var e=b?b.length:0;d=0>d?Sd(0,e+d):d||0}else if(d){var f=Ac(b,c);return b[f]===c?f:-1}return a(b,c,d)}function sc(a,b,c){var d=0,e=a?a.length:0;if("number"!=typeof b&&null!=b){var f=e;for(b=o.createCallback(b,c,3);f--&&b(a[f],f,a);)d++}else d=null==b||c?1:b||d;return l(a,0,Td(Sd(0,e-d),e))}function tc(){for(var c=[],d=-1,e=arguments.length,g=h(),i=ib(),l=i===a,m=h();++d<e;){var n=arguments[d];(Zd(n)||mb(n))&&(c.push(n),g.push(l&&n.length>=s&&f(d?c[d]:m)))}var o=c[0],p=-1,q=o?o.length:0,r=[];a:for(;++p<q;){var t=g[0];if(n=o[p],(t?b(t,n):i(m,n))<0){for(d=e,(t||m).push(n);--d;)if(t=g[d],(t?b(t,n):i(c[d],n))<0)continue a;r.push(n)}}for(;e--;)t=g[e],t&&k(t);return j(g),j(m),r}function uc(a,b,c){var d=0,e=a?a.length:0;if("number"!=typeof b&&null!=b){var f=e;for(b=o.createCallback(b,c,3);f--&&b(a[f],f,a);)d++}else if(d=b,null==d||c)return a?a[e-1]:n;return l(a,Sd(0,e-d))}function vc(a,b,c){var d=a?a.length:0;for("number"==typeof c&&(d=(0>c?Sd(0,d+c):Td(c,d-1))+1);d--;)if(a[d]===b)return d;return-1}function wc(a){for(var b=arguments,c=0,d=b.length,e=a?a.length:0;++c<d;)for(var f=-1,g=b[c];++f<e;)a[f]===g&&(Kd.call(a,f--,1),e--);return a}function xc(a,b,c){a=+a||0,c="number"==typeof c?c:+c||1,null==b&&(b=a,a=0);for(var d=-1,e=Sd(0,Cd((b-a)/(c||1))),f=nd(e);++d<e;)f[d]=a,a+=c;return f}function yc(a,b,c){var d=-1,e=a?a.length:0,f=[];for(b=o.createCallback(b,c,3);++d<e;){var g=a[d];b(g,d,a)&&(f.push(g),Kd.call(a,d--,1),e--)}return f}function zc(a,b,c){if("number"!=typeof b&&null!=b){var d=0,e=-1,f=a?a.length:0;for(b=o.createCallback(b,c,3);++e<f&&b(a[e],e,a);)d++}else d=null==b||c?1:Sd(0,b);return l(a,d)}function Ac(a,b,c,d){var e=0,f=a?a.length:e;for(c=c?o.createCallback(c,d,1):Zc,b=c(b);f>e;){var g=e+f>>>1;c(a[g])<b?e=g+1:f=g}return e}function Bc(){return eb(ab(arguments,!0,!0))}function Cc(a,b,c,d){return"boolean"!=typeof b&&null!=b&&(d=c,c="function"!=typeof b&&d&&d[b]===a?null:b,b=!1),null!=c&&(c=o.createCallback(c,d,3)),eb(a,b,c)}function Dc(a){return $(a,l(arguments,1))}function Ec(){for(var a=-1,b=arguments.length;++a<b;){var c=arguments[a];if(Zd(c)||mb(c))var d=d?eb($(d,c).concat($(c,d))):c}return d||[]}function Fc(){for(var a=arguments.length>1?arguments:arguments[0],b=-1,c=a?ac(me(a,"length")):0,d=nd(0>c?0:c);++b<c;)d[b]=me(a,b);return d}function Gc(a,b){var c=-1,d=a?a.length:0,e={};for(b||!d||Zd(a[0])||(b=[]);++c<d;){var f=a[c];b?e[f]=b[c]:f&&(e[f[0]]=f[1])}return e}function Hc(a,b){if(!Db(b))throw new wd;return function(){return--a<1?b.apply(this,arguments):void 0}}function Ic(a,b){return arguments.length>2?gb(a,17,l(arguments,2),null,b):gb(a,1,null,null,b)}function Jc(a){for(var b=arguments.length>1?ab(arguments,!0,!1,1):ub(a),c=-1,d=b.length;++c<d;){var e=b[c];a[e]=gb(a[e],1,null,null,a)}return a}function Kc(a,b){return arguments.length>2?gb(b,19,l(arguments,2),null,a):gb(b,3,null,null,a)}function Lc(){for(var a=arguments,b=a.length;b--;)if(!Db(a[b]))throw new wd;return function(){for(var b=arguments,c=a.length;c--;)b=[a[c].apply(this,b)];return b[0]}}function Mc(a,b){return b="number"==typeof b?b:+b||a.length,gb(a,4,null,null,null,b)}function Nc(a,b,c){var d,e,f,g,h,i,j,k=0,l=!1,m=!0;if(!Db(a))throw new wd;if(b=Sd(0,b)||0,c===!0){var o=!0;m=!1}else Eb(c)&&(o=c.leading,l="maxWait"in c&&(Sd(b,c.maxWait)||0),m="trailing"in c?c.trailing:m);var p=function(){var c=b-(oe()-g);if(0>=c){e&&Dd(e);var l=j;e=i=j=n,l&&(k=oe(),f=a.apply(h,d),i||e||(d=h=null))}else i=Jd(p,c)},q=function(){i&&Dd(i),e=i=j=n,(m||l!==b)&&(k=oe(),f=a.apply(h,d),i||e||(d=h=null))};return function(){if(d=arguments,g=oe(),h=this,j=m&&(i||!o),l===!1)var c=o&&!i;else{e||o||(k=g);var n=l-(g-k),r=0>=n;r?(e&&(e=Dd(e)),k=g,f=a.apply(h,d)):e||(e=Jd(q,n))}return r&&i?i=Dd(i):i||b===l||(i=Jd(p,b)),c&&(r=!0,f=a.apply(h,d)),!r||i||e||(d=h=null),f}}function Oc(a){if(!Db(a))throw new wd;var b=l(arguments,1);return Jd(function(){a.apply(n,b)},1)}function Pc(a,b){if(!Db(a))throw new wd;var c=l(arguments,2);return Jd(function(){a.apply(n,c)},b)}function Qc(a,b){if(!Db(a))throw new wd;var c=function(){var d=c.cache,e=b?b.apply(this,arguments):r+arguments[0];return Hd.call(d,e)?d[e]:d[e]=a.apply(this,arguments)};return c.cache={},c}function Rc(a){var b,c;if(!Db(a))throw new wd;return function(){return b?c:(b=!0,c=a.apply(this,arguments),a=null,c)}}function Sc(a){return gb(a,16,l(arguments,1))}function Tc(a){return gb(a,32,null,l(arguments,1))}function Uc(a,b,c){var d=!0,e=!0;if(!Db(a))throw new wd;return c===!1?d=!1:Eb(c)&&(d="leading"in c?c.leading:d,e="trailing"in c?c.trailing:e),S.leading=d,S.maxWait=b,S.trailing=e,Nc(a,b,S)}function Vc(a,b){return gb(b,16,[a])}function Wc(a){return function(){return a}}function Xc(a,b,c){var d=typeof a;if(null==a||"function"==d)return Y(a,b,c);if("object"!=d)return bd(a);var e=_d(a),f=e[0],g=a[f];return 1!=e.length||g!==g||Eb(g)?function(b){for(var c=e.length,d=!1;c--&&(d=bb(b[e[c]],a[e[c]],null,!0)););return d}:function(a){var b=a[f];return g===b&&(0!==g||1/g==1/b)}}function Yc(a){return null==a?"":vd(a).replace(de,hb)}function Zc(a){return a}function $c(a,b,c){var d=!0,e=b&&ub(b);b&&(c||e.length)||(null==c&&(c=b),f=p,b=a,a=o,e=ub(b)),c===!1?d=!1:Eb(c)&&"chain"in c&&(d=c.chain);var f=a,g=Db(f);Yb(e,function(c){var e=a[c]=b[c];g&&(f.prototype[c]=function(){var b=this.__chain__,c=this.__wrapped__,g=[c];Id.apply(g,arguments);var h=e.apply(a,g);if(d||b){if(c===h&&Eb(h))return this;h=new f(h),h.__chain__=b}return h})})}function _c(){return c._=zd,this}function ad(){}function bd(a){return function(b){return b[a]}}function cd(a,b,c){var d=null==a,e=null==b;if(null==c&&("boolean"==typeof a&&e?(c=a,a=1):e||"boolean"!=typeof b||(c=b,e=!0)),d&&e&&(b=1),a=+a||0,e?(b=a,a=0):b=+b||0,c||a%1||b%1){var f=Vd();return Td(a+f*(b-a+parseFloat("1e-"+((f+"").length-1))),b)}return db(a,b)}function dd(a,b){if(a){var c=a[b];return Db(c)?a[b]():c}}function ed(a,b,c){var d=o.templateSettings;a=vd(a||""),c=fe({},c,d);var e,f=fe({},c.imports,d.imports),h=_d(f),i=Rb(f),j=0,k=c.interpolate||D,l="__p += '",m=ud((c.escape||D).source+"|"+k.source+"|"+(k===B?y:D).source+"|"+(c.evaluate||D).source+"|$","g");a.replace(m,function(b,c,d,f,h,i){return d||(d=f),l+=a.slice(j,i).replace(F,g),c&&(l+="' +\n__e("+c+") +\n'"),h&&(e=!0,l+="';\n"+h+";\n__p += '"),d&&(l+="' +\n((__t = ("+d+")) == null ? '' : __t) +\n'"),j=i+b.length,b}),l+="';\n";var p=c.variable,q=p;q||(p="obj",l="with ("+p+") {\n"+l+"\n}\n"),l=(e?l.replace(v,""):l).replace(w,"$1").replace(x,"$1;"),l="function("+p+") {\n"+(q?"":p+" || ("+p+" = {});\n")+"var __t, __p = '', __e = _.escape"+(e?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var r="\n/*\n//# sourceURL="+(c.sourceURL||"/lodash/template/source["+H++ +"]")+"\n*/";try{var s=qd(h,"return "+l+r).apply(n,i)}catch(t){throw t.source=l,t}return b?s(b):(s.source=l,s)}function fd(a,b,c){a=(a=+a)>-1?a:0;var d=-1,e=nd(a);for(b=Y(b,c,1);++d<a;)e[d]=b(d);return e}function gd(a){return null==a?"":vd(a).replace(ce,lb)}function hd(a){var b=++q;return vd(null==a?"":a)+b}function id(a){return a=new p(a),a.__chain__=!0,a}function jd(a,b){return b(a),a}function kd(){return this.__chain__=!0,this}function ld(){return vd(this.__wrapped__)}function md(){return this.__wrapped__}c=c?_.defaults(W.Object(),c,_.pick(W,G)):W;var nd=c.Array,od=c.Boolean,pd=c.Date,qd=c.Function,rd=c.Math,sd=c.Number,td=c.Object,ud=c.RegExp,vd=c.String,wd=c.TypeError,xd=[],yd=td.prototype,zd=c._,Ad=yd.toString,Bd=ud("^"+vd(Ad).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Cd=rd.ceil,Dd=c.clearTimeout,Ed=rd.floor,Fd=qd.prototype.toString,Gd=jb(Gd=td.getPrototypeOf)&&Gd,Hd=yd.hasOwnProperty,Id=xd.push,Jd=c.setTimeout,Kd=xd.splice,Ld=xd.unshift,Md=function(){try{var a={},b=jb(b=td.defineProperty)&&b,c=b(a,a,a)&&b}catch(d){}return c}(),Nd=jb(Nd=td.create)&&Nd,Od=jb(Od=nd.isArray)&&Od,Pd=c.isFinite,Qd=c.isNaN,Rd=jb(Rd=td.keys)&&Rd,Sd=rd.max,Td=rd.min,Ud=c.parseInt,Vd=rd.random,Wd={};Wd[J]=nd,Wd[K]=od,Wd[L]=pd,Wd[M]=qd,Wd[O]=td,Wd[N]=sd,Wd[P]=ud,Wd[Q]=vd,p.prototype=o.prototype;var Xd=o.support={};Xd.funcDecomp=!jb(c.WinRTError)&&E.test(m),Xd.funcNames="string"==typeof qd.name,o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:B,variable:"",imports:{_:o}},Nd||(X=function(){function a(){}return function(b){if(Eb(b)){a.prototype=b;var d=new a;a.prototype=null}return d||c.Object()}}());var Yd=Md?function(a,b){T.value=b,Md(a,"__bindData__",T)}:ad,Zd=Od||function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Ad.call(a)==J||!1},$d=function(a){var b,c=a,d=[];if(!c)return d;if(!U[typeof a])return d;for(b in c)Hd.call(c,b)&&d.push(b);return d},_d=Rd?function(a){return Eb(a)?Rd(a):[]}:$d,ae={"&":"&","<":"<",">":">",'"':""","'":"'"},be=wb(ae),ce=ud("("+_d(be).join("|")+")","g"),de=ud("["+_d(ae).join("")+"]","g"),ee=function(a,b,c){var d,e=a,f=e;if(!e)return f;var g=arguments,h=0,i="number"==typeof c?2:g.length;if(i>3&&"function"==typeof g[i-2])var j=Y(g[--i-1],g[i--],2);else i>2&&"function"==typeof g[i-1]&&(j=g[--i]);for(;++h<i;)if(e=g[h],e&&U[typeof e])for(var k=-1,l=U[typeof e]&&_d(e),m=l?l.length:0;++k<m;)d=l[k],f[d]=j?j(f[d],e[d]):e[d];return f},fe=function(a,b,c){var d,e=a,f=e;if(!e)return f;for(var g=arguments,h=0,i="number"==typeof c?2:g.length;++h<i;)if(e=g[h],e&&U[typeof e])for(var j=-1,k=U[typeof e]&&_d(e),l=k?k.length:0;++j<l;)d=k[j],"undefined"==typeof f[d]&&(f[d]=e[d]);return f},ge=function(a,b,c){var d,e=a,f=e;if(!e)return f;if(!U[typeof e])return f;b=b&&"undefined"==typeof c?b:Y(b,c,3);for(d in e)if(b(e[d],d,a)===!1)return f;return f},he=function(a,b,c){var d,e=a,f=e;if(!e)return f;if(!U[typeof e])return f;b=b&&"undefined"==typeof c?b:Y(b,c,3);for(var g=-1,h=U[typeof e]&&_d(e),i=h?h.length:0;++g<i;)if(d=h[g],b(e[d],d,a)===!1)return f;return f},ie=Gd?function(a){if(!a||Ad.call(a)!=O)return!1;var b=a.valueOf,c=jb(b)&&(c=Gd(b))&&Gd(c);return c?a==c||Gd(a)==c:kb(a)}:kb,je=fb(function(a,b,c){Hd.call(a,c)?a[c]++:a[c]=1}),ke=fb(function(a,b,c){(Hd.call(a,c)?a[c]:a[c]=[]).push(b)}),le=fb(function(a,b,c){a[c]=b}),me=_b,ne=Vb,oe=jb(oe=pd.now)&&oe||function(){return(new pd).getTime()},pe=8==Ud(u+"08")?Ud:function(a,b){return Ud(Jb(a)?a.replace(C,""):a,b||0)};return o.after=Hc,o.assign=ee,o.at=Sb,o.bind=Ic,o.bindAll=Jc,o.bindKey=Kc,o.chain=id,o.compact=lc,o.compose=Lc,o.constant=Wc,o.countBy=je,o.create=pb,o.createCallback=Xc,o.curry=Mc,o.debounce=Nc,o.defaults=fe,o.defer=Oc,o.delay=Pc,o.difference=mc,o.filter=Vb,o.flatten=qc,o.forEach=Yb,o.forEachRight=Zb,o.forIn=ge,o.forInRight=sb,o.forOwn=he,o.forOwnRight=tb,o.functions=ub,o.groupBy=ke,o.indexBy=le,o.initial=sc,o.intersection=tc,o.invert=wb,o.invoke=$b,o.keys=_d,o.map=_b,o.mapValues=Lb,o.max=ac,o.memoize=Qc,o.merge=Mb,o.min=bc,o.omit=Nb,o.once=Rc,o.pairs=Ob,o.partial=Sc,o.partialRight=Tc,o.pick=Pb,o.pluck=me,o.property=bd,o.pull=wc,o.range=xc,o.reject=ec,o.remove=yc,o.rest=zc,o.shuffle=gc,o.sortBy=jc,o.tap=jd,o.throttle=Uc,o.times=fd,o.toArray=kc,o.transform=Qb,o.union=Bc,o.uniq=Cc,o.values=Rb,o.where=ne,o.without=Dc,o.wrap=Vc,o.xor=Ec,o.zip=Fc,o.zipObject=Gc,o.collect=_b,o.drop=zc,o.each=Yb,o.eachRight=Zb,o.extend=ee,o.methods=ub,o.object=Gc,o.select=Vb,o.tail=zc,o.unique=Cc,o.unzip=Fc,$c(o),o.clone=nb,o.cloneDeep=ob,o.contains=Tb,o.escape=Yc,o.every=Ub,o.find=Wb,o.findIndex=nc,o.findKey=qb,o.findLast=Xb,o.findLastIndex=oc,o.findLastKey=rb,o.has=vb,o.identity=Zc,o.indexOf=rc,o.isArguments=mb,o.isArray=Zd,o.isBoolean=xb,o.isDate=yb,o.isElement=zb,o.isEmpty=Ab,o.isEqual=Bb,o.isFinite=Cb,o.isFunction=Db,o.isNaN=Fb,o.isNull=Gb,o.isNumber=Hb,o.isObject=Eb,o.isPlainObject=ie,o.isRegExp=Ib,o.isString=Jb,o.isUndefined=Kb,o.lastIndexOf=vc,o.mixin=$c,o.noConflict=_c,o.noop=ad,o.now=oe,o.parseInt=pe,o.random=cd,o.reduce=cc,o.reduceRight=dc,o.result=dd,o.runInContext=m,o.size=hc,o.some=ic,o.sortedIndex=Ac,o.template=ed,o.unescape=gd,o.uniqueId=hd,o.all=Ub,o.any=ic,o.detect=Wb,o.findWhere=Wb,o.foldl=cc,o.foldr=dc,o.include=Tb,o.inject=cc,$c(function(){var a={};return he(o,function(b,c){o.prototype[c]||(a[c]=b)}),a}(),!1),o.first=pc,o.last=uc,o.sample=fc,o.take=pc,o.head=pc,he(o,function(a,b){var c="sample"!==b;o.prototype[b]||(o.prototype[b]=function(b,d){var e=this.__chain__,f=a(this.__wrapped__,b,d);return e||null!=b&&(!d||c&&"function"==typeof b)?new p(f,e):f})}),o.VERSION="2.4.1",o.prototype.chain=kd,o.prototype.toString=ld,o.prototype.value=md,o.prototype.valueOf=md,Yb(["join","pop","shift"],function(a){var b=xd[a];o.prototype[a]=function(){var a=this.__chain__,c=b.apply(this.__wrapped__,arguments);return a?new p(c,a):c}}),Yb(["push","reverse","sort","unshift"],function(a){var b=xd[a];o.prototype[a]=function(){return b.apply(this.__wrapped__,arguments),this}}),Yb(["concat","slice","splice"],function(a){var b=xd[a];o.prototype[a]=function(){return new p(b.apply(this.__wrapped__,arguments),this.__chain__)}}),o}var n,o=[],p=[],q=0,r=+new Date+"",s=75,t=40,u=" \f \n\r\u2028\u2029 ",v=/\b__p \+= '';/g,w=/\b(__p \+=) '' \+/g,x=/(__e\(.*?\)|\b__t\)) \+\n'';/g,y=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,z=/\w*$/,A=/^\s*function[ \n\r\t]+\w/,B=/<%=([\s\S]+?)%>/g,C=RegExp("^["+u+"]*0+(?=.$)"),D=/($^)/,E=/\bthis\b/,F=/['\n\r\t\u2028\u2029\\]/g,G=["Array","Boolean","Date","Function","Math","Number","Object","RegExp","String","_","attachEvent","clearTimeout","isFinite","isNaN","parseInt","setTimeout"],H=0,I="[object Arguments]",J="[object Array]",K="[object Boolean]",L="[object Date]",M="[object Function]",N="[object Number]",O="[object Object]",P="[object RegExp]",Q="[object String]",R={};R[M]=!1,R[I]=R[J]=R[K]=R[L]=R[N]=R[O]=R[P]=R[Q]=!0;var S={leading:!1,maxWait:0,trailing:!1},T={configurable:!1,enumerable:!1,value:null,writable:!1},U={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},V={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},W=U[typeof window]&&window||this,X=U[typeof exports]&&exports&&!exports.nodeType&&exports,Y=U[typeof module]&&module&&!module.nodeType&&module,Z=Y&&Y.exports===X&&X,$=U[typeof global]&&global;!$||$.global!==$&&$.window!==$||(W=$);var _=m();if("function"==typeof define&&"object"==typeof define.amd&&define.amd)W._=_,define(function(){return _});else{if(!X||!Y)return W._=W._||{},W._=_,W._;Z?(Y.exports=_)._=_:X._=_}}).call(this),!function(a,b){"use strict";function c(a,b){var c,d,e=a.toLowerCase();for(b=[].concat(b),c=0;c<b.length;c+=1)if(d=b[c]){if(d.test&&d.test(a))return!0;if(d.toLowerCase()===e)return!0}}var d=b.prototype.trim,e=b.prototype.trimRight,f=b.prototype.trimLeft,g=function(a){return 1*a||0},h=function(a,b){if(1>b)return"";for(var c="";b>0;)1&b&&(c+=a),b>>=1,a+=a;return c},i=[].slice,j=function(a){return null==a?"\\s":a.source?a.source:"["+o.escapeRegExp(a)+"]"},k={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},l={};for(var m in k)l[k[m]]=m;l["'"]="#39";var n=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var c=h,d=function(){return d.cache.hasOwnProperty(arguments[0])||(d.cache[arguments[0]]=d.parse(arguments[0])),d.format.call(null,d.cache[arguments[0]],arguments)};return d.format=function(d,e){var f,g,h,i,j,k,l,m=1,o=d.length,p="",q=[];for(g=0;o>g;g++)if(p=a(d[g]),"string"===p)q.push(d[g]);else if("array"===p){if(i=d[g],i[2])for(f=e[m],h=0;h<i[2].length;h++){if(!f.hasOwnProperty(i[2][h]))throw new Error(n('[_.sprintf] property "%s" does not exist',i[2][h]));f=f[i[2][h]]}else f=i[1]?e[i[1]]:e[m++];if(/[^s]/.test(i[8])&&"number"!=a(f))throw new Error(n("[_.sprintf] expecting number but found %s",a(f)));switch(i[8]){case"b":f=f.toString(2);break;case"c":f=b.fromCharCode(f);break;case"d":f=parseInt(f,10);break;case"e":f=i[7]?f.toExponential(i[7]):f.toExponential();break;case"f":f=i[7]?parseFloat(f).toFixed(i[7]):parseFloat(f);break;case"o":f=f.toString(8);break;case"s":f=(f=b(f))&&i[7]?f.substring(0,i[7]):f;break;case"u":f=Math.abs(f);break;case"x":f=f.toString(16);break;case"X":f=f.toString(16).toUpperCase()}f=/[def]/.test(i[8])&&i[3]&&f>=0?"+"+f:f,k=i[4]?"0"==i[4]?"0":i[4].charAt(1):" ",l=i[6]-b(f).length,j=i[6]?c(k,l):"",q.push(i[5]?f+j:j+f)}return q.join("")},d.cache={},d.parse=function(a){for(var b=a,c=[],d=[],e=0;b;){if(null!==(c=/^[^\x25]+/.exec(b)))d.push(c[0]);else if(null!==(c=/^\x25{2}/.exec(b)))d.push("%");else{if(null===(c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b)))throw new Error("[_.sprintf] huh?");if(c[2]){e|=1;var f=[],g=c[2],h=[];if(null===(h=/^([a-z_][a-z_\d]*)/i.exec(g)))throw new Error("[_.sprintf] huh?");for(f.push(h[1]);""!==(g=g.substring(h[0].length));)if(null!==(h=/^\.([a-z_][a-z_\d]*)/i.exec(g)))f.push(h[1]);else{if(null===(h=/^\[(\d+)\]/.exec(g)))throw new Error("[_.sprintf] huh?");f.push(h[1])}c[2]=f}else e|=2;if(3===e)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");d.push(c)}b=b.substring(c[0].length)}return d},d}(),o={VERSION:"2.3.0",isBlank:function(a){return null==a&&(a=""),/^\s*$/.test(a)},stripTags:function(a){return null==a?"":b(a).replace(/<\/?[^>]+>/g,"")},capitalize:function(a){return a=null==a?"":b(a),a.charAt(0).toUpperCase()+a.slice(1)},chop:function(a,c){return null==a?[]:(a=b(a),c=~~c,c>0?a.match(new RegExp(".{1,"+c+"}","g")):[a])},clean:function(a){return o.strip(a).replace(/\s+/g," ")},count:function(a,c){if(null==a||null==c)return 0;a=b(a),c=b(c);for(var d=0,e=0,f=c.length;;){if(e=a.indexOf(c,e),-1===e)break;d++,e+=f}return d},chars:function(a){return null==a?[]:b(a).split("")},swapCase:function(a){return null==a?"":b(a).replace(/\S/g,function(a){return a===a.toUpperCase()?a.toLowerCase():a.toUpperCase()})},escapeHTML:function(a){return null==a?"":b(a).replace(/[&<>"']/g,function(a){return"&"+l[a]+";"
})},unescapeHTML:function(a){return null==a?"":b(a).replace(/\&([^;]+);/g,function(a,c){var d;return c in k?k[c]:(d=c.match(/^#x([\da-fA-F]+)$/))?b.fromCharCode(parseInt(d[1],16)):(d=c.match(/^#(\d+)$/))?b.fromCharCode(~~d[1]):a})},escapeRegExp:function(a){return null==a?"":b(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(a,b,c,d){var e=o.chars(a);return e.splice(~~b,~~c,d),e.join("")},insert:function(a,b,c){return o.splice(a,b,0,c)},include:function(a,c){return""===c?!0:null==a?!1:-1!==b(a).indexOf(c)},join:function(){var a=i.call(arguments),b=a.shift();return null==b&&(b=""),a.join(b)},lines:function(a){return null==a?[]:b(a).split("\n")},reverse:function(a){return o.chars(a).reverse().join("")},startsWith:function(a,c){return""===c?!0:null==a||null==c?!1:(a=b(a),c=b(c),a.length>=c.length&&a.slice(0,c.length)===c)},endsWith:function(a,c){return""===c?!0:null==a||null==c?!1:(a=b(a),c=b(c),a.length>=c.length&&a.slice(a.length-c.length)===c)},succ:function(a){return null==a?"":(a=b(a),a.slice(0,-1)+b.fromCharCode(a.charCodeAt(a.length-1)+1))},titleize:function(a){return null==a?"":(a=b(a).toLowerCase(),a.replace(/(?:^|\s|-)\S/g,function(a){return a.toUpperCase()}))},camelize:function(a){return o.trim(a).replace(/[-_\s]+(.)?/g,function(a,b){return b?b.toUpperCase():""})},underscored:function(a){return o.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(a){return o.trim(a).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(a){return o.titleize(b(a).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(a){return o.capitalize(o.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:function(a,c){return null==a?"":!c&&d?d.call(a):(c=j(c),b(a).replace(new RegExp("^"+c+"+|"+c+"+$","g"),""))},ltrim:function(a,c){return null==a?"":!c&&f?f.call(a):(c=j(c),b(a).replace(new RegExp("^"+c+"+"),""))},rtrim:function(a,c){return null==a?"":!c&&e?e.call(a):(c=j(c),b(a).replace(new RegExp(c+"+$"),""))},truncate:function(a,c,d){return null==a?"":(a=b(a),d=d||"...",c=~~c,a.length>c?a.slice(0,c)+d:a)},prune:function(a,c,d){if(null==a)return"";if(a=b(a),c=~~c,d=null!=d?b(d):"...",a.length<=c)return a;var e=function(a){return a.toUpperCase()!==a.toLowerCase()?"A":" "},f=a.slice(0,c+1).replace(/.(?=\W*\w*$)/g,e);return f=f.slice(f.length-2).match(/\w\w/)?f.replace(/\s*\S+$/,""):o.rtrim(f.slice(0,f.length-1)),(f+d).length>a.length?a:a.slice(0,f.length)+d},words:function(a,b){return o.isBlank(a)?[]:o.trim(a,b).split(b||/\s+/)},pad:function(a,c,d,e){a=null==a?"":b(a),c=~~c;var f=0;switch(d?d.length>1&&(d=d.charAt(0)):d=" ",e){case"right":return f=c-a.length,a+h(d,f);case"both":return f=c-a.length,h(d,Math.ceil(f/2))+a+h(d,Math.floor(f/2));default:return f=c-a.length,h(d,f)+a}},lpad:function(a,b,c){return o.pad(a,b,c)},rpad:function(a,b,c){return o.pad(a,b,c,"right")},lrpad:function(a,b,c){return o.pad(a,b,c,"both")},sprintf:n,vsprintf:function(a,b){return b.unshift(a),n.apply(null,b)},toNumber:function(a,b){return a?(a=o.trim(a),a.match(/^-?\d+(?:\.\d+)?$/)?g(g(a).toFixed(~~b)):0/0):0},numberFormat:function(a,b,c,d){if(isNaN(a)||null==a)return"";a=a.toFixed(~~b),d="string"==typeof d?d:",";var e=a.split("."),f=e[0],g=e[1]?(c||".")+e[1]:"";return f.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+d)+g},strRight:function(a,c){if(null==a)return"";a=b(a),c=null!=c?b(c):c;var d=c?a.indexOf(c):-1;return~d?a.slice(d+c.length,a.length):a},strRightBack:function(a,c){if(null==a)return"";a=b(a),c=null!=c?b(c):c;var d=c?a.lastIndexOf(c):-1;return~d?a.slice(d+c.length,a.length):a},strLeft:function(a,c){if(null==a)return"";a=b(a),c=null!=c?b(c):c;var d=c?a.indexOf(c):-1;return~d?a.slice(0,d):a},strLeftBack:function(a,b){if(null==a)return"";a+="",b=null!=b?""+b:b;var c=a.lastIndexOf(b);return~c?a.slice(0,c):a},toSentence:function(a,b,c,d){b=b||", ",c=c||" and ";var e=a.slice(),f=e.pop();return a.length>2&&d&&(c=o.rtrim(b)+c),e.length?e.join(b)+c+f:f},toSentenceSerial:function(){var a=i.call(arguments);return a[3]=!0,o.toSentence.apply(o,a)},slugify:function(a){if(null==a)return"";var c="ąàáäâãåæăćęèéëêìíïîłńòóöôõøśșțùúüûñçżź",d="aaaaaaaaaceeeeeiiiilnoooooosstuuuunczz",e=new RegExp(j(c),"g");return a=b(a).toLowerCase().replace(e,function(a){var b=c.indexOf(a);return d.charAt(b)||"-"}),o.dasherize(a.replace(/[^\w\s-]/g,""))},surround:function(a,b){return[b,a,b].join("")},quote:function(a,b){return o.surround(a,b||'"')},unquote:function(a,b){return b=b||'"',a[0]===b&&a[a.length-1]===b?a.slice(1,a.length-1):a},exports:function(){var a={};for(var b in this)this.hasOwnProperty(b)&&!b.match(/^(?:include|contains|reverse)$/)&&(a[b]=this[b]);return a},repeat:function(a,c,d){if(null==a)return"";if(c=~~c,null==d)return h(b(a),c);for(var e=[];c>0;e[--c]=a);return e.join(d)},naturalCmp:function(a,c){if(a==c)return 0;if(!a)return-1;if(!c)return 1;for(var d=/(\.\d+)|(\d+)|(\D+)/g,e=b(a).toLowerCase().match(d),f=b(c).toLowerCase().match(d),g=Math.min(e.length,f.length),h=0;g>h;h++){var i=e[h],j=f[h];if(i!==j){var k=parseInt(i,10);if(!isNaN(k)){var l=parseInt(j,10);if(!isNaN(l)&&k-l)return k-l}return j>i?-1:1}}return e.length===f.length?e.length-f.length:c>a?-1:1},levenshtein:function(a,c){if(null==a&&null==c)return 0;if(null==a)return b(c).length;if(null==c)return b(a).length;a=b(a),c=b(c);for(var d,e,f=[],g=0;g<=c.length;g++)for(var h=0;h<=a.length;h++)e=g&&h?a.charAt(h-1)===c.charAt(g-1)?d:Math.min(f[h],f[h-1],d)+1:g+h,d=f[h],f[h]=e;return f.pop()},toBoolean:function(a,b,d){return"number"==typeof a&&(a=""+a),"string"!=typeof a?!!a:(a=o.trim(a),c(a,b||["true","1"])?!0:c(a,d||["false","0"])?!1:void 0)}};o.strip=o.trim,o.lstrip=o.ltrim,o.rstrip=o.rtrim,o.center=o.lrpad,o.rjust=o.lpad,o.ljust=o.rpad,o.contains=o.include,o.q=o.quote,o.toBool=o.toBoolean,"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(module.exports=o),exports._s=o),"function"==typeof define&&define.amd&&define("underscore.string",[],function(){return o}),a._=a._||{},a._.string=a._.str=o}(this,String),function(a){function b(a,b,c){switch(arguments.length){case 2:return null!=a?a:b;case 3:return null!=a?a:null!=b?b:c;default:throw new Error("Implement me")}}function c(a,b){return Bb.call(a,b)}function d(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function e(a){vb.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+a)}function f(a,b){var c=!0;return o(function(){return c&&(e(a),c=!1),b.apply(this,arguments)},b)}function g(a,b){sc[a]||(e(b),sc[a]=!0)}function h(a,b){return function(c){return r(a.call(this,c),b)}}function i(a,b){return function(c){return this.localeData().ordinal(a.call(this,c),b)}}function j(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function k(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function l(){}function m(a,b){b!==!1&&H(a),p(this,a),this._d=new Date(+a._d),uc===!1&&(uc=!0,vb.updateOffset(this),uc=!1)}function n(a){var b=A(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=vb.localeData(),this._bubble()}function o(a,b){for(var d in b)c(b,d)&&(a[d]=b[d]);return c(b,"toString")&&(a.toString=b.toString),c(b,"valueOf")&&(a.valueOf=b.valueOf),a}function p(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=b._pf),"undefined"!=typeof b._locale&&(a._locale=b._locale),Kb.length>0)for(c in Kb)d=Kb[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function q(a){return 0>a?Math.ceil(a):Math.floor(a)}function r(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function s(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function t(a,b){var c;return b=M(b,a),a.isBefore(b)?c=s(a,b):(c=s(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function u(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(g(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=vb.duration(c,d),v(this,e,a),this}}function v(a,b,c,d){var e=b._milliseconds,f=b._days,g=b._months;d=null==d?!0:d,e&&a._d.setTime(+a._d+e*c),f&&pb(a,"Date",ob(a,"Date")+f*c),g&&nb(a,ob(a,"Month")+g*c),d&&vb.updateOffset(a,f||g)}function w(a){return"[object Array]"===Object.prototype.toString.call(a)}function x(a){return"[object Date]"===Object.prototype.toString.call(a)||a instanceof Date}function y(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&C(a[d])!==C(b[d]))&&g++;return g+f}function z(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=lc[a]||mc[b]||b}return a}function A(a){var b,d,e={};for(d in a)c(a,d)&&(b=z(d),b&&(e[b]=a[d]));return e}function B(b){var c,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}vb[b]=function(e,f){var g,h,i=vb._locale[b],j=[];if("number"==typeof e&&(f=e,e=a),h=function(a){var b=vb().utc().set(d,a);return i.call(vb._locale,b,e||"")},null!=f)return h(f);for(g=0;c>g;g++)j.push(h(g));return j}}function C(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function D(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function E(a,b,c){return jb(vb([a,11,31+b-c]),b,c).week}function F(a){return G(a)?366:365}function G(a){return a%4===0&&a%100!==0||a%400===0}function H(a){var b;a._a&&-2===a._pf.overflow&&(b=a._a[Db]<0||a._a[Db]>11?Db:a._a[Eb]<1||a._a[Eb]>D(a._a[Cb],a._a[Db])?Eb:a._a[Fb]<0||a._a[Fb]>24||24===a._a[Fb]&&(0!==a._a[Gb]||0!==a._a[Hb]||0!==a._a[Ib])?Fb:a._a[Gb]<0||a._a[Gb]>59?Gb:a._a[Hb]<0||a._a[Hb]>59?Hb:a._a[Ib]<0||a._a[Ib]>999?Ib:-1,a._pf._overflowDayOfYear&&(Cb>b||b>Eb)&&(b=Eb),a._pf.overflow=b)}function I(b){return null==b._isValid&&(b._isValid=!isNaN(b._d.getTime())&&b._pf.overflow<0&&!b._pf.empty&&!b._pf.invalidMonth&&!b._pf.nullInput&&!b._pf.invalidFormat&&!b._pf.userInvalidated,b._strict&&(b._isValid=b._isValid&&0===b._pf.charsLeftOver&&0===b._pf.unusedTokens.length&&b._pf.bigHour===a)),b._isValid}function J(a){return a?a.toLowerCase().replace("_","-"):a}function K(a){for(var b,c,d,e,f=0;f<a.length;){for(e=J(a[f]).split("-"),b=e.length,c=J(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=L(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&y(e,c,!0)>=b-1)break;b--}f++}return null}function L(a){var b=null;if(!Jb[a]&&Lb)try{b=vb.locale(),require("./locale/"+a),vb.locale(b)}catch(c){}return Jb[a]}function M(a,b){var c,d;return b._isUTC?(c=b.clone(),d=(vb.isMoment(a)||x(a)?+a:+vb(a))-+c,c._d.setTime(+c._d+d),vb.updateOffset(c,!1),c):vb(a).local()}function N(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function O(a){var b,c,d=a.match(Pb);for(b=0,c=d.length;c>b;b++)d[b]=rc[d[b]]?rc[d[b]]:N(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function P(a,b){return a.isValid()?(b=Q(b,a.localeData()),nc[b]||(nc[b]=O(b)),nc[b](a)):a.localeData().invalidDate()}function Q(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Qb.lastIndex=0;d>=0&&Qb.test(a);)a=a.replace(Qb,c),Qb.lastIndex=0,d-=1;return a}function R(a,b){var c,d=b._strict;switch(a){case"Q":return _b;case"DDDD":return bc;case"YYYY":case"GGGG":case"gggg":return d?cc:Tb;case"Y":case"G":case"g":return ec;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return d?dc:Ub;case"S":if(d)return _b;case"SS":if(d)return ac;case"SSS":if(d)return bc;case"DDD":return Sb;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return Wb;case"a":case"A":return b._locale._meridiemParse;case"x":return Zb;case"X":return $b;case"Z":case"ZZ":return Xb;case"T":return Yb;case"SSSS":return Vb;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return d?ac:Rb;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return Rb;case"Do":return d?b._locale._ordinalParse:b._locale._ordinalParseLenient;default:return c=new RegExp($(Z(a.replace("\\","")),"i"))}}function S(a){a=a||"";var b=a.match(Xb)||[],c=b[b.length-1]||[],d=(c+"").match(jc)||["-",0,0],e=+(60*d[1])+C(d[2]);return"+"===d[0]?e:-e}function T(a,b,c){var d,e=c._a;switch(a){case"Q":null!=b&&(e[Db]=3*(C(b)-1));break;case"M":case"MM":null!=b&&(e[Db]=C(b)-1);break;case"MMM":case"MMMM":d=c._locale.monthsParse(b,a,c._strict),null!=d?e[Db]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[Eb]=C(b));break;case"Do":null!=b&&(e[Eb]=C(parseInt(b.match(/\d{1,2}/)[0],10)));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=C(b));break;case"YY":e[Cb]=vb.parseTwoDigitYear(b);break;case"YYYY":case"YYYYY":case"YYYYYY":e[Cb]=C(b);break;case"a":case"A":c._meridiem=b;break;case"h":case"hh":c._pf.bigHour=!0;case"H":case"HH":e[Fb]=C(b);break;case"m":case"mm":e[Gb]=C(b);break;case"s":case"ss":e[Hb]=C(b);break;case"S":case"SS":case"SSS":case"SSSS":e[Ib]=C(1e3*("0."+b));break;case"x":c._d=new Date(C(b));break;case"X":c._d=new Date(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=S(b);break;case"dd":case"ddd":case"dddd":d=c._locale.weekdaysParse(b),null!=d?(c._w=c._w||{},c._w.d=d):c._pf.invalidWeekday=b;break;case"w":case"ww":case"W":case"WW":case"d":case"e":case"E":a=a.substr(0,1);case"gggg":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=C(b));break;case"gg":case"GG":c._w=c._w||{},c._w[a]=vb.parseTwoDigitYear(b)}}function U(a){var c,d,e,f,g,h,i;c=a._w,null!=c.GG||null!=c.W||null!=c.E?(g=1,h=4,d=b(c.GG,a._a[Cb],jb(vb(),1,4).year),e=b(c.W,1),f=b(c.E,1)):(g=a._locale._week.dow,h=a._locale._week.doy,d=b(c.gg,a._a[Cb],jb(vb(),g,h).year),e=b(c.w,1),null!=c.d?(f=c.d,g>f&&++e):f=null!=c.e?c.e+g:g),i=kb(d,e,f,h,g),a._a[Cb]=i.year,a._dayOfYear=i.dayOfYear}function V(a){var c,d,e,f,g=[];if(!a._d){for(e=X(a),a._w&&null==a._a[Eb]&&null==a._a[Db]&&U(a),a._dayOfYear&&(f=b(a._a[Cb],e[Cb]),a._dayOfYear>F(f)&&(a._pf._overflowDayOfYear=!0),d=fb(f,0,a._dayOfYear),a._a[Db]=d.getUTCMonth(),a._a[Eb]=d.getUTCDate()),c=0;3>c&&null==a._a[c];++c)a._a[c]=g[c]=e[c];for(;7>c;c++)a._a[c]=g[c]=null==a._a[c]?2===c?1:0:a._a[c];24===a._a[Fb]&&0===a._a[Gb]&&0===a._a[Hb]&&0===a._a[Ib]&&(a._nextDay=!0,a._a[Fb]=0),a._d=(a._useUTC?fb:eb).apply(null,g),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[Fb]=24)}}function W(a){var b;a._d||(b=A(a._i),a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],V(a))}function X(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function Y(b){if(b._f===vb.ISO_8601)return void ab(b);b._a=[],b._pf.empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Q(b._f,b._locale).match(Pb)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(R(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&b._pf.unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),rc[f]?(d?b._pf.empty=!1:b._pf.unusedTokens.push(f),T(f,d,b)):b._strict&&!d&&b._pf.unusedTokens.push(f);b._pf.charsLeftOver=i-j,h.length>0&&b._pf.unusedInput.push(h),b._pf.bigHour===!0&&b._a[Fb]<=12&&(b._pf.bigHour=a),b._a[Fb]=k(b._locale,b._a[Fb],b._meridiem),V(b),H(b)}function Z(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e})}function $(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function _(a){var b,c,e,f,g;if(0===a._f.length)return a._pf.invalidFormat=!0,void(a._d=new Date(0/0));for(f=0;f<a._f.length;f++)g=0,b=p({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._pf=d(),b._f=a._f[f],Y(b),I(b)&&(g+=b._pf.charsLeftOver,g+=10*b._pf.unusedTokens.length,b._pf.score=g,(null==e||e>g)&&(e=g,c=b));o(a,c||b)}function ab(a){var b,c,d=a._i,e=fc.exec(d);if(e){for(a._pf.iso=!0,b=0,c=hc.length;c>b;b++)if(hc[b][1].exec(d)){a._f=hc[b][0]+(e[6]||" ");break}for(b=0,c=ic.length;c>b;b++)if(ic[b][1].exec(d)){a._f+=ic[b][0];break}d.match(Xb)&&(a._f+="Z"),Y(a)}else a._isValid=!1}function bb(a){ab(a),a._isValid===!1&&(delete a._isValid,vb.createFromInputFallback(a))}function cb(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function db(b){var c,d=b._i;d===a?b._d=new Date:x(d)?b._d=new Date(+d):null!==(c=Mb.exec(d))?b._d=new Date(+c[1]):"string"==typeof d?bb(b):w(d)?(b._a=cb(d.slice(0),function(a){return parseInt(a,10)}),V(b)):"object"==typeof d?W(b):"number"==typeof d?b._d=new Date(d):vb.createFromInputFallback(b)}function eb(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function fb(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function gb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function hb(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function ib(a,b,c){var d=vb.duration(a).abs(),e=Ab(d.as("s")),f=Ab(d.as("m")),g=Ab(d.as("h")),h=Ab(d.as("d")),i=Ab(d.as("M")),j=Ab(d.as("y")),k=e<oc.s&&["s",e]||1===f&&["m"]||f<oc.m&&["mm",f]||1===g&&["h"]||g<oc.h&&["hh",g]||1===h&&["d"]||h<oc.d&&["dd",h]||1===i&&["M"]||i<oc.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,hb.apply({},k)}function jb(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=vb(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function kb(a,b,c,d,e){var f,g,h=fb(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:F(a-1)+g}}function lb(b){var c,d=b._i,e=b._f;return b._locale=b._locale||vb.localeData(b._l),null===d||e===a&&""===d?vb.invalid({nullInput:!0}):("string"==typeof d&&(b._i=d=b._locale.preparse(d)),vb.isMoment(d)?new m(d,!0):(e?w(e)?_(b):Y(b):db(b),c=new m(b),c._nextDay&&(c.add(1,"d"),c._nextDay=a),c))}function mb(a,b){var c,d;if(1===b.length&&w(b[0])&&(b=b[0]),!b.length)return vb();for(c=b[0],d=1;d<b.length;++d)b[d][a](c)&&(c=b[d]);return c}function nb(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),D(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function ob(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function pb(a,b,c){return"Month"===b?nb(a,c):a._d["set"+(a._isUTC?"UTC":"")+b](c)}function qb(a,b){return function(c){return null!=c?(pb(this,a,c),vb.updateOffset(this,b),this):ob(this,a)}}function rb(a){return 400*a/146097}function sb(a){return 146097*a/400}function tb(a){vb.duration.fn[a]=function(){return this._data[a]}}function ub(a){"undefined"==typeof ender&&(wb=zb.moment,zb.moment=a?f("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.",vb):vb)}for(var vb,wb,xb,yb="2.9.0",zb="undefined"==typeof global||"undefined"!=typeof window&&window!==global.window?this:global,Ab=Math.round,Bb=Object.prototype.hasOwnProperty,Cb=0,Db=1,Eb=2,Fb=3,Gb=4,Hb=5,Ib=6,Jb={},Kb=[],Lb="undefined"!=typeof module&&module&&module.exports,Mb=/^\/?Date\((\-?\d+)/i,Nb=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Ob=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,Pb=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Qb=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Rb=/\d\d?/,Sb=/\d{1,3}/,Tb=/\d{1,4}/,Ub=/[+\-]?\d{1,6}/,Vb=/\d+/,Wb=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Xb=/Z|[\+\-]\d\d:?\d\d/gi,Yb=/T/i,Zb=/[\+\-]?\d+/,$b=/[\+\-]?\d+(\.\d{1,3})?/,_b=/\d/,ac=/\d\d/,bc=/\d{3}/,cc=/\d{4}/,dc=/[+-]?\d{6}/,ec=/[+-]?\d+/,fc=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,gc="YYYY-MM-DDTHH:mm:ssZ",hc=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],ic=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],jc=/([\+\-]|\d\d)/gi,kc=("Date|Hours|Minutes|Seconds|Milliseconds".split("|"),{Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6}),lc={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},mc={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},nc={},oc={s:45,m:45,h:22,d:26,M:11},pc="DDD w W M D d".split(" "),qc="M D H h m s w W".split(" "),rc={M:function(){return this.month()+1},MMM:function(a){return this.localeData().monthsShort(this,a)},MMMM:function(a){return this.localeData().months(this,a)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.localeData().weekdaysMin(this,a)},ddd:function(a){return this.localeData().weekdaysShort(this,a)},dddd:function(a){return this.localeData().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return r(this.year()%100,2)},YYYY:function(){return r(this.year(),4)},YYYYY:function(){return r(this.year(),5)},YYYYYY:function(){var a=this.year(),b=a>=0?"+":"-";return b+r(Math.abs(a),6)},gg:function(){return r(this.weekYear()%100,2)},gggg:function(){return r(this.weekYear(),4)},ggggg:function(){return r(this.weekYear(),5)},GG:function(){return r(this.isoWeekYear()%100,2)},GGGG:function(){return r(this.isoWeekYear(),4)},GGGGG:function(){return r(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.localeData().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return C(this.milliseconds()/100)},SS:function(){return r(C(this.milliseconds()/10),2)},SSS:function(){return r(this.milliseconds(),3)},SSSS:function(){return r(this.milliseconds(),3)},Z:function(){var a=this.utcOffset(),b="+";return 0>a&&(a=-a,b="-"),b+r(C(a/60),2)+":"+r(C(a)%60,2)},ZZ:function(){var a=this.utcOffset(),b="+";return 0>a&&(a=-a,b="-"),b+r(C(a/60),2)+r(C(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},x:function(){return this.valueOf()},X:function(){return this.unix()},Q:function(){return this.quarter()}},sc={},tc=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"],uc=!1;pc.length;)xb=pc.pop(),rc[xb+"o"]=i(rc[xb],xb);for(;qc.length;)xb=qc.pop(),rc[xb+xb]=h(rc[xb],2);rc.DDDD=h(rc.DDD,3),o(l.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){return this._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=vb.utc([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=vb([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.apply(b,[c]):d},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",_ordinalParse:/\d{1,2}/,preparse:function(a){return a},postformat:function(a){return a},week:function(a){return jb(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},firstDayOfWeek:function(){return this._week.dow},firstDayOfYear:function(){return this._week.doy},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}}),vb=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._i=b,g._f=c,g._l=e,g._strict=f,g._isUTC=!1,g._pf=d(),lb(g)},vb.suppressDeprecationWarnings=!1,vb.createFromInputFallback=f("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),vb.min=function(){var a=[].slice.call(arguments,0);return mb("isBefore",a)},vb.max=function(){var a=[].slice.call(arguments,0);return mb("isAfter",a)},vb.utc=function(b,c,e,f){var g;return"boolean"==typeof e&&(f=e,e=a),g={},g._isAMomentObject=!0,g._useUTC=!0,g._isUTC=!0,g._l=e,g._i=b,g._f=c,g._strict=f,g._pf=d(),lb(g).utc()},vb.unix=function(a){return vb(1e3*a)},vb.duration=function(a,b){var d,e,f,g,h=a,i=null;return vb.isDuration(a)?h={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(h={},b?h[b]=a:h.milliseconds=a):(i=Nb.exec(a))?(d="-"===i[1]?-1:1,h={y:0,d:C(i[Eb])*d,h:C(i[Fb])*d,m:C(i[Gb])*d,s:C(i[Hb])*d,ms:C(i[Ib])*d}):(i=Ob.exec(a))?(d="-"===i[1]?-1:1,f=function(a){var b=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*d},h={y:f(i[2]),M:f(i[3]),d:f(i[4]),h:f(i[5]),m:f(i[6]),s:f(i[7]),w:f(i[8])}):null==h?h={}:"object"==typeof h&&("from"in h||"to"in h)&&(g=t(vb(h.from),vb(h.to)),h={},h.ms=g.milliseconds,h.M=g.months),e=new n(h),vb.isDuration(a)&&c(a,"_locale")&&(e._locale=a._locale),e},vb.version=yb,vb.defaultFormat=gc,vb.ISO_8601=function(){},vb.momentProperties=Kb,vb.updateOffset=function(){},vb.relativeTimeThreshold=function(b,c){return oc[b]===a?!1:c===a?oc[b]:(oc[b]=c,!0)},vb.lang=f("moment.lang is deprecated. Use moment.locale instead.",function(a,b){return vb.locale(a,b)}),vb.locale=function(a,b){var c;return a&&(c="undefined"!=typeof b?vb.defineLocale(a,b):vb.localeData(a),c&&(vb.duration._locale=vb._locale=c)),vb._locale._abbr},vb.defineLocale=function(a,b){return null!==b?(b.abbr=a,Jb[a]||(Jb[a]=new l),Jb[a].set(b),vb.locale(a),Jb[a]):(delete Jb[a],null)},vb.langData=f("moment.langData is deprecated. Use moment.localeData instead.",function(a){return vb.localeData(a)}),vb.localeData=function(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return vb._locale;if(!w(a)){if(b=L(a))return b;a=[a]}return K(a)},vb.isMoment=function(a){return a instanceof m||null!=a&&c(a,"_isAMomentObject")},vb.isDuration=function(a){return a instanceof n};for(xb=tc.length-1;xb>=0;--xb)B(tc[xb]);vb.normalizeUnits=function(a){return z(a)},vb.invalid=function(a){var b=vb.utc(0/0);return null!=a?o(b._pf,a):b._pf.userInvalidated=!0,b},vb.parseZone=function(){return vb.apply(null,arguments).parseZone()},vb.parseTwoDigitYear=function(a){return C(a)+(C(a)>68?1900:2e3)},vb.isDate=x,o(vb.fn=m.prototype,{clone:function(){return vb(this)},valueOf:function(){return+this._d-6e4*(this._offset||0)},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=vb(this).utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():P(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):P(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return I(this)},isDSTShifted:function(){return this._a?this.isValid()&&y(this._a,(this._isUTC?vb.utc(this._a):vb(this._a)).toArray())>0:!1},parsingFlags:function(){return o({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(a){return this.utcOffset(0,a)},local:function(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(this._dateUtcOffset(),"m")),this},format:function(a){var b=P(this,a||vb.defaultFormat);return this.localeData().postformat(b)},add:u(1,"add"),subtract:u(-1,"subtract"),diff:function(a,b,c){var d,e,f=M(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=z(b),"year"===b||"month"===b||"quarter"===b?(e=j(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:q(e)},from:function(a,b){return vb.duration({to:this,from:a}).locale(this.locale()).humanize(!b)},fromNow:function(a){return this.from(vb(),a)},calendar:function(a){var b=a||vb(),c=M(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,vb(b)))
},isLeapYear:function(){return G(this.year())},isDST:function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=gb(a,this.localeData()),this.add(a-b,"d")):b},month:qb("Month",!0),startOf:function(a){switch(a=z(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this},endOf:function(b){return b=z(b),b===a||"millisecond"===b?this:this.startOf(b).add(1,"isoWeek"===b?"week":b).subtract(1,"ms")},isAfter:function(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+this>+a):(c=vb.isMoment(a)?+a:+vb(a),c<+this.clone().startOf(b))},isBefore:function(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+a>+this):(c=vb.isMoment(a)?+a:+vb(a),+this.clone().endOf(b)<c)},isBetween:function(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)},isSame:function(a,b){var c;return b=z(b||"millisecond"),"millisecond"===b?(a=vb.isMoment(a)?a:vb(a),+this===+a):(c=+vb(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))},min:f("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(a){return a=vb.apply(null,arguments),this>a?this:a}),max:f("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(a){return a=vb.apply(null,arguments),a>this?this:a}),zone:f("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",function(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}),utcOffset:function(a,b){var c,d=this._offset||0;return null!=a?("string"==typeof a&&(a=S(a)),Math.abs(a)<16&&(a=60*a),!this._isUTC&&b&&(c=this._dateUtcOffset()),this._offset=a,this._isUTC=!0,null!=c&&this.add(c,"m"),d!==a&&(!b||this._changeInProgress?v(this,vb.duration(a-d,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,vb.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?d:this._dateUtcOffset()},isLocal:function(){return!this._isUTC},isUtcOffset:function(){return this._isUTC},isUtc:function(){return this._isUTC&&0===this._offset},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(S(this._i)),this},hasAlignedHourOffset:function(a){return a=a?vb(a).utcOffset():0,(this.utcOffset()-a)%60===0},daysInMonth:function(){return D(this.year(),this.month())},dayOfYear:function(a){var b=Ab((vb(this).startOf("day")-vb(this).startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")},quarter:function(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)},weekYear:function(a){var b=jb(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")},isoWeekYear:function(a){var b=jb(this,1,4).year;return null==a?b:this.add(a-b,"y")},week:function(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")},isoWeek:function(a){var b=jb(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")},weekday:function(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return E(this.year(),1,4)},weeksInYear:function(){var a=this.localeData()._week;return E(this.year(),a.dow,a.doy)},get:function(a){return a=z(a),this[a]()},set:function(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else a=z(a),"function"==typeof this[a]&&this[a](b);return this},locale:function(b){var c;return b===a?this._locale._abbr:(c=vb.localeData(b),null!=c&&(this._locale=c),this)},lang:f("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(b){return b===a?this.localeData():this.locale(b)}),localeData:function(){return this._locale},_dateUtcOffset:function(){return 15*-Math.round(this._d.getTimezoneOffset()/15)}}),vb.fn.millisecond=vb.fn.milliseconds=qb("Milliseconds",!1),vb.fn.second=vb.fn.seconds=qb("Seconds",!1),vb.fn.minute=vb.fn.minutes=qb("Minutes",!1),vb.fn.hour=vb.fn.hours=qb("Hours",!0),vb.fn.date=qb("Date",!0),vb.fn.dates=f("dates accessor is deprecated. Use date instead.",qb("Date",!0)),vb.fn.year=qb("FullYear",!0),vb.fn.years=f("years accessor is deprecated. Use year instead.",qb("FullYear",!0)),vb.fn.days=vb.fn.day,vb.fn.months=vb.fn.month,vb.fn.weeks=vb.fn.week,vb.fn.isoWeeks=vb.fn.isoWeek,vb.fn.quarters=vb.fn.quarter,vb.fn.toJSON=vb.fn.toISOString,vb.fn.isUTC=vb.fn.isUtc,o(vb.duration.fn=n.prototype,{_bubble:function(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;g.milliseconds=d%1e3,a=q(d/1e3),g.seconds=a%60,b=q(a/60),g.minutes=b%60,c=q(b/60),g.hours=c%24,e+=q(c/24),h=q(rb(e)),e-=q(sb(h)),f+=q(e/30),e%=30,h+=q(f/12),f%=12,g.days=e,g.months=f,g.years=h},abs:function(){return this._milliseconds=Math.abs(this._milliseconds),this._days=Math.abs(this._days),this._months=Math.abs(this._months),this._data.milliseconds=Math.abs(this._data.milliseconds),this._data.seconds=Math.abs(this._data.seconds),this._data.minutes=Math.abs(this._data.minutes),this._data.hours=Math.abs(this._data.hours),this._data.months=Math.abs(this._data.months),this._data.years=Math.abs(this._data.years),this},weeks:function(){return q(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*C(this._months/12)},humanize:function(a){var b=ib(this,!a,this.localeData());return a&&(b=this.localeData().pastFuture(+this,b)),this.localeData().postformat(b)},add:function(a,b){var c=vb.duration(a,b);return this._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){var c=vb.duration(a,b);return this._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){return a=z(a),this[a.toLowerCase()+"s"]()},as:function(a){var b,c;if(a=z(a),"month"===a||"year"===a)return b=this._days+this._milliseconds/864e5,c=this._months+12*rb(b),"month"===a?c:c/12;switch(b=this._days+Math.round(sb(this._months/12)),a){case"week":return b/7+this._milliseconds/6048e5;case"day":return b+this._milliseconds/864e5;case"hour":return 24*b+this._milliseconds/36e5;case"minute":return 24*b*60+this._milliseconds/6e4;case"second":return 24*b*60*60+this._milliseconds/1e3;case"millisecond":return Math.floor(24*b*60*60*1e3)+this._milliseconds;default:throw new Error("Unknown unit "+a)}},lang:vb.fn.lang,locale:vb.fn.locale,toIsoString:f("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",function(){return this.toISOString()}),toISOString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);return this.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"},localeData:function(){return this._locale},toJSON:function(){return this.toISOString()}}),vb.duration.fn.toString=vb.duration.fn.toISOString;for(xb in kc)c(kc,xb)&&tb(xb.toLowerCase());vb.duration.fn.asMilliseconds=function(){return this.as("ms")},vb.duration.fn.asSeconds=function(){return this.as("s")},vb.duration.fn.asMinutes=function(){return this.as("m")},vb.duration.fn.asHours=function(){return this.as("h")},vb.duration.fn.asDays=function(){return this.as("d")},vb.duration.fn.asWeeks=function(){return this.as("weeks")},vb.duration.fn.asMonths=function(){return this.as("M")},vb.duration.fn.asYears=function(){return this.as("y")},vb.locale("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===C(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),Lb?module.exports=vb:"function"==typeof define&&define.amd?(define(function(a,b,c){return c.config&&c.config()&&c.config().noGlobal===!0&&(zb.moment=wb),vb}),ub(!0)):ub()}.call(this),function(){function a(a){this._value=a}function b(a,b,c,d){var e,f,g=Math.pow(10,b);return f=(c(a*g)/g).toFixed(b),d&&(e=new RegExp("0{1,"+d+"}$"),f=f.replace(e,"")),f}function c(a,b,c){var d;return d=b.indexOf("$")>-1?e(a,b,c):b.indexOf("%")>-1?f(a,b,c):b.indexOf(":")>-1?g(a,b):i(a._value,b,c)}function d(a,b){var c,d,e,f,g,i=b,j=["KB","MB","GB","TB","PB","EB","ZB","YB"],k=!1;if(b.indexOf(":")>-1)a._value=h(b);else if(b===q)a._value=0;else{for("."!==o[p].delimiters.decimal&&(b=b.replace(/\./g,"").replace(o[p].delimiters.decimal,".")),c=new RegExp("[^a-zA-Z]"+o[p].abbreviations.thousand+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),d=new RegExp("[^a-zA-Z]"+o[p].abbreviations.million+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),e=new RegExp("[^a-zA-Z]"+o[p].abbreviations.billion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),f=new RegExp("[^a-zA-Z]"+o[p].abbreviations.trillion+"(?:\\)|(\\"+o[p].currency.symbol+")?(?:\\))?)?$"),g=0;g<=j.length&&!(k=b.indexOf(j[g])>-1?Math.pow(1024,g+1):!1);g++);a._value=(k?k:1)*(i.match(c)?Math.pow(10,3):1)*(i.match(d)?Math.pow(10,6):1)*(i.match(e)?Math.pow(10,9):1)*(i.match(f)?Math.pow(10,12):1)*(b.indexOf("%")>-1?.01:1)*((b.split("-").length+Math.min(b.split("(").length-1,b.split(")").length-1))%2?1:-1)*Number(b.replace(/[^0-9\.]+/g,"")),a._value=k?Math.ceil(a._value):a._value}return a._value}function e(a,b,c){var d,e,f=b.indexOf("$"),g=b.indexOf("("),h=b.indexOf("-"),j="";return b.indexOf(" $")>-1?(j=" ",b=b.replace(" $","")):b.indexOf("$ ")>-1?(j=" ",b=b.replace("$ ","")):b=b.replace("$",""),e=i(a._value,b,c),1>=f?e.indexOf("(")>-1||e.indexOf("-")>-1?(e=e.split(""),d=1,(g>f||h>f)&&(d=0),e.splice(d,0,o[p].currency.symbol+j),e=e.join("")):e=o[p].currency.symbol+j+e:e.indexOf(")")>-1?(e=e.split(""),e.splice(-1,0,j+o[p].currency.symbol),e=e.join("")):e=e+j+o[p].currency.symbol,e}function f(a,b,c){var d,e="",f=100*a._value;return b.indexOf(" %")>-1?(e=" ",b=b.replace(" %","")):b=b.replace("%",""),d=i(f,b,c),d.indexOf(")")>-1?(d=d.split(""),d.splice(-1,0,e+"%"),d=d.join("")):d=d+e+"%",d}function g(a){var b=Math.floor(a._value/60/60),c=Math.floor((a._value-60*b*60)/60),d=Math.round(a._value-60*b*60-60*c);return b+":"+(10>c?"0"+c:c)+":"+(10>d?"0"+d:d)}function h(a){var b=a.split(":"),c=0;return 3===b.length?(c+=60*Number(b[0])*60,c+=60*Number(b[1]),c+=Number(b[2])):2===b.length&&(c+=60*Number(b[0]),c+=Number(b[1])),Number(c)}function i(a,c,d){var e,f,g,h,i,j,k=!1,l=!1,m=!1,n="",r=!1,s=!1,t=!1,u=!1,v=!1,w="",x="",y=Math.abs(a),z=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],A="",B=!1;if(0===a&&null!==q)return q;if(c.indexOf("(")>-1?(k=!0,c=c.slice(1,-1)):c.indexOf("+")>-1&&(l=!0,c=c.replace(/\+/g,"")),c.indexOf("a")>-1&&(r=c.indexOf("aK")>=0,s=c.indexOf("aM")>=0,t=c.indexOf("aB")>=0,u=c.indexOf("aT")>=0,v=r||s||t||u,c.indexOf(" a")>-1?(n=" ",c=c.replace(" a","")):c=c.replace("a",""),y>=Math.pow(10,12)&&!v||u?(n+=o[p].abbreviations.trillion,a/=Math.pow(10,12)):y<Math.pow(10,12)&&y>=Math.pow(10,9)&&!v||t?(n+=o[p].abbreviations.billion,a/=Math.pow(10,9)):y<Math.pow(10,9)&&y>=Math.pow(10,6)&&!v||s?(n+=o[p].abbreviations.million,a/=Math.pow(10,6)):(y<Math.pow(10,6)&&y>=Math.pow(10,3)&&!v||r)&&(n+=o[p].abbreviations.thousand,a/=Math.pow(10,3))),c.indexOf("b")>-1)for(c.indexOf(" b")>-1?(w=" ",c=c.replace(" b","")):c=c.replace("b",""),g=0;g<=z.length;g++)if(e=Math.pow(1024,g),f=Math.pow(1024,g+1),a>=e&&f>a){w+=z[g],e>0&&(a/=e);break}return c.indexOf("o")>-1&&(c.indexOf(" o")>-1?(x=" ",c=c.replace(" o","")):c=c.replace("o",""),x+=o[p].ordinal(a)),c.indexOf("[.]")>-1&&(m=!0,c=c.replace("[.]",".")),h=a.toString().split(".")[0],i=c.split(".")[1],j=c.indexOf(","),i?(i.indexOf("[")>-1?(i=i.replace("]",""),i=i.split("["),A=b(a,i[0].length+i[1].length,d,i[1].length)):A=b(a,i.length,d),h=A.split(".")[0],A=A.split(".")[1].length?o[p].delimiters.decimal+A.split(".")[1]:"",m&&0===Number(A.slice(1))&&(A="")):h=b(a,null,d),h.indexOf("-")>-1&&(h=h.slice(1),B=!0),j>-1&&(h=h.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+o[p].delimiters.thousands)),0===c.indexOf(".")&&(h=""),(k&&B?"(":"")+(!k&&B?"-":"")+(!B&&l?"+":"")+h+A+(x?x:"")+(n?n:"")+(w?w:"")+(k&&B?")":"")}function j(a,b){o[a]=b}function k(a){var b=a.toString().split(".");return b.length<2?1:Math.pow(10,b[1].length)}function l(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(a,b){var c=k(a),d=k(b);return c>d?c:d},-1/0)}var m,n="1.5.3",o={},p="en",q=null,r="0,0",s="undefined"!=typeof module&&module.exports;m=function(b){return m.isNumeral(b)?b=b.value():0===b||"undefined"==typeof b?b=0:Number(b)||(b=m.fn.unformat(b)),new a(Number(b))},m.version=n,m.isNumeral=function(b){return b instanceof a},m.language=function(a,b){if(!a)return p;if(a&&!b){if(!o[a])throw new Error("Unknown language : "+a);p=a}return(b||!o[a])&&j(a,b),m},m.languageData=function(a){if(!a)return o[p];if(!o[a])throw new Error("Unknown language : "+a);return o[a]},m.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var b=a%10;return 1===~~(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th"},currency:{symbol:"$"}}),m.zeroFormat=function(a){q="string"==typeof a?a:null},m.defaultFormat=function(a){r="string"==typeof a?a:"0.0"},m.validate=function(a,b){var c,d,e,f,g,h,i,j;if("string"!=typeof a&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),""===a)return!1;a=a.replace(/^[+-]?/,"");try{i=m.languageData(b)}catch(k){i=m.languageData(m.language())}return e=i.currency.symbol,g=i.abbreviations,c=i.delimiters.decimal,d="."===i.delimiters.thousands?"\\.":i.delimiters.thousands,j=a.match(/^[^\d]+/),null!==j&&(a=a.substr(1),j[0]!==e)?!1:(j=a.match(/[^\d]+$/),null!==j&&(a=a.slice(0,-1),j[0]!==g.thousand&&j[0]!==g.million&&j[0]!==g.billion&&j[0]!==g.trillion)?!1:a.match(/^\d+$/)?!0:(h=new RegExp(d+"{2}"),a.match(/[^\d.,]/g)?!1:(f=a.split(c),f.length>2?!1:f.length<2?!!f[0].match(/^\d+.*\d$/)&&!f[0].match(h):1===f[0].length?!!f[0].match(/^\d+$/)&&!f[0].match(h)&&!!f[1].match(/^\d+$/):!!f[0].match(/^\d+.*\d$/)&&!f[0].match(h)&&!!f[1].match(/^\d+$/))))},"function"!=typeof Array.prototype.reduce&&(Array.prototype.reduce=function(a,b){"use strict";if(null===this||"undefined"==typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof a)throw new TypeError(a+" is not a function");var c,d,e=this.length>>>0,f=!1;for(1<arguments.length&&(d=b,f=!0),c=0;e>c;++c)this.hasOwnProperty(c)&&(f?d=a(d,this[c],c,this):(d=this[c],f=!0));if(!f)throw new TypeError("Reduce of empty array with no initial value");return d}),m.fn=a.prototype={clone:function(){return m(this)},format:function(a,b){return c(this,a?a:r,void 0!==b?b:Math.round)},unformat:function(a){return"[object Number]"===Object.prototype.toString.call(a)?a:d(this,a?a:r)},value:function(){return this._value},valueOf:function(){return this._value},set:function(a){return this._value=Number(a),this},add:function(a){function b(a,b){return a+c*b}var c=l.call(null,this._value,a);return this._value=[this._value,a].reduce(b,0)/c,this},subtract:function(a){function b(a,b){return a-c*b}var c=l.call(null,this._value,a);return this._value=[a].reduce(b,this._value*c)/c,this},multiply:function(a){function b(a,b){var c=l(a,b);return a*c*b*c/(c*c)}return this._value=[this._value,a].reduce(b,1),this},divide:function(a){function b(a,b){var c=l(a,b);return a*c/(b*c)}return this._value=[this._value,a].reduce(b),this},difference:function(a){return Math.abs(m(this._value).subtract(a).value())}},s&&(module.exports=m),"undefined"==typeof ender&&(this.numeral=m),"function"==typeof define&&define.amd&&define([],function(){return m})}.call(window),function(a){"use strict";function b(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function c(a,b){return a<<b|a>>>32-b}function d(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)}function e(a,b,c,e,f,g,h){return d(b&c|~b&e,a,b,f,g,h)}function f(a,b,c,e,f,g,h){return d(b&e|c&~e,a,b,f,g,h)}function g(a,b,c,e,f,g,h){return d(b^c^e,a,b,f,g,h)}function h(a,b,c,e,f,g,h){return d(c^(b|~e),a,b,f,g,h)}function i(a,c){a[c>>5]|=128<<c%32,a[(c+64>>>9<<4)+14]=c;var d,i,j,k,l,m=1732584193,n=-271733879,o=-1732584194,p=271733878;for(d=0;d<a.length;d+=16)i=m,j=n,k=o,l=p,m=e(m,n,o,p,a[d],7,-680876936),p=e(p,m,n,o,a[d+1],12,-389564586),o=e(o,p,m,n,a[d+2],17,606105819),n=e(n,o,p,m,a[d+3],22,-1044525330),m=e(m,n,o,p,a[d+4],7,-176418897),p=e(p,m,n,o,a[d+5],12,1200080426),o=e(o,p,m,n,a[d+6],17,-1473231341),n=e(n,o,p,m,a[d+7],22,-45705983),m=e(m,n,o,p,a[d+8],7,1770035416),p=e(p,m,n,o,a[d+9],12,-1958414417),o=e(o,p,m,n,a[d+10],17,-42063),n=e(n,o,p,m,a[d+11],22,-1990404162),m=e(m,n,o,p,a[d+12],7,1804603682),p=e(p,m,n,o,a[d+13],12,-40341101),o=e(o,p,m,n,a[d+14],17,-1502002290),n=e(n,o,p,m,a[d+15],22,1236535329),m=f(m,n,o,p,a[d+1],5,-165796510),p=f(p,m,n,o,a[d+6],9,-1069501632),o=f(o,p,m,n,a[d+11],14,643717713),n=f(n,o,p,m,a[d],20,-373897302),m=f(m,n,o,p,a[d+5],5,-701558691),p=f(p,m,n,o,a[d+10],9,38016083),o=f(o,p,m,n,a[d+15],14,-660478335),n=f(n,o,p,m,a[d+4],20,-405537848),m=f(m,n,o,p,a[d+9],5,568446438),p=f(p,m,n,o,a[d+14],9,-1019803690),o=f(o,p,m,n,a[d+3],14,-187363961),n=f(n,o,p,m,a[d+8],20,1163531501),m=f(m,n,o,p,a[d+13],5,-1444681467),p=f(p,m,n,o,a[d+2],9,-51403784),o=f(o,p,m,n,a[d+7],14,1735328473),n=f(n,o,p,m,a[d+12],20,-1926607734),m=g(m,n,o,p,a[d+5],4,-378558),p=g(p,m,n,o,a[d+8],11,-2022574463),o=g(o,p,m,n,a[d+11],16,1839030562),n=g(n,o,p,m,a[d+14],23,-35309556),m=g(m,n,o,p,a[d+1],4,-1530992060),p=g(p,m,n,o,a[d+4],11,1272893353),o=g(o,p,m,n,a[d+7],16,-155497632),n=g(n,o,p,m,a[d+10],23,-1094730640),m=g(m,n,o,p,a[d+13],4,681279174),p=g(p,m,n,o,a[d],11,-358537222),o=g(o,p,m,n,a[d+3],16,-722521979),n=g(n,o,p,m,a[d+6],23,76029189),m=g(m,n,o,p,a[d+9],4,-640364487),p=g(p,m,n,o,a[d+12],11,-421815835),o=g(o,p,m,n,a[d+15],16,530742520),n=g(n,o,p,m,a[d+2],23,-995338651),m=h(m,n,o,p,a[d],6,-198630844),p=h(p,m,n,o,a[d+7],10,1126891415),o=h(o,p,m,n,a[d+14],15,-1416354905),n=h(n,o,p,m,a[d+5],21,-57434055),m=h(m,n,o,p,a[d+12],6,1700485571),p=h(p,m,n,o,a[d+3],10,-1894986606),o=h(o,p,m,n,a[d+10],15,-1051523),n=h(n,o,p,m,a[d+1],21,-2054922799),m=h(m,n,o,p,a[d+8],6,1873313359),p=h(p,m,n,o,a[d+15],10,-30611744),o=h(o,p,m,n,a[d+6],15,-1560198380),n=h(n,o,p,m,a[d+13],21,1309151649),m=h(m,n,o,p,a[d+4],6,-145523070),p=h(p,m,n,o,a[d+11],10,-1120210379),o=h(o,p,m,n,a[d+2],15,718787259),n=h(n,o,p,m,a[d+9],21,-343485551),m=b(m,i),n=b(n,j),o=b(o,k),p=b(p,l);return[m,n,o,p]}function j(a){var b,c="";for(b=0;b<32*a.length;b+=8)c+=String.fromCharCode(a[b>>5]>>>b%32&255);return c}function k(a){var b,c=[];for(c[(a.length>>2)-1]=void 0,b=0;b<c.length;b+=1)c[b]=0;for(b=0;b<8*a.length;b+=8)c[b>>5]|=(255&a.charCodeAt(b/8))<<b%32;return c}function l(a){return j(i(k(a),8*a.length))}function m(a,b){var c,d,e=k(a),f=[],g=[];for(f[15]=g[15]=void 0,e.length>16&&(e=i(e,8*a.length)),c=0;16>c;c+=1)f[c]=909522486^e[c],g[c]=1549556828^e[c];return d=i(f.concat(k(b)),512+8*b.length),j(i(g.concat(d),640))}function n(a){var b,c,d="0123456789abcdef",e="";for(c=0;c<a.length;c+=1)b=a.charCodeAt(c),e+=d.charAt(b>>>4&15)+d.charAt(15&b);return e}function o(a){return unescape(encodeURIComponent(a))}function p(a){return l(o(a))}function q(a){return n(p(a))}function r(a,b){return m(o(a),o(b))}function s(a,b){return n(r(a,b))}function t(a,b,c){return b?c?r(b,a):s(b,a):c?p(a):q(a)}"function"==typeof define&&define.amd?define(function(){return t}):a.md5=t}(this),this.j$=this.jStat=function(a){function b(b,c){var d=b>c?b:c;return a.pow(10,17-~~(a.log(d>0?d:-d)*a.LOG10E))}function c(a){return"[object Function]"===l.call(a)}function d(a){return"number"==typeof a&&a===a}function e(a){return j.apply([],a)}function f(){return new f._init(arguments)}function g(){return 0}function h(){return 1}function i(a,b){return a===b?1:0}var j=Array.prototype.concat,k=Array.prototype.slice,l=Object.prototype.toString,m=Array.isArray||function(a){return"[object Array]"===l.call(a)};f.fn=f.prototype,f._init=function(a){var b;if(m(a[0]))if(m(a[0][0])){for(c(a[1])&&(a[0]=f.map(a[0],a[1])),b=0;b<a[0].length;b++)this[b]=a[0][b];this.length=a[0].length}else this[0]=c(a[1])?f.map(a[0],a[1]):a[0],this.length=1;else if(d(a[0]))this[0]=f.seq.apply(null,a),this.length=1;else{if(a[0]instanceof f)return f(a[0].toArray());this[0]=[],this.length=1}return this},f._init.prototype=f.prototype,f._init.constructor=f,f.utils={calcRdx:b,isArray:m,isFunction:c,isNumber:d,toVector:e},f.extend=function(a){var b,c;if(1===arguments.length){for(c in a)f[c]=a[c];return this}for(b=1;b<arguments.length;b++)for(c in arguments[b])a[c]=arguments[b][c];return a},f.rows=function(a){return a.length||1},f.cols=function(a){return a[0].length||1},f.dimensions=function(a){return{rows:f.rows(a),cols:f.cols(a)}},f.row=function(a,b){return a[b]},f.col=function(a,b){for(var c=new Array(a.length),d=0;d<a.length;d++)c[d]=[a[d][b]];return c},f.diag=function(a){for(var b=f.rows(a),c=new Array(b),d=0;b>d;d++)c[d]=[a[d][d]];return c},f.antidiag=function(a){for(var b=f.rows(a)-1,c=new Array(b),d=0;b>=0;b--,d++)c[d]=[a[d][b]];return c},f.transpose=function(a){var b,c,d,e,f,g=[];for(m(a[0])||(a=[a]),c=a.length,d=a[0].length,f=0;d>f;f++){for(b=new Array(c),e=0;c>e;e++)b[e]=a[e][f];g.push(b)}return 1===g.length?g[0]:g},f.map=function(a,b,c){var d,e,f,g,h;for(m(a[0])||(a=[a]),e=a.length,f=a[0].length,g=c?a:new Array(e),d=0;e>d;d++)for(g[d]||(g[d]=new Array(f)),h=0;f>h;h++)g[d][h]=b(a[d][h],d,h);return 1===g.length?g[0]:g},f.alter=function(a,b){return f.map(a,b,!0)},f.create=function(a,b,d){var e,f,g=new Array(a);for(c(b)&&(d=b,b=a),e=0;a>e;e++)for(g[e]=new Array(b),f=0;b>f;f++)g[e][f]=d(e,f);return g},f.zeros=function(a,b){return d(b)||(b=a),f.create(a,b,g)},f.ones=function(a,b){return d(b)||(b=a),f.create(a,b,h)},f.rand=function(b,c){return d(c)||(c=b),f.create(b,c,a.random)},f.identity=function(a,b){return d(b)||(b=a),f.create(a,b,i)},f.symmetric=function(a){var b,c,d=a.length;if(a.length!==a[0].length)return!1;for(b=0;d>b;b++)for(c=0;d>c;c++)if(a[c][b]!==a[b][c])return!1;return!0},f.clear=function(a){return f.alter(a,g)},f.seq=function(a,d,e,f){c(f)||(f=!1);var g,h=[],i=b(a,d),j=(d*i-a*i)/((e-1)*i),k=a;for(g=0;d>=k;g++,k=(a*i+j*i*g)/i)h.push(f?f(k,g):k);return h};var n=f.prototype;return n.length=0,n.push=Array.prototype.push,n.sort=Array.prototype.sort,n.splice=Array.prototype.splice,n.slice=Array.prototype.slice,n.toArray=function(){return this.length>1?k.call(this):k.call(this)[0]},n.map=function(a,b){return f(f.map(this,a,b))},n.alter=function(a){return f.alter(this,a),this},function(a){for(var b=0;b<a.length;b++)(function(a){n[a]=function(b){var c,d=this;return b?(setTimeout(function(){b.call(d,n[a].call(d))}),this):(c=f[a](this),m(c)?f(c):c)}})(a[b])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(a){for(var b=0;b<a.length;b++)(function(a){n[a]=function(b,c){var d=this;return c?(setTimeout(function(){c.call(d,n[a].call(d,b))}),this):f(f[a](this,b))}})(a[b])}("row col".split(" ")),function(a){for(var b=0;b<a.length;b++)(function(a){n[a]=new Function("return jStat(jStat."+a+".apply(null, arguments));")})(a[b])}("create zeros ones rand identity".split(" ")),f}(Math),function(a,b){function c(a,b){return a-b}function d(a,c,d){return b.max(c,b.min(a,d))}var e=a.utils.isFunction;a.sum=function g(a){for(var g=0,b=a.length;--b>=0;)g+=a[b];return g},a.sumsqrd=function(a){for(var b=0,c=a.length;--c>=0;)b+=a[c]*a[c];return b},a.sumsqerr=function(b){for(var c,d=a.mean(b),e=0,f=b.length;--f>=0;)c=b[f]-d,e+=c*c;return e},a.product=function(a){for(var b=1,c=a.length;--c>=0;)b*=a[c];return b},a.min=function(a){for(var b=a[0],c=0;++c<a.length;)a[c]<b&&(b=a[c]);return b},a.max=function(a){for(var b=a[0],c=0;++c<a.length;)a[c]>b&&(b=a[c]);return b},a.mean=function(b){return a.sum(b)/b.length},a.meansqerr=function(b){return a.sumsqerr(b)/b.length},a.geomean=function(c){return b.pow(a.product(c),1/c.length)},a.median=function(a){var b=a.length,d=a.slice().sort(c);return 1&b?d[b/2|0]:(d[b/2-1]+d[b/2])/2},a.cumsum=function(a){var b,c=a.length,d=new Array(c);for(d[0]=a[0],b=1;c>b;b++)d[b]=d[b-1]+a[b];return d},a.diff=function(a){var b,c=[],d=a.length;for(b=1;d>b;b++)c.push(a[b]-a[b-1]);return c},a.mode=function(a){var b,d=a.length,e=a.slice().sort(c),f=1,g=0,h=0,i=[];for(b=0;d>b;b++)e[b]===e[b+1]?f++:(f>g?(i=[e[b]],g=f,h=0):f===g&&(i.push(e[b]),h++),f=1);return 0===h?i[0]:i},a.range=function(b){return a.max(b)-a.min(b)},a.variance=function(b,c){return a.sumsqerr(b)/(b.length-(c?1:0))},a.stdev=function(c,d){return b.sqrt(a.variance(c,d))},a.meandev=function(c){var d,e=0,f=a.mean(c);for(d=c.length-1;d>=0;d--)e+=b.abs(c[d]-f);return e/c.length},a.meddev=function(c){var d,e=0,f=a.median(c);for(d=c.length-1;d>=0;d--)e+=b.abs(c[d]-f);return e/c.length},a.coeffvar=function(b){return a.stdev(b)/a.mean(b)},a.quartiles=function(a){var d=a.length,e=a.slice().sort(c);return[e[b.round(d/4)-1],e[b.round(d/2)-1],e[b.round(3*d/4)-1]]},a.quantiles=function(a,e,f,g){var h,i,j,k,l,m,n=a.slice().sort(c),o=[e.length],p=a.length;for("undefined"==typeof f&&(f=3/8),"undefined"==typeof g&&(g=3/8),h=0;h<e.length;h++)i=e[h],j=f+i*(1-f-g),k=p*i+j,l=b.floor(d(k,1,p-1)),m=d(k-l,0,1),o[h]=(1-m)*n[l-1]+m*n[l];return o},a.percentileOfScore=function(a,b,c){var d,e,f=0,g=a.length,h=!1;for("strict"===c&&(h=!0),e=0;g>e;e++)d=a[e],(h&&b>d||!h&&b>=d)&&f++;return f/g},a.covariance=function(b,c){var d,e=a.mean(b),f=a.mean(c),g=b.length,h=new Array(g);for(d=0;g>d;d++)h[d]=(b[d]-e)*(c[d]-f);return a.sum(h)/(g-1)},a.corrcoeff=function(b,c){return a.covariance(b,c)/a.stdev(b,1)/a.stdev(c,1)};var f=a.prototype;f.cumsum=function(b,c){var d=[],g=0,h=this;if(e(b)&&(c=b,b=!1),c)return setTimeout(function(){c.call(h,f.cumsum.call(h,b))}),this;if(this.length>1){for(h=b===!0?this:this.transpose();g<h.length;g++)d[g]=a.cumsum(h[g]);return d}return a.cumsum(this[0],b)},function(b){for(var c=0;c<b.length;c++)(function(b){f[b]=function(c,d){var g=[],h=0,i=this;if(e(c)&&(d=c,c=!1),d)return setTimeout(function(){d.call(i,f[b].call(i,c))}),this;if(this.length>1){for(i=c===!0?this:this.transpose();h<i.length;h++)g[h]=a[b](i[h]);return c===!0?a[b](a.utils.toVector(g)):g}return a[b](this[0],c)}})(b[c])}("sum sumsqrd sumsqerr product min max mean meansqerr geomean median diff mode range variance stdev meandev meddev coeffvar quartiles".split(" ")),function(b){for(var c=0;c<b.length;c++)(function(b){f[b]=function(){var c=[],d=0,g=this,h=Array.prototype.slice.call(arguments);if(e(h[h.length-1])){var i=h[h.length-1],j=h.slice(0,h.length-1);return setTimeout(function(){i.call(g,f[b].apply(g,j))}),this}var i=void 0,k=function(c){return a[b].apply(g,[c].concat(h))};if(this.length>1){for(g=g.transpose();d<g.length;d++)c[d]=k(g[d]);return c}return k(this[0])}})(b[c])}("quantiles percentileOfScore".split(" "))}(this.jStat,Math),function(a,b){a.gammaln=function(a){var c,d,e,f=0,g=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],h=1.000000000190015;for(e=(d=c=a)+5.5,e-=(c+.5)*b.log(e);6>f;f++)h+=g[f]/++d;return b.log(2.5066282746310007*h/c)-e},a.gammafn=function(a){var c,d,e,f,g=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],h=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],i=!1,j=0,k=0,l=0,m=a;if(0>=m){if(f=m%1+3.6e-16,!f)return 1/0;i=(1&m?-1:1)*b.PI/b.sin(b.PI*f),m=1-m}for(e=m,d=1>m?m++:(m-=j=(0|m)-1)-1,c=0;8>c;++c)l=(l+g[c])*d,k=k*d+h[c];if(f=l/k+1,m>e)f/=e;else if(e>m)for(c=0;j>c;++c)f*=m,m++;return i&&(f=i/f),f},a.gammap=function(c,d){var e,f=a.gammaln(c),g=c,h=1/c,i=h,j=d+1-c,k=1/1e-30,l=1/j,m=l,n=1,o=-~(8.5*b.log(c>=1?c:1/c)+.4*c+17);if(0>d||0>=c)return 0/0;if(c+1>d){for(;o>=n;n++)h+=i*=d/++g;return h*b.exp(-d+c*b.log(d)-f)}for(;o>=n;n++)e=-n*(n-c),j+=2,l=e*l+j,k=j+e/k,l=1/l,m*=l*k;return 1-m*b.exp(-d+c*b.log(d)-f)},a.factorialln=function(b){return 0>b?0/0:a.gammaln(b+1)},a.factorial=function(b){return 0>b?0/0:a.gammafn(b+1)},a.combination=function(c,d){return c>170||d>170?b.exp(a.combinationln(c,d)):a.factorial(c)/a.factorial(d)/a.factorial(c-d)},a.combinationln=function(b,c){return a.factorialln(b)-a.factorialln(c)-a.factorialln(b-c)},a.permutation=function(b,c){return a.factorial(b)/a.factorial(b-c)},a.betafn=function(c,d){return 0>=c||0>=d?void 0:c+d>170?b.exp(a.betaln(c,d)):a.gammafn(c)*a.gammafn(d)/a.gammafn(c+d)},a.betaln=function(b,c){return a.gammaln(b)+a.gammaln(c)-a.gammaln(b+c)},a.betacf=function(a,c,d){var e,f,g,h,i=1e-30,j=1,k=c+d,l=c+1,m=c-1,n=1,o=1-k*a/l;for(b.abs(o)<i&&(o=i),o=1/o,h=o;100>=j&&(e=2*j,f=j*(d-j)*a/((m+e)*(c+e)),o=1+f*o,b.abs(o)<i&&(o=i),n=1+f/n,b.abs(n)<i&&(n=i),o=1/o,h*=o*n,f=-(c+j)*(k+j)*a/((c+e)*(l+e)),o=1+f*o,b.abs(o)<i&&(o=i),n=1+f/n,b.abs(n)<i&&(n=i),o=1/o,g=o*n,h*=g,!(b.abs(g-1)<3e-7));j++);return h},a.gammapinv=function(c,d){var e,f,g,h,i,j,k,l=0,m=d-1,n=1e-8,o=a.gammaln(d);if(c>=1)return b.max(100,d+100*b.sqrt(d));if(0>=c)return 0;for(d>1?(j=b.log(m),k=b.exp(m*(j-1)-o),i=.5>c?c:1-c,g=b.sqrt(-2*b.log(i)),e=(2.30753+.27061*g)/(1+g*(.99229+.04481*g))-g,.5>c&&(e=-e),e=b.max(.001,d*b.pow(1-1/(9*d)-e/(3*b.sqrt(d)),3))):(g=1-d*(.253+.12*d),e=g>c?b.pow(c/g,1/d):1-b.log(1-(c-g)/(1-g)));12>l;l++){if(0>=e)return 0;if(f=a.gammap(d,e)-c,g=d>1?k*b.exp(-(e-m)+m*(b.log(e)-j)):b.exp(-e+m*b.log(e)-o),h=f/g,e-=g=h/(1-.5*b.min(1,h*((d-1)/e-1))),0>=e&&(e=.5*(e+g)),b.abs(g)<n*e)break}return e},a.erf=function(a){var c,d,e,f,g=[-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],h=g.length-1,i=!1,j=0,k=0;for(0>a&&(a=-a,i=!0),c=2/(2+a),d=4*c-2;h>0;h--)e=j,j=d*j-k+g[h],k=e;return f=c*b.exp(-a*a+.5*(g[0]+d*j)-k),i?f-1:1-f},a.erfc=function(b){return 1-a.erf(b)},a.erfcinv=function(c){var d,e,f,g,h=0;if(c>=2)return-100;if(0>=c)return 100;for(g=1>c?c:2-c,f=b.sqrt(-2*b.log(g/2)),d=-.70711*((2.30753+.27061*f)/(1+f*(.99229+.04481*f))-f);2>h;h++)e=a.erfc(d)-g,d+=e/(1.1283791670955126*b.exp(-d*d)-d*e);return 1>c?d:-d},a.ibetainv=function(c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=1e-8,r=d-1,s=e-1,t=0;if(0>=c)return 0;if(c>=1)return 1;for(d>=1&&e>=1?(h=.5>c?c:1-c,i=b.sqrt(-2*b.log(h)),l=(2.30753+.27061*i)/(1+i*(.99229+.04481*i))-i,.5>c&&(l=-l),m=(l*l-3)/6,n=2/(1/(2*d-1)+1/(2*e-1)),o=l*b.sqrt(m+n)/n-(1/(2*e-1)-1/(2*d-1))*(m+5/6-2/(3*n)),l=d/(d+e*b.exp(2*o))):(f=b.log(d/(d+e)),g=b.log(e/(d+e)),i=b.exp(d*f)/d,j=b.exp(e*g)/e,o=i+j,l=i/o>c?b.pow(d*o*c,1/d):1-b.pow(e*o*(1-c),1/e)),p=-a.gammaln(d)-a.gammaln(e)+a.gammaln(d+e);10>t;t++){if(0===l||1===l)return l;if(k=a.ibeta(l,d,e)-c,i=b.exp(r*b.log(l)+s*b.log(1-l)+p),j=k/i,l-=i=j/(1-.5*b.min(1,j*(r/l-s/(1-l)))),0>=l&&(l=.5*(l+i)),l>=1&&(l=.5*(l+i+1)),b.abs(i)<q*l&&t>0)break}return l},a.ibeta=function(c,d,e){var f=0===c||1===c?0:b.exp(a.gammaln(d+e)-a.gammaln(d)-a.gammaln(e)+d*b.log(c)+e*b.log(1-c));return 0>c||c>1?!1:(d+1)/(d+e+2)>c?f*a.betacf(c,d,e)/d:1-f*a.betacf(1-c,e,d)/e
},a.randn=function(c,d){var e,f,g,h,i;if(d||(d=c),c)return a.create(c,d,function(){return a.randn()});do e=b.random(),f=1.7156*(b.random()-.5),g=e-.449871,h=b.abs(f)+.386595,i=g*g+h*(.196*h-.25472*g);while(i>.27597&&(i>.27846||f*f>-4*b.log(e)*e*e));return f/e},a.randg=function(c,d,e){var f,g,h,i,j,k,l=c;if(e||(e=d),c||(c=1),d)return k=a.zeros(d,e),k.alter(function(){return a.randg(c)}),k;1>c&&(c+=1),f=c-1/3,g=1/b.sqrt(9*f);do{do j=a.randn(),i=1+g*j;while(0>=i);i=i*i*i,h=b.random()}while(h>1-.331*b.pow(j,4)&&b.log(h)>.5*j*j+f*(1-i+b.log(i)));if(c==l)return f*i;do h=b.random();while(0===h);return b.pow(h,1/l)*f*i},function(b){for(var c=0;c<b.length;c++)(function(b){a.fn[b]=function(){return a(a.map(this,function(c){return a[b](c)}))}})(b[c])}("gammaln gammafn factorial factorialln".split(" ")),function(b){for(var c=0;c<b.length;c++)(function(b){a.fn[b]=function(){return a(a[b].apply(null,arguments))}})(b[c])}("randn".split(" "))}(this.jStat,Math),function(a,b){!function(b){for(var c=0;c<b.length;c++)(function(b){a[b]=function(a,b,c){return this instanceof arguments.callee?(this._a=a,this._b=b,this._c=c,this):new arguments.callee(a,b,c)},a.fn[b]=function(c,d,e){var f=a[b](c,d,e);return f.data=this,f},a[b].prototype.sample=function(c){var d=this._a,e=this._b,f=this._c;return c?a.alter(c,function(){return a[b].sample(d,e,f)}):a[b].sample(d,e,f)},function(c){for(var d=0;d<c.length;d++)(function(c){a[b].prototype[c]=function(d){var e=this._a,f=this._b,g=this._c;return d||0===d||(d=this.data),"number"!=typeof d?a.fn.map.call(d,function(d){return a[b][c](d,e,f,g)}):a[b][c](d,e,f,g)}})(c[d])}("pdf cdf inv".split(" ")),function(c){for(var d=0;d<c.length;d++)(function(c){a[b].prototype[c]=function(){return a[b][c](this._a,this._b,this._c)}})(c[d])}("mean median mode variance".split(" "))})(b[c])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy lognormal normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular".split(" ")),a.extend(a.beta,{pdf:function(c,d,e){return c>1||0>c?0:1==d&&1==e?1:512>d||512>e?b.pow(c,d-1)*b.pow(1-c,e-1)/a.betafn(d,e):b.exp((d-1)*b.log(c)+(e-1)*b.log(1-c)-a.betaln(d,e))},cdf:function(b,c,d){return b>1||0>b?1*(b>1):a.ibeta(b,c,d)},inv:function(b,c,d){return a.ibetainv(b,c,d)},mean:function(a,b){return a/(a+b)},median:function(){throw new Error("median not yet implemented")},mode:function(a,c){return a*c/(b.pow(a+c,2)*(a+c+1))},sample:function(b,c){var d=a.randg(b);return d/(d+a.randg(c))},variance:function(a,c){return a*c/(b.pow(a+c,2)*(a+c+1))}}),a.extend(a.centralF,{pdf:function(c,d,e){return 0>c?void 0:b.sqrt(b.pow(d*c,d)*b.pow(e,e)/b.pow(d*c+e,d+e))/(c*a.betafn(d/2,e/2))},cdf:function(b,c,d){return a.ibeta(c*b/(c*b+d),c/2,d/2)},inv:function(b,c,d){return d/(c*(1/a.ibetainv(b,c/2,d/2)-1))},mean:function(a,b){return b>2?b/(b-2):void 0},mode:function(a,b){return a>2?b*(a-2)/(a*(b+2)):void 0},sample:function(b,c){var d=2*a.randg(b/2),e=2*a.randg(c/2);return d/b/(e/c)},variance:function(a,b){return 4>=b?void 0:2*b*b*(a+b-2)/(a*(b-2)*(b-2)*(b-4))}}),a.extend(a.cauchy,{pdf:function(a,c,d){return d/(b.pow(a-c,2)+b.pow(d,2))/b.PI},cdf:function(a,c,d){return b.atan((a-c)/d)/b.PI+.5},inv:function(a,c,d){return c+d*b.tan(b.PI*(a-.5))},median:function(a){return a},mode:function(a){return a},sample:function(c,d){return a.randn()*b.sqrt(1/(2*a.randg(.5)))*d+c}}),a.extend(a.chisquare,{pdf:function(c,d){return b.exp((d/2-1)*b.log(c)-c/2-d/2*b.log(2)-a.gammaln(d/2))},cdf:function(b,c){return a.gammap(c/2,b/2)},inv:function(b,c){return 2*a.gammapinv(b,.5*c)},mean:function(a){return a},median:function(a){return a*b.pow(1-2/(9*a),3)},mode:function(a){return a-2>0?a-2:0},sample:function(b){return 2*a.randg(b/2)},variance:function(a){return 2*a}}),a.extend(a.exponential,{pdf:function(a,c){return 0>a?0:c*b.exp(-c*a)},cdf:function(a,c){return 0>a?0:1-b.exp(-c*a)},inv:function(a,c){return-b.log(1-a)/c},mean:function(a){return 1/a},median:function(a){return 1/a*b.log(2)},mode:function(){return 0},sample:function(a){return-1/a*b.log(b.random())},variance:function(a){return b.pow(a,-2)}}),a.extend(a.gamma,{pdf:function(c,d,e){return b.exp((d-1)*b.log(c)-c/e-a.gammaln(d)-d*b.log(e))},cdf:function(b,c,d){return a.gammap(c,b/d)},inv:function(b,c,d){return a.gammapinv(b,c)*d},mean:function(a,b){return a*b},mode:function(a,b){return a>1?(a-1)*b:void 0},sample:function(b,c){return a.randg(b)*c},variance:function(a,b){return a*b*b}}),a.extend(a.invgamma,{pdf:function(c,d,e){return b.exp(-(d+1)*b.log(c)-e/c-a.gammaln(d)+d*b.log(e))},cdf:function(b,c,d){return 1-a.gammap(c,d/b)},inv:function(b,c,d){return d/a.gammapinv(1-b,c)},mean:function(a,b){return a>1?b/(a-1):void 0},mode:function(a,b){return b/(a+1)},sample:function(b,c){return c/a.randg(b)},variance:function(a,b){return 2>=a?void 0:b*b/((a-1)*(a-1)*(a-2))}}),a.extend(a.kumaraswamy,{pdf:function(a,c,d){return b.exp(b.log(c)+b.log(d)+(c-1)*b.log(a)+(d-1)*b.log(1-b.pow(a,c)))},cdf:function(a,c,d){return 1-b.pow(1-b.pow(a,c),d)},mean:function(b,c){return c*a.gammafn(1+1/b)*a.gammafn(c)/a.gammafn(1+1/b+c)},median:function(a,c){return b.pow(1-b.pow(2,-1/c),1/a)},mode:function(a,c){return a>=1&&c>=1&&1!==a&&1!==c?b.pow((a-1)/(a*c-1),1/a):void 0},variance:function(){throw new Error("variance not yet implemented")}}),a.extend(a.lognormal,{pdf:function(a,c,d){return b.exp(-b.log(a)-.5*b.log(2*b.PI)-b.log(d)-b.pow(b.log(a)-c,2)/(2*d*d))},cdf:function(c,d,e){return.5+.5*a.erf((b.log(c)-d)/b.sqrt(2*e*e))},inv:function(c,d,e){return b.exp(-1.4142135623730951*e*a.erfcinv(2*c)+d)},mean:function(a,c){return b.exp(a+c*c/2)},median:function(a){return b.exp(a)},mode:function(a,c){return b.exp(a-c*c)},sample:function(c,d){return b.exp(a.randn()*d+c)},variance:function(a,c){return(b.exp(c*c)-1)*b.exp(2*a+c*c)}}),a.extend(a.normal,{pdf:function(a,c,d){return b.exp(-.5*b.log(2*b.PI)-b.log(d)-b.pow(a-c,2)/(2*d*d))},cdf:function(c,d,e){return.5*(1+a.erf((c-d)/b.sqrt(2*e*e)))},inv:function(b,c,d){return-1.4142135623730951*d*a.erfcinv(2*b)+c},mean:function(a){return a},median:function(a){return a},mode:function(a){return a},sample:function(b,c){return a.randn()*c+b},variance:function(a,b){return b*b}}),a.extend(a.pareto,{pdf:function(a,c,d){return c>=a?void 0:d*b.pow(c,d)/b.pow(a,d+1)},cdf:function(a,c,d){return 1-b.pow(c/a,d)},mean:function(a,c){return 1>=c?void 0:c*b.pow(a,c)/(c-1)},median:function(a,c){return a*c*b.SQRT2},mode:function(a){return a},variance:function(a,c){return 2>=c?void 0:a*a*c/(b.pow(c-1,2)*(c-2))}}),a.extend(a.studentt,{pdf:function(c,d){return a.gammafn((d+1)/2)/(b.sqrt(d*b.PI)*a.gammafn(d/2))*b.pow(1+c*c/d,-((d+1)/2))},cdf:function(c,d){var e=d/2;return a.ibeta((c+b.sqrt(c*c+d))/(2*b.sqrt(c*c+d)),e,e)},inv:function(c,d){var e=a.ibetainv(2*b.min(c,1-c),.5*d,.5);return e=b.sqrt(d*(1-e)/e),c>0?e:-e},mean:function(a){return a>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(c){return a.randn()*b.sqrt(c/(2*a.randg(c/2)))},variance:function(a){return a>2?a/(a-2):a>1?1/0:void 0}}),a.extend(a.weibull,{pdf:function(a,c,d){return 0>a?0:d/c*b.pow(a/c,d-1)*b.exp(-b.pow(a/c,d))},cdf:function(a,c,d){return 0>a?0:1-b.exp(-b.pow(a/c,d))},inv:function(a,c,d){return c*b.pow(-b.log(1-a),1/d)},mean:function(b,c){return b*a.gammafn(1+1/c)},median:function(a,c){return a*b.pow(b.log(2),1/c)},mode:function(a,c){return 1>=c?void 0:a*b.pow((c-1)/c,1/c)},sample:function(a,c){return a*b.pow(-b.log(b.random()),1/c)},variance:function(c,d){return c*c*a.gammafn(1+2/d)-b.pow(this.mean(c,d),2)}}),a.extend(a.uniform,{pdf:function(a,b,c){return b>a||a>c?0:1/(c-b)},cdf:function(a,b,c){return b>a?0:c>a?(a-b)/(c-b):1},mean:function(a,b){return.5*(a+b)},median:function(b,c){return a.mean(b,c)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(a,c){return a/2+c/2+(c/2-a/2)*(2*b.random()-1)},variance:function(a,c){return b.pow(c-a,2)/12}}),a.extend(a.binomial,{pdf:function(c,d,e){return 0===e||1===e?d*e===c?1:0:a.combination(d,c)*b.pow(e,c)*b.pow(1-e,d-c)},cdf:function(b,c,d){var e=[],f=0;if(0>b)return 0;if(c>b){for(;b>=f;f++)e[f]=a.binomial.pdf(f,c,d);return a.sum(e)}return 1}}),a.extend(a.negbin,{pdf:function(c,d,e){return c!==c|0?!1:0>c?0:a.combination(c+d-1,d-1)*b.pow(1-e,c)*b.pow(e,d)},cdf:function(b,c,d){var e=0,f=0;if(0>b)return 0;for(;b>=f;f++)e+=a.negbin.pdf(f,c,d);return e}}),a.extend(a.hypgeom,{pdf:function(c,d,e,f){if(c!==c|0)return!1;if(0>c||e-(d-f)>c)return 0;if(c>f||c>e)return 0;if(2*e>d)return 2*f>d?a.hypgeom.pdf(d-e-f+c,d,d-e,d-f):a.hypgeom.pdf(f-c,d,d-e,f);if(2*f>d)return a.hypgeom.pdf(e-c,d,e,d-f);if(f>e)return a.hypgeom.pdf(c,d,f,e);for(var g=1,h=0,i=0;c>i;i++){for(;g>1&&f>h;)g*=1-e/(d-h),h++;g*=(f-i)*(e-i)/((i+1)*(d-e-f+i+1))}for(;f>h;h++)g*=1-e/(d-h);return b.min(1,b.max(0,g))},cdf:function(c,d,e,f){if(0>c||e-(d-f)>c)return 0;if(c>=f||c>=e)return 1;if(2*e>d)return 2*f>d?a.hypgeom.cdf(d-e-f+c,d,d-e,d-f):1-a.hypgeom.cdf(f-c-1,d,d-e,f);if(2*f>d)return 1-a.hypgeom.cdf(e-c-1,d,e,d-f);if(f>e)return a.hypgeom.cdf(c,d,f,e);for(var g=1,h=1,i=0,j=0;c>j;j++){for(;g>1&&f>i;){var k=1-e/(d-i);h*=k,g*=k,i++}h*=(f-j)*(e-j)/((j+1)*(d-e-f+j+1)),g+=h}for(;f>i;i++)g*=1-e/(d-i);return b.min(1,b.max(0,g))}}),a.extend(a.poisson,{pdf:function(c,d){return b.pow(d,c)*b.exp(-d)/a.factorial(c)},cdf:function(b,c){var d=[],e=0;if(0>b)return 0;for(;b>=e;e++)d.push(a.poisson.pdf(e,c));return a.sum(d)},mean:function(a){return a},variance:function(a){return a},sample:function(a){var c=1,d=0,e=b.exp(-a);do d++,c*=b.random();while(c>e);return d-1}}),a.extend(a.triangular,{pdf:function(a,b,c,d){return b>=c||b>d||d>c?void 0:b>a||a>c?0:d>=a?2*(a-b)/((c-b)*(d-b)):2*(c-a)/((c-b)*(c-d))},cdf:function(a,c,d,e){return c>=d||c>e||e>d?void 0:c>a?0:e>=a?b.pow(a-c,2)/((d-c)*(e-c)):1-b.pow(d-a,2)/((d-c)*(d-e))},mean:function(a,b,c){return(a+b+c)/3},median:function(a,c,d){return(a+c)/2>=d?c-b.sqrt((c-a)*(c-d))/b.sqrt(2):d>(a+c)/2?a+b.sqrt((c-a)*(d-a))/b.sqrt(2):void 0},mode:function(a,b,c){return c},sample:function(a,c,d){var e=b.random();return(d-a)/(c-a)>e?a+b.sqrt(e*(c-a)*(d-a)):c-b.sqrt((1-e)*(c-a)*(c-d))},variance:function(a,b,c){return(a*a+b*b+c*c-a*b-a*c-b*c)/18}})}(this.jStat,Math),function(a,b){var d=Array.prototype.push,e=a.utils.isArray;a.extend({add:function(b,c){return e(c)?(e(c[0])||(c=[c]),a.map(b,function(a,b,d){return a+c[b][d]})):a.map(b,function(a){return a+c})},subtract:function(b,c){return e(c)?(e(c[0])||(c=[c]),a.map(b,function(a,b,d){return a-c[b][d]||0})):a.map(b,function(a){return a-c})},divide:function(b,c){return e(c)?(e(c[0])||(c=[c]),a.multiply(b,a.inv(c))):a.map(b,function(a){return a/c})},multiply:function(b,c){var d,f,g,h,i=b.length,j=b[0].length,k=a.zeros(i,g=e(c)?c[0].length:j),l=0;if(e(c)){for(;g>l;l++)for(d=0;i>d;d++){for(h=0,f=0;j>f;f++)h+=b[d][f]*c[f][l];k[d][l]=h}return 1===i&&1===l?k[0][0]:k}return a.map(b,function(a){return a*c})},dot:function(b,c){e(b[0])||(b=[b]),e(c[0])||(c=[c]);for(var d,f,g=1===b[0].length&&1!==b.length?a.transpose(b):b,h=1===c[0].length&&1!==c.length?a.transpose(c):c,i=[],j=0,k=g.length,l=g[0].length;k>j;j++){for(i[j]=[],d=0,f=0;l>f;f++)d+=g[j][f]*h[j][f];i[j]=d}return 1===i.length?i[0]:i},pow:function(c,d){return a.map(c,function(a){return b.pow(a,d)})},abs:function(c){return a.map(c,function(a){return b.abs(a)})},norm:function(a,c){var d=0,f=0;for(isNaN(c)&&(c=2),e(a[0])&&(a=a[0]);f<a.length;f++)d+=b.pow(b.abs(a[f]),c);return b.pow(d,1/c)},angle:function(c,d){return b.acos(a.dot(c,d)/(a.norm(c)*a.norm(d)))},aug:function(a,b){for(var c=a.slice(),e=0;e<c.length;e++)d.apply(c[e],b[e]);return c},inv:function(b){for(var c,d=b.length,e=b[0].length,f=a.identity(d,e),g=a.gauss_jordan(b,f),h=[],i=0;d>i;i++)for(h[i]=[],c=e-1;c<g[0].length;c++)h[i][c-e]=g[i][c];return h},det:function(a){var b,c=a.length,d=2*c,e=new Array(d),f=c-1,g=d-1,h=f-c+1,i=g,j=0,k=0;if(2===c)return a[0][0]*a[1][1]-a[0][1]*a[1][0];for(;d>j;j++)e[j]=1;for(j=0;c>j;j++){for(b=0;c>b;b++)e[0>h?h+c:h]*=a[j][b],e[c>i?i+c:i]*=a[j][b],h++,i--;h=--f-c+1,i=--g}for(j=0;c>j;j++)k+=e[j];for(;d>j;j++)k-=e[j];return k},gauss_elimination:function(c,d){var e,f,g,h,i=0,j=0,k=c.length,l=c[0].length,m=1,n=0,o=[];for(c=a.aug(c,d),e=c[0].length;k>i;i++){for(f=c[i][i],j=i,h=i+1;l>h;h++)f<b.abs(c[h][i])&&(f=c[h][i],j=h);if(j!=i)for(h=0;e>h;h++)g=c[i][h],c[i][h]=c[j][h],c[j][h]=g;for(j=i+1;k>j;j++)for(m=c[j][i]/c[i][i],h=i;e>h;h++)c[j][h]=c[j][h]-m*c[i][h]}for(i=k-1;i>=0;i--){for(n=0,j=i+1;k-1>=j;j++)n=o[j]*c[i][j];o[i]=(c[i][e-1]-n)/c[i][i]}return o},gauss_jordan:function(d,e){for(var f=a.aug(d,e),g=f.length,h=f[0].length,i=0;g>i;i++){for(var j=i,k=i+1;g>k;k++)b.abs(f[k][i])>b.abs(f[j][i])&&(j=k);var l=f[i];f[i]=f[j],f[j]=l;for(var k=i+1;g>k;k++){c=f[k][i]/f[i][i];for(var m=i;h>m;m++)f[k][m]-=f[i][m]*c}}for(var i=g-1;i>=0;i--){c=f[i][i];for(var k=0;i>k;k++)for(var m=h-1;m>i-1;m--)f[k][m]-=f[i][m]*f[k][i]/c;f[i][i]/=c;for(var m=g;h>m;m++)f[i][m]/=c}return f},lu:function(){throw new Error("lu not yet implemented")},cholesky:function(){throw new Error("cholesky not yet implemented")},gauss_jacobi:function(c,d,e,f){for(var g,h,i,j,k=0,l=0,m=c.length,n=[],o=[],p=[];m>k;k++)for(n[k]=[],o[k]=[],p[k]=[],l=0;m>l;l++)k>l?(n[k][l]=c[k][l],o[k][l]=p[k][l]=0):l>k?(o[k][l]=c[k][l],n[k][l]=p[k][l]=0):(p[k][l]=c[k][l],n[k][l]=o[k][l]=0);for(i=a.multiply(a.multiply(a.inv(p),a.add(n,o)),-1),h=a.multiply(a.inv(p),d),g=e,j=a.add(a.multiply(i,e),h),k=2;b.abs(a.norm(a.subtract(j,g)))>f;)g=j,j=a.add(a.multiply(i,g),h),k++;return j},gauss_seidel:function(c,d,e,f){for(var g,h,i,j,k,l=0,m=c.length,n=[],o=[],p=[];m>l;l++)for(n[l]=[],o[l]=[],p[l]=[],g=0;m>g;g++)l>g?(n[l][g]=c[l][g],o[l][g]=p[l][g]=0):g>l?(o[l][g]=c[l][g],n[l][g]=p[l][g]=0):(p[l][g]=c[l][g],n[l][g]=o[l][g]=0);for(j=a.multiply(a.multiply(a.inv(a.add(p,n)),o),-1),i=a.multiply(a.inv(a.add(p,n)),d),h=e,k=a.add(a.multiply(j,e),i),l=2;b.abs(a.norm(a.subtract(k,h)))>f;)h=k,k=a.add(a.multiply(j,h),i),l+=1;return k},SOR:function(c,d,e,f,g){for(var h,i,j,k,l,m=0,n=c.length,o=[],p=[],q=[];n>m;m++)for(o[m]=[],p[m]=[],q[m]=[],h=0;n>h;h++)m>h?(o[m][h]=c[m][h],p[m][h]=q[m][h]=0):h>m?(p[m][h]=c[m][h],o[m][h]=q[m][h]=0):(q[m][h]=c[m][h],o[m][h]=p[m][h]=0);for(k=a.multiply(a.inv(a.add(q,a.multiply(o,g))),a.subtract(a.multiply(q,1-g),a.multiply(p,g))),j=a.multiply(a.multiply(a.inv(a.add(q,a.multiply(o,g))),d),g),i=e,l=a.add(a.multiply(k,e),j),m=2;b.abs(a.norm(a.subtract(l,i)))>f;)i=l,l=a.add(a.multiply(k,i),j),m++;return l},householder:function(c){for(var d,e,f,g,h,i=c.length,j=c[0].length,k=0,l=[],m=[];i-1>k;k++){for(d=0,g=k+1;j>g;g++)d+=c[g][k]*c[g][k];for(h=c[k+1][k]>0?-1:1,d=h*b.sqrt(d),e=b.sqrt((d*d-c[k+1][k]*d)/2),l=a.zeros(i,1),l[k+1][0]=(c[k+1][k]-d)/(2*e),f=k+2;i>f;f++)l[f][0]=c[f][k]/(2*e);m=a.subtract(a.identity(i,j),a.multiply(a.multiply(l,a.transpose(l)),2)),c=a.multiply(m,a.multiply(c,m))}return c},QR:function(c,d){for(var e,f,g,h,i,j,k=c.length,l=c[0].length,m=0,n=[],o=[],p=[];k-1>m;m++){for(f=0,e=m+1;l>e;e++)f+=c[e][m]*c[e][m];for(i=c[m+1][m]>0?-1:1,f=i*b.sqrt(f),g=b.sqrt((f*f-c[m+1][m]*f)/2),n=a.zeros(k,1),n[m+1][0]=(c[m+1][m]-f)/(2*g),h=m+2;k>h;h++)n[h][0]=c[h][m]/(2*g);o=a.subtract(a.identity(k,l),a.multiply(a.multiply(n,a.transpose(n)),2)),c=a.multiply(o,c),d=a.multiply(o,d)}for(m=k-1;m>=0;m--){for(j=0,e=m+1;l-1>=e;e++)j=p[e]*c[m][e];p[m]=d[m][0]/c[m][m]}return p},jacobi:function(c){for(var d,e,f,g,h,i,j,k,l=1,m=0,n=c.length,o=a.identity(n,n),p=[];1===l;){for(m++,i=c[0][1],g=0,h=1,e=0;n>e;e++)for(f=0;n>f;f++)e!=f&&i<b.abs(c[e][f])&&(i=b.abs(c[e][f]),g=e,h=f);for(j=c[g][g]===c[h][h]?c[g][h]>0?b.PI/4:-b.PI/4:b.atan(2*c[g][h]/(c[g][g]-c[h][h]))/2,k=a.identity(n,n),k[g][g]=b.cos(j),k[g][h]=-b.sin(j),k[h][g]=b.sin(j),k[h][h]=b.cos(j),o=a.multiply(o,k),d=a.multiply(a.multiply(a.inv(k),c),k),c=d,l=0,e=1;n>e;e++)for(f=1;n>f;f++)e!=f&&b.abs(c[e][f])>.001&&(l=1)}for(e=0;n>e;e++)p.push(c[e][e]);return[o,p]},rungekutta:function(a,b,c,d,e,f){var g,h,i,j,k;if(2===f)for(;c>=d;)g=b*a(d,e),h=b*a(d+b,e+g),i=e+(g+h)/2,e=i,d+=b;if(4===f)for(;c>=d;)g=b*a(d,e),h=b*a(d+b/2,e+g/2),j=b*a(d+b/2,e+h/2),k=b*a(d+b,e+j),i=e+(g+2*h+2*j+k)/6,e=i,d+=b;return e},romberg:function(a,c,d,e){for(var f,g,h,i,j,k=0,l=(d-c)/2,m=[],n=[],o=[];e/2>k;){for(j=a(c),h=c,i=0;d>=h;h+=l,i++)m[i]=h;for(f=m.length,h=1;f-1>h;h++)j+=(h%2!==0?4:2)*a(m[h]);j=l/3*(j+a(d)),o[k]=j,l/=2,k++}for(g=o.length,f=1;1!==g;){for(h=0;g-1>h;h++)n[h]=(b.pow(4,f)*o[h+1]-o[h])/(b.pow(4,f)-1);g=n.length,o=n,n=[],f++}return o},richardson:function(a,c,d,e){function f(a,b){for(var c,d=0,e=a.length;e>d;d++)a[d]===b&&(c=d);return c}for(var g,h,i,j,k,l=(a.length,b.abs(d-a[f(a,d)+1])),m=0,n=[],o=[];e>=l;)g=f(a,d+e),h=f(a,d),n[m]=(c[g]-2*c[h]+c[2*h-g])/(e*e),e/=2,m++;for(j=n.length,i=1;1!=j;){for(k=0;j-1>k;k++)o[k]=(b.pow(4,i)*n[k+1]-n[k])/(b.pow(4,i)-1);j=o.length,n=o,o=[],i++}return n},simpson:function(a,b,c,d){for(var e,f=(c-b)/d,g=a(b),h=[],i=b,j=0,k=1;c>=i;i+=f,j++)h[j]=i;for(e=h.length;e-1>k;k++)g+=(k%2!==0?4:2)*a(h[k]);return f/3*(g+a(c))},hermite:function(a,b,c,d){for(var e,f=a.length,g=0,h=0,i=[],j=[],k=[],l=[];f>h;h++){for(i[h]=1,e=0;f>e;e++)h!=e&&(i[h]*=(d-a[e])/(a[h]-a[e]));for(j[h]=0,e=0;f>e;e++)h!=e&&(j[h]+=1/(a[h]-a[e]));k[h]=(1-2*(d-a[h])*j[h])*i[h]*i[h],l[h]=(d-a[h])*i[h]*i[h],g+=k[h]*b[h]+l[h]*c[h]}return g},lagrange:function(a,b,c){for(var d,e,f=0,g=0,h=a.length;h>g;g++){for(e=b[g],d=0;h>d;d++)g!=d&&(e*=(c-a[d])/(a[g]-a[d]));f+=e}return f},cubic_spline:function(b,c,d){for(var e,f=b.length,g=0,h=[],i=[],j=[],k=[],l=[],m=[],n=[];f-1>g;g++)l[g]=b[g+1]-b[g];for(j[0]=0,g=1;f-1>g;g++)j[g]=3/l[g]*(c[g+1]-c[g])-3/l[g-1]*(c[g]-c[g-1]);for(g=1;f-1>g;g++)h[g]=[],i[g]=[],h[g][g-1]=l[g-1],h[g][g]=2*(l[g-1]+l[g]),h[g][g+1]=l[g],i[g][0]=j[g];for(k=a.multiply(a.inv(h),i),e=0;f-1>e;e++)m[e]=(c[e+1]-c[e])/l[e]-l[e]*(k[e+1][0]+2*k[e][0])/3,n[e]=(k[e+1][0]-k[e][0])/(3*l[e]);for(e=0;f>e&&!(b[e]>d);e++);return e-=1,c[e]+(d-b[e])*m[e]+a.sq(d-b[e])*k[e]+(d-b[e])*a.sq(d-b[e])*n[e]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(b){var c,d,e=b.length,f=b[0].length,g=0,h=[],i=[],j=[],k=[],l=[],m=[],n=[],o=[],p=[],q=[];for(g=0;e>g;g++)h[g]=a.sum(b[g])/f;for(g=0;f>g;g++)for(n[g]=[],c=0;e>c;c++)n[g][c]=b[c][g]-h[c];for(n=a.transpose(n),g=0;e>g;g++)for(o[g]=[],c=0;e>c;c++)o[g][c]=a.dot([n[g]],[n[c]])/(f-1);for(j=a.jacobi(o),p=j[0],i=j[1],q=a.transpose(p),g=0;g<i.length;g++)for(c=g;c<i.length;c++)i[g]<i[c]&&(d=i[g],i[g]=i[c],i[c]=d,k=q[g],q[g]=q[c],q[c]=k);for(m=a.transpose(n),g=0;e>g;g++)for(l[g]=[],c=0;c<m.length;c++)l[g][c]=a.dot([q[g]],[m[c]]);return[b,i,q,l]}}),function(b){for(var c=0;c<b.length;c++)(function(b){a.fn[b]=function(c,d){var e=this;return d?(setTimeout(function(){d.call(e,a.fn[b].call(e,c))},15),this):a(a[b](this,c))}})(b[c])}("add divide multiply subtract dot pow abs norm angle".split(" "))}(this.jStat,Math),function(a,b){var c=[].slice,d=a.utils.isNumber;a.extend({zscore:function(){var b=c.call(arguments);return d(b[1])?(b[0]-b[1])/b[2]:(b[0]-a.mean(b[1]))/a.stdev(b[1],b[2])},ztest:function(){var e=c.call(arguments);if(4===e.length){if(d(e[1])){var f=a.zscore(e[0],e[1],e[2]);return 1===e[3]?a.normal.cdf(-b.abs(f),0,1):2*a.normal.cdf(-b.abs(f),0,1)}var f=e[0];return 1===e[2]?a.normal.cdf(-b.abs(f),0,1):2*a.normal.cdf(-b.abs(f),0,1)}var f=a.zscore(e[0],e[1],e[3]);return 1===e[1]?a.normal.cdf(-b.abs(f),0,1):2*a.normal.cdf(-b.abs(f),0,1)}}),a.extend(a.fn,{zscore:function(a,b){return(a-this.mean())/this.stdev(b)},ztest:function(c,d,e){var f=b.abs(this.zscore(c,e));return 1===d?a.normal.cdf(-f,0,1):2*a.normal.cdf(-f,0,1)}}),a.extend({tscore:function(){var d=c.call(arguments);return 4===d.length?(d[0]-d[1])/(d[2]/b.sqrt(d[3])):(d[0]-a.mean(d[1]))/(a.stdev(d[1],!0)/b.sqrt(d[1].length))},ttest:function(){var e,f=c.call(arguments);return 5===f.length?(e=b.abs(a.tscore(f[0],f[1],f[2],f[3])),1===f[4]?a.studentt.cdf(-e,f[3]-1):2*a.studentt.cdf(-e,f[3]-1)):d(f[1])?(e=b.abs(f[0]),1==f[2]?a.studentt.cdf(-e,f[1]-1):2*a.studentt.cdf(-e,f[1]-1)):(e=b.abs(a.tscore(f[0],f[1])),1==f[2]?a.studentt.cdf(-e,f[1].length-1):2*a.studentt.cdf(-e,f[1].length-1))}}),a.extend(a.fn,{tscore:function(a){return(a-this.mean())/(this.stdev(!0)/b.sqrt(this.cols()))},ttest:function(c,d){return 1===d?1-a.studentt.cdf(b.abs(this.tscore(c)),this.cols()-1):2*a.studentt.cdf(-b.abs(this.tscore(c)),this.cols()-1)}}),a.extend({anovafscore:function(){var d,e,f,g,h,i,j,k,l=c.call(arguments);if(1===l.length){for(h=new Array(l[0].length),j=0;j<l[0].length;j++)h[j]=l[0][j];l=h}if(2===l.length)return a.variance(l[0])/a.variance(l[1]);for(e=new Array,j=0;j<l.length;j++)e=e.concat(l[j]);for(f=a.mean(e),d=0,j=0;j<l.length;j++)d+=l[j].length*b.pow(a.mean(l[j])-f,2);for(d/=l.length-1,i=0,j=0;j<l.length;j++)for(g=a.mean(l[j]),k=0;k<l[j].length;k++)i+=b.pow(l[j][k]-g,2);return i/=e.length-l.length,d/i},anovaftest:function(){var b,e,f,g,h=c.call(arguments);if(d(h[0]))return 1-a.centralF.cdf(h[0],h[1],h[2]);for(anovafscore=a.anovafscore(h),b=h.length-1,f=0,g=0;g<h.length;g++)f+=h[g].length;return e=f-b-1,1-a.centralF.cdf(anovafscore,b,e)},ftest:function(b,c,d){return 1-a.centralF.cdf(b,c,d)}}),a.extend(a.fn,{anovafscore:function(){return a.anovafscore(this.toArray())},anovaftes:function(){var b,c=0;for(b=0;b<this.length;b++)c+=this[b].length;return a.ftest(this.anovafscore(),this.length-1,c-this.length)}}),a.extend({normalci:function(){var d,e=c.call(arguments),f=new Array(2);return d=b.abs(4===e.length?a.normal.inv(e[1]/2,0,1)*e[2]/b.sqrt(e[3]):a.normal.inv(e[1]/2,0,1)*a.stdev(e[2])/b.sqrt(e[2].length)),f[0]=e[0]-d,f[1]=e[0]+d,f},tci:function(){var d,e=c.call(arguments),f=new Array(2);return d=b.abs(4===e.length?a.studentt.inv(e[1]/2,e[3]-1)*e[2]/b.sqrt(e[3]):a.studentt.inv(e[1]/2,e[2].length-1)*a.stdev(e[2],!0)/b.sqrt(e[2].length)),f[0]=e[0]-d,f[1]=e[0]+d,f},significant:function(a,b){return b>a}}),a.extend(a.fn,{normalci:function(b,c){return a.normalci(b,c,this.toArray())},tci:function(b,c){return a.tci(b,c,this.toArray())}})}(this.jStat,Math),function(){function exportModule(numeral,jStat,moment,_,_s,md5){var MEMOIZED_FACT=[],SQRT2PI=2.5066282746310002,WEEK_STARTS=[void 0,0,1,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,1,2,3,4,5,6,0],WEEK_TYPES=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],WEEKEND_TYPES=[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],void 0,void 0,void 0,[0],[1],[2],[3],[4],[5],[6]],simplifyArguments=function(a){for(var b in a)_.isArray(a[b])&&(a[b]=Formula.FLATTEN(a[b]));return a};return Formula.UNIQUE=function(){return _.unique(arguments)},Formula.FLATTEN=function(){return _.flatten(arguments)},Formula.FUNCTION=function(){var a=Array.prototype.slice.call(arguments),b=a[a.length-1],c=/(\w+)\(/g,d=b.replace(c,function(){return"Formulae."+arguments[0]});return a[a.length-1]="return "+d+";",d!==b&&a.unshift("Formulae"),Function.apply(null,a)},Formula.MOMENT=function(a,b){return moment(a).format(b)},Formula.MOMENTADD=function(a,b,c){return moment(a).add(b,c)},Formula.MOMENTDIFF=function(a,b,c){return moment(b).diff(moment.utc(a),c)},Formula.MOMENTSUB=function(a,b,c){return moment(a).subtract(b,c)},Formula.MOMENTUTC=function(a,b){return moment.utc(a).format(b)},Formula.MOMENTUTCADD=function(a,b,c){return moment.utc(a).add(b,c)},Formula.MOMENTUTCDIFF=function(a,b,c){return moment.utc(b).diff(moment.utc(a),c)},Formula.MOMENTUTCSUB=function(a,b,c){return moment.utc(a).subtract(b,c)},Formula.MOMENTUNIX=function(a){return moment.unix(a).toDate()},Formula.MOMENTFORMAT=function(a,b){return moment(a).format(b)},Formula.MOMENTISLEAPYEAR=function(a,b){return moment(a,b).isLeapYear()},Formula.MOMENTISDST=function(a,b){return moment(a,b).isDST()},Formula.MOMENTSTARTOF=function(a,b,c){return moment(a,c).startOf(b).toDate()},Formula.MOMENTENDOF=function(a,b,c){return moment(a,c).endOf(b).toDate()},Formula.MOMENTISAFTER=function(a,b,c){return moment(a,c).isAfter(moment(b,c))},Formula.MOMENTISBEFORE=function(a,b,c){return moment(a,c).isBefore(moment(b,c))},Formula.INTERVAL=function(a){var b=Math.floor(a/94608e4);a%=94608e4;var c=Math.floor(a/2592e3);a%=2592e3;var d=Math.floor(a/86400);a%=86400;var e=Math.floor(a/3600);a%=3600;var f=Math.floor(a/60);a%=60;var g=a;return b=b>0?b+"Y":"",c=c>0?c+"M":"",d=d>0?d+"D":"",e=e>0?e+"H":"",f=f>0?f+"M":"",g=g>0?g+"S":"","P"+b+c+d+"T"+e+f+g},Formula.ARGSCONCAT=function(a){for(var b=[],c=0;c<a.length;c++)b=b.concat(a[c]);return b},Formula.ARGSTOARRAY=function(a){return Array.prototype.slice.call(a,0)},Formula.CLEANFLOAT=function(a){var b=Math.pow(10,14);return Math.round(a*b)/b},Formula.COUNTIN=function(a,b){for(var c=0,d=0;d<a.length;d++)a[d]===b&&c++;return c},Formula.FINDFIELD=function(a,b){for(var c=null,d=0;d<a.length;d++)if(a[d][0]===b){c=d;break}return null==c?"#VALUE!":c},Formula.FINDRESULTINDEX=function(database,criteria){for(var maxCriteriaLength=criteria[0].length,i=1;i<criteria.length;i++)criteria[i].length>maxCriteriaLength&&(maxCriteriaLength=criteria[i].length);var columnResultIndexes=[];for(i=1;maxCriteriaLength>i;i++){for(var rowResultIndexes=[],j=0;j<criteria.length;j++)if(!(criteria[j].length<maxCriteriaLength)){for(var criteriaTitle=criteria[j][0],criteriaIndex=Formula.FINDFIELD(database,criteriaTitle),criteriaValues=_.rest(database[criteriaIndex]),count=0,singleResultIndexes=[],k=0;k<criteriaValues.length;k++)eval(criteriaValues[k]+criteria[j][i])&&(singleResultIndexes[count++]=k);rowResultIndexes[j]=singleResultIndexes}columnResultIndexes[i-1]=_.intersection.apply(_,rowResultIndexes)}var resultIndexes=_.union.apply(_,columnResultIndexes);return resultIndexes},Formula.DAVERAGE=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=0,h=0;h<d.length;h++)g+=e[d[h]];var i=Formula.IF(0===d.length,"#DIV/0!",g/d.length);return i},Formula.DCOUNT=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];return Formula.COUNT(g)},Formula.DCOUNTA=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];return Formula.COUNTA(g)},Formula.DGET=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);return 0===d.length?"#VALUE!":d.length>1?"#NUM!":e[d[0]]},Formula.DMAX=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=e[d[0]],h=1;h<d.length;h++)g<e[d[h]]&&(g=e[d[h]]);return g},Formula.DMIN=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=e[d[0]],h=1;h<d.length;h++)g>e[d[h]]&&(g=e[d[h]]);return g},Formula.DPRODUCT=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];g=_.compact(g);var i=1;for(h=0;h<g.length;h++)i*=g[h];return i},Formula.DSTDEV=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];return g=_.compact(g),Formula.STDEVS(g)},Formula.DSTDEVP=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];return g=_.compact(g),Formula.STDEVP(g)},Formula.DSUM=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];return Formula.SUM(g)},Formula.DVAR=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];return Formula.VARS(g)},Formula.DVARP=function(a,b,c){if(isNaN(b)&&"string"!=typeof b)return"#VALUE!";var d=Formula.FINDRESULTINDEX(a,c),e=[];if("string"==typeof b){var f=Formula.FINDFIELD(a,b);e=_.rest(a[f])}else e=_.rest(a[b]);for(var g=[],h=0;h<d.length;h++)g[h]=e[d[h]];return Formula.VARP(g)},Formula.GETJSON=function(a){var b=new XMLHttpRequest;return b.open("GET",a,!1),b.send(null),200===b.status?JSON.parse(b.responseText):void 0},Formula.DATE=function(){if(!arguments.length)return new Date;if(1===arguments.length)return new Date(arguments[0]);var a=arguments;return a[1]=a[1]-1,new(Date.bind.apply(Date,[Date].concat([].splice.call(a,0))))},Formula.DATEVALUE=function(a){return Math.ceil((moment(a)-moment("1900-01-01"))/864e5)+2},Formula.DAY=function(a){return new Date(a).getDate()},Formula.DAYS=function(a,b){return moment(new Date(a)).diff(moment(new Date(b)),"days")},Formula.DAYS360=function(a,b,c){var d=moment(new Date(a)),e=moment(new Date(b)),f=31,g=31,h=d.date(),i=e.date();return c?(h=31===h?30:h,i=31===i?30:i):(1===d.month()&&(f=d.daysInMonth()),1===e.month()&&(g=e.daysInMonth()),h=h===f?30:h,(30===h||h===f)&&(i=i===g?30:i)),360*(e.year()-d.year())+30*(e.month()-d.month())+(i-h)},Formula.EDATE=function(a,b){return moment(new Date(a)).add("months",b).toDate()},Formula.EOMONTH=function(a,b){var c=moment(new Date(a)).add("months",b);return new Date(c.year(),c.month(),c.daysInMonth())},Formula.FROMNOW=function(a,b){return moment(new Date(a)).fromNow(b)},Formula.HOUR=function(a){return 1>=a?Math.floor(24*a):new Date(a).getHours()},Formula.MINUTE=function(a){return 1>=a?Math.floor(1440*a)-60*Math.floor(24*a):new Date(a).getMinutes()},Formula.ISOWEEKNUM=function(a){return moment(new Date(a)).format("w")},Formula.MONTH=function(a){return new Date(a).getMonth()+1},Formula.NETWORKDAYS=function(a,b,c){return Formula.NETWORKDAYSINTL(a,b,1,c)},Formula.NETWORKDAYSINTL=function(a,b,c,d){var e="undefined"==typeof c?1:c,f=WEEKEND_TYPES[e],g=moment(a),h=moment(b),i=h.diff(g,"days")+1,j=i,k=g,l=[];if("undefined"!=typeof d)for(var m=0;m<d.length;m++)l[m]=moment(new Date(d[m])).format("MM-DD-YYYY");if(!f.length&&!l.length)return j;for(var n=0;i>n;)f.indexOf(parseInt(k.format("d"),10))>=0?j--:l.indexOf(k.format("MM-DD-YYYY"))>=0&&j--,k=k.add("days",1),n++;return j},Formula.NOW=function(){return new Date},Formula.SECOND=function(a){return new Date(a).getSeconds()},Formula.TIME=function(a,b,c){return(3600*a+60*b+c)/86400},Formula.TIMEVALUE=function(a){var b=new Date(a);return(3600*b.getHours()+60*b.getMinutes()+b.getSeconds())/86400},Formula.TODAY=Formula.NOW,Formula.WEEKDAY=function(a,b){var c=moment(new Date(a)).format("d"),d="undefined"==typeof b?1:b;return WEEK_TYPES[d][c]},Formula.WEEKNUM=function(a,b){var c=moment(new Date(a)),d=moment(new Date(c.year(),0,1)),e="undefined"==typeof b?1:b,f=WEEK_STARTS[e],g=d.format("d"),h=f>g?f-g+1:g-f;return 21===e?Formula.ISOWEEKNUM(a):Math.floor(c.diff(d.subtract("days",h),"days")/7)+1},Formula.WORKDAY=function(a,b,c){return Formula.WORKDAYINTL(a,b,1,c)},Formula.WORKDAYINTL=function(a,b,c,d){var e="undefined"==typeof c?1:c,f=WEEKEND_TYPES[e],g=moment(new Date(a)),h=g,i="",j=[];if("undefined"!=typeof d)for(var k=0;k<d.length;k++)j[k]=moment(new Date(d[k])).format("MM-DD-YYYY");for(var l=0;b>l;)h=h.add("days",1),i=h.format("d"),f.indexOf(parseInt(i,10))<0&&j.indexOf(h.format("MM-DD-YYYY"))<0&&l++;
return h.toDate()},Formula.YEAR=function(a){return new Date(a).getFullYear()},Formula.YEARFRAC=function(a,b,c){c="undefined"==typeof c?0:c;var d=moment(new Date(a)),e=moment(new Date(b));if(!d.isValid()||!e.isValid())return"#VALUE!";if(-1===[0,1,2,3,4].indexOf(c))return"#NUM!";if(d===e)return 0;d.diff(e)>0&&(e=moment(new Date(a)),d=moment(new Date(b)));var f=d.year(),g=d.month(),h=d.date(),i=e.year(),j=e.month(),k=e.date();switch(c){case 0:return 31===h&&31===k?(h=30,k=30):31===h?h=30:30===h&&31===k?k=30:1===g&&1===j&&d.daysInMonth()===h&&e.daysInMonth()===k?(h=30,k=30):1===g&&d.daysInMonth()===h&&(h=30),(k+30*j+360*i-(h+30*g+360*f))/360;case 1:var l=function(a,b){var c=moment(new Date(a.year(),2,1));if(moment([a.year()]).isLeapYear()&&a.diff(c)<0&&b.diff(c)>=0)return!0;var d=moment(new Date(b.year(),2,1));return moment([b.year()]).isLeapYear()&&b.diff(d)>=0&&a.diff(d)<0?!0:!1},m=365;if(f===i||f+1===i&&(g>j||g===j&&h>=k))return f===i&&moment([f]).isLeapYear()?m=366:(l(d,e)||1===j&&29===k)&&(m=366),e.diff(d,"days")/m;var n=i-f+1,o=moment(new Date(i+1,0,1)).diff(moment(new Date(f,0,1)),"days"),p=o/n;return e.diff(d,"days")/p;case 2:return e.diff(d,"days")/360;case 3:return e.diff(d,"days")/365;case 4:return 31===h&&(h=30),31===k&&(k=30),(k+30*j+360*i-(h+30*g+360*f))/360}},Formula.BESSELI=function(){function a(a,b){return a.reduce(function(a,c){return b*a+c},0)}function b(b){return 3.75>=b?a(d,b*b/14.0625):Math.exp(Math.abs(b))/Math.sqrt(Math.abs(b))*a(e,3.75/Math.abs(b))}function c(b){return 3.75>b?b*a(f,b*b/14.0625):(0>b?-1:1)*Math.exp(Math.abs(b))/Math.sqrt(Math.abs(b))*a(g,3.75/Math.abs(b))}var d=[1,3.5156229,3.0899424,1.2067492,.2659732,.0360768,.0045813].reverse(),e=[.39894228,.01328592,.00225319,-.00157565,.00916281,-.02057706,.02635537,-.01647633,.00392377].reverse(),f=[.5,.87890594,.51498869,.15084934,.02658733,.00301532,32411e-8].reverse(),g=[.39894228,-.03988024,-.00362018,.00163801,-.01031555,.02282967,-.02895312,.01787654,-.00420059].reverse();return function h(a,d){if(d=Math.round(d),0===d)return b(a);if(1===d)return c(a);if(0>d)throw"BESSELI Order ("+d+") must be nonnegative";if(0===Math.abs(a))return 0;var e,f,g,i,j,k,l=2/Math.abs(a);for(g=2*Math.round((d+Math.round(Math.sqrt(40*d)))/2),i=e=0,j=1,f=g;f>0;f--)k=f*l*j+i,i=j,j=k,Math.abs(j)>1e10&&(j*=1e-10,i*=1e-10,e*=1e-10),f===d&&(e=i);return e*=h(a,0)/j,0>a&&d%2?-e:e}}(),Formula.BESSELJ=function(){function a(a,b){return a.reduce(function(a,c){return b*a+c},0)}function b(b){var c,d,j,k=b*b,l=Math.abs(b)-.785398164;return Math.abs(b)<8?(d=a(e,k),j=a(f,k),c=d/j):(k=64/k,d=a(g,k),j=a(h,k),c=Math.sqrt(i/Math.abs(b))*(Math.cos(l)*d-Math.sin(l)*j*8/Math.abs(b))),c}function c(b){var c,d,e,f=b*b,g=Math.abs(b)-2.356194491;return Math.abs(b)<8?(d=b*a(j,f),e=a(k,f),c=d/e):(f=64/f,d=a(l,f),e=a(m,f),c=Math.sqrt(i/Math.abs(b))*(Math.cos(g)*d-Math.sin(g)*e*8/Math.abs(b)),0>b&&(c=-c)),c}function d(a,b,c,d,e){e||(e=-1);var f,g=2/a;if(0===b)return c;if(1===b)return d;for(var h=1;h!==b;++h)f=d*h*g+e*c,c=d,d=f;return d}var e=[57568490574,-13362590354,651619640.7,-11214424.18,77392.33017,-184.9052456].reverse(),f=[57568490411,1029532985,9494680.718,59272.64853,267.8532712,1].reverse(),g=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),h=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34935152e-8].reverse(),i=.636619772,j=[72362614232,-7895059235,242396853.1,-2972611.439,15704.4826,-30.16036606].reverse(),k=[144725228442,2300535178,18583304.74,99447.43394,376.9991397,1].reverse(),l=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),m=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return function(a,e){if(e=Math.round(e),0===e)return b(Math.abs(a));if(1===e)return c(Math.abs(a));if(0>e)throw"BESSELJ: Order ("+e+") must be nonnegative";if(0===Math.abs(a))return 0;var f,g,h,i,j,k,l,m,n=2/Math.abs(a);if(Math.abs(a)>e)f=d(a,e,b(Math.abs(a)),c(Math.abs(a)),-1);else{for(h=2*Math.floor((e+Math.floor(Math.sqrt(40*e)))/2),i=0,k=f=j=0,l=1,g=h;g>0;g--)m=g*n*l-k,k=l,l=m,Math.abs(l)>1e10&&(l*=1e-10,k*=1e-10,f*=1e-10,j*=1e-10),i&&(j+=l),i=!i,g===e&&(f=k);j=2*j-l,f/=j}return 0>a&&e%2?-f:f}}(),Formula.BESSELK=function(){function a(a,b){return a.reduce(function(a,c){return b*a+c},0)}function b(b){return 2>=b?-Math.log(b/2)*Formula.BESSELI(b,0)+a(f,b*b/4):Math.exp(-b)/Math.sqrt(b)*a(g,2/b)}function c(b){return 2>=b?Math.log(b/2)*Formula.BESSELI(b,1)+1/b*a(h,b*b/4):Math.exp(-b)/Math.sqrt(b)*a(i,2/b)}function d(a,b,c,d,e){e||(e=-1);var f,g=2/a;if(0===b)return c;if(1===b)return d;for(var h=1;h!==b;++h)f=d*h*g+e*c,c=d,d=f;return d}function e(a,b,c,e,f){return function(g,h){if(0===h)return a(g);if(1===h)return b(g);if(0>h)throw c+": Order ("+h+") must be nonnegative";if(1===e&&0===g)throw c+": Undefined when x == 0";if(2===e&&0>=g)throw c+": Undefined when x <= 0";var i=a(g),j=b(g);return d(g,h,i,j,f)}}var f=[-.57721566,.4227842,.23069756,.0348859,.00262698,1075e-7,74e-7].reverse(),g=[1.25331414,-.07832358,.02189568,-.01062446,.00587872,-.0025154,53208e-8].reverse(),h=[1,.15443144,-.67278579,-.18156897,-.01919402,-.00110404,-4686e-8].reverse(),i=[1.25331414,.23498619,-.0365562,.01504268,-.00780353,.00325614,-68245e-8].reverse();return e(b,c,"BESSELK",2,1)}(),Formula.BESSELY=function(){function a(a,b){return a.reduce(function(a,c){return b*a+c},0)}function b(b){var c,d,e,k=b*b,l=b-.785398164;return 8>b?(d=a(f,k),e=a(g,k),c=d/e+j*Formula.BESSELJ(b,0)*Math.log(b)):(k=64/k,d=a(h,k),e=a(i,k),c=Math.sqrt(j/b)*(Math.sin(l)*d+Math.cos(l)*e*8/b)),c}function c(b){var c,d,e,f=b*b,g=b-2.356194491;return 8>b?(d=b*a(k,f),e=a(l,f),c=d/e+j*(Formula.BESSELJ(b,1)*Math.log(b)-1/b)):(f=64/f,d=a(m,f),e=a(n,f),c=Math.sqrt(j/b)*(Math.sin(g)*d+Math.cos(g)*e*8/b)),c}function d(a,b,c,d,e){e||(e=-1);var f,g=2/a;if(0===b)return c;if(1===b)return d;for(var h=1;h!==b;++h)f=d*h*g+e*c,c=d,d=f;return d}function e(a,b,c,e,f){return function(g,h){if(0===h)return a(g);if(1===h)return b(g);if(0>h)throw c+": Order ("+h+") must be nonnegative";if(1===e&&0===g)throw c+": Undefined when x == 0";if(2===e&&0>=g)throw c+": Undefined when x <= 0";var i=a(g),j=b(g);return d(g,h,i,j,f)}}var f=[-2957821389,7062834065,-512359803.6,10879881.29,-86327.92757,228.4622733].reverse(),g=[40076544269,745249964.8,7189466.438,47447.2647,226.1030244,1].reverse(),h=[1,-.001098628627,2734510407e-14,-2073370639e-15,2.093887211e-7].reverse(),i=[-.01562499995,.0001430488765,-6911147651e-15,7.621095161e-7,-9.34945152e-8].reverse(),j=.636619772,k=[-4900604943e3,127527439e4,-51534381390,734926455.1,-4237922.726,8511.937935].reverse(),l=[249958057e5,424441966400,3733650367,22459040.02,102042.605,354.9632885,1].reverse(),m=[1,.00183105,-3516396496e-14,2457520174e-15,-2.40337019e-7].reverse(),n=[.04687499995,-.0002002690873,8449199096e-15,-8.8228987e-7,1.05787412e-7].reverse();return e(b,c,"BESSELY",1,-1)}(),Formula.VALIDBIN=function(a){return/^[01]{1,10}$/.test(a)},Formula.BIN2DEC=function(a){if(!Formula.VALIDBIN(a))return"#NUM!";var b=parseInt(a,2),c=a.toString();return 10===c.length&&"1"===c.substring(0,1)?parseInt(c.substring(1),2)-512:b},Formula.BIN2HEX=function(a,b){if(!Formula.VALIDBIN(a))return"#NUM!";var c=a.toString();if(10===c.length&&"1"===c.substring(0,1))return(0xfffffffe00+parseInt(c.substring(1),2)).toString(16);var d=parseInt(a,2).toString(16);return"undefined"==typeof b?d:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=d.length?_s.repeat("0",b-d.length)+d:"#NUM!")},Formula.BIN2OCT=function(a,b){if(!Formula.VALIDBIN(a))return"#NUM!";var c=a.toString();if(10===c.length&&"1"===c.substring(0,1))return(1073741312+parseInt(c.substring(1),2)).toString(8);var d=parseInt(a,2).toString(8);return"undefined"==typeof b?d:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=d.length?_s.repeat("0",b-d.length)+d:"#NUM!")},Formula.BITAND=function(a,b){return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b?"#NUM!":Math.floor(a)!==a||Math.floor(b)!==b?"#NUM!":a>0xffffffffffff||b>0xffffffffffff?"#NUM!":a&b},Formula.BITLSHIFT=function(a,b){return isNaN(a)||isNaN(b)?"#VALUE!":0>a?"#NUM!":Math.floor(a)!==a?"#NUM!":a>0xffffffffffff?"#NUM!":Math.abs(b)>53?"#NUM!":b>=0?a<<b:a>>-b},Formula.BITOR=function(a,b){return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b?"#NUM!":Math.floor(a)!==a||Math.floor(b)!==b?"#NUM!":a>0xffffffffffff||b>0xffffffffffff?"#NUM!":a|b},Formula.BITRSHIFT=function(a,b){return isNaN(a)||isNaN(b)?"#VALUE!":0>a?"#NUM!":Math.floor(a)!==a?"#NUM!":a>0xffffffffffff?"#NUM!":Math.abs(b)>53?"#NUM!":b>=0?a>>b:a<<-b},Formula.BITXOR=function(a,b){return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b?"#NUM!":Math.floor(a)!==a||Math.floor(b)!==b?"#NUM!":a>0xffffffffffff||b>0xffffffffffff?"#NUM!":a^b},Formula.COMPLEX=function(a,b,c){if(isNaN(a)||isNaN(b))return"#VALUE!";if(c="undefined"==typeof c?"i":c,"i"!==c&&"j"!==c)return"#VALUE!";if(0===a&&0===b)return 0;if(0===a)return 1===b?c:b.toString()+c;if(0===b)return a.toString();var d=b>0?"+":"";return a.toString()+d+(1===b?c:b.toString()+c)},Formula.CONVERT=function(a,b,c){if(isNaN(a))return"#VALUE!";for(var d,e=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],f={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},g={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},h=null,i=null,j=b,k=c,l=1,m=1,n=0;n<e.length;n++)d=null===e[n][2]?[]:e[n][2],(e[n][1]===j||d.indexOf(j)>=0)&&(h=e[n]),(e[n][1]===k||d.indexOf(k)>=0)&&(i=e[n]);if(null===h){var o=f[b.substring(0,2)],p=g[b.substring(0,1)];"da"===b.substring(0,2)&&(p=["dekao",10,"da"]),o?(l=o[2],j=b.substring(2)):p&&(l=p[1],j=b.substring(p[2].length));for(var q=0;q<e.length;q++)d=null===e[q][2]?[]:e[q][2],(e[q][1]===j||d.indexOf(j)>=0)&&(h=e[q])}if(null===i){var r=f[c.substring(0,2)],s=g[c.substring(0,1)];"da"===c.substring(0,2)&&(s=["dekao",10,"da"]),r?(m=r[2],k=c.substring(2)):s&&(m=s[1],k=c.substring(s[2].length));for(var t=0;t<e.length;t++)d=null===e[t][2]?[]:e[t][2],(e[t][1]===k||d.indexOf(k)>=0)&&(i=e[t])}return null===h||null===i?"#N/A":h[3]!==i[3]?"#N/A":a*h[6]*l/(i[6]*m)},Formula.DEC2BIN=function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,3}$/.test(a)||-512>a||a>511)return"#NUM!";if(0>a)return"1"+_s.repeat("0",9-(512+a).toString(2).length)+(512+a).toString(2);var c=parseInt(a,10).toString(2);return"undefined"==typeof b?c:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=c.length?_s.repeat("0",b-c.length)+c:"#NUM!")},Formula.DEC2HEX=function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,12}$/.test(a)||-549755813888>a||a>549755813887)return"#NUM!";if(0>a)return(1099511627776+a).toString(16);var c=parseInt(a,10).toString(16);return"undefined"==typeof b?c:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=c.length?_s.repeat("0",b-c.length)+c:"#NUM!")},Formula.DEC2OCT=function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,9}$/.test(a)||-536870912>a||a>536870911)return"#NUM!";if(0>a)return(1073741824+a).toString(8);var c=parseInt(a,10).toString(8);return"undefined"==typeof b?c:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=c.length?_s.repeat("0",b-c.length)+c:"#NUM!")},Formula.DELTA=function(a,b){return b="undefined"==typeof b?0:b,isNaN(a)||isNaN(b)?"#VALUE!":a===b?1:0},Formula.ERF=function(a,b){return b="undefined"==typeof b?0:b,isNaN(a)||isNaN(b)?"#VALUE!":jStat.erf(a)},Formula.ERFC=function(a){return isNaN(a)?"#VALUE!":jStat.erfc(a)},Formula.ERFCPRECISE=function(){},Formula.ERFPRECISE=function(){},Formula.GESTEP=function(a,b){return b="undefined"==typeof b?0:b,isNaN(a)||isNaN(b)?"#VALUE!":a>=b?1:0},Formula.HEX2BIN=function(a,b){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";var c=10===a.length&&"f"===a.substring(0,1).toLowerCase()?!0:!1,d=c?parseInt(a,16)-1099511627776:parseInt(a,16);if(-512>d||d>511)return"#NUM!";if(c)return"1"+_s.repeat("0",9-(512+d).toString(2).length)+(512+d).toString(2);var e=d.toString(2);return"undefined"==typeof b?e:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=e.length?_s.repeat("0",b-e.length)+e:"#NUM!")},Formula.HEX2DEC=function(a){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";var b=parseInt(a,16);return b>=549755813888?b-1099511627776:b},Formula.HEX2OCT=function(a,b){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";var c=parseInt(a,16);if(c>536870911&&0xffe0000000>c)return"#NUM!";if(c>=0xffe0000000)return(c-0xffc0000000).toString(8);var d=c.toString(8);return"undefined"==typeof b?d:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=d.length?_s.repeat("0",b-d.length)+d:"#NUM!")},Formula.IMABS=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":Math.sqrt(Math.pow(b,2)+Math.pow(c,2))},Formula.IMAGINARY=function(a){if(0===a||"0"===a)return 0;if(["i","j"].indexOf(a)>=0)return 1;a=a.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var b=a.indexOf("+"),c=a.indexOf("-");0===b&&(b=a.indexOf("+",1)),0===c&&(c=a.indexOf("-",1));var d=a.substring(a.length-1,a.length),e="i"===d||"j"===d;return b>=0||c>=0?e?b>=0?isNaN(a.substring(0,b))||isNaN(a.substring(b+1,a.length-1))?"#NUM!":Number(a.substring(b+1,a.length-1)):isNaN(a.substring(0,c))||isNaN(a.substring(c+1,a.length-1))?"#NUM!":-Number(a.substring(c+1,a.length-1)):"#NUM!":e?isNaN(a.substring(0,a.length-1))?"#NUM!":a.substring(0,a.length-1):isNaN(a)?"#NUM!":0},Formula.IMARGUMENT=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":0===b&&0===c?"#DIV/0!":0===b&&c>0?Math.PI/2:0===b&&0>c?-Math.PI/2:0===c&&b>0?0:0===c&&0>b?-Math.PI:b>0?Math.atan(c/b):0>b&&c>=0?Math.atan(c/b)+Math.PI:Math.atan(c/b)-Math.PI},Formula.IMCONJUGATE=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":0!==c?Formula.COMPLEX(b,-c,d):a},Formula.IMCOS=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.COMPLEX(Math.cos(b)*(Math.exp(c)+Math.exp(-c))/2,-Math.sin(b)*(Math.exp(c)-Math.exp(-c))/2,d)},Formula.IMCOSH=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.COMPLEX(Math.cos(c)*(Math.exp(b)+Math.exp(-b))/2,Math.sin(c)*(Math.exp(b)-Math.exp(-b))/2,d)},Formula.IMCOT=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.IMDIV(Formula.IMCOS(a),Formula.IMSIN(a))},Formula.IMCSC=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.IMDIV("1",Formula.IMSIN(a))},Formula.IMCSCH=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.IMDIV("1",Formula.IMSINH(a))},Formula.IMDIV=function(a,b){var c=Formula.IMREAL(a),d=Formula.IMAGINARY(a),e=Formula.IMREAL(b),f=Formula.IMAGINARY(b),g=a.substring(a.length-1),h=a.substring(a.length-1),i="i";if("j"===g?i="j":"j"===h&&(i="j"),"#NUM!"===c||"#NUM!"===d||"#NUM!"===e||"#NUM!"===f)return"#NUM!";if(0===e&&0===f)return"#NUM!";var j=e*e+f*f;return Formula.COMPLEX((c*e+d*f)/j,(d*e-c*f)/j,i)},Formula.IMEXP=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);if(d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c)return"#NUM!";var e=Math.exp(b);return Formula.COMPLEX(e*Math.cos(c),e*Math.sin(c),d)},Formula.IMLN=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.COMPLEX(Math.log(Math.sqrt(b*b+c*c)),Math.atan(c/b),d)},Formula.IMLOG10=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.COMPLEX(Math.log(Math.sqrt(b*b+c*c))/Math.log(10),Math.atan(c/b)/Math.log(10),d)},Formula.IMLOG2=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.COMPLEX(Math.log(Math.sqrt(b*b+c*c))/Math.log(2),Math.atan(c/b)/Math.log(2),d)},Formula.IMPOWER=function(a,b){if(isNaN(b))return"#VALUE!";var c=Formula.IMREAL(a),d=Formula.IMAGINARY(a),e=a.substring(a.length-1);if(e="i"===e||"j"===e?e:"i","#NUM!"===c||"#NUM!"===d)return"#NUM!";var f=Math.pow(Formula.IMABS(a),b),g=Formula.IMARGUMENT(a);return Formula.COMPLEX(f*Math.cos(b*g),f*Math.sin(b*g),e)},Formula.IMPRODUCT=function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=Formula.IMREAL(a),d=Formula.IMAGINARY(a),e=Formula.IMREAL(arguments[b]),f=Formula.IMAGINARY(arguments[b]);if("#NUM!"===c||"#NUM!"===d||"#NUM!"===e||"#NUM!"===f)return"#NUM!";a=Formula.COMPLEX(c*e-d*f,c*f+d*e)}return a},Formula.IMREAL=function(a){if(0===a||"0"===a)return 0;if(["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(a)>=0)return 0;var b=a.indexOf("+"),c=a.indexOf("-");0===b&&(b=a.indexOf("+",1)),0===c&&(c=a.indexOf("-",1));var d=a.substring(a.length-1,a.length),e="i"===d||"j"===d;return b>=0||c>=0?e?b>=0?isNaN(a.substring(0,b))||isNaN(a.substring(b+1,a.length-1))?"#NUM!":Number(a.substring(0,b)):isNaN(a.substring(0,c))||isNaN(a.substring(c+1,a.length-1))?"#NUM!":Number(a.substring(0,c)):"#NUM!":e?isNaN(a.substring(0,a.length-1))?"#NUM!":0:isNaN(a)?"#NUM!":a},Formula.IMSEC=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.IMDIV("1",Formula.IMCOS(a))},Formula.IMSECH=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.IMDIV("1",Formula.IMCOSH(a))},Formula.IMSIN=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.COMPLEX(Math.sin(b)*(Math.exp(c)+Math.exp(-c))/2,Math.cos(b)*(Math.exp(c)-Math.exp(-c))/2,d)},Formula.IMSINH=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);return d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.COMPLEX(Math.cos(c)*(Math.exp(b)-Math.exp(-b))/2,Math.sin(c)*(Math.exp(b)+Math.exp(-b))/2,d)},Formula.IMSQRT=function(a){var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a),d=a.substring(a.length-1);if(d="i"===d||"j"===d?d:"i","#NUM!"===b||"#NUM!"===c)return"#NUM!";var e=Math.sqrt(Formula.IMABS(a)),f=Formula.IMARGUMENT(a);return Formula.COMPLEX(e*Math.cos(f/2),e*Math.sin(f/2),d)},Formula.IMSUB=function(a,b){var c=Formula.IMREAL(a),d=Formula.IMAGINARY(a),e=Formula.IMREAL(b),f=Formula.IMAGINARY(b),g=a.substring(a.length-1),h=a.substring(a.length-1),i="i";return"j"===g?i="j":"j"===h&&(i="j"),"#NUM!"===c||"#NUM!"===d||"#NUM!"===e||"#NUM!"===f?"#NUM!":Formula.COMPLEX(c-e,d-f,i)},Formula.IMSUM=function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=Formula.IMREAL(a),d=Formula.IMAGINARY(a),e=Formula.IMREAL(arguments[b]),f=Formula.IMAGINARY(arguments[b]);if("#NUM!"===c||"#NUM!"===d||"#NUM!"===e||"#NUM!"===f)return"#NUM!";a=Formula.COMPLEX(c+e,d+f)}return a},Formula.IMTAN=function(a){if(a===!0||a===!1)return"#VALUE!";var b=Formula.IMREAL(a),c=Formula.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":Formula.IMDIV(Formula.IMSIN(a),Formula.IMCOS(a))},Formula.OCT2BIN=function(a,b){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";var c=10===a.length&&"7"===a.substring(0,1)?!0:!1,d=c?parseInt(a,8)-1073741824:parseInt(a,8);if(-512>d||d>511)return"#NUM!";if(c)return"1"+_s.repeat("0",9-(512+d).toString(2).length)+(512+d).toString(2);var e=d.toString(2);return"undefined"==typeof b?e:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=e.length?_s.repeat("0",b-e.length)+e:"#NUM!")},Formula.OCT2DEC=function(a){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";var b=parseInt(a,8);return b>=536870912?b-1073741824:b},Formula.OCT2HEX=function(a,b){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";var c=parseInt(a,8);if(c>=536870912)return"ff"+(c+3221225472).toString(16);var d=c.toString(16);return"undefined"==typeof b?d:isNaN(b)?"#VALUE!":0>b?"#NUM!":(b=Math.floor(b),b>=d.length?_s.repeat("0",b-d.length)+d:"#NUM!")},Formula.ACCRINT=function(a,b,c,d,e,f,g,h){if(!moment(a).isValid()||!moment(b).isValid()||!moment(c).isValid())return"#VALUE!";if(0>=d||0>=e)return"#NUM!";if(-1===[1,2,4].indexOf(f))return"#NUM!";if(-1===[0,1,2,3,4].indexOf(g))return"#NUM!";if(moment(a).diff(moment(c))>=0)return"#NUM!";e="undefined"==typeof e?0:e,g="undefined"==typeof g?0:g,h="undefined"==typeof h?!0:h;var i=0;switch(g){case 0:i=Formula.YEARFRAC(a,c,g);break;case 1:i=Formula.YEARFRAC(a,c,g);break;case 2:i=Formula.YEARFRAC(a,c,g);break;case 3:i=Formula.YEARFRAC(a,c,g);break;case 4:i=Formula.YEARFRAC(a,c,g)}return e*d*i},Formula.ACCRINTM=function(){},Formula.AMORDEGRC=function(){},Formula.AMORLINC=function(){},Formula.COUPDAYBS=function(){},Formula.COUPDAYS=function(){},Formula.COUPDAYSNC=function(){},Formula.COUPNCD=function(){},Formula.COUPNUM=function(){},Formula.COUPPCD=function(){},Formula.CUMIPMT=function(rate,periods,value,start,end,type){if(rate=eval(rate),periods=eval(periods),0>=rate||0>=periods||0>=value)return"#NUM!";if(1>start||1>end||start>end)return"#NUM!";if(0!==type&&1!==type)return"#NUM!";var payment=Formula.PMT(rate,periods,value,0,type),interest=0;1===start&&0===type&&(interest=-value,start++);for(var i=start;end>=i;i++)interest+=1===type?Formula.FV(rate,i-2,payment,value,1)-payment:Formula.FV(rate,i-1,payment,value,0);return interest*=rate},Formula.CUMPRINC=function(rate,periods,value,start,end,type){if(rate=eval(rate),periods=eval(periods),0>=rate||0>=periods||0>=value)return"#NUM!";if(1>start||1>end||start>end)return"#NUM!";if(0!==type&&1!==type)return"#NUM!";var payment=Formula.PMT(rate,periods,value,0,type),principal=0;1===start&&(principal=0===type?payment+value*rate:payment,start++);for(var i=start;end>=i;i++)principal+=type>0?payment-(Formula.FV(rate,i-2,payment,value,1)-payment)*rate:payment-Formula.FV(rate,i-1,payment,value,0)*rate;return principal},Formula.DB=function(a,b,c,d,e){if(e="undefined"==typeof e?12:e,isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)||isNaN(e))return"#VALUE!";if(0>a||0>b||0>c||0>d)return"#NUM!";if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(e))return"#NUM!";if(d>c)return"#NUM!";if(b>=a)return 0;for(var f=(1-Math.pow(b/a,1/c)).toFixed(3),g=a*f*e/12,h=g,i=0,j=d===c?c-1:d,k=2;j>=k;k++)i=(a-h)*f,h+=i;return 1===d?g:d===c?(a-h)*f:i},Formula.DDB=function(a,b,c,d,e){if(e="undefined"==typeof e?2:e,isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)||isNaN(e))return"#VALUE!";if(0>a||0>b||0>c||0>d||0>=e)return"#NUM!";if(d>c)return"#NUM!";if(b>=a)return 0;for(var f=0,g=0,h=1;d>=h;h++)g=Math.min((a-f)*(e/c),a-b-f),f+=g;return g},Formula.DISC=function(){},Formula.DOLLARDE=function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";if(b>=0&&1>b)return"#DIV/0!";b=parseInt(b,10);var c=parseInt(a,10);c+=a%1*Math.pow(10,Math.ceil(Math.log(b)/Math.LN10))/b;var d=Math.pow(10,Math.ceil(Math.log(b)/Math.LN2)+1);return c=Math.round(c*d)/d},Formula.DOLLARFR=function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";if(b>=0&&1>b)return"#DIV/0!";b=parseInt(b,10);var c=parseInt(a,10);return c+=a%1*Math.pow(10,-Math.ceil(Math.log(b)/Math.LN10))*b},Formula.DURATION=function(){},Formula.EFFECT=function(a,b){return isNaN(a)||isNaN(b)?"#VALUE!":0>=a||1>b?"#NUM!":(b=parseInt(b,10),Math.pow(1+a/b,b)-1)},Formula.FV=function(rate,periods,payment,value,type){type="undefined"==typeof type?0:type,rate=eval(rate);var result;if(0===rate)result=value+payment*periods;
else{var term=Math.pow(1+rate,periods);result=1===type?value*term+payment*(1+rate)*(term-1)/rate:value*term+payment*(term-1)/rate}return-result},Formula.FVSCHEDULE=function(a,b){for(var c=a,d=0;d<b.length;d++){if(isNaN(b[d]))return"#VALUE!";c*=1+b[d]}return c},Formula.INTRATE=function(){},Formula.IPMT=function(rate,period,periods,present,future,type){type="undefined"==typeof type?0:type,rate=eval(rate),periods=eval(periods);var payment=Formula.PMT(rate,periods,present,future,type),interest;return interest=1===period?1===type?0:-present:1===type?Formula.FV(rate,period-2,payment,present,1)-payment:Formula.FV(rate,period-1,payment,present,0),interest*rate},Formula.IRR=function(a,b){a=Formula.FLATTEN(a);for(var c=function(a,b,c){for(var d=c+1,e=a[0],f=1;f<a.length;f++)e+=a[f]/Math.pow(d,(b[f]-b[0])/365);return e},d=function(a,b,c){for(var d=c+1,e=0,f=1;f<a.length;f++){var g=(b[f]-b[0])/365;e-=g*a[f]/Math.pow(d,g+1)}return e},e=[],f=!1,g=!1,h=0;h<a.length;h++)e[h]=0===h?0:e[h-1]+365,a[h]>0&&(f=!0),a[h]<0&&(g=!0);if(!f||!g)return"#NUM!";b="undefined"==typeof b?.1:b;var i,j,k,l=b,m=1e-10,n=50,o=0,p=!0;do k=c(a,e,l),i=l-k/d(a,e,l),j=Math.abs(i-l),l=i,p=j>m&&Math.abs(k)>m;while(p&&++o<n);return p?"#NUM!":l},Formula.ISPMT=function(rate,period,periods,value){return rate=eval(rate),periods=eval(periods),value*rate*(period/periods-1)},Formula.MDURATION=function(){},Formula.MIRR=function(a,b,c){for(var d=a.length,e=[],f=[],g=0;d>g;g++)a[g]<0?e.push(a[g]):f.push(a[g]);var h=-Formula.NPV(c,f)*Math.pow(1+c,d-1),i=Formula.NPV(b,e)*(1+b);return Math.pow(h/i,1/(d-1))-1},Formula.NOMINAL=function(a,b){return isNaN(a)||isNaN(b)?"#VALUE!":0>=a||1>b?"#NUM!":(b=parseInt(b,10),(Math.pow(a+1,1/b)-1)*b)},Formula.NPER=function(rate,payment,present,future,type){type="undefined"==typeof type?0:type,future="undefined"==typeof future?0:future,rate=eval(rate);var num=payment*(1+rate*type)-future*rate,den=present*rate+payment*(1+rate*type);return Math.log(num/den)/Math.log(1+rate)},Formula.NPV=function(){for(var a=[],b=0;b<arguments.length;b++)a=a.concat(arguments[b]);for(var c=a[0],d=0,e=1;e<a.length;e++)d+=a[e]/Math.pow(1+c,e);return d},Formula.ODDFPRICE=function(){},Formula.ODDFYIELD=function(){},Formula.ODDLPRICE=function(){},Formula.ODDLYIELD=function(){},Formula.PDURATION=function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0>=a?"#NUM!":(Math.log(c)-Math.log(b))/Math.log(1+a)},Formula.PMT=function(rate,periods,present,future,type){type="undefined"==typeof type?0:type,rate=eval(rate),periods=eval(periods);var result;if(0===rate)result=(present+future)/periods;else{var term=Math.pow(1+rate,periods);result=1===type?(future*rate/(term-1)+present*rate/(1-1/term))/(1+rate):future*rate/(term-1)+present*rate/(1-1/term)}return-result},Formula.PPMT=function(a,b,c,d,e,f){return Formula.PMT(a,c,d,e,f)-Formula.IPMT(a,b,c,d,e,f)},Formula.PRICE=function(){},Formula.PRICEDISC=function(){},Formula.PRICEMAT=function(){},Formula.PV=function(rate,periods,payment,future,type){return type="undefined"==typeof type?0:type,rate=eval(rate),periods=eval(periods),0===rate?-payment*periods-future:((1-Math.pow(1+rate,periods))/rate*payment*(1+rate*type)-future)/Math.pow(1+rate,periods)},Formula.RATE=function(periods,payment,present,future,type,guess){guess="undefined"==typeof guess?.01:guess,future="undefined"==typeof future?0:future,type="undefined"==typeof type?0:type,periods=eval(periods);var epsMax=1e-10,iterMax=50,y,y0,y1,x0,x1=0,f=0,i=0,rate=guess;for(Math.abs(rate)<epsMax?y=present*(1+periods*rate)+payment*(1+rate*type)*periods+future:(f=Math.exp(periods*Math.log(1+rate)),y=present*f+payment*(1/rate+type)*(f-1)+future),y0=present+payment*periods+future,y1=present*f+payment*(1/rate+type)*(f-1)+future,i=x0=0,x1=rate;Math.abs(y0-y1)>epsMax&&iterMax>i;)rate=(y1*x0-y0*x1)/(y1-y0),x0=x1,x1=rate,Math.abs(rate)<epsMax?y=present*(1+periods*rate)+payment*(1+rate*type)*periods+future:(f=Math.exp(periods*Math.log(1+rate)),y=present*f+payment*(1/rate+type)*(f-1)+future),y0=y1,y1=y,++i;return rate},Formula.RECEIVED=function(){},Formula.RRI=function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0===a||0===b?"#NUM!":Math.pow(c/b,1/a)-1},Formula.SLN=function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0===c?"#NUM!":(a-b)/c},Formula.SYD=function(a,b,c,d){return isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)?"#VALUE!":0===c?"#NUM!":1>d||d>c?"#NUM!":(d=parseInt(d,10),(a-b)*(c-d+1)*2/(c*(c+1)))},Formula.TBILLEQ=function(a,b,c){return moment(a).isValid()&&moment(b).isValid()?0>=c?"#NUM!":moment(a).diff(moment(b))>0?"#NUM!":moment(b).diff(moment(a),"years")>1?"#NUM!":365*c/(360-c*Formula.DAYS360(a,b)):"#VALUE!"},Formula.TBILLPRICE=function(a,b,c){return moment(a).isValid()&&moment(b).isValid()?0>=c?"#NUM!":moment(a).diff(moment(b))>0?"#NUM!":moment(b).diff(moment(a),"years")>1?"#NUM!":100*(1-c*Formula.DAYS360(a,b)/360):"#VALUE!"},Formula.TBILLYIELD=function(a,b,c){return moment(a).isValid()&&moment(b).isValid()?0>=c?"#NUM!":moment(a).diff(moment(b))>0?"#NUM!":moment(b).diff(moment(a),"years")>1?"#NUM!":360*(100-c)/(c*Formula.DAYS360(a,b)):"#VALUE!"},Formula.VDB=function(){},Formula.XIRR=function(a,b,c){for(var d=function(a,b,c){for(var d=c+1,e=a[0],f=1;f<a.length;f++)e+=a[f]/Math.pow(d,moment(b[f]).diff(moment(b[0]),"days")/365);return e},e=function(a,b,c){for(var d=c+1,e=0,f=1;f<a.length;f++){var g=moment(b[f]).diff(moment(b[0]),"days")/365;e-=g*a[f]/Math.pow(d,g+1)}return e},f=!1,g=!1,h=0;h<a.length;h++)a[h]>0&&(f=!0),a[h]<0&&(g=!0);if(!f||!g)return"#NUM!";c=c||.1;var i,j,k,l=c,m=1e-10,n=50,o=0,p=!0;do k=d(a,b,l),i=l-k/e(a,b,l),j=Math.abs(i-l),l=i,p=j>m&&Math.abs(k)>m;while(p&&++o<n);return p?"#NUM!":l},Formula.XNPV=function(a,b,c){for(var d=0,e=0;e<b.length;e++)d+=b[e]/Math.pow(1+a,moment(c[e]).diff(moment(c[0]),"days")/365);return d},Formula.YIELD=function(){},Formula.YIELDDISC=function(){},Formula.YIELDMAT=function(){},Formula.ISNUMBER=function(a){return!isNaN(parseFloat(a))&&isFinite(a)?!0:!1},Formula.AND=function(){for(var a=!0,b=0;b<arguments.length;b++)arguments[b]||(a=!1);return a},Formula.FALSE=function(){return!1},Formula.SWITCH=function(){var a;if(arguments.length>0){var b=arguments[0],c=arguments.length-1,d=Math.floor(c/2),e=!1,f=c%2===0?null:arguments[arguments.length-1];if(d)for(var g=0;d>g;g++)if(b===arguments[2*g+1]){a=arguments[2*g+2],e=!0;break}!e&&f&&(a=f)}return a},Formula.IF=function(a,b,c){return a?b:c},Formula.IFNA=function(a,b){return"#N/A"===a?b:a},Formula.NOT=function(a){return!a},Formula.OR=function(){for(var a=!1,b=0;b<arguments.length;b++)arguments[b]&&(a=!0);return a},Formula.TRUE=function(){return!0},Formula.XOR=function(){for(var a=0,b=0;b<arguments.length;b++)arguments[b]&&a++;return 1&Math.floor(Math.abs(a))?!0:!1},Formula.REFERENCE=function(a,b){try{var c=b.split("."),d=a;return _(c).forEach(function(a){if("]"===a[a.length-1]){var b=a.indexOf("["),c=a.substring(b+1,a.length-1);d=d[a.substring(0,b)][c]}else d=d[a]}),d}catch(e){return}},Formula.ABS=function(a){return Math.abs(a)},Formula.ACOS=function(a){return Math.acos(a)},Formula.ACOSH=function(a){return Math.log(a+Math.sqrt(a*a-1))},Formula.ACOT=function(a){return Math.atan(1/a)},Formula.ACOTH=function(a){return.5*Math.log((a+1)/(a-1))},Formula.AGGREGATE=function(a){for(var b=[],c=2;c<arguments.length;c++)switch(a){case 1:b[c-2]=Formula.AVERAGE(arguments[c]);break;case 2:b[c-2]=Formula.COUNT(arguments[c]);break;case 3:b[c-2]=Formula.COUNTA(arguments[c]);break;case 4:b[c-2]=Formula.MAX(arguments[c]);break;case 5:b[c-2]=Formula.MIN(arguments[c]);break;case 6:b[c-2]=Formula.PRODUCT(arguments[c]);break;case 7:b[c-2]=Formula.STDEVS(arguments[c]);break;case 8:b[c-2]=Formula.STDEVP(arguments[c]);break;case 9:b[c-2]=Formula.SUM(arguments[c]);break;case 10:b[c-2]=Formula.VARS(arguments[c]);break;case 11:b[c-2]=Formula.VARP(arguments[c]);break;case 12:b[c-2]=Formula.MEDIAN(arguments[c]);break;case 13:b[c-2]=Formula.MODESNGL(arguments[c]);break;case 14:b[c-2]=Formula.LARGE(arguments[c]);break;case 15:b[c-2]=Formula.SMALL(arguments[c]);break;case 16:b[c-2]=Formula.PERCENTILEINC(arguments[c]);break;case 17:b[c-2]=Formula.QUARTILEINC(arguments[c]);break;case 18:b[c-2]=Formula.PERCENTILEEXC(arguments[c]);break;case 19:b[c-2]=Formula.QUARTILEEXC(arguments[c])}return b},Formula.ARABIC=function(a){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(a))throw new Error("Incorrect roman number");var b=0;return a.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(a){b+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[a]}),b},Formula.ASIN=function(a){return Math.asin(a)},Formula.ASINH=function(a){return Math.log(a+Math.sqrt(a*a+1))},Formula.ATAN=function(a){return Math.atan(a)},Formula.ATAN2=function(a,b){return Math.atan2(a,b)},Formula.ATANH=function(a){return Math.log((1+a)/(1-a))/2},Formula.BASE=function(a,b,c){c="undefined"==typeof c?0:c;var d=a.toString(b);return new Array(Math.max(c+1-d.length,0)).join("0")+d},Formula.CEILING=function(a,b,c){if(0===b)return 0;b="undefined"==typeof b?1:Math.abs(b),c="undefined"==typeof c?0:c;var d=-Math.floor(Math.log(b)/Math.log(10));return a>=0?Formula.ROUND(Math.ceil(a/b)*b,d):0===c?-Formula.ROUND(Math.floor(Math.abs(a)/b)*b,d):-Formula.ROUND(Math.ceil(Math.abs(a)/b)*b,d)},Formula.CEILINGMATH=Formula.CEILING,Formula.CEILINGPRECISE=Formula.CEILING,Formula.COMBIN=function(a,b){return Formula.FACT(a)/(Formula.FACT(b)*Formula.FACT(a-b))},Formula.COMBINA=function(a,b){return 0===a&&0===b?1:Formula.COMBIN(a+b-1,a-1)},Formula.COS=Math.cos,Formula.COSH=function(a){return(Math.exp(a)+Math.exp(-a))/2},Formula.COT=function(a){return 1/Math.tan(a)},Formula.COTH=function(a){var b=Math.exp(2*a);return(b+1)/(b-1)},Formula.CSC=function(a){return 1/Math.sin(a)},Formula.CSCH=function(a){return 2/(Math.exp(a)-Math.exp(-a))},Formula.DECIMAL=function(a,b){return parseInt(a,b)},Formula.DEGREES=function(a){return 180*a/Math.PI},Formula.EVEN=function(a){return Formula.CEILING(a,-2,-1)},Formula.EXP=Math.exp,Formula.FACT=function(a){var b=Math.floor(a);return 0===b||1===b?1:MEMOIZED_FACT[b]>0?MEMOIZED_FACT[b]:(MEMOIZED_FACT[b]=Formula.FACT(b-1)*b,MEMOIZED_FACT[b])},Formula.FACTDOUBLE=function(a){var b=Math.floor(a);return 0>=b?1:b*Formula.FACTDOUBLE(b-2)},Formula.FLOOR=function(a,b,c){if(0===b)return 0;b=b?Math.abs(b):1;var d=-Math.floor(Math.log(b)/Math.log(10));return a>=0?Formula.ROUND(Math.floor(a/b)*b,d):0===c||"undefined"==typeof c?-Formula.ROUND(Math.ceil(Math.abs(a)/b)*b,d):-Formula.ROUND(Math.floor(Math.abs(a)/b)*b,d)},Formula.FLOORMATH=Formula.FLOOR,Formula.FLOORPRECISE=function(a,b){if(0===b)return 0;b=b?Math.abs(b):1;var c=-Math.floor(Math.log(b)/Math.log(10));return a>=0?Formula.ROUND(Math.round(a/b)*b,c):-Formula.ROUND(Math.ceil(Math.abs(a)/b)*b,c)},Formula.GCD=function(){for(var a,b,c=arguments.length-1,d=arguments[c];c;)for(b=arguments[--c];a=b%d;b=d,d=a);return d},Formula.INT=function(a){return Math.floor(a)},Formula.ISEVEN=function(a){return 1&Math.floor(Math.abs(a))?!1:!0},Formula.ISOCEILING=Formula.CEILING,Formula.ISODD=function(a){return 1&Math.floor(Math.abs(a))?!0:!1},Formula.LCM=function(){for(var a,b,c,d,e=Formula.ARGSTOARRAY(arguments),f=1;void 0!==(c=e.pop());)for(;c>1;){if(c%2){for(a=3,b=Math.floor(Math.sqrt(c));b>=a&&c%a;a+=2);d=b>=a?a:c}else d=2;for(c/=d,f*=d,a=e.length;a;e[--a]%d===0&&1===(e[a]/=d)&&e.splice(a,1));}return f},Formula.LN=function(a){return Math.log(a)},Formula.LOG=function(a,b){return b="undefined"==typeof b?10:b,Math.log(a)/Math.log(b)},Formula.LOG10=function(a){return Math.log(a)/Math.log(10)},Formula.MOD=function(a,b){var c=Math.abs(a%b);return b>0?c:-c},Formula.MROUND=function(a,b){if(0>a*b)throw new Error("Number and multiple must have the same sign.");return Math.round(a/b)*b},Formula.MULTINOMIAL=function(){for(var a=0,b=1,c=0;c<arguments.length;c++)a+=arguments[c],b*=Formula.FACT(arguments[c]);return Formula.FACT(a)/b},Formula.ODD=function(a){var b=Math.ceil(Math.abs(a));return b=1&b?b:b+1,a>0?b:-b},Formula.E=function(){return Math.E},Formula.PI=function(){return Math.PI},Formula.POWER=function(a,b){var c=Math.pow(a,b);return isNaN(c)?"#NUM!":c},Formula.PRODUCT=function(){for(var a=1,b=0;b<arguments.length;b++)a*=arguments[b];return a},Formula.QUOTIENT=function(a,b){return(a/b).toFixed(0)},Formula.RADIANS=function(a){return a*Math.PI/180},Formula.RAND=function(){return Math.random()},Formula.RANDBETWEEN=function(a,b){return a+Math.ceil((b-a+1)*Math.random())-1},Formula.ROUND=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Formula.ROUNDDOWN=function(a,b){var c=a>0?1:-1;return c*Math.floor(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)},Formula.ROUNDUP=function(a,b){var c=a>0?1:-1;return c*Math.ceil(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)},Formula.SERIESSUM=function(a,b,c,d){for(var e=d[0]*Math.pow(a,b),f=1;f<d.length;f++)e+=d[f]*Math.pow(a,b+f*c);return e},Formula.SEC=function(a){return 1/Math.cos(a)},Formula.SECH=function(a){return 2/(Math.exp(a)+Math.exp(-a))},Formula.SIGN=function(a){return 0>a?-1:0===a?0:1},Formula.SIN=Math.sin,Formula.SINH=function(a){return(Math.exp(a)-Math.exp(-a))/2},Formula.SQRT=Math.sqrt,Formula.SQRTPI=function(a){return Math.sqrt(a*Math.PI)},Formula.SUBTOTAL=function(a){for(var b=[],c=1;c<arguments.length;c++)switch(a){case 1:b[c-1]=Formula.AVERAGE(arguments[c]);break;case 2:b[c-1]=Formula.COUNT(arguments[c]);break;case 3:b[c-1]=Formula.COUNTA(arguments[c]);break;case 4:b[c-1]=Formula.MAX(arguments[c]);break;case 5:b[c-1]=Formula.MIN(arguments[c]);break;case 6:b[c-1]=Formula.PRODUCT(arguments[c]);break;case 7:b[c-1]=Formula.STDEV(arguments[c]);break;case 8:b[c-1]=Formula.STDEVP(arguments[c]);break;case 9:b[c-1]=Formula.SUM(arguments[c]);break;case 10:b[c-1]=Formula.VAR(arguments[c]);break;case 11:b[c-1]=Formula.VARP(arguments[c])}return b},Formula.SUM=function(){for(var a=Formula.FLATTEN(arguments),b=0,c=0;c<a.length;c++)if(a[c]instanceof Array)for(var d=0;d<a[c].length;d++)b+=Formula.ISNUMBER(a[c][d])?a[c][d]:0;else b+=Formula.ISNUMBER(a[c])?a[c]:0;return b},Formula.SUMIF=function(range,criteria){range=Formula.FLATTEN(range);for(var result=0,i=0;i<range.length;i++)result+=eval(range[i]+criteria)?range[i]:0;return result},Formula.SUMIFS=function(){for(var criteria=(arguments.length-1)/2,range=arguments[0],result=0,i=0;i<range.length;i++){for(var fit=!0,j=0;criteria>j;j++)eval(arguments[2*j+1][i]+arguments[2*j+2])||(fit=!1);result+=fit?range[i]:0}return result},Formula.SUMPRODUCT=function(){for(var a=arguments.length+1,b=0,c=0;c<arguments[0].length;c++)for(var d=0;d<arguments[0][c].length;d++){for(var e=1,f=1;a>f;f++)e*=arguments[f-1][c][d];b+=e}return b},Formula.SUMSQ=function(){for(var a=Formula.FLATTEN(arguments),b=0,c=0;c<a.length;c++)b+=Formula.ISNUMBER(a[c])?a[c]*a[c]:0;return b},Formula.SUMX2MY2=function(a,b){var c=0;a=Formula.FLATTEN(a),b=Formula.FLATTEN(b);for(var d=0;d<a.length;d++)c+=a[d]*a[d]-b[d]*b[d];return c},Formula.SUMX2PY2=function(a,b){var c=0;a=Formula.FLATTEN(a),b=Formula.FLATTEN(b);for(var d=0;d<a.length;d++)c+=a[d]*a[d]+b[d]*b[d];return c},Formula.SUMXMY2=function(a,b){var c=0;a=Formula.FLATTEN(a),b=Formula.FLATTEN(b);for(var d=0;d<a.length;d++)c+=Math.pow(a[d]-b[d],2);return c},Formula.TAN=function(a){return Math.tan(a)},Formula.TANH=function(a){var b=Math.exp(2*a);return(b-1)/(b+1)},Formula.TRUNC=function(a,b){b="undefined"==typeof b?0:b;var c=a>0?1:-1;return c*Math.floor(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)},Formula.AVEDEV=function(){var a=Formula.FLATTEN(arguments);return jStat.sum(jStat(a).subtract(jStat.mean(a)).abs()[0])/a.length},Formula.AVERAGE=function(){for(var a=Formula.NUMBERS(Formula.FLATTEN(arguments)),b=a.length,c=0,d=0,e=0;b>e;e++)c+=a[e],d+=1;return c/d},Formula.AVERAGEA=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=0,d=0,e=0;b>e;e++){var f=a[e];"number"==typeof f&&(c+=f),f===!0&&c++,null!==f&&d++}return c/d},Formula.AVERAGEIF=function(range,criteria,average_range){average_range=average_range||range,range=Formula.FLATTEN(range),average_range=Formula.FLATTEN(average_range);for(var average_count=0,result=0,i=0;i<range.length;i++)eval(range[i]+criteria)&&(result+=average_range[i],average_count++);return result/average_count},Formula.AVERAGEIFS=function(){for(var args=Formula.ARGSTOARRAY(arguments),criteria=(args.length-1)/2,range=Formula.FLATTEN(args[0]),count=0,result=0,i=0;i<range.length;i++){for(var condition="",j=0;criteria>j;j++)condition+=args[2*j+1][i]+args[2*j+2],j!==criteria-1&&(condition+="&&");eval(condition)&&(result+=range[i],count++)}var average=result/count;return isNaN(average)?0:average},Formula.BETADIST=function(a,b,c,d,e,f){return e="undefined"==typeof e?0:e,f="undefined"==typeof f?1:f,a=(a-e)/(f-e),d?jStat.beta.cdf(a,b,c):jStat.beta.pdf(a,b,c)},Formula.BETAINV=function(a,b,c,d,e){return d="undefined"==typeof d?0:d,e="undefined"==typeof e?1:e,jStat.beta.inv(a,b,c)*(e-d)+d},Formula.BINOMDIST=function(a,b,c,d){return d?jStat.binomial.cdf(a,b,c):jStat.binomial.pdf(a,b,c)},Formula.BINOMDISTRANGE=function(a,b,c,d){d="undefined"==typeof d?c:d;for(var e=0,f=c;d>=f;f++)e+=Formula.COMBIN(a,f)*Math.pow(b,f)*Math.pow(1-b,a-f);return e},Formula.BINOMINV=function(a,b,c){for(var d=0;a>=d;){if(jStat.binomial.cdf(d,a,b)>=c)return d;d++}},Formula.CHISQDIST=function(a,b,c){return c?jStat.chisquare.cdf(a,b):jStat.chisquare.pdf(a,b)},Formula.CHISQDISTRT=function(){},Formula.CHISQINV=function(a,b){return jStat.chisquare.inv(a,b)},Formula.CHISQINVRT=function(){},Formula.CHISQTEST=function(){},Formula.CONFIDENCENORM=function(a,b,c){return jStat.normalci(1,a,b,c)[1]-1},Formula.CONFIDENCET=function(a,b,c){return jStat.tci(1,a,b,c)[1]-1},Formula.CORREL=function(){return jStat.corrcoeff.apply(this,arguments)},Formula.COUNT=function(){var a=Formula.NUMBERS(Formula.FLATTEN(arguments));return a.length},Formula.COUNTA=function(){var a=Formula.FLATTEN(arguments);return a.length-Formula.COUNTBLANK(a)},Formula.COUNTBLANK=function(){for(var a,b=Formula.FLATTEN(arguments),c=0,d=0;d<b.length;d++)a=b[d],null!==a&&""!==a&&a||c++;return c},Formula.COUNTIF=function(a,b){a=Formula.FLATTEN(a);for(var c=0,d=0;d<a.length;d++)a[d].match(new RegExp(b))&&c++;return c},Formula.COUNTIFS=function(){for(var criteria=(arguments.length-1)/2,range=arguments[0],result=0,i=0;i<range.length;i++){for(var fit=!0,j=0;criteria>j;j++)eval(arguments[2*j+1][i]+arguments[2*j+2])||(fit=!1);result+=fit?1:0}return result},Formula.COUNTUNIQUE=function(){return _.uniq(Formula.FLATTEN(arguments)).length},Formula.COVARIANCEP=function(a,b){a=Formula.FLATTEN(a),b=Formula.FLATTEN(b);for(var c=jStat.mean(a),d=jStat.mean(b),e=0,f=a.length,g=0;f>g;g++)e+=(a[g]-c)*(b[g]-d);return e/f},Formula.COVARIANCES=function(){return jStat.covariance.apply(this,simplifyArguments(arguments))},Formula.DEVSQ=function(){for(var a=Formula.ARGSCONCAT(arguments),b=jStat.mean(a),c=0,d=0;d<a.length;d++)c+=Math.pow(a[d]-b,2);return c},Formula.EXPONDIST=function(a,b,c){return c?jStat.exponential.cdf(a,b):jStat.exponential.pdf(a,b)},Formula.FDIST=function(a,b,c,d){return d?jStat.centralF.cdf(a,b,c):jStat.centralF.pdf(a,b,c)},Formula.FDISTRT=function(){},Formula.FINV=function(a,b,c){return 0>=a||a>1?"#NUM!":jStat.centralF.inv(1-a,b,c)},Formula.FINVRT=function(){},Formula.FTEST=function(){},Formula.FISHER=function(a){return Math.log((1+a)/(1-a))/2},Formula.FISHERINV=function(a){var b=Math.exp(2*a);return(b-1)/(b+1)},Formula.FORECAST=function(a,b,c){c=Formula.FLATTEN(c),b=Formula.FLATTEN(b);for(var d=jStat.mean(c),e=jStat.mean(b),f=c.length,g=0,h=0,i=0;f>i;i++)g+=(c[i]-d)*(b[i]-e),h+=Math.pow(c[i]-d,2);var j=g/h,k=e-j*d;return k+j*a},Formula.FREQUENCY=function(a,b){for(var c=a.length,d=b.length,e=[],f=0;d>=f;f++){e[f]=0;for(var g=0;c>g;g++)0===f?a[g]<=b[0]&&(e[0]+=1):d>f?a[g]>b[f-1]&&a[g]<=b[f]&&(e[f]+=1):f===d&&a[g]>b[d-1]&&(e[d]+=1)}return e},Formula.GAMMA=function(){return jStat.gammafn.apply(this,arguments)},Formula.GAMMADIST=function(){},Formula.GAMMAINV=function(){},Formula.GAMMALN=function(){return jStat.gammaln.apply(this,arguments)},Formula.GAMMALNPRECISE=function(){},Formula.GAUSS=function(a){return jStat.normal.cdf(a,0,1)-.5},Formula.GEOMEAN=function(){return jStat.geomean(Formula.ARGSCONCAT(arguments))},Formula.GROWTH=function(a,b,c,d){var e;if("undefined"==typeof b)for(b=[],e=1;e<=a.length;e++)b.push(e);if("undefined"==typeof c)for(c=[],e=1;e<=a.length;e++)c.push(e);"undefined"==typeof d&&(d=!0);var f=a.length,g=0,h=0,i=0,j=0;for(e=0;f>e;e++){var k=b[e],l=Math.log(a[e]);g+=k,h+=l,i+=k*l,j+=k*k}g/=f,h/=f,i/=f,j/=f;var m,n;d?(m=(i-g*h)/(j-g*g),n=h-m*g):(m=i/j,n=0);var o=[];for(e=0;e<c.length;e++)o.push(Math.exp(n+m*c[e]));return o},Formula.HARMEAN=function(){for(var a=Formula.ARGSCONCAT(arguments),b=a.length,c=0,d=0;b>d;d++)c+=1/a[d];return b/c},Formula.HYPGEOMDIST=function(a,b,c,d,e){function f(a,b,c,d){return Formula.COMBIN(c,a)*Formula.COMBIN(d-c,b-a)/Formula.COMBIN(d,b)}function g(a,b,c,d){for(var e=0,g=0;a>=g;g++)e+=f(g,b,c,d);return e}return e?g(a,b,c,d):f(a,b,c,d)},Formula.INTERCEPT=function(a,b){return Formula.FORECAST(0,a,b)},Formula.KURT=function(){for(var a=Formula.ARGSCONCAT(arguments),b=jStat.mean(a),c=a.length,d=0,e=0;c>e;e++)d+=Math.pow(a[e]-b,4);return d/=Math.pow(jStat.stdev(a,!0),4),c*(c+1)/((c-1)*(c-2)*(c-3))*d-3*(c-1)*(c-1)/((c-2)*(c-3))},Formula.LARGE=function(a,b){return a.sort(function(a,b){return b-a})[b-1]},Formula.LINEST=function(a,b){for(var c=jStat.mean(b),d=jStat.mean(a),e=b.length,f=0,g=0,h=0;e>h;h++)f+=(b[h]-c)*(a[h]-d),g+=Math.pow(b[h]-c,2);var i=f/g,j=d-i*c;return[i,j]},Formula.LOGEST=function(){},Formula.LOGNORMDIST=function(a,b,c,d){return d?jStat.lognormal.cdf(a,b,c):jStat.lognormal.pdf(a,b,c)},Formula.LOGNORMINV=function(a,b,c){return jStat.lognormal.inv(a,b,c)},Formula.MAX=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=b>0?a[0]:0,d=0;b>d;d++)c=a[d]>c&&a[d]!==!0&&a[d]!==!1?a[d]:c;return c},Formula.MAXA=function(){var a=Formula.FLATTEN(arguments);return a.length>0?Math.max.apply(Math,a):0},Formula.MEDIAN=function(){return jStat.median(Formula.FLATTEN(arguments))},Formula.MIN=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=b>0?a[0]:0,d=0;b>d;d++)c=a[d]<c&&a[d]!==!0&&a[d]!==!1?a[d]:c;return c},Formula.MINA=function(){var a=Formula.FLATTEN(arguments);return a.length>0?Math.min.apply(Math,a):0},Formula.MODEMULT=function(){for(var a,b=Formula.ARGSCONCAT(arguments),c=b.length,d={},e=[],f=0,g=0;c>g;g++)a=b[g],d[a]=d[a]?d[a]+1:1,d[a]>f&&(f=d[a],e=[]),d[a]===f&&(e[e.length]=a);return e},Formula.MODESNGL=function(){return Formula.MODEMULT(Formula.ARGSCONCAT(arguments)).sort(function(a,b){return a-b})[0]},Formula.NEGBINOMDIST=function(a,b,c,d){return d?jStat.negbin.cdf(a,b,c):jStat.negbin.pdf(a,b,c)},Formula.NORMDIST=function(a,b,c,d){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0>=c?"#NUM!":d?jStat.normal.cdf(a,b,c):jStat.normal.pdf(a,b,c)},Formula.NORMINV=function(a,b,c){return jStat.normal.inv(a,b,c)},Formula.NORMSDIST=function(a,b){return b?jStat.normal.cdf(a,0,1):jStat.normal.pdf(a,0,1)},Formula.NORMSINV=function(a){return jStat.normal.inv(a,0,1)},Formula.PEARSON=function(a,b){for(var c=jStat.mean(a),d=jStat.mean(b),e=a.length,f=0,g=0,h=0,i=0;e>i;i++)f+=(a[i]-c)*(b[i]-d),g+=Math.pow(a[i]-c,2),h+=Math.pow(b[i]-d,2);return f/Math.sqrt(g*h)},Formula.PERCENTILEEXC=function(a,b){a=a.sort(function(a,b){return a-b});var c=a.length;if(1/(c+1)>b||b>1-1/(c+1))return"#NUM!";var d=b*(c+1)-1,e=Math.floor(d);return Formula.CLEANFLOAT(d===e?a[d]:a[e]+(d-e)*(a[e+1]-a[e]))},Formula.PERCENTILEINC=function(a,b){a=a.sort(function(a,b){return a-b});var c=a.length,d=b*(c-1),e=Math.floor(d);return Formula.CLEANFLOAT(d===e?a[d]:a[e]+(d-e)*(a[e+1]-a[e]))},Formula.PERCENTRANKEXC=function(a,b,c){a=a.sort(function(a,b){return a-b});var d=_.uniq(a),e=a.length,f=d.length;c="undefined"==typeof c?3:c;for(var g=Math.pow(10,c),h=0,i=!1,j=0;!i&&f>j;)b===d[j]?(h=(a.indexOf(d[j])+1)/(e+1),i=!0):b>=d[j]&&(b<d[j+1]||j===f-1)&&(h=(a.indexOf(d[j])+1+(b-d[j])/(d[j+1]-d[j]))/(e+1),i=!0),j++;return Math.floor(h*g)/g},Formula.PERCENTRANKINC=function(a,b,c){a=a.sort(function(a,b){return a-b});var d=_.uniq(a),e=a.length,f=d.length;c="undefined"==typeof c?3:c;for(var g=Math.pow(10,c),h=0,i=!1,j=0;!i&&f>j;)b===d[j]?(h=a.indexOf(d[j])/(e-1),i=!0):b>=d[j]&&(b<d[j+1]||j===f-1)&&(h=(a.indexOf(d[j])+(b-d[j])/(d[j+1]-d[j]))/(e-1),i=!0),j++;return Math.floor(h*g)/g},Formula.PERMUT=function(a,b){return Formula.FACT(a)/Formula.FACT(a-b)},Formula.PERMUTATIONA=function(a,b){return Math.pow(a,b)},Formula.PHI=function(a){return Math.exp(-.5*a*a)/SQRT2PI},Formula.POISSONDIST=function(a,b,c){return c?jStat.poisson.cdf(a,b):jStat.poisson.pdf(a,b)},Formula.PROB=function(a,b,c,d){if("undefined"==typeof c)return 0;if(d="undefined"==typeof d?c:d,c===d)return a.indexOf(c)>=0?b[a.indexOf(c)]:0;for(var e=a.sort(function(a,b){return a-b}),f=e.length,g=0,h=0;f>h;h++)e[h]>=c&&e[h]<=d&&(g+=b[a.indexOf(e[h])]);return g},Formula.QUARTILEEXC=function(a,b){switch(b){case 1:return Formula.PERCENTILEEXC(a,.25);case 2:return Formula.PERCENTILEEXC(a,.5);case 3:return Formula.PERCENTILEEXC(a,.75);default:return"#NUM!"}},Formula.QUARTILEINC=function(a,b){switch(b){case 1:return Formula.PERCENTILEINC(a,.25);case 2:return Formula.PERCENTILEINC(a,.5);case 3:return Formula.PERCENTILEINC(a,.75);default:return"#NUM!"}},Formula.RANKAVG=function(a,b,c){c="undefined"==typeof c?!1:c;var d=c?function(a,b){return a-b}:function(a,b){return b-a};b=b.sort(d);var e=Formula.COUNTIN(b,a);return e>1?(2*b.indexOf(a)+e+1)/2:b.indexOf(a)+1},Formula.RANKEQ=function(a,b,c){c="undefined"==typeof c?!1:c;var d=c?function(a,b){return a-b}:function(a,b){return b-a};return b=b.sort(d),b.indexOf(a)+1},Formula.RSQ=function(a,b){return Math.pow(Formula.PEARSON(a,b),2)},Formula.SKEW=function(){for(var a=Formula.ARGSCONCAT(arguments),b=jStat.mean(a),c=a.length,d=0,e=0;c>e;e++)d+=Math.pow(a[e]-b,3);return c*d/((c-1)*(c-2)*Math.pow(jStat.stdev(a,!0),3))},Formula.SKEWP=function(){for(var a=Formula.ARGSCONCAT(arguments),b=jStat.mean(a),c=a.length,d=0,e=0,f=0;c>f;f++)e+=Math.pow(a[f]-b,3),d+=Math.pow(a[f]-b,2);return e/=c,d/=c,e/Math.pow(d,1.5)},Formula.SLOPE=function(a,b){for(var c=jStat.mean(b),d=jStat.mean(a),e=b.length,f=0,g=0,h=0;e>h;h++)f+=(b[h]-c)*(a[h]-d),g+=Math.pow(b[h]-c,2);return f/g},Formula.SMALL=function(a,b){return a.sort(function(a,b){return a-b})[b-1]},Formula.STANDARDIZE=function(a,b,c){return(a-b)/c},Formula.STDEVA=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=0,d=jStat.mean(a),e=0;b>e;e++)c+=Math.pow(a[e]-d,2);return Math.sqrt(c/(b-1))},Formula.STDEVP=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=0,d=0,e=Formula.AVERAGE(a),f=0;b>f;f++)a[f]!==!0&&a[f]!==!1&&(c+=Math.pow(a[f]-e,2),d++);return Math.sqrt(c/d)},Formula.STDEVPA=function(){for(var a=Formula.ARGSCONCAT(arguments),b=a.length,c=0,d=jStat.mean(a),e=0;b>e;e++)c+=Math.pow(a[e]-d,2);return Math.sqrt(c/b)},Formula.STDEVS=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=0,d=0,e=Formula.AVERAGE(a),f=0;b>f;f++)a[f]!==!0&&a[f]!==!1&&(c+=Math.pow(a[f]-e,2),d++);return Math.sqrt(c/(d-1))},Formula.STEYX=function(a,b){for(var c=jStat.mean(b),d=jStat.mean(a),e=b.length,f=0,g=0,h=0,i=0;e>i;i++)f+=Math.pow(a[i]-d,2),g+=(b[i]-c)*(a[i]-d),h+=Math.pow(b[i]-c,2);return Math.sqrt((f-g*g/h)/(e-2))},Formula.TDIST=function(a,b,c){return c?jStat.studentt.cdf(a,b):jStat.studentt.pdf(a,b)},Formula.TDIST2T=function(){},Formula.TDISTRT=function(){},Formula.TINV=function(a,b){return jStat.studentt.inv(a,b)},Formula.TINV2T=function(){},Formula.TTEST=function(){},Formula.TREND=function(){},Formula.TRIMMEAN=function(a,b){a=Formula.FLATTEN(a);var c=Formula.FLOOR(a.length*b,2)/2;return jStat.mean(_.initial(_.rest(a.sort(function(a,b){return a-b}),c),c))},Formula.VARA=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=0,d=0,e=Formula.AVERAGEA(a),f=0;b>f;f++){var g=a[f];c+="number"==typeof g?Math.pow(g-e,2):g===!0?Math.pow(1-e,2):Math.pow(0-e,2),null!==g&&d++}return c/(d-1)},Formula.VARP=function(){for(var a=Formula.NUMBERS(Formula.FLATTEN(arguments)),b=a.length,c=0,d=0,e=Formula.AVERAGE(a),f=0;b>f;f++)c+=Math.pow(a[f]-e,2),d++;return c/d},Formula.VARPA=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=0,d=0,e=Formula.AVERAGEA(a),f=0;b>f;f++){var g=a[f];c+="number"==typeof g?Math.pow(g-e,2):g===!0?Math.pow(1-e,2):Math.pow(0-e,2),null!==g&&d++}return c/d},Formula.VARS=function(){for(var a=Formula.FLATTEN(arguments),b=a.length,c=0,d=0,e=Formula.AVERAGE(a),f=0;b>f;f++)a[f]!==!0&&a[f]!==!1&&(c+=Math.pow(a[f]-e,2),d++);return c/(d-1)},Formula.WEIBULLDIST=function(a,b,c,d){return d?1-Math.exp(-Math.pow(a/c,b)):Math.pow(a,b-1)*Math.exp(-Math.pow(a/c,b))*b/Math.pow(c,b)},Formula.ZTEST=function(a,b,c){var d=a.length,e="undefined"==typeof c?Formula.STDEVS(a):c;return 1-Formula.NORMSDIST((Formula.AVERAGE(a)-b)/(e/Math.sqrt(d)),Formula.TRUE)},Formula.CHAR=function(a){return String.fromCharCode(a)},Formula.CLEAN=function(a){return a.replace(/[\0-\x1F]/g,"")},Formula.CODE=function(a){return a.charCodeAt(0)},Formula.CONCATENATE=function(){for(var a="",b=0;b<arguments.length;b++)null!==arguments[b]&&void 0!==arguments[b]&&(a+=arguments[b]);return a},Formula.DOLLAR=function(a,b){b="undefined"==typeof b?2:b;var c="";return 0>=b?(a=Math.round(a*Math.pow(10,b))/Math.pow(10,b),c="($0,0)"):b>0&&(c="($0,0."+new Array(b+1).join("0")+")"),numeral(a).format(c)},Formula.EXACT=function(a,b){return a===b},Formula.FIND=function(a,b,c){return c="undefined"==typeof c?0:c,b?b.indexOf(a,c-1)+1:null},Formula.FIXED=function(a,b,c){b="undefined"==typeof b?2:b,c="undefined"==typeof c?!1:c;var d=c?"0":"0,0";return 0>=b?a=Math.round(a*Math.pow(10,b))/Math.pow(10,b):b>0&&(d+="."+new Array(b+1).join("0")),numeral(a).format(d)},Formula.HTML2TEXT=function(a){var b="";return a&&(a instanceof Array?a.forEach(function(a){""!==b&&(b+="\n"),b+=a.replace(/<(?:.|\n)*?>/gm,"")}):b=a.replace(/<(?:.|\n)*?>/gm,"")),b},Formula.HUMANIZE=function(a){if(a instanceof Date){var b=moment(a);return b.format(b.hours()||b.minutes()||b.seconds()?"dddd, MMMM Do YYYY, h:mm:ss":"dddd, MMMM Do YYYY")}return a},Formula.JOIN=function(a,b){return a.join(b)},Formula.LEFT=function(a,b){return b="undefined"==typeof b?1:b,a?a.substring(0,b):null},Formula.LEN=function(a){return a?a.length:0},Formula.LOWER=function(a){return a?a.toLowerCase():a},Formula.MID=function(a,b,c){return a.substring(b-1,c)},Formula.NUMBERVALUE=function(a,b,c){return b="undefined"==typeof b?".":b,c="undefined"==typeof c?",":c,Number(a.replace(b,".").replace(c,""))},Formula.NUMBERS=function(){var a=Formula.FLATTEN(arguments);return a.filter(function(a){return"number"==typeof a})},Formula.PROPER=function(a){return a?a.replace(/\w\S*/g,function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()}):void 0},Formula.REGEXEXTRACT=function(a,b){var c=a.match(new RegExp(b));return c?c[c.length>1?c.length-1:0]:null},Formula.REGEXMATCH=function(a,b,c){var d=a.match(new RegExp(b));return c?d:!!d},Formula.REGEXREPLACE=function(a,b,c){return a.replace(new RegExp(b),c)},Formula.REPLACE=function(a,b,c,d){return a.substr(0,b-1)+d+a.substr(b-1+c)},Formula.REPT=function(a,b){return new Array(b+1).join(a)},Formula.RIGHT=function(a,b){return b="undefined"==typeof b?1:b,a?a.substring(a.length-b):null},Formula.ROMAN=function(a){for(var b=String(a).split(""),c=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM","","X","XX","XXX","XL","L","LX","LXX","LXXX","XC","","I","II","III","IV","V","VI","VII","VIII","IX"],d="",e=3;e--;)d=(c[+b.pop()+10*e]||"")+d;return new Array(+b.join("")+1).join("M")+d},Formula.SEARCH=function(a,b,c){return c="undefined"==typeof c?0:c,b.toLowerCase().indexOf(a.toLowerCase(),c-1)+1},Formula.SPLIT=function(a,b){return _s.words(a,b)},Formula.SUBSTITUTE=function(a,b,c,d){if(!(a&&b&&c))return a;if("undefined"==typeof d)return a.replace(new RegExp(b,"g"),c);for(var e=0,f=0;a.indexOf(b,e)>0;)if(e=a.indexOf(b,e+1),f++,f===d)return a.substring(0,e)+c+a.substring(e+b.length)},Formula.T=function(a){return"string"==typeof a?a:null},Formula.TEXT=function(a,b){if(!a)return"";if(a instanceof Object)try{return JSON.stringify(a)
}catch(c){return""}return"string"==typeof a?b?b.indexOf("0")>=0?numeral(a).format(b):moment(new Date(a)).format(b):a:a.toString&&"function"==typeof a.toString?a.toString():""},Formula.TRIM=function(a){return _s.clean(a)},Formula.UNICHAR=Formula.CHAR,Formula.UNICODE=Formula.CODE,Formula.UPPER=function(a){return a.toUpperCase()},Formula.VALUE=function(a){return numeral().unformat(a)},Formula.MD5=function(a,b,c){return md5(a,b,c)},Formula.NUMERAL=function(a,b){return numeral(a).format(b)},Formula.ISERR=function(a){return["#DIV/0!","#NAME?","#NUM!","#NULL!","#REF!","#VALUE!"].indexOf(a)>=0?!0:!1},Formula.ISERROR=function(a){return Formula.ISERR(a)||"#N/A"===a},Formula.IFERROR=function(a,b){return Formula.ISERROR(a)?b:a},Formula}var root=this,Formula=root.Formula={},_=root._,numeral=root.numeral,jStat=root.jStat,moment=root.moment,lodash=_,md5=root.md5,_s=_.str;if("undefined"!=typeof exports)module.exports=exportModule(require("numeral"),require("jStat"),require("moment"),require("lodash"),require("underscore.string"),require("blueimp-md5"));else{if("function"!=typeof define||!define.amd)return Formula=exportModule(numeral,jStat,moment,lodash,_s,md5);define("formula",["numeral","jstat","moment","lodash","underscore.string","md5"],exportModule)}}.call(this);var Parser=function(){function Parser(){this.yy={}}var o=function(a,b,c,d){for(c=c||{},d=a.length;d--;c[a[d]]=b);return c},$V0=[1,4],$V1=[1,5],$V2=[1,7],$V3=[1,10],$V4=[1,8],$V5=[1,9],$V6=[1,11],$V7=[1,16],$V8=[1,17],$V9=[1,14],$Va=[1,15],$Vb=[1,18],$Vc=[1,20],$Vd=[1,21],$Ve=[1,22],$Vf=[1,23],$Vg=[1,24],$Vh=[1,25],$Vi=[1,26],$Vj=[1,27],$Vk=[1,28],$Vl=[1,29],$Vm=[5,11,12,13,15,16,17,18,19,20,21,22,30,31],$Vn=[5,11,12,13,15,16,17,18,19,20,21,22,30,31,33],$Vo=[1,38],$Vp=[5,11,12,13,15,16,17,18,19,20,21,22,30,31,35],$Vq=[5,12,13,15,16,17,18,19,30,31],$Vr=[5,12,15,16,17,18,30,31],$Vs=[5,12,13,15,16,17,18,19,20,21,30,31],$Vt=[15,30,31],$Vu=[5,11,12,13,15,16,17,18,19,20,21,22,30,31,32,36],parser={trace:function(){},yy:{},symbols_:{error:2,expressions:3,expression:4,EOF:5,variableSequence:6,TIME_AMPM:7,TIME_24:8,number:9,STRING:10,"&":11,"=":12,"+":13,"(":14,")":15,"<":16,">":17,NOT:18,"-":19,"*":20,"/":21,"^":22,FUNCTION:23,expseq:24,cell:25,FIXEDCELL:26,":":27,CELL:28,ARRAY:29,";":30,",":31,VARIABLE:32,DECIMAL:33,NUMBER:34,"%":35,"#":36,"!":37,$accept:0,$end:1},terminals_:{5:"EOF",7:"TIME_AMPM",8:"TIME_24",10:"STRING",11:"&",12:"=",13:"+",14:"(",15:")",16:"<",17:">",18:"NOT",19:"-",20:"*",21:"/",22:"^",23:"FUNCTION",26:"FIXEDCELL",27:":",28:"CELL",29:"ARRAY",30:";",31:",",32:"VARIABLE",33:"DECIMAL",34:"NUMBER",35:"%",36:"#",37:"!"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,1],[4,1],[4,3],[4,3],[4,3],[4,3],[4,4],[4,4],[4,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,3],[4,4],[4,1],[4,1],[4,2],[25,1],[25,3],[25,1],[25,3],[24,1],[24,1],[24,3],[24,3],[6,1],[6,3],[9,1],[9,3],[9,2],[2,3],[2,4]],performAction:function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 2:this.$=yy.handler.helper.callVariable.call(this,$$[$0]);break;case 3:this.$=yy.handler.time.call(yy.obj,$$[$0],!0);break;case 4:this.$=yy.handler.time.call(yy.obj,$$[$0]);break;case 5:this.$=yy.handler.helper.number($$[$0]);break;case 6:this.$=yy.handler.helper.string($$[$0]);break;case 7:this.$=yy.handler.helper.specialMatch("&",$$[$0-2],$$[$0]);break;case 8:this.$=yy.handler.helper.logicMatch("=",$$[$0-2],$$[$0]);break;case 9:this.$=yy.handler.helper.mathMatch("+",$$[$0-2],$$[$0]);break;case 10:this.$=yy.handler.helper.number($$[$0-1]);break;case 11:this.$=yy.handler.helper.logicMatch("<=",$$[$0-3],$$[$0]);break;case 12:this.$=yy.handler.helper.logicMatch(">=",$$[$0-3],$$[$0]);break;case 13:this.$=yy.handler.helper.logicMatch("<>",$$[$0-3],$$[$0]);break;case 14:this.$=yy.handler.helper.logicMatch("NOT",$$[$0-2],$$[$0]);break;case 15:this.$=yy.handler.helper.logicMatch(">",$$[$0-2],$$[$0]);break;case 16:this.$=yy.handler.helper.logicMatch("<",$$[$0-2],$$[$0]);break;case 17:this.$=yy.handler.helper.mathMatch("-",$$[$0-2],$$[$0]);break;case 18:this.$=yy.handler.helper.mathMatch("*",$$[$0-2],$$[$0]);break;case 19:this.$=yy.handler.helper.mathMatch("/",$$[$0-2],$$[$0]);break;case 20:this.$=yy.handler.helper.mathMatch("^",$$[$0-2],$$[$0]);break;case 21:var n1=yy.handler.helper.numberInverted($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 22:var n1=yy.handler.helper.number($$[$0]);this.$=n1,isNaN(this.$)&&(this.$=0);break;case 23:this.$=yy.handler.helper.callFunction.call(this,$$[$0-2],"");break;case 24:this.$=yy.handler.helper.callFunction.call(this,$$[$0-3],$$[$0-1]);break;case 28:this.$=yy.handler.helper.fixedCellValue.call(yy.obj,$$[$0]);break;case 29:this.$=yy.handler.helper.fixedCellRangeValue.call(yy.obj,$$[$0-2],$$[$0]);break;case 30:this.$=yy.handler.helper.cellValue.call(yy.obj,$$[$0]);break;case 31:this.$=yy.handler.helper.cellRangeValue.call(yy.obj,$$[$0-2],$$[$0]);break;case 32:this.$=yy.handler.utils.isArray($$[$0])?$$[$0]:[$$[$0]];break;case 33:var result=[],arr=eval("["+yytext+"]");arr.forEach(function(a){result.push(a)}),this.$=result;break;case 34:case 35:$$[$0-2].push($$[$0]),this.$=$$[$0-2];break;case 36:this.$=[$$[$0]];break;case 37:this.$=yy.handler.utils.isArray($$[$0-2])?$$[$0-2]:[$$[$0-2]],this.$.push($$[$0]);break;case 38:this.$=$$[$0];break;case 39:this.$=1*($$[$0-2]+"."+$$[$0]);break;case 40:this.$=.01*$$[$0-1];break;case 41:case 42:this.$=$$[$0-2]+$$[$0-1]+$$[$0]}},table:[{2:13,3:1,4:2,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{1:[3]},{5:[1,19],11:$Vc,12:$Vd,13:$Ve,16:$Vf,17:$Vg,18:$Vh,19:$Vi,20:$Vj,21:$Vk,22:$Vl},o($Vm,[2,2],{33:[1,30]}),o($Vm,[2,3]),o($Vm,[2,4]),o($Vm,[2,5],{35:[1,31]}),o($Vm,[2,6]),{2:13,4:32,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:33,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:34,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{14:[1,35]},o($Vm,[2,25]),o($Vm,[2,26],{2:36,32:[1,37],36:$Vb}),o($Vn,[2,36],{36:$Vo}),o($Vp,[2,38],{33:[1,39]}),o($Vm,[2,28],{27:[1,40]}),o($Vm,[2,30],{27:[1,41]}),{32:[1,42]},{1:[2,1]},{2:13,4:43,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:44,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:45,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:48,6:3,7:$V0,8:$V1,9:6,10:$V2,12:[1,46],13:$V3,14:$V4,17:[1,47],19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:50,6:3,7:$V0,8:$V1,9:6,10:$V2,12:[1,49],13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:51,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:52,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:53,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:54,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:55,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{32:[1,56]},o($Vp,[2,40]),{11:$Vc,12:$Vd,13:$Ve,15:[1,57],16:$Vf,17:$Vg,18:$Vh,19:$Vi,20:$Vj,21:$Vk,22:$Vl},o($Vq,[2,21],{11:$Vc,20:$Vj,21:$Vk,22:$Vl}),o($Vq,[2,22],{11:$Vc,20:$Vj,21:$Vk,22:$Vl}),{2:13,4:60,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,15:[1,58],19:$V5,23:$V6,24:59,25:12,26:$V7,28:$V8,29:[1,61],32:$V9,34:$Va,36:$Vb},o($Vm,[2,27]),{36:$Vo},{32:[1,62]},{34:[1,63]},{26:[1,64]},{28:[1,65]},{37:[1,66]},o($Vm,[2,7]),o([5,12,15,30,31],[2,8],{11:$Vc,13:$Ve,16:$Vf,17:$Vg,18:$Vh,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o($Vq,[2,9],{11:$Vc,20:$Vj,21:$Vk,22:$Vl}),{2:13,4:67,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:68,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},o($Vr,[2,16],{11:$Vc,13:$Ve,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),{2:13,4:69,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},o($Vr,[2,15],{11:$Vc,13:$Ve,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o([5,12,15,18,30,31],[2,14],{11:$Vc,13:$Ve,16:$Vf,17:$Vg,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o($Vq,[2,17],{11:$Vc,20:$Vj,21:$Vk,22:$Vl}),o($Vs,[2,18],{11:$Vc,22:$Vl}),o($Vs,[2,19],{11:$Vc,22:$Vl}),o([5,12,13,15,16,17,18,19,20,21,22,30,31],[2,20],{11:$Vc}),o($Vn,[2,37]),o($Vm,[2,10]),o($Vm,[2,23]),{15:[1,70],30:[1,71],31:[1,72]},o($Vt,[2,32],{11:$Vc,12:$Vd,13:$Ve,16:$Vf,17:$Vg,18:$Vh,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o($Vt,[2,33]),{37:[1,73]},o($Vp,[2,39]),o($Vm,[2,29]),o($Vm,[2,31]),o($Vu,[2,41]),o($Vr,[2,11],{11:$Vc,13:$Ve,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o($Vr,[2,13],{11:$Vc,13:$Ve,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o($Vr,[2,12],{11:$Vc,13:$Ve,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o($Vm,[2,24]),{2:13,4:74,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},{2:13,4:75,6:3,7:$V0,8:$V1,9:6,10:$V2,13:$V3,14:$V4,19:$V5,23:$V6,25:12,26:$V7,28:$V8,32:$V9,34:$Va,36:$Vb},o($Vu,[2,42]),o($Vt,[2,34],{11:$Vc,12:$Vd,13:$Ve,16:$Vf,17:$Vg,18:$Vh,19:$Vi,20:$Vj,21:$Vk,22:$Vl}),o($Vt,[2,35],{11:$Vc,12:$Vd,13:$Ve,16:$Vf,17:$Vg,18:$Vh,19:$Vi,20:$Vj,21:$Vk,22:$Vl})],defaultActions:{19:[2,1]},parseError:function(a,b){if(!b.recoverable)throw new Error(a);this.trace(a)},parse:function(a){function b(a){f.length=f.length-2*a,g.length=g.length-a,h.length=h.length-a}function c(){var a;return a=q.lex()||o,"number"!=typeof a&&(a=e.symbols_[a]||a),a}function d(a){for(var b=f.length-1,c=0;;){if(n.toString()in i[a])return c;if(0===a||2>b)return!1;b-=2,a=f[b],++c}}var e=this,f=[0],g=[null],h=[],i=this.table,j="",k=0,l=0,m=0,n=2,o=1,p=h.slice.call(arguments,1),q=Object.create(this.lexer),r={yy:{}};for(var s in this.yy)Object.prototype.hasOwnProperty.call(this.yy,s)&&(r.yy[s]=this.yy[s]);q.setInput(a,r.yy),r.yy.lexer=q,r.yy.parser=this,"undefined"==typeof q.yylloc&&(q.yylloc={});var t=q.yylloc;h.push(t);var u=q.options&&q.options.ranges;this.parseError="function"==typeof r.yy.parseError?r.yy.parseError:Object.getPrototypeOf(this).parseError;for(var v,w,x,y,z,A,B,C,D,E={};;){if(x=f[f.length-1],this.defaultActions[x]?y=this.defaultActions[x]:((null===v||"undefined"==typeof v)&&(v=c()),y=i[x]&&i[x][v]),"undefined"==typeof y||!y.length||!y[0]){var F,G="";if(m)w!==o&&(F=d(x));else{F=d(x),D=[];for(A in i[x])this.terminals_[A]&&A>n&&D.push("'"+this.terminals_[A]+"'");G=q.showPosition?"Parse error on line "+(k+1)+":\n"+q.showPosition()+"\nExpecting "+D.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(k+1)+": Unexpected "+(v==o?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(G,{text:q.match,token:this.terminals_[v]||v,line:q.yylineno,loc:t,expected:D,recoverable:F!==!1})}if(3==m){if(v===o||w===o)throw new Error(G||"Parsing halted while starting to recover from another error.");l=q.yyleng,j=q.yytext,k=q.yylineno,t=q.yylloc,v=c()}if(F===!1)throw new Error(G||"Parsing halted. No suitable error recovery rule available.");b(F),w=v==n?null:v,v=n,x=f[f.length-1],y=i[x]&&i[x][n],m=3}if(y[0]instanceof Array&&y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+v);switch(y[0]){case 1:f.push(v),g.push(q.yytext),h.push(q.yylloc),f.push(y[1]),v=null,w?(v=w,w=null):(l=q.yyleng,j=q.yytext,k=q.yylineno,t=q.yylloc,m>0&&m--);break;case 2:if(B=this.productions_[y[1]][1],E.$=g[g.length-B],E._$={first_line:h[h.length-(B||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(B||1)].first_column,last_column:h[h.length-1].last_column},u&&(E._$.range=[h[h.length-(B||1)].range[0],h[h.length-1].range[1]]),z=this.performAction.apply(E,[j,l,k,r.yy,y[1],g,h].concat(p)),"undefined"!=typeof z)return z;B&&(f=f.slice(0,-1*B*2),g=g.slice(0,-1*B),h=h.slice(0,-1*B)),f.push(this.productions_[y[1]][0]),g.push(E.$),h.push(E._$),C=i[f[f.length-2]][f[f.length-1]],f.push(C);break;case 3:return!0}}return!0}},lexer=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a,b){return this.yy=b||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;f<e.length;f++)if(c=this._input.match(this.rules[e[f]]),c&&(!b||c[0].length>b[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:break;case 1:return 10;case 2:return 10;case 3:return 23;case 4:return 7;case 5:return 8;case 6:return 26;case 7:return 26;case 8:return 26;case 9:return 28;case 10:return 23;case 11:return 32;case 12:return 32;case 13:return 34;case 14:return 29;case 15:break;case 16:return 11;case 17:return" ";case 18:return 33;case 19:return 27;case 20:return 30;case 21:return 31;case 22:return 20;case 23:return 21;case 24:return 19;case 25:return 13;case 26:return 22;case 27:return 14;case 28:return 15;case 29:return 17;case 30:return 16;case 31:return 18;case 32:return'"';case 33:return"'";case 34:return"!";case 35:return 12;case 36:return 35;case 37:return 36;case 38:return 5}},rules:[/^(?:\s+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+(?=[(]))/,/^(?:([0]?[1-9]|1[0-2])[:][0-5][0-9]([:][0-5][0-9])?[ ]?(AM|am|aM|Am|PM|pm|pM|Pm))/,/^(?:([0]?[0-9]|1[0-9]|2[0-3])[:][0-5][0-9]([:][0-5][0-9])?)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:\$[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\[(.*)?\])/,/^(?:\$)/,/^(?:&)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:")/,/^(?:')/,/^(?:!)/,/^(?:=)/,/^(?:%)/,/^(?:[#])/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],inclusive:!0}}};return a}();return parser.lexer=lexer,Parser.prototype=parser,parser.Parser=Parser,new Parser}(),ruleJS=function(a){"use strict";var b=this,c=document.getElementById(a)||null,d="0.0.3",e={},f=function(a){var b=function(){};b.prototype=Parser.lexer;var c=function(){this.lexer=new b,this.yy={}};c.prototype=Parser;var d=new c;return d.setObj=function(a){d.yy.obj=a},d.yy.parseError=function(a,b){throw{name:"Parser error",message:a,prop:b}},d.yy.handler=a,d},g={errors:[{type:"NULL",output:"#NULL"},{type:"DIV_ZERO",output:"#DIV/0!"},{type:"VALUE",output:"#VALUE!"},{type:"REF",output:"#REF!"},{type:"NAME",output:"#NAME?"},{type:"NUM",output:"#NUM!"},{type:"NOT_AVAILABLE",output:"#N/A!"},{type:"ERROR",output:"#ERROR"},{type:"NEED_UPDATE",output:"#NEED_UPDATE"}],get:function(a){var b=g.errors.filter(function(b){return b.type===a||b.output===a})[0];return b?b.output:null}},h=function(){this.data=[];var a=["input[type=text]","[data-formula]"],d=function(){document.activeElement&&document.activeElement!==document.body?document.activeElement.blur():document.activeElement||document.body.focus()};this.getItem=function(a){return b.matrix.data.filter(function(b){return b.id===a})[0]},this.removeItem=function(a){b.matrix.data=b.matrix.data.filter(function(b){return b.id!==a})},this.removeItemsInCol=function(a){b.matrix.data=b.matrix.data.filter(function(b){return b.col!==a})},this.removeItemsInRow=function(a){b.matrix.data=b.matrix.data.filter(function(b){return b.row!==a})},this.removeItemsBelowCol=function(a){b.matrix.data=b.matrix.data.filter(function(b){return b.col<a})},this.removeItemsBelowRow=function(a){b.matrix.data=b.matrix.data.filter(function(b){return b.row<a})},this.updateItem=function(a,c){if(b.utils.isString(a)&&(a=b.matrix.getItem(a)),a&&c)for(var d in c)a[d]&&b.utils.isArray(a[d])?b.utils.isArray(c[d])?c[d].forEach(function(b){-1===a[d].indexOf(b)&&a[d].push(b)}):-1===a[d].indexOf(c[d])&&a[d].push(c[d]):a[d]=c[d]},this.addItem=function(a){var c=a.id,d=b.utils.cellCoords(c);a.row=d.row,a.col=d.col;var e=b.matrix.data.filter(function(a){return a.id===c})[0];return e?b.matrix.updateItem(e,a):b.matrix.data.push(a),b.matrix.getItem(c)},this.getRefItemsToColumn=function(a){var c=[];return b.matrix.data.length?(b.matrix.data.forEach(function(d){if(d.deps){var e=d.deps.filter(function(c){var d=b.utils.getCellAlphaNum(c).alpha,e=b.utils.toNum(d);return e>=a});e.length>0&&-1===c.indexOf(d.id)&&c.push(d.id)}}),c):c},this.getRefItemsToRow=function(a){var c=[];return b.matrix.data.length?(b.matrix.data.forEach(function(d){if(d.deps){var e=d.deps.filter(function(c){var d=b.utils.getCellAlphaNum(c).num;return d>a});e.length>0&&-1===c.indexOf(d.id)&&c.push(d.id)}}),c):c},this.updateElementItem=function(a,c){var d=a.getAttribute("id"),e=b.matrix.getItem(d);b.matrix.updateItem(e,c)},this.getDependencies=function(a){var c=function(a){var c=b.matrix.data.filter(function(b){return b.deps?b.deps.indexOf(a)>-1:void 0}),d=[];return c.forEach(function(a){-1===d.indexOf(a.id)&&d.push(a.id)}),d},d=[],e=function(a){var f=c(a);f.length&&f.forEach(function(a){if(-1===d.indexOf(a)){d.push(a);var c=b.matrix.getItem(a);c.deps.length&&e(a)}})};return e(a),d},this.getElementDependencies=function(a){return b.matrix.getDependencies(a.getAttribute("id"))};var e=function(a){{var c=b.matrix.getElementDependencies(a);a.getAttribute("id")}c.forEach(function(a){var c=b.matrix.getItem(a);if(c&&c.formula){var d=document.getElementById(a);f(c.formula,d)}})},f=function(a,c){var d=k(a,c),e=d.result,f=d.error,g=c.nodeName.toUpperCase();return b.matrix.updateElementItem(c,{value:e,error:f}),-1===["INPUT"].indexOf(g)&&(c.innerText=e||f),c.value=e||f,d},g=function(a){var c=a.getAttribute("id"),d=a.getAttribute("data-formula");d&&(b.matrix.addItem({id:c,formula:d}),f(d,a))},h=function(a){var c=a.getAttribute("id");a.addEventListener("dblclick",function(){var d=b.matrix.getItem(c);d&&d.formula&&(d.formulaEdit=!0,a.value="="+d.formula)}),a.addEventListener("blur",function(){var d=b.matrix.getItem(c);d&&(d.formulaEdit&&(a.value=d.value||d.error),d.formulaEdit=!1)}),a.addEventListener("keyup",function(a){switch(a.keyCode){case 13:case 27:d()}}),a.addEventListener("change",function(){b.matrix.removeItem(c);var d=a.value;"="===d[0]&&(a.setAttribute("data-formula",d.substr(1)),g(a)),e(a)})};this.depsInFormula=function(a){var b=a.formula,c=a.deps;return c?(c=c.filter(function(a){return-1!==b.indexOf(a)}),c.length>0):!1},this.scan=function(){var b=c.querySelectorAll(a);[].slice.call(b).forEach(function(a){g(a),h(a)})}},i={isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},isNumber:function(a){return"[object Number]"===Object.prototype.toString.call(a)},isString:function(a){return"[object String]"===Object.prototype.toString.call(a)},isFunction:function(a){return"[object Function]"===Object.prototype.toString.call(a)},isUndefined:function(a){return"[object Undefined]"===Object.prototype.toString.call(a)},isNull:function(a){return"[object Null]"===Object.prototype.toString.call(a)},isSet:function(a){return!b.utils.isUndefined(a)&&!b.utils.isNull(a)},isCell:function(a){return a.match(/^[A-Za-z]+[0-9]+/)?!0:!1},getCellAlphaNum:function(a){var b=a.match(/\d+$/),c=a.replace(b,"");return{alpha:c,num:parseInt(b[0],10)}},changeRowIndex:function(a,c){var d=b.utils.getCellAlphaNum(a),e=d.alpha,f=e,g=parseInt(d.num+c,10);return 1>g&&(g=1),f+""+g},changeColIndex:function(a,c){var d=b.utils.getCellAlphaNum(a),e=d.alpha,f=b.utils.toChar(parseInt(b.utils.toNum(e)+c,10)),g=d.num;f&&0!==f.length||(f="A");var h="$"===e[0]||!1,i="$"===e[e.length-1]||!1;return f=(h?"$":"")+f,g=(i?"$":"")+g,f+""+g},changeFormula:function(a,c,d){return c||(c=1),a.replace(/(\$?[A-Za-z]+\$?[0-9]+)/g,function(a){var e=b.utils.getCellAlphaNum(a),f=e.alpha,g=e.num;return b.utils.isNumber(d.col)&&(g=b.utils.toNum(f),d.col<=g)?b.utils.changeColIndex(a,c):b.utils.isNumber(d.row)&&d.row<g?b.utils.changeRowIndex(a,c):a})},updateFormula:function(a,c,d){var e,f;return-1!==["left","right"].indexOf(c)?e="col":-1!==["up","down"].indexOf(c)&&(e="row"),-1!==["down","right"].indexOf(c)?f=1*d:-1!==["up","left"].indexOf(c)&&(f=-1*d),e&&f?a.replace(/(\$?[A-Za-z]+\$?[0-9]+)/g,function(a){var c=b.utils.getCellAlphaNum(a).alpha,d="$"===c[0]||!1,g="$"===c[c.length-1]||!1;return"row"===e&&g?a:"col"===e&&d?a:"row"===e?b.utils.changeRowIndex(a,f):b.utils.changeColIndex(a,f)}):a},toNum:function(a){a=b.utils.clearFormula(a);var c,d,e="ABCDEFGHIJKLMNOPQRSTUVWXYZ",f=0;for(c=0,d=a.length-1;c<a.length;c+=1,d-=1)f+=Math.pow(e.length,d)*(e.indexOf(a[c])+1);return f&&--f,f},toChar:function(a){for(var b="";a>=0;)b=String.fromCharCode(a%26+97)+b,a=Math.floor(a/26)-1;return b.toUpperCase()},cellCoords:function(a){var c=a.match(/\d+$/),d=a.replace(c,"");return{row:parseInt(c[0],10)-1,col:b.utils.toNum(d)}},clearFormula:function(a){return a.replace(/\$/g,"")},translateCellCoords:function(a){return b.utils.toChar(a.col)+""+parseInt(a.row+1,10)},iterateCells:function(a,c,d){var e={index:[],value:[]},f={start:0,end:0};f=c.col>=a.col?{start:a.col,end:c.col}:{start:c.col,end:a.col};var g={start:0,end:0};g=c.row>=a.row?{start:a.row,end:c.row}:{start:c.row,end:a.row};for(var h=f.start;h<=f.end;h++)for(var i=g.start;i<=g.end;i++){var j=b.utils.toChar(h)+(i+1),k=b.helper.cellValue.call(this,j);e.index.push(j),e.value.push(k)}return b.utils.isFunction(d)?d.apply(d,[e]):e},sort:function(a){return function(b,c){return(c>b?-1:b>c?1:0)*(a?-1:1)}}},j={SUPPORTED_FORMULAS:["ABS","ACCRINT","ACOS","ACOSH","ACOTH","AND","ARABIC","ASIN","ASINH","ATAN","ATAN2","ATANH","AVEDEV","AVERAGE","AVERAGEA","AVERAGEIF","BASE","BESSELI","BESSELJ","BESSELK","BESSELY","BETADIST","BETAINV","BIN2DEC","BIN2HEX","BIN2OCT","BINOMDIST","BINOMDISTRANGE","BINOMINV","BITAND","BITLSHIFT","BITOR","BITRSHIFT","BITXOR","CEILING","CEILINGMATH","CEILINGPRECISE","CHAR","CHISQDIST","CHISQINV","CODE","COMBIN","COMBINA","COMPLEX","CONCATENATE","CONFIDENCENORM","CONFIDENCET","CONVERT","CORREL","COS","COSH","COT","COTH","COUNT","COUNTA","COUNTBLANK","COUNTIF","COUNTIFS","COUNTIN","COUNTUNIQUE","COVARIANCEP","COVARIANCES","CSC","CSCH","CUMIPMT","CUMPRINC","DATE","DATEVALUE","DAY","DAYS","DAYS360","DB","DDB","DEC2BIN","DEC2HEX","DEC2OCT","DECIMAL","DEGREES","DELTA","DEVSQ","DOLLAR","DOLLARDE","DOLLARFR","E","EDATE","EFFECT","EOMONTH","ERF","ERFC","EVEN","EXACT","EXPONDIST","FALSE","FDIST","FINV","FISHER","FISHERINV","IF","INT","ISEVEN","ISODD","LN","LOG","LOG10","MAX","MAXA","MEDIAN","MIN","MINA","MOD","NOT","ODD","OR","PI","POWER","ROUND","ROUNDDOWN","ROUNDUP","SIN","SINH","SPLIT","SQRT","SQRTPI","SUM","SUMIF","SUMIFS","SUMPRODUCT","SUMSQ","SUMX2MY2","SUMX2PY2","SUMXMY2","TAN","TANH","TRUE","TRUNC","XOR"],number:function(a){switch(typeof a){case"number":return a;case"string":if(!isNaN(a))return a.indexOf(".")>-1?parseFloat(a):parseInt(a,10)}return a},string:function(a){return a.substring(1,a.length-1)},numberInverted:function(a){return-1*this.number(a)},specialMatch:function(a,b,c){var d;switch(a){case"&":d=b.toString()+c.toString()}return d},logicMatch:function(a,b,c){var d;switch(a){case"=":d=b===c;break;case">":d=b>c;break;case"<":d=c>b;break;case">=":d=b>=c;break;case"<=":d=b===c;break;case"<>":d=b!=c;break;case"NOT":d=b!=c}return d},mathMatch:function(a,b,c){var d;if(b=j.number(b),c=j.number(c),isNaN(b)||isNaN(c)){if("="===b[0]||"="===c[0])throw Error("NEED_UPDATE");throw Error("VALUE")}switch(a){case"+":d=b+c;break;case"-":d=b-c;break;case"/":if(d=b/c,1/0==d)throw Error("DIV_ZERO");if(isNaN(d))throw Error("VALUE");break;case"*":d=b*c;break;case"^":d=Math.pow(b,c)}return d},callFunction:function(a,c){if(a=a.toUpperCase(),c=c||[],b.helper.SUPPORTED_FORMULAS.indexOf(a)>-1&&b.formulas[a])return b.formulas[a].apply(this,c);throw Error("NAME")},callVariable:function(a){a=a||[];var c=a[0];if(c&&(c=c.toUpperCase(),b.formulas[c]))return"function"==typeof b.formulas[c]?b.formulas[c].apply(this,a):b.formulas[c];throw Error("NAME")},cellValue:function(a){var c,d=b.custom.cellValue,e=this,f=b.matrix.getItem(a);if(b.utils.isFunction(d)){var g=b.utils.cellCoords(a),h=b.utils.translateCellCoords({row:e.row,col:e.col});c=f?f.value:d(g.row,g.col),b.utils.isNull(c)&&(c=0),h&&b.matrix.updateItem(h,{deps:[a]})}else c=f?f.value:document.getElementById(a).value,b.matrix.updateElementItem(e,{deps:[a]});if(f&&f.deps&&-1!==f.deps.indexOf(h))throw Error("REF");if(f&&f.error)throw Error(f.error);if(b.utils.isSet(c)){var i=b.helper.number(c);return isNaN(i)?c:i}throw Error("NOT_AVAILABLE")},cellRangeValue:function(a,c){var d=b.custom.cellValue,e=b.utils.cellCoords(a),f=b.utils.cellCoords(c),g=this,h=b.utils.iterateCells.call(this,e,f),i=[];if(b.utils.isFunction(d)){var j=b.utils.translateCellCoords({row:g.row,col:g.col});b.matrix.updateItem(j,{deps:h.index})}else b.matrix.updateElementItem(g,{deps:h.index});return i.push(h.value),i},fixedCellValue:function(a){return a=a.replace(/\$/g,""),b.helper.cellValue.call(this,a)},fixedCellRangeValue:function(a,c){return a=a.replace(/\$/g,""),c=c.replace(/\$/g,""),b.helper.cellRangeValue.call(this,a,c)}},k=function(a,c){var d=null,f=null;try{e.setObj(c),d=e.parse(a);var h;c instanceof HTMLElement?h=c.getAttribute("id"):c&&c.id&&(h=c.id);var i=b.matrix.getDependencies(h);if(-1!==i.indexOf(h))throw d=null,i.forEach(function(a){b.matrix.updateItem(a,{value:null,error:g.get("REF")})}),Error("REF")}catch(j){var k=g.get(j.message);f=k?k:g.get("ERROR")}return{error:f,result:d}},l=function(){b=this,e=new f(b),b.formulas=Formula,b.matrix=new h,b.custom={},c&&b.matrix.scan()};return{init:l,version:d,utils:i,helper:j,parse:k}};