From a042006c6c81d350d0bca86bd132fad9056041ab Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Wed, 9 Sep 2015 03:16:01 -0700 Subject: [PATCH] Include source-maps --- Makefile | 2 +- dist/wpcom.js | 3 ++- dist/wpcom.js.map | 1 + index.js | 3 ++- index.js.map | 1 + webpack.config.js | 3 ++- 6 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 dist/wpcom.js.map create mode 100644 index.js.map diff --git a/Makefile b/Makefile index be5f060..c46f6dd 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ standalone: dist/wpcom.js install: node_modules index.js clean: - @rm -rf dist index.js + @rm -rf dist index.js index.js.map distclean: clean @rm -rf node_modules diff --git a/dist/wpcom.js b/dist/wpcom.js index ff72bb8..09d14d8 100644 --- a/dist/wpcom.js +++ b/dist/wpcom.js @@ -1 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("debug"),require("fs"),require("qs"),require("wpcom-xhr-request")):"function"==typeof define&&define.amd?define(["debug","fs","qs","wpcom-xhr-request"],e):"object"==typeof exports?exports.WPCOM=e(require("debug"),require("fs"),require("qs"),require("wpcom-xhr-request")):t.WPCOM=e(t.debug,t.fs,t.qs,t["wpcom-xhr-request"])}(this,function(t,e,i,s){return function(t){function e(s){if(i[s])return i[s].exports;var o=i[s]={exports:{},id:s,loaded:!1};return t[s].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){function s(t,e){return this instanceof s?("function"==typeof t&&(e=t,t=null),t&&(h("Token defined: %s…",t.substring(0,6)),this.token=t),e?this.request=e:(h("No request handler. Adding default XHR request handler"),this.request=function(e,i){return e=e||{},t&&(e.authToken=t),o(e,i)}),this.req=new c(this),void(this.apiVersion="1.1")):new s(t,e)}var o=i(19),r=i(9),n=i(13),p=i(15),u=i(4),c=i(16),d=i(3),h=i(1)("wpcom"),a=3e4;s.prototype.me=function(){return new r(this)},s.prototype.site=function(t){return new n(t,this)},s.prototype.users=function(){return new p(this)},s.prototype.batch=function(){return new u(this)},s.prototype.freshlyPressed=function(t,e){return this.req.get("/freshly-pressed",t,e)},s.prototype.sendRequest=function(t,e,i,s){var o="WARN! Don use `sendRequest() anymore. Use `this.req` method.";return console&&console.warn?console.warn(o):console.log(o),d.call(this,t,e,i,s)},s.prototype.Promise=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),s=1;e>s;s++)i[s-1]=arguments[s];return new Promise(function(e,s){t.apply(t,[].concat(i,[function(t,i){t?s(t):e(i)}]))})},Promise.prototype.timeout||(Promise.prototype.timeout=function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?a:arguments[0],i=void 0,s=void 0,o=void 0;return o=new Promise(function(t,i){s=setTimeout(function(){i(new Error("Action timed out while waiting for response."))},e)}),i=function(){return clearTimeout(s),t},Promise.race([this.then(i)["catch"](i),o])}),t.exports=s},function(e,i){e.exports=t},function(t,e,i){function s(t,e,i,o){if(!i)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=o,this._cid=t,this._pid=e,void(this._sid=i)):new s(t,e,i,o)}var o=i(6);i(1)("wpcom:comment");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.get(i,t,e)},s.prototype.replies=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/replies/";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={})),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/posts/"+this._pid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.put(s,t,e,i)},s.prototype.reply=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/delete";return this.wpcom.req.del(i,t,e)},s.prototype.like=function(){return o(this._cid,this._sid,this.wpcom)},s.prototype.likesList=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes";return this.wpcom.req.get(i,t,e)},t.exports=s},function(t,e,i){var s=i(18),o=i(1)("wpcom:send-request"),r=i(1)("wpcom:send-request:res");t.exports=function(t,e,i,n){var p=this;return t="string"==typeof t?{path:t}:t,o("sendRequest(%o)",t.path),t.method=(t.method||"get").toUpperCase(),"function"==typeof e&&(n=e,e={}),"function"==typeof i&&(n=i,i=null),e=e||{},e.apiVersion?(t.apiVersion=e.apiVersion,o("apiVersion: %o",t.apiVersion),delete e.apiVersion):t.apiVersion=this.apiVersion,e.proxyOrigin&&(t.proxyOrigin=e.proxyOrigin,o("proxyOrigin: %o",t.proxyOrigin),delete e.proxyOrigin),e=s.stringify(e,{arrayFormat:"brackets"}),t.query=e,i&&(t.body=i),o("params: %o",t),"function"==typeof n?this.request(t,function(t,e){r(e),n(t,e)}):new Promise(function(e,i){p.request(t,function(t,s){r(s),t?i(t):e(s)})})}},function(t,e,i){function s(t){return this instanceof s?(this.wpcom=t,void(this.urls=[])):new s(t)}i(1)("wpcom:batch");s.prototype.add=function(t){return this.urls.push(t),this},s.prototype.run=function(t,e){return void 0===t&&(t={}),"function"==typeof t&&(e=t,t={}),t.urls=this.urls,this.wpcom.req.get("/batch",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._sid=e,void(this._slug=t)):new s(t,e,i)}i(1)("wpcom:category");s.prototype.slug=function(t){this._slug=t},s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){var s="/sites/"+this._sid+"/categories/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.put(s,t,e,i)},s.prototype["delete"]=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug+"/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`comment id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._cid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:commentlike");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/new";return this.wpcom.req.post(i,t,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e){if(!t)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=e,void(this._sid=t)):new s(t,e)}i(1)("wpcom:follow");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/follows/mine";return this.wpcom.req.get(i,t,e)},s.prototype.follow=s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/follows/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.unfollow=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/follows/mine/delete";return this.wpcom.req.del(i,t,null,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`post id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._pid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:like");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t){return this instanceof s?void(this.wpcom=t):new s(t)}i(1)("wpcom:me");s.prototype.get=function(t,e){return this.wpcom.req.get("/me",t,e)},s.prototype.sites=function(t,e){return this.wpcom.req.get("/me/sites",t,e)},s.prototype.likes=function(t,e){return this.wpcom.req.get("/me/likes",t,e)},s.prototype.groups=function(t,e){return this.wpcom.req.get("/me/groups",t,e)},s.prototype.connections=function(t,e){return this.wpcom.req.get("/me/connections",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){return this instanceof s?(this.wpcom=i,this._sid=e,this._id=t,void(this._id||r("WARN: media `id` is not defined"))):new s(t,e,i)}var o=i(17),r=i(1)("wpcom:media");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.get(i,t,e)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.put(s,t,e,i)},s.prototype.addFiles=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s={path:"/sites/"+this._sid+"/media/new",formData:[]};e=Array.isArray(e)?e:[e];var n,p,u,c,d,h;for(n=0;n %o",d,p[d]),"file"!==d&&(h="attrs["+n+"]["+d+"]",s.formData.push([h,p[d]]));p=p.file,p="string"==typeof p?o.createReadStream(p):p}s.formData.push(["media[]",p])}return this.wpcom.req.post(s,t,null,i)},s.prototype.addUrls=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s,o,r,n,p="/sites/"+this._sid+"/media/new",u={media_urls:[]};for(e=Array.isArray(e)?e:[e],s=0;s1?e-1:0),s=1;e>s;s++)i[s-1]=arguments[s];return new Promise(function(e,s){t.apply(t,[].concat(i,[function(t,i){t?s(t):e(i)}]))})},Promise.prototype.timeout||(Promise.prototype.timeout=function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?a:arguments[0],i=void 0,s=void 0,o=void 0;return o=new Promise(function(t,i){s=setTimeout(function(){i(new Error("Action timed out while waiting for response."))},e)}),i=function(){return clearTimeout(s),t},Promise.race([this.then(i)["catch"](i),o])}),t.exports=s},function(e,i){e.exports=t},function(t,e,i){function s(t,e,i,o){if(!i)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=o,this._cid=t,this._pid=e,void(this._sid=i)):new s(t,e,i,o)}var o=i(6);i(1)("wpcom:comment");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.get(i,t,e)},s.prototype.replies=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/replies/";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={})),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/posts/"+this._pid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.put(s,t,e,i)},s.prototype.reply=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/delete";return this.wpcom.req.del(i,t,e)},s.prototype.like=function(){return o(this._cid,this._sid,this.wpcom)},s.prototype.likesList=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes";return this.wpcom.req.get(i,t,e)},t.exports=s},function(t,e,i){var s=i(18),o=i(1)("wpcom:send-request"),r=i(1)("wpcom:send-request:res");t.exports=function(t,e,i,n){var p=this;return t="string"==typeof t?{path:t}:t,o("sendRequest(%o)",t.path),t.method=(t.method||"get").toUpperCase(),"function"==typeof e&&(n=e,e={}),"function"==typeof i&&(n=i,i=null),e=e||{},e.apiVersion?(t.apiVersion=e.apiVersion,o("apiVersion: %o",t.apiVersion),delete e.apiVersion):t.apiVersion=this.apiVersion,e.proxyOrigin&&(t.proxyOrigin=e.proxyOrigin,o("proxyOrigin: %o",t.proxyOrigin),delete e.proxyOrigin),e=s.stringify(e,{arrayFormat:"brackets"}),t.query=e,i&&(t.body=i),o("params: %o",t),"function"==typeof n?this.request(t,function(t,e){r(e),n(t,e)}):new Promise(function(e,i){p.request(t,function(t,s){r(s),t?i(t):e(s)})})}},function(t,e,i){function s(t){return this instanceof s?(this.wpcom=t,void(this.urls=[])):new s(t)}i(1)("wpcom:batch");s.prototype.add=function(t){return this.urls.push(t),this},s.prototype.run=function(t,e){return void 0===t&&(t={}),"function"==typeof t&&(e=t,t={}),t.urls=this.urls,this.wpcom.req.get("/batch",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._sid=e,void(this._slug=t)):new s(t,e,i)}i(1)("wpcom:category");s.prototype.slug=function(t){this._slug=t},s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){var s="/sites/"+this._sid+"/categories/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.put(s,t,e,i)},s.prototype["delete"]=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug+"/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`comment id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._cid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:commentlike");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/new";return this.wpcom.req.post(i,t,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e){if(!t)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=e,void(this._sid=t)):new s(t,e)}i(1)("wpcom:follow");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/follows/mine";return this.wpcom.req.get(i,t,e)},s.prototype.follow=s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/follows/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.unfollow=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/follows/mine/delete";return this.wpcom.req.del(i,t,null,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`post id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._pid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:like");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t){return this instanceof s?void(this.wpcom=t):new s(t)}i(1)("wpcom:me");s.prototype.get=function(t,e){return this.wpcom.req.get("/me",t,e)},s.prototype.sites=function(t,e){return this.wpcom.req.get("/me/sites",t,e)},s.prototype.likes=function(t,e){return this.wpcom.req.get("/me/likes",t,e)},s.prototype.groups=function(t,e){return this.wpcom.req.get("/me/groups",t,e)},s.prototype.connections=function(t,e){return this.wpcom.req.get("/me/connections",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){return this instanceof s?(this.wpcom=i,this._sid=e,this._id=t,void(this._id||r("WARN: media `id` is not defined"))):new s(t,e,i)}var o=i(17),r=i(1)("wpcom:media");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.get(i,t,e)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.put(s,t,e,i)},s.prototype.addFiles=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s={path:"/sites/"+this._sid+"/media/new",formData:[]};e=Array.isArray(e)?e:[e];var n,p,u,c,d,h;for(n=0;n %o",d,p[d]),"file"!==d&&(h="attrs["+n+"]["+d+"]",s.formData.push([h,p[d]]));p=p.file,p="string"==typeof p?o.createReadStream(p):p}s.formData.push(["media[]",p])}return this.wpcom.req.post(s,t,null,i)},s.prototype.addUrls=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s,o,r,n,p="/sites/"+this._sid+"/media/new",u={media_urls:[]};for(e=Array.isArray(e)?e:[e],s=0;s 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n\t params[_key - 1] = arguments[_key];\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t // The functions here take a variable number of arguments,\n\t // so pass in as many as we can but keep the callback last.\n\t callback.apply(callback, [].concat(params, [function (error, data) {\n\t error ? reject(error) : resolve(data);\n\t }]));\n\t });\n\t};\n\t\n\tif (!Promise.prototype.timeout) {\n\t /**\n\t * Returns a new promise with a deadline\n\t *\n\t * After the timeout interval, the promise will\n\t * reject. If the actual promise settles before\n\t * the deadline, the timer is cancelled.\n\t *\n\t * @param {number} delay how many ms to wait\n\t * @returns {Promise}\n\t */\n\t Promise.prototype.timeout = function () {\n\t var _this = this;\n\t\n\t var delay = arguments.length <= 0 || arguments[0] === undefined ? DEFAULT_ASYNC_TIMEOUT : arguments[0];\n\t\n\t var cancelTimeout = undefined,\n\t timer = undefined,\n\t timeout = undefined;\n\t\n\t timeout = new Promise(function (resolve, reject) {\n\t timer = setTimeout(function () {\n\t reject(new Error('Action timed out while waiting for response.'));\n\t }, delay);\n\t });\n\t\n\t cancelTimeout = function () {\n\t clearTimeout(timer);\n\t return _this;\n\t };\n\t\n\t return Promise.race([this.then(cancelTimeout)['catch'](cancelTimeout), timeout]);\n\t };\n\t}\n\t\n\t/**\n\t * Expose `WPCOM` module\n\t */\n\t\n\tmodule.exports = WPCOM;\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar CommentLike = __webpack_require__(6);\n\tvar debug = __webpack_require__(1)('wpcom:comment');\n\t\n\t/**\n\t * Comment methods\n\t *\n\t * @param {String} [cid] comment id\n\t * @param {String} [pid] post id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Comment(cid, pid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Comment)) {\n\t return new Comment(cid, pid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._cid = cid;\n\t this._pid = pid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Return a single Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Return recent comments for a post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.replies = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Create a comment on a post\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.add = function (query, body, fn) {\n\t if (undefined === fn) {\n\t if (undefined === body) {\n\t body = query;\n\t query = {};\n\t } else if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t }\n\t\n\t body = 'string' === typeof body ? { content: body } : body;\n\t\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Edit a comment\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.update = function (query, body, fn) {\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t\n\t body = 'string' === typeof body ? { content: body } : body;\n\t\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Create a Comment as a reply to another Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.reply = function (query, body, fn) {\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t\n\t body = 'string' === typeof body ? { content: body } : body;\n\t\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/replies/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete a comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.del = Comment.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Create a `CommentLike` instance\n\t *\n\t * @api public\n\t */\n\t\n\tComment.prototype.like = function () {\n\t return CommentLike(this._cid, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Get comment likes list\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.likesList = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Comment` module\n\t */\n\t\n\tmodule.exports = Comment;\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies\n\t */\n\t\n\tvar qs = __webpack_require__(18);\n\tvar debug = __webpack_require__(1)('wpcom:send-request');\n\tvar debug_res = __webpack_require__(1)('wpcom:send-request:res');\n\t\n\t/**\n\t * Request to WordPress REST API\n\t *\n\t * @param {String|Object} params\n\t * @param {Object} [query]\n\t * @param {Object} [body]\n\t * @param {Function} fn\n\t * @api private\n\t */\n\t\n\tmodule.exports = function (params, query, body, fn) {\n\t var _this = this;\n\t\n\t // `params` can be just the path (String)\n\t params = 'string' === typeof params ? { path: params } : params;\n\t\n\t debug('sendRequest(%o)', params.path);\n\t\n\t // set `method` request param\n\t params.method = (params.method || 'get').toUpperCase();\n\t\n\t // `query` is optional\n\t if ('function' === typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t // `body` is optional\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = null;\n\t }\n\t\n\t // query could be `null`\n\t query = query || {};\n\t\n\t // Handle special query parameters\n\t // - `apiVersion`\n\t if (query.apiVersion) {\n\t params.apiVersion = query.apiVersion;\n\t debug('apiVersion: %o', params.apiVersion);\n\t delete query.apiVersion;\n\t } else {\n\t params.apiVersion = this.apiVersion;\n\t }\n\t\n\t // - `proxyOrigin`\n\t if (query.proxyOrigin) {\n\t params.proxyOrigin = query.proxyOrigin;\n\t debug('proxyOrigin: %o', params.proxyOrigin);\n\t delete query.proxyOrigin;\n\t }\n\t\n\t // Stringify query object before to send\n\t query = qs.stringify(query, { arrayFormat: 'brackets' });\n\t\n\t // pass `query` and/or `body` to request params\n\t params.query = query;\n\t\n\t if (body) {\n\t params.body = body;\n\t }\n\t debug('params: %o', params);\n\t\n\t // if callback is provided, behave traditionally\n\t if ('function' === typeof fn) {\n\t // request method\n\t return this.request(params, function (err, res) {\n\t debug_res(res);\n\t fn(err, res);\n\t });\n\t }\n\t\n\t // but if not, return a Promise\n\t return new Promise(function (resolve, reject) {\n\t _this.request(params, function (err, res) {\n\t debug_res(res);\n\t err ? reject(err) : resolve(res);\n\t });\n\t });\n\t};\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:batch');\n\t\n\t/**\n\t * Create a `Batch` instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Batch(wpcom) {\n\t if (!(this instanceof Batch)) {\n\t return new Batch(wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t\n\t this.urls = [];\n\t}\n\t\n\t/**\n\t * Add url to batch requests\n\t *\n\t * @param {String} url\n\t * @api public\n\t */\n\t\n\tBatch.prototype.add = function (url) {\n\t this.urls.push(url);\n\t return this;\n\t};\n\t\n\t/**\n\t * Run the batch request\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tBatch.prototype.run = function (query, fn) {\n\t if (query === undefined) query = {};\n\t\n\t if ('function' === typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t // add urls to query object\n\t query['urls'] = this.urls;\n\t\n\t return this.wpcom.req.get('/batch', query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Batch` module\n\t */\n\t\n\tmodule.exports = Batch;\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:category');\n\t\n\t/**\n\t * Category methods\n\t *\n\t * @param {String} [slug]\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Category(slug, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Category)) {\n\t return new Category(slug, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t this._slug = slug;\n\t}\n\t\n\t/**\n\t * Set category `slug`\n\t *\n\t * @param {String} slug\n\t * @api public\n\t */\n\t\n\tCategory.prototype.slug = function (slug) {\n\t this._slug = slug;\n\t};\n\t\n\t/**\n\t * Get category\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Add category\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype.add = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/categories/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Edit category\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete category\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype['delete'] = Category.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/categories/slug:' + this._slug + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Category` module\n\t */\n\t\n\tmodule.exports = Category;\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:commentlike');\n\t\n\t/**\n\t * CommentLike methods\n\t *\n\t * @param {String} cid comment id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction CommentLike(cid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!cid) {\n\t throw new Error('`comment id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof CommentLike)) {\n\t return new CommentLike(cid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._cid = cid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Get your Like status for a Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCommentLike.prototype.mine = CommentLike.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Like a comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCommentLike.prototype.add = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/new';\n\t return this.wpcom.req.post(path, query, fn);\n\t};\n\t\n\t/**\n\t * Remove your Like from a Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCommentLike.prototype.del = CommentLike.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `CommentLike` module\n\t */\n\t\n\tmodule.exports = CommentLike;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:follow');\n\t\n\t/**\n\t * Follow \n\t *\n\t * @param {String} site_id - site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Follow(site_id, wpcom) {\n\t if (!site_id) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Follow)) {\n\t return new Follow(site_id, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = site_id;\n\t}\n\t\n\t/**\n\t * Get the follow status for current \n\t * user on current blog sites\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tFollow.prototype.mine = Follow.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/follows/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Follow the site\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tFollow.prototype.follow = Follow.prototype.add = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/follows/new';\n\t return this.wpcom.req.put(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Unfollow the site\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tFollow.prototype.unfollow = Follow.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/follows/mine/delete';\n\t return this.wpcom.req.del(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Expose `Follow` module\n\t */\n\t\n\tmodule.exports = Follow;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:like');\n\t\n\t/**\n\t * Like methods\n\t *\n\t * @param {String} pid post id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Like(pid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!pid) {\n\t throw new Error('`post id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Like)) {\n\t return new Like(pid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._pid = pid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Get your Like status for a Post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tLike.prototype.mine = Like.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Like a post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tLike.prototype.add = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/new';\n\t return this.wpcom.req.put(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Remove your Like from a Post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tLike.prototype.del = Like.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Like` module\n\t */\n\t\n\tmodule.exports = Like;\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:me');\n\t\n\t/**\n\t * Create a `Me` instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Me(wpcom) {\n\t if (!(this instanceof Me)) {\n\t return new Me(wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t}\n\t\n\t/**\n\t * Meta data about auth token's User\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.get = function (query, fn) {\n\t return this.wpcom.req.get('/me', query, fn);\n\t};\n\t\n\t/**\n\t * A list of the current user's sites\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api private\n\t */\n\t\n\tMe.prototype.sites = function (query, fn) {\n\t return this.wpcom.req.get('/me/sites', query, fn);\n\t};\n\t\n\t/**\n\t * List the currently authorized user's likes\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.likes = function (query, fn) {\n\t return this.wpcom.req.get('/me/likes', query, fn);\n\t};\n\t\n\t/**\n\t * A list of the current user's group\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.groups = function (query, fn) {\n\t return this.wpcom.req.get('/me/groups', query, fn);\n\t};\n\t\n\t/**\n\t * A list of the current user's connections to third-party services\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.connections = function (query, fn) {\n\t return this.wpcom.req.get('/me/connections', query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Me` module\n\t */\n\t\n\tmodule.exports = Me;\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar fs = __webpack_require__(17);\n\tvar debug = __webpack_require__(1)('wpcom:media');\n\t\n\t/**\n\t * Default\n\t */\n\t\n\tvar def = {\n\t \"apiVersion\": \"1.1\"\n\t};\n\t\n\t/**\n\t * Media methods\n\t *\n\t * @param {String} id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Media(id, sid, wpcom) {\n\t if (!(this instanceof Media)) {\n\t return new Media(id, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t this._id = id;\n\t\n\t if (!this._id) {\n\t debug('WARN: media `id` is not defined');\n\t }\n\t}\n\t\n\t/**\n\t * Get media\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMedia.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/media/' + this._id;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Edit media\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMedia.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/media/' + this._id;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Add media file\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object|Array} files\n\t * @param {Function} fn\n\t */\n\t\n\tMedia.prototype.addFiles = function (query, files, fn) {\n\t if (undefined === fn) {\n\t if (undefined === files) {\n\t files = query;\n\t query = {};\n\t } else if ('function' === typeof files) {\n\t fn = files;\n\t files = query;\n\t query = {};\n\t }\n\t }\n\t\n\t var params = {\n\t path: '/sites/' + this._sid + '/media/new',\n\t formData: []\n\t };\n\t\n\t // process formData\n\t files = Array.isArray(files) ? files : [files];\n\t\n\t var i, f, isStream, isFile, k, param;\n\t for (i = 0; i < files.length; i++) {\n\t f = files[i];\n\t f = 'string' === typeof f ? fs.createReadStream(f) : f;\n\t\n\t isStream = !!f._readableState;\n\t isFile = 'undefined' !== typeof File && f instanceof File;\n\t\n\t debug('is stream: %s', isStream);\n\t debug('is file: %s', isFile);\n\t\n\t if (!isFile && !isStream) {\n\t // process file attributes like as `title`, `description`, ...\n\t for (k in f) {\n\t debug('add %o => %o', k, f[k]);\n\t if ('file' !== k) {\n\t param = 'attrs[' + i + '][' + k + ']';\n\t params.formData.push([param, f[k]]);\n\t }\n\t }\n\t // set file path\n\t f = f.file;\n\t f = 'string' === typeof f ? fs.createReadStream(f) : f;\n\t }\n\t\n\t params.formData.push(['media[]', f]);\n\t }\n\t\n\t return this.wpcom.req.post(params, query, null, fn);\n\t};\n\t\n\t/**\n\t * Add media files from URL\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Array|Object} files\n\t * @param {Function} fn\n\t */\n\t\n\tMedia.prototype.addUrls = function (query, media, fn) {\n\t if (undefined === fn) {\n\t if (undefined === media) {\n\t media = query;\n\t query = {};\n\t } else if ('function' === typeof media) {\n\t fn = media;\n\t media = query;\n\t query = {};\n\t }\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/media/new';\n\t var body = { media_urls: [] };\n\t\n\t // process formData\n\t var i, m, url, k;\n\t\n\t media = Array.isArray(media) ? media : [media];\n\t for (i = 0; i < media.length; i++) {\n\t m = media[i];\n\t\n\t if ('string' === typeof m) {\n\t url = m;\n\t } else {\n\t if (!body.attrs) {\n\t body.attrs = [];\n\t }\n\t\n\t // add attributes\n\t body.attrs[i] = {};\n\t for (k in m) {\n\t if ('url' !== k) {\n\t body.attrs[i][k] = m[k];\n\t }\n\t }\n\t url = m[k];\n\t }\n\t\n\t // push url into [media_url]\n\t body.media_urls.push(url);\n\t }\n\t\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete media\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMedia.prototype['delete'] = Media.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/media/' + this._id + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Media` module\n\t */\n\t\n\tmodule.exports = Media;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Like = __webpack_require__(8);\n\tvar Reblog = __webpack_require__(12);\n\tvar Comment = __webpack_require__(2);\n\tvar debug = __webpack_require__(1)('wpcom:post');\n\t\n\t/**\n\t * Post methods\n\t *\n\t * @param {String} id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Post(id, sid, wpcom) {\n\t if (!(this instanceof Post)) {\n\t return new Post(id, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t\n\t // set `id` and/or `slug` properties\n\t id = id || {};\n\t if ('object' !== typeof id) {\n\t this._id = id;\n\t } else {\n\t this._id = id.id;\n\t this._slug = id.slug;\n\t }\n\t}\n\t\n\t/**\n\t * Set post `id`\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tPost.prototype.id = function (id) {\n\t this._id = id;\n\t};\n\t\n\t/**\n\t * Set post `slug`\n\t *\n\t * @param {String} slug\n\t * @api public\n\t */\n\t\n\tPost.prototype.slug = function (slug) {\n\t this._slug = slug;\n\t};\n\t\n\t/**\n\t * Get post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.get = function (query, fn) {\n\t if (!this._id && this._slug) {\n\t return this.getBySlug(query, fn);\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/posts/' + this._id;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Get post by slug\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.getBySlug = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/slug:' + this._slug;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Add post\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.add = function (query, body, fn) {\n\t var _this = this;\n\t\n\t if (undefined === fn) {\n\t if (undefined === body) {\n\t body = query;\n\t query = {};\n\t } else if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/posts/new';\n\t\n\t return this.wpcom.req.post(path, query, body).then(function (data) {\n\t // update POST object\n\t _this._id = data.ID;\n\t debug('Set post _id: %s', _this._id);\n\t\n\t _this._slug = data.slug;\n\t debug('Set post _slug: %s', _this._slug);\n\t\n\t if ('function' === typeof fn) {\n\t fn(null, data);\n\t } else {\n\t return Promise.resolve(data);\n\t }\n\t })['catch'](function (err) {\n\t if ('function' === typeof fn) {\n\t fn(err);\n\t } else {\n\t return Promise.reject(error);\n\t }\n\t });\n\t};\n\t\n\t/**\n\t * Edit post\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.del = Post.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Restore post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.restore = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/restore';\n\t return this.wpcom.req.put(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Get post likes list\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.likesList = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/likes';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Search within a site for related posts\n\t *\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.related = function (body, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/related';\n\t return this.wpcom.req.put(path, body, null, fn);\n\t};\n\t\n\t/**\n\t * Create a `Like` instance\n\t *\n\t * @api public\n\t */\n\t\n\tPost.prototype.like = function () {\n\t return new Like(this._id, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Reblog` instance\n\t *\n\t * @api public\n\t */\n\t\n\tPost.prototype.reblog = function () {\n\t return new Reblog(this._id, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Comment` instance\n\t *\n\t * @param {String} [cid] comment id\n\t * @api public\n\t */\n\t\n\tPost.prototype.comment = function (cid) {\n\t return new Comment(cid, this._id, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Return recent comments\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.comments = function (query, fn) {\n\t var comment = new Comment(null, this._id, this._sid, this.wpcom);\n\t return comment.replies(query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Post` module\n\t */\n\t\n\tmodule.exports = Post;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:reblog');\n\t\n\t/**\n\t * Reblog methods\n\t *\n\t * @param {String} pid post id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Reblog(pid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!pid) {\n\t throw new Error('`post id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Reblog)) {\n\t return new Reblog(pid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._pid = pid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Get your reblog status for a Post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReblog.prototype.mine = Reblog.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Reblog a post\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReblog.prototype.add = function (query, body, fn) {\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t\n\t if (body && !body.destination_site_id) {\n\t return fn(new Error('destination_site_id is not defined'));\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/new';\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Reblog a post to\n\t * It's almost an alias of Reblogs#add\n\t *\n\t * @param {Number|String} dest site id destination\n\t * @param {String} [note]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReblog.prototype.to = function (dest, note, fn) {\n\t if (undefined === fn) {\n\t if (undefined === note) {\n\t note = null;\n\t } else if ('function' === typeof note) {\n\t fn = note;\n\t note = null;\n\t }\n\t }\n\t\n\t return this.add({ note: note, destination_site_id: dest }, fn);\n\t};\n\t\n\t/**\n\t * Expose `Reblog` module\n\t */\n\t\n\tmodule.exports = Reblog;\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Post = __webpack_require__(11);\n\tvar Category = __webpack_require__(5);\n\tvar Tag = __webpack_require__(14);\n\tvar Media = __webpack_require__(10);\n\tvar Comment = __webpack_require__(2);\n\tvar Follow = __webpack_require__(7);\n\tvar debug = __webpack_require__(1)('wpcom:site');\n\t\n\t/**\n\t * Resources array\n\t * A list of endpoints with the same structure\n\t */\n\t\n\tvar resources = ['categories', 'comments', 'follows', 'media', 'posts', 'shortcodes', 'embeds', ['pageTemplates', 'page-templates'], ['stats', 'stats'], ['statsClicks', 'stats/clicks'], ['statsComments', 'stats/comments'], ['statsCommentFollowers', 'stats/comment-followers'], ['statsCountryViews', 'stats/country-views'], ['statsFollowers', 'stats/followers'], ['statsPublicize', 'stats/publicize'], ['statsReferrers', 'stats/referrers'], ['statsSearchTerms', 'stats/search-terms'], ['statsStreak', 'stats/streak'], ['statsSummary', 'stats/summary'], ['statsTags', 'stats/tags'], ['statsTopAuthors', 'stats/top-authors'], ['statsTopPosts', 'stats/top-posts'], ['statsVideoPlays', 'stats/video-plays'], ['statsVisits', 'stats/visits'], 'tags', 'users'];\n\t\n\t/**\n\t * Create a Site instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Site(id, wpcom) {\n\t if (!(this instanceof Site)) {\n\t return new Site(id, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t\n\t debug('set %o site id', id);\n\t this._id = encodeURIComponent(id);\n\t}\n\t\n\t/**\n\t * Require site information\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.get = function (query, fn) {\n\t return this.wpcom.req.get('/sites/' + this._id, query, fn);\n\t};\n\t\n\t/**\n\t * List method builder\n\t *\n\t * @param {String} subpath\n\t * @param {Function}\n\t * @api private\n\t */\n\t\n\tfunction list(subpath) {\n\t\n\t /**\n\t * Create and return the List method\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\t var listMethod = function listMethod(query, fn) {\n\t var path = '/sites/' + this._id + '/' + subpath;\n\t return this.wpcom.req.get(path, query, fn);\n\t };\n\t listMethod._publicAPI = true;\n\t return listMethod;\n\t}\n\t\n\t// walk for each resource and create related method\n\tvar i, res, isarr, name, subpath;\n\tfor (i = 0; i < resources.length; i++) {\n\t res = resources[i];\n\t isarr = Array.isArray(res);\n\t\n\t name = isarr ? res[0] : res + 'List';\n\t subpath = isarr ? res[1] : res;\n\t\n\t debug('adding method: %o - sub-path: %o - version: %s', 'site.' + name + '()', subpath);\n\t Site.prototype[name] = list(subpath);\n\t}\n\t\n\t/**\n\t * :POST:\n\t * Create a `Post` instance\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tSite.prototype.post = function (id) {\n\t return new Post(id, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * :POST:\n\t * Add a new blog post\n\t *\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @return {Post} new Post instance\n\t */\n\t\n\tSite.prototype.addPost = function (body, fn) {\n\t var post = new Post(null, this._id, this.wpcom);\n\t return post.add(body, fn);\n\t};\n\t\n\t/**\n\t * :POST:\n\t * Delete a blog post\n\t *\n\t * @param {String} id\n\t * @param {Function} fn\n\t * @return {Post} remove Post instance\n\t */\n\t\n\tSite.prototype.deletePost = function (id, fn) {\n\t var post = new Post(id, this._id, this.wpcom);\n\t return post['delete'](fn);\n\t};\n\t\n\t/**\n\t * Create a `Media` instance\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tSite.prototype.media = function (id) {\n\t return new Media(id, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Add a media from a file\n\t *\n\t * @param {Object} [query]\n\t * @param {Array|String} files\n\t * @param {Function} fn\n\t * @return {Post} new Post instance\n\t */\n\t\n\tSite.prototype.addMediaFiles = function (query, files, fn) {\n\t var media = new Media(null, this._id, this.wpcom);\n\t return media.addFiles(query, files, fn);\n\t};\n\t\n\t/**\n\t * Add a new media from url\n\t *\n\t * @param {Object} [query]\n\t * @param {Array|String} files\n\t * @param {Function} fn\n\t * @return {Post} new Post instance\n\t */\n\t\n\tSite.prototype.addMediaUrls = function (query, files, fn) {\n\t var media = new Media(null, this._id, this.wpcom);\n\t return media.addUrls(query, files, fn);\n\t};\n\t\n\t/**\n\t * Delete a blog media\n\t *\n\t * @param {String} id\n\t * @param {Function} fn\n\t * @return {Post} removed Media instance\n\t */\n\t\n\tSite.prototype.deleteMedia = function (id, fn) {\n\t var media = new Media(id, this._id, this.wpcom);\n\t return media.del(fn);\n\t};\n\t\n\t/**\n\t * Create a `Comment` instance\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tSite.prototype.comment = function (id) {\n\t return new Comment(id, null, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Follow` instance\n\t *\n\t * @api public\n\t */\n\t\n\tSite.prototype.follow = function () {\n\t return new Follow(this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Category` instance\n\t * Set `cat` alias\n\t *\n\t * @param {String} [slug]\n\t * @api public\n\t */\n\t\n\tSite.prototype.cat = Site.prototype.category = function (slug) {\n\t return new Category(slug, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Tag` instance\n\t *\n\t * @param {String} [slug]\n\t * @api public\n\t */\n\t\n\tSite.prototype.tag = function (slug) {\n\t return new Tag(slug, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Get a rendered shortcode for a site.\n\t *\n\t * Note: The current user must have publishing access.\n\t *\n\t * @param {String} url\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.renderShortcode = function (url, query, fn) {\n\t if ('string' !== typeof url) {\n\t throw new TypeError('expected a url String');\n\t }\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t query = query || {};\n\t query.shortcode = url;\n\t\n\t var path = '/sites/' + this._id + '/shortcodes/render';\n\t\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Get a rendered embed for a site.\n\t *\n\t * Note: The current user must have publishing access.\n\t *\n\t * @param {String} url\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.renderEmbed = function (url, query, fn) {\n\t if ('string' !== typeof url) {\n\t throw new TypeError('expected an embed String');\n\t }\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t query = query || {};\n\t query.embed_url = url;\n\t\n\t var path = '/sites/' + this._id + '/embeds/render';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Mark a referrering domain as spam\n\t *\n\t * @param {String} domain\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsReferrersSpamNew = function (domain, fn) {\n\t var path = '/sites/' + this._id + '/stats/referrers/spam/new';\n\t var body = { domain: domain };\n\t\n\t return this.wpcom.req.post(path, body, null, fn);\n\t};\n\t\n\t/**\n\t * Remove referrering domain from spam\n\t *\n\t * @param {String} domain\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsReferrersSpamDelete = function (domain, fn) {\n\t var path = '/sites/' + this._id + '/stats/referrers/spam/delete';\n\t var body = { domain: domain };\n\t\n\t return this.wpcom.req.post(path, body, null, fn);\n\t};\n\t\n\t/**\n\t * Get detailed stats about a VideoPress video\n\t *\n\t * @param {String} videoId\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsVideo = function (videoId, query, fn) {\n\t var path = '/sites/' + this._id + '/stats/video/' + videoId;\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Get detailed stats about a particular post\n\t *\n\t * @param {String} postId\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsPostViews = function (postId, query, fn) {\n\t var path = '/sites/' + this._id + '/stats/post/' + postId;\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Site` module\n\t */\n\t\n\tmodule.exports = Site;\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:tag');\n\t\n\t/**\n\t * Tag methods\n\t *\n\t * @param {String} [slug]\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Tag(slug, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Tag)) {\n\t return new Tag(slug, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t this._slug = slug;\n\t}\n\t\n\t/**\n\t * Set tag `slug`\n\t *\n\t * @param {String} slug\n\t * @api public\n\t */\n\t\n\tTag.prototype.slug = function (slug) {\n\t this._slug = slug;\n\t};\n\t\n\t/**\n\t * Get tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Add tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype.add = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/tags/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Edit tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype['delete'] = Tag.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/tags/slug:' + this._slug + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Tag` module\n\t */\n\t\n\tmodule.exports = Tag;\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:users');\n\t\n\t/**\n\t * Create a `Users` instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Users(wpcom) {\n\t if (!(this instanceof Users)) {\n\t return new Users(wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t}\n\t\n\t/**\n\t * A list of @mention suggestions for the current user\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tUsers.prototype.suggest = function (query, fn) {\n\t return this.wpcom.req.get('/users/suggest', query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Users` module\n\t */\n\t\n\tmodule.exports = Users;\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar sendRequest = __webpack_require__(3);\n\tvar debug = __webpack_require__(1)('wpcom:request');\n\t\n\t/**\n\t * Expose `Request` module\n\t */\n\t\n\tfunction Req(wpcom) {\n\t this.wpcom = wpcom;\n\t}\n\t\n\t/**\n\t * Request methods\n\t *\n\t * @param {Object|String} params\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReq.prototype.get = function (params, query, fn) {\n\t // `query` is optional\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return sendRequest.call(this.wpcom, params, query, null, fn);\n\t};\n\t\n\t/**\n\t * Make `update` request\n\t *\n\t * @param {Object|String} params\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReq.prototype.post = Req.prototype.put = function (params, query, body, fn) {\n\t if (undefined === fn) {\n\t if (undefined === body) {\n\t body = query;\n\t query = {};\n\t } else if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t }\n\t\n\t // params can be a string\n\t params = 'string' === typeof params ? { path: params } : params;\n\t\n\t // request method\n\t params.method = 'post';\n\t\n\t return sendRequest.call(this.wpcom, params, query, body, fn);\n\t};\n\t\n\t/**\n\t * Make a `delete` request\n\t *\n\t * @param {Object|String} params\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReq.prototype.del = function (params, query, fn) {\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return this.post(params, query, null, fn);\n\t};\n\t\n\t/**\n\t * Expose module\n\t */\n\t\n\tmodule.exports = Req;\n\n/***/ },\n/* 17 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_17__;\n\n/***/ },\n/* 18 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_18__;\n\n/***/ },\n/* 19 */\n/***/ function(module, exports) {\n\n\tmodule.exports = __WEBPACK_EXTERNAL_MODULE_19__;\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** wpcom.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 41e2087e1f8266bcbb99\n **/","\n\n/**\n * Module dependencies.\n */\n\nvar request_handler = require('wpcom-xhr-request');\n\n/**\n * Local module dependencies.\n */\n\nvar Me = require('./lib/me');\nvar Site = require('./lib/site');\nvar Users = require('./lib/users');\nvar Batch = require('./lib/batch');\nvar Req = require('./lib/util/request');\nvar sendRequest = require('./lib/util/send-request');\nvar debug = require('debug')('wpcom');\n\n/**\n * Local module constants\n */\nvar DEFAULT_ASYNC_TIMEOUT = 30000;\n\n/**\n * XMLHttpRequest (and CORS) API access method.\n *\n * API authentication is done via an (optional) access `token`,\n * which needs to be retrieved via OAuth.\n *\n * Request Handler is optional and XHR is defined as default.\n *\n * @param {String} [token] - OAuth API access token\n * @param {Function} [reqHandler] - function Request Handler\n * @public\n */\n\nfunction WPCOM(token, reqHandler) {\n if (!(this instanceof WPCOM)) {\n return new WPCOM(token, reqHandler);\n }\n\n // `token` is optional\n if ('function' === typeof token) {\n reqHandler = token;\n token = null;\n }\n\n if (token) {\n debug('Token defined: %s…', token.substring(0, 6));\n this.token = token;\n }\n\n // Set default request handler\n if (!reqHandler) {\n debug('No request handler. Adding default XHR request handler');\n\n this.request = function (params, fn) {\n params = params || {};\n\n // token is optional\n if (token) {\n params.authToken = token;\n }\n\n return request_handler(params, fn);\n };\n } else {\n this.request = reqHandler;\n }\n\n // Add Req instance\n this.req = new Req(this);\n\n // Default api version;\n this.apiVersion = '1.1';\n}\n\n/**\n * Get `Me` object instance\n *\n * @api public\n */\n\nWPCOM.prototype.me = function () {\n return new Me(this);\n};\n\n/**\n * Get `Site` object instance\n *\n * @param {String} id\n * @api public\n */\n\nWPCOM.prototype.site = function (id) {\n return new Site(id, this);\n};\n\n/**\n * Get `Users` object instance\n *\n * @api public\n */\n\nWPCOM.prototype.users = function () {\n return new Users(this);\n};\n\n\nWPCOM.prototype.batch = function () {\n return new Batch(this);\n};\n\n/**\n * List Freshly Pressed Posts\n *\n * @param {Object} [query]\n * @param {Function} fn callback function\n * @api public\n */\n\nWPCOM.prototype.freshlyPressed = function (query, fn) {\n return this.req.get('/freshly-pressed', query, fn);\n};\n\n/**\n * Expose send-request\n * @TODO: use `this.req` instead of this method\n */\n\nWPCOM.prototype.sendRequest = function (params, query, body, fn) {\n var msg = 'WARN! Don use `sendRequest() anymore. Use `this.req` method.';\n if (console && console.warn) {\n console.warn(msg);\n } else {\n console.log(msg);\n }\n\n return sendRequest.call(this, params, query, body, fn)\n};\n\n/**\n * Wraps a library callback into a Promise\n *\n * Remember to bind the method to its parent\n * context - extracting it out otherwise removes it.\n *\n * E.g.\n * wpcom.Promise( comment.del.bind( comment ) );\n *\n * The promise rejects if the normal error return from\n * an API call is not empty. It resolves otherwise.\n *\n * @param {function} callback wpcom.js method to call\n * @param params variable list of parameters to send to callback\n * @returns {Promise}\n */\nWPCOM.prototype.Promise = ( callback, ...params ) => {\n return new Promise( ( resolve, reject ) => {\n // The functions here take a variable number of arguments,\n // so pass in as many as we can but keep the callback last.\n callback.apply( callback, [...params, ( error, data ) => {\n error ? reject( error ) : resolve( data );\n } ] );\n } );\n};\n\nif ( ! Promise.prototype.timeout ) {\n\t/**\n * Returns a new promise with a deadline\n *\n * After the timeout interval, the promise will\n * reject. If the actual promise settles before\n * the deadline, the timer is cancelled.\n *\n * @param {number} delay how many ms to wait\n * @returns {Promise}\n */\n Promise.prototype.timeout = function( delay = DEFAULT_ASYNC_TIMEOUT ) {\n let cancelTimeout, timer, timeout;\n\n timeout = new Promise( ( resolve, reject ) => {\n timer = setTimeout( () => {\n reject( new Error( 'Action timed out while waiting for response.' ) );\n }, delay );\n } );\n\n cancelTimeout = () => {\n clearTimeout( timer );\n return this;\n };\n\n return Promise.race( [ this.then( cancelTimeout ).catch( cancelTimeout ), timeout ] );\n };\n}\n\n/**\n * Expose `WPCOM` module\n */\n\nmodule.exports = WPCOM;\n\n\n\n/** WEBPACK FOOTER **\n ** ./wpcom.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"debug\"\n ** module id = 1\n ** module chunks = 0\n **/","\n/**\n * Module dependencies.\n */\n\nvar CommentLike = require('./commentlike');\nvar debug = require('debug')('wpcom:comment');\n\n/**\n * Comment methods\n *\n * @param {String} [cid] comment id\n * @param {String} [pid] post id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Comment(cid, pid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Comment)) {\n return new Comment(cid, pid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._cid = cid;\n this._pid = pid;\n this._sid = sid;\n}\n\n/**\n * Return a single Comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Return recent comments for a post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.replies = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Create a comment on a post\n *\n * @param {Object} [query]\n * @param {String|Object} body\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.add = function (query, body, fn) {\n if ( undefined === fn ) {\n if ( undefined === body ) {\n body = query;\n query = {};\n } else if ( 'function' === typeof body ) {\n fn = body;\n body = query;\n query = {};\n }\n }\n\n body = 'string' === typeof body ? { content: body } : body;\n\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Edit a comment\n *\n * @param {Object} [query]\n * @param {String|Object} body\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.update = function (query, body, fn) {\n if ('function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n\n body = 'string' === typeof body ? { content: body } : body;\n\n var path = '/sites/' + this._sid + '/comments/' + this._cid;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Create a Comment as a reply to another Comment\n *\n * @param {Object} [query]\n * @param {String|Object} body\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.reply = function (query, body, fn) {\n if ('function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n\n body = 'string' === typeof body ? { content: body } : body;\n\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/replies/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Delete a comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.del =\nComment.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Create a `CommentLike` instance\n *\n * @api public\n */\n\nComment.prototype.like = function() {\n return CommentLike(this._cid, this._sid, this.wpcom);\n};\n\n/**\n * Get comment likes list\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.likesList = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Expose `Comment` module\n */\n\nmodule.exports = Comment;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/comment.js\n **/","\n/**\n * Module dependencies\n */\n\nvar qs = require('qs');\nvar debug = require('debug')('wpcom:send-request');\nvar debug_res = require('debug')('wpcom:send-request:res');\n\n/**\n * Request to WordPress REST API\n *\n * @param {String|Object} params\n * @param {Object} [query]\n * @param {Object} [body]\n * @param {Function} fn\n * @api private\n */\n\nmodule.exports = function (params, query, body, fn) {\n // `params` can be just the path (String)\n params = 'string' === typeof params ? { path : params } : params;\n\n debug('sendRequest(%o)', params.path);\n\n // set `method` request param\n params.method = (params.method || 'get').toUpperCase();\n\n // `query` is optional\n if ('function' === typeof query) {\n fn = query;\n query = {};\n }\n\n // `body` is optional\n if ('function' === typeof body) {\n fn = body;\n body = null;\n }\n\n // query could be `null`\n query = query || {};\n\n // Handle special query parameters\n // - `apiVersion`\n if (query.apiVersion) {\n params.apiVersion = query.apiVersion;\n debug('apiVersion: %o', params.apiVersion);\n delete query.apiVersion;\n } else {\n params.apiVersion = this.apiVersion;\n }\n\n // - `proxyOrigin`\n if (query.proxyOrigin) {\n params.proxyOrigin = query.proxyOrigin;\n debug('proxyOrigin: %o', params.proxyOrigin);\n delete query.proxyOrigin;\n }\n\n // Stringify query object before to send\n query = qs.stringify(query, { arrayFormat: 'brackets' });\n\n // pass `query` and/or `body` to request params\n params.query = query;\n\n if (body) {\n params.body = body;\n }\n debug('params: %o', params);\n\n // if callback is provided, behave traditionally\n if ('function' === typeof fn) {\n // request method\n return this.request(params, function(err, res) {\n debug_res(res);\n fn(err, res);\n });\n }\n\n // but if not, return a Promise\n return new Promise((resolve, reject) => {\n this.request(params, (err, res) => {\n debug_res(res);\n err ? reject(err) : resolve(res);\n });\n } );\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/util/send-request.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:batch');\n\n/**\n * Create a `Batch` instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Batch(wpcom) {\n if (!(this instanceof Batch)) {\n return new Batch(wpcom);\n }\n\n this.wpcom = wpcom;\n\n this.urls = [];\n}\n\n/**\n * Add url to batch requests\n *\n * @param {String} url\n * @api public\n */\n\nBatch.prototype.add = function (url) {\n this.urls.push(url);\n return this;\n};\n\n/**\n * Run the batch request\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nBatch.prototype.run = function (query={}, fn) {\n if ('function' === typeof query) {\n fn = query;\n query = {};\n }\n\n // add urls to query object\n query['urls'] = this.urls;\n\n return this.wpcom.req.get('/batch', query, fn);\n};\n\n/**\n * Expose `Batch` module\n */\n\nmodule.exports = Batch;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/batch.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:category');\n\n/**\n * Category methods\n *\n * @param {String} [slug]\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Category(slug, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Category)) {\n return new Category(slug, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n this._slug = slug;\n}\n\n/**\n * Set category `slug`\n *\n * @param {String} slug\n * @api public\n */\n\nCategory.prototype.slug = function (slug) {\n this._slug = slug;\n};\n\n/**\n * Get category\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Add category\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype.add = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/categories/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Edit category\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Delete category\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype['delete'] = Category.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/categories/slug:' + this._slug + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Category` module\n */\n\nmodule.exports = Category;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/category.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:commentlike');\n\n/**\n * CommentLike methods\n *\n * @param {String} cid comment id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction CommentLike(cid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!cid) {\n throw new Error('`comment id` is not correctly defined');\n }\n\n if (!(this instanceof CommentLike)) {\n return new CommentLike(cid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._cid = cid;\n this._sid = sid;\n}\n\n/**\n * Get your Like status for a Comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCommentLike.prototype.mine =\nCommentLike.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Like a comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCommentLike.prototype.add = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/new';\n return this.wpcom.req.post(path, query, fn);\n};\n\n/**\n * Remove your Like from a Comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCommentLike.prototype.del =\nCommentLike.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `CommentLike` module\n */\n\nmodule.exports = CommentLike;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/commentlike.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:follow');\n\n/**\n * Follow \n *\n * @param {String} site_id - site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Follow(site_id, wpcom) {\n if (!site_id) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Follow)) {\n return new Follow(site_id, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = site_id;\n}\n\n/**\n * Get the follow status for current \n * user on current blog sites\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nFollow.prototype.mine =\nFollow.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/follows/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Follow the site\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nFollow.prototype.follow =\nFollow.prototype.add = function (query, fn) {\n var path = '/sites/' + this._sid + '/follows/new';\n return this.wpcom.req.put(path, query, null, fn);\n};\n\n/**\n * Unfollow the site\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nFollow.prototype.unfollow =\nFollow.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/follows/mine/delete';\n return this.wpcom.req.del(path, query, null, fn);\n};\n\n/**\n * Expose `Follow` module\n */\n\nmodule.exports = Follow;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/follow.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:like');\n\n/**\n * Like methods\n *\n * @param {String} pid post id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Like(pid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!pid) {\n throw new Error('`post id` is not correctly defined');\n }\n\n if (!(this instanceof Like)) {\n return new Like(pid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._pid = pid;\n this._sid = sid;\n}\n\n/**\n * Get your Like status for a Post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nLike.prototype.mine =\nLike.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Like a post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nLike.prototype.add = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/new';\n return this.wpcom.req.put(path, query, null, fn);\n};\n\n/**\n * Remove your Like from a Post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nLike.prototype.del =\nLike.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Like` module\n */\n\nmodule.exports = Like;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/like.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:me');\n\n/**\n * Create a `Me` instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Me(wpcom) {\n if (!(this instanceof Me)) {\n return new Me(wpcom);\n }\n\n this.wpcom = wpcom;\n}\n\n/**\n * Meta data about auth token's User\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.get = function (query, fn) {\n return this.wpcom.req.get('/me', query, fn);\n};\n\n/**\n * A list of the current user's sites\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api private\n */\n\nMe.prototype.sites = function (query, fn) {\n return this.wpcom.req.get('/me/sites', query, fn);\n};\n\n/**\n * List the currently authorized user's likes\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.likes = function (query, fn) {\n return this.wpcom.req.get('/me/likes', query, fn);\n};\n\n/**\n * A list of the current user's group\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.groups = function (query, fn) {\n return this.wpcom.req.get('/me/groups', query, fn);\n};\n\n/**\n * A list of the current user's connections to third-party services\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.connections = function (query, fn) {\n return this.wpcom.req.get('/me/connections', query, fn);\n};\n\n/**\n * Expose `Me` module\n */\n\nmodule.exports = Me;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/me.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar fs = require('fs');\nvar debug = require('debug')('wpcom:media');\n\n/**\n * Default\n */\n\nvar def = {\n \"apiVersion\": \"1.1\"\n};\n\n/**\n * Media methods\n *\n * @param {String} id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Media(id, sid, wpcom) {\n if (!(this instanceof Media)) {\n return new Media(id, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n this._id = id;\n\n if (!this._id) {\n debug('WARN: media `id` is not defined');\n }\n}\n\n/**\n * Get media\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMedia.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/media/' + this._id;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Edit media\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nMedia.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/media/' + this._id;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Add media file\n *\n * @param {Object} [query]\n * @param {String|Object|Array} files\n * @param {Function} fn\n */\n\nMedia.prototype.addFiles = function (query, files, fn) {\n if ( undefined === fn ) {\n if ( undefined === files ) {\n files = query;\n query = {};\n } else if ( 'function' === typeof files ) {\n fn = files;\n files = query;\n query = {};\n }\n }\n\n var params = {\n path: '/sites/' + this._sid + '/media/new',\n formData: []\n };\n\n // process formData\n files = Array.isArray(files) ? files : [files];\n\n var i, f, isStream, isFile, k, param;\n for (i = 0; i < files.length; i++) {\n f = files[i];\n f = 'string' === typeof f ? fs.createReadStream(f) : f;\n\n isStream = !!f._readableState;\n isFile = 'undefined' !== typeof File && f instanceof File;\n\n debug('is stream: %s', isStream);\n debug('is file: %s', isFile);\n\n if (!isFile && !isStream) {\n // process file attributes like as `title`, `description`, ...\n for (k in f) {\n debug('add %o => %o', k, f[k]);\n if ('file' !== k) {\n param = 'attrs[' + i + '][' + k + ']';\n params.formData.push([param, f[k]]);\n }\n }\n // set file path\n f = f.file;\n f = 'string' === typeof f ? fs.createReadStream(f) : f;\n }\n\n params.formData.push(['media[]', f]);\n }\n\n return this.wpcom.req.post(params, query, null, fn);\n};\n\n/**\n * Add media files from URL\n *\n * @param {Object} [query]\n * @param {String|Array|Object} files\n * @param {Function} fn\n */\n\nMedia.prototype.addUrls = function (query, media, fn) {\n if ( undefined === fn ) {\n if ( undefined === media ) {\n media = query;\n query = {};\n } else if ( 'function' === typeof media ) {\n fn = media;\n media = query;\n query = {};\n }\n }\n\n var path = '/sites/' + this._sid + '/media/new';\n var body = { media_urls: [] };\n\n // process formData\n var i, m, url, k;\n\n media = Array.isArray(media) ? media : [ media ];\n for (i = 0; i < media.length; i++) {\n m = media[i];\n\n if ('string' === typeof m) {\n url = m;\n } else {\n if (!body.attrs) {\n body.attrs = [];\n }\n\n // add attributes\n body.attrs[i] = {};\n for (k in m) {\n if ('url' !== k) {\n body.attrs[i][k] = m[k];\n }\n }\n url = m[k];\n }\n\n // push url into [media_url]\n body.media_urls.push(url);\n }\n\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Delete media\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMedia.prototype['delete'] = Media.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/media/' + this._id + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Media` module\n */\n\nmodule.exports = Media;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/media.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar Like = require('./like');\nvar Reblog = require('./reblog');\nvar Comment = require('./comment');\nvar debug = require('debug')('wpcom:post');\n\n/**\n * Post methods\n *\n * @param {String} id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Post(id, sid, wpcom) {\n if (!(this instanceof Post)) {\n return new Post(id, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n\n // set `id` and/or `slug` properties\n id = id || {};\n if ('object' !== typeof id) {\n this._id = id;\n } else {\n this._id = id.id;\n this._slug = id.slug;\n }\n}\n\n/**\n * Set post `id`\n *\n * @param {String} id\n * @api public\n */\n\nPost.prototype.id = function (id) {\n this._id = id;\n};\n\n/**\n * Set post `slug`\n *\n * @param {String} slug\n * @api public\n */\n\nPost.prototype.slug = function (slug) {\n this._slug = slug;\n};\n\n/**\n * Get post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.get = function (query, fn) {\n if (!this._id && this._slug) {\n return this.getBySlug(query, fn);\n }\n\n var path = '/sites/' + this._sid + '/posts/' + this._id;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Get post by slug\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.getBySlug = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/slug:' + this._slug;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Add post\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.add = function (query, body, fn) {\n if ( undefined === fn ) {\n if ( undefined === body ) {\n body = query;\n query = {};\n } else if ( 'function' === typeof body ) {\n fn = body;\n body = query;\n query = {};\n }\n }\n\n var path = '/sites/' + this._sid + '/posts/new';\n\n return this.wpcom.req.post(path, query, body)\n .then(data => {\n // update POST object\n this._id = data.ID;\n debug('Set post _id: %s', this._id);\n\n this._slug = data.slug;\n debug('Set post _slug: %s', this._slug);\n\n if ( 'function' === typeof fn ) {\n fn(null, data);\n } else {\n return Promise.resolve( data );\n }\n })\n .catch(err => {\n if ( 'function' === typeof fn ) {\n fn(err);\n } else {\n return Promise.reject( error );\n }\n });\n};\n\n/**\n * Edit post\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Delete post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.del =\nPost.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Restore post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.restore = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/restore';\n return this.wpcom.req.put(path, query, null, fn);\n};\n\n/**\n * Get post likes list\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.likesList = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/likes';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Search within a site for related posts\n *\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.related = function (body, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/related';\n return this.wpcom.req.put(path, body, null, fn);\n};\n\n/**\n * Create a `Like` instance\n *\n * @api public\n */\n\nPost.prototype.like = function () {\n return new Like(this._id, this._sid, this.wpcom);\n};\n\n/**\n * Create a `Reblog` instance\n *\n * @api public\n */\n\nPost.prototype.reblog = function () {\n return new Reblog(this._id, this._sid, this.wpcom);\n};\n\n/**\n * Create a `Comment` instance\n *\n * @param {String} [cid] comment id\n * @api public\n */\n\nPost.prototype.comment = function (cid) {\n return new Comment(cid, this._id, this._sid, this.wpcom);\n};\n\n/**\n * Return recent comments\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.comments = function (query, fn) {\n var comment = new Comment(null, this._id, this._sid, this.wpcom);\n return comment.replies(query, fn);\n};\n\n/**\n * Expose `Post` module\n */\n\nmodule.exports = Post;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/post.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:reblog');\n\n/**\n * Reblog methods\n *\n * @param {String} pid post id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Reblog(pid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!pid) {\n throw new Error('`post id` is not correctly defined');\n }\n\n if (!(this instanceof Reblog)) {\n return new Reblog(pid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._pid = pid;\n this._sid = sid;\n}\n\n/**\n * Get your reblog status for a Post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nReblog.prototype.mine =\nReblog.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Reblog a post\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nReblog.prototype.add = function (query, body, fn) {\n if ('function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n\n if (body && !body.destination_site_id) {\n return fn(new Error('destination_site_id is not defined'));\n }\n\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/new';\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Reblog a post to\n * It's almost an alias of Reblogs#add\n *\n * @param {Number|String} dest site id destination\n * @param {String} [note]\n * @param {Function} fn\n * @api public\n */\n\nReblog.prototype.to = function (dest, note, fn) {\n if ( undefined === fn ) {\n if ( undefined === note ) {\n note = null;\n } else if ('function' === typeof note) {\n fn = note;\n note = null;\n }\n }\n\n return this.add({ note: note, destination_site_id: dest }, fn);\n};\n\n/**\n * Expose `Reblog` module\n */\n\nmodule.exports = Reblog;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/reblog.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar Post = require('./post');\nvar Category = require('./category');\nvar Tag = require('./tag');\nvar Media = require('./media');\nvar Comment = require('./comment');\nvar Follow = require('./follow');\nvar debug = require('debug')('wpcom:site');\n\n/**\n * Resources array\n * A list of endpoints with the same structure\n */\n\nvar resources = [\n 'categories',\n 'comments',\n 'follows',\n 'media',\n 'posts',\n 'shortcodes',\n 'embeds',\n [ 'pageTemplates', 'page-templates' ],\n [ 'stats', 'stats' ],\n [ 'statsClicks', 'stats/clicks' ],\n [ 'statsComments', 'stats/comments' ],\n [ 'statsCommentFollowers', 'stats/comment-followers' ],\n [ 'statsCountryViews', 'stats/country-views' ],\n [ 'statsFollowers', 'stats/followers' ],\n [ 'statsPublicize', 'stats/publicize' ],\n [ 'statsReferrers', 'stats/referrers' ],\n [ 'statsSearchTerms', 'stats/search-terms' ],\n [ 'statsStreak', 'stats/streak' ],\n [ 'statsSummary', 'stats/summary' ],\n [ 'statsTags', 'stats/tags' ],\n [ 'statsTopAuthors', 'stats/top-authors' ],\n [ 'statsTopPosts', 'stats/top-posts' ],\n [ 'statsVideoPlays', 'stats/video-plays' ],\n [ 'statsVisits', 'stats/visits' ],\n 'tags',\n 'users'\n];\n\n/**\n * Create a Site instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Site(id, wpcom) {\n if (!(this instanceof Site)) {\n return new Site(id, wpcom);\n }\n\n this.wpcom = wpcom;\n\n debug('set %o site id', id);\n this._id = encodeURIComponent(id);\n}\n\n/**\n * Require site information\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.get = function (query, fn) {\n return this.wpcom.req.get('/sites/' + this._id, query, fn);\n};\n\n/**\n * List method builder\n *\n * @param {String} subpath\n * @param {Function}\n * @api private\n */\n\nfunction list(subpath) {\n\n /**\n * Create and return the List method\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\n var listMethod = function (query, fn) {\n var path = '/sites/' + this._id + '/' + subpath;\n return this.wpcom.req.get(path, query, fn);\n };\n listMethod._publicAPI = true;\n return listMethod;\n}\n\n// walk for each resource and create related method\nvar i, res, isarr, name, subpath;\nfor (i = 0; i < resources.length; i++) {\n res = resources[i];\n isarr = Array.isArray(res);\n\n name = isarr ? res[0] : res + 'List';\n subpath = isarr ? res[1] : res;\n\n debug('adding method: %o - sub-path: %o - version: %s', ('site.' + name + '()'), subpath);\n Site.prototype[name] = list(subpath);\n}\n\n/**\n * :POST:\n * Create a `Post` instance\n *\n * @param {String} id\n * @api public\n */\n\nSite.prototype.post = function (id) {\n return new Post(id, this._id, this.wpcom);\n};\n\n/**\n * :POST:\n * Add a new blog post\n *\n * @param {Object} body\n * @param {Function} fn\n * @return {Post} new Post instance\n */\n\nSite.prototype.addPost = function (body, fn) {\n var post = new Post(null, this._id, this.wpcom);\n return post.add(body, fn);\n};\n\n/**\n * :POST:\n * Delete a blog post\n *\n * @param {String} id\n * @param {Function} fn\n * @return {Post} remove Post instance\n */\n\nSite.prototype.deletePost = function (id, fn) {\n var post = new Post(id, this._id, this.wpcom);\n return post.delete(fn);\n};\n\n/**\n * Create a `Media` instance\n *\n * @param {String} id\n * @api public\n */\n\nSite.prototype.media = function (id) {\n return new Media(id, this._id, this.wpcom);\n};\n\n/**\n * Add a media from a file\n *\n * @param {Object} [query]\n * @param {Array|String} files\n * @param {Function} fn\n * @return {Post} new Post instance\n */\n\nSite.prototype.addMediaFiles = function (query, files, fn) {\n var media = new Media(null, this._id, this.wpcom);\n return media.addFiles(query, files, fn);\n};\n\n/**\n * Add a new media from url\n *\n * @param {Object} [query]\n * @param {Array|String} files\n * @param {Function} fn\n * @return {Post} new Post instance\n */\n\nSite.prototype.addMediaUrls = function (query, files, fn) {\n var media = new Media(null, this._id, this.wpcom);\n return media.addUrls(query, files, fn);\n};\n\n/**\n * Delete a blog media\n *\n * @param {String} id\n * @param {Function} fn\n * @return {Post} removed Media instance\n */\n\nSite.prototype.deleteMedia = function (id, fn) {\n var media = new Media(id, this._id, this.wpcom);\n return media.del(fn);\n};\n\n/**\n * Create a `Comment` instance\n *\n * @param {String} id\n * @api public\n */\n\nSite.prototype.comment = function (id) {\n return new Comment(id, null, this._id, this.wpcom);\n};\n\n/**\n * Create a `Follow` instance\n *\n * @api public\n */\n\nSite.prototype.follow = function () {\n return new Follow(this._id, this.wpcom);\n};\n\n/**\n * Create a `Category` instance\n * Set `cat` alias\n *\n * @param {String} [slug]\n * @api public\n */\n\nSite.prototype.cat = Site.prototype.category = function (slug) {\n return new Category(slug, this._id, this.wpcom);\n};\n\n/**\n * Create a `Tag` instance\n *\n * @param {String} [slug]\n * @api public\n */\n\nSite.prototype.tag = function (slug) {\n return new Tag(slug, this._id, this.wpcom);\n};\n\n/**\n * Get a rendered shortcode for a site.\n *\n * Note: The current user must have publishing access.\n *\n * @param {String} url\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.renderShortcode = function (url, query, fn) {\n if ('string' !== typeof url) {\n throw new TypeError('expected a url String');\n }\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n query = query || {};\n query.shortcode = url;\n\n var path = '/sites/' + this._id + '/shortcodes/render';\n\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Get a rendered embed for a site.\n *\n * Note: The current user must have publishing access.\n *\n * @param {String} url\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.renderEmbed = function (url, query, fn) {\n if ('string' !== typeof url) {\n throw new TypeError('expected an embed String');\n }\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n query = query || {};\n query.embed_url = url;\n\n var path = '/sites/' + this._id + '/embeds/render';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Mark a referrering domain as spam\n *\n * @param {String} domain\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsReferrersSpamNew = function (domain, fn) {\n var path = '/sites/' + this._id + '/stats/referrers/spam/new';\n var body = { domain: domain };\n\n return this.wpcom.req.post(path, body, null, fn);\n};\n\n/**\n * Remove referrering domain from spam\n *\n * @param {String} domain\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsReferrersSpamDelete = function (domain, fn) {\n var path = '/sites/' + this._id + '/stats/referrers/spam/delete';\n var body = { domain: domain };\n\n return this.wpcom.req.post(path, body, null, fn);\n};\n\n/**\n * Get detailed stats about a VideoPress video\n *\n * @param {String} videoId\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsVideo = function (videoId, query, fn) {\n var path = '/sites/' + this._id + '/stats/video/' + videoId;\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Get detailed stats about a particular post\n *\n * @param {String} postId\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsPostViews = function (postId, query, fn) {\n var path = '/sites/' + this._id + '/stats/post/' + postId;\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Expose `Site` module\n */\n\nmodule.exports = Site;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/site.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:tag');\n\n/**\n * Tag methods\n *\n * @param {String} [slug]\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Tag(slug, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Tag)) {\n return new Tag(slug, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n this._slug = slug;\n}\n\n/**\n * Set tag `slug`\n *\n * @param {String} slug\n * @api public\n */\n\nTag.prototype.slug = function (slug) {\n this._slug = slug;\n};\n\n/**\n * Get tag\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Add tag\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype.add = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/tags/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Edit tag\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Delete tag\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype['delete'] = Tag.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/tags/slug:' + this._slug + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Tag` module\n */\n\nmodule.exports = Tag;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/tag.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:users');\n\n/**\n * Create a `Users` instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Users(wpcom) {\n if (!(this instanceof Users)) {\n return new Users(wpcom);\n }\n\n this.wpcom = wpcom;\n}\n\n/**\n * A list of @mention suggestions for the current user\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nUsers.prototype.suggest = function (query, fn) {\n return this.wpcom.req.get('/users/suggest', query, fn);\n};\n\n/**\n * Expose `Users` module\n */\n\nmodule.exports = Users;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/users.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar sendRequest = require('./send-request');\nvar debug = require('debug')('wpcom:request');\n\n/**\n * Expose `Request` module\n */\n\n\nfunction Req(wpcom) {\n this.wpcom = wpcom;\n}\n\n/**\n * Request methods\n *\n * @param {Object|String} params\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nReq.prototype.get = function (params, query, fn) {\n // `query` is optional\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return sendRequest.call(this.wpcom, params, query, null, fn);\n};\n\n/**\n * Make `update` request\n *\n * @param {Object|String} params\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nReq.prototype.post =\nReq.prototype.put = function (params, query, body, fn) {\n if (undefined === fn) {\n if (undefined === body) {\n body = query;\n query = {}\n } else if ( 'function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n }\n\n // params can be a string\n params = 'string' === typeof params ? { path : params } : params;\n\n // request method\n params.method = 'post';\n\n return sendRequest.call(this.wpcom, params, query, body, fn);\n};\n\n/**\n * Make a `delete` request\n *\n * @param {Object|String} params\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nReq.prototype.del = function (params, query, fn) {\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return this.post(params, query, null, fn);\n};\n\n/**\n * Expose module\n */\n\nmodule.exports = Req;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/util/request.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_17__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fs\"\n ** module id = 17\n ** module chunks = 0\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_18__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"qs\"\n ** module id = 18\n ** module chunks = 0\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_19__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"wpcom-xhr-request\"\n ** module id = 19\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/index.js b/index.js index 0ac57ce..3556056 100644 --- a/index.js +++ b/index.js @@ -1 +1,2 @@ -module.exports=function(t){function e(s){if(i[s])return i[s].exports;var o=i[s]={exports:{},id:s,loaded:!1};return t[s].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){function s(t,e){return this instanceof s?("function"==typeof t&&(e=t,t=null),t&&(h("Token defined: %s…",t.substring(0,6)),this.token=t),e?this.request=e:(h("No request handler. Adding default XHR request handler"),this.request=function(e,i){return e=e||{},t&&(e.authToken=t),o(e,i)}),this.req=new c(this),void(this.apiVersion="1.1")):new s(t,e)}var o=i(19),r=i(9),n=i(13),p=i(15),u=i(4),c=i(16),d=i(3),h=i(1)("wpcom"),a=3e4;s.prototype.me=function(){return new r(this)},s.prototype.site=function(t){return new n(t,this)},s.prototype.users=function(){return new p(this)},s.prototype.batch=function(){return new u(this)},s.prototype.freshlyPressed=function(t,e){return this.req.get("/freshly-pressed",t,e)},s.prototype.sendRequest=function(t,e,i,s){var o="WARN! Don use `sendRequest() anymore. Use `this.req` method.";return console&&console.warn?console.warn(o):console.log(o),d.call(this,t,e,i,s)},s.prototype.Promise=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),s=1;e>s;s++)i[s-1]=arguments[s];return new Promise(function(e,s){t.apply(t,[].concat(i,[function(t,i){t?s(t):e(i)}]))})},Promise.prototype.timeout||(Promise.prototype.timeout=function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?a:arguments[0],i=void 0,s=void 0,o=void 0;return o=new Promise(function(t,i){s=setTimeout(function(){i(new Error("Action timed out while waiting for response."))},e)}),i=function(){return clearTimeout(s),t},Promise.race([this.then(i)["catch"](i),o])}),t.exports=s},function(t,e){t.exports=require("debug")},function(t,e,i){function s(t,e,i,o){if(!i)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=o,this._cid=t,this._pid=e,void(this._sid=i)):new s(t,e,i,o)}var o=i(6);i(1)("wpcom:comment");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.get(i,t,e)},s.prototype.replies=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/replies/";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={})),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/posts/"+this._pid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.put(s,t,e,i)},s.prototype.reply=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/delete";return this.wpcom.req.del(i,t,e)},s.prototype.like=function(){return o(this._cid,this._sid,this.wpcom)},s.prototype.likesList=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes";return this.wpcom.req.get(i,t,e)},t.exports=s},function(t,e,i){var s=i(18),o=i(1)("wpcom:send-request"),r=i(1)("wpcom:send-request:res");t.exports=function(t,e,i,n){var p=this;return t="string"==typeof t?{path:t}:t,o("sendRequest(%o)",t.path),t.method=(t.method||"get").toUpperCase(),"function"==typeof e&&(n=e,e={}),"function"==typeof i&&(n=i,i=null),e=e||{},e.apiVersion?(t.apiVersion=e.apiVersion,o("apiVersion: %o",t.apiVersion),delete e.apiVersion):t.apiVersion=this.apiVersion,e.proxyOrigin&&(t.proxyOrigin=e.proxyOrigin,o("proxyOrigin: %o",t.proxyOrigin),delete e.proxyOrigin),e=s.stringify(e,{arrayFormat:"brackets"}),t.query=e,i&&(t.body=i),o("params: %o",t),"function"==typeof n?this.request(t,function(t,e){r(e),n(t,e)}):new Promise(function(e,i){p.request(t,function(t,s){r(s),t?i(t):e(s)})})}},function(t,e,i){function s(t){return this instanceof s?(this.wpcom=t,void(this.urls=[])):new s(t)}i(1)("wpcom:batch");s.prototype.add=function(t){return this.urls.push(t),this},s.prototype.run=function(t,e){return void 0===t&&(t={}),"function"==typeof t&&(e=t,t={}),t.urls=this.urls,this.wpcom.req.get("/batch",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._sid=e,void(this._slug=t)):new s(t,e,i)}i(1)("wpcom:category");s.prototype.slug=function(t){this._slug=t},s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){var s="/sites/"+this._sid+"/categories/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.put(s,t,e,i)},s.prototype["delete"]=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug+"/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`comment id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._cid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:commentlike");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/new";return this.wpcom.req.post(i,t,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e){if(!t)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=e,void(this._sid=t)):new s(t,e)}i(1)("wpcom:follow");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/follows/mine";return this.wpcom.req.get(i,t,e)},s.prototype.follow=s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/follows/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.unfollow=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/follows/mine/delete";return this.wpcom.req.del(i,t,null,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`post id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._pid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:like");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t){return this instanceof s?void(this.wpcom=t):new s(t)}i(1)("wpcom:me");s.prototype.get=function(t,e){return this.wpcom.req.get("/me",t,e)},s.prototype.sites=function(t,e){return this.wpcom.req.get("/me/sites",t,e)},s.prototype.likes=function(t,e){return this.wpcom.req.get("/me/likes",t,e)},s.prototype.groups=function(t,e){return this.wpcom.req.get("/me/groups",t,e)},s.prototype.connections=function(t,e){return this.wpcom.req.get("/me/connections",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){return this instanceof s?(this.wpcom=i,this._sid=e,this._id=t,void(this._id||r("WARN: media `id` is not defined"))):new s(t,e,i)}var o=i(17),r=i(1)("wpcom:media");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.get(i,t,e)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.put(s,t,e,i)},s.prototype.addFiles=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s={path:"/sites/"+this._sid+"/media/new",formData:[]};e=Array.isArray(e)?e:[e];var n,p,u,c,d,h;for(n=0;n %o",d,p[d]),"file"!==d&&(h="attrs["+n+"]["+d+"]",s.formData.push([h,p[d]]));p=p.file,p="string"==typeof p?o.createReadStream(p):p}s.formData.push(["media[]",p])}return this.wpcom.req.post(s,t,null,i)},s.prototype.addUrls=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s,o,r,n,p="/sites/"+this._sid+"/media/new",u={media_urls:[]};for(e=Array.isArray(e)?e:[e],s=0;s1?e-1:0),s=1;e>s;s++)i[s-1]=arguments[s];return new Promise(function(e,s){t.apply(t,[].concat(i,[function(t,i){t?s(t):e(i)}]))})},Promise.prototype.timeout||(Promise.prototype.timeout=function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?a:arguments[0],i=void 0,s=void 0,o=void 0;return o=new Promise(function(t,i){s=setTimeout(function(){i(new Error("Action timed out while waiting for response."))},e)}),i=function(){return clearTimeout(s),t},Promise.race([this.then(i)["catch"](i),o])}),t.exports=s},function(t,e){t.exports=require("debug")},function(t,e,i){function s(t,e,i,o){if(!i)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=o,this._cid=t,this._pid=e,void(this._sid=i)):new s(t,e,i,o)}var o=i(6);i(1)("wpcom:comment");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.get(i,t,e)},s.prototype.replies=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/replies/";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={})),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/posts/"+this._pid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid;return this.wpcom.req.put(s,t,e,i)},s.prototype.reply=function(t,e,i){"function"==typeof e&&(i=e,e=t,t={}),e="string"==typeof e?{content:e}:e;var s="/sites/"+this._sid+"/comments/"+this._cid+"/replies/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/delete";return this.wpcom.req.del(i,t,e)},s.prototype.like=function(){return o(this._cid,this._sid,this.wpcom)},s.prototype.likesList=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes";return this.wpcom.req.get(i,t,e)},t.exports=s},function(t,e,i){var s=i(18),o=i(1)("wpcom:send-request"),r=i(1)("wpcom:send-request:res");t.exports=function(t,e,i,n){var p=this;return t="string"==typeof t?{path:t}:t,o("sendRequest(%o)",t.path),t.method=(t.method||"get").toUpperCase(),"function"==typeof e&&(n=e,e={}),"function"==typeof i&&(n=i,i=null),e=e||{},e.apiVersion?(t.apiVersion=e.apiVersion,o("apiVersion: %o",t.apiVersion),delete e.apiVersion):t.apiVersion=this.apiVersion,e.proxyOrigin&&(t.proxyOrigin=e.proxyOrigin,o("proxyOrigin: %o",t.proxyOrigin),delete e.proxyOrigin),e=s.stringify(e,{arrayFormat:"brackets"}),t.query=e,i&&(t.body=i),o("params: %o",t),"function"==typeof n?this.request(t,function(t,e){r(e),n(t,e)}):new Promise(function(e,i){p.request(t,function(t,s){r(s),t?i(t):e(s)})})}},function(t,e,i){function s(t){return this instanceof s?(this.wpcom=t,void(this.urls=[])):new s(t)}i(1)("wpcom:batch");s.prototype.add=function(t){return this.urls.push(t),this},s.prototype.run=function(t,e){return void 0===t&&(t={}),"function"==typeof t&&(e=t,t={}),t.urls=this.urls,this.wpcom.req.get("/batch",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._sid=e,void(this._slug=t)):new s(t,e,i)}i(1)("wpcom:category");s.prototype.slug=function(t){this._slug=t},s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e,i){var s="/sites/"+this._sid+"/categories/new";return this.wpcom.req.post(s,t,e,i)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/categories/slug:"+this._slug;return this.wpcom.req.put(s,t,e,i)},s.prototype["delete"]=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/categories/slug:"+this._slug+"/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`comment id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._cid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:commentlike");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/new";return this.wpcom.req.post(i,t,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/comments/"+this._cid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t,e){if(!t)throw new Error("`site id` is not correctly defined");return this instanceof s?(this.wpcom=e,void(this._sid=t)):new s(t,e)}i(1)("wpcom:follow");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/follows/mine";return this.wpcom.req.get(i,t,e)},s.prototype.follow=s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/follows/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.unfollow=s.prototype.del=function(t,e){var i="/sites/"+this._sid+"/follows/mine/delete";return this.wpcom.req.del(i,t,null,e)},t.exports=s},function(t,e,i){function s(t,e,i){if(!e)throw new Error("`site id` is not correctly defined");if(!t)throw new Error("`post id` is not correctly defined");return this instanceof s?(this.wpcom=i,this._pid=t,void(this._sid=e)):new s(t,e,i)}i(1)("wpcom:like");s.prototype.mine=s.prototype.state=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine";return this.wpcom.req.get(i,t,e)},s.prototype.add=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/new";return this.wpcom.req.put(i,t,null,e)},s.prototype.del=s.prototype["delete"]=function(t,e){var i="/sites/"+this._sid+"/posts/"+this._pid+"/likes/mine/delete";return this.wpcom.req.del(i,t,e)},t.exports=s},function(t,e,i){function s(t){return this instanceof s?void(this.wpcom=t):new s(t)}i(1)("wpcom:me");s.prototype.get=function(t,e){return this.wpcom.req.get("/me",t,e)},s.prototype.sites=function(t,e){return this.wpcom.req.get("/me/sites",t,e)},s.prototype.likes=function(t,e){return this.wpcom.req.get("/me/likes",t,e)},s.prototype.groups=function(t,e){return this.wpcom.req.get("/me/groups",t,e)},s.prototype.connections=function(t,e){return this.wpcom.req.get("/me/connections",t,e)},t.exports=s},function(t,e,i){function s(t,e,i){return this instanceof s?(this.wpcom=i,this._sid=e,this._id=t,void(this._id||r("WARN: media `id` is not defined"))):new s(t,e,i)}var o=i(17),r=i(1)("wpcom:media");s.prototype.get=function(t,e){var i="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.get(i,t,e)},s.prototype.update=function(t,e,i){var s="/sites/"+this._sid+"/media/"+this._id;return this.wpcom.req.put(s,t,e,i)},s.prototype.addFiles=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s={path:"/sites/"+this._sid+"/media/new",formData:[]};e=Array.isArray(e)?e:[e];var n,p,u,c,d,h;for(n=0;n %o",d,p[d]),"file"!==d&&(h="attrs["+n+"]["+d+"]",s.formData.push([h,p[d]]));p=p.file,p="string"==typeof p?o.createReadStream(p):p}s.formData.push(["media[]",p])}return this.wpcom.req.post(s,t,null,i)},s.prototype.addUrls=function(t,e,i){void 0===i&&(void 0===e?(e=t,t={}):"function"==typeof e&&(i=e,e=t,t={}));var s,o,r,n,p="/sites/"+this._sid+"/media/new",u={media_urls:[]};for(e=Array.isArray(e)?e:[e],s=0;s 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n\t params[_key - 1] = arguments[_key];\n\t }\n\t\n\t return new Promise(function (resolve, reject) {\n\t // The functions here take a variable number of arguments,\n\t // so pass in as many as we can but keep the callback last.\n\t callback.apply(callback, [].concat(params, [function (error, data) {\n\t error ? reject(error) : resolve(data);\n\t }]));\n\t });\n\t};\n\t\n\tif (!Promise.prototype.timeout) {\n\t /**\n\t * Returns a new promise with a deadline\n\t *\n\t * After the timeout interval, the promise will\n\t * reject. If the actual promise settles before\n\t * the deadline, the timer is cancelled.\n\t *\n\t * @param {number} delay how many ms to wait\n\t * @returns {Promise}\n\t */\n\t Promise.prototype.timeout = function () {\n\t var _this = this;\n\t\n\t var delay = arguments.length <= 0 || arguments[0] === undefined ? DEFAULT_ASYNC_TIMEOUT : arguments[0];\n\t\n\t var cancelTimeout = undefined,\n\t timer = undefined,\n\t timeout = undefined;\n\t\n\t timeout = new Promise(function (resolve, reject) {\n\t timer = setTimeout(function () {\n\t reject(new Error('Action timed out while waiting for response.'));\n\t }, delay);\n\t });\n\t\n\t cancelTimeout = function () {\n\t clearTimeout(timer);\n\t return _this;\n\t };\n\t\n\t return Promise.race([this.then(cancelTimeout)['catch'](cancelTimeout), timeout]);\n\t };\n\t}\n\t\n\t/**\n\t * Expose `WPCOM` module\n\t */\n\t\n\tmodule.exports = WPCOM;\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"debug\");\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar CommentLike = __webpack_require__(6);\n\tvar debug = __webpack_require__(1)('wpcom:comment');\n\t\n\t/**\n\t * Comment methods\n\t *\n\t * @param {String} [cid] comment id\n\t * @param {String} [pid] post id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Comment(cid, pid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Comment)) {\n\t return new Comment(cid, pid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._cid = cid;\n\t this._pid = pid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Return a single Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Return recent comments for a post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.replies = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Create a comment on a post\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.add = function (query, body, fn) {\n\t if (undefined === fn) {\n\t if (undefined === body) {\n\t body = query;\n\t query = {};\n\t } else if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t }\n\t\n\t body = 'string' === typeof body ? { content: body } : body;\n\t\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Edit a comment\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.update = function (query, body, fn) {\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t\n\t body = 'string' === typeof body ? { content: body } : body;\n\t\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Create a Comment as a reply to another Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.reply = function (query, body, fn) {\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t\n\t body = 'string' === typeof body ? { content: body } : body;\n\t\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/replies/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete a comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.del = Comment.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Create a `CommentLike` instance\n\t *\n\t * @api public\n\t */\n\t\n\tComment.prototype.like = function () {\n\t return CommentLike(this._cid, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Get comment likes list\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tComment.prototype.likesList = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Comment` module\n\t */\n\t\n\tmodule.exports = Comment;\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies\n\t */\n\t\n\tvar qs = __webpack_require__(18);\n\tvar debug = __webpack_require__(1)('wpcom:send-request');\n\tvar debug_res = __webpack_require__(1)('wpcom:send-request:res');\n\t\n\t/**\n\t * Request to WordPress REST API\n\t *\n\t * @param {String|Object} params\n\t * @param {Object} [query]\n\t * @param {Object} [body]\n\t * @param {Function} fn\n\t * @api private\n\t */\n\t\n\tmodule.exports = function (params, query, body, fn) {\n\t var _this = this;\n\t\n\t // `params` can be just the path (String)\n\t params = 'string' === typeof params ? { path: params } : params;\n\t\n\t debug('sendRequest(%o)', params.path);\n\t\n\t // set `method` request param\n\t params.method = (params.method || 'get').toUpperCase();\n\t\n\t // `query` is optional\n\t if ('function' === typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t // `body` is optional\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = null;\n\t }\n\t\n\t // query could be `null`\n\t query = query || {};\n\t\n\t // Handle special query parameters\n\t // - `apiVersion`\n\t if (query.apiVersion) {\n\t params.apiVersion = query.apiVersion;\n\t debug('apiVersion: %o', params.apiVersion);\n\t delete query.apiVersion;\n\t } else {\n\t params.apiVersion = this.apiVersion;\n\t }\n\t\n\t // - `proxyOrigin`\n\t if (query.proxyOrigin) {\n\t params.proxyOrigin = query.proxyOrigin;\n\t debug('proxyOrigin: %o', params.proxyOrigin);\n\t delete query.proxyOrigin;\n\t }\n\t\n\t // Stringify query object before to send\n\t query = qs.stringify(query, { arrayFormat: 'brackets' });\n\t\n\t // pass `query` and/or `body` to request params\n\t params.query = query;\n\t\n\t if (body) {\n\t params.body = body;\n\t }\n\t debug('params: %o', params);\n\t\n\t // if callback is provided, behave traditionally\n\t if ('function' === typeof fn) {\n\t // request method\n\t return this.request(params, function (err, res) {\n\t debug_res(res);\n\t fn(err, res);\n\t });\n\t }\n\t\n\t // but if not, return a Promise\n\t return new Promise(function (resolve, reject) {\n\t _this.request(params, function (err, res) {\n\t debug_res(res);\n\t err ? reject(err) : resolve(res);\n\t });\n\t });\n\t};\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:batch');\n\t\n\t/**\n\t * Create a `Batch` instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Batch(wpcom) {\n\t if (!(this instanceof Batch)) {\n\t return new Batch(wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t\n\t this.urls = [];\n\t}\n\t\n\t/**\n\t * Add url to batch requests\n\t *\n\t * @param {String} url\n\t * @api public\n\t */\n\t\n\tBatch.prototype.add = function (url) {\n\t this.urls.push(url);\n\t return this;\n\t};\n\t\n\t/**\n\t * Run the batch request\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tBatch.prototype.run = function (query, fn) {\n\t if (query === undefined) query = {};\n\t\n\t if ('function' === typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t // add urls to query object\n\t query['urls'] = this.urls;\n\t\n\t return this.wpcom.req.get('/batch', query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Batch` module\n\t */\n\t\n\tmodule.exports = Batch;\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:category');\n\t\n\t/**\n\t * Category methods\n\t *\n\t * @param {String} [slug]\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Category(slug, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Category)) {\n\t return new Category(slug, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t this._slug = slug;\n\t}\n\t\n\t/**\n\t * Set category `slug`\n\t *\n\t * @param {String} slug\n\t * @api public\n\t */\n\t\n\tCategory.prototype.slug = function (slug) {\n\t this._slug = slug;\n\t};\n\t\n\t/**\n\t * Get category\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Add category\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype.add = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/categories/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Edit category\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete category\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCategory.prototype['delete'] = Category.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/categories/slug:' + this._slug + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Category` module\n\t */\n\t\n\tmodule.exports = Category;\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:commentlike');\n\t\n\t/**\n\t * CommentLike methods\n\t *\n\t * @param {String} cid comment id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction CommentLike(cid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!cid) {\n\t throw new Error('`comment id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof CommentLike)) {\n\t return new CommentLike(cid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._cid = cid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Get your Like status for a Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCommentLike.prototype.mine = CommentLike.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Like a comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCommentLike.prototype.add = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/new';\n\t return this.wpcom.req.post(path, query, fn);\n\t};\n\t\n\t/**\n\t * Remove your Like from a Comment\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tCommentLike.prototype.del = CommentLike.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `CommentLike` module\n\t */\n\t\n\tmodule.exports = CommentLike;\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:follow');\n\t\n\t/**\n\t * Follow \n\t *\n\t * @param {String} site_id - site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Follow(site_id, wpcom) {\n\t if (!site_id) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Follow)) {\n\t return new Follow(site_id, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = site_id;\n\t}\n\t\n\t/**\n\t * Get the follow status for current \n\t * user on current blog sites\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tFollow.prototype.mine = Follow.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/follows/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Follow the site\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tFollow.prototype.follow = Follow.prototype.add = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/follows/new';\n\t return this.wpcom.req.put(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Unfollow the site\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tFollow.prototype.unfollow = Follow.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/follows/mine/delete';\n\t return this.wpcom.req.del(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Expose `Follow` module\n\t */\n\t\n\tmodule.exports = Follow;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:like');\n\t\n\t/**\n\t * Like methods\n\t *\n\t * @param {String} pid post id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Like(pid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!pid) {\n\t throw new Error('`post id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Like)) {\n\t return new Like(pid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._pid = pid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Get your Like status for a Post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tLike.prototype.mine = Like.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Like a post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tLike.prototype.add = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/new';\n\t return this.wpcom.req.put(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Remove your Like from a Post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tLike.prototype.del = Like.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Like` module\n\t */\n\t\n\tmodule.exports = Like;\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:me');\n\t\n\t/**\n\t * Create a `Me` instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Me(wpcom) {\n\t if (!(this instanceof Me)) {\n\t return new Me(wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t}\n\t\n\t/**\n\t * Meta data about auth token's User\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.get = function (query, fn) {\n\t return this.wpcom.req.get('/me', query, fn);\n\t};\n\t\n\t/**\n\t * A list of the current user's sites\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api private\n\t */\n\t\n\tMe.prototype.sites = function (query, fn) {\n\t return this.wpcom.req.get('/me/sites', query, fn);\n\t};\n\t\n\t/**\n\t * List the currently authorized user's likes\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.likes = function (query, fn) {\n\t return this.wpcom.req.get('/me/likes', query, fn);\n\t};\n\t\n\t/**\n\t * A list of the current user's group\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.groups = function (query, fn) {\n\t return this.wpcom.req.get('/me/groups', query, fn);\n\t};\n\t\n\t/**\n\t * A list of the current user's connections to third-party services\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMe.prototype.connections = function (query, fn) {\n\t return this.wpcom.req.get('/me/connections', query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Me` module\n\t */\n\t\n\tmodule.exports = Me;\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar fs = __webpack_require__(17);\n\tvar debug = __webpack_require__(1)('wpcom:media');\n\t\n\t/**\n\t * Default\n\t */\n\t\n\tvar def = {\n\t \"apiVersion\": \"1.1\"\n\t};\n\t\n\t/**\n\t * Media methods\n\t *\n\t * @param {String} id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Media(id, sid, wpcom) {\n\t if (!(this instanceof Media)) {\n\t return new Media(id, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t this._id = id;\n\t\n\t if (!this._id) {\n\t debug('WARN: media `id` is not defined');\n\t }\n\t}\n\t\n\t/**\n\t * Get media\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMedia.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/media/' + this._id;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Edit media\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMedia.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/media/' + this._id;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Add media file\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Object|Array} files\n\t * @param {Function} fn\n\t */\n\t\n\tMedia.prototype.addFiles = function (query, files, fn) {\n\t if (undefined === fn) {\n\t if (undefined === files) {\n\t files = query;\n\t query = {};\n\t } else if ('function' === typeof files) {\n\t fn = files;\n\t files = query;\n\t query = {};\n\t }\n\t }\n\t\n\t var params = {\n\t path: '/sites/' + this._sid + '/media/new',\n\t formData: []\n\t };\n\t\n\t // process formData\n\t files = Array.isArray(files) ? files : [files];\n\t\n\t var i, f, isStream, isFile, k, param;\n\t for (i = 0; i < files.length; i++) {\n\t f = files[i];\n\t f = 'string' === typeof f ? fs.createReadStream(f) : f;\n\t\n\t isStream = !!f._readableState;\n\t isFile = 'undefined' !== typeof File && f instanceof File;\n\t\n\t debug('is stream: %s', isStream);\n\t debug('is file: %s', isFile);\n\t\n\t if (!isFile && !isStream) {\n\t // process file attributes like as `title`, `description`, ...\n\t for (k in f) {\n\t debug('add %o => %o', k, f[k]);\n\t if ('file' !== k) {\n\t param = 'attrs[' + i + '][' + k + ']';\n\t params.formData.push([param, f[k]]);\n\t }\n\t }\n\t // set file path\n\t f = f.file;\n\t f = 'string' === typeof f ? fs.createReadStream(f) : f;\n\t }\n\t\n\t params.formData.push(['media[]', f]);\n\t }\n\t\n\t return this.wpcom.req.post(params, query, null, fn);\n\t};\n\t\n\t/**\n\t * Add media files from URL\n\t *\n\t * @param {Object} [query]\n\t * @param {String|Array|Object} files\n\t * @param {Function} fn\n\t */\n\t\n\tMedia.prototype.addUrls = function (query, media, fn) {\n\t if (undefined === fn) {\n\t if (undefined === media) {\n\t media = query;\n\t query = {};\n\t } else if ('function' === typeof media) {\n\t fn = media;\n\t media = query;\n\t query = {};\n\t }\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/media/new';\n\t var body = { media_urls: [] };\n\t\n\t // process formData\n\t var i, m, url, k;\n\t\n\t media = Array.isArray(media) ? media : [media];\n\t for (i = 0; i < media.length; i++) {\n\t m = media[i];\n\t\n\t if ('string' === typeof m) {\n\t url = m;\n\t } else {\n\t if (!body.attrs) {\n\t body.attrs = [];\n\t }\n\t\n\t // add attributes\n\t body.attrs[i] = {};\n\t for (k in m) {\n\t if ('url' !== k) {\n\t body.attrs[i][k] = m[k];\n\t }\n\t }\n\t url = m[k];\n\t }\n\t\n\t // push url into [media_url]\n\t body.media_urls.push(url);\n\t }\n\t\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete media\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tMedia.prototype['delete'] = Media.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/media/' + this._id + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Media` module\n\t */\n\t\n\tmodule.exports = Media;\n\n/***/ },\n/* 11 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Like = __webpack_require__(8);\n\tvar Reblog = __webpack_require__(12);\n\tvar Comment = __webpack_require__(2);\n\tvar debug = __webpack_require__(1)('wpcom:post');\n\t\n\t/**\n\t * Post methods\n\t *\n\t * @param {String} id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Post(id, sid, wpcom) {\n\t if (!(this instanceof Post)) {\n\t return new Post(id, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t\n\t // set `id` and/or `slug` properties\n\t id = id || {};\n\t if ('object' !== typeof id) {\n\t this._id = id;\n\t } else {\n\t this._id = id.id;\n\t this._slug = id.slug;\n\t }\n\t}\n\t\n\t/**\n\t * Set post `id`\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tPost.prototype.id = function (id) {\n\t this._id = id;\n\t};\n\t\n\t/**\n\t * Set post `slug`\n\t *\n\t * @param {String} slug\n\t * @api public\n\t */\n\t\n\tPost.prototype.slug = function (slug) {\n\t this._slug = slug;\n\t};\n\t\n\t/**\n\t * Get post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.get = function (query, fn) {\n\t if (!this._id && this._slug) {\n\t return this.getBySlug(query, fn);\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/posts/' + this._id;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Get post by slug\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.getBySlug = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/slug:' + this._slug;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Add post\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.add = function (query, body, fn) {\n\t var _this = this;\n\t\n\t if (undefined === fn) {\n\t if (undefined === body) {\n\t body = query;\n\t query = {};\n\t } else if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/posts/new';\n\t\n\t return this.wpcom.req.post(path, query, body).then(function (data) {\n\t // update POST object\n\t _this._id = data.ID;\n\t debug('Set post _id: %s', _this._id);\n\t\n\t _this._slug = data.slug;\n\t debug('Set post _slug: %s', _this._slug);\n\t\n\t if ('function' === typeof fn) {\n\t fn(null, data);\n\t } else {\n\t return Promise.resolve(data);\n\t }\n\t })['catch'](function (err) {\n\t if ('function' === typeof fn) {\n\t fn(err);\n\t } else {\n\t return Promise.reject(error);\n\t }\n\t });\n\t};\n\t\n\t/**\n\t * Edit post\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.del = Post.prototype['delete'] = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Restore post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.restore = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/restore';\n\t return this.wpcom.req.put(path, query, null, fn);\n\t};\n\t\n\t/**\n\t * Get post likes list\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.likesList = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/likes';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Search within a site for related posts\n\t *\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.related = function (body, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._id + '/related';\n\t return this.wpcom.req.put(path, body, null, fn);\n\t};\n\t\n\t/**\n\t * Create a `Like` instance\n\t *\n\t * @api public\n\t */\n\t\n\tPost.prototype.like = function () {\n\t return new Like(this._id, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Reblog` instance\n\t *\n\t * @api public\n\t */\n\t\n\tPost.prototype.reblog = function () {\n\t return new Reblog(this._id, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Comment` instance\n\t *\n\t * @param {String} [cid] comment id\n\t * @api public\n\t */\n\t\n\tPost.prototype.comment = function (cid) {\n\t return new Comment(cid, this._id, this._sid, this.wpcom);\n\t};\n\t\n\t/**\n\t * Return recent comments\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tPost.prototype.comments = function (query, fn) {\n\t var comment = new Comment(null, this._id, this._sid, this.wpcom);\n\t return comment.replies(query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Post` module\n\t */\n\t\n\tmodule.exports = Post;\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:reblog');\n\t\n\t/**\n\t * Reblog methods\n\t *\n\t * @param {String} pid post id\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Reblog(pid, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!pid) {\n\t throw new Error('`post id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Reblog)) {\n\t return new Reblog(pid, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._pid = pid;\n\t this._sid = sid;\n\t}\n\t\n\t/**\n\t * Get your reblog status for a Post\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReblog.prototype.mine = Reblog.prototype.state = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/mine';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Reblog a post\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReblog.prototype.add = function (query, body, fn) {\n\t if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t\n\t if (body && !body.destination_site_id) {\n\t return fn(new Error('destination_site_id is not defined'));\n\t }\n\t\n\t var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/new';\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Reblog a post to\n\t * It's almost an alias of Reblogs#add\n\t *\n\t * @param {Number|String} dest site id destination\n\t * @param {String} [note]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReblog.prototype.to = function (dest, note, fn) {\n\t if (undefined === fn) {\n\t if (undefined === note) {\n\t note = null;\n\t } else if ('function' === typeof note) {\n\t fn = note;\n\t note = null;\n\t }\n\t }\n\t\n\t return this.add({ note: note, destination_site_id: dest }, fn);\n\t};\n\t\n\t/**\n\t * Expose `Reblog` module\n\t */\n\t\n\tmodule.exports = Reblog;\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar Post = __webpack_require__(11);\n\tvar Category = __webpack_require__(5);\n\tvar Tag = __webpack_require__(14);\n\tvar Media = __webpack_require__(10);\n\tvar Comment = __webpack_require__(2);\n\tvar Follow = __webpack_require__(7);\n\tvar debug = __webpack_require__(1)('wpcom:site');\n\t\n\t/**\n\t * Resources array\n\t * A list of endpoints with the same structure\n\t */\n\t\n\tvar resources = ['categories', 'comments', 'follows', 'media', 'posts', 'shortcodes', 'embeds', ['pageTemplates', 'page-templates'], ['stats', 'stats'], ['statsClicks', 'stats/clicks'], ['statsComments', 'stats/comments'], ['statsCommentFollowers', 'stats/comment-followers'], ['statsCountryViews', 'stats/country-views'], ['statsFollowers', 'stats/followers'], ['statsPublicize', 'stats/publicize'], ['statsReferrers', 'stats/referrers'], ['statsSearchTerms', 'stats/search-terms'], ['statsStreak', 'stats/streak'], ['statsSummary', 'stats/summary'], ['statsTags', 'stats/tags'], ['statsTopAuthors', 'stats/top-authors'], ['statsTopPosts', 'stats/top-posts'], ['statsVideoPlays', 'stats/video-plays'], ['statsVisits', 'stats/visits'], 'tags', 'users'];\n\t\n\t/**\n\t * Create a Site instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Site(id, wpcom) {\n\t if (!(this instanceof Site)) {\n\t return new Site(id, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t\n\t debug('set %o site id', id);\n\t this._id = encodeURIComponent(id);\n\t}\n\t\n\t/**\n\t * Require site information\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.get = function (query, fn) {\n\t return this.wpcom.req.get('/sites/' + this._id, query, fn);\n\t};\n\t\n\t/**\n\t * List method builder\n\t *\n\t * @param {String} subpath\n\t * @param {Function}\n\t * @api private\n\t */\n\t\n\tfunction list(subpath) {\n\t\n\t /**\n\t * Create and return the List method\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\t var listMethod = function listMethod(query, fn) {\n\t var path = '/sites/' + this._id + '/' + subpath;\n\t return this.wpcom.req.get(path, query, fn);\n\t };\n\t listMethod._publicAPI = true;\n\t return listMethod;\n\t}\n\t\n\t// walk for each resource and create related method\n\tvar i, res, isarr, name, subpath;\n\tfor (i = 0; i < resources.length; i++) {\n\t res = resources[i];\n\t isarr = Array.isArray(res);\n\t\n\t name = isarr ? res[0] : res + 'List';\n\t subpath = isarr ? res[1] : res;\n\t\n\t debug('adding method: %o - sub-path: %o - version: %s', 'site.' + name + '()', subpath);\n\t Site.prototype[name] = list(subpath);\n\t}\n\t\n\t/**\n\t * :POST:\n\t * Create a `Post` instance\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tSite.prototype.post = function (id) {\n\t return new Post(id, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * :POST:\n\t * Add a new blog post\n\t *\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @return {Post} new Post instance\n\t */\n\t\n\tSite.prototype.addPost = function (body, fn) {\n\t var post = new Post(null, this._id, this.wpcom);\n\t return post.add(body, fn);\n\t};\n\t\n\t/**\n\t * :POST:\n\t * Delete a blog post\n\t *\n\t * @param {String} id\n\t * @param {Function} fn\n\t * @return {Post} remove Post instance\n\t */\n\t\n\tSite.prototype.deletePost = function (id, fn) {\n\t var post = new Post(id, this._id, this.wpcom);\n\t return post['delete'](fn);\n\t};\n\t\n\t/**\n\t * Create a `Media` instance\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tSite.prototype.media = function (id) {\n\t return new Media(id, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Add a media from a file\n\t *\n\t * @param {Object} [query]\n\t * @param {Array|String} files\n\t * @param {Function} fn\n\t * @return {Post} new Post instance\n\t */\n\t\n\tSite.prototype.addMediaFiles = function (query, files, fn) {\n\t var media = new Media(null, this._id, this.wpcom);\n\t return media.addFiles(query, files, fn);\n\t};\n\t\n\t/**\n\t * Add a new media from url\n\t *\n\t * @param {Object} [query]\n\t * @param {Array|String} files\n\t * @param {Function} fn\n\t * @return {Post} new Post instance\n\t */\n\t\n\tSite.prototype.addMediaUrls = function (query, files, fn) {\n\t var media = new Media(null, this._id, this.wpcom);\n\t return media.addUrls(query, files, fn);\n\t};\n\t\n\t/**\n\t * Delete a blog media\n\t *\n\t * @param {String} id\n\t * @param {Function} fn\n\t * @return {Post} removed Media instance\n\t */\n\t\n\tSite.prototype.deleteMedia = function (id, fn) {\n\t var media = new Media(id, this._id, this.wpcom);\n\t return media.del(fn);\n\t};\n\t\n\t/**\n\t * Create a `Comment` instance\n\t *\n\t * @param {String} id\n\t * @api public\n\t */\n\t\n\tSite.prototype.comment = function (id) {\n\t return new Comment(id, null, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Follow` instance\n\t *\n\t * @api public\n\t */\n\t\n\tSite.prototype.follow = function () {\n\t return new Follow(this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Category` instance\n\t * Set `cat` alias\n\t *\n\t * @param {String} [slug]\n\t * @api public\n\t */\n\t\n\tSite.prototype.cat = Site.prototype.category = function (slug) {\n\t return new Category(slug, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Create a `Tag` instance\n\t *\n\t * @param {String} [slug]\n\t * @api public\n\t */\n\t\n\tSite.prototype.tag = function (slug) {\n\t return new Tag(slug, this._id, this.wpcom);\n\t};\n\t\n\t/**\n\t * Get a rendered shortcode for a site.\n\t *\n\t * Note: The current user must have publishing access.\n\t *\n\t * @param {String} url\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.renderShortcode = function (url, query, fn) {\n\t if ('string' !== typeof url) {\n\t throw new TypeError('expected a url String');\n\t }\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t query = query || {};\n\t query.shortcode = url;\n\t\n\t var path = '/sites/' + this._id + '/shortcodes/render';\n\t\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Get a rendered embed for a site.\n\t *\n\t * Note: The current user must have publishing access.\n\t *\n\t * @param {String} url\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.renderEmbed = function (url, query, fn) {\n\t if ('string' !== typeof url) {\n\t throw new TypeError('expected an embed String');\n\t }\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t query = query || {};\n\t query.embed_url = url;\n\t\n\t var path = '/sites/' + this._id + '/embeds/render';\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Mark a referrering domain as spam\n\t *\n\t * @param {String} domain\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsReferrersSpamNew = function (domain, fn) {\n\t var path = '/sites/' + this._id + '/stats/referrers/spam/new';\n\t var body = { domain: domain };\n\t\n\t return this.wpcom.req.post(path, body, null, fn);\n\t};\n\t\n\t/**\n\t * Remove referrering domain from spam\n\t *\n\t * @param {String} domain\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsReferrersSpamDelete = function (domain, fn) {\n\t var path = '/sites/' + this._id + '/stats/referrers/spam/delete';\n\t var body = { domain: domain };\n\t\n\t return this.wpcom.req.post(path, body, null, fn);\n\t};\n\t\n\t/**\n\t * Get detailed stats about a VideoPress video\n\t *\n\t * @param {String} videoId\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsVideo = function (videoId, query, fn) {\n\t var path = '/sites/' + this._id + '/stats/video/' + videoId;\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Get detailed stats about a particular post\n\t *\n\t * @param {String} postId\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tSite.prototype.statsPostViews = function (postId, query, fn) {\n\t var path = '/sites/' + this._id + '/stats/post/' + postId;\n\t\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Site` module\n\t */\n\t\n\tmodule.exports = Site;\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:tag');\n\t\n\t/**\n\t * Tag methods\n\t *\n\t * @param {String} [slug]\n\t * @param {String} sid site id\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Tag(slug, sid, wpcom) {\n\t if (!sid) {\n\t throw new Error('`site id` is not correctly defined');\n\t }\n\t\n\t if (!(this instanceof Tag)) {\n\t return new Tag(slug, sid, wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t this._sid = sid;\n\t this._slug = slug;\n\t}\n\t\n\t/**\n\t * Set tag `slug`\n\t *\n\t * @param {String} slug\n\t * @api public\n\t */\n\t\n\tTag.prototype.slug = function (slug) {\n\t this._slug = slug;\n\t};\n\t\n\t/**\n\t * Get tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype.get = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n\t return this.wpcom.req.get(path, query, fn);\n\t};\n\t\n\t/**\n\t * Add tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype.add = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/tags/new';\n\t return this.wpcom.req.post(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Edit tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype.update = function (query, body, fn) {\n\t var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n\t return this.wpcom.req.put(path, query, body, fn);\n\t};\n\t\n\t/**\n\t * Delete tag\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tTag.prototype['delete'] = Tag.prototype.del = function (query, fn) {\n\t var path = '/sites/' + this._sid + '/tags/slug:' + this._slug + '/delete';\n\t return this.wpcom.req.del(path, query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Tag` module\n\t */\n\t\n\tmodule.exports = Tag;\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar debug = __webpack_require__(1)('wpcom:users');\n\t\n\t/**\n\t * Create a `Users` instance\n\t *\n\t * @param {WPCOM} wpcom\n\t * @api public\n\t */\n\t\n\tfunction Users(wpcom) {\n\t if (!(this instanceof Users)) {\n\t return new Users(wpcom);\n\t }\n\t\n\t this.wpcom = wpcom;\n\t}\n\t\n\t/**\n\t * A list of @mention suggestions for the current user\n\t *\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tUsers.prototype.suggest = function (query, fn) {\n\t return this.wpcom.req.get('/users/suggest', query, fn);\n\t};\n\t\n\t/**\n\t * Expose `Users` module\n\t */\n\t\n\tmodule.exports = Users;\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\t/**\n\t * Module dependencies.\n\t */\n\t\n\tvar sendRequest = __webpack_require__(3);\n\tvar debug = __webpack_require__(1)('wpcom:request');\n\t\n\t/**\n\t * Expose `Request` module\n\t */\n\t\n\tfunction Req(wpcom) {\n\t this.wpcom = wpcom;\n\t}\n\t\n\t/**\n\t * Request methods\n\t *\n\t * @param {Object|String} params\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReq.prototype.get = function (params, query, fn) {\n\t // `query` is optional\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return sendRequest.call(this.wpcom, params, query, null, fn);\n\t};\n\t\n\t/**\n\t * Make `update` request\n\t *\n\t * @param {Object|String} params\n\t * @param {Object} [query]\n\t * @param {Object} body\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReq.prototype.post = Req.prototype.put = function (params, query, body, fn) {\n\t if (undefined === fn) {\n\t if (undefined === body) {\n\t body = query;\n\t query = {};\n\t } else if ('function' === typeof body) {\n\t fn = body;\n\t body = query;\n\t query = {};\n\t }\n\t }\n\t\n\t // params can be a string\n\t params = 'string' === typeof params ? { path: params } : params;\n\t\n\t // request method\n\t params.method = 'post';\n\t\n\t return sendRequest.call(this.wpcom, params, query, body, fn);\n\t};\n\t\n\t/**\n\t * Make a `delete` request\n\t *\n\t * @param {Object|String} params\n\t * @param {Object} [query]\n\t * @param {Function} fn\n\t * @api public\n\t */\n\t\n\tReq.prototype.del = function (params, query, fn) {\n\t if ('function' == typeof query) {\n\t fn = query;\n\t query = {};\n\t }\n\t\n\t return this.post(params, query, null, fn);\n\t};\n\t\n\t/**\n\t * Expose module\n\t */\n\t\n\tmodule.exports = Req;\n\n/***/ },\n/* 17 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"fs\");\n\n/***/ },\n/* 18 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"qs\");\n\n/***/ },\n/* 19 */\n/***/ function(module, exports) {\n\n\tmodule.exports = require(\"wpcom-xhr-request\");\n\n/***/ }\n/******/ ]);\n\n\n/** WEBPACK FOOTER **\n ** index.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 069ba039875892d69a65\n **/","\n\n/**\n * Module dependencies.\n */\n\nvar request_handler = require('wpcom-xhr-request');\n\n/**\n * Local module dependencies.\n */\n\nvar Me = require('./lib/me');\nvar Site = require('./lib/site');\nvar Users = require('./lib/users');\nvar Batch = require('./lib/batch');\nvar Req = require('./lib/util/request');\nvar sendRequest = require('./lib/util/send-request');\nvar debug = require('debug')('wpcom');\n\n/**\n * Local module constants\n */\nvar DEFAULT_ASYNC_TIMEOUT = 30000;\n\n/**\n * XMLHttpRequest (and CORS) API access method.\n *\n * API authentication is done via an (optional) access `token`,\n * which needs to be retrieved via OAuth.\n *\n * Request Handler is optional and XHR is defined as default.\n *\n * @param {String} [token] - OAuth API access token\n * @param {Function} [reqHandler] - function Request Handler\n * @public\n */\n\nfunction WPCOM(token, reqHandler) {\n if (!(this instanceof WPCOM)) {\n return new WPCOM(token, reqHandler);\n }\n\n // `token` is optional\n if ('function' === typeof token) {\n reqHandler = token;\n token = null;\n }\n\n if (token) {\n debug('Token defined: %s…', token.substring(0, 6));\n this.token = token;\n }\n\n // Set default request handler\n if (!reqHandler) {\n debug('No request handler. Adding default XHR request handler');\n\n this.request = function (params, fn) {\n params = params || {};\n\n // token is optional\n if (token) {\n params.authToken = token;\n }\n\n return request_handler(params, fn);\n };\n } else {\n this.request = reqHandler;\n }\n\n // Add Req instance\n this.req = new Req(this);\n\n // Default api version;\n this.apiVersion = '1.1';\n}\n\n/**\n * Get `Me` object instance\n *\n * @api public\n */\n\nWPCOM.prototype.me = function () {\n return new Me(this);\n};\n\n/**\n * Get `Site` object instance\n *\n * @param {String} id\n * @api public\n */\n\nWPCOM.prototype.site = function (id) {\n return new Site(id, this);\n};\n\n/**\n * Get `Users` object instance\n *\n * @api public\n */\n\nWPCOM.prototype.users = function () {\n return new Users(this);\n};\n\n\nWPCOM.prototype.batch = function () {\n return new Batch(this);\n};\n\n/**\n * List Freshly Pressed Posts\n *\n * @param {Object} [query]\n * @param {Function} fn callback function\n * @api public\n */\n\nWPCOM.prototype.freshlyPressed = function (query, fn) {\n return this.req.get('/freshly-pressed', query, fn);\n};\n\n/**\n * Expose send-request\n * @TODO: use `this.req` instead of this method\n */\n\nWPCOM.prototype.sendRequest = function (params, query, body, fn) {\n var msg = 'WARN! Don use `sendRequest() anymore. Use `this.req` method.';\n if (console && console.warn) {\n console.warn(msg);\n } else {\n console.log(msg);\n }\n\n return sendRequest.call(this, params, query, body, fn)\n};\n\n/**\n * Wraps a library callback into a Promise\n *\n * Remember to bind the method to its parent\n * context - extracting it out otherwise removes it.\n *\n * E.g.\n * wpcom.Promise( comment.del.bind( comment ) );\n *\n * The promise rejects if the normal error return from\n * an API call is not empty. It resolves otherwise.\n *\n * @param {function} callback wpcom.js method to call\n * @param params variable list of parameters to send to callback\n * @returns {Promise}\n */\nWPCOM.prototype.Promise = ( callback, ...params ) => {\n return new Promise( ( resolve, reject ) => {\n // The functions here take a variable number of arguments,\n // so pass in as many as we can but keep the callback last.\n callback.apply( callback, [...params, ( error, data ) => {\n error ? reject( error ) : resolve( data );\n } ] );\n } );\n};\n\nif ( ! Promise.prototype.timeout ) {\n\t/**\n * Returns a new promise with a deadline\n *\n * After the timeout interval, the promise will\n * reject. If the actual promise settles before\n * the deadline, the timer is cancelled.\n *\n * @param {number} delay how many ms to wait\n * @returns {Promise}\n */\n Promise.prototype.timeout = function( delay = DEFAULT_ASYNC_TIMEOUT ) {\n let cancelTimeout, timer, timeout;\n\n timeout = new Promise( ( resolve, reject ) => {\n timer = setTimeout( () => {\n reject( new Error( 'Action timed out while waiting for response.' ) );\n }, delay );\n } );\n\n cancelTimeout = () => {\n clearTimeout( timer );\n return this;\n };\n\n return Promise.race( [ this.then( cancelTimeout ).catch( cancelTimeout ), timeout ] );\n };\n}\n\n/**\n * Expose `WPCOM` module\n */\n\nmodule.exports = WPCOM;\n\n\n\n/** WEBPACK FOOTER **\n ** ./wpcom.js\n **/","module.exports = require(\"debug\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"debug\"\n ** module id = 1\n ** module chunks = 0\n **/","\n/**\n * Module dependencies.\n */\n\nvar CommentLike = require('./commentlike');\nvar debug = require('debug')('wpcom:comment');\n\n/**\n * Comment methods\n *\n * @param {String} [cid] comment id\n * @param {String} [pid] post id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Comment(cid, pid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Comment)) {\n return new Comment(cid, pid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._cid = cid;\n this._pid = pid;\n this._sid = sid;\n}\n\n/**\n * Return a single Comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Return recent comments for a post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.replies = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Create a comment on a post\n *\n * @param {Object} [query]\n * @param {String|Object} body\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.add = function (query, body, fn) {\n if ( undefined === fn ) {\n if ( undefined === body ) {\n body = query;\n query = {};\n } else if ( 'function' === typeof body ) {\n fn = body;\n body = query;\n query = {};\n }\n }\n\n body = 'string' === typeof body ? { content: body } : body;\n\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/replies/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Edit a comment\n *\n * @param {Object} [query]\n * @param {String|Object} body\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.update = function (query, body, fn) {\n if ('function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n\n body = 'string' === typeof body ? { content: body } : body;\n\n var path = '/sites/' + this._sid + '/comments/' + this._cid;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Create a Comment as a reply to another Comment\n *\n * @param {Object} [query]\n * @param {String|Object} body\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.reply = function (query, body, fn) {\n if ('function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n\n body = 'string' === typeof body ? { content: body } : body;\n\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/replies/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Delete a comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.del =\nComment.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Create a `CommentLike` instance\n *\n * @api public\n */\n\nComment.prototype.like = function() {\n return CommentLike(this._cid, this._sid, this.wpcom);\n};\n\n/**\n * Get comment likes list\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nComment.prototype.likesList = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Expose `Comment` module\n */\n\nmodule.exports = Comment;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/comment.js\n **/","\n/**\n * Module dependencies\n */\n\nvar qs = require('qs');\nvar debug = require('debug')('wpcom:send-request');\nvar debug_res = require('debug')('wpcom:send-request:res');\n\n/**\n * Request to WordPress REST API\n *\n * @param {String|Object} params\n * @param {Object} [query]\n * @param {Object} [body]\n * @param {Function} fn\n * @api private\n */\n\nmodule.exports = function (params, query, body, fn) {\n // `params` can be just the path (String)\n params = 'string' === typeof params ? { path : params } : params;\n\n debug('sendRequest(%o)', params.path);\n\n // set `method` request param\n params.method = (params.method || 'get').toUpperCase();\n\n // `query` is optional\n if ('function' === typeof query) {\n fn = query;\n query = {};\n }\n\n // `body` is optional\n if ('function' === typeof body) {\n fn = body;\n body = null;\n }\n\n // query could be `null`\n query = query || {};\n\n // Handle special query parameters\n // - `apiVersion`\n if (query.apiVersion) {\n params.apiVersion = query.apiVersion;\n debug('apiVersion: %o', params.apiVersion);\n delete query.apiVersion;\n } else {\n params.apiVersion = this.apiVersion;\n }\n\n // - `proxyOrigin`\n if (query.proxyOrigin) {\n params.proxyOrigin = query.proxyOrigin;\n debug('proxyOrigin: %o', params.proxyOrigin);\n delete query.proxyOrigin;\n }\n\n // Stringify query object before to send\n query = qs.stringify(query, { arrayFormat: 'brackets' });\n\n // pass `query` and/or `body` to request params\n params.query = query;\n\n if (body) {\n params.body = body;\n }\n debug('params: %o', params);\n\n // if callback is provided, behave traditionally\n if ('function' === typeof fn) {\n // request method\n return this.request(params, function(err, res) {\n debug_res(res);\n fn(err, res);\n });\n }\n\n // but if not, return a Promise\n return new Promise((resolve, reject) => {\n this.request(params, (err, res) => {\n debug_res(res);\n err ? reject(err) : resolve(res);\n });\n } );\n};\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/util/send-request.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:batch');\n\n/**\n * Create a `Batch` instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Batch(wpcom) {\n if (!(this instanceof Batch)) {\n return new Batch(wpcom);\n }\n\n this.wpcom = wpcom;\n\n this.urls = [];\n}\n\n/**\n * Add url to batch requests\n *\n * @param {String} url\n * @api public\n */\n\nBatch.prototype.add = function (url) {\n this.urls.push(url);\n return this;\n};\n\n/**\n * Run the batch request\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nBatch.prototype.run = function (query={}, fn) {\n if ('function' === typeof query) {\n fn = query;\n query = {};\n }\n\n // add urls to query object\n query['urls'] = this.urls;\n\n return this.wpcom.req.get('/batch', query, fn);\n};\n\n/**\n * Expose `Batch` module\n */\n\nmodule.exports = Batch;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/batch.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:category');\n\n/**\n * Category methods\n *\n * @param {String} [slug]\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Category(slug, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Category)) {\n return new Category(slug, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n this._slug = slug;\n}\n\n/**\n * Set category `slug`\n *\n * @param {String} slug\n * @api public\n */\n\nCategory.prototype.slug = function (slug) {\n this._slug = slug;\n};\n\n/**\n * Get category\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Add category\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype.add = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/categories/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Edit category\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/categories/slug:' + this._slug;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Delete category\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCategory.prototype['delete'] = Category.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/categories/slug:' + this._slug + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Category` module\n */\n\nmodule.exports = Category;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/category.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:commentlike');\n\n/**\n * CommentLike methods\n *\n * @param {String} cid comment id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction CommentLike(cid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!cid) {\n throw new Error('`comment id` is not correctly defined');\n }\n\n if (!(this instanceof CommentLike)) {\n return new CommentLike(cid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._cid = cid;\n this._sid = sid;\n}\n\n/**\n * Get your Like status for a Comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCommentLike.prototype.mine =\nCommentLike.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Like a comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCommentLike.prototype.add = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/new';\n return this.wpcom.req.post(path, query, fn);\n};\n\n/**\n * Remove your Like from a Comment\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nCommentLike.prototype.del =\nCommentLike.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `CommentLike` module\n */\n\nmodule.exports = CommentLike;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/commentlike.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:follow');\n\n/**\n * Follow \n *\n * @param {String} site_id - site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Follow(site_id, wpcom) {\n if (!site_id) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Follow)) {\n return new Follow(site_id, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = site_id;\n}\n\n/**\n * Get the follow status for current \n * user on current blog sites\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nFollow.prototype.mine =\nFollow.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/follows/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Follow the site\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nFollow.prototype.follow =\nFollow.prototype.add = function (query, fn) {\n var path = '/sites/' + this._sid + '/follows/new';\n return this.wpcom.req.put(path, query, null, fn);\n};\n\n/**\n * Unfollow the site\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nFollow.prototype.unfollow =\nFollow.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/follows/mine/delete';\n return this.wpcom.req.del(path, query, null, fn);\n};\n\n/**\n * Expose `Follow` module\n */\n\nmodule.exports = Follow;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/follow.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:like');\n\n/**\n * Like methods\n *\n * @param {String} pid post id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Like(pid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!pid) {\n throw new Error('`post id` is not correctly defined');\n }\n\n if (!(this instanceof Like)) {\n return new Like(pid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._pid = pid;\n this._sid = sid;\n}\n\n/**\n * Get your Like status for a Post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nLike.prototype.mine =\nLike.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Like a post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nLike.prototype.add = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/new';\n return this.wpcom.req.put(path, query, null, fn);\n};\n\n/**\n * Remove your Like from a Post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nLike.prototype.del =\nLike.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Like` module\n */\n\nmodule.exports = Like;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/like.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:me');\n\n/**\n * Create a `Me` instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Me(wpcom) {\n if (!(this instanceof Me)) {\n return new Me(wpcom);\n }\n\n this.wpcom = wpcom;\n}\n\n/**\n * Meta data about auth token's User\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.get = function (query, fn) {\n return this.wpcom.req.get('/me', query, fn);\n};\n\n/**\n * A list of the current user's sites\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api private\n */\n\nMe.prototype.sites = function (query, fn) {\n return this.wpcom.req.get('/me/sites', query, fn);\n};\n\n/**\n * List the currently authorized user's likes\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.likes = function (query, fn) {\n return this.wpcom.req.get('/me/likes', query, fn);\n};\n\n/**\n * A list of the current user's group\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.groups = function (query, fn) {\n return this.wpcom.req.get('/me/groups', query, fn);\n};\n\n/**\n * A list of the current user's connections to third-party services\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMe.prototype.connections = function (query, fn) {\n return this.wpcom.req.get('/me/connections', query, fn);\n};\n\n/**\n * Expose `Me` module\n */\n\nmodule.exports = Me;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/me.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar fs = require('fs');\nvar debug = require('debug')('wpcom:media');\n\n/**\n * Default\n */\n\nvar def = {\n \"apiVersion\": \"1.1\"\n};\n\n/**\n * Media methods\n *\n * @param {String} id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Media(id, sid, wpcom) {\n if (!(this instanceof Media)) {\n return new Media(id, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n this._id = id;\n\n if (!this._id) {\n debug('WARN: media `id` is not defined');\n }\n}\n\n/**\n * Get media\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMedia.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/media/' + this._id;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Edit media\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nMedia.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/media/' + this._id;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Add media file\n *\n * @param {Object} [query]\n * @param {String|Object|Array} files\n * @param {Function} fn\n */\n\nMedia.prototype.addFiles = function (query, files, fn) {\n if ( undefined === fn ) {\n if ( undefined === files ) {\n files = query;\n query = {};\n } else if ( 'function' === typeof files ) {\n fn = files;\n files = query;\n query = {};\n }\n }\n\n var params = {\n path: '/sites/' + this._sid + '/media/new',\n formData: []\n };\n\n // process formData\n files = Array.isArray(files) ? files : [files];\n\n var i, f, isStream, isFile, k, param;\n for (i = 0; i < files.length; i++) {\n f = files[i];\n f = 'string' === typeof f ? fs.createReadStream(f) : f;\n\n isStream = !!f._readableState;\n isFile = 'undefined' !== typeof File && f instanceof File;\n\n debug('is stream: %s', isStream);\n debug('is file: %s', isFile);\n\n if (!isFile && !isStream) {\n // process file attributes like as `title`, `description`, ...\n for (k in f) {\n debug('add %o => %o', k, f[k]);\n if ('file' !== k) {\n param = 'attrs[' + i + '][' + k + ']';\n params.formData.push([param, f[k]]);\n }\n }\n // set file path\n f = f.file;\n f = 'string' === typeof f ? fs.createReadStream(f) : f;\n }\n\n params.formData.push(['media[]', f]);\n }\n\n return this.wpcom.req.post(params, query, null, fn);\n};\n\n/**\n * Add media files from URL\n *\n * @param {Object} [query]\n * @param {String|Array|Object} files\n * @param {Function} fn\n */\n\nMedia.prototype.addUrls = function (query, media, fn) {\n if ( undefined === fn ) {\n if ( undefined === media ) {\n media = query;\n query = {};\n } else if ( 'function' === typeof media ) {\n fn = media;\n media = query;\n query = {};\n }\n }\n\n var path = '/sites/' + this._sid + '/media/new';\n var body = { media_urls: [] };\n\n // process formData\n var i, m, url, k;\n\n media = Array.isArray(media) ? media : [ media ];\n for (i = 0; i < media.length; i++) {\n m = media[i];\n\n if ('string' === typeof m) {\n url = m;\n } else {\n if (!body.attrs) {\n body.attrs = [];\n }\n\n // add attributes\n body.attrs[i] = {};\n for (k in m) {\n if ('url' !== k) {\n body.attrs[i][k] = m[k];\n }\n }\n url = m[k];\n }\n\n // push url into [media_url]\n body.media_urls.push(url);\n }\n\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Delete media\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nMedia.prototype['delete'] = Media.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/media/' + this._id + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Media` module\n */\n\nmodule.exports = Media;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/media.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar Like = require('./like');\nvar Reblog = require('./reblog');\nvar Comment = require('./comment');\nvar debug = require('debug')('wpcom:post');\n\n/**\n * Post methods\n *\n * @param {String} id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Post(id, sid, wpcom) {\n if (!(this instanceof Post)) {\n return new Post(id, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n\n // set `id` and/or `slug` properties\n id = id || {};\n if ('object' !== typeof id) {\n this._id = id;\n } else {\n this._id = id.id;\n this._slug = id.slug;\n }\n}\n\n/**\n * Set post `id`\n *\n * @param {String} id\n * @api public\n */\n\nPost.prototype.id = function (id) {\n this._id = id;\n};\n\n/**\n * Set post `slug`\n *\n * @param {String} slug\n * @api public\n */\n\nPost.prototype.slug = function (slug) {\n this._slug = slug;\n};\n\n/**\n * Get post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.get = function (query, fn) {\n if (!this._id && this._slug) {\n return this.getBySlug(query, fn);\n }\n\n var path = '/sites/' + this._sid + '/posts/' + this._id;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Get post by slug\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.getBySlug = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/slug:' + this._slug;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Add post\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.add = function (query, body, fn) {\n if ( undefined === fn ) {\n if ( undefined === body ) {\n body = query;\n query = {};\n } else if ( 'function' === typeof body ) {\n fn = body;\n body = query;\n query = {};\n }\n }\n\n var path = '/sites/' + this._sid + '/posts/new';\n\n return this.wpcom.req.post(path, query, body)\n .then(data => {\n // update POST object\n this._id = data.ID;\n debug('Set post _id: %s', this._id);\n\n this._slug = data.slug;\n debug('Set post _slug: %s', this._slug);\n\n if ( 'function' === typeof fn ) {\n fn(null, data);\n } else {\n return Promise.resolve( data );\n }\n })\n .catch(err => {\n if ( 'function' === typeof fn ) {\n fn(err);\n } else {\n return Promise.reject( error );\n }\n });\n};\n\n/**\n * Edit post\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Delete post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.del =\nPost.prototype['delete'] = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Restore post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.restore = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/restore';\n return this.wpcom.req.put(path, query, null, fn);\n};\n\n/**\n * Get post likes list\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.likesList = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/likes';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Search within a site for related posts\n *\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.related = function (body, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._id + '/related';\n return this.wpcom.req.put(path, body, null, fn);\n};\n\n/**\n * Create a `Like` instance\n *\n * @api public\n */\n\nPost.prototype.like = function () {\n return new Like(this._id, this._sid, this.wpcom);\n};\n\n/**\n * Create a `Reblog` instance\n *\n * @api public\n */\n\nPost.prototype.reblog = function () {\n return new Reblog(this._id, this._sid, this.wpcom);\n};\n\n/**\n * Create a `Comment` instance\n *\n * @param {String} [cid] comment id\n * @api public\n */\n\nPost.prototype.comment = function (cid) {\n return new Comment(cid, this._id, this._sid, this.wpcom);\n};\n\n/**\n * Return recent comments\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nPost.prototype.comments = function (query, fn) {\n var comment = new Comment(null, this._id, this._sid, this.wpcom);\n return comment.replies(query, fn);\n};\n\n/**\n * Expose `Post` module\n */\n\nmodule.exports = Post;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/post.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:reblog');\n\n/**\n * Reblog methods\n *\n * @param {String} pid post id\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Reblog(pid, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!pid) {\n throw new Error('`post id` is not correctly defined');\n }\n\n if (!(this instanceof Reblog)) {\n return new Reblog(pid, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._pid = pid;\n this._sid = sid;\n}\n\n/**\n * Get your reblog status for a Post\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nReblog.prototype.mine =\nReblog.prototype.state = function (query, fn) {\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/mine';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Reblog a post\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nReblog.prototype.add = function (query, body, fn) {\n if ('function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n\n if (body && !body.destination_site_id) {\n return fn(new Error('destination_site_id is not defined'));\n }\n\n var path = '/sites/' + this._sid + '/posts/' + this._pid + '/reblogs/new';\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Reblog a post to\n * It's almost an alias of Reblogs#add\n *\n * @param {Number|String} dest site id destination\n * @param {String} [note]\n * @param {Function} fn\n * @api public\n */\n\nReblog.prototype.to = function (dest, note, fn) {\n if ( undefined === fn ) {\n if ( undefined === note ) {\n note = null;\n } else if ('function' === typeof note) {\n fn = note;\n note = null;\n }\n }\n\n return this.add({ note: note, destination_site_id: dest }, fn);\n};\n\n/**\n * Expose `Reblog` module\n */\n\nmodule.exports = Reblog;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/reblog.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar Post = require('./post');\nvar Category = require('./category');\nvar Tag = require('./tag');\nvar Media = require('./media');\nvar Comment = require('./comment');\nvar Follow = require('./follow');\nvar debug = require('debug')('wpcom:site');\n\n/**\n * Resources array\n * A list of endpoints with the same structure\n */\n\nvar resources = [\n 'categories',\n 'comments',\n 'follows',\n 'media',\n 'posts',\n 'shortcodes',\n 'embeds',\n [ 'pageTemplates', 'page-templates' ],\n [ 'stats', 'stats' ],\n [ 'statsClicks', 'stats/clicks' ],\n [ 'statsComments', 'stats/comments' ],\n [ 'statsCommentFollowers', 'stats/comment-followers' ],\n [ 'statsCountryViews', 'stats/country-views' ],\n [ 'statsFollowers', 'stats/followers' ],\n [ 'statsPublicize', 'stats/publicize' ],\n [ 'statsReferrers', 'stats/referrers' ],\n [ 'statsSearchTerms', 'stats/search-terms' ],\n [ 'statsStreak', 'stats/streak' ],\n [ 'statsSummary', 'stats/summary' ],\n [ 'statsTags', 'stats/tags' ],\n [ 'statsTopAuthors', 'stats/top-authors' ],\n [ 'statsTopPosts', 'stats/top-posts' ],\n [ 'statsVideoPlays', 'stats/video-plays' ],\n [ 'statsVisits', 'stats/visits' ],\n 'tags',\n 'users'\n];\n\n/**\n * Create a Site instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Site(id, wpcom) {\n if (!(this instanceof Site)) {\n return new Site(id, wpcom);\n }\n\n this.wpcom = wpcom;\n\n debug('set %o site id', id);\n this._id = encodeURIComponent(id);\n}\n\n/**\n * Require site information\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.get = function (query, fn) {\n return this.wpcom.req.get('/sites/' + this._id, query, fn);\n};\n\n/**\n * List method builder\n *\n * @param {String} subpath\n * @param {Function}\n * @api private\n */\n\nfunction list(subpath) {\n\n /**\n * Create and return the List method\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\n var listMethod = function (query, fn) {\n var path = '/sites/' + this._id + '/' + subpath;\n return this.wpcom.req.get(path, query, fn);\n };\n listMethod._publicAPI = true;\n return listMethod;\n}\n\n// walk for each resource and create related method\nvar i, res, isarr, name, subpath;\nfor (i = 0; i < resources.length; i++) {\n res = resources[i];\n isarr = Array.isArray(res);\n\n name = isarr ? res[0] : res + 'List';\n subpath = isarr ? res[1] : res;\n\n debug('adding method: %o - sub-path: %o - version: %s', ('site.' + name + '()'), subpath);\n Site.prototype[name] = list(subpath);\n}\n\n/**\n * :POST:\n * Create a `Post` instance\n *\n * @param {String} id\n * @api public\n */\n\nSite.prototype.post = function (id) {\n return new Post(id, this._id, this.wpcom);\n};\n\n/**\n * :POST:\n * Add a new blog post\n *\n * @param {Object} body\n * @param {Function} fn\n * @return {Post} new Post instance\n */\n\nSite.prototype.addPost = function (body, fn) {\n var post = new Post(null, this._id, this.wpcom);\n return post.add(body, fn);\n};\n\n/**\n * :POST:\n * Delete a blog post\n *\n * @param {String} id\n * @param {Function} fn\n * @return {Post} remove Post instance\n */\n\nSite.prototype.deletePost = function (id, fn) {\n var post = new Post(id, this._id, this.wpcom);\n return post.delete(fn);\n};\n\n/**\n * Create a `Media` instance\n *\n * @param {String} id\n * @api public\n */\n\nSite.prototype.media = function (id) {\n return new Media(id, this._id, this.wpcom);\n};\n\n/**\n * Add a media from a file\n *\n * @param {Object} [query]\n * @param {Array|String} files\n * @param {Function} fn\n * @return {Post} new Post instance\n */\n\nSite.prototype.addMediaFiles = function (query, files, fn) {\n var media = new Media(null, this._id, this.wpcom);\n return media.addFiles(query, files, fn);\n};\n\n/**\n * Add a new media from url\n *\n * @param {Object} [query]\n * @param {Array|String} files\n * @param {Function} fn\n * @return {Post} new Post instance\n */\n\nSite.prototype.addMediaUrls = function (query, files, fn) {\n var media = new Media(null, this._id, this.wpcom);\n return media.addUrls(query, files, fn);\n};\n\n/**\n * Delete a blog media\n *\n * @param {String} id\n * @param {Function} fn\n * @return {Post} removed Media instance\n */\n\nSite.prototype.deleteMedia = function (id, fn) {\n var media = new Media(id, this._id, this.wpcom);\n return media.del(fn);\n};\n\n/**\n * Create a `Comment` instance\n *\n * @param {String} id\n * @api public\n */\n\nSite.prototype.comment = function (id) {\n return new Comment(id, null, this._id, this.wpcom);\n};\n\n/**\n * Create a `Follow` instance\n *\n * @api public\n */\n\nSite.prototype.follow = function () {\n return new Follow(this._id, this.wpcom);\n};\n\n/**\n * Create a `Category` instance\n * Set `cat` alias\n *\n * @param {String} [slug]\n * @api public\n */\n\nSite.prototype.cat = Site.prototype.category = function (slug) {\n return new Category(slug, this._id, this.wpcom);\n};\n\n/**\n * Create a `Tag` instance\n *\n * @param {String} [slug]\n * @api public\n */\n\nSite.prototype.tag = function (slug) {\n return new Tag(slug, this._id, this.wpcom);\n};\n\n/**\n * Get a rendered shortcode for a site.\n *\n * Note: The current user must have publishing access.\n *\n * @param {String} url\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.renderShortcode = function (url, query, fn) {\n if ('string' !== typeof url) {\n throw new TypeError('expected a url String');\n }\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n query = query || {};\n query.shortcode = url;\n\n var path = '/sites/' + this._id + '/shortcodes/render';\n\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Get a rendered embed for a site.\n *\n * Note: The current user must have publishing access.\n *\n * @param {String} url\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.renderEmbed = function (url, query, fn) {\n if ('string' !== typeof url) {\n throw new TypeError('expected an embed String');\n }\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n query = query || {};\n query.embed_url = url;\n\n var path = '/sites/' + this._id + '/embeds/render';\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Mark a referrering domain as spam\n *\n * @param {String} domain\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsReferrersSpamNew = function (domain, fn) {\n var path = '/sites/' + this._id + '/stats/referrers/spam/new';\n var body = { domain: domain };\n\n return this.wpcom.req.post(path, body, null, fn);\n};\n\n/**\n * Remove referrering domain from spam\n *\n * @param {String} domain\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsReferrersSpamDelete = function (domain, fn) {\n var path = '/sites/' + this._id + '/stats/referrers/spam/delete';\n var body = { domain: domain };\n\n return this.wpcom.req.post(path, body, null, fn);\n};\n\n/**\n * Get detailed stats about a VideoPress video\n *\n * @param {String} videoId\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsVideo = function (videoId, query, fn) {\n var path = '/sites/' + this._id + '/stats/video/' + videoId;\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Get detailed stats about a particular post\n *\n * @param {String} postId\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nSite.prototype.statsPostViews = function (postId, query, fn) {\n var path = '/sites/' + this._id + '/stats/post/' + postId;\n\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Expose `Site` module\n */\n\nmodule.exports = Site;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/site.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:tag');\n\n/**\n * Tag methods\n *\n * @param {String} [slug]\n * @param {String} sid site id\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Tag(slug, sid, wpcom) {\n if (!sid) {\n throw new Error('`site id` is not correctly defined');\n }\n\n if (!(this instanceof Tag)) {\n return new Tag(slug, sid, wpcom);\n }\n\n this.wpcom = wpcom;\n this._sid = sid;\n this._slug = slug;\n}\n\n/**\n * Set tag `slug`\n *\n * @param {String} slug\n * @api public\n */\n\nTag.prototype.slug = function (slug) {\n this._slug = slug;\n};\n\n/**\n * Get tag\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype.get = function (query, fn) {\n var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n return this.wpcom.req.get(path, query, fn);\n};\n\n/**\n * Add tag\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype.add = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/tags/new';\n return this.wpcom.req.post(path, query, body, fn);\n};\n\n/**\n * Edit tag\n *\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype.update = function (query, body, fn) {\n var path = '/sites/' + this._sid + '/tags/slug:' + this._slug;\n return this.wpcom.req.put(path, query, body, fn);\n};\n\n/**\n * Delete tag\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nTag.prototype['delete'] = Tag.prototype.del = function (query, fn) {\n var path = '/sites/' + this._sid + '/tags/slug:' + this._slug + '/delete';\n return this.wpcom.req.del(path, query, fn);\n};\n\n/**\n * Expose `Tag` module\n */\n\nmodule.exports = Tag;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/tag.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('wpcom:users');\n\n/**\n * Create a `Users` instance\n *\n * @param {WPCOM} wpcom\n * @api public\n */\n\nfunction Users(wpcom) {\n if (!(this instanceof Users)) {\n return new Users(wpcom);\n }\n\n this.wpcom = wpcom;\n}\n\n/**\n * A list of @mention suggestions for the current user\n *\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nUsers.prototype.suggest = function (query, fn) {\n return this.wpcom.req.get('/users/suggest', query, fn);\n};\n\n/**\n * Expose `Users` module\n */\n\nmodule.exports = Users;\n\n\n/** WEBPACK FOOTER **\n ** ./lib/users.js\n **/","\n/**\n * Module dependencies.\n */\n\nvar sendRequest = require('./send-request');\nvar debug = require('debug')('wpcom:request');\n\n/**\n * Expose `Request` module\n */\n\n\nfunction Req(wpcom) {\n this.wpcom = wpcom;\n}\n\n/**\n * Request methods\n *\n * @param {Object|String} params\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nReq.prototype.get = function (params, query, fn) {\n // `query` is optional\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return sendRequest.call(this.wpcom, params, query, null, fn);\n};\n\n/**\n * Make `update` request\n *\n * @param {Object|String} params\n * @param {Object} [query]\n * @param {Object} body\n * @param {Function} fn\n * @api public\n */\n\nReq.prototype.post =\nReq.prototype.put = function (params, query, body, fn) {\n if (undefined === fn) {\n if (undefined === body) {\n body = query;\n query = {}\n } else if ( 'function' === typeof body) {\n fn = body;\n body = query;\n query = {};\n }\n }\n\n // params can be a string\n params = 'string' === typeof params ? { path : params } : params;\n\n // request method\n params.method = 'post';\n\n return sendRequest.call(this.wpcom, params, query, body, fn);\n};\n\n/**\n * Make a `delete` request\n *\n * @param {Object|String} params\n * @param {Object} [query]\n * @param {Function} fn\n * @api public\n */\n\nReq.prototype.del = function (params, query, fn) {\n if ('function' == typeof query) {\n fn = query;\n query = {};\n }\n\n return this.post(params, query, null, fn);\n};\n\n/**\n * Expose module\n */\n\nmodule.exports = Req;\n\n\n\n/** WEBPACK FOOTER **\n ** ./lib/util/request.js\n **/","module.exports = require(\"fs\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"fs\"\n ** module id = 17\n ** module chunks = 0\n **/","module.exports = require(\"qs\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"qs\"\n ** module id = 18\n ** module chunks = 0\n **/","module.exports = require(\"wpcom-xhr-request\");\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"wpcom-xhr-request\"\n ** module id = 19\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index caf2e15..9c733ba 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -23,5 +23,6 @@ module.exports = { }, resolve: { extensions: ['', '.js'] - } + }, + devtool: 'sourcemap' };