From 78fd234e24ac89f052c51015c8e91794b78a55df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Belin?= Date: Mon, 15 Dec 2014 22:40:02 +0100 Subject: [PATCH] CORS handling is delegated to 'cors' module --- CHANGELOG.md | 3 +++ lib/server.js | 26 ++++++++------------------ package.json | 17 +++++++++-------- www/js/mocha.js | 4 ++-- www/js/tests.js | 43 +++++++++++++++++++++++++------------------ www/js/tests.min.js | 4 ++-- 6 files changed, 49 insertions(+), 48 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c97987c3..39e825b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog This file contains highlights of what changes on each version of the [Akismet.js](https://www.npmjs.org/package/akismet-js) library. +#### Version 0.3.4 +- CORS headers handling delegated to [`cors`](https://www.npmjs.com/package/cors) module. + #### Version 0.3.3 - Updated the package dependencies. diff --git a/lib/server.js b/lib/server.js index bb1e1bd4..c57a8240 100644 --- a/lib/server.js +++ b/lib/server.js @@ -7,6 +7,7 @@ // Module dependencies. var bodyParser=require('body-parser'); var enums=require('./enums'); +var cors=require('cors'); var express=require('express'); var http=require('http'); var https=require('https'); @@ -221,23 +222,6 @@ Server.prototype.verifyKey=function(req, res) { }); }; -/** - * Adds [CORS](http://www.w3.org/TR/cors) headers to the response. - * @method _addCORSHeaders - * @param {express.Request} req The request sent by a client. - * @param {express.Response} res The response sent by the server. - * @param {Function} next The callback used to pass the request off to the next middleware. - * @static - * @private - */ -Server._addCORSHeaders=function(req, res, next) { - res.set('access-control-allow-headers', util.format('%s, %s', enums.HTTPHeaders.X_REQUESTED_WITH, enums.HTTPHeaders.X_USER_AGENT)); - res.set('access-control-allow-methods', 'GET, OPTIONS, POST'); - res.set('access-control-allow-origin', '*'); - res.set('access-control-expose-headers', enums.HTTPHeaders.X_AKISMET_DEBUG_HELP); - next(); -}; - /** * Processes the specified request body. * @method _processRequest @@ -273,8 +257,14 @@ Server._processRequest=function(req, res, next) { * @private */ Server.prototype._registerMiddleware=function() { + this._express.use(cors({ + allowedHeaders: [ enums.HTTPHeaders.X_REQUESTED_WITH, enums.HTTPHeaders.X_USER_AGENT ], + exposedHeaders: [ enums.HTTPHeaders.X_AKISMET_DEBUG_HELP ], + methods: [ 'GET', 'POST' ], + origin: '*' + })); + this._express.use(bodyParser.urlencoded({ extended: true })); - this._express.use(Server._addCORSHeaders); this._express.use(Server._processRequest); }; diff --git a/package.json b/package.json index 6baf1422..c67e3a86 100644 --- a/package.json +++ b/package.json @@ -6,25 +6,26 @@ "license": "MIT", "main": "./index", "name": "akismet-js", - "version": "0.3.3", + "version": "0.3.4", "bin": { "akismet": "./bin/cli.js" }, "dependencies": { - "body-parser": "^1.9.2", - "commander": "^2.5.0", - "express": "^4.10.2", + "body-parser": "^1.10.0", + "commander": "^2.5.1", + "cors": "^2.5.2", + "express": "^4.10.6", "superagent": "^0.21.0" }, "devDependencies": { - "archiver": "^0.12.0", - "browserify": "^6.3.2", + "archiver": "^0.13.0", + "browserify": "^7.0.1", "david": "^5.0.0", - "docgen-js": "^0.1.0", + "docgen-js": "^0.0.1", "jshint": "^2.5.10", "mocha": "^2.0.1", "shelljs": "^0.3.0", - "uglify-js": "^2.4.15" + "uglify-js": "^2.4.16" }, "engines": { "node": ">=0.10.0" diff --git a/www/js/mocha.js b/www/js/mocha.js index 4fef6674..7143b18a 100644 --- a/www/js/mocha.js +++ b/www/js/mocha.js @@ -1,2 +1,2 @@ -!function(){function t(e){var n=t.resolve(e),r=t.modules[n];if(!r)throw new Error('failed to require "'+e+'"');return r.exports||(r.exports={},r.call(r.exports,r,r.exports,t.relative(n))),r.exports}function e(){for(var t=(new r).getTime();f.length&&(new r).getTime()-t<100;)f.shift()();c=f.length?o(e,0):null}t.modules={},t.resolve=function(e){var n=e,r=e+".js",o=e+"/index.js";return t.modules[r]&&r||t.modules[o]&&o||n},t.register=function(e,n){t.modules[e]=n},t.relative=function(e){return function(n){if("."!=n.charAt(0))return t(n);var r=e.split("/"),o=n.split("/");r.pop();for(var i=0;i/g,">"),e=e.replace(/"/g,""")}var r=function(t){this.ignoreWhitespace=t};r.prototype={diff:function(e,n){if(n===e)return[{value:n}];if(!n)return[{value:e,removed:!0}];if(!e)return[{value:n,added:!0}];n=this.tokenize(n),e=this.tokenize(e);var r=n.length,o=e.length,i=r+o,s=[{newPos:-1,components:[]}],a=this.extractCommon(s[0],n,e,0);if(s[0].newPos+1>=r&&a+1>=o)return s[0].components;for(var u=1;i>=u;u++)for(var l=-1*u;u>=l;l+=2){var c,f=s[l-1],p=s[l+1];a=(p?p.newPos:0)-l,f&&(s[l-1]=void 0);var h=f&&f.newPos+1=0&&o>a;if(h||d){!h||d&&f.newPos=r&&a+1>=o)return c.components;s[l]=c}else s[l]=void 0}},pushComponent:function(t,e,n,r){var o=t[t.length-1];o&&o.added===n&&o.removed===r?t[t.length-1]={value:this.join(o.value,e),added:n,removed:r}:t.push({value:e,added:n,removed:r})},extractCommon:function(t,e,n,r){for(var o=e.length,i=n.length,s=t.newPos,a=s-r;o>s+1&&i>a+1&&this.equals(e[s+1],n[a+1]);)s++,a++,this.pushComponent(t.components,e[s],void 0,void 0);return t.newPos=s,a},equals:function(t,e){var n=/\S/;return!this.ignoreWhitespace||n.test(t)||n.test(e)?t===e:!0},join:function(t,e){return t+e},tokenize:function(t){return t}};var o=new r,i=new r(!0),s=new r;i.tokenize=s.tokenize=function(t){return e(t.split(/(\s+|\b)/))};var a=new r(!0);a.tokenize=function(t){return e(t.split(/([{}:;,]|\s+)/))};var u=new r;return u.tokenize=function(t){return t.split(/^/m)},{Diff:r,diffChars:function(t,e){return o.diff(t,e)},diffWords:function(t,e){return i.diff(t,e)},diffWordsWithSpace:function(t,e){return s.diff(t,e)},diffLines:function(t,e){return u.diff(t,e)},diffCss:function(t,e){return a.diff(t,e)},createPatch:function(t,e,n,r,o){function i(t){return t.map(function(t){return" "+t})}function s(t,e,n){var r=l[l.length-2],o=e===l.length-2,i=e===l.length-3&&(n.added!==r.added||n.removed!==r.removed);/\n$/.test(n.value)||!o&&!i||t.push("\\ No newline at end of file")}var a=[];a.push("Index: "+t),a.push("==================================================================="),a.push("--- "+t+("undefined"==typeof r?"":" "+r)),a.push("+++ "+t+("undefined"==typeof o?"":" "+o));var l=u.diff(e,n);l[l.length-1].value||l.pop(),l.push({value:"",lines:[]});for(var c=0,f=0,p=[],h=1,d=1,g=0;g=0;s--){for(var l=r[s],c=0;c"):o.removed&&e.push(""),e.push(n(o.value)),o.added?e.push(""):o.removed&&e.push("")}return e.join("")},convertChangesToDMP:function(t){for(var e,n=[],r=0;ri;i++)if(r[i]===e||r[i].listener&&r[i].listener===e){o=i;break}if(0>o)return this;r.splice(o,1),r.length||delete this.$events[t]}else(r===e||r.listener&&r.listener===e)&&delete this.$events[t]}return this},r.prototype.removeAllListeners=function(t){return void 0===t?(this.$events={},this):(this.$events&&this.$events[t]&&(this.$events[t]=null),this)},r.prototype.listeners=function(t){return this.$events||(this.$events={}),this.$events[t]||(this.$events[t]=[]),n(this.$events[t])||(this.$events[t]=[this.$events[t]]),this.$events[t]},r.prototype.emit=function(t){if(!this.$events)return!1;var e=this.$events[t];if(!e)return!1;var r=[].slice.call(arguments,1);if("function"==typeof e)e.apply(this,r);else{if(!n(e))return!1;for(var o=e.slice(),i=0,s=o.length;s>i;i++)o[i].apply(this,r)}return!0}}),t.register("browser/fs.js",function(){}),t.register("browser/path.js",function(){}),t.register("browser/progress.js",function(t){function e(){this.percent=0,this.size(0),this.fontSize(11),this.font("helvetica, arial, sans-serif")}t.exports=e,e.prototype.size=function(t){return this._size=t,this},e.prototype.text=function(t){return this._text=t,this},e.prototype.fontSize=function(t){return this._fontSize=t,this},e.prototype.font=function(t){return this._font=t,this},e.prototype.update=function(t){return this.percent=t,this},e.prototype.draw=function(t){try{var e=Math.min(this.percent,100),n=this._size,r=n/2,o=r,i=r,s=r-1,a=this._fontSize;t.font=a+"px "+this._font;var u=2*Math.PI*(e/100);t.clearRect(0,0,n,n),t.strokeStyle="#9f9f9f",t.beginPath(),t.arc(o,i,s,0,u,!1),t.stroke(),t.strokeStyle="#eee",t.beginPath(),t.arc(o,i,s-1,0,u,!0),t.stroke();var l=this._text||(0|e)+"%",c=t.measureText(l).width;t.fillText(l,o-c/2+1,i+a/2-1)}catch(t){}return this}}),t.register("browser/tty.js",function(t,e){e.isatty=function(){return!0},e.getWindowSize=function(){return"innerHeight"in n?[n.innerHeight,n.innerWidth]:[640,480]}}),t.register("context.js",function(t){function e(){}t.exports=e,e.prototype.runnable=function(t){return 0==arguments.length?this._runnable:(this.test=this._runnable=t,this)},e.prototype.timeout=function(t){return 0===arguments.length?this.runnable().timeout():(this.runnable().timeout(t),this)},e.prototype.enableTimeouts=function(t){return this.runnable().enableTimeouts(t),this},e.prototype.slow=function(t){return this.runnable().slow(t),this},e.prototype.inspect=function(){return JSON.stringify(this,function(t,e){return"_runnable"!=t&&"test"!=t?e:void 0},2)}}),t.register("hook.js",function(t,e,n){function r(t,e){i.call(this,t,e),this.type="hook"}function o(){}var i=n("./runnable");t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r,r.prototype.error=function(t){if(0==arguments.length){var t=this._error;return this._error=null,t}this._error=t}}),t.register("interfaces/bdd.js",function(t,e,n){var r=n("../suite"),o=n("../test"),i=n("../utils");t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.before=function(t,n){e[0].beforeAll(t,n)},t.after=function(t,n){e[0].afterAll(t,n)},t.beforeEach=function(t,n){e[0].beforeEach(t,n)},t.afterEach=function(t,n){e[0].afterEach(t,n)},t.describe=t.context=function(t,o){var i=r.create(e[0],t);return i.file=n,e.unshift(i),o.call(i),e.shift(),i},t.xdescribe=t.xcontext=t.describe.skip=function(t,n){var o=r.create(e[0],t);o.pending=!0,e.unshift(o),n.call(o),e.shift()},t.describe.only=function(e,n){var r=t.describe(e,n);return s.grep(r.fullTitle()),r},t.it=t.specify=function(t,r){var i=e[0];if(i.pending)var r=null;var s=new o(t,r);return s.file=n,i.addTest(s),s},t.it.only=function(e,n){var r=t.it(e,n),o="^"+i.escapeRegexp(r.fullTitle())+"$";return s.grep(new RegExp(o)),r},t.xit=t.xspecify=t.it.skip=function(e){t.it(e)}})}}),t.register("interfaces/exports.js",function(t,e,n){var r=n("../suite"),o=n("../test");t.exports=function(t){function e(t,i){var s;for(var a in t)if("function"==typeof t[a]){var u=t[a];switch(a){case"before":n[0].beforeAll(u);break;case"after":n[0].afterAll(u);break;case"beforeEach":n[0].beforeEach(u);break;case"afterEach":n[0].afterEach(u);break;default:var l=new o(a,u);l.file=i,n[0].addTest(l)}}else{var s=r.create(n[0],a);n.unshift(s),e(t[a]),n.shift()}}var n=[t];t.on("require",e)}}),t.register("interfaces/index.js",function(t,e,n){e.bdd=n("./bdd"),e.tdd=n("./tdd"),e.qunit=n("./qunit"),e.exports=n("./exports")}),t.register("interfaces/qunit.js",function(t,e,n){var r=n("../suite"),o=n("../test"),i=n("../utils");t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.before=function(t,n){e[0].beforeAll(t,n)},t.after=function(t,n){e[0].afterAll(t,n)},t.beforeEach=function(t,n){e[0].beforeEach(t,n)},t.afterEach=function(t,n){e[0].afterEach(t,n)},t.suite=function(t){e.length>1&&e.shift();var o=r.create(e[0],t);return o.file=n,e.unshift(o),o},t.suite.only=function(e,n){var r=t.suite(e,n);s.grep(r.fullTitle())},t.test=function(t,r){var i=new o(t,r);return i.file=n,e[0].addTest(i),i},t.test.only=function(e,n){var r=t.test(e,n),o="^"+i.escapeRegexp(r.fullTitle())+"$";s.grep(new RegExp(o))},t.test.skip=function(e){t.test(e)}})}}),t.register("interfaces/tdd.js",function(t,e,n){var r=n("../suite"),o=n("../test"),i=n("../utils");t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.setup=function(t,n){e[0].beforeEach(t,n)},t.teardown=function(t,n){e[0].afterEach(t,n)},t.suiteSetup=function(t,n){e[0].beforeAll(t,n)},t.suiteTeardown=function(t,n){e[0].afterAll(t,n)},t.suite=function(t,o){var i=r.create(e[0],t);return i.file=n,e.unshift(i),o.call(i),e.shift(),i},t.suite.skip=function(t,n){var o=r.create(e[0],t);o.pending=!0,e.unshift(o),n.call(o),e.shift()},t.suite.only=function(e,n){var r=t.suite(e,n);s.grep(r.fullTitle())},t.test=function(t,r){var i=e[0];if(i.pending)var r=null;var s=new o(t,r);return s.file=n,i.addTest(s),s},t.test.only=function(e,n){var r=t.test(e,n),o="^"+i.escapeRegexp(r.fullTitle())+"$";s.grep(new RegExp(o))},t.test.skip=function(e){t.test(e)}})}}),t.register("mocha.js",function(t,e,r){function o(t){return __dirname+"/../images/"+t+".png"}function s(t){t=t||{},this.files=[],this.options=t,this.grep(t.grep),this.suite=new e.Suite("",new e.Context),this.ui(t.ui),this.bail(t.bail),this.reporter(t.reporter),null!=t.timeout&&this.timeout(t.timeout),this.useColors(t.useColors),null!==t.enableTimeouts&&this.enableTimeouts(t.enableTimeouts),t.slow&&this.slow(t.slow),this.suite.on("pre-require",function(t){e.afterEach=t.afterEach||t.teardown,e.after=t.after||t.suiteTeardown,e.beforeEach=t.beforeEach||t.setup,e.before=t.before||t.suiteSetup,e.describe=t.describe||t.suite,e.it=t.it||t.test,e.setup=t.setup||t.beforeEach,e.suiteSetup=t.suiteSetup||t.before,e.suiteTeardown=t.suiteTeardown||t.after,e.suite=t.suite||t.describe,e.teardown=t.teardown||t.afterEach,e.test=t.test||t.it})}var a=r("browser/path"),u=r("./utils");if(e=t.exports=s,"undefined"!=typeof i&&"function"==typeof i.cwd){var l=a.join,c=i.cwd();t.paths.push(c,l(c,"node_modules"))}e.utils=u,e.interfaces=r("./interfaces"),e.reporters=r("./reporters"),e.Runnable=r("./runnable"),e.Context=r("./context"),e.Runner=r("./runner"),e.Suite=r("./suite"),e.Hook=r("./hook"),e.Test=r("./test"),s.prototype.bail=function(t){return 0==arguments.length&&(t=!0),this.suite.bail(t),this},s.prototype.addFile=function(t){return this.files.push(t),this},s.prototype.reporter=function(t){if("function"==typeof t)this._reporter=t;else{t=t||"spec";var e;try{e=r("./reporters/"+t)}catch(t){}if(!e)try{e=r(t)}catch(t){}if(e||"teamcity"!==t||console.warn("The Teamcity reporter was moved to a package named mocha-teamcity-reporter (https://npmjs.org/package/mocha-teamcity-reporter)."),!e)throw new Error('invalid reporter "'+t+'"');this._reporter=e}return this},s.prototype.ui=function(t){if(t=t||"bdd",this._ui=e.interfaces[t],!this._ui)try{this._ui=r(t)}catch(t){}if(!this._ui)throw new Error('invalid interface "'+t+'"');return this._ui=this._ui(this.suite),this},s.prototype.loadFiles=function(t){var e=this,o=this.suite,i=this.files.length;this.files.forEach(function(s){s=a.resolve(s),o.emit("pre-require",n,s,e),o.emit("require",r(s),s,e),o.emit("post-require",n,s,e),--i||t&&t()})},s.prototype._growl=function(t,e){var n=r("growl");t.on("end",function(){var r=e.stats;if(r.failures){var i=r.failures+" of "+t.total+" tests failed";n(i,{name:"mocha",title:"Failed",image:o("error")})}else n(r.passes+" tests passed in "+r.duration+"ms",{name:"mocha",title:"Passed",image:o("ok")})})},s.prototype.grep=function(t){return this.options.grep="string"==typeof t?new RegExp(u.escapeRegexp(t)):t,this},s.prototype.invert=function(){return this.options.invert=!0,this},s.prototype.ignoreLeaks=function(t){return this.options.ignoreLeaks=!!t,this},s.prototype.checkLeaks=function(){return this.options.ignoreLeaks=!1,this},s.prototype.growl=function(){return this.options.growl=!0,this},s.prototype.globals=function(t){return this.options.globals=(this.options.globals||[]).concat(t),this},s.prototype.useColors=function(t){return this.options.useColors=arguments.length&&void 0!=t?t:!0,this},s.prototype.useInlineDiffs=function(t){return this.options.useInlineDiffs=arguments.length&&void 0!=t?t:!1,this},s.prototype.timeout=function(t){return this.suite.timeout(t),this},s.prototype.slow=function(t){return this.suite.slow(t),this},s.prototype.enableTimeouts=function(t){return this.suite.enableTimeouts(arguments.length&&void 0!==t?t:!0),this},s.prototype.asyncOnly=function(){return this.options.asyncOnly=!0,this},s.prototype.run=function(t){this.files.length&&this.loadFiles();var n=this.suite,r=this.options;r.files=this.files;var o=new e.Runner(n),i=new this._reporter(o,r);return o.ignoreLeaks=!1!==r.ignoreLeaks,o.asyncOnly=r.asyncOnly,r.grep&&o.grep(r.grep,r.invert),r.globals&&o.globals(r.globals),r.growl&&this._growl(o,i),e.reporters.Base.useColors=r.useColors,e.reporters.Base.inlineDiffs=r.useInlineDiffs,o.run(t)}}),t.register("ms.js",function(t){function e(t){var e=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"y":return n*l;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"h":return n*a;case"minutes":case"minute":case"m":return n*s;case"seconds":case"second":case"s":return n*i;case"ms":return n}}}function n(t){return t>=u?Math.round(t/u)+"d":t>=a?Math.round(t/a)+"h":t>=s?Math.round(t/s)+"m":t>=i?Math.round(t/i)+"s":t+"ms"}function r(t){return o(t,u,"day")||o(t,a,"hour")||o(t,s,"minute")||o(t,i,"second")||t+" ms"}function o(t,e,n){return e>t?void 0:1.5*e>t?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var i=1e3,s=60*i,a=60*s,u=24*a,l=365.25*u;t.exports=function(t,o){return o=o||{},"string"==typeof t?e(t):o.long?r(t):n(t)}}),t.register("reporters/base.js",function(t,e,r){function o(t){var e=this.stats={suites:0,tests:0,passes:0,pending:0,failures:0},n=this.failures=[];t&&(this.runner=t,t.stats=e,t.on("start",function(){e.start=new v}),t.on("suite",function(t){e.suites=e.suites||0,t.root||e.suites++}),t.on("test end",function(){e.tests=e.tests||0,e.tests++}),t.on("pass",function(t){e.passes=e.passes||0;var n=t.slow()/2;t.speed=t.duration>t.slow()?"slow":t.duration>n?"medium":"fast",e.passes++}),t.on("fail",function(t,r){e.failures=e.failures||0,e.failures++,t.err=r,n.push(t)}),t.on("end",function(){e.end=new v,e.duration=new v-e.start}),t.on("pending",function(){e.pending++}))}function s(t,e){return t=String(t),Array(e-t.length+1).join(" ")+t}function a(t,e){var n=l(t,"WordsWithSpace",e),r=n.split("\n");if(r.length>4){var o=String(r.length).length;n=r.map(function(t,e){return s(++e,o)+" | "+t}).join("\n")}return n="\n"+w("diff removed","actual")+" "+w("diff added","expected")+"\n\n"+n+"\n",n=n.replace(/^/gm," ")}function u(t,e){function n(t){return e&&(t=c(t)),"+"===t[0]?o+f("diff added",t):"-"===t[0]?o+f("diff removed",t):t.match(/\@\@/)?null:t.match(/\\ No newline/)?null:o+t}function r(t){return null!=t}var o=" ";msg=d.createPatch("string",t.actual,t.expected);var i=msg.split("\n").splice(4);return"\n "+f("diff added","+ expected")+" "+f("diff removed","- actual")+"\n\n"+i.map(n).filter(r).join("\n")}function l(t,e,n){var r=n?c(t.actual):t.actual,o=n?c(t.expected):t.expected;return d["diff"+e](r,o).map(function(t){return t.added?f("diff added",t.value):t.removed?f("diff removed",t.value):t.value}).join("")}function c(t){return t.replace(/\t/g,"").replace(/\r/g,"").replace(/\n/g,"\n")}function f(t,e){return e.split("\n").map(function(e){return w(t,e)}).join("\n")}function p(t,e){return t=Object.prototype.toString.call(t),e=Object.prototype.toString.call(e),t==e}var h=r("browser/tty"),d=r("browser/diff"),g=r("../ms"),m=r("../utils"),v=n.Date,y=(n.setTimeout,n.setInterval,n.clearTimeout,n.clearInterval,h.isatty(1)&&h.isatty(2));e=t.exports=o,e.useColors=y||void 0!==i.env.MOCHA_COLORS,e.inlineDiffs=!1,e.colors={pass:90,fail:31,"bright pass":92,"bright fail":91,"bright yellow":93,pending:36,suite:0,"error title":0,"error message":31,"error stack":90,checkmark:32,fast:90,medium:33,slow:31,green:32,light:90,"diff gutter":90,"diff added":42,"diff removed":41},e.symbols={ok:"✓",err:"✖",dot:"․"},"win32"==i.platform&&(e.symbols.ok="√",e.symbols.err="×",e.symbols.dot=".");var w=e.color=function(t,n){return e.useColors?"["+e.colors[t]+"m"+n+"":n};e.window={width:y?i.stdout.getWindowSize?i.stdout.getWindowSize(1)[0]:h.getWindowSize()[1]:75},e.cursor={hide:function(){y&&i.stdout.write("[?25l")},show:function(){y&&i.stdout.write("[?25h")},deleteLine:function(){y&&i.stdout.write("")},beginningOfLine:function(){y&&i.stdout.write("")},CR:function(){y?(e.cursor.deleteLine(),e.cursor.beginningOfLine()):i.stdout.write("\r")}},e.list=function(t){console.error(),t.forEach(function(t,n){var r=w("error title"," %s) %s:\n")+w("error message"," %s")+w("error stack","\n%s\n"),o=t.err,i=o.message||"",s=o.stack||i,l=s.indexOf(i)+i.length,c=s.slice(0,l),f=o.actual,h=o.expected,d=!0;if(o.uncaught&&(c="Uncaught "+c),o.showDiff&&p(f,h)&&(d=!1,o.actual=f=m.stringify(f),o.expected=h=m.stringify(h)),"string"==typeof f&&"string"==typeof h){r=w("error title"," %s) %s:\n%s")+w("error stack","\n%s\n");var g=i.match(/^([^:]+): expected/);c="\n "+w("error message",g?g[1]:c),c+=e.inlineDiffs?a(o,d):u(o,d)}s=s.slice(l?l+1:l).replace(/^/gm," "),console.error(r,n+1,t.fullTitle(),c,s)})},o.prototype.epilogue=function(){var t,e=this.stats;console.log(),t=w("bright pass"," ")+w("green"," %d passing")+w("light"," (%s)"),console.log(t,e.passes||0,g(e.duration)),e.pending&&(t=w("pending"," ")+w("pending"," %d pending"),console.log(t,e.pending)),e.failures&&(t=w("fail"," %d failing"),console.error(t,e.failures),o.list(this.failures),console.error()),console.log()}}),t.register("reporters/doc.js",function(t,e,n){function r(t){function e(){return Array(n).join(" ")}o.call(this,t);var n=(this.stats,t.total,2);t.on("suite",function(t){t.root||(++n,console.log('%s
',e()),++n,console.log("%s

%s

",e(),i.escape(t.title)),console.log("%s
",e()))}),t.on("suite end",function(t){t.root||(console.log("%s
",e()),--n,console.log("%s
",e()),--n)}),t.on("pass",function(t){console.log("%s
%s
",e(),i.escape(t.title));var n=i.escape(i.clean(t.fn.toString()));console.log("%s
%s
",e(),n)}),t.on("fail",function(t,n){console.log('%s
%s
',e(),i.escape(t.title));var r=i.escape(i.clean(t.fn.toString()));console.log('%s
%s
',e(),r),console.log('%s
%s
',e(),i.escape(n))})}var o=n("./base"),i=n("../utils");e=t.exports=r}),t.register("reporters/dot.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,.75*s.window.width|0),r=-1;t.on("start",function(){i.stdout.write("\n ")}),t.on("pending",function(){++r%n==0&&i.stdout.write("\n "),i.stdout.write(a("pending",s.symbols.dot))}),t.on("pass",function(t){++r%n==0&&i.stdout.write("\n "),i.stdout.write("slow"==t.speed?a("bright yellow",s.symbols.dot):a(t.speed,s.symbols.dot))}),t.on("fail",function(){++r%n==0&&i.stdout.write("\n "),i.stdout.write(a("fail",s.symbols.dot))}),t.on("end",function(){console.log(),e.epilogue()})}function o(){}var s=n("./base"),a=s.color;e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/html-cov.js",function(t,e,n){function r(t){var e=n("jade"),r=__dirname+"/templates/coverage.jade",u=a.readFileSync(r,"utf8"),l=e.compile(u,{filename:r}),c=this;s.call(this,t,!1),t.on("end",function(){i.stdout.write(l({cov:c.cov,coverageClass:o}))})}function o(t){return t>=75?"high":t>=50?"medium":t>=25?"low":"terrible"}var s=n("./json-cov"),a=n("browser/fs");e=t.exports=r}),t.register("reporters/html.js",function(t,e,r){function o(t){f.call(this,t);var e,n,r=this,o=this.stats,v=(t.total,s(m)),y=v.getElementsByTagName("li"),w=y[1].getElementsByTagName("em")[0],b=y[1].getElementsByTagName("a")[0],x=y[2].getElementsByTagName("em")[0],T=y[2].getElementsByTagName("a")[0],k=y[3].getElementsByTagName("em")[0],E=v.getElementsByTagName("canvas")[0],j=s('
    '),_=[j],C=document.getElementById("mocha");if(E.getContext){var S=window.devicePixelRatio||1;E.style.width=E.width,E.style.height=E.height,E.width*=S,E.height*=S,n=E.getContext("2d"),n.scale(S,S),e=new h}return C?(c(b,"click",function(){u();var t=/pass/.test(j.className)?"":" pass";j.className=j.className.replace(/fail|pass/g,"")+t,j.className.trim()&&a("test pass")}),c(T,"click",function(){u();var t=/fail/.test(j.className)?"":" fail";j.className=j.className.replace(/fail|pass/g,"")+t,j.className.trim()&&a("test fail")}),C.appendChild(v),C.appendChild(j),e&&e.size(40),t.on("suite",function(t){if(!t.root){var e=r.suiteURL(t),n=s('
  • %s

  • ',e,d(t.title));_[0].appendChild(n),_.unshift(document.createElement("ul")),n.appendChild(_[0])}}),t.on("suite end",function(t){t.root||_.shift()}),t.on("fail",function(e){"hook"==e.type&&t.emit("test end",e)}),void t.on("test end",function(t){var i=o.tests/this.total*100|0;e&&e.update(i).draw(n);var a=new g-o.start;if(l(w,o.passes),l(x,o.failures),l(k,(a/1e3).toFixed(2)),"passed"==t.state)var u=r.testURL(t),f=s('
  • %e%ems

  • ',t.speed,t.title,t.duration,u);else if(t.pending)var f=s('
  • %e

  • ',t.title);else{var f=s('
  • %e

  • ',t.title,encodeURIComponent(t.fullTitle())),h=t.err.stack||t.err.toString();~h.indexOf(t.err.message)||(h=t.err.message+"\n"+h),"[object Error]"==h&&(h=t.err.message),!t.err.stack&&t.err.sourceURL&&void 0!==t.err.line&&(h+="\n("+t.err.sourceURL+":"+t.err.line+")"),f.appendChild(s('
    %e
    ',h))}if(!t.pending){var d=f.getElementsByTagName("h2")[0];c(d,"click",function(){m.style.display="none"==m.style.display?"block":"none"});var m=s("
    %e
    ",p.clean(t.fn.toString()));f.appendChild(m),m.style.display="none"}_[0]&&_[0].appendChild(f)})):i("#mocha div missing, add it to your document")}function i(t){document.body.appendChild(s('
    %s
    ',t))}function s(t){var e=arguments,n=document.createElement("div"),r=1;return n.innerHTML=t.replace(/%([se])/g,function(t,n){switch(n){case"s":return String(e[r++]);case"e":return d(e[r++])}}),n.firstChild}function a(t){for(var e=document.getElementsByClassName("suite"),n=0;n0&&(e.coverage=e.hits/e.sloc*100),e}function a(t,e){var n={filename:t,coverage:0,hits:0,misses:0,sloc:0,source:{}};return e.source.forEach(function(t,r){r++,0===e[r]?(n.misses++,n.sloc++):void 0!==e[r]&&(n.hits++,n.sloc++),n.source[r]={source:t,coverage:void 0===e[r]?"":e[r]}}),n.coverage=n.hits/n.sloc*100,n}function u(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration}}var l=r("./base");e=t.exports=o}),t.register("reporters/json-stream.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,t.total);t.on("start",function(){console.log(JSON.stringify(["start",{total:n}]))}),t.on("pass",function(t){console.log(JSON.stringify(["pass",o(t)]))}),t.on("fail",function(t){console.log(JSON.stringify(["fail",o(t)]))}),t.on("end",function(){i.stdout.write(JSON.stringify(["end",e.stats]))})}function o(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration}}{var s=n("./base");s.color}e=t.exports=r}),t.register("reporters/json.js",function(t,e,n){function r(t){var e=this;s.call(this,t);var n=[],r=[],a=[];t.on("test end",function(t){n.push(t)}),t.on("pass",function(t){a.push(t)}),t.on("fail",function(t,e){r.push(t),e===Object(e)&&(t.errMsg=e.message,t.errStack=e.stack)}),t.on("end",function(){var s={stats:e.stats,tests:n.map(o),failures:r.map(o),passes:a.map(o)};t.testResults=s,i.stdout.write(JSON.stringify(s,null,2))})}function o(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration,err:t.err,errStack:t.err.stack,errMessage:t.err.message}}{var s=n("./base");s.cursor,s.color}e=t.exports=r}),t.register("reporters/landing.js",function(t,e,n){function r(t){function e(){var t=Array(r).join("-");return" "+u("runway",t)}s.call(this,t);var n=this,r=(this.stats,.75*s.window.width|0),o=t.total,l=i.stdout,c=u("plane","✈"),f=-1,p=0;t.on("start",function(){l.write("\n "),a.hide()}),t.on("test end",function(t){var n=-1==f?r*++p/o|0:f;"failed"==t.state&&(c=u("plane crash","✈"),f=n),l.write("\n\n"),l.write(e()),l.write("\n "),l.write(u("runway",Array(n).join("⋅"))),l.write(c),l.write(u("runway",Array(r-n).join("⋅")+"\n")),l.write(e()),l.write("")}),t.on("end",function(){a.show(),console.log(),n.epilogue()})}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,s.colors.plane=0,s.colors["plane crash"]=31,s.colors.runway=90,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/list.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,0);t.on("start",function(){console.log()}),t.on("test",function(t){i.stdout.write(u("pass"," "+t.fullTitle()+": "))}),t.on("pending",function(t){var e=u("checkmark"," -")+u("pending"," %s");console.log(e,t.fullTitle())}),t.on("pass",function(t){var e=u("checkmark"," "+s.symbols.dot)+u("pass"," %s: ")+u(t.speed,"%dms");a.CR(),console.log(e,t.fullTitle(),t.duration)}),t.on("fail",function(t){a.CR(),console.log(u("fail"," %d) %s"),++n,t.fullTitle())}),t.on("end",e.epilogue.bind(e))}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/markdown.js",function(t,e,n){function r(t){function e(t){return Array(u).join("#")+" "+t}function n(t,e){var r=e;return e=e[t.title]=e[t.title]||{suite:t},t.suites.forEach(function(t){n(t,e)}),r}function r(t,e){++e;var n,o="";for(var i in t)"suite"!=i&&(i&&(n=" - ["+i+"](#"+s.slug(t[i].suite.fullTitle())+")\n"),i&&(o+=Array(e).join(" ")+n),o+=r(t[i],e));return--e,o}function a(t){var e=n(t,{});return r(e,0)}o.call(this,t);var u=(this.stats,0),l="";a(t.suite),t.on("suite",function(t){++u;var n=s.slug(t.fullTitle());l+='\n',l+=e(t.title)+"\n"}),t.on("suite end",function(){--u}),t.on("pass",function(t){var e=s.clean(t.fn.toString());l+=t.title+".\n",l+="\n```js\n",l+=e+"\n",l+="```\n\n"}),t.on("end",function(){i.stdout.write("# TOC\n"),i.stdout.write(a(t.suite)),i.stdout.write(l)})}var o=n("./base"),s=n("../utils");e=t.exports=r}),t.register("reporters/min.js",function(t,e,n){function r(t){s.call(this,t),t.on("start",function(){i.stdout.write(""),i.stdout.write("")}),t.on("end",this.epilogue.bind(this))}function o(){}var s=n("./base");e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/nyan.js",function(t,e,n){function r(t){a.call(this,t);{var e=this,n=(this.stats,.75*a.window.width|0),r=(this.rainbowColors=e.generateColors(),this.colorIndex=0,this.numberOfLines=4,this.trajectories=[[],[],[],[]],this.nyanCatWidth=11); -this.trajectoryWidthMax=n-r,this.scoreboardWidth=5,this.tick=0}t.on("start",function(){a.cursor.hide(),e.draw()}),t.on("pending",function(){e.draw()}),t.on("pass",function(){e.draw()}),t.on("fail",function(){e.draw()}),t.on("end",function(){a.cursor.show();for(var t=0;t=this.trajectoryWidthMax&&r.shift(),r.push(e)}},r.prototype.drawRainbow=function(){var t=this;this.trajectories.forEach(function(e){o("["+t.scoreboardWidth+"C"),o(e.join("")),o("\n")}),this.cursorUp(this.numberOfLines)},r.prototype.drawNyanCat=function(){var t=this,e=this.scoreboardWidth+this.trajectories[0].length,n="["+e+"C",r="";o(n),o("_,------,"),o("\n"),o(n),r=t.tick?" ":" ",o("_|"+r+"/\\_/\\ "),o("\n"),o(n),r=t.tick?"_":"__";var i=t.tick?"~":"^";o(i+"|"+r+this.face()+" "),o("\n"),o(n),r=t.tick?" ":" ",o(r+'"" "" '),o("\n"),this.cursorUp(this.numberOfLines)},r.prototype.face=function(){var t=this.stats;return t.failures?"( x .x)":t.pending?"( o .o)":t.passes?"( ^ .^)":"( - .-)"},r.prototype.cursorUp=function(t){o("["+t+"A")},r.prototype.cursorDown=function(t){o("["+t+"B")},r.prototype.generateColors=function(){for(var t=[],e=0;42>e;e++){var n=Math.floor(Math.PI/3),r=e*(1/6),o=Math.floor(3*Math.sin(r)+3),i=Math.floor(3*Math.sin(r+2*n)+3),s=Math.floor(3*Math.sin(r+4*n)+3);t.push(36*o+6*i+s+16)}return t},r.prototype.rainbowify=function(t){var e=this.rainbowColors[this.colorIndex%this.rainbowColors.length];return this.colorIndex+=1,"[38;5;"+e+"m"+t+""},s.prototype=a.prototype,r.prototype=new s,r.prototype.constructor=r}),t.register("reporters/progress.js",function(t,e,n){function r(t,e){s.call(this,t);var n=this,e=e||{},r=(this.stats,.5*s.window.width|0),o=t.total,l=0,c=(Math.max,-1);e.open=e.open||"[",e.complete=e.complete||"▬",e.incomplete=e.incomplete||s.symbols.dot,e.close=e.close||"]",e.verbose=!1,t.on("start",function(){console.log(),a.hide()}),t.on("test end",function(){l++;var t=l/o,n=r*t|0,s=r-n;(c!==n||e.verbose)&&(c=n,a.CR(),i.stdout.write(""),i.stdout.write(u("progress"," "+e.open)),i.stdout.write(Array(n).join(e.complete)),i.stdout.write(Array(s).join(e.incomplete)),i.stdout.write(u("progress",e.close)),e.verbose&&i.stdout.write(u("progress"," "+l+" of "+o)))}),t.on("end",function(){a.show(),console.log(),n.epilogue()})}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,s.colors.progress=90,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/spec.js",function(t,e,n){function r(t){function e(){return Array(r).join(" ")}i.call(this,t);var n=this,r=(this.stats,0),o=0;t.on("start",function(){console.log()}),t.on("suite",function(t){++r,console.log(a("suite","%s%s"),e(),t.title)}),t.on("suite end",function(){--r,1==r&&console.log()}),t.on("pending",function(t){var n=e()+a("pending"," - %s");console.log(n,t.title)}),t.on("pass",function(t){if("fast"==t.speed){var n=e()+a("checkmark"," "+i.symbols.ok)+a("pass"," %s ");s.CR(),console.log(n,t.title)}else{var n=e()+a("checkmark"," "+i.symbols.ok)+a("pass"," %s ")+a(t.speed,"(%dms)");s.CR(),console.log(n,t.title,t.duration)}}),t.on("fail",function(t){s.CR(),console.log(e()+a("fail"," %d) %s"),++o,t.title)}),t.on("end",n.epilogue.bind(n))}function o(){}var i=n("./base"),s=i.cursor,a=i.color;e=t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/tap.js",function(t,e,n){function r(t){i.call(this,t);var e=(this.stats,1),n=0,r=0;t.on("start",function(){var e=t.grepTotal(t.suite);console.log("%d..%d",1,e)}),t.on("test end",function(){++e}),t.on("pending",function(t){console.log("ok %d %s # SKIP -",e,o(t))}),t.on("pass",function(t){n++,console.log("ok %d %s",e,o(t))}),t.on("fail",function(t,n){r++,console.log("not ok %d %s",e,o(t)),n.stack&&console.log(n.stack.replace(/^/gm," "))}),t.on("end",function(){console.log("# tests "+(n+r)),console.log("# pass "+n),console.log("# fail "+r)})}function o(t){return t.fullTitle().replace(/#/g,"")}{var i=n("./base");i.cursor,i.color}e=t.exports=r}),t.register("reporters/xunit.js",function(t,e,r){function o(t){l.call(this,t);var e=this.stats,n=[];t.on("pending",function(t){n.push(t)}),t.on("pass",function(t){n.push(t)}),t.on("fail",function(t){n.push(t)}),t.on("end",function(){console.log(a("testsuite",{name:"Mocha Tests",tests:e.tests,failures:e.failures,errors:e.failures,skipped:e.tests-e.failures-e.passes,timestamp:(new p).toUTCString(),time:e.duration/1e3||0},!1)),n.forEach(s),console.log("")})}function i(){}function s(t){var e={classname:t.parent.fullTitle(),name:t.title,time:t.duration/1e3||0};if("failed"==t.state){var n=t.err;console.log(a("testcase",e,!1,a("failure",{},!1,u(f(n.message)+"\n"+n.stack))))}else console.log(t.pending?a("testcase",e,!1,a("skipped",{},!0)):a("testcase",e,!0))}function a(t,e,n,r){var o,i=n?"/>":">",s=[];for(var a in e)s.push(a+'="'+f(e[a])+'"');return o="<"+t+(s.length?" "+s.join(" "):"")+i,r&&(o+=r+""}{var l=r("./base"),c=r("../utils"),f=c.escape,p=n.Date;n.setTimeout,n.setInterval,n.clearTimeout,n.clearInterval}e=t.exports=o,i.prototype=l.prototype,o.prototype=new i,o.prototype.constructor=o}),t.register("runnable.js",function(t,e,r){function o(t,e){this.title=t,this.fn=e,this.async=e&&e.length,this.sync=!this.async,this._timeout=2e3,this._slow=75,this._enableTimeouts=!0,this.timedOut=!1}function i(){}var s=r("browser/events").EventEmitter,a=r("browser/debug")("mocha:runnable"),u=r("./ms"),l=n.Date,c=n.setTimeout,f=(n.setInterval,n.clearTimeout),p=(n.clearInterval,Object.prototype.toString);t.exports=o,i.prototype=s.prototype,o.prototype=new i,o.prototype.constructor=o,o.prototype.timeout=function(t){return 0==arguments.length?this._timeout:("string"==typeof t&&(t=u(t)),a("timeout %d",t),this._timeout=t,this.timer&&this.resetTimeout(),this)},o.prototype.slow=function(t){return 0===arguments.length?this._slow:("string"==typeof t&&(t=u(t)),a("timeout %d",t),this._slow=t,this)},o.prototype.enableTimeouts=function(t){return 0===arguments.length?this._enableTimeouts:(a("enableTimeouts %s",t),this._enableTimeouts=t,this)},o.prototype.fullTitle=function(){return this.parent.fullTitle()+" "+this.title},o.prototype.clearTimeout=function(){f(this.timer)},o.prototype.inspect=function(){return JSON.stringify(this,function(t,e){return"_"!=t[0]?"parent"==t?"#":"ctx"==t?"#":e:void 0},2)},o.prototype.resetTimeout=function(){var t=this,e=this.timeout()||1e9;this._enableTimeouts&&(this.clearTimeout(),this.timer=c(function(){t.callback(new Error("timeout of "+e+"ms exceeded")),t.timedOut=!0},e))},o.prototype.globals=function(t){this._allowedGlobals=t},o.prototype.run=function(t){function e(t){i||(i=!0,s.emit("error",t||new Error("done() called multiple times")))}function n(n){var r=s.timeout();if(!s.timedOut){if(o)return e(n);s.clearTimeout(),s.duration=new l-a,o=!0,!n&&s.duration>r&&s._enableTimeouts&&(n=new Error("timeout of "+r+"ms exceeded")),t(n)}}function r(t){var e=t.call(u);e&&"function"==typeof e.then?(s.resetTimeout(),e.then(function(){n()},function(t){n(t||new Error("Promise rejected with no or falsy reason"))})):n()}var o,i,s=this,a=new l,u=this.ctx;if(u&&u.runnable&&u.runnable(this),this.callback=n,this.async){this.resetTimeout();try{this.fn.call(u,function(t){return t instanceof Error||"[object Error]"===p.call(t)?n(t):null!=t?n("[object Object]"===Object.prototype.toString.call(t)?new Error("done() invoked with non-Error: "+JSON.stringify(t)):new Error("done() invoked with non-Error: "+t)):void n()})}catch(t){n(t)}}else{if(this.asyncOnly)return n(new Error("--async-only option in use without declaring `done()`"));try{this.pending?n():r(this.fn)}catch(t){n(t)}}}}),t.register("runner.js",function(t,e,r){function o(t){var e=this;this._globals=[],this._abort=!1,this.suite=t,this.total=t.total(),this.failures=0,this.on("test end",function(t){e.checkGlobals(t)}),this.on("hook end",function(t){e.checkGlobals(t)}),this.grep(/.*/),this.globals(this.globalProps().concat(u()))}function s(){}function a(t,e){return p(e,function(e){if(/^d+/.test(e))return!1;if(n.navigator&&/^getInterface/.test(e))return!1;if(n.navigator&&/^\d+/.test(e))return!1;if(/^mocha-/.test(e))return!1;var r=p(t,function(t){return~t.indexOf("*")?0==e.indexOf(t.split("*")[0]):e==t});return 0==r.length&&(!n.navigator||"onerror"!==e)})}function u(){if("object"==typeof i&&"string"==typeof i.version){var t=i.version.split(".").reduce(function(t,e){return t<<8|e});if(2315>t)return["errno"]}return[]}var l=r("browser/events").EventEmitter,c=r("browser/debug")("mocha:runner"),f=(r("./test"),r("./utils")),p=f.filter,h=(f.keys,["setTimeout","clearTimeout","setInterval","clearInterval","XMLHttpRequest","Date"]);t.exports=o,o.immediately=n.setImmediate||i.nextTick,s.prototype=l.prototype,o.prototype=new s,o.prototype.constructor=o,o.prototype.grep=function(t,e){return c("grep %s",t),this._grep=t,this._invert=e,this.total=this.grepTotal(this.suite),this},o.prototype.grepTotal=function(t){var e=this,n=0;return t.eachTest(function(t){var r=e._grep.test(t.fullTitle());e._invert&&(r=!r),r&&n++}),n},o.prototype.globalProps=function(){for(var t=f.keys(n),e=0;e1?this.fail(t,new Error("global leaks detected: "+e.join(", "))):e.length&&this.fail(t,new Error("global leak detected: "+e[0])))}},o.prototype.fail=function(t,e){++this.failures,t.state="failed","string"==typeof e&&(e=new Error('the string "'+e+'" was thrown, throw an Error :)')),this.emit("fail",t,e)},o.prototype.failHook=function(t,e){this.fail(t,e),this.suite.bail()&&this.emit("end")},o.prototype.hook=function(t,e){function n(t){var o=i[t];return o?s.failures&&r.bail()?e():(s.currentRunnable=o,o.ctx.currentTest=s.test,s.emit("hook",o),o.on("error",function(t){s.failHook(o,t)}),void o.run(function(r){o.removeAllListeners("error");var i=o.error();return i&&s.fail(s.test,i),r?(s.failHook(o,r),e(r)):(s.emit("hook end",o),delete o.ctx.currentTest,void n(++t))})):e()}var r=this.suite,i=r["_"+t],s=this;o.immediately(function(){n(0)})},o.prototype.hooks=function(t,e,n){function r(s){return o.suite=s,s?void o.hook(t,function(t){if(t){var s=o.suite;return o.suite=i,n(t,s)}r(e.pop())}):(o.suite=i,n())}var o=this,i=this.suite;r(e.pop())},o.prototype.hookUp=function(t,e){var n=[this.suite].concat(this.parents()).reverse();this.hooks(t,n,e)},o.prototype.hookDown=function(t,e){var n=[this.suite].concat(this.parents());this.hooks(t,n,e)},o.prototype.parents=function(){for(var t=this.suite,e=[];t=t.parent;)e.push(t);return e},o.prototype.runTest=function(t){var e=this.test,n=this;this.asyncOnly&&(e.asyncOnly=!0);try{e.on("error",function(t){n.fail(e,t)}),e.run(t)}catch(e){t(e)}},o.prototype.runTests=function(t,e){function n(t,r,o){var s=i.suite;i.suite=o?r.parent:r,i.suite?i.hookUp("afterEach",function(t,o){return i.suite=s,t?n(t,o,!0):void e(r)}):(i.suite=s,e(r))}function r(a,u){if(i.failures&&t._bail)return e();if(i._abort)return e();if(a)return n(a,u,!0);if(o=s.shift(),!o)return e();var l=i._grep.test(o.fullTitle());return i._invert&&(l=!l),l?o.pending?(i.emit("pending",o),i.emit("test end",o),r()):(i.emit("test",i.test=o),void i.hookDown("beforeEach",function(t,e){return t?n(t,e,!1):(i.currentRunnable=i.test,void i.runTest(function(t){return o=i.test,t?(i.fail(o,t),i.emit("test end",o),i.hookUp("afterEach",r)):(o.state="passed",i.emit("pass",o),i.emit("test end",o),void i.hookUp("afterEach",r))}))})):r()}var o,i=this,s=t.tests.slice();this.next=r,r()},o.prototype.runSuite=function(t,e){function n(e){if(e)return e==t?r():r(e);if(i._abort)return r();var o=t.suites[s++];return o?void i.runSuite(o,n):r()}function r(n){i.suite=t,i.hook("afterAll",function(){i.emit("suite end",t),e(n)})}var o=this.grepTotal(t),i=this,s=0;return c("run suite %s",t.fullTitle()),o?(this.emit("suite",this.suite=t),void this.hook("beforeAll",function(e){return e?r():void i.runTests(t,n)})):e()},o.prototype.uncaught=function(t){t?c("uncaught exception %s",t.message):(c("uncaught undefined exception"),t=new Error("Catched undefined error, did you throw without specifying what?"));var e=this.currentRunnable;if(e&&"failed"!=e.state)return e.clearTimeout(),t.uncaught=!0,this.fail(e,t),"test"==e.type?(this.emit("test end",e),void this.hookUp("afterEach",this.next)):void this.emit("end")},o.prototype.run=function(t){function e(t){n.uncaught(t)}var n=this,t=t||function(){};return c("start"),this.on("end",function(){c("end"),i.removeListener("uncaughtException",e),t(n.failures)}),this.emit("start"),this.runSuite(this.suite,function(){c("finished running"),n.emit("end")}),i.on("uncaughtException",e),this},o.prototype.abort=function(){c("aborting"),this._abort=!0}}),t.register("suite.js",function(t,e,n){function r(t,e){this.title=t;var n=function(){};n.prototype=e,this.ctx=new n,this.suites=[],this.tests=[],this.pending=!1,this._beforeEach=[],this._beforeAll=[],this._afterEach=[],this._afterAll=[],this.root=!t,this._timeout=2e3,this._enableTimeouts=!0,this._slow=75,this._bail=!1}function o(){}var i=n("browser/events").EventEmitter,s=n("browser/debug")("mocha:suite"),a=n("./ms"),u=n("./utils"),l=n("./hook");e=t.exports=r,e.create=function(t,e){var n=new r(e,t.ctx);return n.parent=t,t.pending&&(n.pending=!0),e=n.fullTitle(),t.addSuite(n),n},o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r,r.prototype.clone=function(){var t=new r(this.title);return s("clone"),t.ctx=this.ctx,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.bail(this.bail()),t},r.prototype.timeout=function(t){return 0==arguments.length?this._timeout:("string"==typeof t&&(t=a(t)),s("timeout %d",t),this._timeout=parseInt(t,10),this)},r.prototype.enableTimeouts=function(t){return 0===arguments.length?this._enableTimeouts:(s("enableTimeouts %s",t),this._enableTimeouts=t,this)},r.prototype.slow=function(t){return 0===arguments.length?this._slow:("string"==typeof t&&(t=a(t)),s("slow %d",t),this._slow=t,this)},r.prototype.bail=function(t){return 0==arguments.length?this._bail:(s("bail %s",t),this._bail=t,this)},r.prototype.beforeAll=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"before all" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._beforeAll.push(n),this.emit("beforeAll",n),this},r.prototype.afterAll=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"after all" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._afterAll.push(n),this.emit("afterAll",n),this},r.prototype.beforeEach=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"before each" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._beforeEach.push(n),this.emit("beforeEach",n),this},r.prototype.afterEach=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"after each" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._afterEach.push(n),this.emit("afterEach",n),this},r.prototype.addSuite=function(t){return t.parent=this,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.bail(this.bail()),this.suites.push(t),this.emit("suite",t),this},r.prototype.addTest=function(t){return t.parent=this,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.ctx=this.ctx,this.tests.push(t),this.emit("test",t),this},r.prototype.fullTitle=function(){if(this.parent){var t=this.parent.fullTitle();if(t)return t+" "+this.title}return this.title},r.prototype.total=function(){return u.reduce(this.suites,function(t,e){return t+e.total()},0)+this.tests.length},r.prototype.eachTest=function(t){return u.forEach(this.tests,t),u.forEach(this.suites,function(e){e.eachTest(t)}),this}}),t.register("test.js",function(t,e,n){function r(t,e){i.call(this,t,e),this.pending=!e,this.type="test"}function o(){}var i=n("./runnable");t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("utils.js",function(t,e,n){function r(t){return!~l.indexOf(t)}function o(t){return t.replace(//g,">").replace(/\/\/(.*)/gm,'//$1').replace(/('.*?')/gm,'$1').replace(/(\d+\.\d+)/gm,'$1').replace(/(\d+)/gm,'$1').replace(/\bnew[ \t]+(\w+)/gm,'new $1').replace(/\b(function|new|throw|return|var|if|else)\b/gm,'$1')}var i=n("browser/fs"),s=n("browser/path"),a=s.join,u=n("browser/debug")("mocha:watch"),l=["node_modules",".git"];e.escape=function(t){return String(t).replace(/&/g,"&").replace(/"/g,""").replace(//g,">")},e.forEach=function(t,e,n){for(var r=0,o=t.length;o>r;r++)e.call(n,t[r],r)},e.map=function(t,e,n){for(var r=[],o=0,i=t.length;i>o;o++)r.push(e.call(n,t[o],o));return r},e.indexOf=function(t,e,n){for(var r=n||0,o=t.length;o>r;r++)if(t[r]===e)return r;return-1},e.reduce=function(t,e,n){for(var r=n,o=0,i=t.length;i>o;o++)r=e(r,t[o],o,t);return r},e.filter=function(t,e){for(var n=[],r=0,o=t.length;o>r;r++){var i=t[r];e(i,r,t)&&n.push(i)}return n},e.keys=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e},e.watch=function(t,e){var n={interval:100};t.forEach(function(t){u("file %s",t),i.watchFile(t,n,function(n,r){r.mtime *{?/,"").replace(/\s+\}$/,"");var n=t.match(/^\n?( *)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length,o=new RegExp("^\n?"+(r?" ":" ")+"{"+(r?r:n)+"}","gm");return t=t.replace(o,""),e.trim(t)},e.escapeRegexp=function(t){return t.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")},e.trim=function(t){return t.replace(/^\s+|\s+$/g,"")},e.parseQuery=function(t){return e.reduce(t.replace("?","").split("&"),function(t,e){var n=e.indexOf("="),r=e.slice(0,n),o=e.slice(++n);return t[r]=decodeURIComponent(o),t},{})},e.highlightTags=function(t){for(var e=document.getElementsByTagName(t),n=0,r=e.length;r>n;++n)e[n].innerHTML=o(e[n].innerHTML)},e.stringify=function(t){return t instanceof RegExp?t.toString():JSON.stringify(e.canonicalize(t),null,2).replace(/,(\n|$)/g,"$1")},e.canonicalize=function(t,n){if(n=n||[],-1!==e.indexOf(n,t))return"[Circular]";var r;return"[object Array]"==={}.toString.call(t)?(n.push(t),r=e.map(t,function(t){return e.canonicalize(t,n)}),n.pop()):"object"==typeof t&&null!==t?(n.push(t),r={},e.forEach(e.keys(t).sort(),function(o){r[o]=e.canonicalize(t[o],n)}),n.pop()):r=t,r}});var n=function(){return this}(),r=n.Date,o=n.setTimeout,i=(n.setInterval,n.clearTimeout,n.clearInterval,{});i.exit=function(){},i.stdout={};var s=[],a=n.onerror;i.removeListener=function(t,e){if("uncaughtException"==t){n.onerror=a?a:function(){};var r=u.utils.indexOf(s,e);-1!=r&&s.splice(r,1)}},i.on=function(t,e){"uncaughtException"==t&&(n.onerror=function(t,n,r){return e(new Error(t+" ("+n+":"+r+")")),!0},s.push(e))};var u=n.Mocha=t("mocha"),l=n.mocha=new u({reporter:"html"});l.suite.removeAllListeners("pre-require");var c,f=[];u.Runner.immediately=function(t){f.push(t),c||(c=o(e,0))},l.throwError=function(t){throw u.utils.forEach(s,function(e){e(t)}),t},l.ui=function(t){return u.prototype.ui.call(this,t),this.suite.emit("pre-require",n,null,this),this},l.setup=function(t){"string"==typeof t&&(t={ui:t});for(var e in t)this[e](t[e]);return this},l.run=function(t){l.options;l.globals("location");var e=u.utils.parseQuery(n.location.search||"");return e.grep&&l.grep(e.grep),e.invert&&l.invert(),u.prototype.run.call(l,function(e){n.document&&u.utils.highlightTags("code"),t&&t(e)})},u.process=i}(); \ No newline at end of file +!function(){function t(e){var n=t.resolve(e),r=t.modules[n];if(!r)throw new Error('failed to require "'+e+'"');return r.exports||(r.exports={},r.call(r.exports,r,r.exports,t.relative(n))),r.exports}function e(){for(var t=(new r).getTime();f.length&&(new r).getTime()-t<100;)f.shift()();c=f.length?o(e,0):null}t.modules={},t.resolve=function(e){var n=e,r=e+".js",o=e+"/index.js";return t.modules[r]&&r||t.modules[o]&&o||n},t.register=function(e,n){t.modules[e]=n},t.relative=function(e){return function(n){if("."!=n.charAt(0))return t(n);var r=e.split("/"),o=n.split("/");r.pop();for(var i=0;i/g,">"),e=e.replace(/"/g,""")}var r=function(t){this.ignoreWhitespace=t};r.prototype={diff:function(e,n){if(n===e)return[{value:n}];if(!n)return[{value:e,removed:!0}];if(!e)return[{value:n,added:!0}];n=this.tokenize(n),e=this.tokenize(e);var r=n.length,o=e.length,i=r+o,s=[{newPos:-1,components:[]}],a=this.extractCommon(s[0],n,e,0);if(s[0].newPos+1>=r&&a+1>=o)return s[0].components;for(var u=1;i>=u;u++)for(var l=-1*u;u>=l;l+=2){var c,f=s[l-1],p=s[l+1];a=(p?p.newPos:0)-l,f&&(s[l-1]=void 0);var h=f&&f.newPos+1=0&&o>a;if(h||d){!h||d&&f.newPos=r&&a+1>=o)return c.components;s[l]=c}else s[l]=void 0}},pushComponent:function(t,e,n,r){var o=t[t.length-1];o&&o.added===n&&o.removed===r?t[t.length-1]={value:this.join(o.value,e),added:n,removed:r}:t.push({value:e,added:n,removed:r})},extractCommon:function(t,e,n,r){for(var o=e.length,i=n.length,s=t.newPos,a=s-r;o>s+1&&i>a+1&&this.equals(e[s+1],n[a+1]);)s++,a++,this.pushComponent(t.components,e[s],void 0,void 0);return t.newPos=s,a},equals:function(t,e){var n=/\S/;return!this.ignoreWhitespace||n.test(t)||n.test(e)?t===e:!0},join:function(t,e){return t+e},tokenize:function(t){return t}};var o=new r,i=new r(!0),s=new r;i.tokenize=s.tokenize=function(t){return e(t.split(/(\s+|\b)/))};var a=new r(!0);a.tokenize=function(t){return e(t.split(/([{}:;,]|\s+)/))};var u=new r;return u.tokenize=function(t){return t.split(/^/m)},{Diff:r,diffChars:function(t,e){return o.diff(t,e)},diffWords:function(t,e){return i.diff(t,e)},diffWordsWithSpace:function(t,e){return s.diff(t,e)},diffLines:function(t,e){return u.diff(t,e)},diffCss:function(t,e){return a.diff(t,e)},createPatch:function(t,e,n,r,o){function i(t){return t.map(function(t){return" "+t})}function s(t,e,n){var r=l[l.length-2],o=e===l.length-2,i=e===l.length-3&&(n.added!==r.added||n.removed!==r.removed);/\n$/.test(n.value)||!o&&!i||t.push("\\ No newline at end of file")}var a=[];a.push("Index: "+t),a.push("==================================================================="),a.push("--- "+t+("undefined"==typeof r?"":" "+r)),a.push("+++ "+t+("undefined"==typeof o?"":" "+o));var l=u.diff(e,n);l[l.length-1].value||l.pop(),l.push({value:"",lines:[]});for(var c=0,f=0,p=[],h=1,d=1,g=0;g=0;s--){for(var l=r[s],c=0;c"):o.removed&&e.push(""),e.push(n(o.value)),o.added?e.push(""):o.removed&&e.push("")}return e.join("")},convertChangesToDMP:function(t){for(var e,n=[],r=0;ri;i++)if(r[i]===e||r[i].listener&&r[i].listener===e){o=i;break}if(0>o)return this;r.splice(o,1),r.length||delete this.$events[t]}else(r===e||r.listener&&r.listener===e)&&delete this.$events[t]}return this},r.prototype.removeAllListeners=function(t){return void 0===t?(this.$events={},this):(this.$events&&this.$events[t]&&(this.$events[t]=null),this)},r.prototype.listeners=function(t){return this.$events||(this.$events={}),this.$events[t]||(this.$events[t]=[]),n(this.$events[t])||(this.$events[t]=[this.$events[t]]),this.$events[t]},r.prototype.emit=function(t){if(!this.$events)return!1;var e=this.$events[t];if(!e)return!1;var r=[].slice.call(arguments,1);if("function"==typeof e)e.apply(this,r);else{if(!n(e))return!1;for(var o=e.slice(),i=0,s=o.length;s>i;i++)o[i].apply(this,r)}return!0}}),t.register("browser/fs.js",function(){}),t.register("browser/glob.js",function(){}),t.register("browser/path.js",function(){}),t.register("browser/progress.js",function(t){function e(){this.percent=0,this.size(0),this.fontSize(11),this.font("helvetica, arial, sans-serif")}t.exports=e,e.prototype.size=function(t){return this._size=t,this},e.prototype.text=function(t){return this._text=t,this},e.prototype.fontSize=function(t){return this._fontSize=t,this},e.prototype.font=function(t){return this._font=t,this},e.prototype.update=function(t){return this.percent=t,this},e.prototype.draw=function(t){try{var e=Math.min(this.percent,100),n=this._size,r=n/2,o=r,i=r,s=r-1,a=this._fontSize;t.font=a+"px "+this._font;var u=2*Math.PI*(e/100);t.clearRect(0,0,n,n),t.strokeStyle="#9f9f9f",t.beginPath(),t.arc(o,i,s,0,u,!1),t.stroke(),t.strokeStyle="#eee",t.beginPath(),t.arc(o,i,s-1,0,u,!0),t.stroke();var l=this._text||(0|e)+"%",c=t.measureText(l).width;t.fillText(l,o-c/2+1,i+a/2-1)}catch(t){}return this}}),t.register("browser/tty.js",function(t,e){e.isatty=function(){return!0},e.getWindowSize=function(){return"innerHeight"in n?[n.innerHeight,n.innerWidth]:[640,480]}}),t.register("context.js",function(t){function e(){}t.exports=e,e.prototype.runnable=function(t){return 0==arguments.length?this._runnable:(this.test=this._runnable=t,this)},e.prototype.timeout=function(t){return 0===arguments.length?this.runnable().timeout():(this.runnable().timeout(t),this)},e.prototype.enableTimeouts=function(t){return this.runnable().enableTimeouts(t),this},e.prototype.slow=function(t){return this.runnable().slow(t),this},e.prototype.inspect=function(){return JSON.stringify(this,function(t,e){return"_runnable"!=t&&"test"!=t?e:void 0},2)}}),t.register("hook.js",function(t,e,n){function r(t,e){i.call(this,t,e),this.type="hook"}function o(){}var i=n("./runnable");t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r,r.prototype.error=function(t){if(0==arguments.length){var t=this._error;return this._error=null,t}this._error=t}}),t.register("interfaces/bdd.js",function(t,e,n){var r=n("../suite"),o=n("../test"),i=(n("../utils"),n("browser/escape-string-regexp"));t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.before=function(t,n){e[0].beforeAll(t,n)},t.after=function(t,n){e[0].afterAll(t,n)},t.beforeEach=function(t,n){e[0].beforeEach(t,n)},t.afterEach=function(t,n){e[0].afterEach(t,n)},t.describe=t.context=function(t,o){var i=r.create(e[0],t);return i.file=n,e.unshift(i),o.call(i),e.shift(),i},t.xdescribe=t.xcontext=t.describe.skip=function(t,n){var o=r.create(e[0],t);o.pending=!0,e.unshift(o),n.call(o),e.shift()},t.describe.only=function(e,n){var r=t.describe(e,n);return s.grep(r.fullTitle()),r},t.it=t.specify=function(t,r){var i=e[0];i.pending&&(r=null);var s=new o(t,r);return s.file=n,i.addTest(s),s},t.it.only=function(e,n){var r=t.it(e,n),o="^"+i(r.fullTitle())+"$";return s.grep(new RegExp(o)),r},t.xit=t.xspecify=t.it.skip=function(e){t.it(e)}})}}),t.register("interfaces/exports.js",function(t,e,n){var r=n("../suite"),o=n("../test");t.exports=function(t){function e(t,i){var s;for(var a in t)if("function"==typeof t[a]){var u=t[a];switch(a){case"before":n[0].beforeAll(u);break;case"after":n[0].afterAll(u);break;case"beforeEach":n[0].beforeEach(u);break;case"afterEach":n[0].afterEach(u);break;default:var l=new o(a,u);l.file=i,n[0].addTest(l)}}else s=r.create(n[0],a),n.unshift(s),e(t[a]),n.shift()}var n=[t];t.on("require",e)}}),t.register("interfaces/index.js",function(t,e,n){e.bdd=n("./bdd"),e.tdd=n("./tdd"),e.qunit=n("./qunit"),e.exports=n("./exports")}),t.register("interfaces/qunit.js",function(t,e,n){{var r=n("../suite"),o=n("../test"),i=n("browser/escape-string-regexp");n("../utils")}t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.before=function(t,n){e[0].beforeAll(t,n)},t.after=function(t,n){e[0].afterAll(t,n)},t.beforeEach=function(t,n){e[0].beforeEach(t,n)},t.afterEach=function(t,n){e[0].afterEach(t,n)},t.suite=function(t){e.length>1&&e.shift();var o=r.create(e[0],t);return o.file=n,e.unshift(o),o},t.suite.only=function(e,n){var r=t.suite(e,n);s.grep(r.fullTitle())},t.test=function(t,r){var i=new o(t,r);return i.file=n,e[0].addTest(i),i},t.test.only=function(e,n){var r=t.test(e,n),o="^"+i(r.fullTitle())+"$";s.grep(new RegExp(o))},t.test.skip=function(e){t.test(e)}})}}),t.register("interfaces/tdd.js",function(t,e,n){{var r=n("../suite"),o=n("../test"),i=n("browser/escape-string-regexp");n("../utils")}t.exports=function(t){var e=[t];t.on("pre-require",function(t,n,s){t.setup=function(t,n){e[0].beforeEach(t,n)},t.teardown=function(t,n){e[0].afterEach(t,n)},t.suiteSetup=function(t,n){e[0].beforeAll(t,n)},t.suiteTeardown=function(t,n){e[0].afterAll(t,n)},t.suite=function(t,o){var i=r.create(e[0],t);return i.file=n,e.unshift(i),o.call(i),e.shift(),i},t.suite.skip=function(t,n){var o=r.create(e[0],t);o.pending=!0,e.unshift(o),n.call(o),e.shift()},t.suite.only=function(e,n){var r=t.suite(e,n);s.grep(r.fullTitle())},t.test=function(t,r){var i=e[0];i.pending&&(r=null);var s=new o(t,r);return s.file=n,i.addTest(s),s},t.test.only=function(e,n){var r=t.test(e,n),o="^"+i(r.fullTitle())+"$";s.grep(new RegExp(o))},t.test.skip=function(e){t.test(e)}})}}),t.register("mocha.js",function(t,e,r){function o(t){return __dirname+"/../images/"+t+".png"}function s(t){t=t||{},this.files=[],this.options=t,this.grep(t.grep),this.suite=new e.Suite("",new e.Context),this.ui(t.ui),this.bail(t.bail),this.reporter(t.reporter),null!=t.timeout&&this.timeout(t.timeout),this.useColors(t.useColors),null!==t.enableTimeouts&&this.enableTimeouts(t.enableTimeouts),t.slow&&this.slow(t.slow),this.suite.on("pre-require",function(t){e.afterEach=t.afterEach||t.teardown,e.after=t.after||t.suiteTeardown,e.beforeEach=t.beforeEach||t.setup,e.before=t.before||t.suiteSetup,e.describe=t.describe||t.suite,e.it=t.it||t.test,e.setup=t.setup||t.beforeEach,e.suiteSetup=t.suiteSetup||t.before,e.suiteTeardown=t.suiteTeardown||t.after,e.suite=t.suite||t.describe,e.teardown=t.teardown||t.afterEach,e.test=t.test||t.it})}var a=r("browser/path"),u=r("browser/escape-string-regexp"),l=r("./utils");if(e=t.exports=s,"undefined"!=typeof i&&"function"==typeof i.cwd){var c=a.join,f=i.cwd();t.paths.push(f,c(f,"node_modules"))}e.utils=l,e.interfaces=r("./interfaces"),e.reporters=r("./reporters"),e.Runnable=r("./runnable"),e.Context=r("./context"),e.Runner=r("./runner"),e.Suite=r("./suite"),e.Hook=r("./hook"),e.Test=r("./test"),s.prototype.bail=function(t){return 0==arguments.length&&(t=!0),this.suite.bail(t),this},s.prototype.addFile=function(t){return this.files.push(t),this},s.prototype.reporter=function(t){if("function"==typeof t)this._reporter=t;else{t=t||"spec";var e;try{e=r("./reporters/"+t)}catch(t){}if(!e)try{e=r(t)}catch(t){}if(e||"teamcity"!==t||console.warn("The Teamcity reporter was moved to a package named mocha-teamcity-reporter (https://npmjs.org/package/mocha-teamcity-reporter)."),!e)throw new Error('invalid reporter "'+t+'"');this._reporter=e}return this},s.prototype.ui=function(t){if(t=t||"bdd",this._ui=e.interfaces[t],!this._ui)try{this._ui=r(t)}catch(t){}if(!this._ui)throw new Error('invalid interface "'+t+'"');return this._ui=this._ui(this.suite),this},s.prototype.loadFiles=function(t){var e=this,o=this.suite,i=this.files.length;this.files.forEach(function(s){s=a.resolve(s),o.emit("pre-require",n,s,e),o.emit("require",r(s),s,e),o.emit("post-require",n,s,e),--i||t&&t()})},s.prototype._growl=function(t,e){var n=r("growl");t.on("end",function(){var r=e.stats;if(r.failures){var i=r.failures+" of "+t.total+" tests failed";n(i,{name:"mocha",title:"Failed",image:o("error")})}else n(r.passes+" tests passed in "+r.duration+"ms",{name:"mocha",title:"Passed",image:o("ok")})})},s.prototype.grep=function(t){return this.options.grep="string"==typeof t?new RegExp(u(t)):t,this},s.prototype.invert=function(){return this.options.invert=!0,this},s.prototype.ignoreLeaks=function(t){return this.options.ignoreLeaks=!!t,this},s.prototype.checkLeaks=function(){return this.options.ignoreLeaks=!1,this},s.prototype.growl=function(){return this.options.growl=!0,this},s.prototype.globals=function(t){return this.options.globals=(this.options.globals||[]).concat(t),this},s.prototype.useColors=function(t){return this.options.useColors=arguments.length&&void 0!=t?t:!0,this},s.prototype.useInlineDiffs=function(t){return this.options.useInlineDiffs=arguments.length&&void 0!=t?t:!1,this},s.prototype.timeout=function(t){return this.suite.timeout(t),this},s.prototype.slow=function(t){return this.suite.slow(t),this},s.prototype.enableTimeouts=function(t){return this.suite.enableTimeouts(arguments.length&&void 0!==t?t:!0),this},s.prototype.asyncOnly=function(){return this.options.asyncOnly=!0,this},s.prototype.noHighlighting=function(){return this.options.noHighlighting=!0,this},s.prototype.run=function(t){this.files.length&&this.loadFiles();var n=this.suite,r=this.options;r.files=this.files;var o=new e.Runner(n),i=new this._reporter(o,r);return o.ignoreLeaks=!1!==r.ignoreLeaks,o.asyncOnly=r.asyncOnly,r.grep&&o.grep(r.grep,r.invert),r.globals&&o.globals(r.globals),r.growl&&this._growl(o,i),e.reporters.Base.useColors=r.useColors,e.reporters.Base.inlineDiffs=r.useInlineDiffs,o.run(t)}}),t.register("ms.js",function(t){function e(t){var e=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"y":return n*l;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"h":return n*a;case"minutes":case"minute":case"m":return n*s;case"seconds":case"second":case"s":return n*i;case"ms":return n}}}function n(t){return t>=u?Math.round(t/u)+"d":t>=a?Math.round(t/a)+"h":t>=s?Math.round(t/s)+"m":t>=i?Math.round(t/i)+"s":t+"ms"}function r(t){return o(t,u,"day")||o(t,a,"hour")||o(t,s,"minute")||o(t,i,"second")||t+" ms"}function o(t,e,n){return e>t?void 0:1.5*e>t?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var i=1e3,s=60*i,a=60*s,u=24*a,l=365.25*u;t.exports=function(t,o){return o=o||{},"string"==typeof t?e(t):o.long?r(t):n(t)}}),t.register("reporters/base.js",function(t,e,r){function o(t){var e=this.stats={suites:0,tests:0,passes:0,pending:0,failures:0},n=this.failures=[];t&&(this.runner=t,t.stats=e,t.on("start",function(){e.start=new v}),t.on("suite",function(t){e.suites=e.suites||0,t.root||e.suites++}),t.on("test end",function(){e.tests=e.tests||0,e.tests++}),t.on("pass",function(t){e.passes=e.passes||0;var n=t.slow()/2;t.speed=t.duration>t.slow()?"slow":t.duration>n?"medium":"fast",e.passes++}),t.on("fail",function(t,r){e.failures=e.failures||0,e.failures++,t.err=r,n.push(t)}),t.on("end",function(){e.end=new v,e.duration=new v-e.start}),t.on("pending",function(){e.pending++}))}function s(t,e){return t=String(t),Array(e-t.length+1).join(" ")+t}function a(t,e){var n=l(t,"WordsWithSpace",e),r=n.split("\n");if(r.length>4){var o=String(r.length).length;n=r.map(function(t,e){return s(++e,o)+" | "+t}).join("\n")}return n="\n"+w("diff removed","actual")+" "+w("diff added","expected")+"\n\n"+n+"\n",n=n.replace(/^/gm," ")}function u(t,e){function n(t){return e&&(t=c(t)),"+"===t[0]?o+f("diff added",t):"-"===t[0]?o+f("diff removed",t):t.match(/\@\@/)?null:t.match(/\\ No newline/)?null:o+t}function r(t){return null!=t}var o=" ";msg=d.createPatch("string",t.actual,t.expected);var i=msg.split("\n").splice(4);return"\n "+f("diff added","+ expected")+" "+f("diff removed","- actual")+"\n\n"+i.map(n).filter(r).join("\n")}function l(t,e,n){var r=n?c(t.actual):t.actual,o=n?c(t.expected):t.expected;return d["diff"+e](r,o).map(function(t){return t.added?f("diff added",t.value):t.removed?f("diff removed",t.value):t.value}).join("")}function c(t){return t.replace(/\t/g,"").replace(/\r/g,"").replace(/\n/g,"\n")}function f(t,e){return e.split("\n").map(function(e){return w(t,e)}).join("\n")}function p(t,e){return t=Object.prototype.toString.call(t),e=Object.prototype.toString.call(e),t==e}var h=r("browser/tty"),d=r("browser/diff"),g=r("../ms"),m=r("../utils"),v=n.Date,y=(n.setTimeout,n.setInterval,n.clearTimeout,n.clearInterval,h.isatty(1)&&h.isatty(2));e=t.exports=o,e.useColors=y||void 0!==i.env.MOCHA_COLORS,e.inlineDiffs=!1,e.colors={pass:90,fail:31,"bright pass":92,"bright fail":91,"bright yellow":93,pending:36,suite:0,"error title":0,"error message":31,"error stack":90,checkmark:32,fast:90,medium:33,slow:31,green:32,light:90,"diff gutter":90,"diff added":42,"diff removed":41},e.symbols={ok:"✓",err:"✖",dot:"․"},"win32"==i.platform&&(e.symbols.ok="√",e.symbols.err="×",e.symbols.dot=".");var w=e.color=function(t,n){return e.useColors?"["+e.colors[t]+"m"+n+"":n};e.window={width:y?i.stdout.getWindowSize?i.stdout.getWindowSize(1)[0]:h.getWindowSize()[1]:75},e.cursor={hide:function(){y&&i.stdout.write("[?25l")},show:function(){y&&i.stdout.write("[?25h")},deleteLine:function(){y&&i.stdout.write("")},beginningOfLine:function(){y&&i.stdout.write("")},CR:function(){y?(e.cursor.deleteLine(),e.cursor.beginningOfLine()):i.stdout.write("\r")}},e.list=function(t){console.error(),t.forEach(function(t,n){var r=w("error title"," %s) %s:\n")+w("error message"," %s")+w("error stack","\n%s\n"),o=t.err,i=o.message||"",s=o.stack||i,l=s.indexOf(i)+i.length,c=s.slice(0,l),f=o.actual,h=o.expected,d=!0;if(o.uncaught&&(c="Uncaught "+c),o.showDiff&&p(f,h)&&(d=!1,o.actual=f=m.stringify(f),o.expected=h=m.stringify(h)),o.showDiff&&"string"==typeof f&&"string"==typeof h){r=w("error title"," %s) %s:\n%s")+w("error stack","\n%s\n");var g=i.match(/^([^:]+): expected/);c="\n "+w("error message",g?g[1]:c),c+=e.inlineDiffs?a(o,d):u(o,d)}s=s.slice(l?l+1:l).replace(/^/gm," "),console.error(r,n+1,t.fullTitle(),c,s)})},o.prototype.epilogue=function(){var t,e=this.stats;console.log(),t=w("bright pass"," ")+w("green"," %d passing")+w("light"," (%s)"),console.log(t,e.passes||0,g(e.duration)),e.pending&&(t=w("pending"," ")+w("pending"," %d pending"),console.log(t,e.pending)),e.failures&&(t=w("fail"," %d failing"),console.error(t,e.failures),o.list(this.failures),console.error()),console.log()}}),t.register("reporters/doc.js",function(t,e,n){function r(t){function e(){return Array(n).join(" ")}o.call(this,t);var n=(this.stats,t.total,2);t.on("suite",function(t){t.root||(++n,console.log('%s
    ',e()),++n,console.log("%s

    %s

    ",e(),i.escape(t.title)),console.log("%s
    ",e()))}),t.on("suite end",function(t){t.root||(console.log("%s
    ",e()),--n,console.log("%s
    ",e()),--n)}),t.on("pass",function(t){console.log("%s
    %s
    ",e(),i.escape(t.title));var n=i.escape(i.clean(t.fn.toString()));console.log("%s
    %s
    ",e(),n)}),t.on("fail",function(t,n){console.log('%s
    %s
    ',e(),i.escape(t.title));var r=i.escape(i.clean(t.fn.toString()));console.log('%s
    %s
    ',e(),r),console.log('%s
    %s
    ',e(),i.escape(n))})}var o=n("./base"),i=n("../utils");e=t.exports=r}),t.register("reporters/dot.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,.75*s.window.width|0),r=-1;t.on("start",function(){i.stdout.write("\n ")}),t.on("pending",function(){++r%n==0&&i.stdout.write("\n "),i.stdout.write(a("pending",s.symbols.dot))}),t.on("pass",function(t){++r%n==0&&i.stdout.write("\n "),i.stdout.write("slow"==t.speed?a("bright yellow",s.symbols.dot):a(t.speed,s.symbols.dot))}),t.on("fail",function(){++r%n==0&&i.stdout.write("\n "),i.stdout.write(a("fail",s.symbols.dot))}),t.on("end",function(){console.log(),e.epilogue()})}function o(){}var s=n("./base"),a=s.color;e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/html-cov.js",function(t,e,n){function r(t){var e=n("jade"),r=__dirname+"/templates/coverage.jade",u=a.readFileSync(r,"utf8"),l=e.compile(u,{filename:r}),c=this;s.call(this,t,!1),t.on("end",function(){i.stdout.write(l({cov:c.cov,coverageClass:o}))})}function o(t){return t>=75?"high":t>=50?"medium":t>=25?"low":"terrible"}var s=n("./json-cov"),a=n("browser/fs");e=t.exports=r}),t.register("reporters/html.js",function(t,e,r){function o(t){f.call(this,t);var e,n,r=this,o=this.stats,v=(t.total,s(m)),y=v.getElementsByTagName("li"),w=y[1].getElementsByTagName("em")[0],b=y[1].getElementsByTagName("a")[0],x=y[2].getElementsByTagName("em")[0],T=y[2].getElementsByTagName("a")[0],k=y[3].getElementsByTagName("em")[0],E=v.getElementsByTagName("canvas")[0],j=s('
      '),_=[j],C=document.getElementById("mocha");if(E.getContext){var S=window.devicePixelRatio||1;E.style.width=E.width,E.style.height=E.height,E.width*=S,E.height*=S,n=E.getContext("2d"),n.scale(S,S),e=new h}return C?(c(b,"click",function(){u();var t=/pass/.test(j.className)?"":" pass";j.className=j.className.replace(/fail|pass/g,"")+t,j.className.trim()&&a("test pass")}),c(T,"click",function(){u();var t=/fail/.test(j.className)?"":" fail";j.className=j.className.replace(/fail|pass/g,"")+t,j.className.trim()&&a("test fail")}),C.appendChild(v),C.appendChild(j),e&&e.size(40),t.on("suite",function(t){if(!t.root){var e=r.suiteURL(t),n=s('
    • %s

    • ',e,d(t.title));_[0].appendChild(n),_.unshift(document.createElement("ul")),n.appendChild(_[0])}}),t.on("suite end",function(t){t.root||_.shift()}),t.on("fail",function(e){"hook"==e.type&&t.emit("test end",e)}),void t.on("test end",function(t){var i=o.tests/this.total*100|0;e&&e.update(i).draw(n);var a=new g-o.start;if(l(w,o.passes),l(x,o.failures),l(k,(a/1e3).toFixed(2)),"passed"==t.state)var u=r.testURL(t),f=s('
    • %e%ems

    • ',t.speed,t.title,t.duration,u);else if(t.pending)var f=s('
    • %e

    • ',t.title);else{var f=s('
    • %e

    • ',t.title,encodeURIComponent(t.fullTitle())),h=t.err.stack||t.err.toString();~h.indexOf(t.err.message)||(h=t.err.message+"\n"+h),"[object Error]"==h&&(h=t.err.message),!t.err.stack&&t.err.sourceURL&&void 0!==t.err.line&&(h+="\n("+t.err.sourceURL+":"+t.err.line+")"),f.appendChild(s('
      %e
      ',h))}if(!t.pending){var d=f.getElementsByTagName("h2")[0];c(d,"click",function(){m.style.display="none"==m.style.display?"block":"none"});var m=s("
      %e
      ",p.clean(t.fn.toString()));f.appendChild(m),m.style.display="none"}_[0]&&_[0].appendChild(f)})):i("#mocha div missing, add it to your document")}function i(t){document.body.appendChild(s('
      %s
      ',t))}function s(t){var e=arguments,n=document.createElement("div"),r=1;return n.innerHTML=t.replace(/%([se])/g,function(t,n){switch(n){case"s":return String(e[r++]);case"e":return d(e[r++])}}),n.firstChild}function a(t){for(var e=document.getElementsByClassName("suite"),n=0;n0&&(e.coverage=e.hits/e.sloc*100),e}function a(t,e){var n={filename:t,coverage:0,hits:0,misses:0,sloc:0,source:{}};return e.source.forEach(function(t,r){r++,0===e[r]?(n.misses++,n.sloc++):void 0!==e[r]&&(n.hits++,n.sloc++),n.source[r]={source:t,coverage:void 0===e[r]?"":e[r]}}),n.coverage=n.hits/n.sloc*100,n}function u(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration}}var l=r("./base");e=t.exports=o}),t.register("reporters/json-stream.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,t.total);t.on("start",function(){console.log(JSON.stringify(["start",{total:n}]))}),t.on("pass",function(t){console.log(JSON.stringify(["pass",o(t)]))}),t.on("fail",function(t,e){t=o(t),t.err=e.message,console.log(JSON.stringify(["fail",t]))}),t.on("end",function(){i.stdout.write(JSON.stringify(["end",e.stats]))})}function o(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration}}{var s=n("./base");s.color}e=t.exports=r}),t.register("reporters/json.js",function(t,e,n){function r(t){var e=this;a.call(this,t);var n=[],r=[],s=[],u=[];t.on("test end",function(t){n.push(t)}),t.on("pass",function(t){u.push(t)}),t.on("fail",function(t){s.push(t)}),t.on("pending",function(t){r.push(t)}),t.on("end",function(){var a={stats:e.stats,tests:n.map(o),pending:r.map(o),failures:s.map(o),passes:u.map(o)};t.testResults=a,i.stdout.write(JSON.stringify(a,null,2))})}function o(t){return{title:t.title,fullTitle:t.fullTitle(),duration:t.duration,err:s(t.err||{})}}function s(t){var e={};return Object.getOwnPropertyNames(t).forEach(function(n){e[n]=t[n]},t),e}{var a=n("./base");a.cursor,a.color}e=t.exports=r}),t.register("reporters/landing.js",function(t,e,n){function r(t){function e(){var t=Array(r).join("-");return" "+u("runway",t)}s.call(this,t);var n=this,r=(this.stats,.75*s.window.width|0),o=t.total,l=i.stdout,c=u("plane","✈"),f=-1,p=0;t.on("start",function(){l.write("\n\n\n "),a.hide()}),t.on("test end",function(t){var n=-1==f?r*++p/o|0:f;"failed"==t.state&&(c=u("plane crash","✈"),f=n),l.write("["+(r+1)+"D"),l.write(e()),l.write("\n "),l.write(u("runway",Array(n).join("⋅"))),l.write(c),l.write(u("runway",Array(r-n).join("⋅")+"\n")),l.write(e()),l.write("")}),t.on("end",function(){a.show(),console.log(),n.epilogue()})}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,s.colors.plane=0,s.colors["plane crash"]=31,s.colors.runway=90,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/list.js",function(t,e,n){function r(t){s.call(this,t);var e=this,n=(this.stats,0);t.on("start",function(){console.log()}),t.on("test",function(t){i.stdout.write(u("pass"," "+t.fullTitle()+": "))}),t.on("pending",function(t){var e=u("checkmark"," -")+u("pending"," %s");console.log(e,t.fullTitle())}),t.on("pass",function(t){var e=u("checkmark"," "+s.symbols.dot)+u("pass"," %s: ")+u(t.speed,"%dms");a.CR(),console.log(e,t.fullTitle(),t.duration)}),t.on("fail",function(t){a.CR(),console.log(u("fail"," %d) %s"),++n,t.fullTitle())}),t.on("end",e.epilogue.bind(e))}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/markdown.js",function(t,e,n){function r(t){function e(t){return Array(u).join("#")+" "+t}function n(t,e){var r=e;return e=e[t.title]=e[t.title]||{suite:t},t.suites.forEach(function(t){n(t,e)}),r}function r(t,e){++e;var n,o="";for(var i in t)"suite"!=i&&(i&&(n=" - ["+i+"](#"+s.slug(t[i].suite.fullTitle())+")\n"),i&&(o+=Array(e).join(" ")+n),o+=r(t[i],e));return--e,o}function a(t){var e=n(t,{});return r(e,0)}o.call(this,t);var u=(this.stats,0),l="";a(t.suite),t.on("suite",function(t){++u;var n=s.slug(t.fullTitle());l+='\n',l+=e(t.title)+"\n"}),t.on("suite end",function(){--u}),t.on("pass",function(t){var e=s.clean(t.fn.toString());l+=t.title+".\n",l+="\n```js\n",l+=e+"\n",l+="```\n\n"}),t.on("end",function(){i.stdout.write("# TOC\n"),i.stdout.write(a(t.suite)),i.stdout.write(l) +})}var o=n("./base"),s=n("../utils");e=t.exports=r}),t.register("reporters/min.js",function(t,e,n){function r(t){s.call(this,t),t.on("start",function(){i.stdout.write(""),i.stdout.write("")}),t.on("end",this.epilogue.bind(this))}function o(){}var s=n("./base");e=t.exports=r,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/nyan.js",function(t,e,n){function r(t){a.call(this,t);{var e=this,n=(this.stats,.75*a.window.width|0),r=(this.rainbowColors=e.generateColors(),this.colorIndex=0,this.numberOfLines=4,this.trajectories=[[],[],[],[]],this.nyanCatWidth=11);this.trajectoryWidthMax=n-r,this.scoreboardWidth=5,this.tick=0}t.on("start",function(){a.cursor.hide(),e.draw()}),t.on("pending",function(){e.draw()}),t.on("pass",function(){e.draw()}),t.on("fail",function(){e.draw()}),t.on("end",function(){a.cursor.show();for(var t=0;t=this.trajectoryWidthMax&&r.shift(),r.push(e)}},r.prototype.drawRainbow=function(){var t=this;this.trajectories.forEach(function(e){o("["+t.scoreboardWidth+"C"),o(e.join("")),o("\n")}),this.cursorUp(this.numberOfLines)},r.prototype.drawNyanCat=function(){var t=this,e=this.scoreboardWidth+this.trajectories[0].length,n="["+e+"C",r="";o(n),o("_,------,"),o("\n"),o(n),r=t.tick?" ":" ",o("_|"+r+"/\\_/\\ "),o("\n"),o(n),r=t.tick?"_":"__";var i=t.tick?"~":"^";o(i+"|"+r+this.face()+" "),o("\n"),o(n),r=t.tick?" ":" ",o(r+'"" "" '),o("\n"),this.cursorUp(this.numberOfLines)},r.prototype.face=function(){var t=this.stats;return t.failures?"( x .x)":t.pending?"( o .o)":t.passes?"( ^ .^)":"( - .-)"},r.prototype.cursorUp=function(t){o("["+t+"A")},r.prototype.cursorDown=function(t){o("["+t+"B")},r.prototype.generateColors=function(){for(var t=[],e=0;42>e;e++){var n=Math.floor(Math.PI/3),r=e*(1/6),o=Math.floor(3*Math.sin(r)+3),i=Math.floor(3*Math.sin(r+2*n)+3),s=Math.floor(3*Math.sin(r+4*n)+3);t.push(36*o+6*i+s+16)}return t},r.prototype.rainbowify=function(t){var e=this.rainbowColors[this.colorIndex%this.rainbowColors.length];return this.colorIndex+=1,"[38;5;"+e+"m"+t+""},s.prototype=a.prototype,r.prototype=new s,r.prototype.constructor=r}),t.register("reporters/progress.js",function(t,e,n){function r(t,e){s.call(this,t);var n=this,e=e||{},r=(this.stats,.5*s.window.width|0),o=t.total,l=0,c=(Math.max,-1);e.open=e.open||"[",e.complete=e.complete||"▬",e.incomplete=e.incomplete||s.symbols.dot,e.close=e.close||"]",e.verbose=!1,t.on("start",function(){console.log(),a.hide()}),t.on("test end",function(){l++;var t=l/o,n=r*t|0,s=r-n;(c!==n||e.verbose)&&(c=n,a.CR(),i.stdout.write(""),i.stdout.write(u("progress"," "+e.open)),i.stdout.write(Array(n).join(e.complete)),i.stdout.write(Array(s).join(e.incomplete)),i.stdout.write(u("progress",e.close)),e.verbose&&i.stdout.write(u("progress"," "+l+" of "+o)))}),t.on("end",function(){a.show(),console.log(),n.epilogue()})}function o(){}var s=n("./base"),a=s.cursor,u=s.color;e=t.exports=r,s.colors.progress=90,o.prototype=s.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/spec.js",function(t,e,n){function r(t){function e(){return Array(r).join(" ")}i.call(this,t);var n=this,r=(this.stats,0),o=0;t.on("start",function(){console.log()}),t.on("suite",function(t){++r,console.log(a("suite","%s%s"),e(),t.title)}),t.on("suite end",function(){--r,1==r&&console.log()}),t.on("pending",function(t){var n=e()+a("pending"," - %s");console.log(n,t.title)}),t.on("pass",function(t){if("fast"==t.speed){var n=e()+a("checkmark"," "+i.symbols.ok)+a("pass"," %s ");s.CR(),console.log(n,t.title)}else{var n=e()+a("checkmark"," "+i.symbols.ok)+a("pass"," %s ")+a(t.speed,"(%dms)");s.CR(),console.log(n,t.title,t.duration)}}),t.on("fail",function(t){s.CR(),console.log(e()+a("fail"," %d) %s"),++o,t.title)}),t.on("end",n.epilogue.bind(n))}function o(){}var i=n("./base"),s=i.cursor,a=i.color;e=t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("reporters/tap.js",function(t,e,n){function r(t){i.call(this,t);var e=(this.stats,1),n=0,r=0;t.on("start",function(){var e=t.grepTotal(t.suite);console.log("%d..%d",1,e)}),t.on("test end",function(){++e}),t.on("pending",function(t){console.log("ok %d %s # SKIP -",e,o(t))}),t.on("pass",function(t){n++,console.log("ok %d %s",e,o(t))}),t.on("fail",function(t,n){r++,console.log("not ok %d %s",e,o(t)),n.stack&&console.log(n.stack.replace(/^/gm," "))}),t.on("end",function(){console.log("# tests "+(n+r)),console.log("# pass "+n),console.log("# fail "+r)})}function o(t){return t.fullTitle().replace(/#/g,"")}{var i=n("./base");i.cursor,i.color}e=t.exports=r}),t.register("reporters/xunit.js",function(t,e,r){function o(t){l.call(this,t);var e=this.stats,n=[];t.on("pending",function(t){n.push(t)}),t.on("pass",function(t){n.push(t)}),t.on("fail",function(t){n.push(t)}),t.on("end",function(){console.log(a("testsuite",{name:"Mocha Tests",tests:e.tests,failures:e.failures,errors:e.failures,skipped:e.tests-e.failures-e.passes,timestamp:(new p).toUTCString(),time:e.duration/1e3||0},!1)),n.forEach(s),console.log("")})}function i(){}function s(t){var e={classname:t.parent.fullTitle(),name:t.title,time:t.duration/1e3||0};if("failed"==t.state){var n=t.err;console.log(a("testcase",e,!1,a("failure",{},!1,u(f(n.message)+"\n"+n.stack))))}else console.log(t.pending?a("testcase",e,!1,a("skipped",{},!0)):a("testcase",e,!0))}function a(t,e,n,r){var o,i=n?"/>":">",s=[];for(var a in e)s.push(a+'="'+f(e[a])+'"');return o="<"+t+(s.length?" "+s.join(" "):"")+i,r&&(o+=r+""}{var l=r("./base"),c=r("../utils"),f=c.escape,p=n.Date;n.setTimeout,n.setInterval,n.clearTimeout,n.clearInterval}e=t.exports=o,i.prototype=l.prototype,o.prototype=new i,o.prototype.constructor=o}),t.register("runnable.js",function(t,e,r){function o(t,e){this.title=t,this.fn=e,this.async=e&&e.length,this.sync=!this.async,this._timeout=2e3,this._slow=75,this._enableTimeouts=!0,this.timedOut=!1,this._trace=new Error("done() called multiple times")}function i(){}var s=r("browser/events").EventEmitter,a=r("browser/debug")("mocha:runnable"),u=r("./ms"),l=n.Date,c=n.setTimeout,f=(n.setInterval,n.clearTimeout),p=(n.clearInterval,Object.prototype.toString);t.exports=o,i.prototype=s.prototype,o.prototype=new i,o.prototype.constructor=o,o.prototype.timeout=function(t){return 0==arguments.length?this._timeout:(0===t&&(this._enableTimeouts=!1),"string"==typeof t&&(t=u(t)),a("timeout %d",t),this._timeout=t,this.timer&&this.resetTimeout(),this)},o.prototype.slow=function(t){return 0===arguments.length?this._slow:("string"==typeof t&&(t=u(t)),a("timeout %d",t),this._slow=t,this)},o.prototype.enableTimeouts=function(t){return 0===arguments.length?this._enableTimeouts:(a("enableTimeouts %s",t),this._enableTimeouts=t,this)},o.prototype.fullTitle=function(){return this.parent.fullTitle()+" "+this.title},o.prototype.clearTimeout=function(){f(this.timer)},o.prototype.inspect=function(){return JSON.stringify(this,function(t,e){return"_"!=t[0]?"parent"==t?"#":"ctx"==t?"#":e:void 0},2)},o.prototype.resetTimeout=function(){var t=this,e=this.timeout()||1e9;this._enableTimeouts&&(this.clearTimeout(),this.timer=c(function(){t._enableTimeouts&&(t.callback(new Error("timeout of "+e+"ms exceeded")),t.timedOut=!0)},e))},o.prototype.globals=function(t){this._allowedGlobals=t},o.prototype.run=function(t){function e(t){i||(i=!0,s.emit("error",t||new Error("done() called multiple times; stacktrace may be inaccurate")))}function n(n){var r=s.timeout();if(!s.timedOut){if(o)return e(n||s._trace);s.clearTimeout(),s.duration=new l-a,o=!0,!n&&s.duration>r&&s._enableTimeouts&&(n=new Error("timeout of "+r+"ms exceeded")),t(n)}}function r(t){var e=t.call(u);e&&"function"==typeof e.then?(s.resetTimeout(),e.then(function(){n()},function(t){n(t||new Error("Promise rejected with no or falsy reason"))})):n()}var o,i,s=this,a=new l,u=this.ctx;if(u&&u.runnable&&u.runnable(this),this.callback=n,this.async){this.resetTimeout();try{this.fn.call(u,function(t){return t instanceof Error||"[object Error]"===p.call(t)?n(t):null!=t?n("[object Object]"===Object.prototype.toString.call(t)?new Error("done() invoked with non-Error: "+JSON.stringify(t)):new Error("done() invoked with non-Error: "+t)):void n()})}catch(t){n(t)}}else{if(this.asyncOnly)return n(new Error("--async-only option in use without declaring `done()`"));try{this.pending?n():r(this.fn)}catch(t){n(t)}}}}),t.register("runner.js",function(t,e,r){function o(t){var e=this;this._globals=[],this._abort=!1,this.suite=t,this.total=t.total(),this.failures=0,this.on("test end",function(t){e.checkGlobals(t)}),this.on("hook end",function(t){e.checkGlobals(t)}),this.grep(/.*/),this.globals(this.globalProps().concat(u()))}function s(){}function a(t,e){return p(e,function(e){if(/^d+/.test(e))return!1;if(n.navigator&&/^getInterface/.test(e))return!1;if(n.navigator&&/^\d+/.test(e))return!1;if(/^mocha-/.test(e))return!1;var r=p(t,function(t){return~t.indexOf("*")?0==e.indexOf(t.split("*")[0]):e==t});return 0==r.length&&(!n.navigator||"onerror"!==e)})}function u(){if("object"==typeof i&&"string"==typeof i.version){var t=i.version.split(".").reduce(function(t,e){return t<<8|e});if(2315>t)return["errno"]}return[]}var l=r("browser/events").EventEmitter,c=r("browser/debug")("mocha:runner"),f=(r("./test"),r("./utils")),p=f.filter,h=(f.keys,["setTimeout","clearTimeout","setInterval","clearInterval","XMLHttpRequest","Date"]);t.exports=o,o.immediately=n.setImmediate||i.nextTick,s.prototype=l.prototype,o.prototype=new s,o.prototype.constructor=o,o.prototype.grep=function(t,e){return c("grep %s",t),this._grep=t,this._invert=e,this.total=this.grepTotal(this.suite),this},o.prototype.grepTotal=function(t){var e=this,n=0;return t.eachTest(function(t){var r=e._grep.test(t.fullTitle());e._invert&&(r=!r),r&&n++}),n},o.prototype.globalProps=function(){for(var t=f.keys(n),e=0;e1?this.fail(t,new Error("global leaks detected: "+e.join(", "))):e.length&&this.fail(t,new Error("global leak detected: "+e[0])))}},o.prototype.fail=function(t,e){++this.failures,t.state="failed","string"==typeof e&&(e=new Error('the string "'+e+'" was thrown, throw an Error :)')),this.emit("fail",t,e)},o.prototype.failHook=function(t,e){this.fail(t,e),this.suite.bail()&&this.emit("end")},o.prototype.hook=function(t,e){function n(t){var o=i[t];return o?s.failures&&r.bail()?e():(s.currentRunnable=o,o.ctx.currentTest=s.test,s.emit("hook",o),o.on("error",function(t){s.failHook(o,t)}),void o.run(function(r){o.removeAllListeners("error");var i=o.error();return i&&s.fail(s.test,i),r?(s.failHook(o,r),e(r)):(s.emit("hook end",o),delete o.ctx.currentTest,void n(++t))})):e()}var r=this.suite,i=r["_"+t],s=this;o.immediately(function(){n(0)})},o.prototype.hooks=function(t,e,n){function r(s){return o.suite=s,s?void o.hook(t,function(t){if(t){var s=o.suite;return o.suite=i,n(t,s)}r(e.pop())}):(o.suite=i,n())}var o=this,i=this.suite;r(e.pop())},o.prototype.hookUp=function(t,e){var n=[this.suite].concat(this.parents()).reverse();this.hooks(t,n,e)},o.prototype.hookDown=function(t,e){var n=[this.suite].concat(this.parents());this.hooks(t,n,e)},o.prototype.parents=function(){for(var t=this.suite,e=[];t=t.parent;)e.push(t);return e},o.prototype.runTest=function(t){var e=this.test,n=this;this.asyncOnly&&(e.asyncOnly=!0);try{e.on("error",function(t){n.fail(e,t)}),e.run(t)}catch(e){t(e)}},o.prototype.runTests=function(t,e){function n(t,r,o){var s=i.suite;i.suite=o?r.parent:r,i.suite?i.hookUp("afterEach",function(t,o){return i.suite=s,t?n(t,o,!0):void e(r)}):(i.suite=s,e(r))}function r(a,u){if(i.failures&&t._bail)return e();if(i._abort)return e();if(a)return n(a,u,!0);if(o=s.shift(),!o)return e();var l=i._grep.test(o.fullTitle());return i._invert&&(l=!l),l?o.pending?(i.emit("pending",o),i.emit("test end",o),r()):(i.emit("test",i.test=o),void i.hookDown("beforeEach",function(t,e){return t?n(t,e,!1):(i.currentRunnable=i.test,void i.runTest(function(t){return o=i.test,t?(i.fail(o,t),i.emit("test end",o),i.hookUp("afterEach",r)):(o.state="passed",i.emit("pass",o),i.emit("test end",o),void i.hookUp("afterEach",r))}))})):r()}var o,i=this,s=t.tests.slice();this.next=r,r()},o.prototype.runSuite=function(t,e){function n(e){if(e)return e==t?r():r(e);if(i._abort)return r();var o=t.suites[s++];return o?void i.runSuite(o,n):r()}function r(n){i.suite=t,i.hook("afterAll",function(){i.emit("suite end",t),e(n)})}var o=this.grepTotal(t),i=this,s=0;return c("run suite %s",t.fullTitle()),o?(this.emit("suite",this.suite=t),void this.hook("beforeAll",function(e){return e?r():void i.runTests(t,n)})):e()},o.prototype.uncaught=function(t){t?c("uncaught exception %s",t!==function(){return this}.call(t)?t:t.message||t):(c("uncaught undefined exception"),t=new Error("Caught undefined error, did you throw without specifying what?")),t.uncaught=!0;var e=this.currentRunnable;if(e){var n=e.state;if(this.fail(e,t),e.clearTimeout(),!n)return"test"==e.type?(this.emit("test end",e),void this.hookUp("afterEach",this.next)):void this.emit("end")}},o.prototype.run=function(t){function e(t){n.uncaught(t)}var n=this,t=t||function(){};return c("start"),this.on("end",function(){c("end"),i.removeListener("uncaughtException",e),t(n.failures)}),this.emit("start"),this.runSuite(this.suite,function(){c("finished running"),n.emit("end")}),i.on("uncaughtException",e),this},o.prototype.abort=function(){c("aborting"),this._abort=!0}}),t.register("suite.js",function(t,e,n){function r(t,e){this.title=t;var n=function(){};n.prototype=e,this.ctx=new n,this.suites=[],this.tests=[],this.pending=!1,this._beforeEach=[],this._beforeAll=[],this._afterEach=[],this._afterAll=[],this.root=!t,this._timeout=2e3,this._enableTimeouts=!0,this._slow=75,this._bail=!1}function o(){}var i=n("browser/events").EventEmitter,s=n("browser/debug")("mocha:suite"),a=n("./ms"),u=n("./utils"),l=n("./hook");e=t.exports=r,e.create=function(t,e){var n=new r(e,t.ctx);return n.parent=t,t.pending&&(n.pending=!0),e=n.fullTitle(),t.addSuite(n),n},o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r,r.prototype.clone=function(){var t=new r(this.title);return s("clone"),t.ctx=this.ctx,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.bail(this.bail()),t},r.prototype.timeout=function(t){return 0==arguments.length?this._timeout:(0===t&&(this._enableTimeouts=!1),"string"==typeof t&&(t=a(t)),s("timeout %d",t),this._timeout=parseInt(t,10),this)},r.prototype.enableTimeouts=function(t){return 0===arguments.length?this._enableTimeouts:(s("enableTimeouts %s",t),this._enableTimeouts=t,this)},r.prototype.slow=function(t){return 0===arguments.length?this._slow:("string"==typeof t&&(t=a(t)),s("slow %d",t),this._slow=t,this)},r.prototype.bail=function(t){return 0==arguments.length?this._bail:(s("bail %s",t),this._bail=t,this)},r.prototype.beforeAll=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"before all" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._beforeAll.push(n),this.emit("beforeAll",n),this},r.prototype.afterAll=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"after all" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._afterAll.push(n),this.emit("afterAll",n),this},r.prototype.beforeEach=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"before each" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._beforeEach.push(n),this.emit("beforeEach",n),this},r.prototype.afterEach=function(t,e){if(this.pending)return this;"function"==typeof t&&(e=t,t=e.name),t='"after each" hook'+(t?": "+t:"");var n=new l(t,e);return n.parent=this,n.timeout(this.timeout()),n.enableTimeouts(this.enableTimeouts()),n.slow(this.slow()),n.ctx=this.ctx,this._afterEach.push(n),this.emit("afterEach",n),this},r.prototype.addSuite=function(t){return t.parent=this,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.bail(this.bail()),this.suites.push(t),this.emit("suite",t),this},r.prototype.addTest=function(t){return t.parent=this,t.timeout(this.timeout()),t.enableTimeouts(this.enableTimeouts()),t.slow(this.slow()),t.ctx=this.ctx,this.tests.push(t),this.emit("test",t),this},r.prototype.fullTitle=function(){if(this.parent){var t=this.parent.fullTitle();if(t)return t+" "+this.title}return this.title},r.prototype.total=function(){return u.reduce(this.suites,function(t,e){return t+e.total()},0)+this.tests.length},r.prototype.eachTest=function(t){return u.forEach(this.tests,t),u.forEach(this.suites,function(e){e.eachTest(t)}),this}}),t.register("test.js",function(t,e,n){function r(t,e){i.call(this,t,e),this.pending=!e,this.type="test"}function o(){}var i=n("./runnable");t.exports=r,o.prototype=i.prototype,r.prototype=new o,r.prototype.constructor=r}),t.register("utils.js",function(t,e,n){function r(t){return!~p.indexOf(t)}function o(t){return t.replace(//g,">").replace(/\/\/(.*)/gm,'//$1').replace(/('.*?')/gm,'$1').replace(/(\d+\.\d+)/gm,'$1').replace(/(\d+)/gm,'$1').replace(/\bnew[ \t]+(\w+)/gm,'new $1').replace(/\b(function|new|throw|return|var|if|else)\b/gm,'$1')}var i=n("browser/fs"),s=n("browser/path"),a=s.basename,u=i.existsSync||s.existsSync,l=n("browser/glob"),c=s.join,f=n("browser/debug")("mocha:watch"),p=["node_modules",".git"];e.escape=function(t){return String(t).replace(/&/g,"&").replace(/"/g,""").replace(//g,">")},e.forEach=function(t,e,n){for(var r=0,o=t.length;o>r;r++)e.call(n,t[r],r)},e.map=function(t,e,n){for(var r=[],o=0,i=t.length;i>o;o++)r.push(e.call(n,t[o],o));return r},e.indexOf=function(t,e,n){for(var r=n||0,o=t.length;o>r;r++)if(t[r]===e)return r;return-1},e.reduce=function(t,e,n){for(var r=n,o=0,i=t.length;i>o;o++)r=e(r,t[o],o,t);return r},e.filter=function(t,e){for(var n=[],r=0,o=t.length;o>r;r++){var i=t[r];e(i,r,t)&&n.push(i)}return n},e.keys=Object.keys||function(t){var e=[],n=Object.prototype.hasOwnProperty;for(var r in t)n.call(t,r)&&e.push(r);return e},e.watch=function(t,e){var n={interval:100};t.forEach(function(t){f("file %s",t),i.watchFile(t,n,function(n,r){r.mtime *{?/,"").replace(/\s+\}$/,"");var n=t.match(/^\n?( *)/)[1].length,r=t.match(/^\n?(\t*)/)[1].length,o=new RegExp("^\n?"+(r?" ":" ")+"{"+(r?r:n)+"}","gm");return t=t.replace(o,""),e.trim(t)},e.trim=function(t){return t.replace(/^\s+|\s+$/g,"")},e.parseQuery=function(t){return e.reduce(t.replace("?","").split("&"),function(t,e){var n=e.indexOf("="),r=e.slice(0,n),o=e.slice(++n);return t[r]=decodeURIComponent(o),t},{})},e.highlightTags=function(t){for(var e=document.getElementById("mocha").getElementsByTagName(t),n=0,r=e.length;r>n;++n)e[n].innerHTML=o(e[n].innerHTML)},e.stringify=function(t){return t instanceof RegExp?t.toString():JSON.stringify(e.canonicalize(t),null,2).replace(/,(\n|$)/g,"$1")},e.canonicalize=function(t,n){if(n=n||[],-1!==e.indexOf(n,t))return"[Circular]";var r;return"[object Array]"==={}.toString.call(t)?(n.push(t),r=e.map(t,function(t){return e.canonicalize(t,n)}),n.pop()):"object"==typeof t&&null!==t?(n.push(t),r={},e.forEach(e.keys(t).sort(),function(o){r[o]=e.canonicalize(t[o],n)}),n.pop()):r=t,r},e.lookupFiles=function t(e,n,r){var o=[],s=new RegExp("\\.("+n.join("|")+")$");if(!u(e)){if(!u(e+".js")){if(o=l.sync(e),!o.length)throw new Error("cannot resolve path (or pattern) '"+e+"'");return o}e+=".js"}try{var f=i.statSync(e);if(f.isFile())return e}catch(t){return}return i.readdirSync(e).forEach(function(u){u=c(e,u);try{var l=i.statSync(u);if(l.isDirectory())return void(r&&(o=o.concat(t(u,n,r))))}catch(t){return}l.isFile()&&s.test(u)&&"."!==a(u)[0]&&o.push(u)}),o}});var n=function(){return this}(),r=n.Date,o=n.setTimeout,i=(n.setInterval,n.clearTimeout,n.clearInterval,{});i.exit=function(){},i.stdout={};var s=[],a=n.onerror;i.removeListener=function(t,e){if("uncaughtException"==t){n.onerror=a?a:function(){};var r=u.utils.indexOf(s,e);-1!=r&&s.splice(r,1)}},i.on=function(t,e){"uncaughtException"==t&&(n.onerror=function(t,n,r){return e(new Error(t+" ("+n+":"+r+")")),!0},s.push(e))};var u=n.Mocha=t("mocha"),l=n.mocha=new u({reporter:"html"});l.suite.removeAllListeners("pre-require");var c,f=[];u.Runner.immediately=function(t){f.push(t),c||(c=o(e,0))},l.throwError=function(t){throw u.utils.forEach(s,function(e){e(t)}),t},l.ui=function(t){return u.prototype.ui.call(this,t),this.suite.emit("pre-require",n,null,this),this},l.setup=function(t){"string"==typeof t&&(t={ui:t});for(var e in t)this[e](t[e]);return this},l.run=function(t){var e=l.options;l.globals("location");var r=u.utils.parseQuery(n.location.search||"");return r.grep&&l.grep(r.grep),r.invert&&l.invert(),u.prototype.run.call(l,function(r){var o=n.document;o&&o.getElementById("mocha")&&e.noHighlighting!==!0&&u.utils.highlightTags("code"),t&&t(r)})},u.process=i}(); \ No newline at end of file diff --git a/www/js/tests.js b/www/js/tests.js index 2fce6557..919644b5 100644 --- a/www/js/tests.js +++ b/www/js/tests.js @@ -2766,7 +2766,9 @@ function Response(req, options) { options = options || {}; this.req = req; this.xhr = this.req.xhr; - this.text = this.xhr.responseText; + this.text = this.req.method !='HEAD' + ? this.xhr.responseText + : null; this.setStatusProperties(this.xhr.status); this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders()); // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but @@ -2922,16 +2924,18 @@ function Request(method, url) { this.header = {}; this._header = {}; this.on('end', function(){ + var err = null; + var res = null; + try { - var res = new Response(self); - if ('HEAD' == method) res.text = null; - self.callback(null, res); + res = new Response(self); } catch(e) { - var err = new Error('Parser is unable to parse the response'); + err = new Error('Parser is unable to parse the response'); err.parse = true; err.original = e; - self.callback(err); } + + self.callback(err, res); }); } @@ -3278,6 +3282,7 @@ Request.prototype.send = function(data){ Request.prototype.callback = function(err, res){ var fn = this._callback; + this.clearTimeout(); if (2 == fn.length) return fn(err, res); if (err) return this.emit('error', err); fn(res); @@ -4406,24 +4411,26 @@ module.exports={ "license": "MIT", "main": "./index", "name": "akismet-js", - "version": "0.3.2", + "version": "0.3.3", "bin": { "akismet": "./bin/cli.js" }, "dependencies": { - "body-parser": "^1.9.0", - "commander": "^2.3.0", - "express": "^4.9.5", - "superagent": "^0.20.0" + "body-parser": "^1.10.0", + "commander": "^2.5.1", + "cors": "^2.5.2", + "express": "^4.10.6", + "superagent": "^0.21.0" }, "devDependencies": { - "archiver": "^0.11.0", - "browserify": "^6.0.2", - "docgen-js": "^0.1.0", - "jshint": "^2.5.6", - "mocha": "^1.21.4", + "archiver": "^0.13.0", + "browserify": "^7.0.1", + "david": "^5.0.0", + "docgen-js": "^0.0.1", + "jshint": "^2.5.10", + "mocha": "^2.0.1", "shelljs": "^0.3.0", - "uglify-js": "^2.4.15" + "uglify-js": "^2.4.16" }, "engines": { "node": ">=0.10.0" @@ -4910,4 +4917,4 @@ function main() { $(main); },{"../../test/client_test":18,"../../test/comment_test":19}]},{},[20]) -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uXFwuLlxcUHJvZ3JhbSBGaWxlc1xcTm9kZS5qc1xcbm9kZV9tb2R1bGVzXFxicm93c2VyaWZ5XFxub2RlX21vZHVsZXNcXGJyb3dzZXItcGFja1xcX3ByZWx1ZGUuanMiLCIuLlxcLi5cXFByb2dyYW0gRmlsZXNcXE5vZGUuanNcXG5vZGVfbW9kdWxlc1xcYnJvd3NlcmlmeVxcbm9kZV9tb2R1bGVzXFxhc3NlcnRcXGFzc2VydC5qcyIsIi4uXFwuLlxcUHJvZ3JhbSBGaWxlc1xcTm9kZS5qc1xcbm9kZV9tb2R1bGVzXFxicm93c2VyaWZ5XFxub2RlX21vZHVsZXNcXGluaGVyaXRzXFxpbmhlcml0c19icm93c2VyLmpzIiwiLi5cXC4uXFxQcm9ncmFtIEZpbGVzXFxOb2RlLmpzXFxub2RlX21vZHVsZXNcXGJyb3dzZXJpZnlcXG5vZGVfbW9kdWxlc1xccHJvY2Vzc1xcYnJvd3Nlci5qcyIsIi4uXFwuLlxcUHJvZ3JhbSBGaWxlc1xcTm9kZS5qc1xcbm9kZV9tb2R1bGVzXFxicm93c2VyaWZ5XFxub2RlX21vZHVsZXNcXHB1bnljb2RlXFxwdW55Y29kZS5qcyIsIi4uXFwuLlxcUHJvZ3JhbSBGaWxlc1xcTm9kZS5qc1xcbm9kZV9tb2R1bGVzXFxicm93c2VyaWZ5XFxub2RlX21vZHVsZXNcXHF1ZXJ5c3RyaW5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AgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBhdXRvIGpzb25cbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAuc2VuZCh7IG5hbWU6ICd0aicgfSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBtYW51YWwgeC13d3ctZm9ybS11cmxlbmNvZGVkXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2Zvcm0nKVxuICogICAgICAgICAuc2VuZCgnbmFtZT10aicpXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gYXV0byB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnZm9ybScpXG4gKiAgICAgICAgIC5zZW5kKHsgbmFtZTogJ3RqJyB9KVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGRlZmF1bHRzIHRvIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICAqICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gICogICAgICAgIC5zZW5kKCduYW1lPXRvYmknKVxuICAqICAgICAgICAuc2VuZCgnc3BlY2llcz1mZXJyZXQnKVxuICAqICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqIEBwYXJhbSB7U3RyaW5nfE9iamVjdH0gZGF0YVxuICogQHJldHVybiB7UmVxdWVzdH0gZm9yIGNoYWluaW5nXG4gKiBAYXBpIHB1YmxpY1xuICovXG5cblJlcXVlc3QucHJvdG90eXBlLnNlbmQgPSBmdW5jdGlvbihkYXRhKXtcbiAgdmFyIG9iaiA9IGlzT2JqZWN0KGRhdGEpO1xuICB2YXIgdHlwZSA9IHRoaXMuZ2V0SGVhZGVyKCdDb250ZW50LVR5c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kge1xuICAgICAgICAgICAgdmFyIHZhbGlkUGFydHMgPSBob3N0cGFydHMuc2xpY2UoMCwgaSk7XG4gICAgICAgICAgICB2YXIgbm90SG9zdCA9IGhvc3RwYXJ0cy5zbGljZShpICsgMSk7XG4gICAgICAgICAgICB2YXIgYml0ID0gcGFydC5tYXRjaChob3N0bmFtZVBhcnRTdGFydCk7XG4gICAgICAgICAgICBpZiAoYml0KSB7XG4gICAgICAgICAgICAgIHZhbGlkUGFydHMucHVzaChiaXRbMV0pO1xuICAgICAgICAgICAgICBub3RIb3N0LnVuc2hpZnQoYml0WzJdKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChub3RIb3N0Lmxlbmd0aCkge1xuICAgICAgICAgICAgICByZXN0ID0gJy8nICsgbm90SG9zdC5qb2luKCcuJykgKyByZXN0O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdGhpcy5ob3N0bmFtZSA9IHZhbGlkUGFydHMuam9pbignLicpO1xuICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgaWYgKHRoaXMuaG9zdG5hbWUubGVuZ3RoID4gaG9zdG5hbWVNYXhMZW4pIHtcbiAgICAgIHRoaXMuaG9zdG5hbWUgPSAnJztcbiAgICB9IGVsc2Uge1xuICAgICAgLy8gaG9zdG5hbWVzIGFyZSBhbHdheXMgbG93ZXIgY2FzZS5cbiAgICAgIHRoaXMuaG9zdG5hbWUgPSB0aGlzLmhvc3RuYW1lLnRvTG93ZXJDYXNlKCk7XG4gICAgfVxuXG4gICAgaWYgKCFpcHY2SG9zdG5hbWUpIHtcbiAgICAgIC8vIElETkEgU3VwcG9ydDogUmV0dXJucyBhIHB1bnkgY29kZWQgcmVwcmVzZW50YXRpb24gb2YgXCJkb21haW5cIi5cbiAgICAgIC8vIEl0IG9ubHkgY29udmVydHMgdGhlIHBhcnQgb2YgdGhlIGRvbWFpbiBuYW1lIHRoYXR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c3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2pzb24nKVxuICogICAgICAgICAuc2VuZCgne1wibmFtZVwiOlwidGpcIn0pXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gYXV0byBqc29uXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnNlbmQoeyBuYW1lOiAndGonIH0pXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gbWFudWFsIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICogICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gKiAgICAgICAgIC50eXBlKCdmb3JtJylcbiAqICAgICAgICAgLnNlbmQoJ25hbWU9dGonKVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGF1dG8geC13d3ctZm9ybS11cmxlbmNvZGVkXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2Zvcm0nKVxuICogICAgICAgICAuc2VuZCh7IG5hbWU6ICd0aicgfSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBkZWZhdWx0cyB0byB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAgKiAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICAqICAgICAgICAuc2VuZCgnbmFtZT10b2JpJylcbiAgKiAgICAgICAgLnNlbmQoJ3NwZWNpZXM9ZmVycmV0JylcbiAgKiAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiBAcGFyYW0ge1N0cmluZ3xPYmplY3R9IGRhdGFcbiAqIEByZXR1cm4ge1JlcXVlc3R9IGZvciBjaGFpbmluZ1xuICogQGFwaSBwdWJsaWNcbiAqL1xuXG5SZXF1ZXN0LnByb3RvdHlwZS5zZW5kID0gZnVuY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GFcIj48L2Rpdj4nKTtcclxuXHJcbiAgICAvLyBSdW4gdGhlIHRlc3RzLlxyXG4gICAgbW9jaGEuc2V0dXAoe1xyXG4gICAgICBjaGVja0xlYWtzOiB0cnVlLFxyXG4gICAgICB1aTogJ2JkZCdcclxuICAgIH0pO1xyXG5cclxuICAgIHdpbmRvdy5wcm9jZXNzPXtcclxuICAgICAgZW52OiB7XHJcbiAgICAgICAgQUtJU01FVF9BUElfS0VZOiBhcGlLZXkudmFsKCksXHJcbiAgICAgICAgQUtJU01FVF9CTE9HOiBibG9nLnZhbCgpLFxyXG4gICAgICAgIEFLSVNNRVRfU0VSVklDRV9VUkw6IHNlcnZpY2VVcmwudmFsKClcclxuICAgICAgfVxyXG4gICAgfTtcclxuXHJcbiAgICByZXF1aXJlKCcuLi8uLi90ZXN0L2NvbW1lbnRfdGVzdCcpO1xyXG4gICAgcmVxdWlyZSgnLi4vLi4vdGVzdC9jbGllbnRfdGVzdCcpO1xyXG4gICAgbW9jaGEucnVuKCk7XHJcbiAgfSk7XHJcbn1cclxuXHJcbi8vIFN0YXJ0IHRoZSBhcHBsaWNhdGlvbi5cclxuJChtYWluKTtcclxuIl19 diff --git a/www/js/tests.min.js b/www/js/tests.min.js index 6fe51c97..b317f40b 100644 --- a/www/js/tests.min.js +++ b/www/js/tests.min.js @@ -1,2 +1,2 @@ -!function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s=0;r--)if(o[r]!=i[r])return!1;for(r=o.length-1;r>=0;r--)if(n=o[r],!a(t[n],e[n]))return!1;return!0}function l(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function h(t,e,n,r){var o;f.isString(n)&&(r=n,n=null);try{e()}catch(t){o=t}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!o&&i(o,n,"Missing expected exception"+r),!t&&l(o,n)&&i(o,n,"Got unwanted exception"+r),t&&o&&n&&!l(o,n)||!t&&o)throw o}var f=t("util/"),p=Array.prototype.slice,m=Object.prototype.hasOwnProperty,d=e.exports=s;d.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=o(this),this.generatedMessage=!0);var e=t.stackStartFunction||i;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,s=e.name,a=r.indexOf("\n"+s);if(a>=0){var u=r.indexOf("\n",a+1);r=r.substring(u+1)}this.stack=r}}},f.inherits(d.AssertionError,Error),d.fail=i,d.ok=s,d.equal=function(t,e,n){t!=e&&i(t,e,n,"==",d.equal)},d.notEqual=function(t,e,n){t==e&&i(t,e,n,"!=",d.notEqual)},d.deepEqual=function(t,e,n){a(t,e)||i(t,e,n,"deepEqual",d.deepEqual)},d.notDeepEqual=function(t,e,n){a(t,e)&&i(t,e,n,"notDeepEqual",d.notDeepEqual)},d.strictEqual=function(t,e,n){t!==e&&i(t,e,n,"===",d.strictEqual)},d.notStrictEqual=function(t,e,n){t===e&&i(t,e,n,"!==",d.notStrictEqual)},d.throws=function(){h.apply(this,[!0].concat(p.call(arguments)))},d.doesNotThrow=function(){h.apply(this,[!1].concat(p.call(arguments)))},d.ifError=function(t){if(t)throw t};var y=Object.keys||function(t){var e=[];for(var n in t)m.call(t,n)&&e.push(n);return e}},{"util/":10}],2:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],3:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.MutationObserver,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};var r=[];if(e){var o=document.createElement("div"),i=new MutationObserver(function(){var t=r.slice();r.length=0,t.forEach(function(t){t()})});return i.observe(o,{attributes:!0}),function(t){r.length||o.setAttribute("yes","no"),r.push(t)}}return n?(window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var n=r.shift();n()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){(function(t){!function(r){function o(t){throw RangeError(J[t])}function i(t,e){for(var n=t.length;n--;)t[n]=e(t[n]);return t}function s(t,e){return i(t.split(q),e).join(".")}function a(t){for(var e,n,r=[],o=0,i=t.length;i>o;)e=t.charCodeAt(o++),e>=55296&&56319>=e&&i>o?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function u(t){return i(t,function(t){var e="";return t>65535&&(t-=65536,e+=M(t>>>10&1023|55296),t=56320|1023&t),e+=M(t)}).join("")}function c(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function l(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function h(t,e,n){var r=0;for(t=n?U(t/A):t>>1,t+=U(t/e);t>I*O>>1;r+=S)t=U(t/I);return U(r+(I+1)*t/(t+j))}function f(t){var e,n,r,i,s,a,l,f,p,m,d=[],y=t.length,g=0,v=x,b=k;for(n=t.lastIndexOf(C),0>n&&(n=0),r=0;n>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),d.push(t.charCodeAt(r));for(i=n>0?n+1:0;y>i;){for(s=g,a=1,l=S;i>=y&&o("invalid-input"),f=c(t.charCodeAt(i++)),(f>=S||f>U((_-g)/a))&&o("overflow"),g+=f*a,p=b>=l?E:l>=b+O?O:l-b,!(p>f);l+=S)m=S-p,a>U(_/m)&&o("overflow"),a*=m;e=d.length+1,b=h(g-s,e,0==s),U(g/e)>_-v&&o("overflow"),v+=U(g/e),g%=e,d.splice(g++,0,v)}return u(d)}function p(t){var e,n,r,i,s,u,c,f,p,m,d,y,g,v,b,w=[];for(t=a(t),y=t.length,e=x,n=0,s=k,u=0;y>u;++u)d=t[u],128>d&&w.push(M(d));for(r=i=w.length,i&&w.push(C);y>r;){for(c=_,u=0;y>u;++u)d=t[u],d>=e&&c>d&&(c=d);for(g=r+1,c-e>U((_-n)/g)&&o("overflow"),n+=(c-e)*g,e=c,u=0;y>u;++u)if(d=t[u],e>d&&++n>_&&o("overflow"),d==e){for(f=n,p=S;m=s>=p?E:p>=s+O?O:p-s,!(m>f);p+=S)b=f-m,v=S-m,w.push(M(l(m+b%v,0))),f=U(b/v);w.push(M(l(f,0))),s=h(n,g,r==i),n=0,++r}++n,++e}return w.join("")}function m(t){return s(t,function(t){return N.test(t)?f(t.slice(4).toLowerCase()):t})}function d(t){return s(t,function(t){return T.test(t)?"xn--"+p(t):t})}var y="object"==typeof n&&n,g="object"==typeof e&&e&&e.exports==y&&e,v="object"==typeof t&&t;(v.global===v||v.window===v)&&(r=v);var b,w,_=2147483647,S=36,E=1,O=26,j=38,A=700,k=72,x=128,C="-",N=/^xn--/,T=/[^ -~]/,q=/\x2E|\u3002|\uFF0E|\uFF61/g,J={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=S-E,U=Math.floor,M=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:a,encode:u},decode:f,encode:p,toASCII:d,toUnicode:m},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return b});else if(y&&!y.nodeType)if(g)g.exports=b;else for(w in b)b.hasOwnProperty(w)&&(y[w]=b[w]);else r.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(t,e){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,o,i){e=e||"&",o=o||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var l=0;c>l;++l){var h,f,p,m,d=t[l].replace(a,"%20"),y=d.indexOf(o);y>=0?(h=d.substr(0,y),f=d.substr(y+1)):(h=d,f=""),p=decodeURIComponent(h),m=decodeURIComponent(f),n(s,p)?r(s[p])?s[p].push(m):s[p]=[s[p],m]:s[p]=m}return s};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],6:[function(t,e){"use strict";function n(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r",'"',"`"," ","\r","\n"," "],y=["{","}","|","\\","^","`"].concat(d),g=["'"].concat(y),v=["%","/","?",";","#"].concat(g),b=["/","?","#"],w=255,_=/^[a-z0-9A-Z_-]{0,63}$/,S=/^([a-z0-9A-Z_-]{0,63})(.*)$/,E={javascript:!0,"javascript:":!0},O={javascript:!0,"javascript:":!0},j={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");r.prototype.parse=function(t,e,n){if(!u(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t;r=r.trim();var o=p.exec(r);if(o){o=o[0];var i=o.toLowerCase();this.protocol=i,r=r.substr(o.length)}if(n||o||r.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===r.substr(0,2);!s||o&&O[o]||(r=r.substr(2),this.slashes=!0)}if(!O[o]&&(s||o&&!j[o])){for(var a=-1,c=0;cl)&&(a=l)}var h,m;m=-1===a?r.lastIndexOf("@"):r.lastIndexOf("@",a),-1!==m&&(h=r.slice(0,m),r=r.slice(m+1),this.auth=decodeURIComponent(h)),a=-1;for(var c=0;cl)&&(a=l)}-1===a&&(a=r.length),this.host=r.slice(0,a),r=r.slice(a),this.parseHost(),this.hostname=this.hostname||"";var d="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!d)for(var y=this.hostname.split(/\./),c=0,k=y.length;k>c;c++){var x=y[c];if(x&&!x.match(_)){for(var C="",N=0,T=x.length;T>N;N++)C+=x.charCodeAt(N)>127?"x":x[N];if(!C.match(_)){var q=y.slice(0,c),J=y.slice(c+1),I=x.match(S);I&&(q.push(I[1]),J.unshift(I[2])),J.length&&(r="/"+J.join(".")+r),this.hostname=q.join(".");break}}}if(this.hostname=this.hostname.length>w?"":this.hostname.toLowerCase(),!d){for(var U=this.hostname.split("."),M=[],c=0;cc;c++){var H=g[c],K=encodeURIComponent(H);K===H&&(K=escape(H)),r=r.split(H).join(K)}var L=r.indexOf("#");-1!==L&&(this.hash=r.substr(L),r=r.slice(0,L));var z=r.indexOf("?");if(-1!==z?(this.search=r.substr(z),this.query=r.substr(z+1),e&&(this.query=A.parse(this.query)),r=r.slice(0,z)):e&&(this.search="",this.query={}),r&&(this.pathname=r),j[i]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",R=this.search||"";this.path=P+R}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&c(this.query)&&Object.keys(this.query).length&&(i=A.stringify(this.query));var s=this.search||i&&"?"+i||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||j[e])&&o!==!1?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),e+o+n+s+r},r.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(u(t)){var e=new r;e.parse(t,!1,!0),t=e}var n=new r;if(Object.keys(this).forEach(function(t){n[t]=this[t]},this),n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(e){"protocol"!==e&&(n[e]=t[e])}),j[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n;if(t.protocol&&t.protocol!==n.protocol){if(!j[t.protocol])return Object.keys(t).forEach(function(e){n[e]=t[e]}),n.href=n.format(),n;if(n.protocol=t.protocol,t.host||O[t.protocol])n.pathname=t.pathname;else{for(var o=(t.pathname||"").split("/");o.length&&!(t.host=o.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),n.pathname=o.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var i=n.pathname||"",s=n.search||"";n.path=i+s}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var a=n.pathname&&"/"===n.pathname.charAt(0),c=t.host||t.pathname&&"/"===t.pathname.charAt(0),f=c||a||n.host&&t.pathname,p=f,m=n.pathname&&n.pathname.split("/")||[],o=t.pathname&&t.pathname.split("/")||[],d=n.protocol&&!j[n.protocol];if(d&&(n.hostname="",n.port=null,n.host&&(""===m[0]?m[0]=n.host:m.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===o[0]?o[0]=t.host:o.unshift(t.host)),t.host=null),f=f&&(""===o[0]||""===m[0])),c)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,m=o;else if(o.length)m||(m=[]),m.pop(),m=m.concat(o),n.search=t.search,n.query=t.query;else if(!h(t.search)){if(d){n.hostname=n.host=m.shift();var y=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;y&&(n.auth=y.shift(),n.host=n.hostname=y.shift())}return n.search=t.search,n.query=t.query,l(n.pathname)&&l(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!m.length)return n.pathname=null,n.path=n.search?"/"+n.search:null,n.href=n.format(),n;for(var g=m.slice(-1)[0],v=(n.host||t.host)&&("."===g||".."===g)||""===g,b=0,w=m.length;w>=0;w--)g=m[w],"."==g?m.splice(w,1):".."===g?(m.splice(w,1),b++):b&&(m.splice(w,1),b--);if(!f&&!p)for(;b--;b)m.unshift("..");!f||""===m[0]||m[0]&&"/"===m[0].charAt(0)||m.unshift(""),v&&"/"!==m.join("/").substr(-1)&&m.push("");var _=""===m[0]||m[0]&&"/"===m[0].charAt(0);if(d){n.hostname=n.host=_?"":m.length?m.shift():"";var y=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;y&&(n.auth=y.shift(),n.host=n.hostname=y.shift())}return f=f||n.host&&m.length,f&&!_&&m.unshift(""),m.length?n.pathname=m.join("/"):(n.pathname=null,n.path=null),l(n.pathname)&&l(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=m.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{punycode:4,querystring:7}],9:[function(t,e){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],10:[function(t,e,n){(function(e,r){function o(t,e){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(e)?r.showHidden=e:e&&n._extend(r,e),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=i),u(r,t,r.depth)}function i(t,e){var n=o.styles[e];return n?"["+o.colors[n][0]+"m"+t+"["+o.colors[n][1]+"m":t}function s(t){return t}function a(t){var e={};return t.forEach(function(t){e[t]=!0}),e}function u(t,e,r){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var o=e.inspect(r,t);return b(o)||(o=u(t,o,r)),o}var i=c(t,e);if(i)return i;var s=Object.keys(e),d=a(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),j(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(e);if(0===s.length){if(A(e)){var y=e.name?": "+e.name:"";return t.stylize("[Function"+y+"]","special")}if(S(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(O(e))return t.stylize(Date.prototype.toString.call(e),"date");if(j(e))return l(e)}var g="",v=!1,w=["{","}"];if(m(e)&&(v=!0,w=["[","]"]),A(e)){var _=e.name?": "+e.name:"";g=" [Function"+_+"]"}if(S(e)&&(g=" "+RegExp.prototype.toString.call(e)),O(e)&&(g=" "+Date.prototype.toUTCString.call(e)),j(e)&&(g=" "+l(e)),0===s.length&&(!v||0==e.length))return w[0]+g+w[1];if(0>r)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var E;return E=v?h(t,e,r,d,s):s.map(function(n){return f(t,e,r,d,n,v)}),t.seen.pop(),p(E,g,w)}function c(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return v(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,r,o){for(var i=[],s=0,a=e.length;a>s;++s)i.push(T(e,String(s))?f(t,e,n,r,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(f(t,e,n,r,o,!0))}),i}function f(t,e,n,r,o,i){var s,a,c;if(c=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]},c.get?a=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(a=t.stylize("[Setter]","special")),T(r,o)||(s="["+o+"]"),a||(t.seen.indexOf(c.value)<0?(a=y(n)?u(t,c.value,null):u(t,c.value,n-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),_(s)){if(i&&o.match(/^\d+$/))return a;s=JSON.stringify(""+o),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function p(t,e,n){var r=0,o=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function m(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function y(t){return null===t}function g(t){return null==t}function v(t){return"number"==typeof t}function b(t){return"string"==typeof t}function w(t){return"symbol"==typeof t}function _(t){return void 0===t}function S(t){return E(t)&&"[object RegExp]"===x(t)}function E(t){return"object"==typeof t&&null!==t}function O(t){return E(t)&&"[object Date]"===x(t)}function j(t){return E(t)&&("[object Error]"===x(t)||t instanceof Error)}function A(t){return"function"==typeof t}function k(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function x(t){return Object.prototype.toString.call(t)}function C(t){return 10>t?"0"+t.toString(10):t.toString(10)}function N(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),U[t.getMonth()],e].join(" ")}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var q=/%[sdj%]/g;n.format=function(t){if(!b(t)){for(var e=[],n=0;n=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),a=r[n];i>n;a=r[++n])s+=y(a)||!E(a)?" "+a:" "+o(a);return s},n.deprecate=function(t,o){function i(){if(!s){if(e.throwDeprecation)throw new Error(o);e.traceDeprecation?console.trace(o):console.error(o),s=!0}return t.apply(this,arguments)}if(_(r.process))return function(){return n.deprecate(t,o).apply(this,arguments)};if(e.noDeprecation===!0)return t;var s=!1;return i};var J,I={};n.debuglog=function(t){if(_(J)&&(J=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!I[t])if(new RegExp("\\b"+t+"\\b","i").test(J)){var r=e.pid;I[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else I[t]=function(){};return I[t]},n.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=m,n.isBoolean=d,n.isNull=y,n.isNullOrUndefined=g,n.isNumber=v,n.isString=b,n.isSymbol=w,n.isUndefined=_,n.isRegExp=S,n.isObject=E,n.isDate=O,n.isError=j,n.isFunction=A,n.isPrimitive=k,n.isBuffer=t("./support/isBuffer");var U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",N(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!E(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":9,_process:3,inherits:2}],11:[function(t,e){function n(){}function r(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function o(){if(y.XMLHttpRequest&&("file:"!=y.location.protocol||!y.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1}function i(t){return t===Object(t)}function s(t){if(!i(t))return t;var e=[];for(var n in t)null!=t[n]&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}function a(t){for(var e,n,r={},o=t.split("&"),i=0,s=o.length;s>i;++i)n=o[i],e=n.split("="),r[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return r}function u(t){var e,n,r,o,i=t.split(/\r?\n/),s={};i.pop();for(var a=0,u=i.length;u>a;++a)n=i[a],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),o=g(n.slice(e+1)),s[r]=o;return s}function c(t){return t.split(/ *; */).shift()}function l(t){return d(t.split(/ *; */),function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})}function h(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text=this.xhr.responseText,this.setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text):null}function f(t,e){var n=this;m.call(this),this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){try{var e=new h(n);"HEAD"==t&&(e.text=null),n.callback(null,e)}catch(t){var r=new Error("Parser is unable to parse the response");r.parse=!0,r.original=t,n.callback(r)}})}function p(t,e){return"function"==typeof e?new f("GET",t).end(e):1==arguments.length?new f("GET",t):new f(t,e)}var m=t("emitter"),d=t("reduce"),y="undefined"==typeof window?this:window,g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};p.serializeObject=s,p.parseString=a,p.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},p.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},p.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},h.prototype.get=function(t){return this.header[t.toLowerCase()]},h.prototype.setHeaderProperties=function(){var t=this.header["content-type"]||"";this.type=c(t);var e=l(t);for(var n in e)this[n]=e[n]},h.prototype.parseBody=function(t){var e=p.parse[this.type];return e&&t&&t.length?e(t):null},h.prototype.setStatusProperties=function(t){var e=t/100|0;this.status=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t||1223==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},h.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",o=new Error(r);return o.status=this.status,o.method=e,o.url=n,o},p.Response=h,m(f.prototype),f.prototype.use=function(t){return t(this),this},f.prototype.timeout=function(t){return this._timeout=t,this},f.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},f.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},f.prototype.set=function(t,e){if(i(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},f.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},f.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},f.prototype.type=function(t){return this.set("Content-Type",p.types[t]||t),this},f.prototype.accept=function(t){return this.set("Accept",p.types[t]||t),this},f.prototype.auth=function(t,e){var n=btoa(t+":"+e);return this.set("Authorization","Basic "+n),this},f.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},f.prototype.field=function(t,e){return this._formData||(this._formData=new FormData),this._formData.append(t,e),this},f.prototype.attach=function(t,e,n){return this._formData||(this._formData=new FormData),this._formData.append(t,e,n),this},f.prototype.send=function(t){var e=i(t),n=this.getHeader("Content-Type");if(e&&i(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this.getHeader("Content-Type"),this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+t:t:(this._data||"")+t):this._data=t;return e?(n||this.type("json"),this):this},f.prototype.callback=function(t,e){var n=this._callback;return 2==n.length?n(t,e):t?this.emit("error",t):void n(e)},f.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},f.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype.withCredentials=function(){return this._withCredentials=!0,this},f.prototype.end=function(t){var e=this,i=this.xhr=o(),s=this._query.join("&"),a=this._timeout,u=this._formData||this._data;if(this._callback=t||n,i.onreadystatechange=function(){return 4==i.readyState?0==i.status?e.aborted?e.timeoutError():e.crossDomainError():void e.emit("end"):void 0},i.upload&&(i.upload.onprogress=function(t){t.percent=t.loaded/t.total*100,e.emit("progress",t)}),a&&!this._timer&&(this._timer=setTimeout(function(){e.abort()},a)),s&&(s=p.serializeObject(s),this.url+=~this.url.indexOf("?")?"&"+s:"?"+s),i.open(this.method,this.url,!0),this._withCredentials&&(i.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof u&&!r(u)){var c=p.serialize[this.getHeader("Content-Type")];c&&(u=c(u))}for(var l in this.header)null!=this.header[l]&&i.setRequestHeader(l,this.header[l]);return this.emit("request",this),i.send(u),this},p.Request=f,p.get=function(t,e,n){var r=p("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},p.head=function(t,e,n){var r=p("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},p.del=function(t,e){var n=p("DELETE",t);return e&&n.end(e),n},p.patch=function(t,e,n){var r=p("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},p.post=function(t,e,n){var r=p("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},p.put=function(t,e,n){var r=p("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},e.exports=p},{emitter:12,reduce:13}],12:[function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;or;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],13:[function(t,e){e.exports=function(t,e,n){for(var r=0,o=t.length,i=3==arguments.length?n:t[r++];o>r;)i=e.call(null,i,t[r],++r,t);return i}},{}],14:[function(t,e){(function(n){"use strict";function r(t,e){if(this.charset=null,this.language=null,this.url="string"==typeof t?t:null,"object"==typeof e&&e)for(var n in e){var r=e[n];this.hasOwnProperty(n)&&"undefined"!=typeof r&&(this[n]=r)}}function o(e,i,s){if(this.apiKey=String(e),this.blog=i instanceof r?i:new r(i),this.userAgent=u.format("Node.js/%s | Akismet.js/%s","undefined"!=typeof window?"0.0.0":n.version,t("../package.json").version),this.serviceUrl="https://"+o.DEFAULT_SERVICE,"object"==typeof s&&s)for(var a in s){var c=s[a];this.hasOwnProperty(a)&&"undefined"!=typeof c&&(this[a]=c)}}var i=t("./enums"),s=t("superagent"),a=t("url"),u=t("util");r.fromJSON=function(t){var e;if("string"!=typeof t)e=t;else try{e=JSON.parse(t) -}catch(t){return null}return e&&"object"==typeof e?new r(e.blog,{charset:e.blog_charset,language:e.blog_lang}):null},r.prototype.toJSON=function(t){var e={};return"string"==typeof this.url&&(e.blog=this.url),"string"==typeof this.charset&&(e.blog_charset=this.charset),"string"==typeof this.language&&(e.blog_lang=this.language),JSON.stringify(e,null,t)},r.prototype.toString=function(){return"Blog "+this.toJSON(2)},o.DEFAULT_SERVICE="rest.akismet.com",o.prototype.checkComment=function(t,e){var n=a.parse(this.serviceUrl),r=n.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.CHECK_COMMENT):u.format("%s//%s.%s%s",n.protocol,this.apiKey,n.host,i.EndPoints.CHECK_COMMENT);this._queryService(r,JSON.parse(t.toJSON()),function(t,n){t?e(t,!1):e(null,"true"==n)})},o.prototype.submitHam=function(t,e){var n=a.parse(this.serviceUrl),r=n.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_HAM):u.format("%s//%s.%s%s",n.protocol,this.apiKey,n.host,i.EndPoints.SUBMIT_HAM);this._queryService(r,JSON.parse(t.toJSON()),e)},o.prototype.submitSpam=function(t,e){var n=a.parse(this.serviceUrl),r=n.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_SPAM):u.format("%s//%s.%s%s",n.protocol,this.apiKey,n.host,i.EndPoints.SUBMIT_SPAM);this._queryService(r,JSON.parse(t.toJSON()),e)},o.prototype.toString=function(){return u.format('Client { apiKey: "%s", blog: "%s", serviceUrl: "%s", userAgent: "%s" }',this.apiKey,this.blog.url,this.serviceUrl,this.userAgent)},o.prototype.verifyKey=function(t){var e=a.resolve(this.serviceUrl,i.EndPoints.VERIFY_KEY);this._queryService(e,{},function(e,n){e?t(e,!1):t(null,"valid"==n)})},o.prototype._queryService=function(t,e,n){e.key=this.apiKey,e.blog=this.blog.url,this.blog.charset&&(e.blog_charset=this.blog.charset),this.blog.lang&&(e.blog_lang=this.blog.lang),s.post(t).type("form").set("undefined"!=typeof window?i.HTTPHeaders.X_USER_AGENT:"user-agent",this.userAgent).send(e).end(function(t,e){if(t)n(t,null);else if(e.ok){var r=i.HTTPHeaders.X_AKISMET_DEBUG_HELP;n(r in e.header?new Error(e.header[r]):null,e.text)}else n(new Error(e.error?e.error.toString():e.status),null)})},e.exports={Blog:r,Client:o}}).call(this,t("_process"))},{"../package.json":17,"./enums":16,_process:3,superagent:11,url:8,util:10}],15:[function(t,e){"use strict";function n(t){if(this.email=null,this.ipAddress=null,this.name=null,this.url=null,this.userAgent=null,"object"==typeof t&&t)for(var e in t){var n=t[e];this.hasOwnProperty(e)&&"undefined"!=typeof n&&(this[e]=n)}}function r(t){if(this.author=null,this.content=null,this.permalink=null,this.referrer=null,this.type=null,"object"==typeof t&&t)for(var e in t){var n=t[e];this.hasOwnProperty(e)&&"undefined"!=typeof n&&(this[e]=n)}}var o={COMMENT:"comment",PINGBACK:"pingback",TRACKBACK:"trackback"};n.fromJSON=function(t){var e;if("string"!=typeof t)e=t;else try{e=JSON.parse(t)}catch(t){return null}return e&&"object"==typeof e?new n({name:e.comment_author,email:e.comment_author_email,url:e.comment_author_url,userAgent:e.user_agent,ipAddress:e.user_ip}):null},n.prototype.toJSON=function(t){var e={};return"string"==typeof this.name&&(e.comment_author=this.name),"string"==typeof this.email&&(e.comment_author_email=this.email),"string"==typeof this.url&&(e.comment_author_url=this.url),"string"==typeof this.userAgent&&(e.user_agent=this.userAgent),"string"==typeof this.ipAddress&&(e.user_ip=this.ipAddress),JSON.stringify(e,null,t)},n.prototype.toString=function(){return"Author "+this.toJSON(2)},r.fromJSON=function(t){var e;if("string"!=typeof t)e=t;else try{e=JSON.parse(t)}catch(t){return null}if(!e||"object"!=typeof e)return null;var o=!1;for(var i in e)if("comment_author"==i.substr(0,"comment_author".length)||"user"==i.substr(0,"user".length)){o=!0;break}return new r({author:o?n.fromJSON(e):null,content:e.comment_content,type:e.comment_type,permalink:e.permalink,referrer:e.referrer})},r.prototype.toJSON=function(t){var e={};if(this.author instanceof n){var r=JSON.parse(this.author.toJSON());for(var o in r)e[o]=r[o]}return"string"==typeof this.content&&(e.comment_content=this.content),"string"==typeof this.type&&(e.comment_type=this.type),"string"==typeof this.permalink&&(e.permalink=this.permalink),"string"==typeof this.referrer&&(e.referrer=this.referrer),JSON.stringify(e,null,t)},r.prototype.toString=function(){return"Comment "+this.toJSON(2)},e.exports={Author:n,Comment:r,CommentType:o}},{}],16:[function(t,e){"use strict";var n={CHECK_COMMENT:"/1.1/comment-check",SUBMIT_HAM:"/1.1/submit-ham",SUBMIT_SPAM:"/1.1/submit-spam",VERIFY_KEY:"/1.1/verify-key"},r={X_AKISMET_DEBUG_HELP:"x-akismet-debug-help",X_REQUESTED_WITH:"x-requested-with",X_USER_AGENT:"x-user-agent"};e.exports={EndPoints:n,HTTPHeaders:r}},{}],17:[function(t,e){e.exports={author:"Cédric Belin ",bugs:"https://github.com/cedx/akismet.js/issues",description:"Prevent comment spam using Akismet service.",homepage:"https://github.com/cedx/akismet.js",license:"MIT",main:"./index",name:"akismet-js",version:"0.3.2",bin:{akismet:"./bin/cli.js"},dependencies:{"body-parser":"^1.9.0",commander:"^2.3.0",express:"^4.9.5",superagent:"^0.20.0"},devDependencies:{archiver:"^0.11.0",browserify:"^6.0.2","docgen-js":"^0.1.0",jshint:"^2.5.6",mocha:"^1.21.4",shelljs:"^0.3.0","uglify-js":"^2.4.15"},engines:{node:">=0.10.0"},jshintConfig:{browser:!0,freeze:!0,indent:2,latedef:!0,loopfunc:!0,newcap:!0,node:!0,nonew:!0,quotmark:"single",strict:!0,trailing:!0,undef:!0,unused:!0,globals:{describe:!1,it:!1}},keywords:["akismet","comment","spam","validation"],repository:{type:"git",url:"https://github.com/cedx/akismet.js.git"},scripts:{make:"node bin/make.js",start:"node bin/cli.js",test:"node bin/make.js test"},yuidoc:{logo:"http://dev.belin.io/akismet.js/favicon.ico",name:"Akismet.js",url:"https://www.npmjs.org/package/akismet-js",options:{linkNatives:!0,outdir:"doc/api",paths:"lib",tabtospace:2,theme:"default"}}}},{}],18:[function(t){(function(e){"use strict";var n=t("assert"),r=e.process.env,o=t("../lib/comment").Author,i=t("../lib/client").Blog,s=t("../lib/client").Client,a=t("../lib/comment").Comment,u=t("../lib/comment").CommentType,c={run:function(){var t=this;describe("Blog",function(){describe("fromJSON()",t.testFromJSON),describe("toJSON()",t.testToJSON)})},testFromJSON:function(){it("should return a null reference with a non-object JSON string",function(){n.strictEqual(i.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=i.fromJSON("{}");n.strictEqual(t.charset,null),n.strictEqual(t.language,null),n.strictEqual(t.url,null)}),it("should return an initialized instance with a non-empty JSON object",function(){var t=i.fromJSON('{ "blog": "http://dev.belin.io/akismet.js", "blog_charset": "UTF-8", "blog_lang": "en" }');n.equal(t.charset,"UTF-8"),n.equal(t.language,"en"),n.equal(t.url,"http://dev.belin.io/akismet.js")})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){n.equal((new i).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new i("http://dev.belin.io/akismet.js",{charset:"UTF-8",language:"en"});n.equal(t.toJSON(),'{"blog":"http://dev.belin.io/akismet.js","blog_charset":"UTF-8","blog_lang":"en"}')})}},l={_client:new s(r.AKISMET_API_KEY,r.AKISMET_BLOG,{serviceUrl:"AKISMET_SERVICE_URL"in r?r.AKISMET_SERVICE_URL:"https://"+s.DEFAULT_SERVICE}),_ham:new a({author:new o({ipAddress:"192.168.0.1",name:"Akismet.js",url:"http://dev.belin.io/akismet.js",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71"}),content:"I'm testing out the Service API.",referrer:"https://www.npmjs.org/package/akismet-js",type:u.COMMENT}),_spam:new a({author:new o({ipAddress:"127.0.0.1",name:"viagra-test-123",userAgent:"Spam Bot/6.6.6"}),content:"Spam!",type:u.TRACKBACK}),run:function(){var t=this;describe("Client",function(){this.timeout(1e4),describe("verifyKey()",t.testVerifyKey.bind(t)),describe("submitHam()",t.testSubmitHam.bind(t)),describe("submitSpam()",t.testSubmitSpam.bind(t)),describe("checkComment()",t.testCheckComment.bind(t))})},testCheckComment:function(){var t=this;it("should return `false` for valid comment (e.g. ham)",function(e){t._client.checkComment(t._ham,function(t,r){n.ifError(t),n.strictEqual(r,!1),e()})}),it("should return `true` for invalid comment (e.g. spam)",function(e){t._client.checkComment(t._spam,function(t,r){n.ifError(t),n.strictEqual(r,!0),e()})})},testSubmitHam:function(){var t=this;it("should complete without error",function(e){t._client.submitHam(t._ham,e)})},testSubmitSpam:function(){var t=this;it("should complete without error",function(e){t._client.submitSpam(t._spam,e)})},testVerifyKey:function(){var t=this;it("should return `true` for a valid API key",function(e){t._client.verifyKey(function(t,r){n.ifError(t),n.strictEqual(r,!0),e()})}),it("should return `false` for an invalid API key",function(e){var r=new s("viagra-test-123",t._client.blog,{serviceUrl:t._client.serviceUrl});r.verifyKey(function(t,r){n.ifError(t),n.strictEqual(r,!1),e()})})}};c.run(),l.run()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lib/client":14,"../lib/comment":15,assert:1}],19:[function(t){"use strict";var e=t("assert"),n=t("../lib/comment").Author,r=t("../lib/comment").Comment,o=t("../lib/comment").CommentType,i={run:function(){var t=this;describe("Author",function(){describe("fromJSON()",t.testFromJSON),describe("toJSON()",t.testToJSON)})},testFromJSON:function(){it("should return a null reference with a non-object JSON string",function(){e.strictEqual(n.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=n.fromJSON("{}");e.strictEqual(t.email,null),e.strictEqual(t.url,null)}),it("should return an initialized instance with a non-empty JSON object",function(){var t=n.fromJSON('{ "comment_author_email": "cedric@belin.io", "comment_author_url": "http://belin.io" }');e.equal(t.email,"cedric@belin.io"),e.equal(t.url,"http://belin.io")})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){e.equal((new n).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new n({name:"Cédric Belin",email:"cedric@belin.io",ipAddress:"127.0.0.1",url:"http://belin.io"});e.equal(t.toJSON(),'{"comment_author":"Cédric Belin","comment_author_email":"cedric@belin.io","comment_author_url":"http://belin.io","user_ip":"127.0.0.1"}')})}},s={run:function(){var t=this;describe("Comment",function(){describe("fromJSON()",t.testFromJSON),describe("toJSON()",t.testToJSON)})},testFromJSON:function(){it("should return a null reference with a non-object JSON string",function(){e.strictEqual(r.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=r.fromJSON("{}");e.strictEqual(t.author,null),e.strictEqual(t.content,null),e.strictEqual(t.referrer,null),e.strictEqual(t.type,null)}),it("should return an initialized instance with a non-empty JSON object",function(){var t=r.fromJSON('{ "comment_author": "Cédric Belin", "comment_content": "A user comment.", "comment_type": "trackback", "referrer": "http://belin.io" }');e(t.author instanceof n),e.equal(t.author.name,"Cédric Belin"),e.equal(t.content,"A user comment."),e.equal(t.referrer,"http://belin.io"),e.equal(t.type,o.TRACKBACK)})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){e.equal((new r).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new r({author:new n({name:"Cédric Belin"}),content:"A user comment.",referrer:"http://belin.io",type:o.PINGBACK});e.equal(t.toJSON(),'{"comment_author":"Cédric Belin","comment_content":"A user comment.","comment_type":"pingback","referrer":"http://belin.io"}')})}};i.run(),s.run()},{"../lib/comment":15,assert:1}],20:[function(t){"use strict";function e(){var e="ontouchstart"in document.documentElement||window.navigator.maxTouchPoints||window.navigator.msMaxTouchPoints;e||$('[data-toggle="tooltip"]').tooltip({placement:"auto"}),$("#btn-submit").on("click",function(e){e.preventDefault(),$("#form-unit-tests input").each(function(){var t=$(this);t.val($.trim(t.val()))});var n=$("#blog-url");n.val().length||n.val("http://dev.belin.io/akismet.js");var r=$("#service-url");r.val().length||r.val("http://localhost:3000");var o=$("#api-key");return o.val().length>0?(o.closest(".form-group").removeClass("has-error"),$("main").empty().append('
      '),mocha.setup({checkLeaks:!0,ui:"bdd"}),window.process={env:{AKISMET_API_KEY:o.val(),AKISMET_BLOG:n.val(),AKISMET_SERVICE_URL:r.val()}},t("../../test/comment_test"),t("../../test/client_test"),void mocha.run()):(o.closest(".form-group").addClass("has-error"),o.focus(),void $("#dialog-alert").modal("show"))})}$(e)},{"../../test/client_test":18,"../../test/comment_test":19}]},{},[20]); \ No newline at end of file +!function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};e[s][0].call(l.exports,function(t){var n=e[s][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s=0;r--)if(o[r]!=i[r])return!1;for(r=o.length-1;r>=0;r--)if(n=o[r],!a(t[n],e[n]))return!1;return!0}function l(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function h(t,e,n,r){var o;f.isString(n)&&(r=n,n=null);try{e()}catch(t){o=t}if(r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),t&&!o&&i(o,n,"Missing expected exception"+r),!t&&l(o,n)&&i(o,n,"Got unwanted exception"+r),t&&o&&n&&!l(o,n)||!t&&o)throw o}var f=t("util/"),p=Array.prototype.slice,m=Object.prototype.hasOwnProperty,d=e.exports=s;d.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=o(this),this.generatedMessage=!0);var e=t.stackStartFunction||i;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var r=n.stack,s=e.name,a=r.indexOf("\n"+s);if(a>=0){var u=r.indexOf("\n",a+1);r=r.substring(u+1)}this.stack=r}}},f.inherits(d.AssertionError,Error),d.fail=i,d.ok=s,d.equal=function(t,e,n){t!=e&&i(t,e,n,"==",d.equal)},d.notEqual=function(t,e,n){t==e&&i(t,e,n,"!=",d.notEqual)},d.deepEqual=function(t,e,n){a(t,e)||i(t,e,n,"deepEqual",d.deepEqual)},d.notDeepEqual=function(t,e,n){a(t,e)&&i(t,e,n,"notDeepEqual",d.notDeepEqual)},d.strictEqual=function(t,e,n){t!==e&&i(t,e,n,"===",d.strictEqual)},d.notStrictEqual=function(t,e,n){t===e&&i(t,e,n,"!==",d.notStrictEqual)},d.throws=function(){h.apply(this,[!0].concat(p.call(arguments)))},d.doesNotThrow=function(){h.apply(this,[!1].concat(p.call(arguments)))},d.ifError=function(t){if(t)throw t};var y=Object.keys||function(t){var e=[];for(var n in t)m.call(t,n)&&e.push(n);return e}},{"util/":10}],2:[function(t,e){e.exports="function"==typeof Object.create?function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],3:[function(t,e){function n(){}var r=e.exports={};r.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.MutationObserver,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};var r=[];if(e){var o=document.createElement("div"),i=new MutationObserver(function(){var t=r.slice();r.length=0,t.forEach(function(t){t()})});return i.observe(o,{attributes:!0}),function(t){r.length||o.setAttribute("yes","no"),r.push(t)}}return n?(window.addEventListener("message",function(t){var e=t.source;if((e===window||null===e)&&"process-tick"===t.data&&(t.stopPropagation(),r.length>0)){var n=r.shift();n()}},!0),function(t){r.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}}(),r.title="browser",r.browser=!0,r.env={},r.argv=[],r.on=n,r.addListener=n,r.once=n,r.off=n,r.removeListener=n,r.removeAllListeners=n,r.emit=n,r.binding=function(){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(){throw new Error("process.chdir is not supported")}},{}],4:[function(t,e,n){(function(t){!function(r){function o(t){throw RangeError(J[t])}function i(t,e){for(var n=t.length;n--;)t[n]=e(t[n]);return t}function s(t,e){return i(t.split(q),e).join(".")}function a(t){for(var e,n,r=[],o=0,i=t.length;i>o;)e=t.charCodeAt(o++),e>=55296&&56319>=e&&i>o?(n=t.charCodeAt(o++),56320==(64512&n)?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--)):r.push(e);return r}function u(t){return i(t,function(t){var e="";return t>65535&&(t-=65536,e+=M(t>>>10&1023|55296),t=56320|1023&t),e+=M(t)}).join("")}function c(t){return 10>t-48?t-22:26>t-65?t-65:26>t-97?t-97:S}function l(t,e){return t+22+75*(26>t)-((0!=e)<<5)}function h(t,e,n){var r=0;for(t=n?U(t/A):t>>1,t+=U(t/e);t>I*O>>1;r+=S)t=U(t/I);return U(r+(I+1)*t/(t+j))}function f(t){var e,n,r,i,s,a,l,f,p,m,d=[],y=t.length,g=0,v=x,b=k;for(n=t.lastIndexOf(C),0>n&&(n=0),r=0;n>r;++r)t.charCodeAt(r)>=128&&o("not-basic"),d.push(t.charCodeAt(r));for(i=n>0?n+1:0;y>i;){for(s=g,a=1,l=S;i>=y&&o("invalid-input"),f=c(t.charCodeAt(i++)),(f>=S||f>U((_-g)/a))&&o("overflow"),g+=f*a,p=b>=l?E:l>=b+O?O:l-b,!(p>f);l+=S)m=S-p,a>U(_/m)&&o("overflow"),a*=m;e=d.length+1,b=h(g-s,e,0==s),U(g/e)>_-v&&o("overflow"),v+=U(g/e),g%=e,d.splice(g++,0,v)}return u(d)}function p(t){var e,n,r,i,s,u,c,f,p,m,d,y,g,v,b,w=[];for(t=a(t),y=t.length,e=x,n=0,s=k,u=0;y>u;++u)d=t[u],128>d&&w.push(M(d));for(r=i=w.length,i&&w.push(C);y>r;){for(c=_,u=0;y>u;++u)d=t[u],d>=e&&c>d&&(c=d);for(g=r+1,c-e>U((_-n)/g)&&o("overflow"),n+=(c-e)*g,e=c,u=0;y>u;++u)if(d=t[u],e>d&&++n>_&&o("overflow"),d==e){for(f=n,p=S;m=s>=p?E:p>=s+O?O:p-s,!(m>f);p+=S)b=f-m,v=S-m,w.push(M(l(m+b%v,0))),f=U(b/v);w.push(M(l(f,0))),s=h(n,g,r==i),n=0,++r}++n,++e}return w.join("")}function m(t){return s(t,function(t){return N.test(t)?f(t.slice(4).toLowerCase()):t})}function d(t){return s(t,function(t){return T.test(t)?"xn--"+p(t):t})}var y="object"==typeof n&&n,g="object"==typeof e&&e&&e.exports==y&&e,v="object"==typeof t&&t;(v.global===v||v.window===v)&&(r=v);var b,w,_=2147483647,S=36,E=1,O=26,j=38,A=700,k=72,x=128,C="-",N=/^xn--/,T=/[^ -~]/,q=/\x2E|\u3002|\uFF0E|\uFF61/g,J={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=S-E,U=Math.floor,M=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:a,encode:u},decode:f,encode:p,toASCII:d,toUnicode:m},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return b});else if(y&&!y.nodeType)if(g)g.exports=b;else for(w in b)b.hasOwnProperty(w)&&(y[w]=b[w]);else r.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(t,e){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,o,i){e=e||"&",o=o||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var l=0;c>l;++l){var h,f,p,m,d=t[l].replace(a,"%20"),y=d.indexOf(o);y>=0?(h=d.substr(0,y),f=d.substr(y+1)):(h=d,f=""),p=decodeURIComponent(h),m=decodeURIComponent(f),n(s,p)?r(s[p])?s[p].push(m):s[p]=[s[p],m]:s[p]=m}return s};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],6:[function(t,e){"use strict";function n(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r",'"',"`"," ","\r","\n"," "],y=["{","}","|","\\","^","`"].concat(d),g=["'"].concat(y),v=["%","/","?",";","#"].concat(g),b=["/","?","#"],w=255,_=/^[a-z0-9A-Z_-]{0,63}$/,S=/^([a-z0-9A-Z_-]{0,63})(.*)$/,E={javascript:!0,"javascript:":!0},O={javascript:!0,"javascript:":!0},j={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=t("querystring");r.prototype.parse=function(t,e,n){if(!u(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var r=t;r=r.trim();var o=p.exec(r);if(o){o=o[0];var i=o.toLowerCase();this.protocol=i,r=r.substr(o.length)}if(n||o||r.match(/^\/\/[^@\/]+@[^@\/]+/)){var s="//"===r.substr(0,2);!s||o&&O[o]||(r=r.substr(2),this.slashes=!0)}if(!O[o]&&(s||o&&!j[o])){for(var a=-1,c=0;cl)&&(a=l)}var h,m;m=-1===a?r.lastIndexOf("@"):r.lastIndexOf("@",a),-1!==m&&(h=r.slice(0,m),r=r.slice(m+1),this.auth=decodeURIComponent(h)),a=-1;for(var c=0;cl)&&(a=l)}-1===a&&(a=r.length),this.host=r.slice(0,a),r=r.slice(a),this.parseHost(),this.hostname=this.hostname||"";var d="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!d)for(var y=this.hostname.split(/\./),c=0,k=y.length;k>c;c++){var x=y[c];if(x&&!x.match(_)){for(var C="",N=0,T=x.length;T>N;N++)C+=x.charCodeAt(N)>127?"x":x[N];if(!C.match(_)){var q=y.slice(0,c),J=y.slice(c+1),I=x.match(S);I&&(q.push(I[1]),J.unshift(I[2])),J.length&&(r="/"+J.join(".")+r),this.hostname=q.join(".");break}}}if(this.hostname=this.hostname.length>w?"":this.hostname.toLowerCase(),!d){for(var U=this.hostname.split("."),M=[],c=0;cc;c++){var H=g[c],K=encodeURIComponent(H);K===H&&(K=escape(H)),r=r.split(H).join(K)}var L=r.indexOf("#");-1!==L&&(this.hash=r.substr(L),r=r.slice(0,L));var z=r.indexOf("?");if(-1!==z?(this.search=r.substr(z),this.query=r.substr(z+1),e&&(this.query=A.parse(this.query)),r=r.slice(0,z)):e&&(this.search="",this.query={}),r&&(this.pathname=r),j[i]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",R=this.search||"";this.path=P+R}return this.href=this.format(),this},r.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,i="";this.host?o=t+this.host:this.hostname&&(o=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&c(this.query)&&Object.keys(this.query).length&&(i=A.stringify(this.query));var s=this.search||i&&"?"+i||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||j[e])&&o!==!1?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),e+o+n+s+r},r.prototype.resolve=function(t){return this.resolveObject(o(t,!1,!0)).format()},r.prototype.resolveObject=function(t){if(u(t)){var e=new r;e.parse(t,!1,!0),t=e}var n=new r;if(Object.keys(this).forEach(function(t){n[t]=this[t]},this),n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol)return Object.keys(t).forEach(function(e){"protocol"!==e&&(n[e]=t[e])}),j[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n;if(t.protocol&&t.protocol!==n.protocol){if(!j[t.protocol])return Object.keys(t).forEach(function(e){n[e]=t[e]}),n.href=n.format(),n;if(n.protocol=t.protocol,t.host||O[t.protocol])n.pathname=t.pathname;else{for(var o=(t.pathname||"").split("/");o.length&&!(t.host=o.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),n.pathname=o.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var i=n.pathname||"",s=n.search||"";n.path=i+s}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var a=n.pathname&&"/"===n.pathname.charAt(0),c=t.host||t.pathname&&"/"===t.pathname.charAt(0),f=c||a||n.host&&t.pathname,p=f,m=n.pathname&&n.pathname.split("/")||[],o=t.pathname&&t.pathname.split("/")||[],d=n.protocol&&!j[n.protocol];if(d&&(n.hostname="",n.port=null,n.host&&(""===m[0]?m[0]=n.host:m.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===o[0]?o[0]=t.host:o.unshift(t.host)),t.host=null),f=f&&(""===o[0]||""===m[0])),c)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,m=o;else if(o.length)m||(m=[]),m.pop(),m=m.concat(o),n.search=t.search,n.query=t.query;else if(!h(t.search)){if(d){n.hostname=n.host=m.shift();var y=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;y&&(n.auth=y.shift(),n.host=n.hostname=y.shift())}return n.search=t.search,n.query=t.query,l(n.pathname)&&l(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!m.length)return n.pathname=null,n.path=n.search?"/"+n.search:null,n.href=n.format(),n;for(var g=m.slice(-1)[0],v=(n.host||t.host)&&("."===g||".."===g)||""===g,b=0,w=m.length;w>=0;w--)g=m[w],"."==g?m.splice(w,1):".."===g?(m.splice(w,1),b++):b&&(m.splice(w,1),b--);if(!f&&!p)for(;b--;b)m.unshift("..");!f||""===m[0]||m[0]&&"/"===m[0].charAt(0)||m.unshift(""),v&&"/"!==m.join("/").substr(-1)&&m.push("");var _=""===m[0]||m[0]&&"/"===m[0].charAt(0);if(d){n.hostname=n.host=_?"":m.length?m.shift():"";var y=n.host&&n.host.indexOf("@")>0?n.host.split("@"):!1;y&&(n.auth=y.shift(),n.host=n.hostname=y.shift())}return f=f||n.host&&m.length,f&&!_&&m.unshift(""),m.length?n.pathname=m.join("/"):(n.pathname=null,n.path=null),l(n.pathname)&&l(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var t=this.host,e=m.exec(t);e&&(e=e[0],":"!==e&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{punycode:4,querystring:7}],9:[function(t,e){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],10:[function(t,e,n){(function(e,r){function o(t,e){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(e)?r.showHidden=e:e&&n._extend(r,e),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=i),u(r,t,r.depth)}function i(t,e){var n=o.styles[e];return n?"["+o.colors[n][0]+"m"+t+"["+o.colors[n][1]+"m":t}function s(t){return t}function a(t){var e={};return t.forEach(function(t){e[t]=!0}),e}function u(t,e,r){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var o=e.inspect(r,t);return b(o)||(o=u(t,o,r)),o}var i=c(t,e);if(i)return i;var s=Object.keys(e),d=a(s);if(t.showHidden&&(s=Object.getOwnPropertyNames(e)),j(e)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(e);if(0===s.length){if(A(e)){var y=e.name?": "+e.name:"";return t.stylize("[Function"+y+"]","special")}if(S(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(O(e))return t.stylize(Date.prototype.toString.call(e),"date");if(j(e))return l(e)}var g="",v=!1,w=["{","}"];if(m(e)&&(v=!0,w=["[","]"]),A(e)){var _=e.name?": "+e.name:"";g=" [Function"+_+"]"}if(S(e)&&(g=" "+RegExp.prototype.toString.call(e)),O(e)&&(g=" "+Date.prototype.toUTCString.call(e)),j(e)&&(g=" "+l(e)),0===s.length&&(!v||0==e.length))return w[0]+g+w[1];if(0>r)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var E;return E=v?h(t,e,r,d,s):s.map(function(n){return f(t,e,r,d,n,v)}),t.seen.pop(),p(E,g,w)}function c(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return v(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):y(e)?t.stylize("null","null"):void 0}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,r,o){for(var i=[],s=0,a=e.length;a>s;++s)i.push(T(e,String(s))?f(t,e,n,r,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(f(t,e,n,r,o,!0))}),i}function f(t,e,n,r,o,i){var s,a,c;if(c=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]},c.get?a=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(a=t.stylize("[Setter]","special")),T(r,o)||(s="["+o+"]"),a||(t.seen.indexOf(c.value)<0?(a=y(n)?u(t,c.value,null):u(t,c.value,n-1),a.indexOf("\n")>-1&&(a=i?a.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+a.split("\n").map(function(t){return" "+t}).join("\n"))):a=t.stylize("[Circular]","special")),_(s)){if(i&&o.match(/^\d+$/))return a;s=JSON.stringify(""+o),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=t.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=t.stylize(s,"string"))}return s+": "+a}function p(t,e,n){var r=0,o=t.reduce(function(t,e){return r++,e.indexOf("\n")>=0&&r++,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}function m(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function y(t){return null===t}function g(t){return null==t}function v(t){return"number"==typeof t}function b(t){return"string"==typeof t}function w(t){return"symbol"==typeof t}function _(t){return void 0===t}function S(t){return E(t)&&"[object RegExp]"===x(t)}function E(t){return"object"==typeof t&&null!==t}function O(t){return E(t)&&"[object Date]"===x(t)}function j(t){return E(t)&&("[object Error]"===x(t)||t instanceof Error)}function A(t){return"function"==typeof t}function k(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function x(t){return Object.prototype.toString.call(t)}function C(t){return 10>t?"0"+t.toString(10):t.toString(10)}function N(){var t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":");return[t.getDate(),U[t.getMonth()],e].join(" ")}function T(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var q=/%[sdj%]/g;n.format=function(t){if(!b(t)){for(var e=[],n=0;n=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}}),a=r[n];i>n;a=r[++n])s+=y(a)||!E(a)?" "+a:" "+o(a);return s},n.deprecate=function(t,o){function i(){if(!s){if(e.throwDeprecation)throw new Error(o);e.traceDeprecation?console.trace(o):console.error(o),s=!0}return t.apply(this,arguments)}if(_(r.process))return function(){return n.deprecate(t,o).apply(this,arguments)};if(e.noDeprecation===!0)return t;var s=!1;return i};var J,I={};n.debuglog=function(t){if(_(J)&&(J=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!I[t])if(new RegExp("\\b"+t+"\\b","i").test(J)){var r=e.pid;I[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else I[t]=function(){};return I[t]},n.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=m,n.isBoolean=d,n.isNull=y,n.isNullOrUndefined=g,n.isNumber=v,n.isString=b,n.isSymbol=w,n.isUndefined=_,n.isRegExp=S,n.isObject=E,n.isDate=O,n.isError=j,n.isFunction=A,n.isPrimitive=k,n.isBuffer=t("./support/isBuffer");var U=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",N(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!E(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":9,_process:3,inherits:2}],11:[function(t,e){function n(){}function r(t){var e={}.toString.call(t);switch(e){case"[object File]":case"[object Blob]":case"[object FormData]":return!0;default:return!1}}function o(){if(y.XMLHttpRequest&&("file:"!=y.location.protocol||!y.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}return!1}function i(t){return t===Object(t)}function s(t){if(!i(t))return t;var e=[];for(var n in t)null!=t[n]&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}function a(t){for(var e,n,r={},o=t.split("&"),i=0,s=o.length;s>i;++i)n=o[i],e=n.split("="),r[decodeURIComponent(e[0])]=decodeURIComponent(e[1]);return r}function u(t){var e,n,r,o,i=t.split(/\r?\n/),s={};i.pop();for(var a=0,u=i.length;u>a;++a)n=i[a],e=n.indexOf(":"),r=n.slice(0,e).toLowerCase(),o=g(n.slice(e+1)),s[r]=o;return s}function c(t){return t.split(/ *; */).shift()}function l(t){return d(t.split(/ *; */),function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})}function h(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method?this.xhr.responseText:null,this.setStatusProperties(this.xhr.status),this.header=this.headers=u(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this.setHeaderProperties(this.header),this.body="HEAD"!=this.req.method?this.parseBody(this.text):null}function f(t,e){var n=this;m.call(this),this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",function(){var t=null,e=null;try{e=new h(n)}catch(e){t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=e}n.callback(t,e)})}function p(t,e){return"function"==typeof e?new f("GET",t).end(e):1==arguments.length?new f("GET",t):new f(t,e)}var m=t("emitter"),d=t("reduce"),y="undefined"==typeof window?this:window,g="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};p.serializeObject=s,p.parseString=a,p.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},p.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},p.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},h.prototype.get=function(t){return this.header[t.toLowerCase()]},h.prototype.setHeaderProperties=function(){var t=this.header["content-type"]||"";this.type=c(t);var e=l(t);for(var n in e)this[n]=e[n]},h.prototype.parseBody=function(t){var e=p.parse[this.type];return e&&t&&t.length?e(t):null},h.prototype.setStatusProperties=function(t){var e=t/100|0;this.status=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.clientError=4==e,this.serverError=5==e,this.error=4==e||5==e?this.toError():!1,this.accepted=202==t,this.noContent=204==t||1223==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.notFound=404==t,this.forbidden=403==t},h.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,r="cannot "+e+" "+n+" ("+this.status+")",o=new Error(r);return o.status=this.status,o.method=e,o.url=n,o},p.Response=h,m(f.prototype),f.prototype.use=function(t){return t(this),this},f.prototype.timeout=function(t){return this._timeout=t,this},f.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},f.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},f.prototype.set=function(t,e){if(i(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},f.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},f.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},f.prototype.type=function(t){return this.set("Content-Type",p.types[t]||t),this},f.prototype.accept=function(t){return this.set("Accept",p.types[t]||t),this},f.prototype.auth=function(t,e){var n=btoa(t+":"+e);return this.set("Authorization","Basic "+n),this},f.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},f.prototype.field=function(t,e){return this._formData||(this._formData=new FormData),this._formData.append(t,e),this},f.prototype.attach=function(t,e,n){return this._formData||(this._formData=new FormData),this._formData.append(t,e,n),this},f.prototype.send=function(t){var e=i(t),n=this.getHeader("Content-Type");if(e&&i(this._data))for(var r in t)this._data[r]=t[r];else"string"==typeof t?(n||this.type("form"),n=this.getHeader("Content-Type"),this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+t:t:(this._data||"")+t):this._data=t;return e?(n||this.type("json"),this):this},f.prototype.callback=function(t,e){var n=this._callback;return this.clearTimeout(),2==n.length?n(t,e):t?this.emit("error",t):void n(e)},f.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},f.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},f.prototype.withCredentials=function(){return this._withCredentials=!0,this},f.prototype.end=function(t){var e=this,i=this.xhr=o(),s=this._query.join("&"),a=this._timeout,u=this._formData||this._data;if(this._callback=t||n,i.onreadystatechange=function(){return 4==i.readyState?0==i.status?e.aborted?e.timeoutError():e.crossDomainError():void e.emit("end"):void 0},i.upload&&(i.upload.onprogress=function(t){t.percent=t.loaded/t.total*100,e.emit("progress",t)}),a&&!this._timer&&(this._timer=setTimeout(function(){e.abort()},a)),s&&(s=p.serializeObject(s),this.url+=~this.url.indexOf("?")?"&"+s:"?"+s),i.open(this.method,this.url,!0),this._withCredentials&&(i.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof u&&!r(u)){var c=p.serialize[this.getHeader("Content-Type")];c&&(u=c(u))}for(var l in this.header)null!=this.header[l]&&i.setRequestHeader(l,this.header[l]);return this.emit("request",this),i.send(u),this},p.Request=f,p.get=function(t,e,n){var r=p("GET",t);return"function"==typeof e&&(n=e,e=null),e&&r.query(e),n&&r.end(n),r},p.head=function(t,e,n){var r=p("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},p.del=function(t,e){var n=p("DELETE",t);return e&&n.end(e),n},p.patch=function(t,e,n){var r=p("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},p.post=function(t,e,n){var r=p("POST",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},p.put=function(t,e,n){var r=p("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&r.send(e),n&&r.end(n),r},e.exports=p},{emitter:12,reduce:13}],12:[function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;or;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],13:[function(t,e){e.exports=function(t,e,n){for(var r=0,o=t.length,i=3==arguments.length?n:t[r++];o>r;)i=e.call(null,i,t[r],++r,t);return i}},{}],14:[function(t,e){(function(n){"use strict";function r(t,e){if(this.charset=null,this.language=null,this.url="string"==typeof t?t:null,"object"==typeof e&&e)for(var n in e){var r=e[n];this.hasOwnProperty(n)&&"undefined"!=typeof r&&(this[n]=r)}}function o(e,i,s){if(this.apiKey=String(e),this.blog=i instanceof r?i:new r(i),this.userAgent=u.format("Node.js/%s | Akismet.js/%s","undefined"!=typeof window?"0.0.0":n.version,t("../package.json").version),this.serviceUrl="https://"+o.DEFAULT_SERVICE,"object"==typeof s&&s)for(var a in s){var c=s[a];this.hasOwnProperty(a)&&"undefined"!=typeof c&&(this[a]=c)}}var i=t("./enums"),s=t("superagent"),a=t("url"),u=t("util");r.fromJSON=function(t){var e;if("string"!=typeof t)e=t; +else try{e=JSON.parse(t)}catch(t){return null}return e&&"object"==typeof e?new r(e.blog,{charset:e.blog_charset,language:e.blog_lang}):null},r.prototype.toJSON=function(t){var e={};return"string"==typeof this.url&&(e.blog=this.url),"string"==typeof this.charset&&(e.blog_charset=this.charset),"string"==typeof this.language&&(e.blog_lang=this.language),JSON.stringify(e,null,t)},r.prototype.toString=function(){return"Blog "+this.toJSON(2)},o.DEFAULT_SERVICE="rest.akismet.com",o.prototype.checkComment=function(t,e){var n=a.parse(this.serviceUrl),r=n.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.CHECK_COMMENT):u.format("%s//%s.%s%s",n.protocol,this.apiKey,n.host,i.EndPoints.CHECK_COMMENT);this._queryService(r,JSON.parse(t.toJSON()),function(t,n){t?e(t,!1):e(null,"true"==n)})},o.prototype.submitHam=function(t,e){var n=a.parse(this.serviceUrl),r=n.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_HAM):u.format("%s//%s.%s%s",n.protocol,this.apiKey,n.host,i.EndPoints.SUBMIT_HAM);this._queryService(r,JSON.parse(t.toJSON()),e)},o.prototype.submitSpam=function(t,e){var n=a.parse(this.serviceUrl),r=n.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_SPAM):u.format("%s//%s.%s%s",n.protocol,this.apiKey,n.host,i.EndPoints.SUBMIT_SPAM);this._queryService(r,JSON.parse(t.toJSON()),e)},o.prototype.toString=function(){return u.format('Client { apiKey: "%s", blog: "%s", serviceUrl: "%s", userAgent: "%s" }',this.apiKey,this.blog.url,this.serviceUrl,this.userAgent)},o.prototype.verifyKey=function(t){var e=a.resolve(this.serviceUrl,i.EndPoints.VERIFY_KEY);this._queryService(e,{},function(e,n){e?t(e,!1):t(null,"valid"==n)})},o.prototype._queryService=function(t,e,n){e.key=this.apiKey,e.blog=this.blog.url,this.blog.charset&&(e.blog_charset=this.blog.charset),this.blog.lang&&(e.blog_lang=this.blog.lang),s.post(t).type("form").set("undefined"!=typeof window?i.HTTPHeaders.X_USER_AGENT:"user-agent",this.userAgent).send(e).end(function(t,e){if(t)n(t,null);else if(e.ok){var r=i.HTTPHeaders.X_AKISMET_DEBUG_HELP;n(r in e.header?new Error(e.header[r]):null,e.text)}else n(new Error(e.error?e.error.toString():e.status),null)})},e.exports={Blog:r,Client:o}}).call(this,t("_process"))},{"../package.json":17,"./enums":16,_process:3,superagent:11,url:8,util:10}],15:[function(t,e){"use strict";function n(t){if(this.email=null,this.ipAddress=null,this.name=null,this.url=null,this.userAgent=null,"object"==typeof t&&t)for(var e in t){var n=t[e];this.hasOwnProperty(e)&&"undefined"!=typeof n&&(this[e]=n)}}function r(t){if(this.author=null,this.content=null,this.permalink=null,this.referrer=null,this.type=null,"object"==typeof t&&t)for(var e in t){var n=t[e];this.hasOwnProperty(e)&&"undefined"!=typeof n&&(this[e]=n)}}var o={COMMENT:"comment",PINGBACK:"pingback",TRACKBACK:"trackback"};n.fromJSON=function(t){var e;if("string"!=typeof t)e=t;else try{e=JSON.parse(t)}catch(t){return null}return e&&"object"==typeof e?new n({name:e.comment_author,email:e.comment_author_email,url:e.comment_author_url,userAgent:e.user_agent,ipAddress:e.user_ip}):null},n.prototype.toJSON=function(t){var e={};return"string"==typeof this.name&&(e.comment_author=this.name),"string"==typeof this.email&&(e.comment_author_email=this.email),"string"==typeof this.url&&(e.comment_author_url=this.url),"string"==typeof this.userAgent&&(e.user_agent=this.userAgent),"string"==typeof this.ipAddress&&(e.user_ip=this.ipAddress),JSON.stringify(e,null,t)},n.prototype.toString=function(){return"Author "+this.toJSON(2)},r.fromJSON=function(t){var e;if("string"!=typeof t)e=t;else try{e=JSON.parse(t)}catch(t){return null}if(!e||"object"!=typeof e)return null;var o=!1;for(var i in e)if("comment_author"==i.substr(0,"comment_author".length)||"user"==i.substr(0,"user".length)){o=!0;break}return new r({author:o?n.fromJSON(e):null,content:e.comment_content,type:e.comment_type,permalink:e.permalink,referrer:e.referrer})},r.prototype.toJSON=function(t){var e={};if(this.author instanceof n){var r=JSON.parse(this.author.toJSON());for(var o in r)e[o]=r[o]}return"string"==typeof this.content&&(e.comment_content=this.content),"string"==typeof this.type&&(e.comment_type=this.type),"string"==typeof this.permalink&&(e.permalink=this.permalink),"string"==typeof this.referrer&&(e.referrer=this.referrer),JSON.stringify(e,null,t)},r.prototype.toString=function(){return"Comment "+this.toJSON(2)},e.exports={Author:n,Comment:r,CommentType:o}},{}],16:[function(t,e){"use strict";var n={CHECK_COMMENT:"/1.1/comment-check",SUBMIT_HAM:"/1.1/submit-ham",SUBMIT_SPAM:"/1.1/submit-spam",VERIFY_KEY:"/1.1/verify-key"},r={X_AKISMET_DEBUG_HELP:"x-akismet-debug-help",X_REQUESTED_WITH:"x-requested-with",X_USER_AGENT:"x-user-agent"};e.exports={EndPoints:n,HTTPHeaders:r}},{}],17:[function(t,e){e.exports={author:"Cédric Belin ",bugs:"https://github.com/cedx/akismet.js/issues",description:"Prevent comment spam using Akismet service.",homepage:"https://github.com/cedx/akismet.js",license:"MIT",main:"./index",name:"akismet-js",version:"0.3.3",bin:{akismet:"./bin/cli.js"},dependencies:{"body-parser":"^1.10.0",commander:"^2.5.1",cors:"^2.5.2",express:"^4.10.6",superagent:"^0.21.0"},devDependencies:{archiver:"^0.13.0",browserify:"^7.0.1",david:"^5.0.0","docgen-js":"^0.0.1",jshint:"^2.5.10",mocha:"^2.0.1",shelljs:"^0.3.0","uglify-js":"^2.4.16"},engines:{node:">=0.10.0"},jshintConfig:{browser:!0,freeze:!0,indent:2,latedef:!0,loopfunc:!0,newcap:!0,node:!0,nonew:!0,quotmark:"single",strict:!0,trailing:!0,undef:!0,unused:!0,globals:{describe:!1,it:!1}},keywords:["akismet","comment","spam","validation"],repository:{type:"git",url:"https://github.com/cedx/akismet.js.git"},scripts:{make:"node bin/make.js",start:"node bin/cli.js",test:"node bin/make.js test"},yuidoc:{logo:"http://dev.belin.io/akismet.js/favicon.ico",name:"Akismet.js",url:"https://www.npmjs.org/package/akismet-js",options:{linkNatives:!0,outdir:"doc/api",paths:"lib",tabtospace:2,theme:"default"}}}},{}],18:[function(t){(function(e){"use strict";var n=t("assert"),r=e.process.env,o=t("../lib/comment").Author,i=t("../lib/client").Blog,s=t("../lib/client").Client,a=t("../lib/comment").Comment,u=t("../lib/comment").CommentType,c={run:function(){var t=this;describe("Blog",function(){describe("fromJSON()",t.testFromJSON),describe("toJSON()",t.testToJSON)})},testFromJSON:function(){it("should return a null reference with a non-object JSON string",function(){n.strictEqual(i.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=i.fromJSON("{}");n.strictEqual(t.charset,null),n.strictEqual(t.language,null),n.strictEqual(t.url,null)}),it("should return an initialized instance with a non-empty JSON object",function(){var t=i.fromJSON('{ "blog": "http://dev.belin.io/akismet.js", "blog_charset": "UTF-8", "blog_lang": "en" }');n.equal(t.charset,"UTF-8"),n.equal(t.language,"en"),n.equal(t.url,"http://dev.belin.io/akismet.js")})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){n.equal((new i).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new i("http://dev.belin.io/akismet.js",{charset:"UTF-8",language:"en"});n.equal(t.toJSON(),'{"blog":"http://dev.belin.io/akismet.js","blog_charset":"UTF-8","blog_lang":"en"}')})}},l={_client:new s(r.AKISMET_API_KEY,r.AKISMET_BLOG,{serviceUrl:"AKISMET_SERVICE_URL"in r?r.AKISMET_SERVICE_URL:"https://"+s.DEFAULT_SERVICE}),_ham:new a({author:new o({ipAddress:"192.168.0.1",name:"Akismet.js",url:"http://dev.belin.io/akismet.js",userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71"}),content:"I'm testing out the Service API.",referrer:"https://www.npmjs.org/package/akismet-js",type:u.COMMENT}),_spam:new a({author:new o({ipAddress:"127.0.0.1",name:"viagra-test-123",userAgent:"Spam Bot/6.6.6"}),content:"Spam!",type:u.TRACKBACK}),run:function(){var t=this;describe("Client",function(){this.timeout(1e4),describe("verifyKey()",t.testVerifyKey.bind(t)),describe("submitHam()",t.testSubmitHam.bind(t)),describe("submitSpam()",t.testSubmitSpam.bind(t)),describe("checkComment()",t.testCheckComment.bind(t))})},testCheckComment:function(){var t=this;it("should return `false` for valid comment (e.g. ham)",function(e){t._client.checkComment(t._ham,function(t,r){n.ifError(t),n.strictEqual(r,!1),e()})}),it("should return `true` for invalid comment (e.g. spam)",function(e){t._client.checkComment(t._spam,function(t,r){n.ifError(t),n.strictEqual(r,!0),e()})})},testSubmitHam:function(){var t=this;it("should complete without error",function(e){t._client.submitHam(t._ham,e)})},testSubmitSpam:function(){var t=this;it("should complete without error",function(e){t._client.submitSpam(t._spam,e)})},testVerifyKey:function(){var t=this;it("should return `true` for a valid API key",function(e){t._client.verifyKey(function(t,r){n.ifError(t),n.strictEqual(r,!0),e()})}),it("should return `false` for an invalid API key",function(e){var r=new s("viagra-test-123",t._client.blog,{serviceUrl:t._client.serviceUrl});r.verifyKey(function(t,r){n.ifError(t),n.strictEqual(r,!1),e()})})}};c.run(),l.run()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../lib/client":14,"../lib/comment":15,assert:1}],19:[function(t){"use strict";var e=t("assert"),n=t("../lib/comment").Author,r=t("../lib/comment").Comment,o=t("../lib/comment").CommentType,i={run:function(){var t=this;describe("Author",function(){describe("fromJSON()",t.testFromJSON),describe("toJSON()",t.testToJSON)})},testFromJSON:function(){it("should return a null reference with a non-object JSON string",function(){e.strictEqual(n.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=n.fromJSON("{}");e.strictEqual(t.email,null),e.strictEqual(t.url,null)}),it("should return an initialized instance with a non-empty JSON object",function(){var t=n.fromJSON('{ "comment_author_email": "cedric@belin.io", "comment_author_url": "http://belin.io" }');e.equal(t.email,"cedric@belin.io"),e.equal(t.url,"http://belin.io")})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){e.equal((new n).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new n({name:"Cédric Belin",email:"cedric@belin.io",ipAddress:"127.0.0.1",url:"http://belin.io"});e.equal(t.toJSON(),'{"comment_author":"Cédric Belin","comment_author_email":"cedric@belin.io","comment_author_url":"http://belin.io","user_ip":"127.0.0.1"}')})}},s={run:function(){var t=this;describe("Comment",function(){describe("fromJSON()",t.testFromJSON),describe("toJSON()",t.testToJSON)})},testFromJSON:function(){it("should return a null reference with a non-object JSON string",function(){e.strictEqual(r.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=r.fromJSON("{}");e.strictEqual(t.author,null),e.strictEqual(t.content,null),e.strictEqual(t.referrer,null),e.strictEqual(t.type,null)}),it("should return an initialized instance with a non-empty JSON object",function(){var t=r.fromJSON('{ "comment_author": "Cédric Belin", "comment_content": "A user comment.", "comment_type": "trackback", "referrer": "http://belin.io" }');e(t.author instanceof n),e.equal(t.author.name,"Cédric Belin"),e.equal(t.content,"A user comment."),e.equal(t.referrer,"http://belin.io"),e.equal(t.type,o.TRACKBACK)})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){e.equal((new r).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new r({author:new n({name:"Cédric Belin"}),content:"A user comment.",referrer:"http://belin.io",type:o.PINGBACK});e.equal(t.toJSON(),'{"comment_author":"Cédric Belin","comment_content":"A user comment.","comment_type":"pingback","referrer":"http://belin.io"}')})}};i.run(),s.run()},{"../lib/comment":15,assert:1}],20:[function(t){"use strict";function e(){var e="ontouchstart"in document.documentElement||window.navigator.maxTouchPoints||window.navigator.msMaxTouchPoints;e||$('[data-toggle="tooltip"]').tooltip({placement:"auto"}),$("#btn-submit").on("click",function(e){e.preventDefault(),$("#form-unit-tests input").each(function(){var t=$(this);t.val($.trim(t.val()))});var n=$("#blog-url");n.val().length||n.val("http://dev.belin.io/akismet.js");var r=$("#service-url");r.val().length||r.val("http://localhost:3000");var o=$("#api-key");return o.val().length>0?(o.closest(".form-group").removeClass("has-error"),$("main").empty().append('
      '),mocha.setup({checkLeaks:!0,ui:"bdd"}),window.process={env:{AKISMET_API_KEY:o.val(),AKISMET_BLOG:n.val(),AKISMET_SERVICE_URL:r.val()}},t("../../test/comment_test"),t("../../test/client_test"),void mocha.run()):(o.closest(".form-group").addClass("has-error"),o.focus(),void $("#dialog-alert").modal("show"))})}$(e)},{"../../test/client_test":18,"../../test/comment_test":19}]},{},[20]); \ No newline at end of file