bridge-scorer
Version:
collection of duplicate bridge scoring algorithms.
1 lines • 78.8 kB
JavaScript
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).spec=t()}}(function(){return function t(e,r,o){function n(a,s){if(!r[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[a]={exports:{}};e[a][0].call(h.exports,function(t){var r=e[a][1][t];return n(r||t)},h,h.exports,t,e,r,o)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a<o.length;a++)n(o[a]);return n}({1:[function(t,e,r){"use strict";var o=e.exports={};o.contractMade=t("./lib/contract").made,o.contractTricks=t("./lib/contract").tricks,o.contractResult=t("./lib/contract").result,o.matchpoints=t("./lib/matchpoints").standard,o.matchpointsACBL=t("./lib/matchpoints").ACBL,o.crossImps=t("./lib/imps").crossImps,o.butler=t("./lib/imps").butler,o.rank=t("./lib/rank")},{"./lib/contract":2,"./lib/imps":3,"./lib/matchpoints":4,"./lib/rank":5}],2:[function(t,e,r){"use strict";function o(t,e,r){if(0===t.level)return 0;var o=r-t.level,n="X"===t.risk,i="XX"===t.risk,c=t.denomination;if(r<0){if(""===t.risk)return r*(e?100:50);var u=e?s[-r]:a[-r];return i&&(u*=2),u}var h=0;switch(c){case"S":case"H":h=30*t.level;break;case"NT":h=30*t.level+10;break;case"C":case"D":h=20*t.level}if(n?h*=2:i&&(h*=4),h<100?h+=50:(h+=e?500:300,7===t.level?h+=e?1500:1e3:6===t.level&&(h+=e?750:500)),n?h+=50:i&&(h+=100),o>0)if(n)h+=o*(e?200:100);else if(i)h+=o*(e?400:200);else switch(c){case"S":case"H":case"NT":h+=30*o;break;case"C":case"D":h+=20*o}return h}function n(t,e,r){var n=t.level+6;return o(t,e,r<n?r-n:r-6)}function i(t,e,r){return n(t,e,r+t.level+6)}var a=[0,-100,-300,-500,-800,-1100,-1400,-1700,-2e3,-2300,-2600,-2900,-3200,-3500],s=[0,-200,-500,-800,-1100,-1400,-1700,-2e3,-2300,-2600,-2900,-3200,-3500,-3800];e.exports={made:o,tricks:n,result:i}},{}],3:[function(t,e,r){"use strict";function o(t){var e=s.length-1,r=1;t<0&&(r=-1,t=0-t);for(var o=0;o<e;++o)if(s[o].diff<=t&&t<s[o+1].diff)return s[o].imps*r;return 24*r}function n(t){var e,r,n,i,a,s=[];for(e=0;e<t.length;++e)if(0===(n=t[e]).score)n.impsNS={value:-1},n.impsEW={value:-1},s.push({game:n,scoreNS:0});else if(n.contract&&n.contract.declaror&&n.score){n.impsNS={value:-1},n.impsEW={value:-1};var c={game:n,scoreNS:"N"===n.contract.declaror||"S"===n.contract.declaror?n.score:-n.score};s.push(c)}for(e=0;e<s.length;++e){for(i=s[e].scoreNS,a=0,r=0;r<s.length;++r)e!==r&&(a+=o(i-s[r].scoreNS));s[e].game.impsNS.value=a/(s.length-1),s[e].game.impsEW.value=-s[e].game.impsNS.value}}function i(t,e){var r,n,i,a=[];for(r=0;r<t.length;++r)if(0===(n=t[r]).score)n.impsNS={value:-1},n.impsEW={value:-1},a.push({game:n,scoreNS:0});else if(n.contract&&n.contract.declaror&&n.score){n.impsNS={value:-1},n.impsEW={value:-1};var s={game:n,scoreNS:"N"===n.contract.declaror||"S"===n.contract.declaror?n.score:-n.score};a.push(s)}var c=e(a);for(r=0;r<a.length;++r)i=o(a[r].scoreNS-c),a[r].game.impsNS.value=i,a[r].game.impsEW.value=-i;return c}function a(t){return i(t,function(t){if(t.length>3){t.sort(function(t,e){return e.scoreNS-t.scoreNS});var e=Math.ceil((t.length-10)/15)+1;t=t.slice(e,-e)}var r=t.reduce(function(t,e){return t+e.scoreNS},0);return 10*Math.round(r/t.length/10)})}var s=[{diff:0,imps:0},{diff:20,imps:1},{diff:50,imps:2},{diff:90,imps:3},{diff:130,imps:4},{diff:170,imps:5},{diff:220,imps:6},{diff:270,imps:7},{diff:320,imps:8},{diff:370,imps:9},{diff:430,imps:10},{diff:500,imps:11},{diff:600,imps:12},{diff:750,imps:13},{diff:900,imps:14},{diff:1100,imps:15},{diff:1300,imps:16},{diff:1500,imps:17},{diff:1750,imps:18},{diff:2e3,imps:19},{diff:2250,imps:20},{diff:2500,imps:21},{diff:3e3,imps:22},{diff:3500,imps:23},{diff:4e3,imps:24}];e.exports={toImps:o,crossImps:n,butler:a}},{}],4:[function(t,e,r){"use strict";function o(t,e){var r,o,n=[];for(r=0;r<t.length;++r)if(0===(o=t[r]).score)o.matchpointsNS={value:-1},o.matchpointsEW={value:-1},n.push({game:o,scoreNS:0});else if(o.contract&&o.contract.declaror&&o.score){o.matchpointsNS={value:-1},o.matchpointsEW={value:-1};var i={game:o,scoreNS:"N"===o.contract.declaror||"S"===o.contract.declaror?o.score:-o.score};n.push(i)}var a=n.length*e.win-e.win;n.sort(function(t,e){return e.scoreNS-t.scoreNS}),r=0;for(var s,c,u,h=n.length-1;r<=h;){o=(s=n[r]).game;var l=0,f=s.scoreNS;for(c=0,u=r+1;u<=h&&f===n[u].scoreNS;++u)++c,l+=e.tie;for(l+=e.win*(h-r-c),o.matchpointsNS.value=l,o.matchpointsNS.rank=(r+1).toString(),o.matchpointsNS.percentage=l/a*100,o.matchpointsEW.value=a-l,o.matchpointsEW.percentage=o.matchpointsEW.value/a*100,c>0&&(o.matchpointsNS.rank+="="),u=0;u<c;++u)n[++r].game.matchpointsNS=o.matchpointsNS,n[r].game.matchpointsEW=o.matchpointsEW;++r}for(n.sort(function(t,e){return e.game.matchpointsEW.value-t.game.matchpointsEW.value}),r=0;r<=h;){for(o=(s=n[r]).game,c=0,u=r+1;u<=h&&o.matchpointsEW.value===n[u].game.matchpointsEW.value;++u)++c;for(o.matchpointsEW.rank=(r+1).toString(),c>0&&(o.matchpointsEW.rank+="="),u=0;u<c;++u)n[++r].game.matchpointsEW=o.matchpointsEW;++r}return t}e.exports={standard:function(t){return o(t,{win:2,tie:1})},ACBL:function(t){return o(t,{win:1,tie:.5})}}},{}],5:[function(t,e,r){"use strict";function o(t){for(var e,r,o=0,n=(t=t.slice().sort(function(t,e){return e.score-t.score})).length-1,i=0;o<=n;){var a=(r=t[o]).score,s=0;for(e=o+1;e<=n&&a===t[e].score;++e)++s;for(i=o+1,r.rank=i.toString(),s>0&&(r.rank+="="),e=0;e<s;++e)t[++o].rank=r.rank;++o}for(o=0;o<=n;++o){r=t[o];var c=parseInt(r.rank,10);r.scale=1===c?1:(i-c)/i}return t}e.exports=o},{}],6:[function(t,e,r){function o(){function t(t,r){Object.keys(r).forEach(function(o){~e.indexOf(o)||(t[o]=r[o])})}var e=[].slice.call(arguments);return function(){for(var e=[].slice.call(arguments),r=0,o={};r<e.length;r++)t(o,e[r]);return o}}function n(t,e,r){var n=o("name","message","stack","constructor","toJSON")(e||{});this.message=t||"Unspecified AssertionError",this.showDiff=!1;for(var i in n)this[i]=n[i];if((r=r||arguments.callee)&&Error.captureStackTrace)Error.captureStackTrace(this,r);else try{throw new Error}catch(t){this.stack=t.stack}}e.exports=n,n.prototype=Object.create(Error.prototype),n.prototype.name="AssertionError",n.prototype.constructor=n,n.prototype.toJSON=function(t){var e=o("constructor","toJSON","stack")({name:this.name},this);return!1!==t&&this.stack&&(e.stack=this.stack),e}},{}],7:[function(t,e,r){"use strict";function o(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function n(t){return 3*t.length/4-o(t)}function i(t){var e,r,n,i,a,s,c=t.length;a=o(t),s=new l(3*c/4-a),n=a>0?c-4:c;var u=0;for(e=0,r=0;e<n;e+=4,r+=3)i=h[t.charCodeAt(e)]<<18|h[t.charCodeAt(e+1)]<<12|h[t.charCodeAt(e+2)]<<6|h[t.charCodeAt(e+3)],s[u++]=i>>16&255,s[u++]=i>>8&255,s[u++]=255&i;return 2===a?(i=h[t.charCodeAt(e)]<<2|h[t.charCodeAt(e+1)]>>4,s[u++]=255&i):1===a&&(i=h[t.charCodeAt(e)]<<10|h[t.charCodeAt(e+1)]<<4|h[t.charCodeAt(e+2)]>>2,s[u++]=i>>8&255,s[u++]=255&i),s}function a(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,r){for(var o,n=[],i=e;i<r;i+=3)o=(t[i]<<16)+(t[i+1]<<8)+t[i+2],n.push(a(o));return n.join("")}function c(t){for(var e,r=t.length,o=r%3,n="",i=[],a=0,c=r-o;a<c;a+=16383)i.push(s(t,a,a+16383>c?c:a+16383));return 1===o?(e=t[r-1],n+=u[e>>2],n+=u[e<<4&63],n+="=="):2===o&&(e=(t[r-2]<<8)+t[r-1],n+=u[e>>10],n+=u[e>>4&63],n+=u[e<<2&63],n+="="),i.push(n),i.join("")}r.byteLength=n,r.toByteArray=i,r.fromByteArray=c;for(var u=[],h=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,d=f.length;p<d;++p)u[p]=f[p],h[f.charCodeAt(p)]=p;h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},{}],8:[function(t,e,r){"use strict";function o(t){if(t>Y)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=n.prototype,e}function n(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return i(t,e,r)}function i(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?l(t,e,r):"string"==typeof t?u(t,e):f(t)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,r){return a(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}function c(t){return a(t),o(t<0?0:0|p(t))}function u(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!n.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(t,e),i=o(r),a=i.write(t,e);return a!==r&&(i=i.slice(0,a)),i}function h(t){for(var e=t.length<0?0:0|p(t.length),r=o(e),n=0;n<e;n+=1)r[n]=255&t[n];return r}function l(t,e,r){if(e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");var o;return o=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),o.__proto__=n.prototype,o}function f(t){if(n.isBuffer(t)){var e=0|p(t.length),r=o(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(t){if(H(t)||"length"in t)return"number"!=typeof t.length||V(t.length)?o(0):h(t);if("Buffer"===t.type&&Array.isArray(t.data))return h(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function p(t){if(t>=Y)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Y.toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),n.alloc(+t)}function g(t,e){if(n.isBuffer(t))return t.length;if(H(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return D(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(o)return D(t).length;e=(""+e).toLowerCase(),o=!0}}function v(t,e,r){var o=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return _(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return O(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return j(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,r);default:if(o)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),o=!0}}function m(t,e,r){var o=t[e];t[e]=t[r],t[r]=o}function y(t,e,r,o,i){if(0===t.length)return-1;if("string"==typeof r?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,V(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=n.from(e,o)),n.isBuffer(e))return 0===e.length?-1:b(t,e,r,o,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,o,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,o,n){function i(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}var a=1,s=t.length,c=e.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(t.length<2||e.length<2)return-1;a=2,s/=2,c/=2,r/=2}var u;if(n){var h=-1;for(u=r;u<s;u++)if(i(t,u)===i(e,-1===h?0:u-h)){if(-1===h&&(h=u),u-h+1===c)return h*a}else-1!==h&&(u-=u-h),h=-1}else for(r+c>s&&(r=s-c),u=r;u>=0;u--){for(var l=!0,f=0;f<c;f++)if(i(t,u+f)!==i(e,f)){l=!1;break}if(l)return u}return-1}function w(t,e,r,o){r=Number(r)||0;var n=t.length-r;o?(o=Number(o))>n&&(o=n):o=n;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");o>i/2&&(o=i/2);for(var a=0;a<o;++a){var s=parseInt(e.substr(2*a,2),16);if(V(s))return a;t[r+a]=s}return a}function x(t,e,r,o){return X(D(e,t.length-r),t,r,o)}function N(t,e,r,o){return X(U(e),t,r,o)}function S(t,e,r,o){return N(t,e,r,o)}function q(t,e,r,o){return X(z(e),t,r,o)}function E(t,e,r,o){return X(R(e,t.length-r),t,r,o)}function j(t,e,r){return 0===e&&r===t.length?$.fromByteArray(t):$.fromByteArray(t.slice(e,r))}function k(t,e,r){r=Math.min(t.length,r);for(var o=[],n=e;n<r;){var i=t[n],a=null,s=i>239?4:i>223?3:i>191?2:1;if(n+s<=r){var c,u,h,l;switch(s){case 1:i<128&&(a=i);break;case 2:128==(192&(c=t[n+1]))&&(l=(31&i)<<6|63&c)>127&&(a=l);break;case 3:c=t[n+1],u=t[n+2],128==(192&c)&&128==(192&u)&&(l=(15&i)<<12|(63&c)<<6|63&u)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:c=t[n+1],u=t[n+2],h=t[n+3],128==(192&c)&&128==(192&u)&&128==(192&h)&&(l=(15&i)<<18|(63&c)<<12|(63&u)<<6|63&h)>65535&&l<1114112&&(a=l)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,o.push(a>>>10&1023|55296),a=56320|1023&a),o.push(a),n+=s}return M(o)}function M(t){var e=t.length;if(e<=G)return String.fromCharCode.apply(String,t);for(var r="",o=0;o<e;)r+=String.fromCharCode.apply(String,t.slice(o,o+=G));return r}function O(t,e,r){var o="";r=Math.min(t.length,r);for(var n=e;n<r;++n)o+=String.fromCharCode(127&t[n]);return o}function A(t,e,r){var o="";r=Math.min(t.length,r);for(var n=e;n<r;++n)o+=String.fromCharCode(t[n]);return o}function _(t,e,r){var o=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>o)&&(r=o);for(var n="",i=e;i<r;++i)n+=F(t[i]);return n}function P(t,e,r){for(var o=t.slice(e,r),n="",i=0;i<o.length;i+=2)n+=String.fromCharCode(o[i]+256*o[i+1]);return n}function T(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,o,i,a){if(!n.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<a)throw new RangeError('"value" argument is out of bounds');if(r+o>t.length)throw new RangeError("Index out of range")}function C(t,e,r,o,n,i){if(r+o>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function W(t,e,r,o,n){return e=+e,r>>>=0,n||C(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(t,e,r,o,23,4),r+4}function I(t,e,r,o,n){return e=+e,r>>>=0,n||C(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(t,e,r,o,52,8),r+8}function L(t){if((t=t.trim().replace(Z,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function F(t){return t<16?"0"+t.toString(16):t.toString(16)}function D(t,e){e=e||1/0;for(var r,o=t.length,n=null,i=[],a=0;a<o;++a){if((r=t.charCodeAt(a))>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===o){(e-=3)>-1&&i.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&i.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function U(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}function R(t,e){for(var r,o,n,i=[],a=0;a<t.length&&!((e-=2)<0);++a)o=(r=t.charCodeAt(a))>>8,n=r%256,i.push(n),i.push(o);return i}function z(t){return $.toByteArray(L(t))}function X(t,e,r,o){for(var n=0;n<o&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function H(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function V(t){return t!==t}var $=t("base64-js"),J=t("ieee754");r.Buffer=n,r.SlowBuffer=d,r.INSPECT_MAX_BYTES=50;var Y=2147483647;r.kMaxLength=Y,n.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}(),n.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),n.poolSize=8192,n.from=function(t,e,r){return i(t,e,r)},n.prototype.__proto__=Uint8Array.prototype,n.__proto__=Uint8Array,n.alloc=function(t,e,r){return s(t,e,r)},n.allocUnsafe=function(t){return c(t)},n.allocUnsafeSlow=function(t){return c(t)},n.isBuffer=function(t){return null!=t&&!0===t._isBuffer},n.compare=function(t,e){if(!n.isBuffer(t)||!n.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,o=e.length,i=0,a=Math.min(r,o);i<a;++i)if(t[i]!==e[i]){r=t[i],o=e[i];break}return r<o?-1:o<r?1:0},n.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return n.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var o=n.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var a=t[r];if(!n.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(o,i),i+=a.length}return o},n.byteLength=g,n.prototype._isBuffer=!0,n.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)m(this,e,e+1);return this},n.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},n.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},n.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?k(this,0,t):v.apply(this,arguments)},n.prototype.equals=function(t){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===n.compare(this,t)},n.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},n.prototype.compare=function(t,e,r,o,i){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),e<0||r>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=r)return 0;if(o>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,o>>>=0,i>>>=0,this===t)return 0;for(var a=i-o,s=r-e,c=Math.min(a,s),u=this.slice(o,i),h=t.slice(e,r),l=0;l<c;++l)if(u[l]!==h[l]){a=u[l],s=h[l];break}return a<s?-1:s<a?1:0},n.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},n.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},n.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},n.prototype.write=function(t,e,r,o){if(void 0===e)o="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)o=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===o&&(o="utf8")):(o=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return w(this,t,e,r);case"utf8":case"utf-8":return x(this,t,e,r);case"ascii":return N(this,t,e,r);case"latin1":case"binary":return S(this,t,e,r);case"base64":return q(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var G=4096;n.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var o=this.subarray(t,e);return o.__proto__=n.prototype,o},n.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var o=this[t],n=1,i=0;++i<e&&(n*=256);)o+=this[t+i]*n;return o},n.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var o=this[t+--e],n=1;e>0&&(n*=256);)o+=this[t+--e]*n;return o},n.prototype.readUInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),this[t]},n.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},n.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},n.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},n.prototype.readUInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},n.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var o=this[t],n=1,i=0;++i<e&&(n*=256);)o+=this[t+i]*n;return n*=128,o>=n&&(o-=Math.pow(2,8*e)),o},n.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var o=e,n=1,i=this[t+--o];o>0&&(n*=256);)i+=this[t+--o]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*e)),i},n.prototype.readInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},n.prototype.readInt16LE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt16BE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},n.prototype.readInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},n.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),J.read(this,t,!0,23,4)},n.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),J.read(this,t,!1,23,4)},n.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),J.read(this,t,!0,52,8)},n.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(t,8,this.length),J.read(this,t,!1,52,8)},n.prototype.writeUIntLE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||B(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,i=0;for(this[e]=255&t;++i<r&&(n*=256);)this[e+i]=t/n&255;return e+r},n.prototype.writeUIntBE=function(t,e,r,o){t=+t,e>>>=0,r>>>=0,o||B(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,i=1;for(this[e+n]=255&t;--n>=0&&(i*=256);)this[e+n]=t/i&255;return e+r},n.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},n.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},n.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},n.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},n.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},n.prototype.writeIntLE=function(t,e,r,o){if(t=+t,e>>>=0,!o){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var i=0,a=1,s=0;for(this[e]=255&t;++i<r&&(a*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},n.prototype.writeIntBE=function(t,e,r,o){if(t=+t,e>>>=0,!o){var n=Math.pow(2,8*r-1);B(this,t,e,r,n-1,-n)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},n.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},n.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},n.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},n.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},n.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},n.prototype.writeFloatLE=function(t,e,r){return W(this,t,e,!0,r)},n.prototype.writeFloatBE=function(t,e,r){return W(this,t,e,!1,r)},n.prototype.writeDoubleLE=function(t,e,r){return I(this,t,e,!0,r)},n.prototype.writeDoubleBE=function(t,e,r){return I(this,t,e,!1,r)},n.prototype.copy=function(t,e,r,o){if(r||(r=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e<o-r&&(o=t.length-e+r);var n,i=o-r;if(this===t&&r<e&&e<o)for(n=i-1;n>=0;--n)t[n+e]=this[n+r];else if(i<1e3)for(n=0;n<i;++n)t[n+e]=this[n+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},n.prototype.fill=function(t,e,r,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!n.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=e;a<r;++a)this[a]=t;else{var s=n.isBuffer(t)?t:new n(t,o),c=s.length;for(a=0;a<r-e;++a)this[a+e]=s[a%c]}return this};var Z=/[^+/0-9A-Za-z-_]/g},{"base64-js":7,ieee754:42}],9:[function(t,e,r){e.exports=t("./lib/chai")},{"./lib/chai":10}],10:[function(t,e,r){var o=[];(r=e.exports={}).version="3.5.0",r.AssertionError=t("assertion-error");var n=t("./chai/utils");r.use=function(t){return~o.indexOf(t)||(t(this,n),o.push(t)),this},r.util=n;var i=t("./chai/config");r.config=i;var a=t("./chai/assertion");r.use(a);var s=t("./chai/core/assertions");r.use(s);var c=t("./chai/interface/expect");r.use(c);var u=t("./chai/interface/should");r.use(u);var h=t("./chai/interface/assert");r.use(h)},{"./chai/assertion":11,"./chai/config":12,"./chai/core/assertions":13,"./chai/interface/assert":14,"./chai/interface/expect":15,"./chai/interface/should":16,"./chai/utils":30,"assertion-error":6}],11:[function(t,e,r){var o=t("./config");e.exports=function(t,e){function r(t,e,r){i(this,"ssfi",r||arguments.callee),i(this,"object",t),i(this,"message",e)}var n=t.AssertionError,i=e.flag;t.Assertion=r,Object.defineProperty(r,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),o.includeStack},set:function(t){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),o.includeStack=t}}),Object.defineProperty(r,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),o.showDiff},set:function(t){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),o.showDiff=t}}),r.addProperty=function(t,r){e.addProperty(this.prototype,t,r)},r.addMethod=function(t,r){e.addMethod(this.prototype,t,r)},r.addChainableMethod=function(t,r,o){e.addChainableMethod(this.prototype,t,r,o)},r.overwriteProperty=function(t,r){e.overwriteProperty(this.prototype,t,r)},r.overwriteMethod=function(t,r){e.overwriteMethod(this.prototype,t,r)},r.overwriteChainableMethod=function(t,r,o){e.overwriteChainableMethod(this.prototype,t,r,o)},r.prototype.assert=function(t,r,a,s,c,u){var h=e.test(this,arguments);if(!0!==u&&(u=!1),!0!==o.showDiff&&(u=!1),!h){var r=e.getMessage(this,arguments),l=e.getActual(this,arguments);throw new n(r,{actual:l,expected:s,showDiff:u},o.includeStack?this.assert:i(this,"ssfi"))}},Object.defineProperty(r.prototype,"_obj",{get:function(){return i(this,"object")},set:function(t){i(this,"object",t)}})}},{"./config":12}],12:[function(t,e,r){e.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}},{}],13:[function(t,e,r){e.exports=function(t,e){function r(t,r){r&&O(this,"message",r),t=t.toLowerCase();var o=O(this,"object"),n=~["a","e","i","o","u"].indexOf(t.charAt(0))?"an ":"a ";this.assert(t===e.type(o),"expected #{this} to be "+n+t,"expected #{this} not to be "+n+t)}function o(){O(this,"contains",!0)}function n(t,r){e.expectTypes(this,["array","object","string"]),r&&O(this,"message",r);var o=O(this,"object"),n=!1;if("array"===e.type(o)&&"object"===e.type(t)){for(var i in o)if(e.eql(o[i],t)){n=!0;break}}else if("object"===e.type(t)){if(!O(this,"negate")){for(var a in t)new M(o).property(a,t[a]);return}var s={};for(var a in t)s[a]=o[a];n=e.eql(s,t)}else n=void 0!=o&&~o.indexOf(t);this.assert(n,"expected #{this} to include "+e.inspect(t),"expected #{this} to not include "+e.inspect(t))}function i(){var t=O(this,"object"),e=Object.prototype.toString.call(t);this.assert("[object Arguments]"===e,"expected #{this} to be arguments but got "+e,"expected #{this} to not be arguments")}function a(t,e){e&&O(this,"message",e);var r=O(this,"object");if(O(this,"deep"))return this.eql(t);this.assert(t===r,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",t,this._obj,!0)}function s(t,r){r&&O(this,"message",r),this.assert(e.eql(t,O(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",t,this._obj,!0)}function c(t,e){e&&O(this,"message",e);var r=O(this,"object");if(O(this,"doLength")){new M(r,e).to.have.property("length");var o=r.length;this.assert(o>t,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",t,o)}else this.assert(r>t,"expected #{this} to be above "+t,"expected #{this} to be at most "+t)}function u(t,e){e&&O(this,"message",e);var r=O(this,"object");if(O(this,"doLength")){new M(r,e).to.have.property("length");var o=r.length;this.assert(o>=t,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",t,o)}else this.assert(r>=t,"expected #{this} to be at least "+t,"expected #{this} to be below "+t)}function h(t,e){e&&O(this,"message",e);var r=O(this,"object");if(O(this,"doLength")){new M(r,e).to.have.property("length");var o=r.length;this.assert(o<t,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",t,o)}else this.assert(r<t,"expected #{this} to be below "+t,"expected #{this} to be at least "+t)}function l(t,e){e&&O(this,"message",e);var r=O(this,"object");if(O(this,"doLength")){new M(r,e).to.have.property("length");var o=r.length;this.assert(o<=t,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",t,o)}else this.assert(r<=t,"expected #{this} to be at most "+t,"expected #{this} to be above "+t)}function f(t,r){r&&O(this,"message",r);var o=e.getName(t);this.assert(O(this,"object")instanceof t,"expected #{this} to be an instance of "+o,"expected #{this} to not be an instance of "+o)}function p(t,r){r&&O(this,"message",r);var o=O(this,"object");this.assert(o.hasOwnProperty(t),"expected #{this} to have own property "+e.inspect(t),"expected #{this} to not have own property "+e.inspect(t))}function d(t,r,o){"string"==typeof r&&(o=r,r=null),o&&O(this,"message",o);var n=O(this,"object"),i=Object.getOwnPropertyDescriptor(Object(n),t);i&&r?this.assert(e.eql(r,i),"expected the own property descriptor for "+e.inspect(t)+" on #{this} to match "+e.inspect(r)+", got "+e.inspect(i),"expected the own property descriptor for "+e.inspect(t)+" on #{this} to not match "+e.inspect(r),r,i,!0):this.assert(i,"expected #{this} to have an own property descriptor for "+e.inspect(t),"expected #{this} to not have an own property descriptor for "+e.inspect(t)),O(this,"object",i)}function g(){O(this,"doLength",!0)}function v(t,e){e&&O(this,"message",e);var r=O(this,"object");new M(r,e).to.have.property("length");var o=r.length;this.assert(o==t,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",t,o)}function m(t,e){e&&O(this,"message",e);var r=O(this,"object");this.assert(t.exec(r),"expected #{this} to match "+t,"expected #{this} not to match "+t)}function y(t){var r,o=O(this,"object"),n=!0,i="keys must be given single argument of Array|Object|String, or multiple String arguments";switch(e.type(t)){case"array":if(arguments.length>1)throw new Error(i);break;case"object":if(arguments.length>1)throw new Error(i);t=Object.keys(t);break;default:t=Array.prototype.slice.call(arguments)}if(!t.length)throw new Error("keys required");var a=Object.keys(o),s=t,c=t.length,u=O(this,"any"),h=O(this,"all");if(u||h||(h=!0),u&&(n=s.filter(function(t){return~a.indexOf(t)}).length>0),h&&(n=t.every(function(t){return~a.indexOf(t)}),O(this,"negate")||O(this,"contains")||(n=n&&t.length==a.length)),c>1){var l=(t=t.map(function(t){return e.inspect(t)})).pop();h&&(r=t.join(", ")+", and "+l),u&&(r=t.join(", ")+", or "+l)}else r=e.inspect(t[0]);r=(c>1?"keys ":"key ")+r,r=(O(this,"contains")?"contain ":"have ")+r,this.assert(n,"expected #{this} to "+r,"expected #{this} to not "+r,s.slice(0).sort(),a.sort(),!0)}function b(t,r,o){o&&O(this,"message",o);var n=O(this,"object");new M(n,o).is.a("function");var i=!1,a=null,s=null,c=null;0===arguments.length?(r=null,t=null):t&&(t instanceof RegExp||"string"==typeof t)?(r=t,t=null):t&&t instanceof Error?(a=t,t=null,r=null):"function"==typeof t?(!(s=t.prototype.name)||"Error"===s&&t!==Error)&&(s=t.name||(new t).name):t=null;try{n()}catch(o){if(a)return this.assert(o===a,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",a instanceof Error?a.toString():a,o instanceof Error?o.toString():o),O(this,"object",o),this;if(t&&(this.assert(o instanceof t,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",s,o instanceof Error?o.toString():o),!r))return O(this,"object",o),this;var u="error"===e.type(o)&&"message"in o?o.message:""+o;if(null!=u&&r&&r instanceof RegExp)return this.assert(r.exec(u),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",r,u),O(this,"object",o),this;if(null!=u&&r&&"string"==typeof r)return this.assert(~u.indexOf(r),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",r,u),O(this,"object",o),this;i=!0,c=o}var h="",l=null!==s?s:a?"#{exp}":"an error";i&&(h=" but #{act} was thrown"),this.assert(!0===i,"expected #{this} to throw "+l+h,"expected #{this} to not throw "+l+h,a instanceof Error?a.toString():a,c instanceof Error?c.toString():c),O(this,"object",c)}function w(t,r){r&&O(this,"message",r);var o=O(this,"object"),n=O(this,"itself"),i="function"!==e.type(o)||n?o[t]:o.prototype[t];this.assert("function"==typeof i,"expected #{this} to respond to "+e.inspect(t),"expected #{this} to not respond to "+e.inspect(t))}function x(t,r){r&&O(this,"message",r);var o=t(O(this,"object"));this.assert(o,"expected #{this} to satisfy "+e.objDisplay(t),"expected #{this} to not satisfy"+e.objDisplay(t),!this.negate,o)}function N(t,r,o){o&&O(this,"message",o);var n=O(this,"object");if(new M(n,o).is.a("number"),"number"!==e.type(t)||"number"!==e.type(r))throw new Error("the arguments to closeTo or approximately must be numbers");this.assert(Math.abs(n-t)<=r,"expected #{this} to be close to "+t+" +/- "+r,"expected #{this} not to be close to "+t+" +/- "+r)}function S(t,e,r){return t.every(function(t){return r?e.some(function(e){return r(t,e)}):-1!==e.indexOf(t)})}function q(t,e){e&&O(this,"message",e);var r=O(this,"object");new M(t).to.be.an("array"),this.assert(t.indexOf(r)>-1,"expected #{this} to be one of #{exp}","expected #{this} to not be one of #{exp}",t,r)}function E(t,e,r){r&&O(this,"message",r);var o=O(this,"object");new M(t,r).to.have.property(e),new M(o).is.a("function");var n=t[e];o(),this.assert(n!==t[e],"expected ."+e+" to change","expected ."+e+" to not change")}function j(t,e,r){r&&O(this,"message",r);var o=O(this,"object");new M(t,r).to.have.property(e),new M(o).is.a("function");var n=t[e];o(),this.assert(t[e]-n>0,"expected ."+e+" to increase","expected ."+e+" to not increase")}function k(t,e,r){r&&O(this,"message",r);var o=O(this,"object");new M(t,r).to.have.property(e),new M(o).is.a("function");var n=t[e];o(),this.assert(t[e]-n<0,"expected ."+e+" to decrease","expected ."+e+" to not decrease")}var M=t.Assertion,O=(Object.prototype.toString,e.flag);["to","be","been","is","and","has","have","with","that","which","at","of","same"].forEach(function(t){M.addProperty(t,function(){return this})}),M.addProperty("not",function(){O(this,"negate",!0)}),M.addProperty("deep",function(){O(this,"deep",!0)}),M.addProperty("any",function(){O(this,"any",!0),O(this,"all",!1)}),M.addProperty("all",function(){O(this,"all",!0),O(this,"any",!1)}),M.addChainableMethod("an",r),M.addChainableMethod("a",r),M.addChainableMethod("include",n,o),M.addChainableMethod("contain",n,o),M.addChainableMethod("contains",n,o),M.addChainableMethod("includes",n,o),M.addProperty("ok",function(){this.assert(O(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),M.addProperty("true",function(){this.assert(!0===O(this,"object"),"expected #{this} to be true","expected #{this} to be false",!this.negate)}),M.addProperty("false",function(){this.assert(!1===O(this,"object"),"expected #{this} to be false","expected #{this} to be true",!!this.negate)}),M.addProperty("null",function(){this.assert(null===O(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),M.addProperty("undefined",function(){this.assert(void 0===O(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),M.addProperty("NaN",function(){this.assert(isNaN(O(this,"object")),"expected #{this} to be NaN","expected #{this} not to be NaN")}),M.addProperty("exist",function(){this.assert(null!=O(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),M.addProperty("empty",function(){var t=O(this,"object"),e=t;Array.isArray(t)||"string"==typeof object?e=t.length:"object"==typeof t&&(e=Object.keys(t).length),this.assert(!e,"expected #{this} to be empty","expected #{this} not to be empty")}),M.addProperty("arguments",i),M.addProperty("Arguments",i),M.addMethod("equal",a),M.addMethod("equals",a),M.addMethod("eq",a),M.addMethod("eql",s),M.addMethod("eqls",s),M.addMethod("above",c),M.addMethod("gt",c),M.addMethod("greaterThan",c),M.addMethod("least",u),M.addMethod("gte",u),M.addMethod("below",h),M.addMethod("lt",h),M.addMethod("lessThan",h),M.addMethod("most",l),M.addMethod("lte",l),M.addMethod("within",function(t,e,r){r&&O(this,"message",r);var o=O(this,"object"),n=t+".."+e;if(O(this,"doLength")){new M(o,r).to.have.property("length");var i=o.length;this.assert(i>=t&&i<=e,"expected #{this} to have a length within "+n,"expected #{this} to not have a length within "+n)}else this.assert(o>=t&&o<=e,"expected #{this} to be within "+n,"expected #{this} to not be within "+n)}),M.addMethod("instanceof",f),M.addMethod("instanceOf",f),M.addMethod("property",function(t,r,o){o&&O(this,"message",o);var n=!!O(this,"deep"),i=n?"deep property ":"property ",a=O(this,"negate"),s=O(this,"object"),c=n?e.getPathInfo(t,s):null,u=n?c.exists:e.hasProperty(t,s),h=n?c.value:s[t];if(a&&arguments.length>1){if(void 0===h)throw o=null!=o?o+": ":"",new Error(o+e.inspect(s)+" has no "+i+e.inspect(t))}else this.assert(u,"expected #{this} to have a "+i+e.inspect(t),"expected #{this} to not have "+i+e.inspect(t));arguments.length>1&&this.assert(r===h,"expected #{this} to have a "+i+e.inspect(t)+" of #{exp}, but got #{act}","expected #{this} to not have a "+i+e.inspect(t)+" of #{act}",r,h),O(this,"object",h)}),M.addMethod("ownProperty",p),M.addMethod("haveOwnProperty",p),M.addMethod("ownPropertyDescriptor",d),M.addMethod("haveOwnPropertyDescriptor",d),M.addChainableMethod("length",v,g),M.addMethod("lengthOf",v),M.addMethod("match",m),M.addMethod("matches",m),M.addMethod("string",function(t,r){r&&O(this,"message",r);var o=O(this,"object");new M(o,r).is.a("string"),this.assert(~o.indexOf(t),"expected #{this} to contain "+e.inspect(t),"expected #{this} to not contain "+e.inspect(t))}),M.addMethod("keys",y),M.addMethod("key",y),M.addMethod("throw",b),M.addMethod("throws",b),M.addMethod("Throw",b),M.addMethod("respondTo",w),M.addMethod("respondsTo",w),M.addProperty("itself",function(){O(this,"itself",!0)}),M.addMethod("satisfy",x),M.addMethod("satisfies",x),M.addMethod("closeTo",N),M.addMethod("approximately",N),M.addMethod("members",function(t,r){r&&O(this,"message",r);var o=O(this,"object");new M(o).to.be.an("array"),new M(t).to.be.an("array");var n=O(this,"deep")?e.eql:void 0;if(O(this,"contains"))return this.assert(S(t,o,n),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",o,t);this.assert(S(o,t,n)&&S(t,o,n),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",o,t)}),M.addMethod("oneOf",q),M.addChainableMethod("change",E),M.addChainableMethod("changes",E),M.addChainableMethod("increase",j),M.addChainableMethod("increases",j),M.addChainableMethod("decrease",k),M.addChainableMethod("decreases",k),M.addProperty("extensible",function(){var t,e=O(this,"object");try{t=Object.isExtensible(e)}catch(e){if(!(e instanceof TypeError))throw e;t=!1}this.assert(t,"expected #{this} to be extensible","expected #{this} to not be extensible")}),M.addProperty("sealed",function(){var t,e=O(this,"object");try{t=Object.isSealed(e)}catch(e){if(!(e instanceof TypeError))throw e;t=!0}this.assert(t,"expected #{this} to be sealed","expected #{this} to not be sealed")}),M.addProperty("frozen",function(){var t,e=O(this,"object");try{t=Object.isFrozen(e)}catch(e){if(!(e instanceof TypeError))throw e;t=!0}this.assert(t,"expected #{this} to be frozen","expected #{this} to not be frozen")})}},{}],14:[function(t,e,r){e.exports=function(t,e){var r=t.Assertion,o=e.flag,n=t.assert=function(e,o){new r(null,null,t.assert).assert(e,o,"[ negation message unavailable ]")};n.fail=function(e,r,o,i){throw o=o||"assert.fail()",new t.AssertionError(o,{actual:e,expected:r,operator:i},n.fail)},n.isOk=function(t,e){new r(t,e).is.ok},n.isNotOk=function(t,e){new r(t,e).is.not.ok},n.equal=function(t,e,i){var a=new r(t,i,n.equal);a.assert(e==o(a,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",e,t)},n.notEqual=function(t,e,i){var a=new r(t,i,n.notEqual);a.assert(e!=o(a,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",e,t)},n.strictEqual=function(t,e,o){new r(t,o).to.equal(e)},n.notStrictEqual=function(t,e,o){new r(t,o).to.not.equal(e)},n.deepEqual=function(t,e,o){new r(t,o).to.eql(e)},n.notDeepEqual=function(t,e,o){new r(t,o).to.not.eql(e)},n.isAbove=function(t,e,o){new r(t,o).to.be.above(e)},n.isAtLeast=function(t,e,o){new r(t,o).to.be.least(e)},n.isBelow=function(t,e,o){new r(t,o).to.be.below(e)},n.isAtMost=function(t,e,o){new r(t,o).to.be.most(e)},n.isTrue=function(t,e){new r(t,e).is.true},n.isNotTrue=function(t,e){new r(t,e).to.not.equal(!0)},n.isFalse=function(t,e){new r(t,e).is.false},n.isNotFalse=function(t,e){new r(t,e).to.not.equal(!1)},n.isNull=function(t,e){new r(t,e).to.equal(null)},n.isNotNull=function(t,e){new r(t,e).to.not.equal(null)},n.isNaN=function(t,e){new r(t,e).to.be.NaN},n.isNotNaN=function(t,e){new r(t,e).not.to.be.NaN},n.isUndefined=function(t,e){new r(t,e).to.equal(void 0)},n.isDefined=function(t,e){new r(t,e).to.not.equal(void 0)},n.isFunction=function(t,e){new r(t,e).to.be.a("function")},n.isNotFunction=function(t,e){new r(t,e).to.not.be.a("function")},n.isObject=function(t,e){new r(t,e).to.be.a("object")},n.isNotObject=function(t,e){new r(t,e).to.not.be.a("object")},n.isArray=function(t,e){new r(t,e).to.be.an("array")},n.isNotArray=function(t,e){new r(t,e).to.not.be.an("array")},n.isString=function(t,e){new r(t,e).to.be.a("string")},n.isNotString=function(t,e){new r(t,e).to.not.be.a("string")},n.isNumber=function(t,e){new r(t,e).to.be.a("number")},n.isNotNumber=function(t,e){new r(t,e).to.not.be.a("number")},n.isBoolean=function(t,e){new r(t,e).to.be.a("boolean")},n.isNotBoolean=function(t,e){new r(t,e).to.not.be.a("boolean")},n.typeOf=function(t,e,o){new r(t,o).to.be.a(e)},n.notTypeOf=function(t,e,o){new r(t,o).to.not.be.a(e)},n.instanceOf=function(t,e,o){new r(t,o).to.be.instanceOf(e)},n.notInstanceOf=function(t,e,o){new r(t,o).to.not.be.instanceOf(e)},n.include=function(t,e,o){new r(t,o,n.include).include(e)},n.notInclude=function(t,e,o){new r(t,o,n.notInclude).not.include(e)},n.match=function(t,e,o){new r(t,o).to.match(e)},n.notMatch=function(t,e,o){new r(t,o).to.not.match(e)},n.property=function(t,e,o){new r(t,o).to.have.property(e)},n.notProperty=function(t,e,o){new r(t,o).to.not.have.property(e)},n.deepProperty=function(t,e,o){new r(t,o).to.have.deep.property(e)},n.notDeepProperty=function(t,e,o){new r(t,o).to.not.have.deep.property(e)},n.propertyVal=function(t,e,o,n){new r(t,n).to.have.property(e,o)},n.propertyNotVal=function(t,e,o,n){new r(t,n).to.not.have.property(e,o)},n.deepPropertyVal=function(t,e,o,n){new r(t,n).to.have.deep.property(e,o)},n.deepPropertyNotVal=function(t,e,o,n){new r(t,n).to.not.have.deep.property(e,o)},n.lengthOf=function(t,e,o){new r(t,o).to.have.length(e)},n.throws=function(t,e,n,i){("string"==typeof e||e instanceof RegExp)&&(n=e,e=null);var a=new r(t,i).to.throw(e,n);return o(a,"object")},n.doesNotThrow=function(t,e,o){"string"==typeof e&&(o=e,e=null),new r(t,o).to.not.Throw(e)},n.operator=function(t,n,i,a){var s;switch(n){case"==":s=t==i;break;case"===":s=t===i;break;case">":s=t>i;break;case">=":s=t>=i;break;case"<":s=t<i;break;case"<=":s=t<=i;break;case"!=":s=t!=i;break;case"!==":s=t!==i;break;default:throw new Error('Invalid operator "'+n+'"')}var c=new r(s,a);c.assert(!0===o(c,"object"),"expected "+e.inspect(t)+" to be "+n+" "+e.inspect(i),"expected "+e.inspect(t)+" to not be "+n+" "+e.inspect(i))},n.closeTo=function(t,e,o,n){new r(t,n).to.be.closeTo(e,o)},n.approximately=function(t,e,o,n){new r(t,n).to.be.approximately(e,o)},n.sameMembers=function(t,e,o){new r(t,o).to.have.same.members(e)},n.sameDeepMembers=function(t,e,o){new r(t,o).to.have.same.deep.members(e)},n.includeMembers=function(t,e,o){new r(t,o).to.include.members(e)},n.includeDeepMembers=function(t,e,o){new r(t,o).to.include.deep.members(e)},n.oneOf=function(t,e,o){new r(t,o).to.be.oneOf(e)},n.changes=function(t,e,o){new r(t).to.change(e,o)},n.doesNotChange=function(t,e,o){new r(t).to.not.change(e,o)},n.increases=function(t,e,o){new r(t).to.increase(e,o)},n.doesNotIncrease=function(t,e,o){new r(t).to.not.increase(e,o)},n.decreases=function(t,e,o){new r(t).to.decrease(e,o)},n.doesNotDecrease=function(t,e,o){new r(t).to.not.decrease(e,o)},n.ifError=function(t){if(t)throw t},n.isExtensible=function(t,e){new r(t,e).to.be.extensible},n.isNotExtensible=function(t,e){new r(t,e).to.not.be.extensible},n.isSealed=function(t,e){new r(t,e).to.be.sealed},n.isNotSealed=function(t,e){new r(t,e).to.not.be.sealed},n.isFrozen=function(t,e){new r(t,e).to.be.frozen},n.isNotFrozen=function(t,e){new r(t,e).to.not.be.frozen},function t(e,r){return n[r]=n[e],t}("isOk","ok")("isNotOk","notOk")("throws","throw")("throws","Throw")("isExtensible","extensible")("isNotExtensible","notExtensible")("isSealed","sealed")("isNotSealed","notSealed")("isFrozen","frozen")("isNotFrozen","notFrozen")}},{}],15:[function(t,e,r){e.exports=function(t,e){t.expect=function(e,r){return new t.Assertion(e,r)},t.expect.fail=function(e,r,o,n){throw o=o||"expect.fail()",new t.AssertionError(o,{actual:e,expected:r,operator:n},t.expect.fail)}}},{}],16:[function(t,e,r){e.exports=function(t,e){function r(){function e(){return this instanceof String||this instanceof Number||this instanceof Boolean?new o(this.valueOf(),null,e):new o(this,null,e)}function r(t){Object.defineProperty(this,"should",{value:t,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:r,get:e,configurable:!0});var n={};return n.fail=function(e,r,o,i){throw o=o||"should.fail()",new t.AssertionError(o,{actual:e,expected:r,operator:i},n.fail)},n.equal=function(t,e,r){new o(t,r).to.equal(e)},n.Throw=function(t,e,r,n){new o(t,n).to.Throw(e,r)},n.exist=function(t,e){new o(t,e).to.exist},n.not={},n.not.equal=function(t,e,r){new o(t,r).to.not.equal(e)},n.not.Throw=function(t,e,r,n){new o(t,n).to.not.Throw(e,r)},n.not.exist=function(t,e){new o(t,e).to.not.exist},n.throw=n.Throw,n.not.throw=n.not.Throw,n}var o=t.Assertion;t.should=r,t.Should=r}},{}],17:[function(t,e,r)