From f0466db9c3e7fc5a9ac24b52093ef18d3e7077ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Belin?= Date: Sun, 5 Apr 2015 03:41:08 +0200 Subject: [PATCH] Refreshed the unit tests --- www/js/tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/js/tests.js b/www/js/tests.js index e6da677e..ba3a96b2 100644 --- a/www/js/tests.js +++ b/www/js/tests.js @@ -1,3 +1,3 @@ -!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;s0?(i.closest(".form-group").removeClass("has-error"),$("main").empty().append('
'),e.env={AKISMET_API_KEY:i.val(),AKISMET_BLOG:r.val(),AKISMET_SERVICE_URL:o.val()},mocha.setup("bdd"),t("../../test/comment_test"),t("../../test/client_test"),void mocha.run()):(i.closest(".form-group").addClass("has-error"),i.focus(),void $("#dialog-alert").modal("show"))})}$(n)}).call(this,t("_process"))},{"../../test/client_test":19,"../../test/comment_test":20,_process:7}],2:[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",n.version.length?n.version:"0.0.0",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(n){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){var e=a.parse(this.serviceUrl),n=e.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.CHECK_COMMENT):u.format("%s//%s.%s%s",e.protocol,this.apiKey,e.host,i.EndPoints.CHECK_COMMENT),r=JSON.parse(t.toJSON());return this._queryService(n,r).then(function(t){return"true"==t})},o.prototype.submitHam=function(t){var e=a.parse(this.serviceUrl),n=e.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_HAM):u.format("%s//%s.%s%s",e.protocol,this.apiKey,e.host,i.EndPoints.SUBMIT_HAM);return this._queryService(n,JSON.parse(t.toJSON()))},o.prototype.submitSpam=function(t){var e=a.parse(this.serviceUrl),n=e.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_SPAM):u.format("%s//%s.%s%s",e.protocol,this.apiKey,e.host,i.EndPoints.SUBMIT_SPAM);return this._queryService(n,JSON.parse(t.toJSON()))},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(){var t=a.resolve(this.serviceUrl,i.EndPoints.VERIFY_KEY);return this._queryService(t,{}).then(function(t){return"valid"==t})},o.prototype._queryService=function(t,e){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);var n=this;return new Promise(function(r,o){s.post(t).type("form").send(e).set("undefined"!=typeof window?i.HTTPHeaders.X_USER_AGENT:"user-agent",n.userAgent).end(function(t,e){if(t||!e.ok)o(new Error(t?t.status:e.status));else{var n=i.HTTPHeaders.X_AKISMET_DEBUG_HELP;n in e.header?o(new Error(e.header[n])):r(e.text)}})})},e.exports={Blog:r,Client:o}}).call(this,t("_process"))},{"../package.json":18,"./enums":4,_process:7,superagent:15,url:12,util:14}],3:[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(r){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(o){return null}if(!e||"object"!=typeof e)return null;var i=!1;for(var s in e)if("comment_author"==s.substr(0,"comment_author".length)||"user"==s.substr(0,"user".length)){i=!0;break}return new r({author:i?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}},{}],4:[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}},{}],5:[function(t,e){function n(t,e){return p.isUndefined(e)?""+e:p.isNumber(e)&&!isFinite(e)?e.toString():p.isFunction(e)||p.isRegExp(e)?e.toString():e}function r(t,e){return p.isString(t)?t.length=0;i--)if(s[i]!=c[i])return!1;for(i=s.length-1;i>=0;i--)if(o=s[i],!a(t[o],e[o]))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;p.isString(n)&&(r=n,n=null);try{e()}catch(s){o=s}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 p=t("util/"),f=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}}},p.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(f.call(arguments)))},d.doesNotThrow=function(){h.apply(this,[!1].concat(f.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/":14}],6:[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}},{}],7:[function(t,e){function n(){if(!s){s=!0;for(var t,e=i.length;e;){t=i,i=[];for(var n=-1;++no;)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+=R(t>>>10&1023|55296),t=56320|1023&t),e+=R(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?I(t/A):t>>1,t+=I(t/e);t>U*E>>1;r+=S)t=I(t/U);return I(r+(U+1)*t/(t+j))}function p(t){var e,n,r,i,s,a,l,p,f,m,d=[],y=t.length,g=0,v=C,b=x;for(n=t.lastIndexOf(k),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"),p=c(t.charCodeAt(i++)),(p>=S||p>I((w-g)/a))&&o("overflow"),g+=p*a,f=b>=l?O:l>=b+E?E:l-b,!(f>p);l+=S)m=S-f,a>I(w/m)&&o("overflow"),a*=m;e=d.length+1,b=h(g-s,e,0==s),I(g/e)>w-v&&o("overflow"),v+=I(g/e),g%=e,d.splice(g++,0,v)}return u(d)}function f(t){var e,n,r,i,s,u,c,p,f,m,d,y,g,v,b,_=[];for(t=a(t),y=t.length,e=C,n=0,s=x,u=0;y>u;++u)d=t[u],128>d&&_.push(R(d));for(r=i=_.length,i&&_.push(k);y>r;){for(c=w,u=0;y>u;++u)d=t[u],d>=e&&c>d&&(c=d);for(g=r+1,c-e>I((w-n)/g)&&o("overflow"),n+=(c-e)*g,e=c,u=0;y>u;++u)if(d=t[u],e>d&&++n>w&&o("overflow"),d==e){for(p=n,f=S;m=s>=f?O:f>=s+E?E:f-s,!(m>p);f+=S)b=p-m,v=S-m,_.push(R(l(m+b%v,0))),p=I(b/v);_.push(R(l(p,0))),s=h(n,g,r==i),n=0,++r}++n,++e}return _.join("")}function m(t){return s(t,function(t){return T.test(t)?p(t.slice(4).toLowerCase()):t})}function d(t){return s(t,function(t){return N.test(t)?"xn--"+f(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,O=1,E=26,j=38,A=700,x=72,C=128,k="-",T=/^xn--/,N=/[^ -~]/,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"},U=S-O,I=Math.floor,R=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:a,encode:u},decode:p,encode:f,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(_ in b)b.hasOwnProperty(_)&&(y[_]=b[_]);else r.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[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,p,f,m,d=t[l].replace(a,"%20"),y=d.indexOf(o);y>=0?(h=d.substr(0,y),p=d.substr(y+1)):(h=d,p=""),f=decodeURIComponent(h),m=decodeURIComponent(p),n(s,f)?r(s[f])?s[f].push(m):s[f]=[s[f],m]:s[f]=m}return s};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],10:[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=["/","?","#"],_=255,w=/^[a-z0-9A-Z_-]{0,63}$/,S=/^([a-z0-9A-Z_-]{0,63})(.*)$/,O={javascript:!0,"javascript:":!0},E={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=f.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&&E[o]||(r=r.substr(2),this.slashes=!0)}if(!E[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,x=y.length;x>c;c++){var C=y[c];if(C&&!C.match(w)){for(var k="",T=0,N=C.length;N>T;T++)k+=C.charCodeAt(T)>127?"x":C[T];if(!k.match(w)){var q=y.slice(0,c),J=y.slice(c+1),U=C.match(S);U&&(q.push(U[1]),J.unshift(U[2])),J.length&&(r="/"+J.join(".")+r),this.hostname=q.join(".");break}}}if(this.hostname=this.hostname.length>_?"":this.hostname.toLowerCase(),!d){for(var I=this.hostname.split("."),R=[],c=0;cc;c++){var D=g[c],B=encodeURIComponent(D);B===D&&(B=escape(D)),r=r.split(D).join(B)}var K=r.indexOf("#");-1!==K&&(this.hash=r.substr(K),r=r.slice(0,K));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 M=this.pathname||"",P=this.search||"";this.path=M+P}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||E[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),p=c||a||n.host&&t.pathname,f=p,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),p=p&&(""===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,_=m.length;_>=0;_--)g=m[_],"."==g?m.splice(_,1):".."===g?(m.splice(_,1),b++):b&&(m.splice(_,1),b--);if(!p&&!f)for(;b--;b)m.unshift("..");!p||""===m[0]||m[0]&&"/"===m[0].charAt(0)||m.unshift(""),v&&"/"!==m.join("/").substr(-1)&&m.push("");var w=""===m[0]||m[0]&&"/"===m[0].charAt(0);if(d){n.hostname=n.host=w?"":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 p=p||n.host&&m.length,p&&!w&&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:8,querystring:11}],13:[function(t,e){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],14:[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),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(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(E(e))return t.stylize(Date.prototype.toString.call(e),"date");if(j(e))return l(e)}var g="",v=!1,_=["{","}"];if(m(e)&&(v=!0,_=["[","]"]),A(e)){var w=e.name?": "+e.name:"";g=" [Function"+w+"]"}if(S(e)&&(g=" "+RegExp.prototype.toString.call(e)),E(e)&&(g=" "+Date.prototype.toUTCString.call(e)),j(e)&&(g=" "+l(e)),0===s.length&&(!v||0==e.length))return _[0]+g+_[1];if(0>r)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var O;return O=v?h(t,e,r,d,s):s.map(function(n){return p(t,e,r,d,n,v)}),t.seen.pop(),f(O,g,_)}function c(t,e){if(w(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(N(e,String(s))?p(t,e,n,r,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(p(t,e,n,r,o,!0))}),i}function p(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")),N(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")),w(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 f(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 _(t){return"symbol"==typeof t}function w(t){return void 0===t}function S(t){return O(t)&&"[object RegExp]"===C(t)}function O(t){return"object"==typeof t&&null!==t}function E(t){return O(t)&&"[object Date]"===C(t)}function j(t){return O(t)&&("[object Error]"===C(t)||t instanceof Error)}function A(t){return"function"==typeof t}function x(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function C(t){return Object.prototype.toString.call(t)}function k(t){return 10>t?"0"+t.toString(10):t.toString(10)}function T(){var t=new Date,e=[k(t.getHours()),k(t.getMinutes()),k(t.getSeconds())].join(":");return[t.getDate(),I[t.getMonth()],e].join(" ")}function N(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(e){return"[Circular]"}default:return t}}),a=r[n];i>n;a=r[++n])s+=y(a)||!O(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(w(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,U={};n.debuglog=function(t){if(w(J)&&(J=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!U[t])if(new RegExp("\\b"+t+"\\b","i").test(J)){var r=e.pid;U[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else U[t]=function(){};return U[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=_,n.isUndefined=w,n.isRegExp=S,n.isObject=O,n.isDate=E,n.isError=j,n.isFunction=A,n.isPrimitive=x,n.isBuffer=t("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",T(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!O(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":13,_process:7,inherits:6}],15:[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(t){return t===Object(t)}function i(t){if(!o(t))return t;var e=[];for(var n in t)null!=t[n]&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}function s(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 a(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=y(n.slice(e+1)),s[r]=o;return s}function u(t){return t.split(/ *; */).shift()}function c(t){return m(t.split(/ *; */),function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})}function l(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=a(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?this.text:this.xhr.response):null}function h(t,e){var n=this;f.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 l(n)}catch(r){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=r,n.callback(t)}if(n.emit("response",e),t)return n.callback(t,e);if(e.status>=200&&e.status<300)return n.callback(t,e);var o=new Error(e.statusText||"Unsuccessful HTTP response");o.original=t,o.response=e,o.status=e.status,n.callback(t||o,e)})}function p(t,e){return"function"==typeof e?new h("GET",t).end(e):1==arguments.length?new h("GET",t):new h(t,e)}var f=t("emitter"),m=t("reduce"),d="undefined"==typeof window?this:window;p.getXHR=function(){if(d.XMLHttpRequest&&("file:"!=d.location.protocol||!d.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};var y="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};p.serializeObject=i,p.parseString=s,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":i,"application/json":JSON.stringify},p.parse={"application/x-www-form-urlencoded":s,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype.setHeaderProperties=function(){var t=this.header["content-type"]||""; -this.type=u(t);var e=c(t);for(var n in e)this[n]=e[n]},l.prototype.parseBody=function(t){var e=p.parse[this.type];return e&&t&&(t.length||t instanceof Object)?e(t):null},l.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},l.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=l,f(h.prototype),h.prototype.use=function(t){return t(this),this},h.prototype.timeout=function(t){return this._timeout=t,this},h.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},h.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},h.prototype.set=function(t,e){if(o(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},h.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},h.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},h.prototype.type=function(t){return this.set("Content-Type",p.types[t]||t),this},h.prototype.accept=function(t){return this.set("Accept",p.types[t]||t),this},h.prototype.auth=function(t,e){var n=btoa(t+":"+e);return this.set("Authorization","Basic "+n),this},h.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},h.prototype.field=function(t,e){return this._formData||(this._formData=new d.FormData),this._formData.append(t,e),this},h.prototype.attach=function(t,e,n){return this._formData||(this._formData=new d.FormData),this._formData.append(t,e,n),this},h.prototype.send=function(t){var e=o(t),n=this.getHeader("Content-Type");if(e&&o(this._data))for(var i in t)this._data[i]=t[i];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||r(t)?this:(n||this.type("json"),this)},h.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},h.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},h.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},h.prototype.withCredentials=function(){return this._withCredentials=!0,this},h.prototype.end=function(t){var e=this,o=this.xhr=p.getXHR(),i=this._query.join("&"),s=this._timeout,a=this._formData||this._data;this._callback=t||n,o.onreadystatechange=function(){if(4==o.readyState){var t;try{t=o.status}catch(n){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};try{o.upload&&this.hasListeners("progress")&&(o.upload.onprogress=function(t){t.percent=t.loaded/t.total*100,e.emit("progress",t)})}catch(u){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),i&&(i=p.serializeObject(i),this.url+=~this.url.indexOf("?")?"&"+i:"?"+i),o.open(this.method,this.url,!0),this._withCredentials&&(o.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof a&&!r(a)){var c=p.serialize[this.getHeader("Content-Type")];c&&(a=c(a))}for(var l in this.header)null!=this.header[l]&&o.setRequestHeader(l,this.header[l]);return this.emit("request",this),o.send(a),this},p.Request=h,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:16,reduce:17}],16:[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}},{}],17:[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}},{}],18:[function(t,e){e.exports={author:"Cédric Belin ",bugs:"https://bitbucket.org/cedx/akismet.js/issues",description:"Prevent comment spam using Akismet service.",homepage:"https://bitbucket.org/cedx/akismet.js",license:"MIT",main:"./index",name:"akismet-js",version:"0.5.1",bin:{akismet:"./bin/cli.js"},dependencies:{"body-parser":"^1.12.2",commander:"^2.7.1",cors:"^2.5.3",express:"^4.12.3",forever:"^0.14.1",superagent:"^1.1.0"},devDependencies:{browserify:"9.0.4",del:"^1.1.1","docgen-js":"^0.0.1",gulp:"^3.8.11","gulp-david":"^0.2.1","gulp-jshint":"^1.10.0","gulp-load-plugins":"^0.9.0","gulp-mocha":"^2.0.1","gulp-sourcemaps":"^1.5.1","gulp-uglify":"^1.1.0","gulp-zip":"^3.0.2","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},engines:{node:">=0.12.0"},jshintConfig:{browser:!0,camelcase:!1,freeze:!0,indent:2,latedef:"nofunc",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://bitbucket.org/cedx/akismet.js.git"},scripts:{start:"forever start -c node -e var/stderr.log -o var/stdout.log -l var/forever.log --append --minUptime 30000 --spinSleepTime 30000 --uid akismet bin/cli.js",stop:"forever stop akismet",test:"gulp test"},yuidoc:{logo:"http://dev.belin.io/akismet.js/favicon.ico",name:"Akismet.js",url:"https://www.npmjs.com/package/akismet-js",options:{linkNatives:!0,outdir:"doc/api",paths:"lib",tabtospace:2,theme:"default"}}}},{}],19:[function(t){(function(e){"use strict";var n=t("assert"),r=t("../lib/client"),o=t("../lib/comment"),i={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(r.Blog.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=r.Blog.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=r.Blog.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 r.Blog).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new r.Blog("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"}')})}},s={_client:new r.Client(e.env.AKISMET_API_KEY,"AKISMET_BLOG"in e.env?e.env.AKISMET_BLOG:"http://dev.belin.io/akismet.js",{serviceUrl:"AKISMET_SERVICE_URL"in e.env?e.env.AKISMET_SERVICE_URL:"https://"+r.Client.DEFAULT_SERVICE}),_ham:new o.Comment({author:new o.Author({ipAddress:"192.168.0.1",name:"Akismet.js",url:"http://dev.belin.io/akismet.js",userAgent:"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0"}),content:"I'm testing out the Service API.",referrer:"https://www.npmjs.com/package/akismet-js",type:o.CommentType.COMMENT}),_spam:new o.Comment({author:new o.Author({ipAddress:"127.0.0.1",name:"viagra-test-123",userAgent:"Spam Bot/6.6.6"}),content:"Spam!",type:o.CommentType.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).then(function(t){n.strictEqual(t,!1),e()},e)}),it("should return `true` for invalid comment (e.g. spam)",function(e){t._client.checkComment(t._spam).then(function(t){n.strictEqual(t,!0),e()},e)})},testSubmitHam:function(){var t=this;it("should complete without error",function(e){t._client.submitHam(t._ham).then(function(){e()},e)})},testSubmitSpam:function(){var t=this;it("should complete without error",function(e){t._client.submitSpam(t._spam).then(function(){e()},e)})},testVerifyKey:function(){var t=this;it("should return `true` for a valid API key",function(e){t._client.verifyKey().then(function(t){n.strictEqual(t,!0),e()},e)}),it("should return `false` for an invalid API key",function(e){var o=new r.Client("viagra-test-123",t._client.blog,{serviceUrl:t._client.serviceUrl});o.verifyKey().then(function(t){n.strictEqual(t,!1),e()},e)})}};i.run(),s.run()}).call(this,t("_process"))},{"../lib/client":2,"../lib/comment":3,_process:7,assert:5}],20:[function(t){"use strict";var e=t("assert"),n=t("../lib/comment"),r={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.Author.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=n.Author.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.Author.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.Author).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new n.Author({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"}')})}},o={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(n.Comment.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=n.Comment.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=n.Comment.fromJSON('{ "comment_author": "Cédric Belin", "comment_content": "A user comment.", "comment_type": "trackback", "referrer": "http://belin.io" }');e(t.author instanceof n.Author),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,n.CommentType.TRACKBACK)})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){e.equal((new n.Comment).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new n.Comment({author:new n.Author({name:"Cédric Belin"}),content:"A user comment.",referrer:"http://belin.io",type:n.CommentType.PINGBACK});e.equal(t.toJSON(),'{"comment_author":"Cédric Belin","comment_content":"A user comment.","comment_type":"pingback","referrer":"http://belin.io"}')})}};r.run(),o.run()},{"../lib/comment":3,assert:5}]},{},[1]); +!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;s0?(i.closest(".form-group").removeClass("has-error"),$("main").empty().append('
'),e.env={AKISMET_API_KEY:i.val(),AKISMET_BLOG:r.val(),AKISMET_SERVICE_URL:o.val()},mocha.setup("bdd"),t("../../test/comment_test"),t("../../test/client_test"),void mocha.run()):(i.closest(".form-group").addClass("has-error"),i.focus(),void $("#dialog-alert").modal("show"))})}$(n)}).call(this,t("_process"))},{"../../test/client_test":19,"../../test/comment_test":20,_process:7}],2:[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",n.version.length?n.version:"0.0.0",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(n){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){var e=a.parse(this.serviceUrl),n=e.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.CHECK_COMMENT):u.format("%s//%s.%s%s",e.protocol,this.apiKey,e.host,i.EndPoints.CHECK_COMMENT),r=JSON.parse(t.toJSON());return this._queryService(n,r).then(function(t){return"true"==t})},o.prototype.submitHam=function(t){var e=a.parse(this.serviceUrl),n=e.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_HAM):u.format("%s//%s.%s%s",e.protocol,this.apiKey,e.host,i.EndPoints.SUBMIT_HAM);return this._queryService(n,JSON.parse(t.toJSON()))},o.prototype.submitSpam=function(t){var e=a.parse(this.serviceUrl),n=e.host!=o.DEFAULT_SERVICE?a.resolve(this.serviceUrl,i.EndPoints.SUBMIT_SPAM):u.format("%s//%s.%s%s",e.protocol,this.apiKey,e.host,i.EndPoints.SUBMIT_SPAM);return this._queryService(n,JSON.parse(t.toJSON()))},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(){var t=a.resolve(this.serviceUrl,i.EndPoints.VERIFY_KEY);return this._queryService(t,{}).then(function(t){return"valid"==t})},o.prototype._queryService=function(t,e){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);var n=this;return new Promise(function(r,o){s.post(t).type("form").send(e).set("undefined"!=typeof window?i.HTTPHeaders.X_USER_AGENT:"user-agent",n.userAgent).end(function(t,e){if(t||!e.ok)o(new Error(t?t.status:e.status));else{var n=i.HTTPHeaders.X_AKISMET_DEBUG_HELP;n in e.header?o(new Error(e.header[n])):r(e.text)}})})},e.exports={Blog:r,Client:o}}).call(this,t("_process"))},{"../package.json":18,"./enums":4,_process:7,superagent:15,url:12,util:14}],3:[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(r){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(o){return null}if(!e||"object"!=typeof e)return null;var i=!1;for(var s in e)if("comment_author"==s.substr(0,"comment_author".length)||"user"==s.substr(0,"user".length)){i=!0;break}return new r({author:i?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}},{}],4:[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}},{}],5:[function(t,e){function n(t,e){return p.isUndefined(e)?""+e:p.isNumber(e)&&!isFinite(e)?e.toString():p.isFunction(e)||p.isRegExp(e)?e.toString():e}function r(t,e){return p.isString(t)?t.length=0;i--)if(s[i]!=c[i])return!1;for(i=s.length-1;i>=0;i--)if(o=s[i],!a(t[o],e[o]))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;p.isString(n)&&(r=n,n=null);try{e()}catch(s){o=s}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 p=t("util/"),f=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}}},p.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(f.call(arguments)))},d.doesNotThrow=function(){h.apply(this,[!1].concat(f.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/":14}],6:[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}},{}],7:[function(t,e){function n(){if(!s){s=!0;for(var t,e=i.length;e;){t=i,i=[];for(var n=-1;++no;)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+=P(t>>>10&1023|55296),t=56320|1023&t),e+=P(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?I(t/A):t>>1,t+=I(t/e);t>U*E>>1;r+=S)t=I(t/U);return I(r+(U+1)*t/(t+j))}function p(t){var e,n,r,i,s,a,l,p,f,m,d=[],y=t.length,g=0,v=C,b=x;for(n=t.lastIndexOf(k),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"),p=c(t.charCodeAt(i++)),(p>=S||p>I((w-g)/a))&&o("overflow"),g+=p*a,f=b>=l?O:l>=b+E?E:l-b,!(f>p);l+=S)m=S-f,a>I(w/m)&&o("overflow"),a*=m;e=d.length+1,b=h(g-s,e,0==s),I(g/e)>w-v&&o("overflow"),v+=I(g/e),g%=e,d.splice(g++,0,v)}return u(d)}function f(t){var e,n,r,i,s,u,c,p,f,m,d,y,g,v,b,_=[];for(t=a(t),y=t.length,e=C,n=0,s=x,u=0;y>u;++u)d=t[u],128>d&&_.push(P(d));for(r=i=_.length,i&&_.push(k);y>r;){for(c=w,u=0;y>u;++u)d=t[u],d>=e&&c>d&&(c=d);for(g=r+1,c-e>I((w-n)/g)&&o("overflow"),n+=(c-e)*g,e=c,u=0;y>u;++u)if(d=t[u],e>d&&++n>w&&o("overflow"),d==e){for(p=n,f=S;m=s>=f?O:f>=s+E?E:f-s,!(m>p);f+=S)b=p-m,v=S-m,_.push(P(l(m+b%v,0))),p=I(b/v);_.push(P(l(p,0))),s=h(n,g,r==i),n=0,++r}++n,++e}return _.join("")}function m(t){return s(t,function(t){return T.test(t)?p(t.slice(4).toLowerCase()):t})}function d(t){return s(t,function(t){return N.test(t)?"xn--"+f(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,O=1,E=26,j=38,A=700,x=72,C=128,k="-",T=/^xn--/,N=/[^ -~]/,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"},U=S-O,I=Math.floor,P=String.fromCharCode;if(b={version:"1.2.4",ucs2:{decode:a,encode:u},decode:p,encode:f,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(_ in b)b.hasOwnProperty(_)&&(y[_]=b[_]);else r.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[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,p,f,m,d=t[l].replace(a,"%20"),y=d.indexOf(o);y>=0?(h=d.substr(0,y),p=d.substr(y+1)):(h=d,p=""),f=decodeURIComponent(h),m=decodeURIComponent(p),n(s,f)?r(s[f])?s[f].push(m):s[f]=[s[f],m]:s[f]=m}return s};var r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],10:[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=["/","?","#"],_=255,w=/^[a-z0-9A-Z_-]{0,63}$/,S=/^([a-z0-9A-Z_-]{0,63})(.*)$/,O={javascript:!0,"javascript:":!0},E={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=f.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&&E[o]||(r=r.substr(2),this.slashes=!0)}if(!E[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,x=y.length;x>c;c++){var C=y[c];if(C&&!C.match(w)){for(var k="",T=0,N=C.length;N>T;T++)k+=C.charCodeAt(T)>127?"x":C[T];if(!k.match(w)){var q=y.slice(0,c),J=y.slice(c+1),U=C.match(S);U&&(q.push(U[1]),J.unshift(U[2])),J.length&&(r="/"+J.join(".")+r),this.hostname=q.join(".");break}}}if(this.hostname=this.hostname.length>_?"":this.hostname.toLowerCase(),!d){for(var I=this.hostname.split("."),P=[],c=0;cc;c++){var D=g[c],B=encodeURIComponent(D);B===D&&(B=escape(D)),r=r.split(D).join(B)}var K=r.indexOf("#");-1!==K&&(this.hash=r.substr(K),r=r.slice(0,K));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 M=this.pathname||"",R=this.search||"";this.path=M+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||E[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),p=c||a||n.host&&t.pathname,f=p,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),p=p&&(""===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,_=m.length;_>=0;_--)g=m[_],"."==g?m.splice(_,1):".."===g?(m.splice(_,1),b++):b&&(m.splice(_,1),b--);if(!p&&!f)for(;b--;b)m.unshift("..");!p||""===m[0]||m[0]&&"/"===m[0].charAt(0)||m.unshift(""),v&&"/"!==m.join("/").substr(-1)&&m.push("");var w=""===m[0]||m[0]&&"/"===m[0].charAt(0);if(d){n.hostname=n.host=w?"":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 p=p||n.host&&m.length,p&&!w&&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:8,querystring:11}],13:[function(t,e){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],14:[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),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(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(E(e))return t.stylize(Date.prototype.toString.call(e),"date");if(j(e))return l(e)}var g="",v=!1,_=["{","}"];if(m(e)&&(v=!0,_=["[","]"]),A(e)){var w=e.name?": "+e.name:"";g=" [Function"+w+"]"}if(S(e)&&(g=" "+RegExp.prototype.toString.call(e)),E(e)&&(g=" "+Date.prototype.toUTCString.call(e)),j(e)&&(g=" "+l(e)),0===s.length&&(!v||0==e.length))return _[0]+g+_[1];if(0>r)return S(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var O;return O=v?h(t,e,r,d,s):s.map(function(n){return p(t,e,r,d,n,v)}),t.seen.pop(),f(O,g,_)}function c(t,e){if(w(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(N(e,String(s))?p(t,e,n,r,String(s),!0):"");return o.forEach(function(o){o.match(/^\d+$/)||i.push(p(t,e,n,r,o,!0))}),i}function p(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")),N(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")),w(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 f(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 _(t){return"symbol"==typeof t}function w(t){return void 0===t}function S(t){return O(t)&&"[object RegExp]"===C(t)}function O(t){return"object"==typeof t&&null!==t}function E(t){return O(t)&&"[object Date]"===C(t)}function j(t){return O(t)&&("[object Error]"===C(t)||t instanceof Error)}function A(t){return"function"==typeof t}function x(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||"undefined"==typeof t}function C(t){return Object.prototype.toString.call(t)}function k(t){return 10>t?"0"+t.toString(10):t.toString(10)}function T(){var t=new Date,e=[k(t.getHours()),k(t.getMinutes()),k(t.getSeconds())].join(":");return[t.getDate(),I[t.getMonth()],e].join(" ")}function N(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(e){return"[Circular]"}default:return t}}),a=r[n];i>n;a=r[++n])s+=y(a)||!O(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(w(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,U={};n.debuglog=function(t){if(w(J)&&(J=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!U[t])if(new RegExp("\\b"+t+"\\b","i").test(J)){var r=e.pid;U[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else U[t]=function(){};return U[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=_,n.isUndefined=w,n.isRegExp=S,n.isObject=O,n.isDate=E,n.isError=j,n.isFunction=A,n.isPrimitive=x,n.isBuffer=t("./support/isBuffer");var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.log=function(){console.log("%s - %s",T(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!O(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":13,_process:7,inherits:6}],15:[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(t){return t===Object(t)}function i(t){if(!o(t))return t;var e=[];for(var n in t)null!=t[n]&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e.join("&")}function s(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 a(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=y(n.slice(e+1)),s[r]=o;return s}function u(t){return t.split(/ *; */).shift()}function c(t){return m(t.split(/ *; */),function(t,e){var n=e.split(/ *= */),r=n.shift(),o=n.shift();return r&&o&&(t[r]=o),t},{})}function l(t,e){e=e||{},this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||"undefined"==typeof this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText,this.setStatusProperties(this.xhr.status),this.header=this.headers=a(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?this.text:this.xhr.response):null}function h(t,e){var n=this;f.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 l(n)}catch(r){return t=new Error("Parser is unable to parse the response"),t.parse=!0,t.original=r,n.callback(t)}if(n.emit("response",e),t)return n.callback(t,e);if(e.status>=200&&e.status<300)return n.callback(t,e);var o=new Error(e.statusText||"Unsuccessful HTTP response");o.original=t,o.response=e,o.status=e.status,n.callback(t||o,e)})}function p(t,e){return"function"==typeof e?new h("GET",t).end(e):1==arguments.length?new h("GET",t):new h(t,e)}var f=t("emitter"),m=t("reduce"),d="undefined"==typeof window?this:window;p.getXHR=function(){if(d.XMLHttpRequest&&("file:"!=d.location.protocol||!d.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};var y="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};p.serializeObject=i,p.parseString=s,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":i,"application/json":JSON.stringify},p.parse={"application/x-www-form-urlencoded":s,"application/json":JSON.parse},l.prototype.get=function(t){return this.header[t.toLowerCase()]},l.prototype.setHeaderProperties=function(){var t=this.header["content-type"]||""; +this.type=u(t);var e=c(t);for(var n in e)this[n]=e[n]},l.prototype.parseBody=function(t){var e=p.parse[this.type];return e&&t&&(t.length||t instanceof Object)?e(t):null},l.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},l.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=l,f(h.prototype),h.prototype.use=function(t){return t(this),this},h.prototype.timeout=function(t){return this._timeout=t,this},h.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},h.prototype.abort=function(){return this.aborted?void 0:(this.aborted=!0,this.xhr.abort(),this.clearTimeout(),this.emit("abort"),this)},h.prototype.set=function(t,e){if(o(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},h.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},h.prototype.getHeader=function(t){return this._header[t.toLowerCase()]},h.prototype.type=function(t){return this.set("Content-Type",p.types[t]||t),this},h.prototype.accept=function(t){return this.set("Accept",p.types[t]||t),this},h.prototype.auth=function(t,e){var n=btoa(t+":"+e);return this.set("Authorization","Basic "+n),this},h.prototype.query=function(t){return"string"!=typeof t&&(t=i(t)),t&&this._query.push(t),this},h.prototype.field=function(t,e){return this._formData||(this._formData=new d.FormData),this._formData.append(t,e),this},h.prototype.attach=function(t,e,n){return this._formData||(this._formData=new d.FormData),this._formData.append(t,e,n),this},h.prototype.send=function(t){var e=o(t),n=this.getHeader("Content-Type");if(e&&o(this._data))for(var i in t)this._data[i]=t[i];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||r(t)?this:(n||this.type("json"),this)},h.prototype.callback=function(t,e){var n=this._callback;this.clearTimeout(),n(t,e)},h.prototype.crossDomainError=function(){var t=new Error("Origin is not allowed by Access-Control-Allow-Origin");t.crossDomain=!0,this.callback(t)},h.prototype.timeoutError=function(){var t=this._timeout,e=new Error("timeout of "+t+"ms exceeded");e.timeout=t,this.callback(e)},h.prototype.withCredentials=function(){return this._withCredentials=!0,this},h.prototype.end=function(t){var e=this,o=this.xhr=p.getXHR(),i=this._query.join("&"),s=this._timeout,a=this._formData||this._data;this._callback=t||n,o.onreadystatechange=function(){if(4==o.readyState){var t;try{t=o.status}catch(n){t=0}if(0==t){if(e.timedout)return e.timeoutError();if(e.aborted)return;return e.crossDomainError()}e.emit("end")}};try{o.upload&&this.hasListeners("progress")&&(o.upload.onprogress=function(t){t.percent=t.loaded/t.total*100,e.emit("progress",t)})}catch(u){}if(s&&!this._timer&&(this._timer=setTimeout(function(){e.timedout=!0,e.abort()},s)),i&&(i=p.serializeObject(i),this.url+=~this.url.indexOf("?")?"&"+i:"?"+i),o.open(this.method,this.url,!0),this._withCredentials&&(o.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof a&&!r(a)){var c=p.serialize[this.getHeader("Content-Type")];c&&(a=c(a))}for(var l in this.header)null!=this.header[l]&&o.setRequestHeader(l,this.header[l]);return this.emit("request",this),o.send(a),this},p.Request=h,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:16,reduce:17}],16:[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}},{}],17:[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}},{}],18:[function(t,e){e.exports={author:"Cédric Belin ",bugs:"https://bitbucket.org/cedx/akismet.js/issues",description:"Prevent comment spam using Akismet service.",homepage:"https://bitbucket.org/cedx/akismet.js",license:"MIT",main:"./index",name:"akismet-js",version:"0.5.2",bin:{akismet:"./bin/cli.js"},dependencies:{"body-parser":"^1.12.2",commander:"^2.7.1",cors:"^2.5.3",express:"^4.12.3",forever:"^0.14.1",superagent:"^1.1.0"},devDependencies:{browserify:"9.0.4",del:"^1.1.1","docgen-js":"^0.0.1",gulp:"^3.8.11","gulp-david":"^0.2.1","gulp-jshint":"^1.10.0","gulp-load-plugins":"^0.9.0","gulp-mocha":"^2.0.1","gulp-sourcemaps":"^1.5.1","gulp-uglify":"^1.1.0","gulp-zip":"^3.0.2","vinyl-buffer":"^1.0.0","vinyl-source-stream":"^1.1.0"},engines:{node:">=0.12.0"},jshintConfig:{browser:!0,camelcase:!1,freeze:!0,indent:2,latedef:"nofunc",loopfunc:!0,newcap:!0,node:!0,nonew:!0,quotmark:"single",strict:!0,trailing:!0,undef:!0,unused:!0,globals:{describe:!1,it:!1,Promise:!1}},keywords:["akismet","comment","spam","validation"],repository:{type:"git",url:"https://bitbucket.org/cedx/akismet.js.git"},scripts:{start:"forever start -c node -e var/stderr.log -o var/stdout.log -l var/forever.log --append --minUptime 30000 --spinSleepTime 30000 --uid akismet bin/cli.js",stop:"forever stop akismet",test:"gulp test"},yuidoc:{logo:"http://dev.belin.io/akismet.js/favicon.ico",name:"Akismet.js",url:"https://www.npmjs.com/package/akismet-js",options:{linkNatives:!0,outdir:"doc/api",paths:"lib",tabtospace:2,theme:"default"}}}},{}],19:[function(t){(function(e){"use strict";var n=t("assert"),r=t("../lib/client"),o=t("../lib/comment"),i={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(r.Blog.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=r.Blog.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=r.Blog.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 r.Blog).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new r.Blog("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"}')})}},s={_client:new r.Client(e.env.AKISMET_API_KEY,"AKISMET_BLOG"in e.env?e.env.AKISMET_BLOG:"http://dev.belin.io/akismet.js",{serviceUrl:"AKISMET_SERVICE_URL"in e.env?e.env.AKISMET_SERVICE_URL:"https://"+r.Client.DEFAULT_SERVICE}),_ham:new o.Comment({author:new o.Author({ipAddress:"192.168.0.1",name:"Akismet.js",url:"http://dev.belin.io/akismet.js",userAgent:"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0"}),content:"I'm testing out the Service API.",referrer:"https://www.npmjs.com/package/akismet-js",type:o.CommentType.COMMENT}),_spam:new o.Comment({author:new o.Author({ipAddress:"127.0.0.1",name:"viagra-test-123",userAgent:"Spam Bot/6.6.6"}),content:"Spam!",type:o.CommentType.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).then(function(t){n.strictEqual(t,!1),e()},e)}),it("should return `true` for invalid comment (e.g. spam)",function(e){t._client.checkComment(t._spam).then(function(t){n.strictEqual(t,!0),e()},e)})},testSubmitHam:function(){var t=this;it("should complete without error",function(e){t._client.submitHam(t._ham).then(function(){e()},e)})},testSubmitSpam:function(){var t=this;it("should complete without error",function(e){t._client.submitSpam(t._spam).then(function(){e()},e)})},testVerifyKey:function(){var t=this;it("should return `true` for a valid API key",function(e){t._client.verifyKey().then(function(t){n.strictEqual(t,!0),e()},e)}),it("should return `false` for an invalid API key",function(e){var o=new r.Client("viagra-test-123",t._client.blog,{serviceUrl:t._client.serviceUrl});o.verifyKey().then(function(t){n.strictEqual(t,!1),e()},e)})}};i.run(),s.run()}).call(this,t("_process"))},{"../lib/client":2,"../lib/comment":3,_process:7,assert:5}],20:[function(t){"use strict";var e=t("assert"),n=t("../lib/comment"),r={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.Author.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=n.Author.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.Author.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.Author).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new n.Author({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"}')})}},o={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(n.Comment.fromJSON("foo"),null)}),it("should return an empty instance with an empty JSON object",function(){var t=n.Comment.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=n.Comment.fromJSON('{ "comment_author": "Cédric Belin", "comment_content": "A user comment.", "comment_type": "trackback", "referrer": "http://belin.io" }');e(t.author instanceof n.Author),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,n.CommentType.TRACKBACK)})},testToJSON:function(){it("should return an empty JSON object with a newly created instance",function(){e.equal((new n.Comment).toJSON(),"{}")}),it("should return a non-empty JSON object with a initialized instance",function(){var t=new n.Comment({author:new n.Author({name:"Cédric Belin"}),content:"A user comment.",referrer:"http://belin.io",type:n.CommentType.PINGBACK});e.equal(t.toJSON(),'{"comment_author":"Cédric Belin","comment_content":"A user comment.","comment_type":"pingback","referrer":"http://belin.io"}')})}};r.run(),o.run()},{"../lib/comment":3,assert:5}]},{},[1]); //# sourceMappingURL=tests.js.map \ No newline at end of file